@uploadcare/file-uploader 1.26.3 → 1.27.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 +2 -2
- package/dist/index.d.ts +19 -1
- package/dist/index.js +4 -4
- package/dist/index.layered.css +2 -2
- package/dist/index.ssr.js +3 -1
- 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 +3 -3
- package/web/file-uploader.iife.min.d.ts +19 -1
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +19 -1
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.layered.min.css +2 -2
- package/web/uc-basic.min.css +2 -2
- 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 +19 -1
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +2 -2
- package/web/uc-file-uploader-inline.min.css +2 -2
- package/web/uc-file-uploader-inline.min.d.ts +19 -1
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.layered.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.d.ts +19 -1
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.layered.min.css +2 -2
- package/web/uc-file-uploader-regular.min.css +2 -2
- package/web/uc-file-uploader-regular.min.d.ts +19 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var UC=(function(exports){'use strict';/**
|
|
2
2
|
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.27.1 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-02-
|
|
5
|
+
* Built: 2026-02-16T22:57:40.561Z
|
|
6
6
|
*/
|
|
7
|
-
var ks=Object.defineProperty;var hl=Object.getOwnPropertyDescriptor;var a=(r,i)=>ks(r,"name",{value:i,configurable:true});var h=(r,i,t,e)=>{for(var o=e>1?void 0:e?hl(i,t):i,s=r.length-1,n;s>=0;s--)(n=r[s])&&(o=(e?n(i,t,o):n(o))||o);return e&&o&&ks(i,t,o),o};var xt=[],Zt=0,Ai=4,Ms=a(r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Zt+Ai;s<xt.length;)xt[s]===e?xt.splice(s,Ai):s+=Ai;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!xt.length;for(let n of i)xt.push(n,t.value,e,o);if(s){for(Zt=0;Zt<xt.length;Zt+=Ai)xt[Zt](xt[Zt+1],xt[Zt+2],xt[Zt+3]);xt.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t},"atom");function ki(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}a(ki,"listenKeys");function Jr(r,i,t){let e=ki(r,i,t);return t(r.value),e}a(Jr,"subscribeKeys");var to=a((r={})=>{let i=Ms(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i},"map");var z=class r{static{a(this,"PubSub");}static{this.De=new Map;}constructor(i,t){this.Q=i,this.pt=t;}get id(){return this.Q}pub(i,t){i in this.pt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.pt.setKey(i,t);}sub(i,t,e=true){return (e?Jr:ki)(this.pt,[i],s=>{t(s[i]);})}read(i){return i in this.pt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.pt.get()[i]}add(i,t,e=false){(!(i in this.pt.get())||e)&&this.pt.setKey(i,t);}has(i){return i in this.pt.get()}get store(){return this.pt.get()}static registerCtx(i,t){if(r.De.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=to(i);return r.De.set(t,e),new r(t,e)}static deleteCtx(i){r.De.delete(i);}static getCtx(i){let t=r.De.get(i);return t?new r(i,t):null}static hasCtx(i){return r.De.has(i)}};var Mi=globalThis,Ii=Mi.ShadowRoot&&(Mi.ShadyCSS===void 0||Mi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Is=Symbol(),Os=new WeakMap,Oi=class{static{a(this,"n");}constructor(i,t,e){if(this.Nl=true,e!==Is)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(Ii&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Os.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Os.set(t,i));}return i}toString(){return this.cssText}},Ls=a(r=>new Oi(typeof r=="string"?r:r+"",void 0,Is),"r");var Us=a((r,i)=>{if(Ii)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Mi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},"S"),eo=Ii?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Ls(t)})(r):r;var{is:fl,defineProperty:gl,getOwnPropertyDescriptor:vl,getOwnPropertyNames:yl,getOwnPropertySymbols:bl,getPrototypeOf:wl}=Object,Li=globalThis,Rs=Li.trustedTypes,Tl=Rs?Rs.emptyScript:"",El=Li.reactiveElementPolyfillSupport,Ye=a((r,i)=>r,"d"),Qe={toAttribute(r,i){switch(i){case Boolean:r=r?Tl:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},Ui=a((r,i)=>!fl(r,i),"f"),Ps={attribute:true,type:String,converter:Qe,reflect:false,useDefault:false,hasChanged:Ui};Symbol.metadata??=Symbol("metadata"),Li.litPropertyMetadata??=new WeakMap;var _t=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.yr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.gi&&[...this.gi.keys()]}static createProperty(i,t=Ps){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(),o=this.getPropertyDescriptor(i,e,t);o!==void 0&&gl(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=vl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let l=o?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Ps}static yr(){if(this.hasOwnProperty(Ye("elementProperties")))return;let i=wl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ye("finalized")))return;if(this.finalized=true,this.yr(),this.hasOwnProperty(Ye("properties"))){let t=this.properties,e=[...yl(t),...bl(t)];for(let o of e)this.createProperty(o,t[o]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,o]of t)this.elementProperties.set(e,o);}this.gi=new Map;for(let[t,e]of this.elementProperties){let o=this.br(t,e);o!==void 0&&this.gi.set(o,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 o of e)t.unshift(eo(o));}else i!==void 0&&t.push(eo(i));return t}static br(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ce=null,this._l();}_l(){this.wr=new Promise(i=>this.enableUpdating=i),this.jt=new Map,this.Bl(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Fe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Fe?.delete(i);}Bl(){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 Us(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Fe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Fe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Tr(i,e);}zl(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.br(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:Qe).toAttribute(t,e.type);this.ce=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.ce=null;}}Tr(i,t){let e=this.constructor,o=e.gi.get(i);if(o!==void 0&&this.ce!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Qe;this.ce=o;let l=n.fromAttribute(t,s.type);this[o]=l??this.Er?.get(o)??l,this.ce=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let n=this.constructor;if(o===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Ui)(s,t)||e.useDefault&&e.reflect&&s===this.Er?.get(i)&&!this.hasAttribute(n.br(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.wr=this.Hl());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.Er??=new Map).has(i)&&(this.Er.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.jt.has(i)||(this.hasUpdated||e||(t=void 0),this.jt.set(i,t)),o===true&&this.ce!==i&&(this.gs??=new Set).add(i));}async Hl(){this.isUpdatePending=true;try{await this.wr;}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[o,s]of this.vi)this[o]=s;this.vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,l=this[o];n!==true||this.jt.has(o)||l===void 0||this.C(o,void 0,s,l);}}let i=false,t=this.jt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Fe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.xr();}catch(e){throw i=false,this.xr(),e}i&&this.jl(t);}willUpdate(i){}jl(i){this.Fe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}xr(){this.jt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.wr}shouldUpdate(i){return true}update(i){this.gs&&=this.gs.forEach(t=>this.zl(t,this[t])),this.xr();}updated(i){}firstUpdated(i){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Ye("elementProperties")]=new Map,_t[Ye("finalized")]=new Map,El?.({ReactiveElement:_t}),(Li.reactiveElementVersions??=[]).push("2.1.2");var ro=globalThis,$s=a(r=>r,"i"),Ri=ro.trustedTypes,Ds=Ri?Ri.createPolicy("lit-html",{createHTML:a(r=>r,"createHTML")}):void 0,oo="$lit$",Nt=`lit$${Math.random().toFixed(9).slice(2)}$`,so="?"+Nt,xl=`<${so}>`,pe=document,ti=a(()=>pe.createComment(""),"c"),ei=a(r=>r===null||typeof r!="object"&&typeof r!="function","a"),no=Array.isArray,zs=a(r=>no(r)||typeof r?.[Symbol.iterator]=="function","d"),io=`[ \f\r]`,Je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fs=/-->/g,Vs=/>/g,ue=RegExp(`>|${io}(?:([^\\s"'>=/]+)(${io}*=${io}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),_s=/'/g,Ns=/"/g,Hs=/^(?:script|style|textarea|title)$/i,ao=a(r=>(i,...t)=>({Kt:r,strings:i,values:t}),"x"),y=ao(1);ao(2);ao(3);var tt=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Bs=new WeakMap,de=pe.createTreeWalker(pe,129);function js(r,i){if(!no(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ds!==void 0?Ds.createHTML(i):i}a(js,"V");var Ks=a((r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=Je;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,m=0;for(;m<c.length&&(n.lastIndex=m,p=n.exec(c),p!==null);)m=n.lastIndex,n===Je?p[1]==="!--"?n=Fs:p[1]!==void 0?n=Vs:p[2]!==void 0?(Hs.test(p[2])&&(o=RegExp("</"+p[2],"g")),n=ue):p[3]!==void 0&&(n=ue):n===ue?p[0]===">"?(n=o??Je,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?ue:p[3]==='"'?Ns:_s):n===Ns||n===_s?n=ue:n===Fs||n===Vs?n=Je:(n=ue,o=void 0);let f=n===ue&&r[l+1].startsWith("/>")?" ":"";s+=n===Je?c+xl:d>=0?(e.push(u),c.slice(0,d)+oo+c.slice(d)+Nt+f):c+Nt+(d===-2?l:f);}return [js(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ii=class r{static{a(this,"S");}constructor({strings:i,Kt:t},e){let o;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=Ks(i,t);if(this.el=r.createElement(u,e),de.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(o=de.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(oo)){let m=p[n++],f=o.getAttribute(d).split(Nt),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?$i:v[1]==="?"?Di:v[1]==="@"?Fi:me}),o.removeAttribute(d);}else d.startsWith(Nt)&&(c.push({type:6,index:s}),o.removeAttribute(d));if(Hs.test(o.tagName)){let d=o.textContent.split(Nt),m=d.length-1;if(m>0){o.textContent=Ri?Ri.emptyScript:"";for(let f=0;f<m;f++)o.append(d[f],ti()),de.nextNode(),c.push({type:2,index:++s});o.append(d[m],ti());}}}else if(o.nodeType===8)if(o.data===so)c.push({type:2,index:s});else {let d=-1;for(;(d=o.data.indexOf(Nt,d+1))!==-1;)c.push({type:7,index:s}),d+=Nt.length-1;}s++;}}static createElement(i,t){let e=pe.createElement("template");return e.innerHTML=i,e}};function he(r,i,t=r,e){if(i===tt)return i;let o=e!==void 0?t.Kl?.[e]:t.Gl,s=ei(i)?void 0:i.Cr;return o?.constructor!==s&&(o?.vs?.(false),s===void 0?o=void 0:(o=new s(r),o.Sr(r,t,e)),e!==void 0?(t.Kl??=[])[e]=o:t.Gl=o),o!==void 0&&(i=he(r,o.ql(r,i.values),o,e)),i}a(he,"M");var Pi=class{static{a(this,"R");}constructor(i,t){this.ys=[],this.mt=void 0,this.bs=i,this.c=t;}get parentNode(){return this.c.parentNode}get W(){return this.c.W}u(i){let{el:{content:t},parts:e}=this.bs,o=(i?.creationScope??pe).importNode(t,true);de.currentNode=o;let s=de.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new ke(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Vi(s,this,i)),this.ys.push(u),c=e[++l];}n!==c?.index&&(s=de.nextNode(),n++);}return de.currentNode=pe,o}p(i){let t=0;for(let e of this.ys)e!==void 0&&(e.strings!==void 0?(e.gt(i,e,t),t+=e.strings.length-2):e.gt(i[t])),t++;}},ke=class r{static{a(this,"k");}get W(){return this.c?.W??this.Ts}constructor(i,t,e,o){this.type=2,this.i=P,this.mt=void 0,this.St=i,this.ue=t,this.c=e,this.options=o,this.Ts=o?.isConnected??true;}get parentNode(){let i=this.St.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.St}get endNode(){return this.ue}gt(i,t=this){i=he(this,i,t),ei(i)?i===P||i==null||i===""?(this.i!==P&&this.de(),this.i=P):i!==this.i&&i!==tt&&this.Es(i):i.Kt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):zs(i)?this.k(i):this.Es(i);}O(i){return this.St.parentNode.insertBefore(i,this.ue)}T(i){this.i!==i&&(this.de(),this.i=this.O(i));}Es(i){this.i!==P&&ei(this.i)?this.St.nextSibling.data=i:this.T(pe.createTextNode(i)),this.i=i;}$(i){let{values:t,Kt:e}=i,o=typeof e=="number"?this.Wl(i):(e.el===void 0&&(e.el=ii.createElement(js(e.h,e.h[0]),this.options)),e);if(this.i?.bs===o)this.i.p(t);else {let s=new Pi(o,this),n=s.u(this.options);s.p(t),this.T(n),this.i=s;}}Wl(i){let t=Bs.get(i.strings);return t===void 0&&Bs.set(i.strings,t=new ii(i)),t}k(i){no(this.i)||(this.i=[],this.de());let t=this.i,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(ti()),this.O(ti()),this,this.options)):e=t[o],e.gt(s),o++;o<t.length&&(this.de(e&&e.ue.nextSibling,o),t.length=o);}de(i=this.St.nextSibling,t){for(this.yi?.(false,true,t);i!==this.ue;){let e=$s(i).nextSibling;$s(i).remove(),i=e;}}setConnected(i){this.c===void 0&&(this.Ts=i,this.yi?.(i));}},me=class{static{a(this,"H");}get tagName(){return this.element.tagName}get W(){return this.c.W}constructor(i,t,e,o,s){this.type=1,this.i=P,this.mt=void 0,this.element=i,this.name=t,this.c=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.i=Array(e.length-1).fill(new String),this.strings=e):this.i=P;}gt(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=he(this,i,t,0),n=!ei(i)||i!==this.i&&i!==tt,n&&(this.i=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=he(this,l[e+c],t,c),u===tt&&(u=this.i[c]),n||=!ei(u)||u!==this.i[c],u===P?i=P:i!==P&&(i+=(u??"")+s[c+1]),this.i[c]=u;}n&&!o&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},$i=class extends me{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},Di=class extends me{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},Fi=class extends me{static{a(this,"z");}constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}gt(i,t=this){if((i=he(this,i,t,0)??P)===tt)return;let e=this.i,o=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.i=i;}handleEvent(i){typeof this.i=="function"?this.i.call(this.options?.host??this.element,i):this.i.handleEvent(i);}},Vi=class{static{a(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.mt=void 0,this.c=t,this.options=e;}get W(){return this.c.W}gt(i){he(this,i);}},Gs={I:ke},Cl=ro.litHtmlPolyfillSupport;Cl?.(ii,ke),(ro.litHtmlVersions??=[]).push("3.3.2");var qs=a((r,i,t)=>{let e=t?.renderBefore??i,o=e.Zl;if(o===void 0){let s=t?.renderBefore??null;e.Zl=o=new ke(i.insertBefore(ti(),s),s,void 0,t??{});}return o.gt(r),o},"D");var lo=globalThis,yt=class extends _t{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.Ar=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.Ar=qs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Ar?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Ar?.setConnected(false);}render(){return tt}};yt.rp=true,yt.finalized=true,lo.litElementHydrateSupport?.({LitElement:yt});var Sl=lo.litElementPolyfillSupport;Sl?.({LitElement:yt});(lo.litElementVersions??=[]).push("4.2.2");var Al=/\\([0-9a-fA-F]{1,6} ?)/g;function kl(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}a(kl,"hasLeadingTrailingQuotes");function Ml(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(Ml,"trimQuotes");function Ol(r){let i="",t="";for(let e=0;e<r.length;e++){let o=r[e+1];r[e]==="\\"&&o==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}a(Ol,"escapeQuotes");function Ws(r){let i=r;kl(r)&&(i=Ml(i),i=i.replace(Al,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Ol(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(Ws,"parseCssPropertyValue");function Me(r){class i extends r{constructor(){super(...arguments);this.xs=null;this.kr=null;}static{a(this,"CssDataMixinClass");}getCssData(o,s=false){let n=this.xs??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.kr||(this.kr=window.getComputedStyle(this));let l=this.kr.getPropertyValue(o).trim();try{n[o]=Ws(l);}catch(c){s||console.warn(`CSS Data error: ${o}`,c),n[o]=null;}}return this.xs=n,n[o]}}return i}a(Me,"CssDataMixin");function _i(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Gt={};this.qt=null;this.bi=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.qt||(this.qt=Array.from(this.childNodes)),super.connectedCallback();}Xl(){if(this.bi)return;this.bi=true,this.Gt={};let o=Array.from(this.childNodes),s=o.length?o:this.qt??[];for(let n of s){let l=this.Cs(n),c=this.Gt[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Gt[l]=c;}this.qt=null;}Cs(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Cs(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}Yl(o){return !o.textContent||!o.textContent.trim()}Ql(o){let s=this.Gt[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Yl(n))}update(o){!this.hasUpdated&&this.willYield&&this.Xl(),super.update(o);}yield(o,s){if(o===""&&!this.Gt[o]&&!this.bi&&this.qt?.length){let l=[];for(let c of this.qt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Gt[o]=l,this.bi=true,this.qt=null;}let n=this.Gt[o];return y` ${n} ${this.Ql(o)?s:void 0} `}}return i}a(_i,"LightDomMixin");function Oe(r){class i extends r{static{a(this,"RegisterableElementMixinClass");}static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&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,o);}}return i}a(Oe,"RegisterableElementMixin");var Xt=class extends Event{static{a(this,"s");}constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Ie=class{static{a(this,"s");}constructor(i,t,e,o){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=o??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Xt(this.context,this.host,this.t,this.subscribe));}};var Ni=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var co=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Le=class extends Ni{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Xt(this.context,l,n,true)));o.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 co(this.context,this.host));}};var Ll={attribute:true,type:String,converter:Qe,reflect:false,hasChanged:Ui},Ul=a((r=Ll,i,t)=>{let{kind:e,metadata:o}=t,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),s.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,r,true,l);},init(l){return l!==void 0&&this.C(n,void 0,r,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,r,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(r){return (i,t)=>typeof t=="object"?Ul(r,i,t):((e,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}a(b,"n");function g(r){return b({...r,state:true,attribute:false})}a(g,"r");function D(r,i){let t,e=a(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var Zs="ctx-name-context";function zi(){return function(r){class i extends r{constructor(...o){super(...o);this.J=null;this.Ve=false;this.Mr=false;this.Or=void 0;this.pe=new Map;this.Ne=new Set;this.init$={};this.ctxOwner=false;this.wi=void 0;this.Ti=false;this.ctxName=this.Rt;this.Pt=false;this.wi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Rt,this.Jl=new Ie(this,{context:Zs,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.ks=s,this.As();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}static set template(o){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 Ss(){return this.wi}set Ss(o){let s=o??void 0;this.wi!==s&&(this.wi=s,this.As());}shouldUpdate(o){return this.Pt?super.shouldUpdate(o):false}get Rt(){return this.Ss||this.ks||void 0}As(){if(this.ctxName=this.Rt,!(!this.ctxName||this.Ve)){if(this.isConnected){this.Ir();return}this.Ti=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Rt,this.ctxName&&(this.Or?this.Or.setValue(this.ctxName):this.Or=new Le(this,{context:Zs,initialValue:this.ctxName}));}Ms(){if(!(!this.J||this.pe.size===0)){for(let[o,{value:s,rewrite:n}]of this.pe)this.J.add(o,s,n);this.pe.clear();}}Os(){return !this.J&&this.Rt&&this.Lr(),this.J&&this.Ms(),this.J}Ei(){let o=this.Os();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}Lr(){let o=this.init$,s=this.Rt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.J){this.J=z.getCtx(s)??z.registerCtx(o,s);for(let[n,l]of Object.entries(this.init$))this.J.add(n,l,this.ctxOwner);this.Ms();}}get $(){return this.Rt&&this.Lr(),new Proxy({},{get:a((o,s)=>{if(typeof s=="string")return this.J?.read(s)},"get"),set:a((o,s,n)=>(typeof s!="string"||this.J?.pub(s,n),true),"set")})}sub(o,s,n=true){let l=this.Ei().sub(o,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Ne.delete(p));},"trackedRemove");return this.Ne.add(p),p}pub(o,s){this.Ei().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.Ei()}has(o){return this.J?.has(o)??false}add(o,s,n=false){let l=this.Os();if(!l){if(!n&&this.pe.has(o))return;this.pe.set(o,{value:s,rewrite:n});return}this.pe.delete(o),l.add(o,s,n);}add$(o,s=false){for(let[n,l]of Object.entries(o))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Ve?this.Pt&&this.Mr&&(this.Mr=false,this.initCallback()):this.ctxName?(this.Ti=false,this.Ir()):this.Ti&&this.Rt&&(this.Ti=false,this.Ir());}Ir(){if(this.Ve)return;this.Ve=true,this.Lr();let o=this.init$;if(Object.keys(o).length>0){let s=this.Ei();for(let[n,l]of Object.entries(o))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Pt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.tc(),super.disconnectedCallback(),this.Ve&&(this.Mr=true);}tc(){if(this.Ne.size!==0){for(let o of [...this.Ne])o();this.Ne.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Ss",1),h([g()],i.prototype,"ks",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Pt",2),i}}a(zi,"SymbioteMixin");var uo=class extends Oe(zi()(Me(_i(yt)))){static{a(this,"BaseComponent");}};var ut=class r{static{a(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var Rl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function po(r){for(let i in r){if(Rl.includes(i))continue;let t=[...i].reduce((e,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),e+=o,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}a(po,"defineComponents");var ho="UC";function Pl(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[ho]){t(window[ho]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[ho];i&&po(s),t(s);},document.head.appendChild(o);})}a(Pl,"loadFileUploaderFrom");var ri={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var mo=new Map,Xs=new Map,Ys=a((r,i)=>{mo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...ri,...i};return mo.set(r,t),t},"defineLocaleSync"),$l=a((r,i)=>{Xs.set(r,i);},"defineLocaleAsync"),Qs=a((r,i)=>{typeof i=="function"?$l(r,i):Ys(r,i);},"defineLocale"),Js=a(async r=>{let i=mo.get(r);if(!i){let t=Xs.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Ys(r,e);}return i},"resolveLocaleDefinition");Qs("en",ri);var U=a(r=>`*cfg/${r}`,"sharedConfigKey");var lt=a(r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Bt=a(r=>r.join(","),"serializeCsv");var tn=a(r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Hi=a((...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>tn(i)).join("/-/"),"joinCdnOperations"),et=a((...r)=>{let i=Hi(...r);return i?`-/${i}/`:""},"createCdnUrlModifiers");function ji(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),o=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):o>=0&&(s=t.slice(o+1)),s}a(ji,"extractFilename");function Ki(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}a(Ki,"extractUuid");function fo(r){let i=en(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(fo,"extractCdnUrlModifiers");function go(r){return fo(r).split("/-/").filter(Boolean).map(t=>tn(t))}a(go,"extractOperations");function en(r){let i=new URL(r),t=ji(r),e=rn(t)?on(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(en,"trimFilename");function rn(r){return r.startsWith("http")}a(rn,"isFileUrl");function on(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(on,"splitFileUrl");var G=a((r,i,t)=>{let e=new URL(en(r)),o=t??ji(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&rn(o)){let n=on(o);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},"createCdnUrl"),Yt=a((r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var q=a((r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var oi=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}),nn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Dl(r,i){if(typeof i=="number"){let t=i;return oi[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return oi[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return oi.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}a(Dl,"transformationToStr");function Qt(r){return Hi(...nn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Dl(i,t)}).filter(i=>!!i))}a(Qt,"transformationsToOperations");var Gi=Hi("format/auto","progressive/yes"),zt=a(([r])=>typeof r<"u"?Number(r):void 0,"asNumber"),sn=a(()=>true,"asBoolean"),Fl=a(([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),"asFilter"),Vl=a(([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:q(r,"x").map(Number),coords:q(i).map(Number)}},"asCrop"),_l=Object.freeze({enhance:zt,brightness:zt,exposure:zt,gamma:zt,contrast:zt,saturation:zt,vibrance:zt,warmth:zt,filter:Fl,mirror:sn,flip:sn,rotate:zt,crop:a(r=>{let[i,t]=r,{dimensions:e,coords:o}=Vl([i,t]);return {dimensions:e,coords:o}},"crop")});function vo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!nn.includes(e))continue;let s=e,n=_l[s];try{let l=n(o);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(vo,"operationsToTransformations");var _=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),it=Object.freeze([_.CROP,_.TUNING,_.FILTERS]),an=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),ln=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"]),cn=Object.freeze(["rotate","mirror","flip"]),Ht=oi,Ct=Object.freeze({brightness:{zero:Ht.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Ht.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Ht.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Ht.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Ht.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Ht.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Ht.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Ht.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Ht.filter,range:[0,100],keypointsNumber:1}});var si="https://ucarecdn.com",Nl="https://upload.uploadcare.com",Bl="https://social.uploadcare.com",zl="https://ucarecd.net",Hl={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:"",cloudImageEditorTabs:Bt(it),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:si,cdnCnamePrefixed:zl,baseUrl:Nl,socialBaseUrl:Bl,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,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true},Y=Object.freeze(Hl);var qi=a((r,i)=>(...t)=>{let e=r();if(!e.read(U("debug")))return;let o=t;if(typeof t?.[0]=="function"){let n=t[0];o=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);},"createDebugPrinter");var Q=class{constructor(i){this.Ur=new Set;this.Wt=null;this.z=qi(()=>this.r.ctx,this.constructor.name);this.r=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.Ur.add(i);}get he(){if(!this.Wt){let i={};this.Wt=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let o=U(e);return this.r.ctx.has(o)?this.r.ctx.read(o):Y[e]},"get")});}return this.Wt}destroy(){for(let i of this.Ur)try{i();}catch{}this.Ur.clear();}},It=a((r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),un=a(r=>({get ctx(){return r()},get modalManager(){return It(r(),"*modalManager",false)},get telemetryManager(){return It(r(),"*telemetryManager")},get localeManager(){return It(r(),"*localeManager")},get a11y(){return It(r(),"*a11y")},get blocksRegistry(){return It(r(),"*blocksRegistry")},get eventEmitter(){return It(r(),"*eventEmitter")},get uploadCollection(){return It(r(),"*uploadCollection")},get secureUploadsManager(){return It(r(),"*secureUploadsManager",false)},get api(){return It(r(),"*publicApi")},get validationManager(){return It(r(),"*validationManager")}}),"createSharedInstancesBag");var W=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Wi=class extends Q{constructor(){super(...arguments);this.Zt=new Map;this.vt=new Set;this.w=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.Zt.set(t,e),this.K(W.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Zt.get(t);return e?(this.Zt.delete(t),this.vt.delete(t),this.K(W.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Zt.get(t);return e?(this.vt.add(t),this.K(W.OPEN,{modal:e,id:t}),true):(this.z(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Zt.get(t);return !e||!this.vt.has(t)?(this.z(`Modal with ID "${t}" not found or not active`),false):(this.vt.delete(t),this.K(W.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Zt.has(t)?this.vt.has(t)?this.close(t):this.open(t):(this.z(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.vt.size>0}back(){if(this.vt.size===0)return this.z("No active modals to go back from"),false;let t=Array.from(this.vt).pop();return t?this.close(t):false}closeAll(){let t=this.vt.size;return this.vt.clear(),this.K(W.CLOSE_ALL,{}),t}subscribe(t,e){return this.w.has(t)||this.w.set(t,new Set),this.w.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.w.has(t)&&this.w.get(t)?.delete(e);}K(t,e){if(this.w.has(t))for(let o of this.w.get(t)??new Set)try{o(e);}catch(s){this.r.telemetryManager.sendEventError(s,"modal subscriber"),this.z("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Zt.clear(),this.w.clear(),this.K(W.DESTROY,{});}};var ni=a(r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function dn(r){return Object.prototype.toString.call(r)==="[object Object]"}a(dn,"isObject");var jl=/\W|_/g;function Kl(r){return r.split(jl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(Kl,"camelizeString");function pn(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Kt(t,{ignoreKeys:i})):r}a(pn,"camelizeArrayItems");function Kt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return pn(r,{ignoreKeys:i});if(!dn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}dn(o)?o=Kt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=pn(o,{ignoreKeys:i})),t[Kl(e)]=o;}return t}a(Kt,"camelizeKeys");var Gl=a(r=>new Promise(i=>setTimeout(i,r)),"delay");function Co({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:o=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:s,integration:o});let n=[r,i,e].filter(Boolean).join("/"),l=[s,o].filter(Boolean).join("; ");return `${n} (${l})`}a(Co,"getUserAgent$1");var ql={factor:2,time:100};function Wl(r,i=ql){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a(l=>Gl(l??s).then(()=>(t+=1,e(o))),"retry")})}return a(e,"runAttempt"),e(r)}a(Wl,"retrier");var fe=class extends Error{static{a(this,"UploadcareError");}},Ue=class r extends fe{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Zi=a((r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),Jt=class r extends fe{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Zl=500,mn=a(({check:r,interval:i=Zl,timeout:t,signal:e})=>new Promise((o,s)=>{let n,l;Zi(e,()=>{n&&clearTimeout(n),s(new Jt("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new Jt("Timed out"));},t));let c=a(()=>{try{Promise.resolve(r(e)).then(u=>{u?(l&&clearTimeout(l),o(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),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"},Xi="application/octet-stream",fn="original",ee=a(({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=r?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",Zi(o,()=>{p=true,c.abort(),l(new Jt);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(T){let C=T.split(": "),x=C.shift(),A=C.join(": ");x&&typeof x<"u"&&(f[x]=A);});let v=c.response,w=c.status;n({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new Ue(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function Xl(r,...i){return r}a(Xl,"identity");var Yl=a(({name:r})=>r?[r]:[],"getFileOptions"),Ql=Xl,Jl=a(()=>new FormData,"getFormData"),gn=a(r=>false,"isBuffer"),Yi=a(r=>typeof Blob<"u"&&r instanceof Blob,"isBlob"),Qi=a(r=>typeof File<"u"&&r instanceof File,"isFile"),Ji=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),Re=a(r=>Yi(r)||Qi(r)||gn()||Ji(r),"isFileData"),tc=a(r=>typeof r=="string"||typeof r=="number"||typeof r>"u","isSimpleValue"),ec=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),ic=a(r=>!!r&&typeof r=="object"&&"data"in r&&Re(r.data),"isFileValue");function vn(r,i,t){if(Array.isArray(t))for(let e of t)vn(r,`${i}[]`,e);else if(ic(t)){let{name:e,contentType:o}=t,s=Ql(t.data,e,o??Xi),n=Yl({name:e,contentType:o});r.push([i,s,...n]);}else if(ec(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else tc(t)&&t&&r.push([i,t.toString()]);}a(vn,"collectParams");function rc(r){let i=[];for(let[t,e]of Object.entries(r))vn(i,t,e);return i}a(rc,"getFormDataParams");function tr(r){let i=Jl(),t=rc(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}a(tr,"buildFormData");var rt=class r extends fe{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},oc=a(r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),jt=a((r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=oc(t)),e.toString()},"getUrl"),sc="6.18.4",nc="UploadcareUploadClient",ac=sc;function ve(r){return Co({libraryName:nc,libraryVersion:ac,...r})}a(ve,"getUserAgent");var lc="RequestThrottledError",hn=15e3,cc=1e3;function uc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return hn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:hn}a(uc,"getTimeoutFromThrottledRequest");function ie(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Wl(({attempt:o,retry:s})=>r().catch(n=>{if("response"in n&&n?.code===lc&&o<t)return s(uc(n));if(n instanceof Ue&&o<e)return s((o+1)*cc);throw n}))}a(ie,"retryIfFailed");var yn=a(r=>{let i="";return (Yi(r)||Qi(r)||Ji(r))&&(i=r.type),i||Xi},"getContentType"),bn=a(r=>{let i="";return Qi(r)&&r.name?i=r.name:Yi(r)||gn()?i="":Ji(r)&&r.name&&(i=r.name),i||fn},"getFileName");function So(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}a(So,"getStoreValue");function dc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=R.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",url:jt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},data:tr({file:{data:r,name:t||bn(r),contentType:e||yn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:So(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(dc,"base");var wo;(function(r){r.Token="token",r.FileInfo="file_info";})(wo||(wo={}));function pc(r,{publicKey:i,baseURL:t=R.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},url:jt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:So(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(pc,"fromUrl");var ct;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ct||(ct={}));var hc=a(r=>"status"in r&&r.status===ct.Error,"isErrorResponse");function mc(r,{publicKey:i,baseURL:t=R.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}={}){return ie(()=>ee({method:"GET",headers:i?{"X-UC-User-Agent":ve({publicKey:i,integration:o,userAgent:s})}:void 0,url:jt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Kt(JSON.parse(c));if("error"in d&&!hc(d))throw new rt(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(mc,"fromUrlStatus");function fc(r,{publicKey:i,baseURL:t=R.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=R.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:c,userAgent:u})},url:jt(t,"/group/",{jsonerrors:1}),data:tr({files:r,callback:e,pub_key:i,signature:o,expire:s,source:l}),signal:n}).then(({data:m,headers:f,request:v})=>{let w=Kt(JSON.parse(m));if("error"in w)throw new rt(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(fc,"group");function wn(r,{publicKey:i,baseURL:t=R.baseURL,signal:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=R.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"GET",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:s,userAgent:n})},url:jt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=Kt(JSON.parse(u));if("error"in m)throw new rt(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(wn,"info");function gc(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=R.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",url:jt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},data:tr({filename:e||fn,size:r,content_type:t||Xi,part_size:o,UPLOADCARE_STORE:So(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A.parts=Object.keys(A.parts).map(gt=>A.parts[Number(gt)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}a(gc,"multipartStart");function vc(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=R.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Xi}}).then(l=>(o&&o({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(vc,"multipartUpload");function yc(r,{publicKey:i,baseURL:t=R.baseURL,source:e="local",signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=R.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"POST",url:jt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:s,userAgent:n})},data:tr({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:u,headers:p,request:d})=>{let m=Kt(JSON.parse(u));if("error"in m)throw new rt(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(yc,"multipartComplete");function Ao(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return mn({check:a(p=>wn(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(Ao,"isReadyPoll");function bc(r){return "defaultEffects"in r}a(bc,"isGroupFileInfo");var ge=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=R.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=jt(t,`${o}/`),l=s?jt(`https://${s}.s3.amazonaws.com/`,`${o}/${i.filename}`):null;this.uuid=o,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,bc(i)&&(this.defaultEffects=i.defaultEffects);}},wc=a((r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>dc(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:C})=>Ao(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new ge(C,{baseCDN:w})),"uploadDirect"),Tc=a((r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>wn(r,{publicKey:i,baseURL:e,signal:o,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(m=>new ge(m,{baseCDN:d,fileName:t})).then(m=>(s&&s({isComputable:true,value:1}),m)),"uploadFromUploaded"),Ec=a((r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=a(n=>()=>{e=n,o.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return Zi(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),xc=window.WebSocket,To=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Cc=a((r,i)=>r==="success"?{status:ct.Success,...i}:r==="progress"?{status:ct.Progress,...i}:{status:ct.Error,...i},"response"),Eo=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new To;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 xc(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,Cc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}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(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},yo=null,ko=a(r=>{if(!yo){let i=typeof window>"u"?0:3e4;yo=new Eo(r,i);}return yo},"getPusher"),Sc=a(r=>{ko(r).connect();},"preconnect");function Ac({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return mn({check:a(u=>mc(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ct.Error:return new rt(p.error,p.errorCode);case ct.Waiting:return false;case ct.Unknown:return new rt(`Token "${r}" was not found.`);case ct.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ct.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(Ac,"pollStrategy");var kc=a(({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=ko(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(r);},"destroy");Zi(t,()=>{c(),s(new Jt("pusher cancelled"));}),n.subscribe(r,u=>{switch(u.status){case ct.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ct.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),o(u);break}case ct.Error:c(),s(new rt(u.msg,u.error_code));}});}),"pushStrategy"),Mc=a((r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=R.pusherKey,metadata:C})=>Promise.resolve(Sc(T)).then(()=>pc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(x=>(ko(T)?.disconnect(),Promise.reject(x))).then(x=>x.type===wo.FileInfo?x:Ec([({signal:A})=>Ac({token:x.token,publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:A}),({signal:A})=>kc({token:x.token,pusherKey:T,signal:A,onProgress:d})],{signal:p})).then(x=>{if(x instanceof rt)throw x;return x}).then(x=>Ao(x.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(x=>new ge(x,{baseCDN:o})),"uploadFromUrl"),bo=new WeakMap,Oc=a(async r=>{if(bo.has(r))return bo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return bo.set(r,i),i},"getBlobFromReactNativeAsset"),Tn=a(async r=>{if(Qi(r)||Yi(r))return r.size;if(Ji(r))return (await Oc(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Ic=a((r,i=R.multipartMinFileSize)=>r>=i,"isMultipart"),En=a(r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Re(r)&&t.test(r)},"isUuid"),Mo=a(r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Re(r)&&t.test(r)},"isUrl"),Lc=a((r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(o[u]=d,n-=1,n?c():t(o));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<r;u++)c();}),"runWithConcurrency"),Uc=a((r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},"sliceChunk"),Rc=a(async(r,i,t)=>e=>Uc(r,e,i,t),"prepareChunks"),Pc=a((r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>vc(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),$c=a(async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=R.multipartChunkSize,maxConcurrentRequests:C=R.maxConcurrentRequests,baseCDN:x,metadata:A})=>{let gt=e??await Tn(r),vt,ce=a((X,at)=>{if(!u)return;vt||(vt=Array(X).fill(0));let Et=a(Ot=>Ot.reduce((Vt,Qr)=>Vt+Qr,0),"sum");return Ot=>{Ot.isComputable&&(vt[at]=Ot.value,u({isComputable:true,value:Et(vt)/X}));}},"createProgressHandler");return w||=yn(r),gc(gt,{publicKey:i,contentType:w,fileName:t||bn(r),baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:A,multipartChunkSize:T}).then(async({uuid:X,parts:at})=>{let Et=await Rc(r,gt,T);return Promise.all([X,Lc(C,at.map((Ot,Vt)=>()=>Pc(Et(Vt),Ot,{publicKey:i,contentType:w,onProgress:ce(at.length,Vt),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([X])=>yc(X,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(X=>X.isReady?X:Ao(X.uuid,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(X=>new ge(X,{baseCDN:x}))},"uploadMultipart");async function Oo(r,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:x=R.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:gt,pusherKey:vt,metadata:ce}){if(Re(r)){let X=await Tn(r);return Ic(X,w)?$c(r,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:X,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:ce}):wc(r,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:ce})}if(Mo(r))return Mc(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:x,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:gt,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:vt,metadata:ce});if(En(r))return Tc(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x});throw new TypeError(`File uploading from "${r}" is not supported`)}a(Oo,"uploadFile");var Dc=a((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},"replaceUrlBase"),xo=class{static{a(this,"UploadcareGroup");}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((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Dc(i.cdnUrl,t),this.files=e.map(o=>new ge(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},Fc=a(r=>{for(let i of r)if(!Re(i))return false;return true},"isFileDataArray"),Vc=a(r=>{for(let i of r)if(!En(i))return false;return true},"isUuidArray"),_c=a(r=>{for(let i of r)if(!Mo(i))return false;return true},"isUrlArray");function xn(r,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=R.multipartChunkSize,baseCDN:T=R.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:x,jsonpCallback:A}){if(!Fc(r)&&!_c(r)&&!Vc(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let gt,vt=true,ce=r.length,X=a((at,Et)=>{if(!c)return;gt||(gt=Array(at).fill(0));let Ot=a(Vt=>Vt.reduce((Qr,pl)=>Qr+pl)/at,"normalize");return Vt=>{if(!Vt.isComputable||!vt){vt=false,c({isComputable:false});return}gt[Et]=Vt.value,c({isComputable:true,value:Ot(gt)});}},"createProgressHandler");return Promise.all(r.map((at,Et)=>Re(at)||Mo(at)?Oo(at,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:X(ce,Et),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:x}).then(Ot=>Ot.uuid):at)).then(at=>fc(at,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:o,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(Et=>new xo(Et,{baseCDN:T})).then(Et=>(c&&c({isComputable:true,value:1}),Et)))}a(xn,"uploadFileGroup");var te=class{static{a(this,"Queue");}xi=1;Rr=[];Ci=0;Pr=new Map;$r=new Map;constructor(i){this.xi=i;}run(){let i=this.xi-this.Ci;for(let t=0;t<i;t++){let e=this.Rr.shift();if(!e)return;let o=this.Pr.get(e),s=this.$r.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ci+=1,e().finally(()=>{this.Pr.delete(e),this.$r.delete(e),this.Ci-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.Pr.set(i,e),this.$r.set(i,o),this.Rr.push(i),t&&this.run();})}get pending(){return this.Rr.length}get running(){return this.Ci}set concurrency(i){this.xi=i,this.run();}get concurrency(){return this.xi}};var Io=a(()=>({}),"blockCtx"),Lo=a(r=>({...Io(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),Uo=a(r=>({...Lo(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new te(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),Cn=a(r=>({...Uo(r),"*solution":null}),"solutionBlockCtx");var Nc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ai(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}a(ai,"focus");function Ro(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Nc[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}a(Ro,"findGroupNodeByEventTarget");function Po(r,i){return i.role==="toolbar"?Bc(i):i.querySelectorAll(`[role=${r.role}]`)}a(Po,"getItems");function Bc(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(Bc,"getToolbarItems");function zc(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(zc,"isHorizontalOrientation");function Sn(r){return i=>{let t=false,e=r?.searchDelayMs||300,o=0,s="";function n(d){let m=Ro(d.target);if(!m){l();return}let f=Po(d.target,m),v=Array.from(f).indexOf(d.target),w="ArrowDown",T="ArrowUp";if(zc(m)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),d.key===w)d.preventDefault(),ai(d.target,f[v+1]||f[0]);else if(d.key===T)d.preventDefault(),ai(d.target,f[v-1]||f[f.length-1]);else if(d.key==="Home")d.preventDefault(),ai(d.target,f[0]);else if(d.key==="End")d.preventDefault(),ai(d.target,f[f.length-1]);else if(d.key.length===1&&m.role!=="tablist"){let C=Date.now();C-o<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),o=C;let x=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));x&&(d.preventDefault(),ai(d.target,x));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let m=Ro(d.target);if(m){t||(t=true,i.addEventListener("keydown",n));let f=Po(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let m=Ro(d.target);if(m){let f=Po(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(Sn,"focusGroupKeyUX");function An(){return r=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(o,"focusOut"),r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}a(An,"hiddenKeyUX");function kn(){return r=>{let i=[];function t(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let o=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let p=r.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l);}}}a(kn,"jumpKeyUX");function Mn(r){let i,t=r.split(" "),e;function o(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(o,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",o),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",o),l.removeEventListener("keyup",s);})}a(Mn,"pressKeyUX");function On(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}a(On,"startKeyUX");var $o=class{constructor(){this._e=new Map;this.Dr=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(o=>{let s=o.target;s instanceof Node&&this.Dr.some(n=>n===s||n.contains(s))&&t(o);},"wrappedListener");this._e.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this._e.get(t);e&&window.removeEventListener(i,e),this._e.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Dr.push(i);}destroy(){this.Dr=[];for(let i of this._e.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this._e.clear();}},er=class{static{a(this,"A11y");}constructor(){this.Si=new $o,this.Is=On(this.Si,[Sn(),Mn("is-pressed"),kn(),An()]);}registerBlock(i){this.Si.registerScope(i);}destroy(){this.Is?.(),this.Si.destroy();}};var Gt=a(r=>`*l10n/${r}`,"localeStateKey"),Hc="en",ir=class extends Q{constructor(t){super(t);this.Fr="";for(let[e,o]of Object.entries(ri)){let s=this.e.has(Gt(e))?!this.e.read(Gt(e)):true;this.e.add(Gt(e),o,s);}this.addSub(this.e.sub(U("localeName"),async e=>{if(!e)return;this.Fr=e;let o=await Js(e);if(e!==Hc&&this.Fr!==e)return;let s=this.he.localeDefinitionOverride?.[e];for(let[n,l]of Object.entries(o)){let c=s?.[n];this.e.add(Gt(n),c??l,true);}})),this.addSub(this.e.sub(U("localeDefinitionOverride"),e=>{if(!e)return;let o=e[this.Fr];if(o)for(let[s,n]of Object.entries(o))this.e.add(Gt(s),n,true);}));}static{a(this,"LocaleManager");}};function jc(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(jc,"i");function Fo(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Fo(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=jc(i);return typeof t=="object"&&t!==null?[e,Fo(t)]:[e,t]}))}a(Fo,"c");function Kc(r){return {ok:true,value:r}}a(Kc,"u");function Do(r){return {ok:false,error:r}}a(Do,"a");var Gc="https://tlm.uploadcare.com/api/",Vo=class{static{a(this,"y");}constructor(i=Gc){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return Do(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return Kc(s)}catch(s){return Do(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return Do(new Error(`Error fetching data from "${e}". Error: ${o}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Fo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},qc=a(async(r,i)=>({success:true,data:i}),"p"),Wc=a(async r=>qc(void 0,r),"f"),rr=class extends Vo{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Wc(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 Zc=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),or=class extends Q{constructor(){super(...arguments);this.Be=new Map;this.Ai=new Set;}static{a(this,"EventEmitter");}bindTarget(t){return this.Ai.add(t),()=>{this.Ai.delete(t);}}Ls(t,e){for(let o of this.Ai)o.dispatchEvent(new CustomEvent(t,{detail:e}));this.z?.(()=>{let o=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,o]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Ls(t,typeof e=="function"?e():e);return}this.Be.has(t)&&window.clearTimeout(this.Be.get(t));let n=typeof s=="number"?s:Zc,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.Ls(t,c),this.Be.delete(t);}catch(c){this.z?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.Be.set(t,l);}destroy(){for(let t of this.Be.values())window.clearTimeout(t);this.Ai.clear();}};var In="1.26.3";var Lt="blocks",Ut=In;var sr=class extends Q{constructor(t){super(t);this.ec=ut.generateRandomUUID();this.me=structuredClone(Y);this.Vr=false;this.Nr=null;this.$t=false;this.Us=new rr,this.fe=new te(10),this.addSub(this.e.sub(U("qualityInsights"),e=>{this.$t=!!e;}));for(let e of Object.keys(this.me))this.addSub(this.e.sub(U(e),o=>{this.$t&&(this.Vr&&this.me[e]!==o&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.ic(e,o));}));}static{a(this,"TelemetryManager");}rc(t){t===F.INIT_SOLUTION&&!this.Vr&&(this.Vr=true);}ic(t,e){this.me[t]!==e&&(this.me[t]=e);}oc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(o.config=this.me),{...o,appVersion:Ut,appName:Lt,sessionId:this.ec,component:this.sc,activity:this.nc,projectPubkey:this.me.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.ac,payload:{location:this.cc,...e}}}uc(t){return !!(t&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.$t)return;let e=this.oc({eventType:t.eventType,payload:t.payload,config:t.config});this.rc(t.eventType),!(this.uc(t.eventType)||this.Nr&&this.Rs(this.Nr,e))&&this.fe.add(async()=>{this.Nr=e,await this.Us.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Rs(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 o=Object.keys(t),s=Object.keys(e);if(o.length!==s.length)return false;for(let n of o)if(!Object.hasOwn(e,n)||!this.Rs(t[n],e[n]))return false;return true}get ac(){return Date.now()}get sc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get nc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get cc(){return location.origin}};var Ln=a(r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Yc=a(r=>r,"DEFAULT_TRANSFORMER"),_o="{{",Rn="}}",Un="plural:";function Pe(r,i={},t={}){let{openToken:e=_o,closeToken:o=Rn,transform:s=Yc}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);r=r.replaceAll(e+n+o,u);}return r}a(Pe,"applyTemplateData");function Pn(r){let i=[],t=r.indexOf(_o);for(;t!==-1;){let e=r.indexOf(Rn,t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(Un)){let s=r.substring(t+2,e).replace(Un,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:l});}t=r.indexOf(_o,e);}return i}a(Pn,"getPluralObjects");var $n="--uploadcare-blocks-window-height",li=class r{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty($n,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty($n);}};var nr=a((r,i)=>new Intl.PluralRules(r).select(i),"getPluralForm");var Qc=a(r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=nr(o,t);return e(`${i}__${s}`)},"createPluralizer"),ar=a(r=>{let i=Qc(()=>t),t=a((e,o={})=>{if(!e)return "";let n=r().read(Gt(e))||e,l=Pn(n);for(let u of l)o[u.variable]=i(u.pluralKey,Number(o[u.countVariable]));return Pe(n,o)},"l10n");return t},"createL10n");var Jc=a(r=>r.tagName?.includes("-")??false,"isCustomElement"),lr=class{constructor(i){this.Xt=new Set;this.ki=new Map;this.Ps=false;this.Yt=i,this.Yt.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.Mi?.(),this.Mi=void 0,this.Xt.clear(),this.ki.clear();}hostUpdated(){if(!this.Mi&&this.Yt.has(U("testMode"))){let i=this.Yt.subConfigValue("testMode",t=>{this.Ps=!!t,this.$s();});this.Mi=i;}this.dc(),this.$s();}dc(){let i=this.Yt,t=i.renderRoot??i;if(!t)return;let e=this.Yt,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Jc(n));for(let n of s)if(!(o&&n.closest(o)!==e)&&!this.Xt.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.Xt.add(n),this.ki.set(n,l);}for(let n of Array.from(this.Xt))(!n.isConnected||o&&n.closest(o)!==e)&&(this.Xt.delete(n),this.ki.delete(n));}$s(){if(!this.Xt.size)return;let i=this.Yt.testId||"";for(let t of this.Xt){let e=this.ki.get(t);e&&(this.Ps?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var tu=Oe(zi()(Me(_i(yt)))),S=class extends tu{constructor(){super();this.Oi=new Map;this.activityType=null;this.init$=Io();this.l10n=ar(()=>this.sharedCtx);this.debugPrint=qi(()=>this.sharedCtx,this.constructor.name);this.r=un(()=>this.sharedCtx);new lr(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);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(),li.registerClient(this);}initCallback(){this.yt("*blocksRegistry",()=>new Set),this.yt("*eventEmitter",t=>new or(t)),this.yt("*localeManager",t=>new ir(t)),this.yt("*modalManager",t=>new Wi(t)),this.yt("*a11y",()=>new er),this.yt("*telemetryManager",t=>new sr(t)),this.sub(Gt("locale-id"),t=>{let e=Ln(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.bt("*modalManager",false)}get telemetryManager(){return this.bt("*telemetryManager")}get localeManager(){return this.bt("*localeManager")}get a11y(){return this.bt("*a11y")}get blocksRegistry(){return this.bt("*blocksRegistry")}get eventEmitter(){return this.bt("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),li.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.pc(),z.deleteCtx(this.ctxName);}yt(t,e){if(!this.Oi.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.r);this.add(t,o,true),this.Oi.set(t,o);return}}pc(){for(let[t,e]of this.Oi.entries())e?.destroy?.(),this.pub(t,null),this.Oi.delete(t);}bt(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:Ki(t),cdnUrlModifiers:fo(t),fileName:ji(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?Pe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Wt){let t={};this.Wt=new Proxy(t,{set:a((e,o,s)=>{if(typeof o!="string"||!(o in Y))return false;let n=o,l=U(n);return this.has(l)||this.add(l,Y[n]),this.$[l]=s,true},"set"),get:a((e,o)=>{let s=U(o);return this.has(s)||this.add(s,Y[o]),this.$[s]},"get")});}return this.Wt}subConfigValue(t,e){let o=U(t);return this.has(o)||this.add(o,Y[t]),this.sub(o,e)}};var Rt={ATTRIBUTE:1,CHILD:2},dt=a(r=>(...i)=>({Cr:r,values:i}),"e"),bt=class{static{a(this,"i");}constructor(i){}get W(){return this.c.W}Sr(i,t,e){this.Ii=i,this.c=t,this.hc=e;}ql(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var ye=class extends bt{static{a(this,"e");}constructor(i){if(super(i),this.it=P,i.type!==Rt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===P||i==null)return this.Ds=void 0,this.it=i;if(i===tt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Ds;this.it=i;let t=[i];return t.raw=t,this.Ds={Kt:this.constructor.resultType,strings:t,values:[]}}};ye.directiveName="unsafeHTML",ye.resultType=1;dt(ye);var ci=class extends ye{static{a(this,"t");}};ci.directiveName="unsafeSVG",ci.resultType=2;var cr=dt(ci);var Dn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var qt=class extends S{constructor(){super(...arguments);this.init$=Cn(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);}render(){return y`${cr(Dn)}`}};var Fn=a(r=>typeof r!="number"?0:Math.floor(r/1e3),"msToUnixTimestamp"),Vn=a((r,{threshold:i})=>{let{secureExpire:t}=r,e=Fn(Date.now()),o=Number(t),s=Fn(i);return e+s>=o},"isSecureTokenExpired");var ur=class extends Q{constructor(){super(...arguments);this.Qt=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.he;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.Qt||Vn(this.Qt,{threshold:s})){this.Qt?this.z("Secure signature is expired. Resolving a new one..."):this.z("Secure signature is not set yet.");try{let n=await o();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.z("Secure signature resolved:",n),this.z("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Qt=n):(this.z("Secure signature resolver returned nothing."),this.Qt=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.r.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Qt}return t&&e?(this.z("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Qt=null;}};var No=a((r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Bo=a((r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=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:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}},"validateMultiple");var eu=a(()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),iu=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),ru=a(()=>({safariDesktop:eu()}),"calcBrowserInfo"),ou=a(()=>({htmlMediaCapture:iu()}),"calcBrowserFeatures"),_n=ru(),be=ou();var ui="image/*",zo="video/*",su=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],nu=a(()=>_n.safariDesktop?[ui]:[ui,...su],"calcImageAcceptList"),di=nu(),dr=a(r=>r?r.filter(i=>typeof i=="string").flatMap(i=>q(i)):[],"mergeFileTypes"),Ho=a((r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),"matchMimeType"),Nn=a((r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),Bn=a(r=>{let i=r?.type;return i?Ho(i,di):false},"fileIsImage");var jo=a((r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=dr([...t?di:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let l=Ho(s,o),c=Nn(n,o);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var Ko=a((r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var Pt=1e3,we=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),pi=a(r=>Math.ceil(r*100)/100,"round"),zn=a((r,i=we.AUTO)=>{let t=i===we.AUTO;if(i===we.BYTE||t&&r<Pt**1){let o=nr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===we.KB||t&&r<Pt**2?`${pi(r/Pt**1)} KB`:i===we.MB||t&&r<Pt**3?`${pi(r/Pt**2)} MB`:i===we.GB||t&&r<Pt**4?`${pi(r/Pt**3)} GB`:i===we.TB||t&&r<Pt**5?`${pi(r/Pt**4)} TB`:`${pi(r/Pt**5)} PB`},"prettyBytes");var Go=a((r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:zn(t)}),payload:{entry:r}}},"validateMaxSizeLimit");var qo=a((r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof rt)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Ue)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}},"validateUploadError");var $e={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."},au=a(r=>typeof r=="function"?{runOn:"change",validator:r}:r,"getValidatorDescriptor"),pr=class extends Q{constructor(t){super(t);this.mc=[Ko,jo,Go,qo];this.fc=[Bo,No];this.fe=new te(20);this.Fs=D(()=>{this.fe.run();},500);this.Dt=false;this.ge=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(U("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(U("multipleMin"),e)),this.addSub(this.e.sub(U("multipleMax"),e)),this.addSub(this.e.sub(U("multiple"),e)),this.addSub(this.e.sub(U("imgOnly"),e)),this.addSub(this.e.sub(U("accept"),e)),this.addSub(this.e.sub(U("validationConcurrency"),o=>{this.fe.concurrency=o;}));}static{a(this,"ValidationManager");}get f(){return this.r.uploadCollection}runFileValidators(t,e){if(this.Dt)return;let o=e??this.f.items();for(let s of o){let n=this.f.read(s);n&&this.gc(n,t);}}runCollectionValidators(){if(this.Dt)return;let t=this.r.api,e=t.getOutputCollectionState(),o=[],s=this.he.collectionValidators;for(let n of [...this.fc,...s])try{let l=n(e,t);if(!l)continue;l&&(o.push(this.Vs(l)),l.message||console.warn($e.MISSING_ERROR_MESSAGE));}catch(l){console.warn($e.COLLECTION_VALIDATION_FAILED,l);}this.e.pub("*collectionErrors",o),o.length>0&&this.r.eventEmitter.emit(I.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.ge.get(t.uid);e&&(e.abortController?.abort(),this.ge.delete(t.uid));}async gc(t,e){if(this.Dt)return;let o=this.r.api,s=this.Ns(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Dt||(await n,this.Dt))return;let c=this.vc(t,e);if(c.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=o.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.he.validationTimeout,m=this._s(),f=new Set(c.map(T=>T.validator)),v=[];for(let T of m)if(!f.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Dt)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn($e.FILE_VALIDATION_TIMEOUT);},d);try{let x=await T.validator(u,o,{signal:p.signal});if(!x||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let A=this.Vs(x);s.lastErrorThrownByValidator.set(T.validator,A),v.push(A),x.message||console.warn($e.MISSING_ERROR_MESSAGE);}catch(x){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn($e.FILE_VALIDATION_FAILED,x),this.r.telemetryManager.sendEventError(x,`file validator. ${$e.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.Fs(),await this.fe.add(async()=>{this.Dt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}Vs(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Ns(t){let e=this.ge.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.ge.set(t.uid,o),o}_s(){let t=this.he.fileValidators;return [...this.mc,...t].map(au)}vc(t,e){let o=this.Ns(t);return this._s().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Dt=true,this.Fs.cancel();for(let t of this.ge.values())t.abortController?.abort(),t.promise=void 0;this.ge.clear();}};var Hn="[Typed State] Wrong property name: ",hr=class{static{a(this,"TypedData");}constructor(i){this.Q=ut.generateFastUid(),this.Z=z.registerCtx(i,this.Q);}get uid(){return this.Q}setValue(i,t){if(!this.Z.has(i)){console.warn(`${Hn}${String(i)}`);return}this.Z.read(i)!==t&&this.Z.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Z.has(i)||console.warn(`${Hn}${String(i)}`),this.Z.read(i)}subscribe(i,t){return this.Z.sub(i,t)}destroy(){z.deleteCtx(this.Q);}};var mr=class r{constructor(i){this.Ft=Object.create(null);this.Li=new Set;this.Ui=new Set;this.At=new Set;this._r=new Set;this.Br=new Set;this.ve=new Set;this.Hs=i.initialValue,this.Q=ut.generateFastUid(),this.Z=z.registerCtx({},this.Q),this.Bs=i.watchList||[];let t=Object.create(null);this.zs=(e,o)=>{this.ze&&window.clearTimeout(this.ze),t[e]||(t[e]=new Set),t[e].add(o),this.ze=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Li.forEach(s=>{s({...t});}),t=Object.create(null));}),this.js();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}static{this.yc=1e4;}K(){this.He&&window.clearTimeout(this.He),this.He=window.setTimeout(()=>{let i=new Set(this.Br),t=new Set(this._r);this.Br.clear(),this._r.clear();for(let e of this.Ui)e?.([...this.At],i,t);this.js();});}js(){this.ve.size!==0&&(this.je&&window.clearTimeout(this.je),this.je=window.setTimeout(()=>{let i=[...this.ve];this.ve.clear();for(let t of i)t.destroy();},r.yc));}observeCollection(i){return this.Ui.add(i),this.At.size>0&&this.K(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Ui.delete(i);}add(i){let t=new hr(this.Hs);for(let[e,o]of Object.entries(i))t.setValue(e,o);return this.At.add(t.uid),this.K(),this.Z.add(t.uid,t),this.Br.add(t),this.Bs.forEach(e=>{this.Ft[t.uid]||(this.Ft[t.uid]=[]),this.Ft[t.uid]?.push(t.subscribe(e,()=>{this.zs(e,t.uid);}));}),t.uid}hasItem(i){return this.At.has(i)}read(i){return this.Z.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 o=this.read(i);if(!o)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);o.setValue(t,e);}remove(i){let t=this.read(i);t&&(this._r.add(t),this.ve.add(t)),this.At.delete(i),this.K(),this.Z.pub(i,void 0),this.Ft[i]?.forEach(e=>{e();}),delete this.Ft[i];}clearAll(){this.At.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Li.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Li.delete(i);}findItems(i){let t=[];return this.At.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.At]}get size(){return this.At.size}destroy(){this.ze&&window.clearTimeout(this.ze),this.He&&window.clearTimeout(this.He),this.je&&window.clearTimeout(this.je);for(let i of this.ve)i.destroy();this.ve.clear(),z.deleteCtx(this.Q),this.Li=new Set,this.Ui=new Set;for(let i of Object.keys(this.Ft))this.Ft[i]?.forEach(t=>{t();}),delete this.Ft[i];}};var k=Object.freeze({PHOTO:"photo",VIDEO:"video"}),wt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Wo=a(r=>({isVideoRecordingEnabled:lt(r.cameraModes).includes(k.VIDEO),isPhotoEnabled:lt(r.cameraModes).includes(k.PHOTO)}),"calcCameraModes");var St=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Zo=a((r,i)=>{for(let t of r)if(i(t))return t},"findBlockInCtx");var jn=a((r,i)=>{for(let t of r)if(i(t))return true;return false},"hasBlockInCtx");function fr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}a(fr,"applyStyles");var lu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,cu=new RegExp(`^/?(${lu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Kn=a(({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(si),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=cu.exec(o.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var $t=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Xo=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),H=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Xo,...$t});var gr=a(r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e)),"getOutputData");function Gn(r){let i=new Map;return a((...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s},"memoized")}a(Gn,"memoize");var qn=new Set;function vr(r){qn.has(r)||(qn.add(r),console.warn(r));}a(vr,"warnOnce");function uu(r){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...o)=>(i&&vr(r),e(...o))),"withAssert")}a(uu,"createAsyncAssertWrapper");function Wn(r){let i={},t=r.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>r.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>gr(r),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},o=uu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let l=s,u=Gn(o(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(Wn,"buildOutputCollectionState");var yr=class extends Q{constructor(){super(...arguments);this.bc=ar(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=Kn({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.f.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??H.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let l=this.f.add({file:t,isImage:Bn(t),mimeType:t.type,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??H.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.r.eventEmitter.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Bt(dr([this.cfg.accept??"",...this.cfg.imgOnly?di:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),fr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=Wo(this.cfg);t.modeCamera===k.PHOTO&&n?s.accept=ui:t.modeCamera===k.VIDEO&&l?s.accept=zo:s.accept=[ui,l&&zo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?H.CAMERA:H.LOCAL});}),this.r.modalManager?.open(St.UPLOAD_LIST),this.e.pub("*currentActivity",St.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.f.size>0&&!t)this.r.modalManager?.open(St.UPLOAD_LIST),this.e.pub("*currentActivity",St.UPLOAD_LIST);else if(this.Ks?.length===1){let e=this.Ks[0];if(e==="local"){this.e.pub("*currentActivity",St.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&be.htmlMediaCapture){let{isPhotoEnabled:l,isVideoRecordingEnabled:c}=Wo(this.cfg);if(l&&c){this.e.pub("*currentActivity",St.START_FROM);return}else if(l||c){this.openSystemDialog({captureCamera:true,modeCamera:l?k.PHOTO:k.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:k.PHOTO});}let o=this.r.blocksRegistry;Zo(o,a(l=>"type"in l&&l.type===e,"isSourceBtn"))?.activate(),this.e.read("*currentActivity")&&this.r.modalManager?.open(this.e.read("*currentActivity"));}else this.r.modalManager?.open(St.START_FROM),this.e.pub("*currentActivity",St.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=Zo(this.r.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.r.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{if(jn(this.r.blocksRegistry,o=>o.activityType===t)){this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);},"setCurrentActivity");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.setModalState=a(t=>{if(t&&!this.e.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this.r.modalManager?.open(this.e.read("*currentActivity")):(this.r.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null));},"setModalState");}static{a(this,"UploaderPublicApi");}get f(){return this.r.uploadCollection}get cfg(){return this.he}get l10n(){return this.bc}removeAllFiles(){this.f.clearAll();}getOutputItem(t){let e=z.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let o=e.store,s=o.fileInfo,n=o.isRemoved?"removed":o.errors.length>0?"failed":o.fileInfo?"success":o.isUploading?"uploading":"idle";return {uuid:s?.uuid??o.uuid??null,internalId:t,name:s?.originalFilename??o.fileName,size:s?.size??o.fileSize,isImage:s?.isImage??o.isImage,mimeType:s?.mimeType??o.mimeType,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl??s?.cdnUrl??null,fullPath:o.fullPath,uploadProgress:o.uploadProgress,fileInfo:s??null,metadata:o.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:n,source:o?.source}}getOutputCollectionState(){return Wn(this.r)}get Ks(){let t=[];return this.cfg.sourceList&&(t=q(this.cfg.sourceList)),t}};var Zn={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 hi=33.333333333333336,M=1,Yo=24,Xn=6;function re(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}a(re,"setSvgNodeAttrs");function pt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return re(t,i),t}a(pt,"createSvgNode");function Yn(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,o+c*n+1.5*p-24*t*p],m=[e+l*s+1.5*u,o+c*n+1.5*p],f=[e+l*s-24*t*u+1.5*u,o+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}a(Yn,"cornerPath");function Qn(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,o+p*n+1.5*m],v=[e+u*s+34*t/2,o+p*n+1.5*m]):(f=[e+u*s+1.5*d,o+p*n-34*t/2],v=[e+u*s+1.5*d,o+p*n+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,T=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:T}}a(Qn,"sidePath");function Jn(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}a(Jn,"thumbCursor");function ta({rect:r,delta:[i,t],imageBox:e}){return Fe({...r,x:r.x+i,y:r.y+t},e)}a(ta,"moveRect");function Fe(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}a(Fe,"constraintRect");function du({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;s+=o,l-=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,l=r.y+r.height-s,t&&(n=l*t,c=r.x+r.width/2-n/2)),c<=e.x&&(c=e.x,s=r.y+r.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y+r.height-l),l<M&&(l=M,t&&(n=l*t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),n<M&&(n=M,t&&(l=n/t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),{x:c,y:s,width:n,height:l}}a(du,"resizeNorth");function pu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;s+=o,n-=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(l=n/t,c=r.y+r.height/2-l/2)),c<=e.y&&(c=e.y,s=r.x+r.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x+r.width-n),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),{x:s,y:c,width:n,height:l}}a(pu,"resizeWest");function hu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;l+=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=r.x+r.width/2-n/2),c<=e.x&&(c=e.x,s=r.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y),l<M&&(l=M,t&&(n=l*t),c=r.x+r.width/2-n/2),n<M&&(n=M,t&&(l=n/t),c=r.x+r.width/2-n/2),{x:c,y:s,width:n,height:l}}a(hu,"resizeSouth");function mu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;n+=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=r.y+r.height/2-l/2),c<=e.y&&(c=e.y,s=r.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2),{x:s,y:c,width:n,height:l}}a(mu,"resizeEast");function fu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+s<e.y&&(s=e.y-l),n+=o,c-=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x+r.width-c,l=e.y)):t&&(o=u*t-c,c=c+o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c,l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c,l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(fu,"resizeNorthWest");function gu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x,l=e.y)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(gu,"resizeNorthEast");function vu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=o,c-=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x+r.width-c,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c),{x:n,y:l,width:c,height:u}}a(vu,"resizeSouthWest");function yu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(yu,"resizeSouthEast");function ea({direction:r,...i}){switch(r){case "n":return du(i);case "w":return pu(i);case "s":return hu(i);case "e":return mu(i);case "nw":return fu(i);case "ne":return gu(i);case "sw":return vu(i);case "se":return yu(i);default:return i.rect}}a(ea,"resizeRect");function ia(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}a(ia,"rectContainsPoint");function ra(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}a(ra,"isRectInsideRect");function oa(r,i){return Math.abs(r.width/r.height-i)<.1}a(oa,"isRectMatchesAspectRatio");function Ve({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}a(Ve,"rotateSize");function sa(r,i,t){let e=r/i,o,s;e>t?(o=Math.round(i*t),s=i):(o=r,s=Math.round(r/t));let n=Math.round((r-o)/2),l=Math.round((i-s)/2);return n+o>r&&(o=r-n),l+s>i&&(s=i-l),{x:n,y:l,width:o,height:s}}a(sa,"calculateMaxCenteredCropFrame");function _e(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}a(_e,"roundRect");function oe(r,i,t){return Math.min(Math.max(r,i),t)}a(oe,"clamp");var mi=["free"],wr=a(r=>{let i=q(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let o=e.trim();if(!o)continue;let s=o.indexOf(":");if(s===-1&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),l=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:ut.generateFastUid(),type:"aspect-ratio",width:mi.includes(o)?0:n,height:mi.includes(o)?0:l,hasFreeform:mi.includes(o)});}return t},"parseCropPreset"),na=a((r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(o-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(o-u)/u>e)return null}return s},"getClosestAspectRatio");function aa(r){return Co({...r,libraryName:Lt,libraryVersion:Ut})}a(aa,"customUserAgent");var la="active",Ne="___ACTIVITY_IS_ACTIVE___",ca,E=class r extends(ca=S,ca){constructor(){super(...arguments);this.historyTracked=false;this.init$=Lo(this);this.wc=D(this.Tc.bind(this),10);}static{a(this,"LitActivityBlock");}Gs(){let t=r.Ke.get(this);this[Ne]=false,this.removeAttribute(la),t?.deactivateCallback?.();}Ec(){let t=r.Ke.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ne]=true,this.setAttribute(la,""),t?.activateCallback?.(),this.wc(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Ne]?this.Gs():this.activityType===t&&!this[Ne]&&this.Ec();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Tc(){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);}xc(){return !!this.activityType&&r.Ke.has(this)}static{this.Ke=new Map;}get isActivityActive(){return !!this[Ne]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.Ke.set(this,{activateCallback:o,deactivateCallback:s});}Cc(){this.isActivityActive&&this.Gs(),r.Ke.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.xc()&&this.Cc();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(o=>o instanceof r&&o.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}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 o=!!e;e&&(o=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=o?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};E.activities=St;var $=class r extends E{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Ri=false;this.init$=Uo(this);this.jr=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Oc(e);},300);this.kc=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of o){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Zs(),this.jr();}};this.Mc=t=>{if(!this.isConnected)return;this.jr();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(o.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=o.filter(n=>t.fileInfo?.has(n)&&!!z.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Zs();}if(t.isUploading)for(let s of t.isUploading){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=z.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Ic(),this.cfg.cloudImageEditorAutoOpen&&this.Lc();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=z.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Zs=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get Sc(){return this.hasBlockInCtx(t=>t instanceof r?t.Ri&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.yt("*uploadCollection",()=>new mr({initialValue:Zn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.yt("*secureUploadsManager",t=>new ur(t)),this.yt("*validationManager",t=>new pr(t)),this.yt("*publicApi",t=>new yr(t)),!this.Sc&&this.couldBeCtxOwner&&this.Ac();}getAPI(){return this.api}get validationManager(){return this.bt("*validationManager")}get api(){return this.bt("*publicApi")}get uploadCollection(){return this.bt("*uploadCollection")}get secureUploadsManager(){return this.bt("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Ri&&this.qs(),this.jr.cancel();}connectedCallback(){super.connectedCallback(),this.Ri&&this.Ws();}Ac(){this.Ri=true,this.Ws(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ws(){this.qs(),this.zr=this.uploadCollection.observeCollection(this.kc),this.Hr=this.uploadCollection.observeProperties(this.Mc);}qs(){this.Hr?.(),this.zr?.(),this.Hr=void 0,this.zr=void 0;}async Oc(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await xn(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Lc(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}Ic(){let t=wr(this.cfg.cropPreset);if(t){let[e]=t,o=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 o){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=sa(l,c,u),d=et(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:G(m,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}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:aa,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 gr(this.r)}};$.extSrcList=Object.freeze({...$t});$.sourceTypes=Object.freeze({...H});var fi=class extends S{constructor(){super(...arguments);this.name="";this.Kr="";this.Xs=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.Xs=t,this.Ys();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ys();}Ys(){if(!this.name){this.Kr="";return}let t=`#uc-icon-${this.name}`,e=this.Xs?.(this.name);this.Kr=e??t;}render(){return y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Kr}></use></svg>`)} `}};h([b({type:String})],fi.prototype,"name",2),h([g()],fi.prototype,"Kr",2);var ua=a(r=>[...new Set(r)],"uniqueArray");var Te="--uc-img-",Qo="unresolved";var Jo=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ts=3e3,es=5e3,is=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var bu="https://ucarecdn.com",Be=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:bu},"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 Tr=class extends Me(Oe(yt)){constructor(){super();this.ye={};this.w=new Map;this.be=null;this.Pi=null;for(let t in Be){let e=Be[t];this.ye[Te+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.ye[Te+t]}set$$(t){for(let e in t){let o=Te+e,s=t[e];this.ye[o]=s,this.K(o,s);}}sub$$(t,e){let o=Te+t;this.w.has(o)||this.w.set(o,new Set),this.w.get(o)?.add(e);let s=this.ye[o];s!==null&&s!==""&&e(s);}K(t,e){this.w.has(t)&&this.w.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${Lt}/${Ut}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;Be[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.be=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.be?.unobserve(t));});},o),this.be.observe(t),this.Pi||(this.Pi=new Set),this.Pi.add(t);}connectedCallback(){super.connectedCallback(),this.Uc();}Uc(){for(let t in Be){let e=Te+t,o=this.getCssData(e,true);o!=null&&(this.ye[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.be&&(this.Pi?.forEach(t=>{this.be?.unobserve(t);}),this.be=null),this.w.clear();}static get observedAttributes(){return Object.keys(Be)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Te+t;this.ye[s]=o,this.K(s,o);});}};var da=a(r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var Cr=class extends Tr{constructor(){super(...arguments);this.kt=new Image;this.wt=new Image;}static{a(this,"ImgBase");}Qs(t){return !t.includes("//")&&!Jo&&(t=new URL(t,document.baseURI).href),t}$i(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let n=parseInt(o,10);return Number(n)>es&&this.Js?es+s:Number(n)>ts&&!this.Js?ts+s:t}Rc(t,e){let o={format:this.Gr("format"),quality:this.Gr("quality"),resize:this.$i(t),blur:e,"cdn-operations":this.Gr("cdn-operations")??void 0,analytics:this.analyticsParams()};return et(...da(o))}Gr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}tt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(Jo&&o&&!o.includes("//"))return this.Ge(o);let s=this.Rc(t,e),n=this.$$("cdn-cname"),l=n;if(o.startsWith(String(n)))return G(o,s);let c=this.$$("uuid");if(l&&c)return this.Ge(G(Yt(l,c),s));if(c)return this.Ge(G(Yt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.Ge(G(u,s,this.Qs(o)));let p=this.$$("pubkey");if(p)return this.Ge(G(`https://${p}.ucr.io/`,s,this.Qs(o)))}Ge(t){let e=this.$$("secure-delivery-proxy");return e?Pe(e,{previewUrl:t},{transform:a(o=>window.encodeURIComponent(o),"transform")}):t}we(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=o?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}Pc(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Mt||(this.qr({elNode:this.kt}),this.appendChild(this.kt)),this.kt}get Di(){return this.Mt?{type:is.PREVIEW,img:this.wt}:{type:is.MAIN,img:this.img}}get Mt(){return this.$$("is-preview-blur")}get tn(){return this.$$("is-background-for")}get en(){let t=this.$$("breakpoints");if(t){let e=q(t);return ua(e.map(o=>parseInt(o,10)))}else return null}get Js(){return this.$$("format").toLowerCase()==="jpeg"}rn(t){let e=new Set;e.add(`url("${this.tt(this.we(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.tt(this.we(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.tt(this.we(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}sn(){let t=new Set;return this.en?this.en.forEach(e=>{t.add(`${this.tt(`${e}x`)} ${this.$i(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.tt(`${e*2}x`)} ${this.$i(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.tt(`${e*3}x`)} ${this.$i(`${e*3}w`)}`);}):(t.add(`${this.tt(this.we(this.Di.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.tt(this.we(this.Di.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.tt(this.we(this.Di.img,3))} 3x`)),[...t].join()}nn(){return this.tt()}get an(){return this.tt("100x","100")}$c(){let t=this.tn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.rn(e);}):this.rn(e);});}Dc({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}qr({elNode:t}){this.Pc(t),this.initAttributes(t);}Wr({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.qr({elNode:o}),o.setAttribute(Qo,""),o.addEventListener("load",()=>{o.removeAttribute(Qo),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Dc({elNode:o,src:t,srcset:e});})}async Fc(){if(this.$$("intersection")){this.Mt&&(this.qr({elNode:this.wt}),this.appendChild(this.wt)),this.initIntersection(this.Di.img,async()=>{this.Mt&&(this.wt.src=this.an);try{await this.Wr({src:this.nn(),srcset:this.sn(),elNode:this.kt}),this.Mt&&await this.wt.remove(),this.appendChild(this.kt);}catch{this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}});return}try{this.Mt&&(await this.Wr({src:this.an,elNode:this.wt}),this.appendChild(this.wt)),await this.Wr({src:this.nn(),srcset:this.sn(),elNode:this.kt}),this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}catch{this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}}init(){this.tn?this.$c():this.Fc();}};var rs=class extends Cr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:wu}=Gs,pa=a(r=>r,"i");var ma=a(r=>r.strings===void 0,"r"),ha=a(()=>document.createComment(""),"s"),ze=a((r,i,t)=>{let e=r.St.parentNode,o=i===void 0?r.ue:i.St;if(t===void 0){let s=e.insertBefore(ha(),o),n=e.insertBefore(ha(),o);t=new wu(s,n,r,r.options);}else {let s=t.ue.nextSibling,n=t.c,l=n!==r;if(l){let c;t.Vc?.(r),t.c=r,t.yi!==void 0&&(c=r.W)!==n.W&&t.yi(c);}if(s!==o||l){let c=t.St;for(;c!==s;){let u=pa(c).nextSibling;pa(e).insertBefore(c,o),c=u;}}}return t},"v"),se=a((r,i,t=r)=>(r.gt(i,t),r),"u"),Tu={},fa=a((r,i=Tu)=>r.i=i,"p"),ga=a(r=>r.i,"M"),Sr=a(r=>{r.de(),r.St.remove();},"h");var gi=a((r,i)=>{let t=r.mt;if(t===void 0)return false;for(let e of t)e.vs?.(i,false),gi(e,i);return true},"s"),Ar=a(r=>{let i,t;do{if((i=r.c)===void 0)break;t=i.mt,t.delete(r),r=i;}while(t?.size===0)},"o"),va=a(r=>{for(let i;i=r.c;r=i){let t=i.mt;if(t===void 0)i.mt=t=new Set;else if(t.has(r))break;t.add(r),Cu(i);}},"r");function Eu(r){this.mt!==void 0?(Ar(this),this.c=r,va(this)):this.c=r;}a(Eu,"h");function xu(r,i=false,t=0){let e=this.i,o=this.mt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)gi(e[s],false),Ar(e[s]);else e!=null&&(gi(e,false),Ar(e));else gi(this,r);}a(xu,"n");var Cu=a(r=>{r.type==Rt.CHILD&&(r.yi??=xu,r.Vc??=Eu);},"c"),kr=class extends bt{static{a(this,"f");}constructor(){super(...arguments),this.mt=void 0;}Sr(i,t,e){super.Sr(i,t,e),va(this),this.isConnected=i.W;}vs(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(gi(this,i),Ar(this));}setValue(i){if(ma(this.Ii))this.Ii.gt(i,this);else {let t=[...this.Ii.i];t[this.hc]=i,this.Ii.gt(t,this,0);}}disconnected(){}reconnected(){}};var O=a(()=>new ss,"e"),ss=class{static{a(this,"h");}},os=new WeakMap,L=dt(class extends kr{render(r){return P}update(r,[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=r.options?.host,this.rt(this.ct=r.element)),P}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=os.get(i);t===void 0&&(t=new WeakMap,os.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?os.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 ns=null,vi=class extends S{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");},"closeDialog");this.Nc=()=>{this.closeDialog();};this._c=t=>{this.Zr=t.target;};this.Bc=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Zr&&this.closeDialog();};this.qe=({id:t})=>{t===this.id?(ns=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.We=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.ln=t=>{this.hide(),ns===this.id&&this.emit(I.MODAL_CLOSE,{modalId:ns,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){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;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(W.OPEN,this.qe),this.modalManager?.subscribe(W.CLOSE,this.We),this.modalManager?.subscribe(W.CLOSE_ALL,this.ln);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Zr=void 0,this.modalManager?.unsubscribe(W.OPEN,this.qe),this.modalManager?.unsubscribe(W.CLOSE,this.We),this.modalManager?.unsubscribe(W.CLOSE_ALL,this.ln);}zc(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Nc),this.dialogEl.value?.addEventListener("mousedown",this._c),this.dialogEl.value?.addEventListener("mouseup",this.Bc);}render(){return y`<dialog ${L(this.zc)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],vi.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],vi.prototype,"blockBodyScrolling",2);var Mr=class extends ${constructor(){super(...arguments);this.S=null;this.Fi=null;}static{a(this,"FormInput");}get cn(){return this.nameAttrValue??this.ctxName}un(){let t=document.createElement("input");return t.type="text",t.name=this.cn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,fr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.S=this.un(),this.appendChild(this.S),this.sub("*collectionState",t=>{if(!t)return;if(!this.Fi){let n=document.createElement("div");this.appendChild(n),this.Fi=n;}if(!this.S){let n=this.un();this.appendChild(n),this.S=n;}if(this.Fi.innerHTML="",t.status==="uploading"||t.status==="idle"){this.S.value="",this.S.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.S.value="",this.S.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.S.value=e.cdnUrl??"",this.S.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.S.value=o[0],this.S.setCustomValidity("");return}this.S.remove(),this.S=null;let s=new DocumentFragment;for(let n of o){let l=document.createElement("input");l.type="hidden",l.name=`${this.cn}[]`,l.value=n,s.appendChild(l);}this.Fi.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Mr.prototype,"nameAttrValue",2);var as=class extends S{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var He=class extends S{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.et=0;this.Vi=O();this.dn=()=>{let t=this.Vi.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.et>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.et=this.Xr(this.value),this.Yr(),this.Vi.value?.addEventListener("animationiteration",this.dn);}updated(t){if(super.updated(t),t.has("value")){let e=this.Xr(this.value);if(!this.visible)this.et=e;else {let o=Math.max(this.et,e);o!==this.et&&(this.et=o,this.Yr());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Yr():this.et=this.Xr(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Vi.value?.removeEventListener("animationiteration",this.dn);}Xr(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Yr(){this.visible&&this.style.setProperty("--l-progress-value",this.et.toString());}render(){return y`<div ${L(this.Vi)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],He.prototype,"hasFileName",2),h([b({type:Number})],He.prototype,"value",2),h([b({type:Boolean,reflect:true})],He.prototype,"visible",2);var yi=class extends ${constructor(){super();this.Tt=false;this.Te=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Qr=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.Tt=t;}),this.sub("*commonProgress",t=>{this.Te=t;});}updated(t){super.updated(t),t.has("visible")&&(this.Tt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Qr?.(),this.Qr=void 0;}render(){return y`<uc-progress-bar .value=${this.Te} .visible=${this.Tt}></uc-progress-bar>`}};h([g()],yi.prototype,"Tt",2),h([g()],yi.prototype,"Te",2);var je=class extends S{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Hc=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Hc} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],je.prototype,"value",2),h([b({type:Boolean,reflect:true})],je.prototype,"disabled",2),h([b({type:Array,attribute:false})],je.prototype,"options",2);var Su="src-type-",Ke=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Jr={};this.to="default";this.eo="";}static{a(this,"SourceBtn");}jc(){this.Ee({type:H.LOCAL,activate:a(()=>(this.api.openSystemDialog(),false),"activate")}),this.Ee({type:H.URL,activity:E.activities.URL,textKey:"from-url"}),this.Ee({type:H.CAMERA,activity:E.activities.CAMERA,activate:a(()=>{let t=be.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t},"activate")}),this.Ee({type:"draw",activity:E.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(Xo))this.Ee({type:t,activity:E.activities.CAMERA,activate:a(()=>{let e=be.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?k.PHOTO:k.VIDEO}),!e},"activate")});for(let t of Object.values($t))this.Ee({type:t,activity:E.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.jc(),this.type&&this.pn(this.type);}Ee(t){this.Jr[t.type]=t;}activate(){if(!this.type)return;let t=this.Jr[this.type];if(!t)return;let{activity:e,activate:o,activityParams:s={}}=t;(o?o():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}pn(t){let e=this.Jr[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:o=t,icon:s=t}=e;this.eo=`${Su}${o}`,this.to=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.pn(this.type):(this.eo="",this.to="default"));}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.to}></uc-icon><div class="uc-txt">${this.l10n(this.eo)}</div></button>`}};h([b({type:String})],Ke.prototype,"type",2),h([g()],Ke.prototype,"to",2),h([g()],Ke.prototype,"eo",2);var bi=class extends S{constructor(){super(...arguments);this.hn=[];this.q=[];this.wrap=false;this.gn=[];}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.hn=q(t),this.mn();}),this.subConfigValue("cameraModes",t=>{this.q=lt(t),this.mn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}mn(){let t=[];for(let e of this.hn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&be.htmlMediaCapture){let o=this.q.length?this.q.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...o);continue}t.push(e);}this.gn=t;}render(){return y`${this.gn.map(t=>y`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};h([b({type:Boolean,attribute:"wrap",noAccessor:true})],bi.prototype,"wrap",2),h([g()],bi.prototype,"gn",2);var ls=class extends S{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var At="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ee(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=At);},"cancel")}}a(Ee,"preloadImage");function wi(r){let i=[];for(let s of r){let n=Ee(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(wi,"batchPreloadImages");function cs(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let o=new Image,s=new Promise((n,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},o.onerror=c=>{l(c);};});return o.src=URL.createObjectURL(r),s}a(cs,"generateThumb");var Ge=class extends ${constructor(){super(...arguments);this.Ni=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,n)=>{let l=o.subscribe(s,c=>{this.isConnected&&n(c);});this.Ni.add(l);})(t,e);}reset(){for(let t of this.Ni)t();this.Ni=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ni=new Set;}};function Au(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(Au,"createSvgBlobUrl");function Or(r="hsl(209, 21%, 65%)",i=32,t=32){return Au(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(Or,"fileCssBg");var ku=3e3,qe=class extends Ge{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Vt="";this.vn=false;this._i=null;this.yn=false;this.Kc=this.cfg.filesViewMode;this.bn=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.Gc(e);if(o&&s&&n){let p=await this.proxyUrl(G(Yt(this.cfg.cdnCname,n),et(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Ee(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await cs(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Or(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await cs(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Or(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Or(p));}});this.Bi=D(this.bn.bind(this),100);}static{a(this,"Thumb");}Gc(t=false){t&&(this._i=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?._i?.height||0),10),parseInt(String(this?._i?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,ku)}qc(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=At,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),o();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}ro(){this.io?.cancel(),this.io=void 0;}Wc(t){if(this.ro(),!t){this.Vt&&(this.Vt="");return}if(t===this.Vt)return;let e=new AbortController,o={controller:e,cancel:a(()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);},"cancel")};this.io=o,this.qc(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Vt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}zi(t=false){if(this.entry){if(t){this.bn(true);return}this.yn&&this.Bi();}}firstUpdated(t){super.firstUpdated(t),this.wn();}updated(t){super.updated(t),t.has("uid")&&this.wn();}Ze(t){let[e]=t;e&&(this.yn=e.isIntersecting,e.isIntersecting&&(this._i=e.boundingClientRect,this.zi(),this.s?.disconnect()),e.intersectionRatio===0&&this.Bi.cancel());}reset(){super.reset(),this.Bi.cancel(),this.ro(),this.Vt&&(this.Vt="");}wn(){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 o=a(()=>{this.zi();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.Wc(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.zi(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.vn&&(this.Kc==="list"&&this.zi(true),this.vn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Bi.cancel(),this.ro(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Vt||At} role="img" alt="Preview of uploaded image" ?hidden=${!this.Vt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],qe.prototype,"badgeIcon",2),h([b({attribute:false})],qe.prototype,"uid",2),h([g()],qe.prototype,"Vt",2);var us=class extends E{static{a(this,"ActivityHeader");}};var ds=class extends E{constructor(){super(...arguments);this.historyTracked=true;this.activityType=E.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var ps=class extends ${constructor(){super(...arguments);this.Tn=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.Tn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Tn?.();}};var We=a((r,i)=>{let t=false,e,o=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...n),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...n),o=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var ya=a((r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},"u"),ba=dt(class extends bt{constructor(r){if(super(r),r.type!==Rt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let o=[],s=[],n=0;for(let l of r)o[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=ga(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,m=o.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(o[d]===null)d++;else if(o[m]===null)m--;else if(l[d]===n[f])c[f]=se(o[d],s[f]),d++,f++;else if(l[m]===n[v])c[v]=se(o[m],s[v]),m--,v--;else if(l[d]===n[v])c[v]=se(o[d],s[v]),ze(r,c[v+1],o[d]),d++,v--;else if(l[m]===n[f])c[f]=se(o[m],s[f]),ze(r,o[d],o[m]),m--,f++;else if(u===void 0&&(u=ya(n,f,v),p=ya(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(n[f]),T=w!==void 0?o[w]:null;if(T===null){let C=ze(r,o[d]);se(C,s[f]),c[f]=C;}else c[f]=se(T,s[f]),ze(r,o[d],T),o[w]=null;f++;}else Sr(o[m]),m--;else Sr(o[d]),d++;for(;f<=v;){let w=ze(r,c[v+1]);se(w,s[f]),c[f++]=w;}for(;d<=m;){let w=o[d++];w!==null&&Sr(w);}return this.ut=n,fa(r,c),tt}});var Lr=a(()=>{let r=[];return {stack:r,promiseReadJpegChunks:a(t=>new Promise((e,o)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{o(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){o("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return n(t.slice(s,s+=m),f=>{if(f.byteLength!==m){o("Corrupted");return}r.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||o("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Mu=a(async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Lr();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ta=a(async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Lr();await s(r),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),o.push(u.length)});let l=[r.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(r.slice(c,e[u])),c=e[u]+o[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),Ou=226,Ea=a((r,i)=>Ta(r,Ou,i.map(t=>t.buffer)),"replaceIccProfile"),Iu=a(async r=>{try{return await Ea(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Lu=a((r,i,t)=>new Promise((e,o)=>{let s=a(n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);},"callback");r.toBlob(s,i,t),r.width=r.height=1;}),"canvasToBlob"),Ti=a(()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},"createCanvas"),Uu=a(r=>{let{ctx:t,canvas:e}=Ti();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},"hasTransparency"),Ru=a(async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Lr();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Pu="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Ir,$u=a(()=>new Promise(r=>{if(Ir!==void 0)r(Ir);else {let i=new Image;i.addEventListener("load",()=>{Ir=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Ir);}),i.src=Pu;}}),"isBrowserApplyExifOrientation"),Du=a((r,i)=>{let t,e,o,s;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=true;else if(r.getUint16(6)===19789)e=false;else return;if(r.getUint16(8,e)!==42)return;o=8+r.getUint32(10,e);let n=r.getUint16(o-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},"findExifOrientation"),Fu=a((r,i)=>{Du(r,(t,e)=>r.setUint16(t,i,e));},"setExifOrientation"),Vu=a(async(r,i,t)=>(t&&Fu(i,1),Ta(r,225,[i.buffer])),"replaceExif"),_u=a((r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),Nu=a(r=>_u(new Image,r),"imageLoader"),Bu=[1,3],zu=[192,193,194,195,197,198,199,201,202,203,205,206,207],wa={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hu=a(async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Lr();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&zu.indexOf(o)>=0){let n=s.getUint8(5);Bu.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),xa=a((r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},"memoize"),Ca=a((r,i)=>{let[t]=r,e=Object.keys(i).map(o=>parseInt(o,10)).sort((o,s)=>o-s);for(let o=0;o<e.length;o++){let s=e[o],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),ne={R:55,G:110,B:165,A:255},ju=`rgba(${ne.R}, ${ne.G}, ${ne.B}, ${ne.A/255})`,Sa=a((r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Ti();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ti();s.width=r,s.height=i,n&&(n.fillStyle=ju,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ne.R&&l[1]===ne.G&&l[2]===ne.B&&l[3]===ne.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}},"canvasTest");function Aa(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}a(Aa,"wrapAsync");var Ku=Aa(xa(Sa,Ca)),Gu=Aa(xa(Sa,Ca)),ka=a(async(r,i)=>{let t=wa.squareSide.find(n=>n*n>=r*i),e=wa.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([Ku(t,t),Gu(e,1)]);if(o&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Ma=a(async(r,i,t)=>{try{let{ctx:e,canvas:o}=Ti();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),qu=a(({img:r,targetW:i,targetH:t})=>Ma(r,i,t),"native"),Wu=a(function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,n=t;do o.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<r*e);return o.reverse()},"calcShrinkSteps"),Zu=a(({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Wu({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[l,c],u)=>n.then(p=>ka(l,c).then(()=>Ma(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),Xu=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Yu=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),hs=.71,Qu=a((r,i)=>{if(r.width*hs*r.height*hs<i.size)throw new Error("Not required");let t=r.width,e=r.height,o=t/e,s=Math.floor(Math.sqrt(i.size*o)),n=Math.floor(i.size/Math.sqrt(i.size*o));return ka(s,n).then(()=>{let{ctx:l}=Ti();return "imageSmoothingQuality"in l&&!Xu()&&!Yu?qu({img:r,targetW:s,targetH:n}):Zu({img:r,sourceW:t,targetW:s,targetH:n,step:hs})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Oa=a(async(r,i)=>{try{if(await Hu(r))throw new Error("Should skipped");let e=await Promise.allSettled([Ru(r),$u(),Mu(r)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Iu(r).catch(()=>r),p=await Nu(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Qu(p,i),m="image/jpeg",f=i?.quality||.8;!s&&Uu(d)&&(m="image/png",f=void 0);let v=await Lu(d,m,f);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await Vu(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await Ea(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var Ju=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ia=a(r=>{if(typeof r!="string")return false;let i=Ju.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Z=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")}),j=class j extends Ge{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.En=true;this.uid="";this.oo="";this.so="";this.ao="";this.et=0;this.xn=false;this.lo="";this.Cn=false;this.Sn=false;this.An=false;this.kn=false;this.Mn=false;this.Hi=false;this.On="";this.In=false;this.Zc=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(E.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT;});this.Xc=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Yc=()=>{this.Ln();};this.g=D(()=>this.Un(),100);this.Jc=this.withEntry(We((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===Z.FINISHED,c=e===Z.UPLOADING,u=e===Z.QUEUED_UPLOADING,p=e===Z.QUEUED_VALIDATION,d=e===Z.VALIDATION,m=t.getValue("fileName"),f="";o?f="":!l&&n&&s&&Object.values($t).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.ao=f,this.so=o,this.xn=c||u||p||d,this.et=p||d?0:t.getValue("uploadProgress"),this.On=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ln=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.g();try{let o=new AbortController;t.setValue("abortController",o);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File&&this.cfg.imageShrink)try{let d=Ia(this.cfg.imageShrink);d?l=await Oa(l,d):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:o.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Oo(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.g();}catch(o){this.telemetryManager.sendEventError(o,"file upload. Failed to upload file"),o instanceof Jt&&o.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof fe?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:o}):(console.error("Unknown upload error",o),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:o})})),t===this.entry&&this.g();}}});}static{a(this,"FileItem");}Un(){let t=this.entry;if(!t)return;let e=Z.IDLE;t.getValue("errors").length>0?e=Z.FAILED:t.getValue("isQueuedForUploading")?e=Z.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Z.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Z.VALIDATION:t.getValue("isUploading")?e=Z.UPLOADING:t.getValue("fileInfo")&&(e=Z.FINISHED),this.Qc(t,e);}Qc(t,e){e===Z.FAILED?this.lo="badge-error":e===Z.FINISHED&&(this.lo="badge-success"),e===Z.UPLOADING&&(this.kn=false,this.removeAttribute("focused")),this.Sn=e===Z.FAILED,this.An=e===Z.UPLOADING,this.Cn=e===Z.FINISHED,this.Mn=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.Jc(e);}reset(){super.reset(),this.g.cancel();}Ze(t){let[e]=t;e&&e.isIntersecting&&!this.In&&(this.En=false,this.In=true);}Rn(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.g();}),this.subEntry("isValidationPending",()=>{this.g();}),this.subEntry("uploadProgress",()=>{this.g();}),this.subEntry("isQueuedForUploading",()=>{this.g();}),this.subEntry("fileName",o=>{this.oo=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.g();}),this.subEntry("externalUrl",o=>{this.oo=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.g();}),this.subEntry("errors",()=>this.g()),this.subEntry("isUploading",()=>this.g()),this.subEntry("fileSize",()=>this.g()),this.subEntry("mimeType",()=>this.g()),this.subEntry("isImage",()=>this.g()),this.Un());}Pn(t){if(this.cfg.filesViewMode==="list"){this.Hi=true;return}this.Hi=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Rn(this.uid);}initCallback(){super.initCallback(),this.Rn(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.g()),this.subConfigValue("filesViewMode",t=>{this.Pn(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.Pn(t);}),this.onclick=()=>{j.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Ln());}),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.En?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Cn} ?data-uploading=${this.An} ?data-failed=${this.Sn} ?data-focused=${this.kn} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.lo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.On}><span class="uc-file-name" ?hidden=${!this.Hi}>${this.oo}</span><span class="uc-file-error" ?hidden=${!this.so}>${this.so}</span><span class="uc-file-hint" ?hidden=${!this.ao}>${this.ao}</span></div><div class="uc-file-actions"><button type="button" @click=${this.Zc} ?hidden=${!this.Mn} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" data-testid="edit" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.Xc} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Yc}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.et} .visible=${this.xn} ?hasFileName=${this.Hi}></uc-progress-bar></div>`}};h([g()],j.prototype,"En",2),h([b({attribute:false})],j.prototype,"uid",2),h([g()],j.prototype,"oo",2),h([g()],j.prototype,"so",2),h([g()],j.prototype,"ao",2),h([g()],j.prototype,"et",2),h([g()],j.prototype,"xn",2),h([g()],j.prototype,"lo",2),h([g()],j.prototype,"Cn",2),h([g()],j.prototype,"Sn",2),h([g()],j.prototype,"An",2),h([g()],j.prototype,"kn",2),h([g()],j.prototype,"Mn",2),h([g()],j.prototype,"Hi",2),h([g()],j.prototype,"On",2);var ms=j;function td(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(o=>{o.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}a(td,"checkIsDirectory");function ed(r,i){return new Promise(t=>{let e=0,o=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});o.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(o);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(o);});},"readReaderContent");s(r);})}a(ed,"readEntryContentAsync");function La(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let o=r.items[e];if(o)if(o.kind==="file"){let s=o.type,n=o;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(ed(c,s).then(u=>{u&&i.push(...u);}));continue}let l=o.getAsFile();l&&t.push(td(l).then(c=>{c||i.push({type:"file",file:l});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(La,"getDropItems");var ot=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ua=["focus"],id=100,fs=new Map;function rd(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}a(rd,"distance");function gs(r){let i=0,t=document.body,e=new Set,o=a(v=>{e.add(v);},"handleSwitch"),s=ot.INACTIVE,n=a(v=>{r.shouldIgnore()&&v!==ot.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");o(v=>r.onChange(v));let c=a(()=>{i=0,n(ot.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===ot.INACTIVE&&n(ot.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(ot.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(ot.INACTIVE);},"onDrop"),m=a(v=>{if(r.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=r.element.getBoundingClientRect(),C=Math.floor(rd(w,T)),x=C<id,A=v.composedPath().includes(r.element);fs.set(r.element,C);let vt=Math.min(...fs.values())===C;A&&vt?(v.preventDefault(),n(ot.OVER)):n(x&&vt?ot.NEAR:ot.ACTIVE);},"onDragOver"),f=a(async v=>{if(r.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await La(w);r.onItems(T),n(ot.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),r.element.addEventListener("drop",f),Ua.forEach(v=>{window.addEventListener(v,c);}),()=>{fs.delete(r.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),r.element.removeEventListener("drop",f),Ua.forEach(v=>{window.removeEventListener(v,c);});}}a(gs,"addDropzone");var vs=new Set,ht=class extends ${constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.$t=true;this.$n=true;this.Dn=null;this.co=null;this.Fn=O();this.xe=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.Vn=true;this.Ce=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get tu(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.$t)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=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&&o}initCallback(){super.initCallback(),vs.add(this),this.uo(),this.po(),this.Nn(),this._n(ot.INACTIVE),this.Dn=gs({element:this,shouldIgnore:a(()=>this.Bn(),"shouldIgnore"),onChange:a(t=>{this._n(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:H.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:H.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(E.activities.UPLOAD_LIST),this.set$({"*currentActivity":E.activities.UPLOAD_LIST})));},"onItems")}),this.updateComplete.then(()=>this.eu()),this.subConfigValue("sourceList",t=>{let e=q(t);this.Vn=e.includes(H.LOCAL),this.uo(),this.po();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.uo(),this.po());}updated(t){super.updated(t),t.has("clickable")&&this.Nn();}Bn(){if(!this.$t||!this.iu())return true;if(!this.fullscreen)return false;let t=vs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}iu(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}uo(){let t=this.Vn&&!this.disabled;this.$t=t;}po(){let t=this.$t||!this.querySelector("[data-default-slot]");this.$n=t,this.hidden=!t;}_n(t){let e=Object.entries(ot).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}eu(){if(this.co)return;let t=this.Fn.value;t&&(this.co=gs({element:t,onChange:a(e=>{let o=Object.entries(ot).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.Bn(),"shouldIgnore")}));}Nn(){this.clickable&&!this.Ce?(this.addEventListener("keydown",this.xe),this.addEventListener("click",this.xe),this.Ce=true):!this.clickable&&this.Ce&&(this.removeEventListener("keydown",this.xe),this.removeEventListener("click",this.xe),this.Ce=false);}disconnectedCallback(){super.disconnectedCallback(),vs.delete(this),this.Dn?.(),this.co?.(),this.Ce&&(this.removeEventListener("keydown",this.xe),this.removeEventListener("click",this.xe),this.Ce=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.Fn)} class="uc-content-wrapper" ?hidden=${!this.$n}><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.tu}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],ht.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],ht.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],ht.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],ht.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],ht.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],ht.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],ht.prototype,"initflow",2),h([b({type:String})],ht.prototype,"text",2),h([g()],ht.prototype,"$t",2),h([g()],ht.prototype,"$n",2);var kt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=E.activities.UPLOAD_LIST;this.zn=false;this.Hn=false;this.jn=false;this.ho=false;this.mo=false;this.ji=null;this.Kn=false;this.fo=null;this.Gn=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.go=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.Ot();};this.vo=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.It=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Ot=We(()=>{this.isConnected&&(this.su(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get ru(){return this.fo?this.ou(this.fo):""}su(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},o=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&o&&c&&f;}this.zn=p,this.Hn=d,this.jn=u,this.mo=e.total===0||!s&&!n,this.ho=!n||this.cfg.multiple,this.Kn=e.total>0,this.fo=e;}ou(t){let e=a(o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Ot),this.subConfigValue("multipleMin",this.Ot),this.subConfigValue("multipleMax",this.Ot),this.sub("*groupInfo",t=>{t&&this.Ot();}),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.Ot),this.uploadCollection.observeCollection(this.Ot),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.ji=null;return}this.ji=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Ot),this.uploadCollection.unobserveCollection(this.Ot));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.ru}</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.Kn}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${ba(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Gn} ?disabled=${!this.mo} ?hidden=${!this.ho} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.ji} >${this.ji??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.ho} ?disabled=${!this.mo} @click=${this.Gn} ><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.jn} @click=${this.go} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.zn} ?disabled=${!this.Hn} @click=${this.vo} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],kt.prototype,"zn",2),h([g()],kt.prototype,"Hn",2),h([g()],kt.prototype,"jn",2),h([g()],kt.prototype,"ho",2),h([g()],kt.prototype,"mo",2),h([g()],kt.prototype,"ji",2),h([g()],kt.prototype,"Kn",2),h([g()],kt.prototype,"fo",2);var Ur=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.URL;this.yo={importDisabled:true};this.Nt=O();this.bo=t=>{let e=t.target?.value??"";this.yo={importDisabled:!e};};this.go=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let o=this.Nt.value?.value?.trim();o&&(this.api.addFileFromUrl(o,{source:H.URL}),this.modalManager?.open(E.activities.UPLOAD_LIST),this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};}static{a(this,"UrlSource");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:a(()=>{let t=this.Nt.value;t&&(t.value="",t.focus()),this.yo={importDisabled:true};},"onActivate")});}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.go}><label><input ${L(this.Nt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.bo} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.yo.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],Ur.prototype,"yo",2);var Ra=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Pa="important",od=" !"+Pa,xe=dt(class extends bt{constructor(r){if(super(r),r.type!==Rt.ATTRIBUTE||r.name!=="style"||r.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(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.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 o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(od);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?Pa:""):t[e]=o;}}return tt}});var sd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},nd=["camera","microphone"];function Rr(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}a(Rr,"formatTime");var $a="image/jpeg",Da="video/webm",N=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CAMERA;this.Ki=null;this.wo=false;this.Xe=[];this.Et=null;this.xt=null;this.Gi=null;this.qi=null;this.v=null;this.Ye={};this.Ct=null;this.e=null;this.Se=[];this.Ae=[];this.nu={};this.Wi=[];this.Zi=null;this.qn=()=>{this.Wn(),this.Qe="pause";};this.Zn=()=>{this.Qe="play",this.au();};this.Je=O();this.Jt=O();this._=O();this.Xn=O();this.Yn=0;this.Qn=0;this.Jn=null;this.Xi=true;this.Yi=true;this.lu=Ra();this.ta=[];this.te=true;this.To="";this.ke=true;this.ee=true;this.Me=true;this.ea=[];this.ie=true;this.Eo=true;this.re=true;this.Lt=true;this.oe=true;this.Oe="camera-full";this.Qe="play";this.ia="microphone";this.Qi="uc-shot-btn uc-camera-action";this.cu=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===k.PHOTO&&this.uu(),this.v===k.VIDEO){if(this.Et?.state==="recording"){this.ra();return}this.du();}};this.pu=t=>{let e=t.target;e&&(this.qi=e.value,this.Ie());};this.hu=t=>{let e=t.target;e&&(this.Gi=e.value,this.Ie());};this.mu=()=>{this.Ie();};this.fu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.cu();};this.gu=()=>{this.vu();};this.yu=()=>{this.bu();};this.wu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.Tu();};this.Eu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.xu();};this.oa=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.sa(o);};this.na=()=>{let t=Math.floor((performance.now()-this.Yn+this.Qn)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Je.value;s&&(s.textContent=Rr(e)),this.ra();return}let o=this.Je.value;o&&(o.textContent=Rr(e));}else {let e=this.Je.value;e&&(e.textContent=Rr(t));}this.Le=requestAnimationFrame(this.na);};this.Cu=()=>{this.Yn=performance.now(),this.Qn=0,this.na();};this.aa=()=>{this.Le&&cancelAnimationFrame(this.Le);};this.Wn=()=>{let t=this._.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.Jt.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.Je.value;n&&(n.textContent=Rr(e)),this.Le=requestAnimationFrame(this.Wn);};this.au=()=>{this.Le&&cancelAnimationFrame(this.Le);};this.Le=null;this.du=()=>{try{this.Xe=[],this.Ye={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Ye.mimeType=t:MediaRecorder.isTypeSupported(Da)?this.Ye.mimeType=Da:this.Ye.mimeType="video/mp4",this.xt&&(this.Et=new MediaRecorder(this.xt,this.Ye),this.Et.start(),this.Et.addEventListener("dataavailable",e=>{this.Xe.push(e.data);}),this.Cu(),this.classList.add("uc-recording"),this.ti(wt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.ra=()=>{this.Et?.addEventListener("stop",()=>{this.Su(),this.aa(),this.ti(wt.STOP);}),this.Et?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.vu=()=>{if(this.Et?.state==="recording")return;let t=this._.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.bu=()=>{this.xt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.ia=t.enabled?"microphone":"microphone-mute",this.Eo=!t.enabled;});};this.Su=()=>{try{let t=new Blob(this.Xe,{type:this.Et?.mimeType}),e=URL.createObjectURL(t),o=this._.value;if(!o)return;o.muted=!1,o.volume=1,this.ei(null),o.src=e,this.Au(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Tu=()=>{if(this.ti(wt.RETAKE),this.v===k.VIDEO){this.ei(this.xt);let t=this._.value;t&&(t.muted=true);}this._.value?.play?.();};this.xu=()=>{if(this.ti(wt.ACCEPT),this.v===k.PHOTO){this.Ct?.toBlob(s=>{if(!s)return;let n=this.la("camera","jpeg",$a,s);this.ca(n);},$a);return}let t=new Blob(this.Xe,{type:this.Et?.mimeType}),e=this.ku(this.Et?.mimeType),o=this.la("video",e,`video/${e}`,t);this.ca(o),this.Xe=[];};this.Mu=t=>{t===wt.SHOT&&(this.oe=true,this.ee=true,this.Lt=true,this.Me=false,this.te=true),(t===wt.RETAKE||t===wt.ACCEPT)&&(this.oe=!this.q.includes(k.VIDEO),this.Lt=!this.q.includes(k.PHOTO),this.ee=false,this.Me=true,this.te=this.Se.length<=1);};this.Ou=t=>{t===wt.PLAY&&(this.ke=false,this.Lt=true,this.te=true,this.ie=true,this.Qe="pause",this.Oe="square",this.Qi="uc-shot-btn uc-camera-action uc-stop-record"),t===wt.STOP&&(this.ke=false,this.ee=true,this.re=true,this.Me=false),(t===wt.RETAKE||t===wt.ACCEPT)&&(this.ke=true,this.oe=!this.q.includes(k.VIDEO),this.Lt=!this.q.includes(k.PHOTO),this.ee=false,this.Me=true,this.re=!this.cfg.enableAudioRecording,this.Oe="video-camera-full",this.Qi="uc-shot-btn uc-camera-action",this.ie=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.te=this.Se.length<=1);};this.ti=t=>{this.v===k.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Mu(t),this.v===k.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Ou(t);};this.sa=t=>{this.Xn.value?.querySelectorAll("button").forEach(o=>{o.classList.toggle("uc-active",o.getAttribute("data-id")===t);}),t===k.PHOTO&&(this.Oe="camera-full",this.ie=true,this.re=true),t===k.VIDEO&&(this.Qe="play",this.Oe="video-camera-full",this.ie=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.re=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.la=(t,e,o,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:o})};this.ca=t=>{this.api.addFileFromObject(t,{source:H.CAMERA}),this.set$({"*currentActivity":E.activities.UPLOAD_LIST}),this.modalManager?.open(E.activities.UPLOAD_LIST);};this.ii=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===k.VIDEO&&this.cfg.enableAudioRecording,o=this.v===k.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Xi=false,this.ee=false,this.Lt=!this.q.includes(k.PHOTO),this.oe=!this.q.includes(k.VIDEO),this.Yi=true,this.ke=true,this.Oe=o,this.re=!e,this.ie=!e):t==="prompt"?(this.To="camera-permissions-prompt",this.Xi=true,this.ee=true,this.Lt=true,this.Yi=false,this.So()):(this.To="camera-permissions-denied",this.Xi=true,this.Yi=false,this.Lt=!this.q.includes(k.PHOTO),this.oe=!this.q.includes(k.VIDEO),this.Me=true,this.Qi="uc-shot-btn uc-camera-action",this.So());},300);this.Iu=()=>{if(!this.xt)return false;let t=this.xt?.getAudioTracks(),e=this.xt?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.So=()=>{this.wo&&(this._.value&&(this._.value.volume=0),this.Zi?.getTracks?.()?.[0]?.stop(),this.xo(this._.value),this.ei(null),this.Iu(),this.aa(),this.wo=false);};this.Ie=async()=>{let t={video:{...sd},audio:this.cfg.enableAudioRecording?{}:false};this.qi&&(t.video={deviceId:{exact:this.qi}}),this.Gi&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Gi}}),this._.value&&(this._.value.volume=0);try{this.ii("prompt"),this.xt=await navigator.mediaDevices.getUserMedia(t),this.xt.addEventListener("inactive",()=>{this.ii("denied");}),this.ei(this.xt),this.wo=!0,this.ii("granted");}catch(e){this.ii("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.ua=()=>{this.Ie();};this.Lu=async()=>{try{this.Ji();for(let t of nd){let e=await navigator.permissions.query({name:t});this.nu[t]=e,e.addEventListener("change",this.ua),this.Wi.push(()=>{e.removeEventListener("change",this.ua);});}this.Ki=()=>{this.Ji();};}catch(t){this.Ji(),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.Ie();}};this.Uu=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Ao(),navigator.mediaDevices.addEventListener("devicechange",this.Ao);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Ao=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Se=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ae=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.ta=this.Se,this.te=this.Se.length<=1,this.qi=this.Se[0]?.value??null,this.ea=this.Ae,this.ie=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.Gi=this.Ae[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Ru=async()=>{await this.Lu(),await this.Uu(),await this.Ie(),this.da(this.q);};this.Pu=async()=>{this.Ki&&this.Ki(),window.chrome||this.ii("denied"),this.So();};this.da=t=>{this.oe=!t.includes(k.VIDEO),this.Lt=!t.includes(k.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.sa(e);};}static{a(this,"CameraSource");}Au(t){this.xo(t),t.addEventListener("play",this.qn),t.addEventListener("pause",this.Zn);}xo(t){t?.removeEventListener("play",this.qn),t?.removeEventListener("pause",this.Zn);}ei(t){this.Zi!==t&&(this.Zi=t,this.Co());}Co(){let t=this._.value;if(!t)return;let e=this.Zi??null;t.srcObject!==e&&(t.srcObject=e);}uu(){if(this.ti("shot"),this.Ct=document.createElement("canvas"),this.e=this.Ct.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this._.value;if(!t)throw new Error("Video element not found");this.Ct.height=t.videoHeight,this.Ct.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.Ct.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}ku(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let o=t.split("/");if(o?.[0]==="video"){let n=o.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get q(){return q(this.cfg.cameraModes).filter(t=>t===k.PHOTO||t===k.VIDEO)}Ji(){if(this.Wi.length!==0){for(let t of this.Wi)t();this.Wi=[],this.Ki=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.Ru,onDeactivate:this.Pu}),this.subConfigValue("cameraMirror",t=>{this.Jn=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.re=!t,this.Eo=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=lt(t);this.da(e.filter(o=>o===k.PHOTO||o===k.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.Co();}updated(t){super.updated(t),this.Co();}$u(){this.Ji(),navigator.mediaDevices?.removeEventListener("devicechange",this.Ao),this.xo(this._.value),this.ei(null);}disconnectedCallback(){super.disconnectedCallback(),this.$u();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.te}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.ta} ?hidden=${this.te} @change=${this.pu} ></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=${xe({transform:this.Jn})} ?hidden=${this.Xi} ${L(this._)} ></video><div class="uc-message-box" ?hidden=${this.Yi}><span>${this.l10n(this.To)}</span><button type="button" @click=${this.mu} ?hidden=${this.lu} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${L(this.Xn)} class="uc-switcher" ?hidden=${!this.ke}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.oa} ?hidden=${this.Lt} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.oa} ?hidden=${this.oe} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.gu} ?hidden=${this.ke} data-testid="recording-timer" ><uc-icon name=${this.Qe}></uc-icon><span ${L(this.Je)}> 00:00 </span><span ${L(this.Jt)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Me} ><button type="button" class="uc-secondary-btn" @click=${this.wu}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Eu} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.fu} class=${this.Qi} ?hidden=${this.ee} ><uc-icon name=${this.Oe}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.yu} ?hidden=${this.re} data-testid="toggle-microphone" ><uc-icon name=${this.ia}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.ea} ?hidden=${this.ie} ?disabled=${this.Eo} @change=${this.hu} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],N.prototype,"Jn",2),h([g()],N.prototype,"Xi",2),h([g()],N.prototype,"Yi",2),h([g()],N.prototype,"lu",2),h([g()],N.prototype,"ta",2),h([g()],N.prototype,"te",2),h([g()],N.prototype,"To",2),h([g()],N.prototype,"ke",2),h([g()],N.prototype,"ee",2),h([g()],N.prototype,"Me",2),h([g()],N.prototype,"ea",2),h([g()],N.prototype,"ie",2),h([g()],N.prototype,"Eo",2),h([g()],N.prototype,"re",2),h([g()],N.prototype,"Lt",2),h([g()],N.prototype,"oe",2),h([g()],N.prototype,"Oe",2),h([g()],N.prototype,"Qe",2),h([g()],N.prototype,"ia",2),h([g()],N.prototype,"Qi",2);function Ei(r,i,t){return r?i(r):t?.(r)}a(Ei,"n");function Fa(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(Fa,"normalize");function mt(...r){let i=Fa(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(mt,"classNames");function Va(r,...i){let t=Fa(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}a(Va,"applyClassNames");var ad=a(r=>it.includes(r),"isTabIdValue"),_a=a(r=>{if(!r)return it;let i=lt(r).filter(ad);return i.length===0?it:i},"parseTabs");function Na(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":it,"*tabId":_.CROP,"*on.retryNetwork":a(()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=At,t.src=e;}r.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=et(Qt(i),"preview"),o=G(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:o,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),r.remove();},"*on.apply"),"*on.cancel":a(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(Na,"initState");var Ba="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ce={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},xi=class extends S{constructor(){super(...arguments);this.Tt=false;this.pa=Ce;this.ha=Ce.visible;this.ma=Ce.hidden;this.ko=false;this.fa=false;}static{a(this,"PresenceToggle");}set visible(t){this.Tt=t,this.ga();}get visible(){return this.Tt}set styles(t){this.pa=t,this.ko=true,this.ha=t.visible??Ce.visible,this.ma=t.hidden??Ce.hidden;}get styles(){return this.pa}ga(){this.style.visibility=this.Tt?"inherit":"hidden",Va(this,{[Ce.transition]:!this.ko,[this.ha]:this.Tt,[this.ma]:!this.Tt}),this.toggleAttribute("inert",!this.Tt);}Du(){this.fa||(this.fa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ko||this.classList.add(Ce.transition),this.ga(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Du();},0);}};h([b({type:Boolean})],xi.prototype,"visible",1),h([b({attribute:false})],xi.prototype,"styles",1);var Pr=class extends S{constructor(){super(...arguments);this.active=false;this.Jt=O();this.Mo=false;this.Oo=()=>{let t=this.Jt.value;t&&(this.va(t),this.Mo&&this.active&&this.Io());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.Io();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Io():this.Fu());}Io(){let t=this.Jt.value;if(!t)return;this.Mo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Oo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Oo,{once:true});}Fu(){let t=this.Jt.value;t&&(this.Mo=false,t.removeEventListener("transitionend",this.Oo),this.va(t));}va(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.Jt)}></div></div>`}};h([b({type:Boolean,reflect:true})],Pr.prototype,"active",2);var ae=dt(class extends bt{constructor(r){if(super(r),r.type!==Rt.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.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=r.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let o=!!i[e];o===this.st.has(e)||this.nt?.has(e)||(o?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return tt}});var K=a(r=>r??P,"o");var Mt=class extends S{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.ya(),this.ba();}updated(t){super.updated(t),t.has("reverse")&&this.ya(),t.has("theme")&&this.ba();}ya(){this.style.flexDirection=this.reverse?"row-reverse":"";}ba(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Vu(){let t=this.Lo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Nu}}get Lo(){return !this.icon}get Nu(){return !this.text&&!this.Lo}render(){return y`<button type="button" role=${K(this.ariaRole||void 0)} aria-controls=${K(this.ariaControls||void 0)} aria-label=${K(this.l10n(this.titleProp))} title=${K(this.l10n(this.titleProp))} ><uc-icon class=${ae(this.Vu)} name=${K(this.icon||void 0)} ?hidden=${this.Lo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],Mt.prototype,"text",2),h([b({type:String})],Mt.prototype,"icon",2),h([b({type:Boolean,reflect:true})],Mt.prototype,"reverse",2),h([b({type:String,reflect:true})],Mt.prototype,"theme",2),h([b({attribute:"aria-role"})],Mt.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],Mt.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],Mt.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],Mt.prototype,"active",2);function za(r,i){let t={};for(let e of i){let o=r[e];(Object.hasOwn(r,e)||o!==void 0)&&(t[e]=o);}return t}a(za,"pick");function Ze(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return G(r,et(Gi,Qt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}a(Ze,"viewerImageSrc");var $r=class extends S{constructor(){super(...arguments);this.wa=`uc-backdrop-mask-${ut.generateFastUid()}`;this.er=false;this.ni=false;this.xa=O();this.ai=false;this.li=null;this.Sa=t=>{this.Aa(),this.ci&&(t.stopPropagation(),t.preventDefault(),this.ci=false);};this.ka=t=>{if(!this.ci||!this.tr||!this.Ro)return;t.stopPropagation(),t.preventDefault();let e=this._t;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,l=t.y-s,c=n-this.tr[0],u=l-this.tr[1],{direction:p}=this.Ro,d=this.Wu(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Ma=t=>{if(!this.Ut)return;let e=Object.values(this.Ut).find(o=>{if(!o||this.$o(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return ia(l,[t.x,t.y])});this.Ta=e,this.Aa();};}static{a(this,"CropFrame");}get _t(){return this.xa.value??null}get ci(){return this.ni}set ci(t){this.ni!==t&&(this.ni=t,this.Po());}Po(){this.oi&&this.oi.setAttribute("class",mt({"uc-guides--hidden":this.er,"uc-guides--visible":!this.er&&this.ni,"uc-guides--semi-hidden":!this.er&&!this.ni}));}$o(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let o=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return o||s}_u(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,l=this._t;if(!l)return;let c=pt("mask",{id:this.wa}),u=pt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=pt("rect",{x:e,y:o,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=pt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.wa})`});l.appendChild(d),l.appendChild(c),this.ri=c,this.Uo=p;}Bu(){this.ri&&(this.ri.style.display="none",window.requestAnimationFrame(()=>{this.ri&&(this.ri.style.display="block");}));}zu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this.Uo&&re(this.Uo,{x:e,y:o,width:s,height:n});}Hu(){let t=this.$["*cropBox"];if(!(!t||!this.oi||!this.Ut)){for(let e of Object.values(this.Ut)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:l}=e,c=o==="",u=o.length===2,{x:p,y:d,width:m,height:f}=t;if(c)re(n,{x:p,y:d,width:m,height:f});else {let w=oe(Math.min(m,f)/82/2,0,1),T=u?Yn(t,o,w):Qn(t,o,w),C=T.center;if(!C)continue;let x=Math.max(Yo*oe(Math.min(m,f)/Yo/3,0,1),Xn);re(n,{x:C[0]-x,y:C[1]-x,width:x*2,height:x*2}),re(s,{d:T.d});}let v=this.$o(o);l.setAttribute("class",mt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}re(this.oi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Ca(t,e){let o=pt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=pt("rect",{fill:"transparent"}),n=pt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(n),o.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.ju.bind(this,e));}Ku(){let t={};for(let e=0;e<3;e++)for(let o=0;o<3;o++){let s=`${["n","","s"][e]}${["w","","e"][o]}`;s!==""&&this.Ca(t,s);}return this.Ca(t,""),t}Gu(){let t=pt("svg"),e=pt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let o=1;o<=2;o++){let s=pt("line",{x1:`${hi*o}%`,y1:"0%",x2:`${hi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=pt("line",{x1:"0%",y1:`${hi*o}%`,x2:"100%",y2:`${hi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}qu(){let t=this._t;if(!t)return;let e=document.createDocumentFragment(),o=this.Gu();e.appendChild(o);let s=this.Ku();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Ut=s,this.oi=o,this.Po();}ju(t,e){if(!this.Ut)return;let o=this.Ut[t];if(!o||this.$o(t))return;let s=this.$["*cropBox"],n=this._t;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.ci=true,this.Ro=o,this.tr=[u,p],this.Ea={...s};}Wu(t,e){let[o,s]=e,n=this.$["*imageBox"],l=this.Ea??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=ta({rect:l,delta:[o,s],imageBox:n}):l=ea({rect:l,delta:[o,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return Fe(_e(l),n)}Aa(){let t=this.Ta,e=this._t;e&&(e.style.cursor=t?Jn(t.direction):"initial");}Oa(t){if(this.si){this.si.setAttribute("href",t);return}let e=this._t;if(!e){this.li=t;return}this.li=null;let o=document.createDocumentFragment(),s=pt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.si=s;}Zu(){let t=this.$["*cropBox"];if(!t||!this.si)return;let{x:e,y:o,width:s,height:n}=t;re(this.si,{x:e,y:o,height:n,width:s});}Do(){this.ai&&(this.zu(),this.Hu(),this.Zu());}toggleThumbs(t){if(this.Ut)for(let e of Object.values(this.Ut)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",mt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Bu(),this.ai&&window.requestAnimationFrame(()=>{this.Do();});}),this.sub("*cropBox",t=>{t&&(this.er=t.height<=M||t.width<=M,this.Po(),this.ai&&window.requestAnimationFrame(()=>{this.Do();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Oa(t);}),document.addEventListener("pointermove",this.ka,true),document.addEventListener("pointerup",this.Sa,true);}firstUpdated(t){super.firstUpdated(t),this.Xu();}Xu(){let t=this._t;if(!(!t||this.ai)){if(this._u(),this.qu(),this.ai=true,t.addEventListener("pointermove",this.Ma,true),this.li){let e=this.li;this.li=null,this.Oa(e);}this.Do();}}disconnectedCallback(){super.disconnectedCallback(),this._t?.removeEventListener("pointermove",this.Ma,true),document.removeEventListener("pointermove",this.ka,true),document.removeEventListener("pointerup",this.Sa,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.xa)}></svg>`}};h([g()],$r.prototype,"ni",2);function cd(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(o=>Number.isInteger(o)&&Number.isFinite(o)),({dimensions:t,coords:e})=>t.every(o=>o>0)&&e.every(o=>o>=0)].every(t=>t(r)):true}a(cd,"validateCrop");var Dr=class extends S{constructor(){super();this.ctxOwner=true;this.se={width:0,height:0};this.e=null;this.E=false;this.ot=null;this.La=O();this.Vo=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Ia=D(this.Ua.bind(this),300),this.Fo=We(()=>{!this.isConnected||!this.E||(this.No(),this.Ra(),this.Pa(),this._o(),this.Bo());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.No();}Ra(){let t=this.$["*editorTransformations"],e=za(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}No(){let t=this.La.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*n,t.height=s*n,e?.scale(n,n),this.Ct=t,this.e=e;}Pa(){if(!this.E||!this.ot)return;let t=this.ot,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},l=Ve({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,m=d/u,f=0+e,v=e+(n.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=n.height-e*2,m=d*u,f=e+(n.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,m=e+(n.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=_e(c);}_o(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[m,f],coords:[v,w]}=n,{width:T}=Ve(this.se,s),C=l/T;t=Fe(_e({x:c+v*C,y:u+w*C,width:m*C,height:f*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!ra(t,e)||d&&!oa(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=Fe(_e(t),e);}Yu(){let t=this.e;if(!t)return;let e=this.ot;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=Ve({width:o.width,height:o.height},c);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}Bo(){if(!this.E||!this.ot||!this.Ct||!this.e)return;let t=this.Ct;this.e.clearRect(0,0,t.width,t.height),this.Yu();}Qu({fromViewer:t}){this.ot&&(this.Vo.value?.toggleThumbs(true),this.Ju(),setTimeout(()=>{this.className=mt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}$a(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l}=e,{width:c,height:u}=Ve(this.se,s),{width:p,height:d}=t,m=n/c,f=l/u;return [oe(Math.round(p/m),1,c),oe(Math.round(d/f),1,u)]}td(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=Ve(this.se,s),{x:m,y:f}=t,v=n/p,w=l/d,T=this.$a(),C={dimensions:T,coords:[oe(Math.round((m-c)/v),0,p-T[0]),oe(Math.round((f-u)/w),0,d-T[1])]};if(!cd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}Ua(){if(!this.isConnected||!this.se)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.td(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.E&&(this.Pa(),this._o(),this.Bo());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.E){this.E=true,await this.updateComplete,this.No(),this.se=t,this.removeEventListener("transitionend",this.Da);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.ot=await this.ed(o,s),this.Ra(),this.Fo(),this.Qu({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.E&&this.ot&&this.Fo();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.E&&(!t&&this.Ua(),this.E=false,this.rd(),this.className=mt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Vo.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Da,{once:true}),this.s?.disconnect());}rd(){let t=this.$a(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(o,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}Ju(){let t=this.$["*cropBox"],e=t.x+t.width/2,o=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${o}px`;}Da(){this.E||(this.ot=null);}async ed(t,e){let o=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Ze(t,o,e)),{promise:n,cancel:l,image:c}=Ee(s),u=this.Ue(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}Ue(t){let e="crop",o=this.$["*loadingOperations"],s=o.get(e);return s||(s=new Map,o.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Bo();}),this.sub("*cropBox",()=>{this.ot&&this.Ia();}),this.sub("*currentAspectRatio",()=>{this._o();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.E&&this.se&&this.activate(this.se,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.ot&&(this.ot=null);}render(){return y`<canvas class="uc-canvas" ${L(this.La)}></canvas><uc-crop-frame ${L(this.Vo)}></uc-crop-frame>`}};h([g()],Dr.prototype,"ot",2);function ys(r,i,t){let e=t,o=t-1,s=new Array(e);for(let n=o;n>=0;n-=1)s[n]=Math.ceil((n*i+(o-n)*r)/o);return s}a(ys,"linspace");function ud(r){return typeof r=="string"&&r in Ct}a(ud,"isOperationKey");function dd(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],o=r[t+1];typeof e=="number"&&typeof o=="number"&&i.push([e,o]);}return i}a(dd,"splitBySections");function pd(r,i,t){let e=dd(r).find(([n,l])=>n<=i&&i<=l);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let l=Math.abs(o-s)||1,c=Math.abs(i-o)/l;return o===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(pd,"calculateOpacities");function hd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}a(hd,"calculateZIndices");function Ha(r,i){let t=Ct[r].keypointsNumber,{range:e,zero:o}=Ct[r];return [...new Set([...ys(e[0],o,t+1),...ys(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}a(Ha,"keypointsRange");var bs=class extends S{constructor(){super();this.E=false;this.zo=true;this.n="initial";this.Fa={};this.Bt=[];this.Na=0;this.Ba=O();this.ir=O();this.classList.add("uc-inactive_to_cropper"),this._a=D(async(t,e,o)=>{let s=a(()=>!this.za(t,e)||this.Te!==o||!!this.Bt.find(u=>u.value===o),"shouldSkip");if(s())return;let n=await this.Ha(t,o),l=new Image;l.src=n.src;let c=this.Ue(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Bt,p=u.findIndex(v=>v.value>o);p===-1&&(p=u.length);let m=u[p]?.image,f=this.ir.value;!f||m&&!f.contains(m)||(u.splice(p,0,n),m?f.insertBefore(l,m):f.appendChild(l),this.Ko(t,o));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}Ue(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}ja(){window.cancelAnimationFrame(this.Na),this.Na=window.requestAnimationFrame(()=>{for(let t of this.Bt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ne({url:t=this.Va,filter:e=this.m??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.Fa};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let l=this.offsetWidth;return this.proxyUrl(Ze(t,l,n))}async Ha(t,e){return {src:await this.ne({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}za(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!ud(this.n)||!Number.isFinite(e)||(this.Ko(this.n,e),this._a(this.n,this.m,e));}Ko(t,e){this.n=t,this.Te=e;let{zero:o}=Ct[t],s=this.Bt.map(c=>c.value),n=pd(s,e,o),l=hd(s,o);this.Bt.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.ja();}Ka(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async od(){this.a=this.a||this.Ka();let t=this.a;t&&this.Ga(t);let e=this.Bt.map(u=>u.src),{images:o,promise:s,cancel:n}=wi(e);o.forEach(u=>{let p=this.Ue(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Ho=()=>{n(),this.Ho=void 0;};let l=this.n,c=this.m;if(await s,this.E&&this.za(l,c)){let u=this.ir.value;if(!u)return;u.replaceChildren(),this.Bt.forEach((p,d)=>{let m=o[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.ja();}}async setTransformations(t){if(this.Fa=t,this.a){let e=await this.ne(),o=this.Ue(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.jo?.();let n=Ha(o,s),l=await Promise.all(n.map(u=>this.ne({url:t,filter:e,operation:o,value:u}))),{cancel:c}=wi(l);this.jo=c;}sd(t){let e=this.a||this.Ka();if(this.Ga(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=mt({"uc-active_from_viewer":this.ui,"uc-active_from_cropper":!this.ui,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.Ue(t);e.addEventListener("error",o,{once:true}),e.src=t,e.addEventListener("load",()=>{o(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=mt({"uc-active_from_viewer":this.ui,"uc-active_from_cropper":!this.ui,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:n}){if(this.E=true,this.zo=false,await this.updateComplete,this.Va=t,this.n=e??"initial",this.Te=o,this.m=s,this.ui=n,typeof o!="number"&&!s){let c=await this.ne({operation:e,value:o});this.sd(c),this.Go();return}!e||typeof o!="number"||(this.Bt=await Promise.all(Ha(e,o).map(c=>this.Ha(e,c))),this.Ko(e,o),this.od());}deactivate({hide:t=true}={}){this.E=false,this.Ho?.(),this.jo?.(),t&&!this.zo?(this.zo=true,this.a&&(this.a.style.transform="scale(1)"),this.className=mt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Go();},{once:true})):this.Go();}Ga(t){let e=this.Ba.value;e&&(e.contains(t)||e.appendChild(t));}Go(){this.ir.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Ba)}></div><div class="uc-fader-layers-host" ${L(this.ir)}></div>`}};var Wt=class extends S{constructor(){super();this.qo=0;this.Nt=O();this.Wa=O();this.Za=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.zt=0;this.ad=t=>{t.stopPropagation();let e=this.Xa(t);e!==null&&(this.Wo(e),this.nd("slider-input",e));};this.ld=t=>{t.stopPropagation();let e=this.Xa(t);e!==null&&this.Wo(e);};this.Ya=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Qa=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}nd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.qo=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Ja(this.zt),this.Zo(),this.s=new ResizeObserver(()=>{this.Zo(),this.rr(this.zt);}),this.s.observe(this);let e=this.Nt.value;e?.addEventListener("focus",this.Ya),e?.addEventListener("blur",this.Qa),window.setTimeout(()=>{this.rr(this.zt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.zt&&this.Wo(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Zo(),this.rr(this.zt)),t.has("zero")&&this.hasUpdated&&this.tl(this.zt);}rr(t){this.tl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(o-this.qo)/100;window.requestAnimationFrame(()=>{let c=this.Wa.value;c&&(c.style.transform=`translateX(${l}px)`);});}tl(t){if(!this.di)return;let e=this.max-this.min;if(e===0)return;this.di.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(o-this.qo)/100;window.requestAnimationFrame(()=>{this.di&&(this.di.style.transform=`translateX(${l}px)`);});}Zo(){let e=this.Za.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.qa===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.di=p,e.innerHTML="",e.appendChild(l),this.qa=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Nt.value;t?.removeEventListener("focus",this.Ya),t?.removeEventListener("blur",this.Qa),this.s?.disconnect(),this.s=void 0;}Wo(t){Number.isFinite(t)&&(this.zt=t,this.hasUpdated&&(this.Ja(t),this.rr(t)));}Ja(t){let e=this.Nt.value;e&&(e.value=String(t));}Xa(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return y`<div class="uc-steps" ${L(this.Za)}></div><div class="uc-thumb" ${L(this.Wa)}></div><input class="uc-input" type="range" ${L(this.Nt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.zt)} ?disabled=${this.disabled} @input=${this.ad} @change=${this.ld} />`}};h([b({type:Boolean,reflect:true})],Wt.prototype,"disabled",2),h([b({type:Number})],Wt.prototype,"min",2),h([b({type:Number})],Wt.prototype,"max",2),h([b({type:Number,attribute:false})],Wt.prototype,"defaultValue",2),h([b({type:Number})],Wt.prototype,"zero",2),h([g()],Wt.prototype,"zt",2);var Ft="original",Fr=class extends S{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.bo=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.cd();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===Ft?void 0:this.state.value,filter:this.state.filter===Ft?void 0:this.state.filter,fromViewer:false});}cd(){let t=this.state.operation,{range:e,zero:o}=Ct[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:o;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Ft?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.bo} ></uc-slider-ui>`}};h([g()],Fr.prototype,"state",2);function Xe(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(Xe,"parseFilterValue");var st=class extends S{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}il(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.il();}updated(t){super.updated(t),t.has("active")&&this.il();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],st.prototype,"active",2),h([g()],st.prototype,"title",2),h([g()],st.prototype,"icon",2),h([g()],st.prototype,"titleProp",2);var Vr=12,_r=16,md=a(r=>{let i=12,t=12;return r.width/r.height>=1?(i=Vr,t=Math.round(Vr*r.height/r.width)):(t=Vr,i=Math.round(Vr*r.width/r.height)),{width:i,height:t}},"getAdjustResolutions"),ws=class extends st{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.ud(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ud(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Nr=class extends st{constructor(){super(...arguments);this.X=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.rl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.rl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}rl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");o(),s(),e||this.requestUpdate();}dd(){let t=this.X;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=md(t),s=(_r-e)/2,n=(_r-o)/2;return y`<uc-icon><svg viewBox="0 0 ${_r} ${_r}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${o} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} >${this.dd()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],Nr.prototype,"aspectRatio",1);function fd(r){let i=r+90;return i=i>=360?0:i,i}a(fd,"nextAngle");function gd(r,i){if(r==="rotate")return fd(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}a(gd,"nextValue");var Br=class extends st{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=gd(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};h([b({type:String})],Br.prototype,"operation",2);var le=class extends st{constructor(){super(...arguments);this.n="";this.m="";this.pi="";this.or=0;this.a=null;this.Pe=false;this.isOriginal=false;this.ol=20;}static{a(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let o=this.m;this.m=e,this.n="filter",this.isOriginal=e===Ft,this.icon=this.isOriginal?"original":"slider",this.ol=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.sl(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:Xe(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}pd(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.ol||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==Ft?{name:this.m,amount:l}:void 0,G(this.pi,et(Gi,Qt(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}async Ze(t,e){t[0]?.isIntersecting?await this.Xo(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.pi=t??"",this.sub("*originalUrl",e=>{this.pi=e??"",!this.isOriginal&&this.pi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.ae());}),this.isOriginal||(this.s?.observe(this),this.ae()),this.m&&this.sl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Xo():this.ae());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.sr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.ae()));}sl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Xo(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.pi){!this.Re&&!this.Ht&&this.ae();return}let e=++this.or,o="";try{o=await this.proxyUrl(this.pd());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Pe=false,this.b?.();let{promise:s,cancel:n}=Ee(o);this.b=()=>{n(),this.or===e&&(this.b=void 0);};try{if(await s,this.or!==e||!this.isConnected)return;this.a=o,this.Pe=!0,this.sr(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.ae();}finally{this.or===e&&(this.b=void 0);}}ae(){if(!this.isConnected||this.a||this.Pe||this.isOriginal||this.$["*networkProblems"]){this.sr();return}this.Ht&&cancelAnimationFrame(this.Ht),this.Ht=requestAnimationFrame(()=>{if(this.Ht=void 0,!this.isConnected||this.a||this.Pe||this.isOriginal){this.sr();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<o){this.Xo();return}this.Re=window.setTimeout(()=>{this.Re=void 0,this.ae();},500);});}sr(){this.Ht&&(cancelAnimationFrame(this.Ht),this.Ht=void 0),this.Re&&(window.clearTimeout(this.Re),this.Re=void 0);}get hd(){return !!(this.Pe&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.hd?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Pe} style=${xe(e)}></div><uc-icon class=${ae({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${xe(o)} ></uc-icon></button>`}};h([g()],le.prototype,"a",2),h([g()],le.prototype,"Pe",2),h([g()],le.prototype,"isOriginal",2),h([g()],le.prototype,"ol",2),h([b({type:String})],le.prototype,"filter",1);var zr=class extends st{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.nl(e);}nl(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),o=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),o();}initCallback(){super.initCallback(),this.n&&this.nl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Ct[this.n],o=t[this.n],s=typeof o<"u"?o!==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:Xe(this.$["*operationTooltip"])});}};h([b({type:String})],zr.prototype,"operation",1);var vd=1,ja=a(()=>{},"noopScrollListener"),Hr=class extends S{constructor(){super(...arguments);this.hiddenScrollbar=false;this.al=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>vd){this.scrollLeft+=o;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.al,{passive:false}),this.addEventListener("scroll",ja,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.al),this.removeEventListener("scroll",ja),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Hr.prototype,"hiddenScrollbar",2);var ft=class extends S{constructor(){super(...arguments);this.hi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.ll=true;this.tabList=[...it];this.activeTab=_.CROP;this.nr=true;this.Yo=false;this.cl=null;this.ul=0;this.dl=0;this.ar=O();this.pl=O();this.tabToggleRefs={[_.CROP]:O(),[_.TUNING]:O(),[_.FILTERS]:O()};this.hl=()=>{this.le();};this.mi=[];this.lr=D(t=>{this.hi=t;},500);this.cr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===_.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${n}`;}else o=this.l10n(Ft);else if(this.showSubToolbar&&this.$["*tabId"]===_.TUNING&&e){s=true;let n=t?.[e]||Ct[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.Yo=s;},0);this.md={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.fd={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.gd={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.vd={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Ft,"*currentOperation":null,"*operationTooltip":null};this.It=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.es=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Md=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Xe(this.$["*operationTooltip"])}),this.ar.value?.apply(),this.ml();};this.Od=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.ar.value?.cancel(),this.ml();};this.Id=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.Qo(o,{fromViewer:false}));};}static{a(this,"EditorToolbar");}ml(){this.$["*showSlider"]=false,this.$["*tabId"]===_.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===_.TUNING&&(this.Yo=false);}Qo(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.fl(t,{fromViewer:e,force:o});}fl(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.le();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===_.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of it){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.le();}}le(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.pl.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.ul!==s||this.dl!==n)&&(this.ul=s,this.dl=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get Jo(){return this.mi.length>=3}yd(t){switch(t){case _.CROP:return this.bd();case _.FILTERS:return this.wd();case _.TUNING:return this.Td();default:return []}}bd(){let t=[];if(this.Jo)t.push(()=>this.Ed());else for(let e of this.mi)t.push(()=>this.gl(e));for(let e of cn)t.push(()=>this.xd(e));return this.ts(t)}wd(){let e=[Ft,...ln].map(o=>()=>this.Cd(o));return this.ts(e)}Td(){let t=an.map(e=>()=>this.Sd(e));return this.ts(t)}ts(t){return t.length?t.map(o=>o()):[]}Ed(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}gl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}xd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Cd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Sd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Ad(){return this.Jo?this.mi.map(t=>this.gl(t)):[]}async kd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ze(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:o}=wi([e]);this.b=()=>{o(),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.Qo(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.cr();}),this.sub("*currentOperation",()=>{this.cr();}),this.sub("*tabId",e=>{this.fl(e,{fromViewer:false,force:true}),this.cr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.kd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,n]of s.entries())if(n){o=true;break}}this.lr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.nr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.nr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.ll=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.Qo(o,{fromViewer:false});return}this.le();}),this.sub("*operationTooltip",e=>{this.cl=e;}),this.cr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.hl);}firstUpdated(t){super.firstUpdated(t),this.ur(),this.le();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.le()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.ur();}disconnectedCallback(){window.removeEventListener("resize",this.hl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}ur(){let t=this.ar.value;t&&(this.$["*sliderEl"]=t);}Ld(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?xe({gridColumn:`${s+1}`}):P;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.gd}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${o?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${o} style=${n} @click=${this.Id} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Ud(t){let e=this.yd(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:P}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Yo?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Jo;return y`<uc-line-loader-ui .active=${this.hi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.cl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.md} ><div class="uc-tab-content-row">${it.map(o=>Ei(this.activeTab===o,()=>this.Ud(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.ll} .styles=${this.vd} @initial-render=${()=>this.le()} ><div class="uc-tab-toggles_indicator" ${L(this.pl)} ></div>${it.map(o=>this.Ld(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.It} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.es}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.fd}><div class="uc-slider" ?hidden=${!this.nr}><uc-editor-slider ${L(this.ar)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.nr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.Ad()}</div>`:P}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Od} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Md} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],ft.prototype,"hi",2),h([g()],ft.prototype,"showMainToolbar",2),h([g()],ft.prototype,"showSubToolbar",2),h([g()],ft.prototype,"ll",2),h([g()],ft.prototype,"tabList",2),h([g()],ft.prototype,"activeTab",2),h([g()],ft.prototype,"nr",2),h([g()],ft.prototype,"Yo",2),h([g()],ft.prototype,"cl",2),h([g()],ft.prototype,"mi",2);var Ka=Bt([...it]),nt=class extends S{constructor(){super(...arguments);this.ctxOwner=true;this.Rd="";this.ne=At;this.Pd="";this.hi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Ka;this.vl=false;this.Pt=false;this.rs=null;this.lr=D(t=>{this.hi=t;},300);this.dr=O();this.yl=O();this.bl=O();this.wl=O();this.Tl=()=>{this.lr(false),this.ne!==At&&(this.$["*networkProblems"]=false);};this.El=()=>{this.lr(false),this.$["*networkProblems"]=true;};this.$d=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Na(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Dd(){this.Pt||this.rs||(this.rs=this.updateComplete.then(()=>{this.rs=null,this.Pt=true;}));}initCallback(){super.initCallback(),this.xl(),this.Cl();}ur(){let t=this.bl.value;t&&(this.$["*faderEl"]=t);let e=this.yl.value;e&&(this.$["*cropperEl"]=e);let o=this.wl.value;o&&(this.$["*imgContainerEl"]=o);let s=this.dr.value;s&&(this.$["*imgEl"]=s);}Fd(){let t=this.dr.value;t&&(t.addEventListener("load",this.Tl),t.addEventListener("error",this.El));}Vd(){let t=this.dr.value;t&&(t.removeEventListener("load",this.Tl),t.removeEventListener("error",this.El));}get Nd(){let t=this.$["*tabId"];return mt("uc-image",{"uc-image_hidden_to_cropper":t===_.CROP,"uc-image_hidden_effects":t!==_.CROP})}Sl(){return new Promise((e,o)=>{let s=window.setTimeout(()=>{o(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(l=>{let[c]=l;c&&c.contentRect.width>0&&c.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.ur(),this.Fd(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.Vd(),super.disconnectedCallback();}render(){let t=this.Pd??"",e=this.Rd??"",o=this.ne||At,s=this.hi,n=this.vl;return y` ${cr(Ba)}<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.$d}></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" ${L(this.wl)}><img src=${o} class=${this.Nd} ${L(this.dr)} />${Ei(this.Pt,()=>y`<uc-editor-image-cropper ${L(this.yl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.bl)}></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">${Ei(this.Pt,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.xl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Cl();}xl(){let t=this.tabs||Ka;this.$["*tabList"]=_a(t);}Cl(){let t=wr(this.cropPreset??""),e=null;if(this.cdnUrl){let o=go(this.cdnUrl),s=vo(o);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=na(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Sl(),this.cdnUrl){let t=this.cdnUrl,e=Ki(t),o=Yt(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=go(t),n=vo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Yt(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"]===_.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(G(t,et("json"))),o=await fetch(e).then(l=>l.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===_.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.Dd();}}async initEditor(){try{await this.Sl();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.vl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=et(Qt(t),"preview"),s=G(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],nt.prototype,"Rd",2),h([g()],nt.prototype,"ne",2),h([g()],nt.prototype,"Pd",2),h([g()],nt.prototype,"hi",2),h([b({type:String,reflect:true})],nt.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],nt.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],nt.prototype,"cropPreset",2),h([b({type:String,reflect:true})],nt.prototype,"tabs",2),h([g()],nt.prototype,"vl",2),h([g()],nt.prototype,"Pt",2);var Ts=class extends nt{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var jr=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CLOUD_IMG_EDIT;this.Y=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>this._d(),"onActivate"),onDeactivate:a(()=>this.Bd(),"onDeactivate")}),this.subConfigValue("cropPreset",t=>{this.Y&&this.Y.cropPreset!==t&&(this.Y={...this.Y,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Y&&this.Y.tabs!==t&&(this.Y={...this.Y,tabs:t});});}es(t){if(!this.fi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.fi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}It(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}_d(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.fi=e;let o=this.fi.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Y=this.zd(o);}Bd(){this.fi=void 0,this.Y=null;}render(){if(!this.Y)return P;let{cdnUrl:t,cropPreset:e,tabs:o}=this.Y;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${K(e)} tabs=${K(o)} @apply=${this.es} @cancel=${this.It} @change=${this.handleChange} ></uc-cloud-image-editor>`}zd(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],jr.prototype,"Y",2);var yd=[{test:a(r=>!!r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ga=D(r=>{for(let{test:i,message:t}of yd)i(r)&&vr(t);},0);var qa=a((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),bd="0123456789abcdefghijklmnopqrstuvwxyz",Wa=a(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=bd[Number(t)]+i,r=r/36n;}return i},"a"),Es=a((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var wd=a(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Td=10,Ed=a(async r=>{let i=await wd(r);return Wa(i).slice(0,Td)},"d"),Za=a(async(r,i)=>{let t=await Ed(r);return qa(t,i)},"f");var Xa=a(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var xs=a(r=>r,"defineComputedProperty"),xd=[xs({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=lt(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Bt(t)},"fn")}),xs({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=lt(r);return t=t.sort((e,o)=>e===i?-1:o===i?1:0),Bt(t)},"fn")}),xs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===si||Es(i,t))?Za(r,t):i,"fn")})],Ya=a(({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of xd)if(o.deps.includes(r)){let s={[o.key]:t(o.key)};for(let c of o.deps)s[c]=t(c);let n=new AbortController;e.get(o.key)?.abort(),e.set(o.key,n);let l;try{l=o.fn(s,{signal:n.signal});}catch(c){e.get(o.key)===n&&e.delete(o.key),console.error(`Failed to compute value for "${o.key}"`,c);return}Xa(l)?l.then(c=>{n.signal.aborted||i(o.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,c);}).finally(()=>{e.get(o.key)===n&&e.delete(o.key);}):i(o.key,l);}},"computeProperty");var V=a(r=>String(r),"asString"),J=a(r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},"asNumber"),B=a(r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},"asBoolean"),Qa=a(r=>r==="auto"?r:B(r),"asStore"),Ja=a(r=>{let i=V(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),tl=a(r=>{let i=V(r);if(!Object.values(k).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),el=a(r=>{let i=V(r),t=lt(i);if(t.some(e=>!Object.values(k).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),il=a(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Cs=a(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),Kr=a(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),Ss=a(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),rl=a(r=>{let i=V(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var Cd={pubkey:V,multiple:B,multipleMin:J,multipleMax:J,confirmUpload:B,imgOnly:B,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Qa,cameraMirror:B,cameraCapture:Ja,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:J,thumbSize:J,showEmptyList:B,useLocalImageEditor:B,useCloudImageEditor:B,cloudImageEditorTabs:V,removeCopyright:B,cropPreset:V,imageShrink:V,modalScrollLock:B,modalBackdropStrokes:B,sourceListWrap:B,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:J,retryNetworkErrorMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:B,saveUrlForRecurrentUploads:B,groupOutput:B,userAgentIntegration:V,debug:B,localeName:V,metadata:il,secureUploadsExpireThreshold:J,localeDefinitionOverride:a(r=>Cs(r),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(r=>Kr(r),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(r=>Kr(r),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(r=>Kr(r),"iconHrefResolver"),fileValidators:Ss,collectionValidators:Ss,validationTimeout:J,validationConcurrency:J,cameraModes:el,defaultCameraMode:tl,enableAudioRecording:B,enableVideoRecording:B,mediaRecorderOptions:Cs,maxVideoRecordingDuration:J,filesViewMode:rl,gridShowFileNames:B,cloudImageEditorAutoOpen:B,cloudImageEditorMaskHref:V,testMode:B,qualityInsights:B},ol=a((r,i)=>{if(!(typeof i>"u"||i===null))try{return Cd[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),Y[r]}},"normalizeConfigValue");var Gr=[...new Set(["debug",...Object.keys(Y)])],Sd=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],al=a(r=>Sd.includes(r),"isComplexKey"),Ci=Gr.filter(r=>!al(r)),sl={...Object.fromEntries(Ci.map(r=>[ni(r),r])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),r]))},Ad={...Object.fromEntries(Ci.map(r=>[ni(r),U(r)])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),U(r)]))},nl=a(r=>`__${r}`,"getLocalPropName"),qr=class extends S{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(Y).map(([t,e])=>[U(t),e]))};this.Hd=new Map;}static{a(this,"Config");}jd(t,e){if(!al(t)){let o=[...new Set([ni(t),t.toLowerCase()])];for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Kd(t,e){this.$[U(t)]!==e&&(typeof e>"u"||e===null?this.$[U(t)]=Y[t]:this.$[U(t)]=e);}pr(t,e){let o=this,s=ol(t,e),n=nl(t);o[n]!==s&&(this.Gd(t,o[n],s),o[n]=s,this.jd(t,s),this.Kd(t,s),this.debugPrint(`"${t}"`,s),Ga(this.cfg));}Al(t){let e=this,o=nl(t);return e[o]??this.$[U(t)]}Gd(t,e,o){this.cfg.debug&&o!==e&&typeof o=="object"&&typeof e=="object"&&JSON.stringify(o)===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:`,o));}initCallback(){super.initCallback();let t=this;for(let e of Ci)this.sub(U(e),o=>{this.pr(e,o);},false);for(let e of Gr){let o=t[e]??this.$[U(e)];o!==Y[e]&&this.pr(e,o);let s=Object.getOwnPropertyDescriptor(this,e);(!s||!s.set||!s.get)&&Object.defineProperty(this,e,{set:a(n=>{this.pr(e,n);},"set"),get:a(()=>this.Al(e),"get")});}for(let e of Gr)this.sub(U(e),()=>{Ya({key:e,setValue:this.pr.bind(this),getValue:this.Al.bind(this),computationControllers:this.Hd});});}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=sl[t];n&&(s[n]=o),Ad[t]&&(this[t]=o);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(sl)]}};for(let r of Gr)qr.prototype[r]=void 0;var ll=a(()=>{let r=globalThis.top??globalThis.parent??globalThis.self;try{return r.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var kd=a(r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),cl=a((r,i="i")=>{let t=r.split("*").map(kd);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Md=["--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"],Od=a((r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),"getCssValue"),ul=a(r=>{let i={};for(let t of Md){let e=Od(r,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Id=["selected-files-change","toolbar-state-change"],Ld=a(r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Id.includes(i))},"isWhitelistedMessage"),Wr=class{constructor(i,t){this.hr=new Map;this.Ml=i=>{if(i.source!==this.os)return;let t=i.data;if(!Ld(t))return;let e=this.hr.get(t.type);if(e)for(let o of e)o(t);};this.os=i,this.kl=t,window.addEventListener("message",this.Ml);}static{a(this,"MessageBridge");}on(i,t){let e=this.hr.get(i)??new Set;this.hr.has(i)||this.hr.set(i,e),e.add(t);}send(i){let t=this.kl();this.os.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Ml);}};function dl(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(dl,"queryString");var Ud={[$t.GDRIVE]:"ngdrive"},Tt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.EXTERNAL;this.$e=O();this.mr=null;this.ss=[];this.ns=false;this.as=false;this.ls=false;this.cs=false;this.fr=false;this.us=false;this.ds="uc-hidden";this.Ol=true;this.vo=()=>{for(let t of this.ss){let e=this.Wd(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.modalManager?.open(E.activities.UPLOAD_LIST);};this.It=()=>{this.historyBack();};this.tp=()=>{this.at?.send({type:"select-all"});};this.ep=()=>{this.at?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get qd(){if(!this.mr)return "";let{selectedCount:t,total:e}=this.mr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Il();},"onActivate")}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.ps(),this.Il());}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.ps();}),this.subConfigValue("multiple",t=>{this.fr=t;}),this.subConfigValue("localeName",()=>{this.Ll();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.Ul(t);});}Wd(t){if(t.alternatives){let e=q(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=cl(o);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}Zd(t){this.Ol=t.isVisible;}async Xd(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Yd(t.selectedCount,t.total),this.ds=t.isReady?"":"uc-hidden",this.ns=t.isReady,this.as=t.isReady&&t.selectedFiles.length>0,this.fr=t.isMultipleMode&&t.total>0,this.ls=t.selectedCount<t.total,this.cs=t.selectedCount===t.total,this.ss=t.selectedFiles??[],this.us=t.total>0;}Rl(){this.Ul(this.cfg.externalSourcesEmbedCss),this.Qd(),this.Ll();}Qd(){this.at?.send({type:"set-theme-definition",theme:ul(this)});}Ul(t){this.at?.send({type:"set-embed-css",css:t});}Ll(){this.at?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Jd(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=Ud[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ll(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,o);return p.search=dl(u),p.toString()}Yd(t,e){this.mr={selectedCount:t,total:e};}Il(){let t=document.createElement("iframe");t.src=this.Jd(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Rl.bind(this)),t.addEventListener("load",this.Rl.bind(this)),this.$e.value&&(this.$e.value.innerHTML="",this.$e.value.appendChild(t)),t.contentWindow&&(this.at?.destroy(),this.at=new Wr(t.contentWindow,()=>this.cfg.socialBaseUrl),this.at.on("selected-files-change",this.Xd.bind(this)),this.at.on("toolbar-state-change",this.Zd.bind(this)),this.Pl());}ps(){this.at?.destroy(),this.at=void 0,this.$e.value&&(this.$e.value.innerHTML=""),this.Pl();}Pl(){this.ss=[],this.ns=false,this.as=false,this.ls=false,this.cs=false,this.fr=false,this.us=false,this.ds="uc-hidden",this.mr=null;}disconnectedCallback(){super.disconnectedCallback(),this.ps();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.$e)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Ol}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.fr}><span>${this.qd}</span><button type="button" @click=${this.tp} ?hidden=${!this.ls}>${this.l10n("select-all")}</button><button type="button" @click=${this.ep} ?hidden=${!this.cs}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.vo} ?disabled=${!this.as} ?hidden=${!this.us} ><uc-spinner ?hidden=${this.ns}></uc-spinner><span class=${this.ds}>${this.l10n("done")}</span></button></div></div>`}};h([g()],Tt.prototype,"ss",2),h([g()],Tt.prototype,"ns",2),h([g()],Tt.prototype,"as",2),h([g()],Tt.prototype,"ls",2),h([g()],Tt.prototype,"cs",2),h([g()],Tt.prototype,"fr",2),h([g()],Tt.prototype,"us",2),h([g()],Tt.prototype,"ds",2),h([g()],Tt.prototype,"Ol",2);var Si=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.$l="upload-file";this.ip=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.$l=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ip}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.$l)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Si.prototype,"dropzone",2),h([g()],Si.prototype,"$l",2);var Zr=class extends qt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([b({type:Boolean})],Zr.prototype,"headless",2);var Xr=class extends qt{constructor(){super();this.Dl=false;this.It=()=>{if(this.Fl){let t=this.$["*historyBack"];t?.();return}this.Vl&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Fl(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==E.activities.START_FROM}get Vl(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}hs(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.hs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Dl=this.Fl||this.Vl;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It} ?hidden=${!this.Dl} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};h([g()],Xr.prototype,"Dl",2);var As="active",Yr="",Ae=class extends qt{constructor(){super();this.ms=false;this.gr=false;this.vr=Yr;this.fs=Yr;this.qe=t=>{t.id===E.activities.CLOUD_IMG_EDIT&&(this.vr=As),this.$["*currentActivity"]===E.activities.UPLOAD_LIST&&(this.vr=As,this.gr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.fs=As);};this.We=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.gr=false),t.id===E.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}hs(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.hs();this.sub("*currentActivity",e=>{e===E.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.fs=Yr):(this.vr=Yr,this.gr=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",o=>{e==="grid"?(o?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.ms=!o):(this.style.removeProperty("--uc-grid-col"),this.ms=false);});}),this.modalManager?.subscribe(W.OPEN,this.qe),this.modalManager?.subscribe(W.CLOSE,this.We);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(W.OPEN,this.qe),this.modalManager?.unsubscribe(W.CLOSE,this.We);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.gr} class=${this.fs}><uc-drop-area ?single=${this.ms} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.vr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([g()],Ae.prototype,"ms",2),h([g()],Ae.prototype,"gr",2),h([g()],Ae.prototype,"vr",2),h([g()],Ae.prototype,"fs",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
|
-
exports.ActivityBlock=E;exports.ActivityHeader=
|
|
7
|
+
var Ms=Object.defineProperty;var fl=Object.getOwnPropertyDescriptor;var a=(r,i)=>Ms(r,"name",{value:i,configurable:true});var h=(r,i,t,e)=>{for(var o=e>1?void 0:e?fl(i,t):i,s=r.length-1,n;s>=0;s--)(n=r[s])&&(o=(e?n(i,t,o):n(o))||o);return e&&o&&Ms(i,t,o),o};var Ct=[],Zt=0,Ai=4,Os=a(r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Zt+Ai;s<Ct.length;)Ct[s]===e?Ct.splice(s,Ai):s+=Ai;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!Ct.length;for(let n of i)Ct.push(n,t.value,e,o);if(s){for(Zt=0;Zt<Ct.length;Zt+=Ai)Ct[Zt](Ct[Zt+1],Ct[Zt+2],Ct[Zt+3]);Ct.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t},"atom");function ki(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}a(ki,"listenKeys");function to(r,i,t){let e=ki(r,i,t);return t(r.value),e}a(to,"subscribeKeys");var eo=a((r={})=>{let i=Os(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i},"map");var z=class r{static{a(this,"PubSub");}static{this.De=new Map;}constructor(i,t){this.Q=i,this.gt=t;}get id(){return this.Q}pub(i,t){i in this.gt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.gt.setKey(i,t);}sub(i,t,e=true){return (e?to:ki)(this.gt,[i],s=>{t(s[i]);})}read(i){return i in this.gt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.gt.get()[i]}add(i,t,e=false){(!(i in this.gt.get())||e)&&this.gt.setKey(i,t);}has(i){return i in this.gt.get()}get store(){return this.gt.get()}static registerCtx(i,t){if(r.De.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=eo(i);return r.De.set(t,e),new r(t,e)}static deleteCtx(i){r.De.delete(i);}static getCtx(i){let t=r.De.get(i);return t?new r(i,t):null}static hasCtx(i){return r.De.has(i)}};var Mi=globalThis,Ii=Mi.ShadowRoot&&(Mi.ShadyCSS===void 0||Mi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ls=Symbol(),Is=new WeakMap,Oi=class{static{a(this,"n");}constructor(i,t,e){if(this.Nl=true,e!==Ls)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(Ii&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Is.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Is.set(t,i));}return i}toString(){return this.cssText}},Us=a(r=>new Oi(typeof r=="string"?r:r+"",void 0,Ls),"r");var Ps=a((r,i)=>{if(Ii)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Mi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},"S"),io=Ii?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Us(t)})(r):r;var{is:vl,defineProperty:yl,getOwnPropertyDescriptor:bl,getOwnPropertyNames:wl,getOwnPropertySymbols:Tl,getPrototypeOf:El}=Object,Li=globalThis,Rs=Li.trustedTypes,xl=Rs?Rs.emptyScript:"",Cl=Li.reactiveElementPolyfillSupport,Ye=a((r,i)=>r,"d"),Qe={toAttribute(r,i){switch(i){case Boolean:r=r?xl:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},Ui=a((r,i)=>!vl(r,i),"f"),$s={attribute:true,type:String,converter:Qe,reflect:false,useDefault:false,hasChanged:Ui};Symbol.metadata??=Symbol("metadata"),Li.litPropertyMetadata??=new WeakMap;var _t=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.yr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.gi&&[...this.gi.keys()]}static createProperty(i,t=$s){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(),o=this.getPropertyDescriptor(i,e,t);o!==void 0&&yl(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=bl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let l=o?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??$s}static yr(){if(this.hasOwnProperty(Ye("elementProperties")))return;let i=El(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ye("finalized")))return;if(this.finalized=true,this.yr(),this.hasOwnProperty(Ye("properties"))){let t=this.properties,e=[...wl(t),...Tl(t)];for(let o of e)this.createProperty(o,t[o]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,o]of t)this.elementProperties.set(e,o);}this.gi=new Map;for(let[t,e]of this.elementProperties){let o=this.br(t,e);o!==void 0&&this.gi.set(o,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 o of e)t.unshift(io(o));}else i!==void 0&&t.push(io(i));return t}static br(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ue=null,this._l();}_l(){this.wr=new Promise(i=>this.enableUpdating=i),this.jt=new Map,this.Bl(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Fe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Fe?.delete(i);}Bl(){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 Ps(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Fe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Fe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Tr(i,e);}zl(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.br(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:Qe).toAttribute(t,e.type);this.ue=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.ue=null;}}Tr(i,t){let e=this.constructor,o=e.gi.get(i);if(o!==void 0&&this.ue!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Qe;this.ue=o;let l=n.fromAttribute(t,s.type);this[o]=l??this.Er?.get(o)??l,this.ue=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let n=this.constructor;if(o===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Ui)(s,t)||e.useDefault&&e.reflect&&s===this.Er?.get(i)&&!this.hasAttribute(n.br(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.wr=this.Hl());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.Er??=new Map).has(i)&&(this.Er.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.jt.has(i)||(this.hasUpdated||e||(t=void 0),this.jt.set(i,t)),o===true&&this.ue!==i&&(this.vs??=new Set).add(i));}async Hl(){this.isUpdatePending=true;try{await this.wr;}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[o,s]of this.vi)this[o]=s;this.vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,l=this[o];n!==true||this.jt.has(o)||l===void 0||this.C(o,void 0,s,l);}}let i=false,t=this.jt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Fe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.xr();}catch(e){throw i=false,this.xr(),e}i&&this.jl(t);}willUpdate(i){}jl(i){this.Fe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}xr(){this.jt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.wr}shouldUpdate(i){return true}update(i){this.vs&&=this.vs.forEach(t=>this.zl(t,this[t])),this.xr();}updated(i){}firstUpdated(i){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Ye("elementProperties")]=new Map,_t[Ye("finalized")]=new Map,Cl?.({ReactiveElement:_t}),(Li.reactiveElementVersions??=[]).push("2.1.2");var oo=globalThis,Ds=a(r=>r,"i"),Pi=oo.trustedTypes,Fs=Pi?Pi.createPolicy("lit-html",{createHTML:a(r=>r,"createHTML")}):void 0,so="$lit$",Nt=`lit$${Math.random().toFixed(9).slice(2)}$`,no="?"+Nt,Sl=`<${no}>`,pe=document,ti=a(()=>pe.createComment(""),"c"),ei=a(r=>r===null||typeof r!="object"&&typeof r!="function","a"),ao=Array.isArray,Hs=a(r=>ao(r)||typeof r?.[Symbol.iterator]=="function","d"),ro=`[ \f\r]`,Je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vs=/-->/g,_s=/>/g,ue=RegExp(`>|${ro}(?:([^\\s"'>=/]+)(${ro}*=${ro}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ns=/'/g,Bs=/"/g,js=/^(?:script|style|textarea|title)$/i,lo=a(r=>(i,...t)=>({Kt:r,strings:i,values:t}),"x"),y=lo(1);lo(2);lo(3);var tt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),zs=new WeakMap,de=pe.createTreeWalker(pe,129);function Ks(r,i){if(!ao(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fs!==void 0?Fs.createHTML(i):i}a(Ks,"V");var Gs=a((r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=Je;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,m=0;for(;m<c.length&&(n.lastIndex=m,p=n.exec(c),p!==null);)m=n.lastIndex,n===Je?p[1]==="!--"?n=Vs:p[1]!==void 0?n=_s:p[2]!==void 0?(js.test(p[2])&&(o=RegExp("</"+p[2],"g")),n=ue):p[3]!==void 0&&(n=ue):n===ue?p[0]===">"?(n=o??Je,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?ue:p[3]==='"'?Bs:Ns):n===Bs||n===Ns?n=ue:n===Vs||n===_s?n=Je:(n=ue,o=void 0);let f=n===ue&&r[l+1].startsWith("/>")?" ":"";s+=n===Je?c+Sl:d>=0?(e.push(u),c.slice(0,d)+so+c.slice(d)+Nt+f):c+Nt+(d===-2?l:f);}return [Ks(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ii=class r{static{a(this,"S");}constructor({strings:i,Kt:t},e){let o;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=Gs(i,t);if(this.el=r.createElement(u,e),de.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(o=de.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(so)){let m=p[n++],f=o.getAttribute(d).split(Nt),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?$i:v[1]==="?"?Di:v[1]==="@"?Fi:me}),o.removeAttribute(d);}else d.startsWith(Nt)&&(c.push({type:6,index:s}),o.removeAttribute(d));if(js.test(o.tagName)){let d=o.textContent.split(Nt),m=d.length-1;if(m>0){o.textContent=Pi?Pi.emptyScript:"";for(let f=0;f<m;f++)o.append(d[f],ti()),de.nextNode(),c.push({type:2,index:++s});o.append(d[m],ti());}}}else if(o.nodeType===8)if(o.data===no)c.push({type:2,index:s});else {let d=-1;for(;(d=o.data.indexOf(Nt,d+1))!==-1;)c.push({type:7,index:s}),d+=Nt.length-1;}s++;}}static createElement(i,t){let e=pe.createElement("template");return e.innerHTML=i,e}};function he(r,i,t=r,e){if(i===tt)return i;let o=e!==void 0?t.Kl?.[e]:t.Gl,s=ei(i)?void 0:i.Cr;return o?.constructor!==s&&(o?.ys?.(false),s===void 0?o=void 0:(o=new s(r),o.Sr(r,t,e)),e!==void 0?(t.Kl??=[])[e]=o:t.Gl=o),o!==void 0&&(i=he(r,o.ql(r,i.values),o,e)),i}a(he,"M");var Ri=class{static{a(this,"R");}constructor(i,t){this.bs=[],this.vt=void 0,this.Ts=i,this.c=t;}get parentNode(){return this.c.parentNode}get W(){return this.c.W}u(i){let{el:{content:t},parts:e}=this.Ts,o=(i?.creationScope??pe).importNode(t,true);de.currentNode=o;let s=de.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new ke(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Vi(s,this,i)),this.bs.push(u),c=e[++l];}n!==c?.index&&(s=de.nextNode(),n++);}return de.currentNode=pe,o}p(i){let t=0;for(let e of this.bs)e!==void 0&&(e.strings!==void 0?(e.yt(i,e,t),t+=e.strings.length-2):e.yt(i[t])),t++;}},ke=class r{static{a(this,"k");}get W(){return this.c?.W??this.Es}constructor(i,t,e,o){this.type=2,this.i=R,this.vt=void 0,this.St=i,this.de=t,this.c=e,this.options=o,this.Es=o?.isConnected??true;}get parentNode(){let i=this.St.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.St}get endNode(){return this.de}yt(i,t=this){i=he(this,i,t),ei(i)?i===R||i==null||i===""?(this.i!==R&&this.pe(),this.i=R):i!==this.i&&i!==tt&&this.xs(i):i.Kt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Hs(i)?this.k(i):this.xs(i);}O(i){return this.St.parentNode.insertBefore(i,this.de)}T(i){this.i!==i&&(this.pe(),this.i=this.O(i));}xs(i){this.i!==R&&ei(this.i)?this.St.nextSibling.data=i:this.T(pe.createTextNode(i)),this.i=i;}$(i){let{values:t,Kt:e}=i,o=typeof e=="number"?this.Wl(i):(e.el===void 0&&(e.el=ii.createElement(Ks(e.h,e.h[0]),this.options)),e);if(this.i?.Ts===o)this.i.p(t);else {let s=new Ri(o,this),n=s.u(this.options);s.p(t),this.T(n),this.i=s;}}Wl(i){let t=zs.get(i.strings);return t===void 0&&zs.set(i.strings,t=new ii(i)),t}k(i){ao(this.i)||(this.i=[],this.pe());let t=this.i,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(ti()),this.O(ti()),this,this.options)):e=t[o],e.yt(s),o++;o<t.length&&(this.pe(e&&e.de.nextSibling,o),t.length=o);}pe(i=this.St.nextSibling,t){for(this.yi?.(false,true,t);i!==this.de;){let e=Ds(i).nextSibling;Ds(i).remove(),i=e;}}setConnected(i){this.c===void 0&&(this.Es=i,this.yi?.(i));}},me=class{static{a(this,"H");}get tagName(){return this.element.tagName}get W(){return this.c.W}constructor(i,t,e,o,s){this.type=1,this.i=R,this.vt=void 0,this.element=i,this.name=t,this.c=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.i=Array(e.length-1).fill(new String),this.strings=e):this.i=R;}yt(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=he(this,i,t,0),n=!ei(i)||i!==this.i&&i!==tt,n&&(this.i=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=he(this,l[e+c],t,c),u===tt&&(u=this.i[c]),n||=!ei(u)||u!==this.i[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.i[c]=u;}n&&!o&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},$i=class extends me{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Di=class extends me{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Fi=class extends me{static{a(this,"z");}constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}yt(i,t=this){if((i=he(this,i,t,0)??R)===tt)return;let e=this.i,o=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.i=i;}handleEvent(i){typeof this.i=="function"?this.i.call(this.options?.host??this.element,i):this.i.handleEvent(i);}},Vi=class{static{a(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.vt=void 0,this.c=t,this.options=e;}get W(){return this.c.W}yt(i){he(this,i);}},qs={I:ke},Al=oo.litHtmlPolyfillSupport;Al?.(ii,ke),(oo.litHtmlVersions??=[]).push("3.3.2");var Ws=a((r,i,t)=>{let e=t?.renderBefore??i,o=e.Zl;if(o===void 0){let s=t?.renderBefore??null;e.Zl=o=new ke(i.insertBefore(ti(),s),s,void 0,t??{});}return o.yt(r),o},"D");var co=globalThis,bt=class extends _t{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.Ar=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.Ar=Ws(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Ar?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Ar?.setConnected(false);}render(){return tt}};bt.op=true,bt.finalized=true,co.litElementHydrateSupport?.({LitElement:bt});var kl=co.litElementPolyfillSupport;kl?.({LitElement:bt});(co.litElementVersions??=[]).push("4.2.2");var Ml=/\\([0-9a-fA-F]{1,6} ?)/g;function Ol(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}a(Ol,"hasLeadingTrailingQuotes");function Il(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(Il,"trimQuotes");function Ll(r){let i="",t="";for(let e=0;e<r.length;e++){let o=r[e+1];r[e]==="\\"&&o==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}a(Ll,"escapeQuotes");function Zs(r){let i=r;Ol(r)&&(i=Il(i),i=i.replace(Ml,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Ll(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(Zs,"parseCssPropertyValue");function Me(r){class i extends r{constructor(){super(...arguments);this.Cs=null;this.kr=null;}static{a(this,"CssDataMixinClass");}getCssData(o,s=false){let n=this.Cs??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.kr||(this.kr=window.getComputedStyle(this));let l=this.kr.getPropertyValue(o).trim();try{n[o]=Zs(l);}catch(c){s||console.warn(`CSS Data error: ${o}`,c),n[o]=null;}}return this.Cs=n,n[o]}}return i}a(Me,"CssDataMixin");function _i(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Gt={};this.qt=null;this.bi=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.qt||(this.qt=Array.from(this.childNodes)),super.connectedCallback();}Xl(){if(this.bi)return;this.bi=true,this.Gt={};let o=Array.from(this.childNodes),s=o.length?o:this.qt??[];for(let n of s){let l=this.Ss(n),c=this.Gt[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Gt[l]=c;}this.qt=null;}Ss(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Ss(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}Yl(o){return !o.textContent||!o.textContent.trim()}Ql(o){let s=this.Gt[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Yl(n))}update(o){!this.hasUpdated&&this.willYield&&this.Xl(),super.update(o);}yield(o,s){if(o===""&&!this.Gt[o]&&!this.bi&&this.qt?.length){let l=[];for(let c of this.qt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Gt[o]=l,this.bi=true,this.qt=null;}let n=this.Gt[o];return y` ${n} ${this.Ql(o)?s:void 0} `}}return i}a(_i,"LightDomMixin");function Oe(r){class i extends r{static{a(this,"RegisterableElementMixinClass");}static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&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,o);}}return i}a(Oe,"RegisterableElementMixin");var Xt=class extends Event{static{a(this,"s");}constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Ie=class{static{a(this,"s");}constructor(i,t,e,o){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=o??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Xt(this.context,this.host,this.t,this.subscribe));}};var Ni=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var uo=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Le=class extends Ni{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Xt(this.context,l,n,true)));o.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 uo(this.context,this.host));}};var Pl={attribute:true,type:String,converter:Qe,reflect:false,hasChanged:Ui},Rl=a((r=Pl,i,t)=>{let{kind:e,metadata:o}=t,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),s.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,r,true,l);},init(l){return l!==void 0&&this.C(n,void 0,r,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,r,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(r){return (i,t)=>typeof t=="object"?Rl(r,i,t):((e,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}a(b,"n");function g(r){return b({...r,state:true,attribute:false})}a(g,"r");function D(r,i){let t,e=a(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var Xs="ctx-name-context";function zi(){return function(r){class i extends r{constructor(...o){super(...o);this.J=null;this.Ve=false;this.Mr=false;this.Or=void 0;this.he=new Map;this.Ne=new Set;this.init$={};this.ctxOwner=false;this.wi=void 0;this.Ti=false;this.ctxName=this.Pt;this.Rt=false;this.wi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Pt,this.Jl=new Ie(this,{context:Xs,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Ms=s,this.ks();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}static set template(o){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 As(){return this.wi}set As(o){let s=o??void 0;this.wi!==s&&(this.wi=s,this.ks());}shouldUpdate(o){return this.Rt?super.shouldUpdate(o):false}get Pt(){return this.As||this.Ms||void 0}ks(){if(this.ctxName=this.Pt,!(!this.ctxName||this.Ve)){if(this.isConnected){this.Ir();return}this.Ti=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Pt,this.ctxName&&(this.Or?this.Or.setValue(this.ctxName):this.Or=new Le(this,{context:Xs,initialValue:this.ctxName}));}Os(){if(!(!this.J||this.he.size===0)){for(let[o,{value:s,rewrite:n}]of this.he)this.J.add(o,s,n);this.he.clear();}}Is(){return !this.J&&this.Pt&&this.Lr(),this.J&&this.Os(),this.J}Ei(){let o=this.Is();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}Lr(){let o=this.init$,s=this.Pt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.J){this.J=z.getCtx(s)??z.registerCtx(o,s);for(let[n,l]of Object.entries(this.init$))this.J.add(n,l,this.ctxOwner);this.Os();}}get $(){return this.Pt&&this.Lr(),new Proxy({},{get:a((o,s)=>{if(typeof s=="string")return this.J?.read(s)},"get"),set:a((o,s,n)=>(typeof s!="string"||this.J?.pub(s,n),true),"set")})}sub(o,s,n=true){let l=this.Ei().sub(o,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Ne.delete(p));},"trackedRemove");return this.Ne.add(p),p}pub(o,s){this.Ei().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.Ei()}has(o){return this.J?.has(o)??false}add(o,s,n=false){let l=this.Is();if(!l){if(!n&&this.he.has(o))return;this.he.set(o,{value:s,rewrite:n});return}this.he.delete(o),l.add(o,s,n);}add$(o,s=false){for(let[n,l]of Object.entries(o))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Ve?this.Rt&&this.Mr&&(this.Mr=false,this.initCallback()):this.ctxName?(this.Ti=false,this.Ir()):this.Ti&&this.Pt&&(this.Ti=false,this.Ir());}Ir(){if(this.Ve)return;this.Ve=true,this.Lr();let o=this.init$;if(Object.keys(o).length>0){let s=this.Ei();for(let[n,l]of Object.entries(o))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Rt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.tc(),super.disconnectedCallback(),this.Ve&&(this.Mr=true);}tc(){if(this.Ne.size!==0){for(let o of [...this.Ne])o();this.Ne.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"As",1),h([g()],i.prototype,"Ms",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Rt",2),i}}a(zi,"SymbioteMixin");var po=class extends Oe(zi()(Me(_i(bt)))){static{a(this,"BaseComponent");}};var ut=class r{static{a(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var $l=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ho(r){for(let i in r){if($l.includes(i))continue;let t=[...i].reduce((e,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),e+=o,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}a(ho,"defineComponents");var mo="UC";function Dl(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[mo]){t(window[mo]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[mo];i&&ho(s),t(s);},document.head.appendChild(o);})}a(Dl,"loadFileUploaderFrom");var ri={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var fo=new Map,Ys=new Map,Qs=a((r,i)=>{fo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...ri,...i};return fo.set(r,t),t},"defineLocaleSync"),Fl=a((r,i)=>{Ys.set(r,i);},"defineLocaleAsync"),Js=a((r,i)=>{typeof i=="function"?Fl(r,i):Qs(r,i);},"defineLocale"),tn=a(async r=>{let i=fo.get(r);if(!i){let t=Ys.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Qs(r,e);}return i},"resolveLocaleDefinition");Js("en",ri);var U=a(r=>`*cfg/${r}`,"sharedConfigKey");var lt=a(r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Bt=a(r=>r.join(","),"serializeCsv");var en=a(r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Hi=a((...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>en(i)).join("/-/"),"joinCdnOperations"),et=a((...r)=>{let i=Hi(...r);return i?`-/${i}/`:""},"createCdnUrlModifiers");function ji(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),o=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):o>=0&&(s=t.slice(o+1)),s}a(ji,"extractFilename");function Ki(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}a(Ki,"extractUuid");function go(r){let i=rn(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(go,"extractCdnUrlModifiers");function vo(r){return go(r).split("/-/").filter(Boolean).map(t=>en(t))}a(vo,"extractOperations");function rn(r){let i=new URL(r),t=ji(r),e=on(t)?sn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(rn,"trimFilename");function on(r){return r.startsWith("http")}a(on,"isFileUrl");function sn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(sn,"splitFileUrl");var G=a((r,i,t)=>{let e=new URL(rn(r)),o=t??ji(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&on(o)){let n=sn(o);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},"createCdnUrl"),Yt=a((r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var q=a((r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var oi=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}),an=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Vl(r,i){if(typeof i=="number"){let t=i;return oi[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return oi[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return oi.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}a(Vl,"transformationToStr");function Qt(r){return Hi(...an.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Vl(i,t)}).filter(i=>!!i))}a(Qt,"transformationsToOperations");var Gi=Hi("format/auto","progressive/yes"),zt=a(([r])=>typeof r<"u"?Number(r):void 0,"asNumber"),nn=a(()=>true,"asBoolean"),_l=a(([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),"asFilter"),Nl=a(([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:q(r,"x").map(Number),coords:q(i).map(Number)}},"asCrop"),Bl=Object.freeze({enhance:zt,brightness:zt,exposure:zt,gamma:zt,contrast:zt,saturation:zt,vibrance:zt,warmth:zt,filter:_l,mirror:nn,flip:nn,rotate:zt,crop:a(r=>{let[i,t]=r,{dimensions:e,coords:o}=Nl([i,t]);return {dimensions:e,coords:o}},"crop")});function yo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!an.includes(e))continue;let s=e,n=Bl[s];try{let l=n(o);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(yo,"operationsToTransformations");var N=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),it=Object.freeze([N.CROP,N.TUNING,N.FILTERS]),ln=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),cn=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"]),un=Object.freeze(["rotate","mirror","flip"]),Ht=oi,St=Object.freeze({brightness:{zero:Ht.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Ht.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Ht.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Ht.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Ht.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Ht.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Ht.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Ht.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Ht.filter,range:[0,100],keypointsNumber:1}});var si="https://ucarecdn.com",zl="https://upload.uploadcare.com",Hl="https://social.uploadcare.com",jl="https://ucarecd.net",Kl={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:"",cloudImageEditorTabs:Bt(it),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:si,cdnCnamePrefixed:jl,baseUrl:zl,socialBaseUrl:Hl,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,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local"},Q=Object.freeze(Kl);var qi=a((r,i)=>(...t)=>{let e=r();if(!e.read(U("debug")))return;let o=t;if(typeof t?.[0]=="function"){let n=t[0];o=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);},"createDebugPrinter");var Z=class{constructor(i){this.Ur=new Set;this.Wt=null;this.z=qi(()=>this.r.ctx,this.constructor.name);this.r=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.Ur.add(i);}get Zt(){if(!this.Wt){let i={};this.Wt=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let o=U(e);return this.r.ctx.has(o)?this.r.ctx.read(o):Q[e]},"get")});}return this.Wt}destroy(){for(let i of this.Ur)try{i();}catch{}this.Ur.clear();}},It=a((r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),dn=a(r=>({get ctx(){return r()},get modalManager(){return It(r(),"*modalManager",false)},get telemetryManager(){return It(r(),"*telemetryManager")},get localeManager(){return It(r(),"*localeManager")},get a11y(){return It(r(),"*a11y")},get blocksRegistry(){return It(r(),"*blocksRegistry")},get eventEmitter(){return It(r(),"*eventEmitter")},get uploadCollection(){return It(r(),"*uploadCollection")},get secureUploadsManager(){return It(r(),"*secureUploadsManager",false)},get api(){return It(r(),"*publicApi")},get validationManager(){return It(r(),"*validationManager")}}),"createSharedInstancesBag");var W=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Wi=class extends Z{constructor(){super(...arguments);this.Xt=new Map;this.bt=new Set;this.w=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.Xt.set(t,e),this.K(W.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Xt.get(t);return e?(this.Xt.delete(t),this.bt.delete(t),this.K(W.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Xt.get(t);return e?(this.bt.add(t),this.K(W.OPEN,{modal:e,id:t}),true):(this.z(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Xt.get(t);return !e||!this.bt.has(t)?(this.z(`Modal with ID "${t}" not found or not active`),false):(this.bt.delete(t),this.K(W.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Xt.has(t)?this.bt.has(t)?this.close(t):this.open(t):(this.z(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.bt.size>0}back(){if(this.bt.size===0)return this.z("No active modals to go back from"),false;let t=Array.from(this.bt).pop();return t?this.close(t):false}closeAll(){let t=this.bt.size;return this.bt.clear(),this.K(W.CLOSE_ALL,{}),t}subscribe(t,e){return this.w.has(t)||this.w.set(t,new Set),this.w.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.w.has(t)&&this.w.get(t)?.delete(e);}K(t,e){if(this.w.has(t))for(let o of this.w.get(t)??new Set)try{o(e);}catch(s){this.r.telemetryManager.sendEventError(s,"modal subscriber"),this.z("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Xt.clear(),this.w.clear(),this.K(W.DESTROY,{});}};var ni=a(r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function pn(r){return Object.prototype.toString.call(r)==="[object Object]"}a(pn,"isObject");var Gl=/\W|_/g;function ql(r){return r.split(Gl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(ql,"camelizeString");function hn(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Kt(t,{ignoreKeys:i})):r}a(hn,"camelizeArrayItems");function Kt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return hn(r,{ignoreKeys:i});if(!pn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}pn(o)?o=Kt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=hn(o,{ignoreKeys:i})),t[ql(e)]=o;}return t}a(Kt,"camelizeKeys");var Wl=a(r=>new Promise(i=>setTimeout(i,r)),"delay");function So({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:o=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:s,integration:o});let n=[r,i,e].filter(Boolean).join("/"),l=[s,o].filter(Boolean).join("; ");return `${n} (${l})`}a(So,"getUserAgent$1");var Zl={factor:2,time:100};function Xl(r,i=Zl){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a(l=>Wl(l??s).then(()=>(t+=1,e(o))),"retry")})}return a(e,"runAttempt"),e(r)}a(Xl,"retrier");var fe=class extends Error{static{a(this,"UploadcareError");}},Ue=class r extends fe{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Zi=a((r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),Jt=class r extends fe{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Yl=500,fn=a(({check:r,interval:i=Yl,timeout:t,signal:e})=>new Promise((o,s)=>{let n,l;Zi(e,()=>{n&&clearTimeout(n),s(new Jt("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new Jt("Timed out"));},t));let c=a(()=>{try{Promise.resolve(r(e)).then(u=>{u?(l&&clearTimeout(l),o(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),P={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"},Xi="application/octet-stream",gn="original",ee=a(({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=r?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",Zi(o,()=>{p=true,c.abort(),l(new Jt);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(T){let C=T.split(": "),x=C.shift(),A=C.join(": ");x&&typeof x<"u"&&(f[x]=A);});let v=c.response,w=c.status;n({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new Ue(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function Ql(r,...i){return r}a(Ql,"identity");var Jl=a(({name:r})=>r?[r]:[],"getFileOptions"),tc=Ql,ec=a(()=>new FormData,"getFormData"),vn=a(r=>false,"isBuffer"),Yi=a(r=>typeof Blob<"u"&&r instanceof Blob,"isBlob"),Qi=a(r=>typeof File<"u"&&r instanceof File,"isFile"),Ji=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),Pe=a(r=>Yi(r)||Qi(r)||vn()||Ji(r),"isFileData"),ic=a(r=>typeof r=="string"||typeof r=="number"||typeof r>"u","isSimpleValue"),rc=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),oc=a(r=>!!r&&typeof r=="object"&&"data"in r&&Pe(r.data),"isFileValue");function yn(r,i,t){if(Array.isArray(t))for(let e of t)yn(r,`${i}[]`,e);else if(oc(t)){let{name:e,contentType:o}=t,s=tc(t.data,e,o??Xi),n=Jl({name:e,contentType:o});r.push([i,s,...n]);}else if(rc(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else ic(t)&&t&&r.push([i,t.toString()]);}a(yn,"collectParams");function sc(r){let i=[];for(let[t,e]of Object.entries(r))yn(i,t,e);return i}a(sc,"getFormDataParams");function tr(r){let i=ec(),t=sc(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}a(tr,"buildFormData");var rt=class r extends fe{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},nc=a(r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),jt=a((r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=nc(t)),e.toString()},"getUrl"),ac="6.18.4",lc="UploadcareUploadClient",cc=ac;function ve(r){return So({libraryName:lc,libraryVersion:cc,...r})}a(ve,"getUserAgent");var uc="RequestThrottledError",mn=15e3,dc=1e3;function pc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return mn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:mn}a(pc,"getTimeoutFromThrottledRequest");function ie(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Xl(({attempt:o,retry:s})=>r().catch(n=>{if("response"in n&&n?.code===uc&&o<t)return s(pc(n));if(n instanceof Ue&&o<e)return s((o+1)*dc);throw n}))}a(ie,"retryIfFailed");var bn=a(r=>{let i="";return (Yi(r)||Qi(r)||Ji(r))&&(i=r.type),i||Xi},"getContentType"),wn=a(r=>{let i="";return Qi(r)&&r.name?i=r.name:Yi(r)||vn()?i="":Ji(r)&&r.name&&(i=r.name),i||gn},"getFileName");function Ao(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}a(Ao,"getStoreValue");function hc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=P.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",url:jt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},data:tr({file:{data:r,name:t||wn(r),contentType:e||bn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ao(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(hc,"base");var To;(function(r){r.Token="token",r.FileInfo="file_info";})(To||(To={}));function mc(r,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},url:jt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Ao(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(mc,"fromUrl");var ct;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ct||(ct={}));var fc=a(r=>"status"in r&&r.status===ct.Error,"isErrorResponse");function gc(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}={}){return ie(()=>ee({method:"GET",headers:i?{"X-UC-User-Agent":ve({publicKey:i,integration:o,userAgent:s})}:void 0,url:jt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Kt(JSON.parse(c));if("error"in d&&!fc(d))throw new rt(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(gc,"fromUrlStatus");function vc(r,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=P.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:c,userAgent:u})},url:jt(t,"/group/",{jsonerrors:1}),data:tr({files:r,callback:e,pub_key:i,signature:o,expire:s,source:l}),signal:n}).then(({data:m,headers:f,request:v})=>{let w=Kt(JSON.parse(m));if("error"in w)throw new rt(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(vc,"group");function Tn(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"GET",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:s,userAgent:n})},url:jt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=Kt(JSON.parse(u));if("error"in m)throw new rt(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Tn,"info");function yc(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=P.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return ie(()=>ee({method:"POST",url:jt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:d,userAgent:m})},data:tr({filename:e||gn,size:r,content_type:t||Xi,part_size:o,UPLOADCARE_STORE:Ao(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:C,request:x})=>{let A=Kt(JSON.parse(T));if("error"in A)throw new rt(A.error.content,A.error.errorCode,x,A,C);return A.parts=Object.keys(A.parts).map(vt=>A.parts[Number(vt)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}a(yc,"multipartStart");function bc(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=P.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Xi}}).then(l=>(o&&o({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(bc,"multipartUpload");function wc(r,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return ie(()=>ee({method:"POST",url:jt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:s,userAgent:n})},data:tr({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:u,headers:p,request:d})=>{let m=Kt(JSON.parse(u));if("error"in m)throw new rt(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(wc,"multipartComplete");function ko(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return fn({check:a(p=>Tn(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(ko,"isReadyPoll");function Tc(r){return "defaultEffects"in r}a(Tc,"isGroupFileInfo");var ge=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=P.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=jt(t,`${o}/`),l=s?jt(`https://${s}.s3.amazonaws.com/`,`${o}/${i.filename}`):null;this.uuid=o,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,Tc(i)&&(this.defaultEffects=i.defaultEffects);}},Ec=a((r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>hc(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:C})=>ko(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new ge(C,{baseCDN:w})),"uploadDirect"),xc=a((r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Tn(r,{publicKey:i,baseURL:e,signal:o,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(m=>new ge(m,{baseCDN:d,fileName:t})).then(m=>(s&&s({isComputable:true,value:1}),m)),"uploadFromUploaded"),Cc=a((r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=a(n=>()=>{e=n,o.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return Zi(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Sc=window.WebSocket,Eo=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Ac=a((r,i)=>r==="success"?{status:ct.Success,...i}:r==="progress"?{status:ct.Progress,...i}:{status:ct.Error,...i},"response"),xo=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Eo;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 Sc(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,Ac(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}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(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},bo=null,Mo=a(r=>{if(!bo){let i=typeof window>"u"?0:3e4;bo=new xo(r,i);}return bo},"getPusher"),kc=a(r=>{Mo(r).connect();},"preconnect");function Mc({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return fn({check:a(u=>gc(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ct.Error:return new rt(p.error,p.errorCode);case ct.Waiting:return false;case ct.Unknown:return new rt(`Token "${r}" was not found.`);case ct.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ct.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(Mc,"pollStrategy");var Oc=a(({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=Mo(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(r);},"destroy");Zi(t,()=>{c(),s(new Jt("pusher cancelled"));}),n.subscribe(r,u=>{switch(u.status){case ct.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ct.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),o(u);break}case ct.Error:c(),s(new rt(u.msg,u.error_code));}});}),"pushStrategy"),Ic=a((r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=P.pusherKey,metadata:C})=>Promise.resolve(kc(T)).then(()=>mc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(x=>(Mo(T)?.disconnect(),Promise.reject(x))).then(x=>x.type===To.FileInfo?x:Cc([({signal:A})=>Mc({token:x.token,publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:A}),({signal:A})=>Oc({token:x.token,pusherKey:T,signal:A,onProgress:d})],{signal:p})).then(x=>{if(x instanceof rt)throw x;return x}).then(x=>ko(x.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(x=>new ge(x,{baseCDN:o})),"uploadFromUrl"),wo=new WeakMap,Lc=a(async r=>{if(wo.has(r))return wo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return wo.set(r,i),i},"getBlobFromReactNativeAsset"),En=a(async r=>{if(Qi(r)||Yi(r))return r.size;if(Ji(r))return (await Lc(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Uc=a((r,i=P.multipartMinFileSize)=>r>=i,"isMultipart"),xn=a(r=>{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 !Pe(r)&&t.test(r)},"isUuid"),Oo=a(r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Pe(r)&&t.test(r)},"isUrl"),Pc=a((r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(o[u]=d,n-=1,n?c():t(o));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<r;u++)c();}),"runWithConcurrency"),Rc=a((r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},"sliceChunk"),$c=a(async(r,i,t)=>e=>Rc(r,e,i,t),"prepareChunks"),Dc=a((r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>bc(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Fc=a(async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=P.multipartChunkSize,maxConcurrentRequests:C=P.maxConcurrentRequests,baseCDN:x,metadata:A})=>{let vt=e??await En(r),yt,ce=a((Y,at)=>{if(!u)return;yt||(yt=Array(Y).fill(0));let xt=a(Ot=>Ot.reduce((Vt,Jr)=>Vt+Jr,0),"sum");return Ot=>{Ot.isComputable&&(yt[at]=Ot.value,u({isComputable:true,value:xt(yt)/Y}));}},"createProgressHandler");return w||=bn(r),yc(vt,{publicKey:i,contentType:w,fileName:t||wn(r),baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:A,multipartChunkSize:T}).then(async({uuid:Y,parts:at})=>{let xt=await $c(r,vt,T);return Promise.all([Y,Pc(C,at.map((Ot,Vt)=>()=>Dc(xt(Vt),Ot,{publicKey:i,contentType:w,onProgress:ce(at.length,Vt),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([Y])=>wc(Y,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(Y=>Y.isReady?Y:ko(Y.uuid,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(Y=>new ge(Y,{baseCDN:x}))},"uploadMultipart");async function Io(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:x=P.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:vt,pusherKey:yt,metadata:ce}){if(Pe(r)){let Y=await En(r);return Uc(Y,w)?Fc(r,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:Y,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:ce}):Ec(r,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:ce})}if(Oo(r))return Ic(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:x,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:vt,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:yt,metadata:ce});if(xn(r))return xc(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x});throw new TypeError(`File uploading from "${r}" is not supported`)}a(Io,"uploadFile");var Vc=a((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},"replaceUrlBase"),Co=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=P.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Vc(i.cdnUrl,t),this.files=e.map(o=>new ge(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},_c=a(r=>{for(let i of r)if(!Pe(i))return false;return true},"isFileDataArray"),Nc=a(r=>{for(let i of r)if(!xn(i))return false;return true},"isUuidArray"),Bc=a(r=>{for(let i of r)if(!Oo(i))return false;return true},"isUrlArray");function Cn(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=P.multipartChunkSize,baseCDN:T=P.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:x,jsonpCallback:A}){if(!_c(r)&&!Bc(r)&&!Nc(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let vt,yt=true,ce=r.length,Y=a((at,xt)=>{if(!c)return;vt||(vt=Array(at).fill(0));let Ot=a(Vt=>Vt.reduce((Jr,ml)=>Jr+ml)/at,"normalize");return Vt=>{if(!Vt.isComputable||!yt){yt=false,c({isComputable:false});return}vt[xt]=Vt.value,c({isComputable:true,value:Ot(vt)});}},"createProgressHandler");return Promise.all(r.map((at,xt)=>Pe(at)||Oo(at)?Io(at,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:Y(ce,xt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:x}).then(Ot=>Ot.uuid):at)).then(at=>vc(at,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:o,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(xt=>new Co(xt,{baseCDN:T})).then(xt=>(c&&c({isComputable:true,value:1}),xt)))}a(Cn,"uploadFileGroup");var te=class{static{a(this,"Queue");}xi=1;Pr=[];Ci=0;Rr=new Map;$r=new Map;constructor(i){this.xi=i;}run(){let i=this.xi-this.Ci;for(let t=0;t<i;t++){let e=this.Pr.shift();if(!e)return;let o=this.Rr.get(e),s=this.$r.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ci+=1,e().finally(()=>{this.Rr.delete(e),this.$r.delete(e),this.Ci-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.Rr.set(i,e),this.$r.set(i,o),this.Pr.push(i),t&&this.run();})}get pending(){return this.Pr.length}get running(){return this.Ci}set concurrency(i){this.xi=i,this.run();}get concurrency(){return this.xi}};var Lo=a(()=>({}),"blockCtx"),Uo=a(r=>({...Lo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),Po=a(r=>({...Uo(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new te(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),Sn=a(r=>({...Po(r),"*solution":null}),"solutionBlockCtx");var dt=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var er=class extends Z{constructor(t){super(t);this.scopes=new Set;this.listener=this.ec.bind(this),window.addEventListener("paste",this.listener);}static{a(this,"ClipboardLayer");}openUploadList(){this.r.api.setCurrentActivity(dt.UPLOAD_LIST),this.r.api.setModalState(true);}async ec(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.Zt.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){let e=Array.from(t.clipboardData.items),o=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(l=>{n.getAsString(c=>{l(c);});}));o.length>0&&(o.forEach(n=>{this.r.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.r.api.addFileFromUrl(l,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var zc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ai(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}a(ai,"focus");function Ro(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=zc[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}a(Ro,"findGroupNodeByEventTarget");function $o(r,i){return i.role==="toolbar"?Hc(i):i.querySelectorAll(`[role=${r.role}]`)}a($o,"getItems");function Hc(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(Hc,"getToolbarItems");function jc(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(jc,"isHorizontalOrientation");function An(r){return i=>{let t=false,e=r?.searchDelayMs||300,o=0,s="";function n(d){let m=Ro(d.target);if(!m){l();return}let f=$o(d.target,m),v=Array.from(f).indexOf(d.target),w="ArrowDown",T="ArrowUp";if(jc(m)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),d.key===w)d.preventDefault(),ai(d.target,f[v+1]||f[0]);else if(d.key===T)d.preventDefault(),ai(d.target,f[v-1]||f[f.length-1]);else if(d.key==="Home")d.preventDefault(),ai(d.target,f[0]);else if(d.key==="End")d.preventDefault(),ai(d.target,f[f.length-1]);else if(d.key.length===1&&m.role!=="tablist"){let C=Date.now();C-o<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),o=C;let x=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));x&&(d.preventDefault(),ai(d.target,x));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let m=Ro(d.target);if(m){t||(t=true,i.addEventListener("keydown",n));let f=$o(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let m=Ro(d.target);if(m){let f=$o(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(An,"focusGroupKeyUX");function kn(){return r=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(o,"focusOut"),r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}a(kn,"hiddenKeyUX");function Mn(){return r=>{let i=[];function t(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let o=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let p=r.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l);}}}a(Mn,"jumpKeyUX");function On(r){let i,t=r.split(" "),e;function o(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(o,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",o),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",o),l.removeEventListener("keyup",s);})}a(On,"pressKeyUX");function In(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}a(In,"startKeyUX");var Do=class{constructor(){this._e=new Map;this.Dr=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(o=>{let s=o.target;s instanceof Node&&this.Dr.some(n=>n===s||n.contains(s))&&t(o);},"wrappedListener");this._e.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this._e.get(t);e&&window.removeEventListener(i,e),this._e.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Dr.push(i);}destroy(){this.Dr=[];for(let i of this._e.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this._e.clear();}},ir=class{static{a(this,"A11y");}constructor(){this.Si=new Do,this.Ls=In(this.Si,[An(),On("is-pressed"),Mn(),kn()]);}registerBlock(i){this.Si.registerScope(i);}destroy(){this.Ls?.(),this.Si.destroy();}};var Gt=a(r=>`*l10n/${r}`,"localeStateKey"),Kc="en",rr=class extends Z{constructor(t){super(t);this.Fr="";for(let[e,o]of Object.entries(ri)){let s=this.e.has(Gt(e))?!this.e.read(Gt(e)):true;this.e.add(Gt(e),o,s);}this.addSub(this.e.sub(U("localeName"),async e=>{if(!e)return;this.Fr=e;let o=await tn(e);if(e!==Kc&&this.Fr!==e)return;let s=this.Zt.localeDefinitionOverride?.[e];for(let[n,l]of Object.entries(o)){let c=s?.[n];this.e.add(Gt(n),c??l,true);}})),this.addSub(this.e.sub(U("localeDefinitionOverride"),e=>{if(!e)return;let o=e[this.Fr];if(o)for(let[s,n]of Object.entries(o))this.e.add(Gt(s),n,true);}));}static{a(this,"LocaleManager");}};function Gc(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(Gc,"i");function Vo(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Vo(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=Gc(i);return typeof t=="object"&&t!==null?[e,Vo(t)]:[e,t]}))}a(Vo,"c");function qc(r){return {ok:true,value:r}}a(qc,"u");function Fo(r){return {ok:false,error:r}}a(Fo,"a");var Wc="https://tlm.uploadcare.com/api/",_o=class{static{a(this,"y");}constructor(i=Wc){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return Fo(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return qc(s)}catch(s){return Fo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return Fo(new Error(`Error fetching data from "${e}". Error: ${o}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Vo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Zc=a(async(r,i)=>({success:true,data:i}),"p"),Xc=a(async r=>Zc(void 0,r),"f"),or=class extends _o{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Xc(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 Yc=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),sr=class extends Z{constructor(){super(...arguments);this.Be=new Map;this.Ai=new Set;}static{a(this,"EventEmitter");}bindTarget(t){return this.Ai.add(t),()=>{this.Ai.delete(t);}}Us(t,e){for(let o of this.Ai)o.dispatchEvent(new CustomEvent(t,{detail:e}));this.z?.(()=>{let o=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,o]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Us(t,typeof e=="function"?e():e);return}this.Be.has(t)&&window.clearTimeout(this.Be.get(t));let n=typeof s=="number"?s:Yc,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.Us(t,c),this.Be.delete(t);}catch(c){this.z?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.Be.set(t,l);}destroy(){for(let t of this.Be.values())window.clearTimeout(t);this.Ai.clear();}};var Ln="1.27.1";var Lt="blocks",Ut=Ln;var nr=class extends Z{constructor(t){super(t);this.ic=ut.generateRandomUUID();this.me=structuredClone(Q);this.Vr=false;this.Nr=null;this.$t=false;this.Ps=new or,this.fe=new te(10),this.addSub(this.e.sub(U("qualityInsights"),e=>{this.$t=!!e;}));for(let e of Object.keys(this.me))this.addSub(this.e.sub(U(e),o=>{this.$t&&(this.Vr&&this.me[e]!==o&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.rc(e,o));}));}static{a(this,"TelemetryManager");}oc(t){t===F.INIT_SOLUTION&&!this.Vr&&(this.Vr=true);}rc(t,e){this.me[t]!==e&&(this.me[t]=e);}sc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(o.config=this.me),{...o,appVersion:Ut,appName:Lt,sessionId:this.ic,component:this.nc,activity:this.ac,projectPubkey:this.me.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.cc,payload:{location:this.uc,...e}}}dc(t){return !!(t&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.$t)return;let e=this.sc({eventType:t.eventType,payload:t.payload,config:t.config});this.oc(t.eventType),!(this.dc(t.eventType)||this.Nr&&this.Rs(this.Nr,e))&&this.fe.add(async()=>{this.Nr=e,await this.Ps.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Rs(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 o=Object.keys(t),s=Object.keys(e);if(o.length!==s.length)return false;for(let n of o)if(!Object.hasOwn(e,n)||!this.Rs(t[n],e[n]))return false;return true}get cc(){return Date.now()}get nc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get ac(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get uc(){return location.origin}};var Un=a(r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Jc=a(r=>r,"DEFAULT_TRANSFORMER"),No="{{",Rn="}}",Pn="plural:";function Re(r,i={},t={}){let{openToken:e=No,closeToken:o=Rn,transform:s=Jc}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);r=r.replaceAll(e+n+o,u);}return r}a(Re,"applyTemplateData");function $n(r){let i=[],t=r.indexOf(No);for(;t!==-1;){let e=r.indexOf(Rn,t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(Pn)){let s=r.substring(t+2,e).replace(Pn,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:l});}t=r.indexOf(No,e);}return i}a($n,"getPluralObjects");var Dn="--uploadcare-blocks-window-height",li=class r{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(Dn,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Dn);}};var ar=a((r,i)=>new Intl.PluralRules(r).select(i),"getPluralForm");var tu=a(r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=ar(o,t);return e(`${i}__${s}`)},"createPluralizer"),lr=a(r=>{let i=tu(()=>t),t=a((e,o={})=>{if(!e)return "";let n=r().read(Gt(e))||e,l=$n(n);for(let u of l)o[u.variable]=i(u.pluralKey,Number(o[u.countVariable]));return Re(n,o)},"l10n");return t},"createL10n");var eu=a(r=>r.tagName?.includes("-")??false,"isCustomElement"),cr=class{constructor(i){this.Yt=new Set;this.ki=new Map;this.$s=false;this.Qt=i,this.Qt.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.Mi?.(),this.Mi=void 0,this.Yt.clear(),this.ki.clear();}hostUpdated(){if(!this.Mi&&this.Qt.has(U("testMode"))){let i=this.Qt.subConfigValue("testMode",t=>{this.$s=!!t,this.Ds();});this.Mi=i;}this.pc(),this.Ds();}pc(){let i=this.Qt,t=i.renderRoot??i;if(!t)return;let e=this.Qt,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!eu(n));for(let n of s)if(!(o&&n.closest(o)!==e)&&!this.Yt.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.Yt.add(n),this.ki.set(n,l);}for(let n of Array.from(this.Yt))(!n.isConnected||o&&n.closest(o)!==e)&&(this.Yt.delete(n),this.ki.delete(n));}Ds(){if(!this.Yt.size)return;let i=this.Qt.testId||"";for(let t of this.Yt){let e=this.ki.get(t);e&&(this.$s?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var iu=Oe(zi()(Me(_i(bt)))),S=class extends iu{constructor(){super();this.Oi=new Map;this.activityType=null;this.init$=Lo();this.l10n=lr(()=>this.sharedCtx);this.debugPrint=qi(()=>this.sharedCtx,this.constructor.name);this.r=dn(()=>this.sharedCtx);new cr(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);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(),li.registerClient(this);}initCallback(){this.tt("*blocksRegistry",()=>new Set),this.tt("*eventEmitter",t=>new sr(t)),this.tt("*localeManager",t=>new rr(t)),this.tt("*modalManager",t=>new Wi(t)),this.tt("*a11y",()=>new ir),this.tt("*clipboard",t=>new er(t)),this.tt("*telemetryManager",t=>new nr(t)),this.sub(Gt("locale-id"),t=>{let e=Un(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.et("*modalManager",false)}get telemetryManager(){return this.et("*telemetryManager")}get localeManager(){return this.et("*localeManager")}get a11y(){return this.et("*a11y")}get clipboardLayer(){return this.et("*clipboard")}get blocksRegistry(){return this.et("*blocksRegistry")}get eventEmitter(){return this.et("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),li.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.hc(),z.deleteCtx(this.ctxName);}tt(t,e){if(!this.Oi.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.r);this.add(t,o,true),this.Oi.set(t,o);return}}hc(){for(let[t,e]of this.Oi.entries())e?.destroy?.(),this.pub(t,null),this.Oi.delete(t);}et(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:Ki(t),cdnUrlModifiers:go(t),fileName:ji(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?Re(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Wt){let t={};this.Wt=new Proxy(t,{set:a((e,o,s)=>{if(typeof o!="string"||!(o in Q))return false;let n=o,l=U(n);return this.has(l)||this.add(l,Q[n]),this.$[l]=s,true},"set"),get:a((e,o)=>{let s=U(o);return this.has(s)||this.add(s,Q[o]),this.$[s]},"get")});}return this.Wt}subConfigValue(t,e){let o=U(t);return this.has(o)||this.add(o,Q[t]),this.sub(o,e)}};var Pt={ATTRIBUTE:1,CHILD:2},pt=a(r=>(...i)=>({Cr:r,values:i}),"e"),wt=class{static{a(this,"i");}constructor(i){}get W(){return this.c.W}Sr(i,t,e){this.Ii=i,this.c=t,this.mc=e;}ql(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var ye=class extends wt{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==Pt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.Fs=void 0,this.it=i;if(i===tt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Fs;this.it=i;let t=[i];return t.raw=t,this.Fs={Kt:this.constructor.resultType,strings:t,values:[]}}};ye.directiveName="unsafeHTML",ye.resultType=1;pt(ye);var ci=class extends ye{static{a(this,"t");}};ci.directiveName="unsafeSVG",ci.resultType=2;var ur=pt(ci);var Fn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var qt=class extends S{constructor(){super(...arguments);this.init$=Sn(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);}render(){return y`${ur(Fn)}`}};var Vn=a(r=>typeof r!="number"?0:Math.floor(r/1e3),"msToUnixTimestamp"),_n=a((r,{threshold:i})=>{let{secureExpire:t}=r,e=Vn(Date.now()),o=Number(t),s=Vn(i);return e+s>=o},"isSecureTokenExpired");var dr=class extends Z{constructor(){super(...arguments);this.Jt=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.Zt;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.Jt||_n(this.Jt,{threshold:s})){this.Jt?this.z("Secure signature is expired. Resolving a new one..."):this.z("Secure signature is not set yet.");try{let n=await o();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.z("Secure signature resolved:",n),this.z("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Jt=n):(this.z("Secure signature resolver returned nothing."),this.Jt=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.r.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Jt}return t&&e?(this.z("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Jt=null;}};var Bo=a((r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var zo=a((r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=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:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}},"validateMultiple");var ru=a(()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),ou=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),su=a(()=>({safariDesktop:ru()}),"calcBrowserInfo"),nu=a(()=>({htmlMediaCapture:ou()}),"calcBrowserFeatures"),Nn=su(),be=nu();var ui="image/*",Ho="video/*",au=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],lu=a(()=>Nn.safariDesktop?[ui]:[ui,...au],"calcImageAcceptList"),di=lu(),pr=a(r=>r?r.filter(i=>typeof i=="string").flatMap(i=>q(i)):[],"mergeFileTypes"),jo=a((r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),"matchMimeType"),Bn=a((r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),zn=a(r=>{let i=r?.type;return i?jo(i,di):false},"fileIsImage");var Ko=a((r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=pr([...t?di:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let l=jo(s,o),c=Bn(n,o);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var Go=a((r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var Rt=1e3,we=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),pi=a(r=>Math.ceil(r*100)/100,"round"),Hn=a((r,i=we.AUTO)=>{let t=i===we.AUTO;if(i===we.BYTE||t&&r<Rt**1){let o=ar("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===we.KB||t&&r<Rt**2?`${pi(r/Rt**1)} KB`:i===we.MB||t&&r<Rt**3?`${pi(r/Rt**2)} MB`:i===we.GB||t&&r<Rt**4?`${pi(r/Rt**3)} GB`:i===we.TB||t&&r<Rt**5?`${pi(r/Rt**4)} TB`:`${pi(r/Rt**5)} PB`},"prettyBytes");var qo=a((r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Hn(t)}),payload:{entry:r}}},"validateMaxSizeLimit");var Wo=a((r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof rt)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Ue)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}},"validateUploadError");var $e={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."},cu=a(r=>typeof r=="function"?{runOn:"change",validator:r}:r,"getValidatorDescriptor"),hr=class extends Z{constructor(t){super(t);this.fc=[Go,Ko,qo,Wo];this.gc=[zo,Bo];this.fe=new te(20);this.Vs=D(()=>{this.fe.run();},500);this.Dt=false;this.ge=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(U("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(U("multipleMin"),e)),this.addSub(this.e.sub(U("multipleMax"),e)),this.addSub(this.e.sub(U("multiple"),e)),this.addSub(this.e.sub(U("imgOnly"),e)),this.addSub(this.e.sub(U("accept"),e)),this.addSub(this.e.sub(U("validationConcurrency"),o=>{this.fe.concurrency=o;}));}static{a(this,"ValidationManager");}get f(){return this.r.uploadCollection}runFileValidators(t,e){if(this.Dt)return;let o=e??this.f.items();for(let s of o){let n=this.f.read(s);n&&this.vc(n,t);}}runCollectionValidators(){if(this.Dt)return;let t=this.r.api,e=t.getOutputCollectionState(),o=[],s=this.Zt.collectionValidators;for(let n of [...this.gc,...s])try{let l=n(e,t);if(!l)continue;l&&(o.push(this.Ns(l)),l.message||console.warn($e.MISSING_ERROR_MESSAGE));}catch(l){console.warn($e.COLLECTION_VALIDATION_FAILED,l);}this.e.pub("*collectionErrors",o),o.length>0&&this.r.eventEmitter.emit(I.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.ge.get(t.uid);e&&(e.abortController?.abort(),this.ge.delete(t.uid));}async vc(t,e){if(this.Dt)return;let o=this.r.api,s=this._s(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Dt||(await n,this.Dt))return;let c=this.yc(t,e);if(c.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=o.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.Zt.validationTimeout,m=this.Bs(),f=new Set(c.map(T=>T.validator)),v=[];for(let T of m)if(!f.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Dt)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn($e.FILE_VALIDATION_TIMEOUT);},d);try{let x=await T.validator(u,o,{signal:p.signal});if(!x||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let A=this.Ns(x);s.lastErrorThrownByValidator.set(T.validator,A),v.push(A),x.message||console.warn($e.MISSING_ERROR_MESSAGE);}catch(x){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn($e.FILE_VALIDATION_FAILED,x),this.r.telemetryManager.sendEventError(x,`file validator. ${$e.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.Vs(),await this.fe.add(async()=>{this.Dt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}Ns(t){return {...t,type:t.type??"CUSTOM_ERROR"}}_s(t){let e=this.ge.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.ge.set(t.uid,o),o}Bs(){let t=this.Zt.fileValidators;return [...this.fc,...t].map(cu)}yc(t,e){let o=this._s(t);return this.Bs().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Dt=true,this.Vs.cancel();for(let t of this.ge.values())t.abortController?.abort(),t.promise=void 0;this.ge.clear();}};var jn="[Typed State] Wrong property name: ",mr=class{static{a(this,"TypedData");}constructor(i){this.Q=ut.generateFastUid(),this.Z=z.registerCtx(i,this.Q);}get uid(){return this.Q}setValue(i,t){if(!this.Z.has(i)){console.warn(`${jn}${String(i)}`);return}this.Z.read(i)!==t&&this.Z.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Z.has(i)||console.warn(`${jn}${String(i)}`),this.Z.read(i)}subscribe(i,t){return this.Z.sub(i,t)}destroy(){z.deleteCtx(this.Q);}};var fr=class r{constructor(i){this.Ft=Object.create(null);this.Li=new Set;this.Ui=new Set;this.At=new Set;this._r=new Set;this.Br=new Set;this.ve=new Set;this.js=i.initialValue,this.Q=ut.generateFastUid(),this.Z=z.registerCtx({},this.Q),this.zs=i.watchList||[];let t=Object.create(null);this.Hs=(e,o)=>{this.ze&&window.clearTimeout(this.ze),t[e]||(t[e]=new Set),t[e].add(o),this.ze=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Li.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Ks();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}static{this.bc=1e4;}K(){this.He&&window.clearTimeout(this.He),this.He=window.setTimeout(()=>{let i=new Set(this.Br),t=new Set(this._r);this.Br.clear(),this._r.clear();for(let e of this.Ui)e?.([...this.At],i,t);this.Ks();});}Ks(){this.ve.size!==0&&(this.je&&window.clearTimeout(this.je),this.je=window.setTimeout(()=>{let i=[...this.ve];this.ve.clear();for(let t of i)t.destroy();},r.bc));}observeCollection(i){return this.Ui.add(i),this.At.size>0&&this.K(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Ui.delete(i);}add(i){let t=new mr(this.js);for(let[e,o]of Object.entries(i))t.setValue(e,o);return this.At.add(t.uid),this.K(),this.Z.add(t.uid,t),this.Br.add(t),this.zs.forEach(e=>{this.Ft[t.uid]||(this.Ft[t.uid]=[]),this.Ft[t.uid]?.push(t.subscribe(e,()=>{this.Hs(e,t.uid);}));}),t.uid}hasItem(i){return this.At.has(i)}read(i){return this.Z.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 o=this.read(i);if(!o)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);o.setValue(t,e);}remove(i){let t=this.read(i);t&&(this._r.add(t),this.ve.add(t)),this.At.delete(i),this.K(),this.Z.pub(i,void 0),this.Ft[i]?.forEach(e=>{e();}),delete this.Ft[i];}clearAll(){this.At.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Li.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Li.delete(i);}findItems(i){let t=[];return this.At.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.At]}get size(){return this.At.size}destroy(){this.ze&&window.clearTimeout(this.ze),this.He&&window.clearTimeout(this.He),this.je&&window.clearTimeout(this.je);for(let i of this.ve)i.destroy();this.ve.clear(),z.deleteCtx(this.Q),this.Li=new Set,this.Ui=new Set;for(let i of Object.keys(this.Ft))this.Ft[i]?.forEach(t=>{t();}),delete this.Ft[i];}};var k=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Tt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Zo=a(r=>({isVideoRecordingEnabled:lt(r.cameraModes).includes(k.VIDEO),isPhotoEnabled:lt(r.cameraModes).includes(k.PHOTO)}),"calcCameraModes");var Xo=a((r,i)=>{for(let t of r)if(i(t))return t},"findBlockInCtx");var Kn=a((r,i)=>{for(let t of r)if(i(t))return true;return false},"hasBlockInCtx");function gr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}a(gr,"applyStyles");var uu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,du=new RegExp(`^/?(${uu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Gn=a(({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(si),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=du.exec(o.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var $t=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Yo=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),H=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Yo,...$t});var vr=a(r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e)),"getOutputData");function qn(r){let i=new Map;return a((...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s},"memoized")}a(qn,"memoize");var Wn=new Set;function yr(r){Wn.has(r)||(Wn.add(r),console.warn(r));}a(yr,"warnOnce");function pu(r){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...o)=>(i&&yr(r),e(...o))),"withAssert")}a(pu,"createAsyncAssertWrapper");function Zn(r){let i={},t=r.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>r.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>vr(r),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},o=pu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let l=s,u=qn(o(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(Zn,"buildOutputCollectionState");var br=class extends Z{constructor(){super(...arguments);this.wc=lr(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=Gn({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.f.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??H.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let l=this.f.add({file:t,isImage:zn(t),mimeType:t.type,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??H.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.r.eventEmitter.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Bt(pr([this.cfg.accept??"",...this.cfg.imgOnly?di:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),gr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=Zo(this.cfg);t.modeCamera===k.PHOTO&&n?s.accept=ui:t.modeCamera===k.VIDEO&&l?s.accept=Ho:s.accept=[ui,l&&Ho].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?H.CAMERA:H.LOCAL});}),this.r.modalManager?.open(dt.UPLOAD_LIST),this.e.pub("*currentActivity",dt.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.f.size>0&&!t)this.r.modalManager?.open(dt.UPLOAD_LIST),this.e.pub("*currentActivity",dt.UPLOAD_LIST);else if(this.zr?.length===1){let e=this.zr[0];if(e==="local"){this.e.pub("*currentActivity",dt.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&be.htmlMediaCapture){let{isPhotoEnabled:o,isVideoRecordingEnabled:s}=Zo(this.cfg);if(o&&s){this.e.pub("*currentActivity",dt.START_FROM);return}else if(o||s){this.openSystemDialog({captureCamera:true,modeCamera:o?k.PHOTO:k.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:k.PHOTO});}setTimeout(()=>{if(e!==this.zr[0])return;let o=this.r.blocksRegistry;Xo(o,a(l=>"type"in l&&l.type===e,"isSourceBtn"))?.activate();},0),this.e.read("*currentActivity")&&this.r.modalManager?.open(this.e.read("*currentActivity"));}else this.r.modalManager?.open(dt.START_FROM),this.e.pub("*currentActivity",dt.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=Xo(this.r.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.r.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{if(Kn(this.r.blocksRegistry,o=>o.activityType===t)){this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);},"setCurrentActivity");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.setModalState=a(t=>{if(t&&!this.e.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this.r.modalManager?.open(this.e.read("*currentActivity")):(this.r.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null));},"setModalState");}static{a(this,"UploaderPublicApi");}get f(){return this.r.uploadCollection}get cfg(){return this.Zt}get l10n(){return this.wc}removeAllFiles(){this.f.clearAll();}getOutputItem(t){let e=z.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let o=e.store,s=o.fileInfo,n=o.isRemoved?"removed":o.errors.length>0?"failed":o.fileInfo?"success":o.isUploading?"uploading":"idle";return {uuid:s?.uuid??o.uuid??null,internalId:t,name:s?.originalFilename??o.fileName,size:s?.size??o.fileSize,isImage:s?.isImage??o.isImage,mimeType:s?.mimeType??o.mimeType,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl??s?.cdnUrl??null,fullPath:o.fullPath,uploadProgress:o.uploadProgress,fileInfo:s??null,metadata:o.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:n,source:o?.source}}getOutputCollectionState(){return Zn(this.r)}get zr(){let t=[];return this.cfg.sourceList&&(t=q(this.cfg.sourceList)),t}};var Xn={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 hi=33.333333333333336,M=1,Qo=24,Yn=6;function re(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}a(re,"setSvgNodeAttrs");function ht(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return re(t,i),t}a(ht,"createSvgNode");function Qn(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,o+c*n+1.5*p-24*t*p],m=[e+l*s+1.5*u,o+c*n+1.5*p],f=[e+l*s-24*t*u+1.5*u,o+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}a(Qn,"cornerPath");function Jn(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,o+p*n+1.5*m],v=[e+u*s+34*t/2,o+p*n+1.5*m]):(f=[e+u*s+1.5*d,o+p*n-34*t/2],v=[e+u*s+1.5*d,o+p*n+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,T=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:T}}a(Jn,"sidePath");function ta(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}a(ta,"thumbCursor");function ea({rect:r,delta:[i,t],imageBox:e}){return Fe({...r,x:r.x+i,y:r.y+t},e)}a(ea,"moveRect");function Fe(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}a(Fe,"constraintRect");function hu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;s+=o,l-=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,l=r.y+r.height-s,t&&(n=l*t,c=r.x+r.width/2-n/2)),c<=e.x&&(c=e.x,s=r.y+r.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y+r.height-l),l<M&&(l=M,t&&(n=l*t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),n<M&&(n=M,t&&(l=n/t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),{x:c,y:s,width:n,height:l}}a(hu,"resizeNorth");function mu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;s+=o,n-=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(l=n/t,c=r.y+r.height/2-l/2)),c<=e.y&&(c=e.y,s=r.x+r.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x+r.width-n),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),{x:s,y:c,width:n,height:l}}a(mu,"resizeWest");function fu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;l+=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=r.x+r.width/2-n/2),c<=e.x&&(c=e.x,s=r.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y),l<M&&(l=M,t&&(n=l*t),c=r.x+r.width/2-n/2),n<M&&(n=M,t&&(l=n/t),c=r.x+r.width/2-n/2),{x:c,y:s,width:n,height:l}}a(fu,"resizeSouth");function gu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;n+=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=r.y+r.height/2-l/2),c<=e.y&&(c=e.y,s=r.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2),{x:s,y:c,width:n,height:l}}a(gu,"resizeEast");function vu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+s<e.y&&(s=e.y-l),n+=o,c-=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x+r.width-c,l=e.y)):t&&(o=u*t-c,c=c+o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c,l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c,l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(vu,"resizeNorthWest");function yu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x,l=e.y)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(yu,"resizeNorthEast");function bu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=o,c-=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x+r.width-c,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c),{x:n,y:l,width:c,height:u}}a(bu,"resizeSouthWest");function wu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(wu,"resizeSouthEast");function ia({direction:r,...i}){switch(r){case "n":return hu(i);case "w":return mu(i);case "s":return fu(i);case "e":return gu(i);case "nw":return vu(i);case "ne":return yu(i);case "sw":return bu(i);case "se":return wu(i);default:return i.rect}}a(ia,"resizeRect");function ra(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}a(ra,"rectContainsPoint");function oa(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}a(oa,"isRectInsideRect");function sa(r,i){return Math.abs(r.width/r.height-i)<.1}a(sa,"isRectMatchesAspectRatio");function Ve({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}a(Ve,"rotateSize");function na(r,i,t){let e=r/i,o,s;e>t?(o=Math.round(i*t),s=i):(o=r,s=Math.round(r/t));let n=Math.round((r-o)/2),l=Math.round((i-s)/2);return n+o>r&&(o=r-n),l+s>i&&(s=i-l),{x:n,y:l,width:o,height:s}}a(na,"calculateMaxCenteredCropFrame");function _e(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}a(_e,"roundRect");function oe(r,i,t){return Math.min(Math.max(r,i),t)}a(oe,"clamp");var mi=["free"],Tr=a(r=>{let i=q(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let o=e.trim();if(!o)continue;let s=o.indexOf(":");if(s===-1&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),l=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:ut.generateFastUid(),type:"aspect-ratio",width:mi.includes(o)?0:n,height:mi.includes(o)?0:l,hasFreeform:mi.includes(o)});}return t},"parseCropPreset"),aa=a((r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(o-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(o-u)/u>e)return null}return s},"getClosestAspectRatio");function la(r){return So({...r,libraryName:Lt,libraryVersion:Ut})}a(la,"customUserAgent");var ca="active",Ne="___ACTIVITY_IS_ACTIVE___",ua,E=class r extends(ua=S,ua){constructor(){super(...arguments);this.historyTracked=false;this.init$=Uo(this);this.Tc=D(this.Ec.bind(this),10);}static{a(this,"LitActivityBlock");}Gs(){let t=r.Ke.get(this);this[Ne]=false,this.removeAttribute(ca),t?.deactivateCallback?.();}xc(){let t=r.Ke.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ne]=true,this.setAttribute(ca,""),t?.activateCallback?.(),this.Tc(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Ne]?this.Gs():this.activityType===t&&!this[Ne]&&this.xc();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Ec(){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);}Cc(){return !!this.activityType&&r.Ke.has(this)}static{this.Ke=new Map;}get isActivityActive(){return !!this[Ne]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.Ke.set(this,{activateCallback:o,deactivateCallback:s});}Sc(){this.isActivityActive&&this.Gs(),r.Ke.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Cc()&&this.Sc();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(o=>o instanceof r&&o.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}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 o=!!e;e&&(o=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=o?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};E.activities=dt;var $=class r extends E{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Pi=false;this.init$=Po(this);this.Kr=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Ic(e);},300);this.Mc=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of o){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Zs(),this.Kr();}};this.Oc=t=>{if(!this.isConnected)return;this.Kr();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(o.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=o.filter(n=>t.fileInfo?.has(n)&&!!z.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Zs();}if(t.isUploading)for(let s of t.isUploading){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=z.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Lc(),this.cfg.cloudImageEditorAutoOpen&&this.Uc();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=z.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Zs=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get Ac(){return this.hasBlockInCtx(t=>t instanceof r?t.Pi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.tt("*uploadCollection",()=>new fr({initialValue:Xn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.tt("*secureUploadsManager",t=>new dr(t)),this.tt("*validationManager",t=>new hr(t)),this.tt("*publicApi",t=>new br(t)),!this.Ac&&this.couldBeCtxOwner&&this.kc();}getAPI(){return this.api}get validationManager(){return this.et("*validationManager")}get api(){return this.et("*publicApi")}get uploadCollection(){return this.et("*uploadCollection")}get secureUploadsManager(){return this.et("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Pi&&this.qs(),this.Kr.cancel();}connectedCallback(){super.connectedCallback(),this.Pi&&this.Ws();}kc(){this.Pi=true,this.Ws(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ws(){this.qs(),this.Hr=this.uploadCollection.observeCollection(this.Mc),this.jr=this.uploadCollection.observeProperties(this.Oc);}qs(){this.jr?.(),this.Hr?.(),this.jr=void 0,this.Hr=void 0;}async Ic(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await Cn(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Uc(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}Lc(){let t=Tr(this.cfg.cropPreset);if(t){let[e]=t,o=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 o){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=na(l,c,u),d=et(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:G(m,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}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:la,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 vr(this.r)}};$.extSrcList=Object.freeze({...$t});$.sourceTypes=Object.freeze({...H});var fi=class extends S{constructor(){super(...arguments);this.name="";this.Gr="";this.Xs=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.Xs=t,this.Ys();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ys();}Ys(){if(!this.name){this.Gr="";return}let t=`#uc-icon-${this.name}`,e=this.Xs?.(this.name);this.Gr=e??t;}render(){return y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Gr}></use></svg>`)} `}};h([b({type:String})],fi.prototype,"name",2),h([g()],fi.prototype,"Gr",2);var da=a(r=>[...new Set(r)],"uniqueArray");var Te="--uc-img-",Jo="unresolved";var ts=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),es=3e3,is=5e3,rs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Tu="https://ucarecdn.com",Be=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Tu},"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 Er=class extends Me(Oe(bt)){constructor(){super();this.ye={};this.w=new Map;this.be=null;this.Ri=null;for(let t in Be){let e=Be[t];this.ye[Te+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.ye[Te+t]}set$$(t){for(let e in t){let o=Te+e,s=t[e];this.ye[o]=s,this.K(o,s);}}sub$$(t,e){let o=Te+t;this.w.has(o)||this.w.set(o,new Set),this.w.get(o)?.add(e);let s=this.ye[o];s!==null&&s!==""&&e(s);}K(t,e){this.w.has(t)&&this.w.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${Lt}/${Ut}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;Be[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.be=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.be?.unobserve(t));});},o),this.be.observe(t),this.Ri||(this.Ri=new Set),this.Ri.add(t);}connectedCallback(){super.connectedCallback(),this.Pc();}Pc(){for(let t in Be){let e=Te+t,o=this.getCssData(e,true);o!=null&&(this.ye[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.be&&(this.Ri?.forEach(t=>{this.be?.unobserve(t);}),this.be=null),this.w.clear();}static get observedAttributes(){return Object.keys(Be)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Te+t;this.ye[s]=o,this.K(s,o);});}};var pa=a(r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var Sr=class extends Er{constructor(){super(...arguments);this.kt=new Image;this.wt=new Image;}static{a(this,"ImgBase");}Qs(t){return !t.includes("//")&&!ts&&(t=new URL(t,document.baseURI).href),t}$i(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let n=parseInt(o,10);return Number(n)>is&&this.Js?is+s:Number(n)>es&&!this.Js?es+s:t}Rc(t,e){let o={format:this.qr("format"),quality:this.qr("quality"),resize:this.$i(t),blur:e,"cdn-operations":this.qr("cdn-operations")??void 0,analytics:this.analyticsParams()};return et(...pa(o))}qr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}ot(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(ts&&o&&!o.includes("//"))return this.Ge(o);let s=this.Rc(t,e),n=this.$$("cdn-cname"),l=n;if(o.startsWith(String(n)))return G(o,s);let c=this.$$("uuid");if(l&&c)return this.Ge(G(Yt(l,c),s));if(c)return this.Ge(G(Yt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.Ge(G(u,s,this.Qs(o)));let p=this.$$("pubkey");if(p)return this.Ge(G(`https://${p}.ucr.io/`,s,this.Qs(o)))}Ge(t){let e=this.$$("secure-delivery-proxy");return e?Re(e,{previewUrl:t},{transform:a(o=>window.encodeURIComponent(o),"transform")}):t}we(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=o?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}$c(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Mt||(this.Wr({elNode:this.kt}),this.appendChild(this.kt)),this.kt}get Di(){return this.Mt?{type:rs.PREVIEW,img:this.wt}:{type:rs.MAIN,img:this.img}}get Mt(){return this.$$("is-preview-blur")}get tn(){return this.$$("is-background-for")}get en(){let t=this.$$("breakpoints");if(t){let e=q(t);return da(e.map(o=>parseInt(o,10)))}else return null}get Js(){return this.$$("format").toLowerCase()==="jpeg"}rn(t){let e=new Set;e.add(`url("${this.ot(this.we(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.ot(this.we(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.ot(this.we(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}sn(){let t=new Set;return this.en?this.en.forEach(e=>{t.add(`${this.ot(`${e}x`)} ${this.$i(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.ot(`${e*2}x`)} ${this.$i(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.ot(`${e*3}x`)} ${this.$i(`${e*3}w`)}`);}):(t.add(`${this.ot(this.we(this.Di.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.ot(this.we(this.Di.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.ot(this.we(this.Di.img,3))} 3x`)),[...t].join()}nn(){return this.ot()}get an(){return this.ot("100x","100")}Dc(){let t=this.tn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.rn(e);}):this.rn(e);});}Fc({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}Wr({elNode:t}){this.$c(t),this.initAttributes(t);}Zr({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.Wr({elNode:o}),o.setAttribute(Jo,""),o.addEventListener("load",()=>{o.removeAttribute(Jo),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Fc({elNode:o,src:t,srcset:e});})}async Vc(){if(this.$$("intersection")){this.Mt&&(this.Wr({elNode:this.wt}),this.appendChild(this.wt)),this.initIntersection(this.Di.img,async()=>{this.Mt&&(this.wt.src=this.an);try{await this.Zr({src:this.nn(),srcset:this.sn(),elNode:this.kt}),this.Mt&&await this.wt.remove(),this.appendChild(this.kt);}catch{this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}});return}try{this.Mt&&(await this.Zr({src:this.an,elNode:this.wt}),this.appendChild(this.wt)),await this.Zr({src:this.nn(),srcset:this.sn(),elNode:this.kt}),this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}catch{this.Mt&&await this.wt?.remove(),this.appendChild(this.kt);}}init(){this.tn?this.Dc():this.Vc();}};var os=class extends Sr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Eu}=qs,ha=a(r=>r,"i");var fa=a(r=>r.strings===void 0,"r"),ma=a(()=>document.createComment(""),"s"),ze=a((r,i,t)=>{let e=r.St.parentNode,o=i===void 0?r.de:i.St;if(t===void 0){let s=e.insertBefore(ma(),o),n=e.insertBefore(ma(),o);t=new Eu(s,n,r,r.options);}else {let s=t.de.nextSibling,n=t.c,l=n!==r;if(l){let c;t.Nc?.(r),t.c=r,t.yi!==void 0&&(c=r.W)!==n.W&&t.yi(c);}if(s!==o||l){let c=t.St;for(;c!==s;){let u=ha(c).nextSibling;ha(e).insertBefore(c,o),c=u;}}}return t},"v"),se=a((r,i,t=r)=>(r.yt(i,t),r),"u"),xu={},ga=a((r,i=xu)=>r.i=i,"p"),va=a(r=>r.i,"M"),Ar=a(r=>{r.pe(),r.St.remove();},"h");var gi=a((r,i)=>{let t=r.vt;if(t===void 0)return false;for(let e of t)e.ys?.(i,false),gi(e,i);return true},"s"),kr=a(r=>{let i,t;do{if((i=r.c)===void 0)break;t=i.vt,t.delete(r),r=i;}while(t?.size===0)},"o"),ya=a(r=>{for(let i;i=r.c;r=i){let t=i.vt;if(t===void 0)i.vt=t=new Set;else if(t.has(r))break;t.add(r),Au(i);}},"r");function Cu(r){this.vt!==void 0?(kr(this),this.c=r,ya(this)):this.c=r;}a(Cu,"h");function Su(r,i=false,t=0){let e=this.i,o=this.vt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)gi(e[s],false),kr(e[s]);else e!=null&&(gi(e,false),kr(e));else gi(this,r);}a(Su,"n");var Au=a(r=>{r.type==Pt.CHILD&&(r.yi??=Su,r.Nc??=Cu);},"c"),Mr=class extends wt{static{a(this,"f");}constructor(){super(...arguments),this.vt=void 0;}Sr(i,t,e){super.Sr(i,t,e),ya(this),this.isConnected=i.W;}ys(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(gi(this,i),kr(this));}setValue(i){if(fa(this.Ii))this.Ii.yt(i,this);else {let t=[...this.Ii.i];t[this.mc]=i,this.Ii.yt(t,this,0);}}disconnected(){}reconnected(){}};var O=a(()=>new ns,"e"),ns=class{static{a(this,"h");}},ss=new WeakMap,L=pt(class extends Mr{render(r){return R}update(r,[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=r.options?.host,this.rt(this.ct=r.element)),R}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ss.get(i);t===void 0&&(t=new WeakMap,ss.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?ss.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 as=null,vi=class extends S{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");},"closeDialog");this._c=()=>{this.closeDialog();};this.Bc=t=>{this.Xr=t.target;};this.zc=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Xr&&this.closeDialog();};this.qe=({id:t})=>{t===this.id?(as=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.We=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.ln=t=>{this.hide(),as===this.id&&this.emit(I.MODAL_CLOSE,{modalId:as,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){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;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(W.OPEN,this.qe),this.modalManager?.subscribe(W.CLOSE,this.We),this.modalManager?.subscribe(W.CLOSE_ALL,this.ln);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Xr=void 0,this.modalManager?.unsubscribe(W.OPEN,this.qe),this.modalManager?.unsubscribe(W.CLOSE,this.We),this.modalManager?.unsubscribe(W.CLOSE_ALL,this.ln);}Hc(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this._c),this.dialogEl.value?.addEventListener("mousedown",this.Bc),this.dialogEl.value?.addEventListener("mouseup",this.zc);}render(){return y`<dialog ${L(this.Hc)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],vi.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],vi.prototype,"blockBodyScrolling",2);var Or=class extends ${constructor(){super(...arguments);this.S=null;this.Fi=null;}static{a(this,"FormInput");}get cn(){return this.nameAttrValue??this.ctxName}un(){let t=document.createElement("input");return t.type="text",t.name=this.cn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,gr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.S=this.un(),this.appendChild(this.S),this.sub("*collectionState",t=>{if(!t)return;if(!this.Fi){let n=document.createElement("div");this.appendChild(n),this.Fi=n;}if(!this.S){let n=this.un();this.appendChild(n),this.S=n;}if(this.Fi.innerHTML="",t.status==="uploading"||t.status==="idle"){this.S.value="",this.S.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.S.value="",this.S.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.S.value=e.cdnUrl??"",this.S.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.S.value=o[0],this.S.setCustomValidity("");return}this.S.remove(),this.S=null;let s=new DocumentFragment;for(let n of o){let l=document.createElement("input");l.type="hidden",l.name=`${this.cn}[]`,l.value=n,s.appendChild(l);}this.Fi.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Or.prototype,"nameAttrValue",2);var ls=class extends S{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var He=class extends S{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.at=0;this.Vi=O();this.dn=()=>{let t=this.Vi.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.at>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.at=this.Yr(this.value),this.Qr(),this.Vi.value?.addEventListener("animationiteration",this.dn);}updated(t){if(super.updated(t),t.has("value")){let e=this.Yr(this.value);if(!this.visible)this.at=e;else {let o=Math.max(this.at,e);o!==this.at&&(this.at=o,this.Qr());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Qr():this.at=this.Yr(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Vi.value?.removeEventListener("animationiteration",this.dn);}Yr(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Qr(){this.visible&&this.style.setProperty("--l-progress-value",this.at.toString());}render(){return y`<div ${L(this.Vi)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],He.prototype,"hasFileName",2),h([b({type:Number})],He.prototype,"value",2),h([b({type:Boolean,reflect:true})],He.prototype,"visible",2);var yi=class extends ${constructor(){super();this.Tt=false;this.Te=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Jr=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.Tt=t;}),this.sub("*commonProgress",t=>{this.Te=t;});}updated(t){super.updated(t),t.has("visible")&&(this.Tt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Jr?.(),this.Jr=void 0;}render(){return y`<uc-progress-bar .value=${this.Te} .visible=${this.Tt}></uc-progress-bar>`}};h([g()],yi.prototype,"Tt",2),h([g()],yi.prototype,"Te",2);var je=class extends S{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.jc=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.jc} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],je.prototype,"value",2),h([b({type:Boolean,reflect:true})],je.prototype,"disabled",2),h([b({type:Array,attribute:false})],je.prototype,"options",2);var ku="src-type-",Ke=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.to={};this.eo="default";this.io="";}static{a(this,"SourceBtn");}Kc(){this.Ee({type:H.LOCAL,activate:a(()=>(this.api.openSystemDialog(),false),"activate")}),this.Ee({type:H.URL,activity:E.activities.URL,textKey:"from-url"}),this.Ee({type:H.CAMERA,activity:E.activities.CAMERA,activate:a(()=>{let t=be.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t},"activate")}),this.Ee({type:"draw",activity:E.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(Yo))this.Ee({type:t,activity:E.activities.CAMERA,activate:a(()=>{let e=be.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?k.PHOTO:k.VIDEO}),!e},"activate")});for(let t of Object.values($t))this.Ee({type:t,activity:E.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.Kc(),this.type&&this.pn(this.type);}Ee(t){this.to[t.type]=t;}activate(){if(!this.type)return;let t=this.to[this.type];if(!t)return;let{activity:e,activate:o,activityParams:s={}}=t;(o?o():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}pn(t){let e=this.to[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:o=t,icon:s=t}=e;this.io=`${ku}${o}`,this.eo=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.pn(this.type):(this.io="",this.eo="default"));}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.eo}></uc-icon><div class="uc-txt">${this.l10n(this.io)}</div></button>`}};h([b({type:String})],Ke.prototype,"type",2),h([g()],Ke.prototype,"eo",2),h([g()],Ke.prototype,"io",2);var bi=class extends S{constructor(){super(...arguments);this.hn=[];this.q=[];this.wrap=false;this.gn=[];}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.hn=q(t),this.mn();}),this.subConfigValue("cameraModes",t=>{this.q=lt(t),this.mn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}mn(){let t=[];for(let e of this.hn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&be.htmlMediaCapture){let o=this.q.length?this.q.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...o);continue}t.push(e);}this.gn=t;}render(){return y`${this.gn.map(t=>y`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};h([b({type:Boolean,attribute:"wrap",noAccessor:true})],bi.prototype,"wrap",2),h([g()],bi.prototype,"gn",2);var cs=class extends S{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var At="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ee(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=At);},"cancel")}}a(Ee,"preloadImage");function wi(r){let i=[];for(let s of r){let n=Ee(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(wi,"batchPreloadImages");function us(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let o=new Image,s=new Promise((n,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},o.onerror=c=>{l(c);};});return o.src=URL.createObjectURL(r),s}a(us,"generateThumb");var Ge=class extends ${constructor(){super(...arguments);this.Ni=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,n)=>{let l=o.subscribe(s,c=>{this.isConnected&&n(c);});this.Ni.add(l);})(t,e);}reset(){for(let t of this.Ni)t();this.Ni=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ni=new Set;}};function Mu(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(Mu,"createSvgBlobUrl");function Ir(r="hsl(209, 21%, 65%)",i=32,t=32){return Mu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(Ir,"fileCssBg");var Ou=3e3,qe=class extends Ge{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Vt="";this.vn=false;this._i=null;this.yn=false;this.Gc=this.cfg.filesViewMode;this.bn=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.qc(e);if(o&&s&&n){let p=await this.proxyUrl(G(Yt(this.cfg.cdnCname,n),et(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Ee(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await us(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ir(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await us(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ir(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ir(p));}});this.Bi=D(this.bn.bind(this),100);}static{a(this,"Thumb");}qc(t=false){t&&(this._i=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?._i?.height||0),10),parseInt(String(this?._i?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Ou)}Wc(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=At,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),o();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}oo(){this.ro?.cancel(),this.ro=void 0;}Zc(t){if(this.oo(),!t){this.Vt&&(this.Vt="");return}if(t===this.Vt)return;let e=new AbortController,o={controller:e,cancel:a(()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);},"cancel")};this.ro=o,this.Wc(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Vt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}zi(t=false){if(this.entry){if(t){this.bn(true);return}this.yn&&this.Bi();}}firstUpdated(t){super.firstUpdated(t),this.wn();}updated(t){super.updated(t),t.has("uid")&&this.wn();}Ze(t){let[e]=t;e&&(this.yn=e.isIntersecting,e.isIntersecting&&(this._i=e.boundingClientRect,this.zi(),this.s?.disconnect()),e.intersectionRatio===0&&this.Bi.cancel());}reset(){super.reset(),this.Bi.cancel(),this.oo(),this.Vt&&(this.Vt="");}wn(){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 o=a(()=>{this.zi();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.Zc(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.zi(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.vn&&(this.Gc==="list"&&this.zi(true),this.vn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Bi.cancel(),this.oo(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Vt||At} role="img" alt="Preview of uploaded image" ?hidden=${!this.Vt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],qe.prototype,"badgeIcon",2),h([b({attribute:false})],qe.prototype,"uid",2),h([g()],qe.prototype,"Vt",2);var ds=class extends E{static{a(this,"ActivityHeader");}};var ps=class extends E{constructor(){super(...arguments);this.historyTracked=true;this.activityType=E.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var hs=class extends ${constructor(){super(...arguments);this.Tn=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.Tn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Tn?.();}};var We=a((r,i)=>{let t=false,e,o=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...n),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...n),o=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var ba=a((r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},"u"),wa=pt(class extends wt{constructor(r){if(super(r),r.type!==Pt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let o=[],s=[],n=0;for(let l of r)o[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=va(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,m=o.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(o[d]===null)d++;else if(o[m]===null)m--;else if(l[d]===n[f])c[f]=se(o[d],s[f]),d++,f++;else if(l[m]===n[v])c[v]=se(o[m],s[v]),m--,v--;else if(l[d]===n[v])c[v]=se(o[d],s[v]),ze(r,c[v+1],o[d]),d++,v--;else if(l[m]===n[f])c[f]=se(o[m],s[f]),ze(r,o[d],o[m]),m--,f++;else if(u===void 0&&(u=ba(n,f,v),p=ba(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(n[f]),T=w!==void 0?o[w]:null;if(T===null){let C=ze(r,o[d]);se(C,s[f]),c[f]=C;}else c[f]=se(T,s[f]),ze(r,o[d],T),o[w]=null;f++;}else Ar(o[m]),m--;else Ar(o[d]),d++;for(;f<=v;){let w=ze(r,c[v+1]);se(w,s[f]),c[f++]=w;}for(;d<=m;){let w=o[d++];w!==null&&Ar(w);}return this.ut=n,ga(r,c),tt}});var Ur=a(()=>{let r=[];return {stack:r,promiseReadJpegChunks:a(t=>new Promise((e,o)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{o(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){o("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return n(t.slice(s,s+=m),f=>{if(f.byteLength!==m){o("Corrupted");return}r.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||o("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Iu=a(async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Ur();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ea=a(async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Ur();await s(r),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),o.push(u.length)});let l=[r.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(r.slice(c,e[u])),c=e[u]+o[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),Lu=226,xa=a((r,i)=>Ea(r,Lu,i.map(t=>t.buffer)),"replaceIccProfile"),Uu=a(async r=>{try{return await xa(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Pu=a((r,i,t)=>new Promise((e,o)=>{let s=a(n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);},"callback");r.toBlob(s,i,t),r.width=r.height=1;}),"canvasToBlob"),Ti=a(()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},"createCanvas"),Ru=a(r=>{let{ctx:t,canvas:e}=Ti();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},"hasTransparency"),$u=a(async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Ur();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Du="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Lr,Fu=a(()=>new Promise(r=>{if(Lr!==void 0)r(Lr);else {let i=new Image;i.addEventListener("load",()=>{Lr=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Lr);}),i.src=Du;}}),"isBrowserApplyExifOrientation"),Vu=a((r,i)=>{let t,e,o,s;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=true;else if(r.getUint16(6)===19789)e=false;else return;if(r.getUint16(8,e)!==42)return;o=8+r.getUint32(10,e);let n=r.getUint16(o-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},"findExifOrientation"),_u=a((r,i)=>{Vu(r,(t,e)=>r.setUint16(t,i,e));},"setExifOrientation"),Nu=a(async(r,i,t)=>(t&&_u(i,1),Ea(r,225,[i.buffer])),"replaceExif"),Bu=a((r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),zu=a(r=>Bu(new Image,r),"imageLoader"),Hu=[1,3],ju=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ta={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Ku=a(async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Ur();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&ju.indexOf(o)>=0){let n=s.getUint8(5);Hu.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Ca=a((r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},"memoize"),Sa=a((r,i)=>{let[t]=r,e=Object.keys(i).map(o=>parseInt(o,10)).sort((o,s)=>o-s);for(let o=0;o<e.length;o++){let s=e[o],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),ne={R:55,G:110,B:165,A:255},Gu=`rgba(${ne.R}, ${ne.G}, ${ne.B}, ${ne.A/255})`,Aa=a((r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Ti();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ti();s.width=r,s.height=i,n&&(n.fillStyle=Gu,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ne.R&&l[1]===ne.G&&l[2]===ne.B&&l[3]===ne.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}},"canvasTest");function ka(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}a(ka,"wrapAsync");var qu=ka(Ca(Aa,Sa)),Wu=ka(Ca(Aa,Sa)),Ma=a(async(r,i)=>{let t=Ta.squareSide.find(n=>n*n>=r*i),e=Ta.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([qu(t,t),Wu(e,1)]);if(o&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Oa=a(async(r,i,t)=>{try{let{ctx:e,canvas:o}=Ti();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Zu=a(({img:r,targetW:i,targetH:t})=>Oa(r,i,t),"native"),Xu=a(function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,n=t;do o.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<r*e);return o.reverse()},"calcShrinkSteps"),Yu=a(({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Xu({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[l,c],u)=>n.then(p=>Ma(l,c).then(()=>Oa(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),Qu=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Ju=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),ms=.71,td=a((r,i)=>{if(r.width*ms*r.height*ms<i.size)throw new Error("Not required");let t=r.width,e=r.height,o=t/e,s=Math.floor(Math.sqrt(i.size*o)),n=Math.floor(i.size/Math.sqrt(i.size*o));return Ma(s,n).then(()=>{let{ctx:l}=Ti();return "imageSmoothingQuality"in l&&!Qu()&&!Ju?Zu({img:r,targetW:s,targetH:n}):Yu({img:r,sourceW:t,targetW:s,targetH:n,step:ms})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Ia=a(async(r,i)=>{try{if(await Ku(r))throw new Error("Should skipped");let e=await Promise.allSettled([$u(r),Fu(),Iu(r)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Uu(r).catch(()=>r),p=await zu(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await td(p,i),m="image/jpeg",f=i?.quality||.8;!s&&Ru(d)&&(m="image/png",f=void 0);let v=await Pu(d,m,f);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await Nu(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await xa(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var ed=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,La=a(r=>{if(typeof r!="string")return false;let i=ed.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var 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")}),j=class j extends Ge{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.En=true;this.uid="";this.so="";this.ao="";this.lo="";this.at=0;this.xn=false;this.co="";this.Cn=false;this.Sn=false;this.An=false;this.kn=false;this.Mn=false;this.Hi=false;this.On="";this.In=false;this.Xc=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(E.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT;});this.Yc=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Qc=()=>{this.Ln();};this.g=D(()=>this.Un(),100);this.tu=this.withEntry(We((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===X.FINISHED,c=e===X.UPLOADING,u=e===X.QUEUED_UPLOADING,p=e===X.QUEUED_VALIDATION,d=e===X.VALIDATION,m=t.getValue("fileName"),f="";o?f="":!l&&n&&s&&Object.values($t).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.lo=f,this.ao=o,this.xn=c||u||p||d,this.at=p||d?0:t.getValue("uploadProgress"),this.On=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ln=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.g();try{let o=new AbortController;t.setValue("abortController",o);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File&&this.cfg.imageShrink)try{let d=La(this.cfg.imageShrink);d?l=await Ia(l,d):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:o.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Io(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.g();}catch(o){this.telemetryManager.sendEventError(o,"file upload. Failed to upload file"),o instanceof Jt&&o.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof fe?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:o}):(console.error("Unknown upload error",o),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:o})})),t===this.entry&&this.g();}}});}static{a(this,"FileItem");}Un(){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.Jc(t,e);}Jc(t,e){e===X.FAILED?this.co="badge-error":e===X.FINISHED&&(this.co="badge-success"),e===X.UPLOADING&&(this.kn=false,this.removeAttribute("focused")),this.Sn=e===X.FAILED,this.An=e===X.UPLOADING,this.Cn=e===X.FINISHED,this.Mn=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.tu(e);}reset(){super.reset(),this.g.cancel();}Ze(t){let[e]=t;e&&e.isIntersecting&&!this.In&&(this.En=false,this.In=true);}Pn(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.g();}),this.subEntry("isValidationPending",()=>{this.g();}),this.subEntry("uploadProgress",()=>{this.g();}),this.subEntry("isQueuedForUploading",()=>{this.g();}),this.subEntry("fileName",o=>{this.so=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.g();}),this.subEntry("externalUrl",o=>{this.so=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.g();}),this.subEntry("errors",()=>this.g()),this.subEntry("isUploading",()=>this.g()),this.subEntry("fileSize",()=>this.g()),this.subEntry("mimeType",()=>this.g()),this.subEntry("isImage",()=>this.g()),this.Un());}Rn(t){if(this.cfg.filesViewMode==="list"){this.Hi=true;return}this.Hi=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Pn(this.uid);}initCallback(){super.initCallback(),this.Pn(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.g()),this.subConfigValue("filesViewMode",t=>{this.Rn(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.Rn(t);}),this.onclick=()=>{j.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Ln());}),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.En?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Cn} ?data-uploading=${this.An} ?data-failed=${this.Sn} ?data-focused=${this.kn} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.co}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.On}><span class="uc-file-name" ?hidden=${!this.Hi}>${this.so}</span><span class="uc-file-error" ?hidden=${!this.ao}>${this.ao}</span><span class="uc-file-hint" ?hidden=${!this.lo}>${this.lo}</span></div><div class="uc-file-actions"><button type="button" @click=${this.Xc} ?hidden=${!this.Mn} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" data-testid="edit" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.Yc} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Qc}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.at} .visible=${this.xn} ?hasFileName=${this.Hi}></uc-progress-bar></div>`}};h([g()],j.prototype,"En",2),h([b({attribute:false})],j.prototype,"uid",2),h([g()],j.prototype,"so",2),h([g()],j.prototype,"ao",2),h([g()],j.prototype,"lo",2),h([g()],j.prototype,"at",2),h([g()],j.prototype,"xn",2),h([g()],j.prototype,"co",2),h([g()],j.prototype,"Cn",2),h([g()],j.prototype,"Sn",2),h([g()],j.prototype,"An",2),h([g()],j.prototype,"kn",2),h([g()],j.prototype,"Mn",2),h([g()],j.prototype,"Hi",2),h([g()],j.prototype,"On",2);var fs=j;function id(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(o=>{o.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}a(id,"checkIsDirectory");function rd(r,i){return new Promise(t=>{let e=0,o=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});o.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(o);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(o);});},"readReaderContent");s(r);})}a(rd,"readEntryContentAsync");function Ua(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let o=r.items[e];if(o)if(o.kind==="file"){let s=o.type,n=o;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(rd(c,s).then(u=>{u&&i.push(...u);}));continue}let l=o.getAsFile();l&&t.push(id(l).then(c=>{c||i.push({type:"file",file:l});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Ua,"getDropItems");var ot=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Pa=["focus"],od=100,gs=new Map;function sd(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}a(sd,"distance");function vs(r){let i=0,t=document.body,e=new Set,o=a(v=>{e.add(v);},"handleSwitch"),s=ot.INACTIVE,n=a(v=>{r.shouldIgnore()&&v!==ot.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");o(v=>r.onChange(v));let c=a(()=>{i=0,n(ot.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===ot.INACTIVE&&n(ot.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(ot.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(ot.INACTIVE);},"onDrop"),m=a(v=>{if(r.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=r.element.getBoundingClientRect(),C=Math.floor(sd(w,T)),x=C<od,A=v.composedPath().includes(r.element);gs.set(r.element,C);let yt=Math.min(...gs.values())===C;A&&yt?(v.preventDefault(),n(ot.OVER)):n(x&&yt?ot.NEAR:ot.ACTIVE);},"onDragOver"),f=a(async v=>{if(r.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Ua(w);r.onItems(T),n(ot.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),r.element.addEventListener("drop",f),Pa.forEach(v=>{window.addEventListener(v,c);}),()=>{gs.delete(r.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),r.element.removeEventListener("drop",f),Pa.forEach(v=>{window.removeEventListener(v,c);});}}a(vs,"addDropzone");var ys=new Set,mt=class extends ${constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.$t=true;this.$n=true;this.Dn=null;this.uo=null;this.Fn=O();this.xe=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.Vn=true;this.Ce=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get eu(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.$t)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=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&&o}initCallback(){super.initCallback(),ys.add(this),this.po(),this.ho(),this.Nn(),this._n(ot.INACTIVE),this.Dn=vs({element:this,shouldIgnore:a(()=>this.Bn(),"shouldIgnore"),onChange:a(t=>{this._n(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:H.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:H.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(E.activities.UPLOAD_LIST),this.set$({"*currentActivity":E.activities.UPLOAD_LIST})));},"onItems")}),this.updateComplete.then(()=>this.iu()),this.subConfigValue("sourceList",t=>{let e=q(t);this.Vn=e.includes(H.LOCAL),this.po(),this.ho();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.po(),this.ho());}updated(t){super.updated(t),t.has("clickable")&&this.Nn();}Bn(){if(!this.$t||!this.ru())return true;if(!this.fullscreen)return false;let t=ys;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}ru(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}po(){let t=this.Vn&&!this.disabled;this.$t=t;}ho(){let t=this.$t||!this.querySelector("[data-default-slot]");this.$n=t,this.hidden=!t;}_n(t){let e=Object.entries(ot).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}iu(){if(this.uo)return;let t=this.Fn.value;t&&(this.uo=vs({element:t,onChange:a(e=>{let o=Object.entries(ot).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.Bn(),"shouldIgnore")}));}Nn(){this.clickable&&!this.Ce?(this.addEventListener("keydown",this.xe),this.addEventListener("click",this.xe),this.Ce=true):!this.clickable&&this.Ce&&(this.removeEventListener("keydown",this.xe),this.removeEventListener("click",this.xe),this.Ce=false);}disconnectedCallback(){super.disconnectedCallback(),ys.delete(this),this.Dn?.(),this.uo?.(),this.Ce&&(this.removeEventListener("keydown",this.xe),this.removeEventListener("click",this.xe),this.Ce=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.Fn)} class="uc-content-wrapper" ?hidden=${!this.$n}><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.eu}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],mt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],mt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],mt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],mt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],mt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],mt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],mt.prototype,"initflow",2),h([b({type:String})],mt.prototype,"text",2),h([g()],mt.prototype,"$t",2),h([g()],mt.prototype,"$n",2);var kt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=E.activities.UPLOAD_LIST;this.zn=false;this.Hn=false;this.jn=false;this.mo=false;this.fo=false;this.ji=null;this.Kn=false;this.go=null;this.Gn=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.vo=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.Ot();};this.yo=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.It=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Ot=We(()=>{this.isConnected&&(this.nu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get ou(){return this.go?this.su(this.go):""}nu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},o=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&o&&c&&f;}this.zn=p,this.Hn=d,this.jn=u,this.fo=e.total===0||!s&&!n,this.mo=!n||this.cfg.multiple,this.Kn=e.total>0,this.go=e;}su(t){let e=a(o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Ot),this.subConfigValue("multipleMin",this.Ot),this.subConfigValue("multipleMax",this.Ot),this.sub("*groupInfo",t=>{t&&this.Ot();}),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.Ot),this.uploadCollection.observeCollection(this.Ot),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.ji=null;return}this.ji=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Ot),this.uploadCollection.unobserveCollection(this.Ot));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.ou}</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.Kn}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${wa(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Gn} ?disabled=${!this.fo} ?hidden=${!this.mo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.ji} >${this.ji??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.mo} ?disabled=${!this.fo} @click=${this.Gn} ><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.jn} @click=${this.vo} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.zn} ?disabled=${!this.Hn} @click=${this.yo} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],kt.prototype,"zn",2),h([g()],kt.prototype,"Hn",2),h([g()],kt.prototype,"jn",2),h([g()],kt.prototype,"mo",2),h([g()],kt.prototype,"fo",2),h([g()],kt.prototype,"ji",2),h([g()],kt.prototype,"Kn",2),h([g()],kt.prototype,"go",2);var Pr=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.URL;this.bo={importDisabled:true};this.Nt=O();this.wo=t=>{let e=t.target?.value??"";this.bo={importDisabled:!e};};this.vo=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let o=this.Nt.value?.value?.trim();o&&(this.api.addFileFromUrl(o,{source:H.URL}),this.modalManager?.open(E.activities.UPLOAD_LIST),this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};}static{a(this,"UrlSource");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:a(()=>{let t=this.Nt.value;t&&(t.value="",t.focus()),this.bo={importDisabled:true};},"onActivate")});}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.vo}><label><input ${L(this.Nt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.wo} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.bo.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],Pr.prototype,"bo",2);var Ra=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var $a="important",nd=" !"+$a,xe=pt(class extends wt{constructor(r){if(super(r),r.type!==Pt.ATTRIBUTE||r.name!=="style"||r.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(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.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 o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(nd);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?$a:""):t[e]=o;}}return tt}});var ad={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},ld=["camera","microphone"];function Rr(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}a(Rr,"formatTime");var Da="image/jpeg",Fa="video/webm",B=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CAMERA;this.Ki=null;this.To=false;this.Xe=[];this.Et=null;this.xt=null;this.Gi=null;this.qi=null;this.v=null;this.Ye={};this.Ct=null;this.e=null;this.Se=[];this.Ae=[];this.au={};this.Wi=[];this.Zi=null;this.qn=()=>{this.Wn(),this.Qe="pause";};this.Zn=()=>{this.Qe="play",this.lu();};this.Je=O();this.te=O();this._=O();this.Xn=O();this.Yn=0;this.Qn=0;this.Jn=null;this.Xi=true;this.Yi=true;this.cu=Ra();this.ta=[];this.ee=true;this.Eo="";this.ke=true;this.ie=true;this.Me=true;this.ea=[];this.re=true;this.xo=true;this.oe=true;this.Lt=true;this.se=true;this.Oe="camera-full";this.Qe="play";this.ia="microphone";this.Qi="uc-shot-btn uc-camera-action";this.uu=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===k.PHOTO&&this.du(),this.v===k.VIDEO){if(this.Et?.state==="recording"){this.ra();return}this.pu();}};this.hu=t=>{let e=t.target;e&&(this.qi=e.value,this.Ie());};this.mu=t=>{let e=t.target;e&&(this.Gi=e.value,this.Ie());};this.fu=()=>{this.Ie();};this.gu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.uu();};this.vu=()=>{this.yu();};this.bu=()=>{this.wu();};this.Tu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.Eu();};this.xu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.Cu();};this.oa=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.sa(o);};this.na=()=>{let t=Math.floor((performance.now()-this.Yn+this.Qn)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Je.value;s&&(s.textContent=Rr(e)),this.ra();return}let o=this.Je.value;o&&(o.textContent=Rr(e));}else {let e=this.Je.value;e&&(e.textContent=Rr(t));}this.Le=requestAnimationFrame(this.na);};this.Su=()=>{this.Yn=performance.now(),this.Qn=0,this.na();};this.aa=()=>{this.Le&&cancelAnimationFrame(this.Le);};this.Wn=()=>{let t=this._.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.te.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.Je.value;n&&(n.textContent=Rr(e)),this.Le=requestAnimationFrame(this.Wn);};this.lu=()=>{this.Le&&cancelAnimationFrame(this.Le);};this.Le=null;this.pu=()=>{try{this.Xe=[],this.Ye={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Ye.mimeType=t:MediaRecorder.isTypeSupported(Fa)?this.Ye.mimeType=Fa:this.Ye.mimeType="video/mp4",this.xt&&(this.Et=new MediaRecorder(this.xt,this.Ye),this.Et.start(),this.Et.addEventListener("dataavailable",e=>{this.Xe.push(e.data);}),this.Su(),this.classList.add("uc-recording"),this.ti(Tt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.ra=()=>{this.Et?.addEventListener("stop",()=>{this.Au(),this.aa(),this.ti(Tt.STOP);}),this.Et?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.yu=()=>{if(this.Et?.state==="recording")return;let t=this._.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.wu=()=>{this.xt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.ia=t.enabled?"microphone":"microphone-mute",this.xo=!t.enabled;});};this.Au=()=>{try{let t=new Blob(this.Xe,{type:this.Et?.mimeType}),e=URL.createObjectURL(t),o=this._.value;if(!o)return;o.muted=!1,o.volume=1,this.ei(null),o.src=e,this.ku(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Eu=()=>{if(this.ti(Tt.RETAKE),this.v===k.VIDEO){this.ei(this.xt);let t=this._.value;t&&(t.muted=true);}this._.value?.play?.();};this.Cu=()=>{if(this.ti(Tt.ACCEPT),this.v===k.PHOTO){this.Ct?.toBlob(s=>{if(!s)return;let n=this.la("camera","jpeg",Da,s);this.ca(n);},Da);return}let t=new Blob(this.Xe,{type:this.Et?.mimeType}),e=this.Mu(this.Et?.mimeType),o=this.la("video",e,`video/${e}`,t);this.ca(o),this.Xe=[];};this.Ou=t=>{t===Tt.SHOT&&(this.se=true,this.ie=true,this.Lt=true,this.Me=false,this.ee=true),(t===Tt.RETAKE||t===Tt.ACCEPT)&&(this.se=!this.q.includes(k.VIDEO),this.Lt=!this.q.includes(k.PHOTO),this.ie=false,this.Me=true,this.ee=this.Se.length<=1);};this.Iu=t=>{t===Tt.PLAY&&(this.ke=false,this.Lt=true,this.ee=true,this.re=true,this.Qe="pause",this.Oe="square",this.Qi="uc-shot-btn uc-camera-action uc-stop-record"),t===Tt.STOP&&(this.ke=false,this.ie=true,this.oe=true,this.Me=false),(t===Tt.RETAKE||t===Tt.ACCEPT)&&(this.ke=true,this.se=!this.q.includes(k.VIDEO),this.Lt=!this.q.includes(k.PHOTO),this.ie=false,this.Me=true,this.oe=!this.cfg.enableAudioRecording,this.Oe="video-camera-full",this.Qi="uc-shot-btn uc-camera-action",this.re=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.ee=this.Se.length<=1);};this.ti=t=>{this.v===k.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Ou(t),this.v===k.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Iu(t);};this.sa=t=>{this.Xn.value?.querySelectorAll("button").forEach(o=>{o.classList.toggle("uc-active",o.getAttribute("data-id")===t);}),t===k.PHOTO&&(this.Oe="camera-full",this.re=true,this.oe=true),t===k.VIDEO&&(this.Qe="play",this.Oe="video-camera-full",this.re=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.oe=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.la=(t,e,o,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:o})};this.ca=t=>{this.api.addFileFromObject(t,{source:H.CAMERA}),this.set$({"*currentActivity":E.activities.UPLOAD_LIST}),this.modalManager?.open(E.activities.UPLOAD_LIST);};this.ii=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===k.VIDEO&&this.cfg.enableAudioRecording,o=this.v===k.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Xi=false,this.ie=false,this.Lt=!this.q.includes(k.PHOTO),this.se=!this.q.includes(k.VIDEO),this.Yi=true,this.ke=true,this.Oe=o,this.oe=!e,this.re=!e):t==="prompt"?(this.Eo="camera-permissions-prompt",this.Xi=true,this.ie=true,this.Lt=true,this.Yi=false,this.Ao()):(this.Eo="camera-permissions-denied",this.Xi=true,this.Yi=false,this.Lt=!this.q.includes(k.PHOTO),this.se=!this.q.includes(k.VIDEO),this.Me=true,this.Qi="uc-shot-btn uc-camera-action",this.Ao());},300);this.Lu=()=>{if(!this.xt)return false;let t=this.xt?.getAudioTracks(),e=this.xt?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.Ao=()=>{this.To&&(this._.value&&(this._.value.volume=0),this.Zi?.getTracks?.()?.[0]?.stop(),this.Co(this._.value),this.ei(null),this.Lu(),this.aa(),this.To=false);};this.Ie=async()=>{let t={video:{...ad},audio:this.cfg.enableAudioRecording?{}:false};this.qi&&(t.video={deviceId:{exact:this.qi}}),this.Gi&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Gi}}),this._.value&&(this._.value.volume=0);try{this.ii("prompt"),this.xt=await navigator.mediaDevices.getUserMedia(t),this.xt.addEventListener("inactive",()=>{this.ii("denied");}),this.ei(this.xt),this.To=!0,this.ii("granted");}catch(e){this.ii("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.ua=()=>{this.Ie();};this.Uu=async()=>{try{this.Ji();for(let t of ld){let e=await navigator.permissions.query({name:t});this.au[t]=e,e.addEventListener("change",this.ua),this.Wi.push(()=>{e.removeEventListener("change",this.ua);});}this.Ki=()=>{this.Ji();};}catch(t){this.Ji(),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.Ie();}};this.Pu=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.ko(),navigator.mediaDevices.addEventListener("devicechange",this.ko);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.ko=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Se=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ae=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.ta=this.Se,this.ee=this.Se.length<=1,this.qi=this.Se[0]?.value??null,this.ea=this.Ae,this.re=!this.cfg.enableAudioRecording||this.Ae.length<=1,this.Gi=this.Ae[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Ru=async()=>{await this.Uu(),await this.Pu(),await this.Ie(),this.da(this.q);};this.$u=async()=>{this.Ki&&this.Ki(),window.chrome||this.ii("denied"),this.Ao();};this.da=t=>{this.se=!t.includes(k.VIDEO),this.Lt=!t.includes(k.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.sa(e);};}static{a(this,"CameraSource");}ku(t){this.Co(t),t.addEventListener("play",this.qn),t.addEventListener("pause",this.Zn);}Co(t){t?.removeEventListener("play",this.qn),t?.removeEventListener("pause",this.Zn);}ei(t){this.Zi!==t&&(this.Zi=t,this.So());}So(){let t=this._.value;if(!t)return;let e=this.Zi??null;t.srcObject!==e&&(t.srcObject=e);}du(){if(this.ti("shot"),this.Ct=document.createElement("canvas"),this.e=this.Ct.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this._.value;if(!t)throw new Error("Video element not found");this.Ct.height=t.videoHeight,this.Ct.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.Ct.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Mu(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let o=t.split("/");if(o?.[0]==="video"){let n=o.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get q(){return q(this.cfg.cameraModes).filter(t=>t===k.PHOTO||t===k.VIDEO)}Ji(){if(this.Wi.length!==0){for(let t of this.Wi)t();this.Wi=[],this.Ki=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.Ru,onDeactivate:this.$u}),this.subConfigValue("cameraMirror",t=>{this.Jn=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.oe=!t,this.xo=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=lt(t);this.da(e.filter(o=>o===k.PHOTO||o===k.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.So();}updated(t){super.updated(t),this.So();}Du(){this.Ji(),navigator.mediaDevices?.removeEventListener("devicechange",this.ko),this.Co(this._.value),this.ei(null);}disconnectedCallback(){super.disconnectedCallback(),this.Du();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ee}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.ta} ?hidden=${this.ee} @change=${this.hu} ></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=${xe({transform:this.Jn})} ?hidden=${this.Xi} ${L(this._)} ></video><div class="uc-message-box" ?hidden=${this.Yi}><span>${this.l10n(this.Eo)}</span><button type="button" @click=${this.fu} ?hidden=${this.cu} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${L(this.Xn)} class="uc-switcher" ?hidden=${!this.ke}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.oa} ?hidden=${this.Lt} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.oa} ?hidden=${this.se} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.vu} ?hidden=${this.ke} data-testid="recording-timer" ><uc-icon name=${this.Qe}></uc-icon><span ${L(this.Je)}> 00:00 </span><span ${L(this.te)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Me} ><button type="button" class="uc-secondary-btn" @click=${this.Tu}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.xu} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.gu} class=${this.Qi} ?hidden=${this.ie} ><uc-icon name=${this.Oe}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.bu} ?hidden=${this.oe} data-testid="toggle-microphone" ><uc-icon name=${this.ia}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.ea} ?hidden=${this.re} ?disabled=${this.xo} @change=${this.mu} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],B.prototype,"Jn",2),h([g()],B.prototype,"Xi",2),h([g()],B.prototype,"Yi",2),h([g()],B.prototype,"cu",2),h([g()],B.prototype,"ta",2),h([g()],B.prototype,"ee",2),h([g()],B.prototype,"Eo",2),h([g()],B.prototype,"ke",2),h([g()],B.prototype,"ie",2),h([g()],B.prototype,"Me",2),h([g()],B.prototype,"ea",2),h([g()],B.prototype,"re",2),h([g()],B.prototype,"xo",2),h([g()],B.prototype,"oe",2),h([g()],B.prototype,"Lt",2),h([g()],B.prototype,"se",2),h([g()],B.prototype,"Oe",2),h([g()],B.prototype,"Qe",2),h([g()],B.prototype,"ia",2),h([g()],B.prototype,"Qi",2);function Ei(r,i,t){return r?i(r):t?.(r)}a(Ei,"n");function Va(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(Va,"normalize");function ft(...r){let i=Va(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(ft,"classNames");function _a(r,...i){let t=Va(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}a(_a,"applyClassNames");var cd=a(r=>it.includes(r),"isTabIdValue"),Na=a(r=>{if(!r)return it;let i=lt(r).filter(cd);return i.length===0?it:i},"parseTabs");function Ba(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":it,"*tabId":N.CROP,"*on.retryNetwork":a(()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=At,t.src=e;}r.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=et(Qt(i),"preview"),o=G(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:o,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),r.remove();},"*on.apply"),"*on.cancel":a(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(Ba,"initState");var za="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ce={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},xi=class extends S{constructor(){super(...arguments);this.Tt=false;this.pa=Ce;this.ha=Ce.visible;this.ma=Ce.hidden;this.Mo=false;this.fa=false;}static{a(this,"PresenceToggle");}set visible(t){this.Tt=t,this.ga();}get visible(){return this.Tt}set styles(t){this.pa=t,this.Mo=true,this.ha=t.visible??Ce.visible,this.ma=t.hidden??Ce.hidden;}get styles(){return this.pa}ga(){this.style.visibility=this.Tt?"inherit":"hidden",_a(this,{[Ce.transition]:!this.Mo,[this.ha]:this.Tt,[this.ma]:!this.Tt}),this.toggleAttribute("inert",!this.Tt);}Fu(){this.fa||(this.fa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Mo||this.classList.add(Ce.transition),this.ga(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Fu();},0);}};h([b({type:Boolean})],xi.prototype,"visible",1),h([b({attribute:false})],xi.prototype,"styles",1);var $r=class extends S{constructor(){super(...arguments);this.active=false;this.te=O();this.Oo=false;this.Io=()=>{let t=this.te.value;t&&(this.va(t),this.Oo&&this.active&&this.Lo());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.Lo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Lo():this.Vu());}Lo(){let t=this.te.value;if(!t)return;this.Oo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Io),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Io,{once:true});}Vu(){let t=this.te.value;t&&(this.Oo=false,t.removeEventListener("transitionend",this.Io),this.va(t));}va(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.te)}></div></div>`}};h([b({type:Boolean,reflect:true})],$r.prototype,"active",2);var ae=pt(class extends wt{constructor(r){if(super(r),r.type!==Pt.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.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=r.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let o=!!i[e];o===this.st.has(e)||this.nt?.has(e)||(o?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return tt}});var K=a(r=>r??R,"o");var Mt=class extends S{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.ya(),this.ba();}updated(t){super.updated(t),t.has("reverse")&&this.ya(),t.has("theme")&&this.ba();}ya(){this.style.flexDirection=this.reverse?"row-reverse":"";}ba(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Nu(){let t=this.Uo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this._u}}get Uo(){return !this.icon}get _u(){return !this.text&&!this.Uo}render(){return y`<button type="button" role=${K(this.ariaRole||void 0)} aria-controls=${K(this.ariaControls||void 0)} aria-label=${K(this.l10n(this.titleProp))} title=${K(this.l10n(this.titleProp))} ><uc-icon class=${ae(this.Nu)} name=${K(this.icon||void 0)} ?hidden=${this.Uo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],Mt.prototype,"text",2),h([b({type:String})],Mt.prototype,"icon",2),h([b({type:Boolean,reflect:true})],Mt.prototype,"reverse",2),h([b({type:String,reflect:true})],Mt.prototype,"theme",2),h([b({attribute:"aria-role"})],Mt.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],Mt.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],Mt.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],Mt.prototype,"active",2);function Ha(r,i){let t={};for(let e of i){let o=r[e];(Object.hasOwn(r,e)||o!==void 0)&&(t[e]=o);}return t}a(Ha,"pick");function Ze(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return G(r,et(Gi,Qt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}a(Ze,"viewerImageSrc");var Dr=class extends S{constructor(){super(...arguments);this.wa=`uc-backdrop-mask-${ut.generateFastUid()}`;this.er=false;this.ni=false;this.xa=O();this.ai=false;this.li=null;this.Sa=t=>{this.Aa(),this.ci&&(t.stopPropagation(),t.preventDefault(),this.ci=false);};this.ka=t=>{if(!this.ci||!this.tr||!this.Ro)return;t.stopPropagation(),t.preventDefault();let e=this._t;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,l=t.y-s,c=n-this.tr[0],u=l-this.tr[1],{direction:p}=this.Ro,d=this.Zu(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Ma=t=>{if(!this.Ut)return;let e=Object.values(this.Ut).find(o=>{if(!o||this.Do(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return ra(l,[t.x,t.y])});this.Ta=e,this.Aa();};}static{a(this,"CropFrame");}get _t(){return this.xa.value??null}get ci(){return this.ni}set ci(t){this.ni!==t&&(this.ni=t,this.$o());}$o(){this.oi&&this.oi.setAttribute("class",ft({"uc-guides--hidden":this.er,"uc-guides--visible":!this.er&&this.ni,"uc-guides--semi-hidden":!this.er&&!this.ni}));}Do(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let o=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return o||s}Bu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,l=this._t;if(!l)return;let c=ht("mask",{id:this.wa}),u=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=ht("rect",{x:e,y:o,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.wa})`});l.appendChild(d),l.appendChild(c),this.ri=c,this.Po=p;}zu(){this.ri&&(this.ri.style.display="none",window.requestAnimationFrame(()=>{this.ri&&(this.ri.style.display="block");}));}Hu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this.Po&&re(this.Po,{x:e,y:o,width:s,height:n});}ju(){let t=this.$["*cropBox"];if(!(!t||!this.oi||!this.Ut)){for(let e of Object.values(this.Ut)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:l}=e,c=o==="",u=o.length===2,{x:p,y:d,width:m,height:f}=t;if(c)re(n,{x:p,y:d,width:m,height:f});else {let w=oe(Math.min(m,f)/82/2,0,1),T=u?Qn(t,o,w):Jn(t,o,w),C=T.center;if(!C)continue;let x=Math.max(Qo*oe(Math.min(m,f)/Qo/3,0,1),Yn);re(n,{x:C[0]-x,y:C[1]-x,width:x*2,height:x*2}),re(s,{d:T.d});}let v=this.Do(o);l.setAttribute("class",ft("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}re(this.oi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Ca(t,e){let o=ht("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=ht("rect",{fill:"transparent"}),n=ht("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(n),o.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.Ku.bind(this,e));}Gu(){let t={};for(let e=0;e<3;e++)for(let o=0;o<3;o++){let s=`${["n","","s"][e]}${["w","","e"][o]}`;s!==""&&this.Ca(t,s);}return this.Ca(t,""),t}qu(){let t=ht("svg"),e=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let o=1;o<=2;o++){let s=ht("line",{x1:`${hi*o}%`,y1:"0%",x2:`${hi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=ht("line",{x1:"0%",y1:`${hi*o}%`,x2:"100%",y2:`${hi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Wu(){let t=this._t;if(!t)return;let e=document.createDocumentFragment(),o=this.qu();e.appendChild(o);let s=this.Gu();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Ut=s,this.oi=o,this.$o();}Ku(t,e){if(!this.Ut)return;let o=this.Ut[t];if(!o||this.Do(t))return;let s=this.$["*cropBox"],n=this._t;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.ci=true,this.Ro=o,this.tr=[u,p],this.Ea={...s};}Zu(t,e){let[o,s]=e,n=this.$["*imageBox"],l=this.Ea??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=ea({rect:l,delta:[o,s],imageBox:n}):l=ia({rect:l,delta:[o,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return Fe(_e(l),n)}Aa(){let t=this.Ta,e=this._t;e&&(e.style.cursor=t?ta(t.direction):"initial");}Oa(t){if(this.si){this.si.setAttribute("href",t);return}let e=this._t;if(!e){this.li=t;return}this.li=null;let o=document.createDocumentFragment(),s=ht("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.si=s;}Xu(){let t=this.$["*cropBox"];if(!t||!this.si)return;let{x:e,y:o,width:s,height:n}=t;re(this.si,{x:e,y:o,height:n,width:s});}Fo(){this.ai&&(this.Hu(),this.ju(),this.Xu());}toggleThumbs(t){if(this.Ut)for(let e of Object.values(this.Ut)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",ft("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.zu(),this.ai&&window.requestAnimationFrame(()=>{this.Fo();});}),this.sub("*cropBox",t=>{t&&(this.er=t.height<=M||t.width<=M,this.$o(),this.ai&&window.requestAnimationFrame(()=>{this.Fo();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Oa(t);}),document.addEventListener("pointermove",this.ka,true),document.addEventListener("pointerup",this.Sa,true);}firstUpdated(t){super.firstUpdated(t),this.Yu();}Yu(){let t=this._t;if(!(!t||this.ai)){if(this.Bu(),this.Wu(),this.ai=true,t.addEventListener("pointermove",this.Ma,true),this.li){let e=this.li;this.li=null,this.Oa(e);}this.Fo();}}disconnectedCallback(){super.disconnectedCallback(),this._t?.removeEventListener("pointermove",this.Ma,true),document.removeEventListener("pointermove",this.ka,true),document.removeEventListener("pointerup",this.Sa,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.xa)}></svg>`}};h([g()],Dr.prototype,"ni",2);function dd(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(o=>Number.isInteger(o)&&Number.isFinite(o)),({dimensions:t,coords:e})=>t.every(o=>o>0)&&e.every(o=>o>=0)].every(t=>t(r)):true}a(dd,"validateCrop");var Fr=class extends S{constructor(){super();this.ctxOwner=true;this.ne={width:0,height:0};this.e=null;this.E=false;this.pt=null;this.La=O();this.No=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Ia=D(this.Ua.bind(this),300),this.Vo=We(()=>{!this.isConnected||!this.E||(this._o(),this.Pa(),this.Ra(),this.Bo(),this.zo());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this._o();}Pa(){let t=this.$["*editorTransformations"],e=Ha(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}_o(){let t=this.La.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*n,t.height=s*n,e?.scale(n,n),this.Ct=t,this.e=e;}Ra(){if(!this.E||!this.pt)return;let t=this.pt,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},l=Ve({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,m=d/u,f=0+e,v=e+(n.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=n.height-e*2,m=d*u,f=e+(n.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,m=e+(n.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=_e(c);}Bo(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[m,f],coords:[v,w]}=n,{width:T}=Ve(this.ne,s),C=l/T;t=Fe(_e({x:c+v*C,y:u+w*C,width:m*C,height:f*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!oa(t,e)||d&&!sa(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=Fe(_e(t),e);}Qu(){let t=this.e;if(!t)return;let e=this.pt;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=Ve({width:o.width,height:o.height},c);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}zo(){if(!this.E||!this.pt||!this.Ct||!this.e)return;let t=this.Ct;this.e.clearRect(0,0,t.width,t.height),this.Qu();}Ju({fromViewer:t}){this.pt&&(this.No.value?.toggleThumbs(true),this.td(),setTimeout(()=>{this.className=ft({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}$a(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l}=e,{width:c,height:u}=Ve(this.ne,s),{width:p,height:d}=t,m=n/c,f=l/u;return [oe(Math.round(p/m),1,c),oe(Math.round(d/f),1,u)]}ed(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=Ve(this.ne,s),{x:m,y:f}=t,v=n/p,w=l/d,T=this.$a(),C={dimensions:T,coords:[oe(Math.round((m-c)/v),0,p-T[0]),oe(Math.round((f-u)/w),0,d-T[1])]};if(!dd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}Ua(){if(!this.isConnected||!this.ne)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.ed(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.E&&(this.Ra(),this.Bo(),this.zo());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.E){this.E=true,await this.updateComplete,this._o(),this.ne=t,this.removeEventListener("transitionend",this.Da);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.pt=await this.rd(o,s),this.Pa(),this.Vo(),this.Ju({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.E&&this.pt&&this.Vo();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.E&&(!t&&this.Ua(),this.E=false,this.od(),this.className=ft({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.No.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Da,{once:true}),this.s?.disconnect());}od(){let t=this.$a(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(o,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}td(){let t=this.$["*cropBox"],e=t.x+t.width/2,o=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${o}px`;}Da(){this.E||(this.pt=null);}async rd(t,e){let o=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Ze(t,o,e)),{promise:n,cancel:l,image:c}=Ee(s),u=this.Ue(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}Ue(t){let e="crop",o=this.$["*loadingOperations"],s=o.get(e);return s||(s=new Map,o.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.zo();}),this.sub("*cropBox",()=>{this.pt&&this.Ia();}),this.sub("*currentAspectRatio",()=>{this.Bo();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.E&&this.ne&&this.activate(this.ne,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.pt&&(this.pt=null);}render(){return y`<canvas class="uc-canvas" ${L(this.La)}></canvas><uc-crop-frame ${L(this.No)}></uc-crop-frame>`}};h([g()],Fr.prototype,"pt",2);function bs(r,i,t){let e=t,o=t-1,s=new Array(e);for(let n=o;n>=0;n-=1)s[n]=Math.ceil((n*i+(o-n)*r)/o);return s}a(bs,"linspace");function pd(r){return typeof r=="string"&&r in St}a(pd,"isOperationKey");function hd(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],o=r[t+1];typeof e=="number"&&typeof o=="number"&&i.push([e,o]);}return i}a(hd,"splitBySections");function md(r,i,t){let e=hd(r).find(([n,l])=>n<=i&&i<=l);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let l=Math.abs(o-s)||1,c=Math.abs(i-o)/l;return o===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(md,"calculateOpacities");function fd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}a(fd,"calculateZIndices");function ja(r,i){let t=St[r].keypointsNumber,{range:e,zero:o}=St[r];return [...new Set([...bs(e[0],o,t+1),...bs(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}a(ja,"keypointsRange");var ws=class extends S{constructor(){super();this.E=false;this.Ho=true;this.n="initial";this.Fa={};this.Bt=[];this.Na=0;this.Ba=O();this.ir=O();this.classList.add("uc-inactive_to_cropper"),this._a=D(async(t,e,o)=>{let s=a(()=>!this.za(t,e)||this.Te!==o||!!this.Bt.find(u=>u.value===o),"shouldSkip");if(s())return;let n=await this.Ha(t,o),l=new Image;l.src=n.src;let c=this.Ue(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Bt,p=u.findIndex(v=>v.value>o);p===-1&&(p=u.length);let m=u[p]?.image,f=this.ir.value;!f||m&&!f.contains(m)||(u.splice(p,0,n),m?f.insertBefore(l,m):f.appendChild(l),this.Go(t,o));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}Ue(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}ja(){window.cancelAnimationFrame(this.Na),this.Na=window.requestAnimationFrame(()=>{for(let t of this.Bt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ae({url:t=this.Va,filter:e=this.m??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.Fa};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let l=this.offsetWidth;return this.proxyUrl(Ze(t,l,n))}async Ha(t,e){return {src:await this.ae({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}za(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!pd(this.n)||!Number.isFinite(e)||(this.Go(this.n,e),this._a(this.n,this.m,e));}Go(t,e){this.n=t,this.Te=e;let{zero:o}=St[t],s=this.Bt.map(c=>c.value),n=md(s,e,o),l=fd(s,o);this.Bt.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.ja();}Ka(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async sd(){this.a=this.a||this.Ka();let t=this.a;t&&this.Ga(t);let e=this.Bt.map(u=>u.src),{images:o,promise:s,cancel:n}=wi(e);o.forEach(u=>{let p=this.Ue(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.jo=()=>{n(),this.jo=void 0;};let l=this.n,c=this.m;if(await s,this.E&&this.za(l,c)){let u=this.ir.value;if(!u)return;u.replaceChildren(),this.Bt.forEach((p,d)=>{let m=o[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.ja();}}async setTransformations(t){if(this.Fa=t,this.a){let e=await this.ae(),o=this.Ue(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Ko?.();let n=ja(o,s),l=await Promise.all(n.map(u=>this.ae({url:t,filter:e,operation:o,value:u}))),{cancel:c}=wi(l);this.Ko=c;}nd(t){let e=this.a||this.Ka();if(this.Ga(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=ft({"uc-active_from_viewer":this.ui,"uc-active_from_cropper":!this.ui,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.Ue(t);e.addEventListener("error",o,{once:true}),e.src=t,e.addEventListener("load",()=>{o(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=ft({"uc-active_from_viewer":this.ui,"uc-active_from_cropper":!this.ui,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:n}){if(this.E=true,this.Ho=false,await this.updateComplete,this.Va=t,this.n=e??"initial",this.Te=o,this.m=s,this.ui=n,typeof o!="number"&&!s){let c=await this.ae({operation:e,value:o});this.nd(c),this.qo();return}!e||typeof o!="number"||(this.Bt=await Promise.all(ja(e,o).map(c=>this.Ha(e,c))),this.Go(e,o),this.sd());}deactivate({hide:t=true}={}){this.E=false,this.jo?.(),this.Ko?.(),t&&!this.Ho?(this.Ho=true,this.a&&(this.a.style.transform="scale(1)"),this.className=ft({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.qo();},{once:true})):this.qo();}Ga(t){let e=this.Ba.value;e&&(e.contains(t)||e.appendChild(t));}qo(){this.ir.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Ba)}></div><div class="uc-fader-layers-host" ${L(this.ir)}></div>`}};var Wt=class extends S{constructor(){super();this.Wo=0;this.Nt=O();this.Wa=O();this.Za=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.zt=0;this.ld=t=>{t.stopPropagation();let e=this.Xa(t);e!==null&&(this.Zo(e),this.ad("slider-input",e));};this.cd=t=>{t.stopPropagation();let e=this.Xa(t);e!==null&&this.Zo(e);};this.Ya=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Qa=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}ad(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Wo=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Ja(this.zt),this.Xo(),this.s=new ResizeObserver(()=>{this.Xo(),this.rr(this.zt);}),this.s.observe(this);let e=this.Nt.value;e?.addEventListener("focus",this.Ya),e?.addEventListener("blur",this.Qa),window.setTimeout(()=>{this.rr(this.zt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.zt&&this.Zo(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Xo(),this.rr(this.zt)),t.has("zero")&&this.hasUpdated&&this.tl(this.zt);}rr(t){this.tl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(o-this.Wo)/100;window.requestAnimationFrame(()=>{let c=this.Wa.value;c&&(c.style.transform=`translateX(${l}px)`);});}tl(t){if(!this.di)return;let e=this.max-this.min;if(e===0)return;this.di.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(o-this.Wo)/100;window.requestAnimationFrame(()=>{this.di&&(this.di.style.transform=`translateX(${l}px)`);});}Xo(){let e=this.Za.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.qa===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.di=p,e.innerHTML="",e.appendChild(l),this.qa=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Nt.value;t?.removeEventListener("focus",this.Ya),t?.removeEventListener("blur",this.Qa),this.s?.disconnect(),this.s=void 0;}Zo(t){Number.isFinite(t)&&(this.zt=t,this.hasUpdated&&(this.Ja(t),this.rr(t)));}Ja(t){let e=this.Nt.value;e&&(e.value=String(t));}Xa(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return y`<div class="uc-steps" ${L(this.Za)}></div><div class="uc-thumb" ${L(this.Wa)}></div><input class="uc-input" type="range" ${L(this.Nt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.zt)} ?disabled=${this.disabled} @input=${this.ld} @change=${this.cd} />`}};h([b({type:Boolean,reflect:true})],Wt.prototype,"disabled",2),h([b({type:Number})],Wt.prototype,"min",2),h([b({type:Number})],Wt.prototype,"max",2),h([b({type:Number,attribute:false})],Wt.prototype,"defaultValue",2),h([b({type:Number})],Wt.prototype,"zero",2),h([g()],Wt.prototype,"zt",2);var Ft="original",Vr=class extends S{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.wo=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.ud();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===Ft?void 0:this.state.value,filter:this.state.filter===Ft?void 0:this.state.filter,fromViewer:false});}ud(){let t=this.state.operation,{range:e,zero:o}=St[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:o;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Ft?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.wo} ></uc-slider-ui>`}};h([g()],Vr.prototype,"state",2);function Xe(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(Xe,"parseFilterValue");var st=class extends S{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}il(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.il();}updated(t){super.updated(t),t.has("active")&&this.il();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],st.prototype,"active",2),h([g()],st.prototype,"title",2),h([g()],st.prototype,"icon",2),h([g()],st.prototype,"titleProp",2);var _r=12,Nr=16,gd=a(r=>{let i=12,t=12;return r.width/r.height>=1?(i=_r,t=Math.round(_r*r.height/r.width)):(t=_r,i=Math.round(_r*r.width/r.height)),{width:i,height:t}},"getAdjustResolutions"),Ts=class extends st{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.dd(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}dd(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Br=class extends st{constructor(){super(...arguments);this.X=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.rl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.rl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}rl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");o(),s(),e||this.requestUpdate();}pd(){let t=this.X;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=gd(t),s=(Nr-e)/2,n=(Nr-o)/2;return y`<uc-icon><svg viewBox="0 0 ${Nr} ${Nr}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${o} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} >${this.pd()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],Br.prototype,"aspectRatio",1);function vd(r){let i=r+90;return i=i>=360?0:i,i}a(vd,"nextAngle");function yd(r,i){if(r==="rotate")return vd(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}a(yd,"nextValue");var zr=class extends st{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=yd(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};h([b({type:String})],zr.prototype,"operation",2);var le=class extends st{constructor(){super(...arguments);this.n="";this.m="";this.pi="";this.or=0;this.a=null;this.Re=false;this.isOriginal=false;this.ol=20;}static{a(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let o=this.m;this.m=e,this.n="filter",this.isOriginal=e===Ft,this.icon=this.isOriginal?"original":"slider",this.ol=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.sl(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:Xe(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}hd(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.ol||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==Ft?{name:this.m,amount:l}:void 0,G(this.pi,et(Gi,Qt(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}async Ze(t,e){t[0]?.isIntersecting?await this.Yo(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.Ze.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.pi=t??"",this.sub("*originalUrl",e=>{this.pi=e??"",!this.isOriginal&&this.pi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.le());}),this.isOriginal||(this.s?.observe(this),this.le()),this.m&&this.sl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Yo():this.le());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.sr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.le()));}sl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Yo(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.pi){!this.Pe&&!this.Ht&&this.le();return}let e=++this.or,o="";try{o=await this.proxyUrl(this.hd());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Re=false,this.b?.();let{promise:s,cancel:n}=Ee(o);this.b=()=>{n(),this.or===e&&(this.b=void 0);};try{if(await s,this.or!==e||!this.isConnected)return;this.a=o,this.Re=!0,this.sr(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.le();}finally{this.or===e&&(this.b=void 0);}}le(){if(!this.isConnected||this.a||this.Re||this.isOriginal||this.$["*networkProblems"]){this.sr();return}this.Ht&&cancelAnimationFrame(this.Ht),this.Ht=requestAnimationFrame(()=>{if(this.Ht=void 0,!this.isConnected||this.a||this.Re||this.isOriginal){this.sr();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<o){this.Yo();return}this.Pe=window.setTimeout(()=>{this.Pe=void 0,this.le();},500);});}sr(){this.Ht&&(cancelAnimationFrame(this.Ht),this.Ht=void 0),this.Pe&&(window.clearTimeout(this.Pe),this.Pe=void 0);}get md(){return !!(this.Re&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.md?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${ae(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Re} style=${xe(e)}></div><uc-icon class=${ae({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${xe(o)} ></uc-icon></button>`}};h([g()],le.prototype,"a",2),h([g()],le.prototype,"Re",2),h([g()],le.prototype,"isOriginal",2),h([g()],le.prototype,"ol",2),h([b({type:String})],le.prototype,"filter",1);var Hr=class extends st{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.nl(e);}nl(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),o=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),o();}initCallback(){super.initCallback(),this.n&&this.nl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=St[this.n],o=t[this.n],s=typeof o<"u"?o!==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:Xe(this.$["*operationTooltip"])});}};h([b({type:String})],Hr.prototype,"operation",1);var bd=1,Ka=a(()=>{},"noopScrollListener"),jr=class extends S{constructor(){super(...arguments);this.hiddenScrollbar=false;this.al=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>bd){this.scrollLeft+=o;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.al,{passive:false}),this.addEventListener("scroll",Ka,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.al),this.removeEventListener("scroll",Ka),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],jr.prototype,"hiddenScrollbar",2);var gt=class extends S{constructor(){super(...arguments);this.hi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.ll=true;this.tabList=[...it];this.activeTab=N.CROP;this.nr=true;this.Qo=false;this.cl=null;this.ul=0;this.dl=0;this.ar=O();this.pl=O();this.tabToggleRefs={[N.CROP]:O(),[N.TUNING]:O(),[N.FILTERS]:O()};this.hl=()=>{this.ce();};this.mi=[];this.lr=D(t=>{this.hi=t;},500);this.cr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===N.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${n}`;}else o=this.l10n(Ft);else if(this.showSubToolbar&&this.$["*tabId"]===N.TUNING&&e){s=true;let n=t?.[e]||St[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.Qo=s;},0);this.fd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.gd={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.vd={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.yd={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Ft,"*currentOperation":null,"*operationTooltip":null};this.It=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.rs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Od=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Xe(this.$["*operationTooltip"])}),this.ar.value?.apply(),this.ml();};this.Id=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.ar.value?.cancel(),this.ml();};this.Ld=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.Jo(o,{fromViewer:false}));};}static{a(this,"EditorToolbar");}ml(){this.$["*showSlider"]=false,this.$["*tabId"]===N.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===N.TUNING&&(this.Qo=false);}Jo(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.fl(t,{fromViewer:e,force:o});}fl(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.ce();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===N.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of it){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.ce();}}ce(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.pl.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.ul!==s||this.dl!==n)&&(this.ul=s,this.dl=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get ts(){return this.mi.length>=3}bd(t){switch(t){case N.CROP:return this.wd();case N.FILTERS:return this.Td();case N.TUNING:return this.Ed();default:return []}}wd(){let t=[];if(this.ts)t.push(()=>this.xd());else for(let e of this.mi)t.push(()=>this.gl(e));for(let e of un)t.push(()=>this.Cd(e));return this.es(t)}Td(){let e=[Ft,...cn].map(o=>()=>this.Sd(o));return this.es(e)}Ed(){let t=ln.map(e=>()=>this.Ad(e));return this.es(t)}es(t){return t.length?t.map(o=>o()):[]}xd(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}gl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Cd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Sd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Ad(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}kd(){return this.ts?this.mi.map(t=>this.gl(t)):[]}async Md(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ze(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:o}=wi([e]);this.b=()=>{o(),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.Jo(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.cr();}),this.sub("*currentOperation",()=>{this.cr();}),this.sub("*tabId",e=>{this.fl(e,{fromViewer:false,force:true}),this.cr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Md(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,n]of s.entries())if(n){o=true;break}}this.lr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.nr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.nr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.ll=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.Jo(o,{fromViewer:false});return}this.ce();}),this.sub("*operationTooltip",e=>{this.cl=e;}),this.cr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.hl);}firstUpdated(t){super.firstUpdated(t),this.ur(),this.ce();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ce()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.ur();}disconnectedCallback(){window.removeEventListener("resize",this.hl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}ur(){let t=this.ar.value;t&&(this.$["*sliderEl"]=t);}Ud(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?xe({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.vd}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${o?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${o} style=${n} @click=${this.Ld} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Pd(t){let e=this.bd(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:R}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Qo?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.ts;return y`<uc-line-loader-ui .active=${this.hi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.cl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.fd} ><div class="uc-tab-content-row">${it.map(o=>Ei(this.activeTab===o,()=>this.Pd(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.ll} .styles=${this.yd} @initial-render=${()=>this.ce()} ><div class="uc-tab-toggles_indicator" ${L(this.pl)} ></div>${it.map(o=>this.Ud(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.It} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.rs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.gd}><div class="uc-slider" ?hidden=${!this.nr}><uc-editor-slider ${L(this.ar)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.nr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.kd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Id} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Od} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],gt.prototype,"hi",2),h([g()],gt.prototype,"showMainToolbar",2),h([g()],gt.prototype,"showSubToolbar",2),h([g()],gt.prototype,"ll",2),h([g()],gt.prototype,"tabList",2),h([g()],gt.prototype,"activeTab",2),h([g()],gt.prototype,"nr",2),h([g()],gt.prototype,"Qo",2),h([g()],gt.prototype,"cl",2),h([g()],gt.prototype,"mi",2);var Ga=Bt([...it]),nt=class extends S{constructor(){super(...arguments);this.ctxOwner=true;this.Rd="";this.ae=At;this.$d="";this.hi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Ga;this.vl=false;this.Rt=false;this.os=null;this.lr=D(t=>{this.hi=t;},300);this.dr=O();this.yl=O();this.bl=O();this.wl=O();this.Tl=()=>{this.lr(false),this.ae!==At&&(this.$["*networkProblems"]=false);};this.El=()=>{this.lr(false),this.$["*networkProblems"]=true;};this.Dd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Ba(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Fd(){this.Rt||this.os||(this.os=this.updateComplete.then(()=>{this.os=null,this.Rt=true;}));}initCallback(){super.initCallback(),this.xl(),this.Cl();}ur(){let t=this.bl.value;t&&(this.$["*faderEl"]=t);let e=this.yl.value;e&&(this.$["*cropperEl"]=e);let o=this.wl.value;o&&(this.$["*imgContainerEl"]=o);let s=this.dr.value;s&&(this.$["*imgEl"]=s);}Vd(){let t=this.dr.value;t&&(t.addEventListener("load",this.Tl),t.addEventListener("error",this.El));}Nd(){let t=this.dr.value;t&&(t.removeEventListener("load",this.Tl),t.removeEventListener("error",this.El));}get _d(){let t=this.$["*tabId"];return ft("uc-image",{"uc-image_hidden_to_cropper":t===N.CROP,"uc-image_hidden_effects":t!==N.CROP})}Sl(){return new Promise((e,o)=>{let s=window.setTimeout(()=>{o(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(l=>{let[c]=l;c&&c.contentRect.width>0&&c.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.ur(),this.Vd(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.Nd(),super.disconnectedCallback();}render(){let t=this.$d??"",e=this.Rd??"",o=this.ae||At,s=this.hi,n=this.vl;return y` ${ur(za)}<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.Dd}></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" ${L(this.wl)}><img src=${o} class=${this._d} ${L(this.dr)} />${Ei(this.Rt,()=>y`<uc-editor-image-cropper ${L(this.yl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.bl)}></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">${Ei(this.Rt,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.xl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Cl();}xl(){let t=this.tabs||Ga;this.$["*tabList"]=Na(t);}Cl(){let t=Tr(this.cropPreset??""),e=null;if(this.cdnUrl){let o=vo(this.cdnUrl),s=yo(o);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=aa(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Sl(),this.cdnUrl){let t=this.cdnUrl,e=Ki(t),o=Yt(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=vo(t),n=yo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Yt(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"]===N.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(G(t,et("json"))),o=await fetch(e).then(l=>l.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===N.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.Fd();}}async initEditor(){try{await this.Sl();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.vl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=et(Qt(t),"preview"),s=G(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],nt.prototype,"Rd",2),h([g()],nt.prototype,"ae",2),h([g()],nt.prototype,"$d",2),h([g()],nt.prototype,"hi",2),h([b({type:String,reflect:true})],nt.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],nt.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],nt.prototype,"cropPreset",2),h([b({type:String,reflect:true})],nt.prototype,"tabs",2),h([g()],nt.prototype,"vl",2),h([g()],nt.prototype,"Rt",2);var Es=class extends nt{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Kr=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CLOUD_IMG_EDIT;this.Y=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>this.Bd(),"onActivate"),onDeactivate:a(()=>this.zd(),"onDeactivate")}),this.subConfigValue("cropPreset",t=>{this.Y&&this.Y.cropPreset!==t&&(this.Y={...this.Y,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Y&&this.Y.tabs!==t&&(this.Y={...this.Y,tabs:t});});}rs(t){if(!this.fi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.fi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}It(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Bd(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.fi=e;let o=this.fi.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Y=this.Hd(o);}zd(){this.fi=void 0,this.Y=null;}render(){if(!this.Y)return R;let{cdnUrl:t,cropPreset:e,tabs:o}=this.Y;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${K(e)} tabs=${K(o)} @apply=${this.rs} @cancel=${this.It} @change=${this.handleChange} ></uc-cloud-image-editor>`}Hd(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],Kr.prototype,"Y",2);var wd=[{test:a(r=>!!r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],qa=D(r=>{for(let{test:i,message:t}of wd)i(r)&&yr(t);},0);var Wa=a((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),Td="0123456789abcdefghijklmnopqrstuvwxyz",Za=a(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Td[Number(t)]+i,r=r/36n;}return i},"a"),xs=a((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var Ed=a(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),xd=10,Cd=a(async r=>{let i=await Ed(r);return Za(i).slice(0,xd)},"d"),Xa=a(async(r,i)=>{let t=await Cd(r);return Wa(t,i)},"f");var Ya=a(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var Cs=a(r=>r,"defineComputedProperty"),Sd=[Cs({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=lt(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Bt(t)},"fn")}),Cs({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=lt(r);return t=t.sort((e,o)=>e===i?-1:o===i?1:0),Bt(t)},"fn")}),Cs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===si||xs(i,t))?Xa(r,t):i,"fn")})],Qa=a(({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of Sd)if(o.deps.includes(r)){let s={[o.key]:t(o.key)};for(let c of o.deps)s[c]=t(c);let n=new AbortController;e.get(o.key)?.abort(),e.set(o.key,n);let l;try{l=o.fn(s,{signal:n.signal});}catch(c){e.get(o.key)===n&&e.delete(o.key),console.error(`Failed to compute value for "${o.key}"`,c);return}Ya(l)?l.then(c=>{n.signal.aborted||i(o.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,c);}).finally(()=>{e.get(o.key)===n&&e.delete(o.key);}):i(o.key,l);}},"computeProperty");var V=a(r=>String(r),"asString"),J=a(r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},"asNumber"),_=a(r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},"asBoolean"),Ja=a(r=>r==="auto"?r:_(r),"asStore"),tl=a(r=>{let i=V(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),el=a(r=>{let i=V(r);if(!Object.values(k).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),il=a(r=>{let i=V(r),t=lt(i);if(t.some(e=>!Object.values(k).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),rl=a(r=>{let i=V(r);if(i==="local"||i==="global")return i;if(_(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),ol=a(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Ss=a(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),Gr=a(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),As=a(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),sl=a(r=>{let i=V(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var Ad={pubkey:V,multiple:_,multipleMin:J,multipleMax:J,confirmUpload:_,imgOnly:_,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Ja,cameraMirror:_,cameraCapture:tl,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:J,thumbSize:J,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:J,retryNetworkErrorMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:V,debug:_,localeName:V,metadata:ol,secureUploadsExpireThreshold:J,localeDefinitionOverride:a(r=>Ss(r),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(r=>Gr(r),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(r=>Gr(r),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(r=>Gr(r),"iconHrefResolver"),fileValidators:As,collectionValidators:As,validationTimeout:J,validationConcurrency:J,cameraModes:il,defaultCameraMode:el,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Ss,maxVideoRecordingDuration:J,filesViewMode:sl,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:V,testMode:_,qualityInsights:_,pasteScope:rl},nl=a((r,i)=>{if(!(typeof i>"u"||i===null))try{return Ad[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),Q[r]}},"normalizeConfigValue");var qr=[...new Set(["debug",...Object.keys(Q)])],kd=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],cl=a(r=>kd.includes(r),"isComplexKey"),Ci=qr.filter(r=>!cl(r)),al={...Object.fromEntries(Ci.map(r=>[ni(r),r])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),r]))},Md={...Object.fromEntries(Ci.map(r=>[ni(r),U(r)])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),U(r)]))},ll=a(r=>`__${r}`,"getLocalPropName"),Wr=class extends S{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(Q).map(([t,e])=>[U(t),e]))};this.jd=new Map;}static{a(this,"Config");}Kd(t,e){if(!cl(t)){let o=[...new Set([ni(t),t.toLowerCase()])];for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Gd(t,e){this.$[U(t)]!==e&&(typeof e>"u"||e===null?this.$[U(t)]=Q[t]:this.$[U(t)]=e);}pr(t,e){let o=this,s=nl(t,e),n=ll(t);o[n]!==s&&(this.qd(t,o[n],s),o[n]=s,this.Kd(t,s),this.Gd(t,s),this.debugPrint(`"${t}"`,s),qa(this.cfg));}Al(t){let e=this,o=ll(t);return e[o]??this.$[U(t)]}qd(t,e,o){this.cfg.debug&&o!==e&&typeof o=="object"&&typeof e=="object"&&JSON.stringify(o)===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:`,o));}initCallback(){super.initCallback();let t=this;for(let e of Ci)this.sub(U(e),o=>{this.pr(e,o);},false);for(let e of qr){let o=t[e]??this.$[U(e)];o!==Q[e]&&this.pr(e,o);let s=Object.getOwnPropertyDescriptor(this,e);(!s||!s.set||!s.get)&&Object.defineProperty(this,e,{set:a(n=>{this.pr(e,n);},"set"),get:a(()=>this.Al(e),"get")});}for(let e of qr)this.sub(U(e),()=>{Qa({key:e,setValue:this.pr.bind(this),getValue:this.Al.bind(this),computationControllers:this.jd});});}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=al[t];n&&(s[n]=o),Md[t]&&(this[t]=o);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(al)]}};for(let r of qr)Wr.prototype[r]=void 0;var ul=a(()=>{let r=globalThis.top??globalThis.parent??globalThis.self;try{return r.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var Od=a(r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),dl=a((r,i="i")=>{let t=r.split("*").map(Od);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Id=["--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"],Ld=a((r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),"getCssValue"),pl=a(r=>{let i={};for(let t of Id){let e=Ld(r,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Ud=["selected-files-change","toolbar-state-change"],Pd=a(r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Ud.includes(i))},"isWhitelistedMessage"),Zr=class{constructor(i,t){this.hr=new Map;this.Ml=i=>{if(i.source!==this.ss)return;let t=i.data;if(!Pd(t))return;let e=this.hr.get(t.type);if(e)for(let o of e)o(t);};this.ss=i,this.kl=t,window.addEventListener("message",this.Ml);}static{a(this,"MessageBridge");}on(i,t){let e=this.hr.get(i)??new Set;this.hr.has(i)||this.hr.set(i,e),e.add(t);}send(i){let t=this.kl();this.ss.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Ml);}};function hl(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(hl,"queryString");var Rd={[$t.GDRIVE]:"ngdrive"},Et=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.EXTERNAL;this.$e=O();this.mr=null;this.ns=[];this.as=false;this.ls=false;this.cs=false;this.us=false;this.fr=false;this.ds=false;this.ps="uc-hidden";this.Ol=true;this.yo=()=>{for(let t of this.ns){let e=this.Zd(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.modalManager?.open(E.activities.UPLOAD_LIST);};this.It=()=>{this.historyBack();};this.ep=()=>{this.mt?.send({type:"select-all"});};this.ip=()=>{this.mt?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get Wd(){if(!this.mr)return "";let{selectedCount:t,total:e}=this.mr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Il();},"onActivate")}),this.sub("*currentActivityParams",()=>{setTimeout(()=>{!this.isActivityActive||!this.isConnected||(this.hs(),this.Il());});}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.hs();}),this.subConfigValue("multiple",t=>{this.fr=t;}),this.subConfigValue("localeName",()=>{this.Ll();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.Ul(t);});}Zd(t){if(t.alternatives){let e=q(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=dl(o);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}Xd(t){this.Ol=t.isVisible;}async Yd(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Qd(t.selectedCount,t.total),this.ps=t.isReady?"":"uc-hidden",this.as=t.isReady,this.ls=t.isReady&&t.selectedFiles.length>0,this.fr=t.isMultipleMode&&t.total>0,this.cs=t.selectedCount<t.total,this.us=t.selectedCount===t.total,this.ns=t.selectedFiles??[],this.ds=t.total>0;}Pl(){this.Ul(this.cfg.externalSourcesEmbedCss),this.Jd(),this.Ll();}Jd(){this.mt?.send({type:"set-theme-definition",theme:pl(this)});}Ul(t){this.mt?.send({type:"set-embed-css",css:t});}Ll(){this.mt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}tp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=Rd[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ul(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,o);return p.search=hl(u),p.toString()}Qd(t,e){this.mr={selectedCount:t,total:e};}Il(){let t=document.createElement("iframe");t.src=this.tp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Pl.bind(this)),t.addEventListener("load",this.Pl.bind(this)),this.$e.value&&(this.$e.value.innerHTML="",this.$e.value.appendChild(t)),t.contentWindow&&(this.mt?.destroy(),this.mt=new Zr(t.contentWindow,()=>this.cfg.socialBaseUrl),this.mt.on("selected-files-change",this.Yd.bind(this)),this.mt.on("toolbar-state-change",this.Xd.bind(this)),this.Rl());}hs(){this.mt?.destroy(),this.mt=void 0,this.$e.value&&(this.$e.value.innerHTML=""),this.Rl();}Rl(){this.ns=[],this.as=false,this.ls=false,this.cs=false,this.us=false,this.fr=false,this.ds=false,this.ps="uc-hidden",this.mr=null;}disconnectedCallback(){super.disconnectedCallback(),this.hs();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.$e)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Ol}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.fr}><span>${this.Wd}</span><button type="button" @click=${this.ep} ?hidden=${!this.cs}>${this.l10n("select-all")}</button><button type="button" @click=${this.ip} ?hidden=${!this.us}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.yo} ?disabled=${!this.ls} ?hidden=${!this.ds} ><uc-spinner ?hidden=${this.as}></uc-spinner><span class=${this.ps}>${this.l10n("done")}</span></button></div></div>`}};h([g()],Et.prototype,"ns",2),h([g()],Et.prototype,"as",2),h([g()],Et.prototype,"ls",2),h([g()],Et.prototype,"cs",2),h([g()],Et.prototype,"us",2),h([g()],Et.prototype,"fr",2),h([g()],Et.prototype,"ds",2),h([g()],Et.prototype,"ps",2),h([g()],Et.prototype,"Ol",2);var Si=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.$l="upload-file";this.rp=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.$l=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.rp}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.$l)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Si.prototype,"dropzone",2),h([g()],Si.prototype,"$l",2);var Xr=class extends qt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([b({type:Boolean})],Xr.prototype,"headless",2);var Yr=class extends qt{constructor(){super();this.Dl=false;this.It=()=>{if(this.Fl){let t=this.$["*historyBack"];t?.();return}this.Vl&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Fl(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==E.activities.START_FROM}get Vl(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}ms(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.ms();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Dl=this.Fl||this.Vl;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.It} ?hidden=${!this.Dl} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};h([g()],Yr.prototype,"Dl",2);var ks="active",Qr="",Ae=class extends qt{constructor(){super();this.fs=false;this.gr=false;this.vr=Qr;this.gs=Qr;this.qe=t=>{t.id===E.activities.CLOUD_IMG_EDIT&&(this.vr=ks),this.$["*currentActivity"]===E.activities.UPLOAD_LIST&&(this.vr=ks,this.gr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.gs=ks);};this.We=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.gr=false),t.id===E.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}ms(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.ms();this.sub("*currentActivity",e=>{e===E.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.gs=Qr):(this.vr=Qr,this.gr=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",o=>{e==="grid"?(o?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.fs=!o):(this.style.removeProperty("--uc-grid-col"),this.fs=false);});}),this.modalManager?.subscribe(W.OPEN,this.qe),this.modalManager?.subscribe(W.CLOSE,this.We);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(W.OPEN,this.qe),this.modalManager?.unsubscribe(W.CLOSE,this.We);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.gr} class=${this.gs}><uc-drop-area ?single=${this.fs} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.vr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([g()],Ae.prototype,"fs",2),h([g()],Ae.prototype,"gr",2),h([g()],Ae.prototype,"vr",2),h([g()],Ae.prototype,"gs",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
|
+
exports.ActivityBlock=E;exports.ActivityHeader=ds;exports.BaseComponent=po;exports.Block=S;exports.BtnUi=Mt;exports.CameraSource=B;exports.CloudImageEditor=Es;exports.CloudImageEditorActivity=Kr;exports.CloudImageEditorBlock=nt;exports.Config=Wr;exports.Copyright=ls;exports.CropFrame=Dr;exports.Data=z;exports.DropArea=mt;exports.EditorAspectRatioButtonControl=Br;exports.EditorCropButtonControl=zr;exports.EditorFilterControl=le;exports.EditorFreeformButtonControl=Ts;exports.EditorImageCropper=Fr;exports.EditorImageFader=ws;exports.EditorOperationControl=Hr;exports.EditorScroller=jr;exports.EditorSlider=Vr;exports.EditorToolbar=gt;exports.ExternalSource=Et;exports.ExternalUploadSource=$t;exports.FileItem=fs;exports.FileUploaderInline=Yr;exports.FileUploaderMinimal=Ae;exports.FileUploaderRegular=Xr;exports.FormInput=Or;exports.Icon=fi;exports.Img=os;exports.LineLoaderUi=$r;exports.Modal=vi;exports.ModalEvents=W;exports.PACKAGE_NAME=Lt;exports.PACKAGE_VERSION=Ut;exports.PresenceToggle=xi;exports.ProgressBar=He;exports.ProgressBarCommon=yi;exports.Select=je;exports.SimpleBtn=Si;exports.SliderUi=Wt;exports.SolutionBlock=qt;exports.SourceBtn=Ke;exports.SourceList=bi;exports.Spinner=cs;exports.StartFrom=ps;exports.Thumb=qe;exports.UID=ut;exports.UploadCtxProvider=hs;exports.UploadList=kt;exports.UploadSource=H;exports.UploaderBlock=$;exports.UrlSource=Pr;exports.defineComponents=ho;exports.defineLocale=Js;exports.loadFileUploaderFrom=Dl;exports.toKebabCase=ni;return exports;})({});
|