@uploadcare/file-uploader 1.34.0 → 1.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +3 -3
  4. package/dist/index.js +3 -3
  5. package/dist/index.layered.css +3 -3
  6. package/dist/index.ssr.js +1 -1
  7. package/dist/locales/file-uploader/ar.js +2 -2
  8. package/dist/locales/file-uploader/az.js +2 -2
  9. package/dist/locales/file-uploader/ca.js +2 -2
  10. package/dist/locales/file-uploader/cs.js +2 -2
  11. package/dist/locales/file-uploader/da.js +2 -2
  12. package/dist/locales/file-uploader/de.js +2 -2
  13. package/dist/locales/file-uploader/el.js +2 -2
  14. package/dist/locales/file-uploader/en.js +2 -2
  15. package/dist/locales/file-uploader/es.js +2 -2
  16. package/dist/locales/file-uploader/et.js +2 -2
  17. package/dist/locales/file-uploader/fi.js +2 -2
  18. package/dist/locales/file-uploader/fr.js +2 -2
  19. package/dist/locales/file-uploader/he.js +2 -2
  20. package/dist/locales/file-uploader/hy.js +2 -2
  21. package/dist/locales/file-uploader/is.js +2 -2
  22. package/dist/locales/file-uploader/it.js +2 -2
  23. package/dist/locales/file-uploader/ja.js +2 -2
  24. package/dist/locales/file-uploader/ka.js +2 -2
  25. package/dist/locales/file-uploader/kk.js +2 -2
  26. package/dist/locales/file-uploader/ko.js +2 -2
  27. package/dist/locales/file-uploader/lv.js +2 -2
  28. package/dist/locales/file-uploader/nb.js +2 -2
  29. package/dist/locales/file-uploader/nl.js +2 -2
  30. package/dist/locales/file-uploader/pl.js +2 -2
  31. package/dist/locales/file-uploader/pt.js +2 -2
  32. package/dist/locales/file-uploader/ro.js +2 -2
  33. package/dist/locales/file-uploader/ru.js +2 -2
  34. package/dist/locales/file-uploader/sk.js +2 -2
  35. package/dist/locales/file-uploader/sr.js +2 -2
  36. package/dist/locales/file-uploader/sv.js +2 -2
  37. package/dist/locales/file-uploader/tr.js +2 -2
  38. package/dist/locales/file-uploader/uk.js +2 -2
  39. package/dist/locales/file-uploader/vi.js +2 -2
  40. package/dist/locales/file-uploader/zh-TW.js +2 -2
  41. package/dist/locales/file-uploader/zh.js +2 -2
  42. package/package.json +1 -1
  43. package/web/file-uploader.iife.min.js +3 -3
  44. package/web/file-uploader.min.js +3 -3
  45. package/web/uc-basic.layered.min.css +3 -3
  46. package/web/uc-basic.min.css +3 -3
  47. package/web/uc-cloud-image-editor.layered.min.css +2 -2
  48. package/web/uc-cloud-image-editor.min.css +2 -2
  49. package/web/uc-cloud-image-editor.min.js +3 -3
  50. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  51. package/web/uc-file-uploader-inline.min.css +3 -3
  52. package/web/uc-file-uploader-inline.min.js +3 -3
  53. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  54. package/web/uc-file-uploader-minimal.min.css +3 -3
  55. package/web/uc-file-uploader-minimal.min.js +3 -3
  56. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  57. package/web/uc-file-uploader-regular.min.css +3 -3
  58. package/web/uc-file-uploader-regular.min.js +3 -3
  59. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.34.0 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.34.1 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-09-23T00:02:39.550Z
5
+ * Built: 2026-09-30T11:54:56.807Z
6
6
  */
7
- var pn=Object.defineProperty;var yc=Object.getOwnPropertyDescriptor;var hn=(r,i)=>{for(var t in i)pn(r,t,{get:i[t],enumerable:true});};var p=(r,i,t,e)=>{for(var o=e>1?void 0:e?yc(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&&pn(i,t,o),o};var Mt=[],oe=0,Ji=4,fn=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=oe+Ji;s<Mt.length;)Mt[s]===e?Mt.splice(s,Ji):s+=Ji;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,o);if(s){for(oe=0;oe<Mt.length;oe+=Ji)Mt[oe](Mt[oe+1],Mt[oe+2],Mt[oe+3]);Mt.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};function tr(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}function Uo(r,i,t){let e=tr(r,i,t);return t(r.value),e}var $o=(r={})=>{let i=fn(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};var G=class r{static{this.ei=new Map;}constructor(i,t){this.gt=i,this.xt=t;}get id(){return this.gt}pub(i,t){i in this.xt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.xt.setKey(i,t);}sub(i,t,e=true){return (e?Uo:tr)(this.xt,[i],s=>{t(s[i]);})}read(i){return i in this.xt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.xt.get()[i]}add(i,t,e=false){(!(i in this.xt.get())||e)&&this.xt.setKey(i,t);}has(i){return i in this.xt.get()}get store(){return this.xt.get()}static registerCtx(i,t){if(r.ei.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=$o(i);return r.ei.set(t,e),new r(t,e)}static deleteCtx(i){r.ei.delete(i);}static getCtx(i){let t=r.ei.get(i);return t?new r(i,t):null}static hasCtx(i){return r.ei.has(i)}};var er=globalThis,rr=er.ShadowRoot&&(er.ShadyCSS===void 0||er.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gn=Symbol(),mn=new WeakMap,ir=class{constructor(i,t,e){if(this.jc=true,e!==gn)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(rr&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=mn.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&mn.set(t,i));}return i}toString(){return this.cssText}},vn=r=>new ir(typeof r=="string"?r:r+"",void 0,gn);var yn=(r,i)=>{if(rr)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=er.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},Do=rr?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return vn(t)})(r):r;var{is:wc,defineProperty:Ec,getOwnPropertyDescriptor:Tc,getOwnPropertyNames:Cc,getOwnPropertySymbols:xc,getPrototypeOf:Sc}=Object,or=globalThis,bn=or.trustedTypes,Ac=bn?bn.emptyScript:"",kc=or.reactiveElementPolyfillSupport,fi=(r,i)=>r,mi={toAttribute(r,i){switch(i){case Boolean:r=r?Ac: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}},sr=(r,i)=>!wc(r,i),wn={attribute:true,type:String,converter:mi,reflect:false,useDefault:false,hasChanged:sr};Symbol.metadata??=Symbol("metadata"),or.litPropertyMetadata??=new WeakMap;var Ht=class extends HTMLElement{static addInitializer(i){this.to(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Bi&&[...this.Bi.keys()]}static createProperty(i,t=wn){if(t.state&&(t.attribute=false),this.to(),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&&Ec(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=Tc(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let a=o?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??wn}static to(){if(this.hasOwnProperty(fi("elementProperties")))return;let i=Sc(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(fi("finalized")))return;if(this.finalized=true,this.to(),this.hasOwnProperty(fi("properties"))){let t=this.properties,e=[...Cc(t),...xc(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.Bi=new Map;for(let[t,e]of this.elementProperties){let o=this.eo(t,e);o!==void 0&&this.Bi.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(Do(o));}else i!==void 0&&t.push(Do(i));return t}static eo(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.zi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.xe=null,this.Gc();}Gc(){this.io=new Promise(i=>this.enableUpdating=i),this.ee=new Map,this.qc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.ii??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.ii?.delete(i);}qc(){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.zi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.ii?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.ii?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.ro(i,e);}Wc(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.eo(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:mi).toAttribute(t,e.type);this.xe=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.xe=null;}}ro(i,t){let e=this.constructor,o=e.Bi.get(i);if(o!==void 0&&this.xe!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:mi;this.xe=o;let a=n.fromAttribute(t,s.type);this[o]=a??this.oo?.get(o)??a,this.xe=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??sr)(s,t)||e.useDefault&&e.reflect&&s===this.oo?.get(i)&&!this.hasAttribute(n.eo(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.io=this.Zc());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.oo??=new Map).has(i)&&(this.oo.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.ee.has(i)||(this.hasUpdated||e||(t=void 0),this.ee.set(i,t)),o===true&&this.xe!==i&&(this.vn??=new Set).add(i));}async Zc(){this.isUpdatePending=true;try{await this.io;}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.zi){for(let[o,s]of this.zi)this[o]=s;this.zi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,a=this[o];n!==true||this.ee.has(o)||a===void 0||this.C(o,void 0,s,a);}}let i=false,t=this.ee;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.ii?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.so();}catch(e){throw i=false,this.so(),e}i&&this.Yc(t);}willUpdate(i){}Yc(i){this.ii?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}so(){this.ee=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.io}shouldUpdate(i){return true}update(i){this.vn&&=this.vn.forEach(t=>this.Wc(t,this[t])),this.so();}updated(i){}firstUpdated(i){}};Ht.elementStyles=[],Ht.shadowRootOptions={mode:"open"},Ht[fi("elementProperties")]=new Map,Ht[fi("finalized")]=new Map,kc?.({ReactiveElement:Ht}),(or.reactiveElementVersions??=[]).push("2.1.2");var Vo=globalThis,En=r=>r,nr=Vo.trustedTypes,Tn=nr?nr.createPolicy("lit-html",{createHTML:r=>r}):void 0,No="$lit$",Kt=`lit$${Math.random().toFixed(9).slice(2)}$`,_o="?"+Kt,Mc=`<${_o}>`,Se=document,vi=()=>Se.createComment(""),yi=r=>r===null||typeof r!="object"&&typeof r!="function",Bo=Array.isArray,Mn=r=>Bo(r)||typeof r?.[Symbol.iterator]=="function",Fo=`[ \f\r]`,gi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Cn=/-->/g,xn=/>/g,Ce=RegExp(`>|${Fo}(?:([^\\s"'>=/]+)(${Fo}*=${Fo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Sn=/'/g,An=/"/g,On=/^(?:script|style|textarea|title)$/i,zo=r=>(i,...t)=>({zt:r,strings:i,values:t}),v=zo(1),st=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),kn=new WeakMap,xe=Se.createTreeWalker(Se,129);function In(r,i){if(!Bo(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tn!==void 0?Tn.createHTML(i):i}var Ln=(r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=gi;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===gi?d[1]==="!--"?n=Cn:d[1]!==void 0?n=xn:d[2]!==void 0?(On.test(d[2])&&(o=RegExp("</"+d[2],"g")),n=Ce):d[3]!==void 0&&(n=Ce):n===Ce?d[0]===">"?(n=o??gi,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?Ce:d[3]==='"'?An:Sn):n===An||n===Sn?n=Ce:n===Cn||n===xn?n=gi:(n=Ce,o=void 0);let f=n===Ce&&r[a+1].startsWith("/>")?" ":"";s+=n===gi?l+Mc:u>=0?(e.push(c),l.slice(0,u)+No+l.slice(u)+Kt+f):l+Kt+(u===-2?a:f);}return [In(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},bi=class r{constructor({strings:i,zt:t},e){let o;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ln(i,t);if(this.el=r.createElement(c,e),xe.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(o=xe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(No)){let h=d[n++],f=o.getAttribute(u).split(Kt),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?lr:g[1]==="?"?cr:g[1]==="@"?ur:ke}),o.removeAttribute(u);}else u.startsWith(Kt)&&(l.push({type:6,index:s}),o.removeAttribute(u));if(On.test(o.tagName)){let u=o.textContent.split(Kt),h=u.length-1;if(h>0){o.textContent=nr?nr.emptyScript:"";for(let f=0;f<h;f++)o.append(u[f],vi()),xe.nextNode(),l.push({type:2,index:++s});o.append(u[h],vi());}}}else if(o.nodeType===8)if(o.data===_o)l.push({type:2,index:s});else {let u=-1;for(;(u=o.data.indexOf(Kt,u+1))!==-1;)l.push({type:7,index:s}),u+=Kt.length-1;}s++;}}static createElement(i,t){let e=Se.createElement("template");return e.innerHTML=i,e}};function Ae(r,i,t=r,e){if(i===st)return i;let o=e!==void 0?t.Xc?.[e]:t.Qc,s=yi(i)?void 0:i.ao;return o?.constructor!==s&&(o?.yn?.(false),s===void 0?o=void 0:(o=new s(r),o.lo(r,t,e)),e!==void 0?(t.Xc??=[])[e]=o:t.Qc=o),o!==void 0&&(i=Ae(r,o.Jc(r,i.values),o,e)),i}var ar=class{constructor(i,t){this.bn=[],this.Ct=void 0,this.wn=i,this.g=t;}get parentNode(){return this.g.parentNode}get tt(){return this.g.tt}u(i){let{el:{content:t},parts:e}=this.wn,o=(i?.creationScope??Se).importNode(t,true);xe.currentNode=o;let s=xe.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Ve(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new dr(s,this,i)),this.bn.push(c),l=e[++a];}n!==l?.index&&(s=xe.nextNode(),n++);}return xe.currentNode=Se,o}p(i){let t=0;for(let e of this.bn)e!==void 0&&(e.strings!==void 0?(e.St(i,e,t),t+=e.strings.length-2):e.St(i[t])),t++;}},Ve=class r{get tt(){return this.g?.tt??this.En}constructor(i,t,e,o){this.type=2,this.s=U,this.Ct=void 0,this.Rt=i,this.Ce=t,this.g=e,this.options=o,this.En=o?.isConnected??true;}get parentNode(){let i=this.Rt.parentNode,t=this.g;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Rt}get endNode(){return this.Ce}St(i,t=this){i=Ae(this,i,t),yi(i)?i===U||i==null||i===""?(this.s!==U&&this.Se(),this.s=U):i!==this.s&&i!==st&&this.Tn(i):i.zt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Mn(i)?this.k(i):this.Tn(i);}O(i){return this.Rt.parentNode.insertBefore(i,this.Ce)}T(i){this.s!==i&&(this.Se(),this.s=this.O(i));}Tn(i){this.s!==U&&yi(this.s)?this.Rt.nextSibling.data=i:this.T(Se.createTextNode(i)),this.s=i;}$(i){let{values:t,zt:e}=i,o=typeof e=="number"?this.tu(i):(e.el===void 0&&(e.el=bi.createElement(In(e.h,e.h[0]),this.options)),e);if(this.s?.wn===o)this.s.p(t);else {let s=new ar(o,this),n=s.u(this.options);s.p(t),this.T(n),this.s=s;}}tu(i){let t=kn.get(i.strings);return t===void 0&&kn.set(i.strings,t=new bi(i)),t}k(i){Bo(this.s)||(this.s=[],this.Se());let t=this.s,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(vi()),this.O(vi()),this,this.options)):e=t[o],e.St(s),o++;o<t.length&&(this.Se(e&&e.Ce.nextSibling,o),t.length=o);}Se(i=this.Rt.nextSibling,t){for(this.Hi?.(false,true,t);i!==this.Ce;){let e=En(i).nextSibling;En(i).remove(),i=e;}}setConnected(i){this.g===void 0&&(this.En=i,this.Hi?.(i));}},ke=class{get tagName(){return this.element.tagName}get tt(){return this.g.tt}constructor(i,t,e,o,s){this.type=1,this.s=U,this.Ct=void 0,this.element=i,this.name=t,this.g=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.s=Array(e.length-1).fill(new String),this.strings=e):this.s=U;}St(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=Ae(this,i,t,0),n=!yi(i)||i!==this.s&&i!==st,n&&(this.s=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=Ae(this,a[e+l],t,l),c===st&&(c=this.s[l]),n||=!yi(c)||c!==this.s[l],c===U?i=U:i!==U&&(i+=(c??"")+s[l+1]),this.s[l]=c;}n&&!o&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},lr=class extends ke{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},cr=class extends ke{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},ur=class extends ke{constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}St(i,t=this){if((i=Ae(this,i,t,0)??U)===st)return;let e=this.s,o=i===U&&e!==U||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==U&&(e===U||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.s=i;}handleEvent(i){typeof this.s=="function"?this.s.call(this.options?.host??this.element,i):this.s.handleEvent(i);}},dr=class{constructor(i,t,e){this.element=i,this.type=6,this.Ct=void 0,this.g=t,this.options=e;}get tt(){return this.g.tt}St(i){Ae(this,i);}},Pn={I:Ve},Oc=Vo.litHtmlPolyfillSupport;Oc?.(bi,Ve),(Vo.litHtmlVersions??=[]).push("3.3.2");var pr=(r,i,t)=>{let e=t?.renderBefore??i,o=e.eu;if(o===void 0){let s=t?.renderBefore??null;e.eu=o=new Ve(i.insertBefore(vi(),s),s,void 0,t??{});}return o.St(r),o};var Ho=globalThis,xt=class extends Ht{constructor(){super(...arguments),this.renderOptions={host:this},this.co=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.co=pr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.co?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.co?.setConnected(false);}render(){return st}};xt._h=true,xt.finalized=true,Ho.litElementHydrateSupport?.({LitElement:xt});var Ic=Ho.litElementPolyfillSupport;Ic?.({LitElement:xt});(Ho.litElementVersions??=[]).push("4.2.2");var Lc=/\\([0-9a-fA-F]{1,6} ?)/g;function Pc(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Rc(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}function Uc(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}function Rn(r){let i=r;Pc(r)&&(i=Rc(i),i=i.replace(Lc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Uc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ne(r){class i extends r{constructor(){super(...arguments);this.xn=null;this.uo=null;}getCssData(o,s=false){let n=this.xn??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.uo||(this.uo=window.getComputedStyle(this));let a=this.uo.getPropertyValue(o).trim();try{n[o]=Rn(a);}catch(l){s||console.warn(`CSS Data error: ${o}`,l),n[o]=null;}}return this.xn=n,n[o]}}return i}function hr(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.ie={};this.re=null;this.Ki=false;}createRenderRoot(){return this}connectedCallback(){this.re||(this.re=Array.from(this.childNodes)),super.connectedCallback();}iu(){if(this.Ki)return;this.Ki=true,this.ie={};let o=Array.from(this.childNodes),s=o.length?o:this.re??[];for(let n of s){let a=this.Cn(n),l=this.ie[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.ie[a]=l;}this.re=null;}Cn(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Cn(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}ru(o){return !o.textContent||!o.textContent.trim()}ou(o){let s=this.ie[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.ru(n))}update(o){!this.hasUpdated&&this.willYield&&this.iu(),super.update(o);}yield(o,s){if(o===""&&!this.ie[o]&&!this.Ki&&this.re?.length){let a=[];for(let l of this.re)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.ie[o]=a,this.Ki=true,this.re=null;}let n=this.ie[o];return v` ${n} ${this.ou(o)?s:void 0} `}}return i}function _e(r){class i extends r{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}var se=class extends Event{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 Be=class{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 se(this.context,this.host,this.t,this.subscribe));}};var fr=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var Ko=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},ze=class extends fr{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:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new se(this.context,a,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 Ko(this.context,this.host));}};var Dc={attribute:true,type:String,converter:mi,reflect:false,hasChanged:sr},Fc=(r=Dc,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(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(r){return (i,t)=>typeof t=="object"?Fc(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)}function m(r){return y({...r,state:true,attribute:false})}function F(r,i){let t,e=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Un="ctx-name-context";function gr(){return function(r){class i extends r{constructor(...o){super(...o);this.vt=null;this.ri=false;this.po=false;this.ho=void 0;this.Ae=new Map;this.oi=new Set;this.init$={};this.ctxOwner=false;this.ji=void 0;this.Gi=false;this.ctxName=this.Ht;this.Kt=false;this.ji=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ht,this.su=new Be(this,{context:Un,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.kn=s,this.An();},subscribe:true});}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 Sn(){return this.ji}set Sn(o){let s=o??void 0;this.ji!==s&&(this.ji=s,this.An());}shouldUpdate(o){return this.Kt?super.shouldUpdate(o):false}get Ht(){return this.Sn||this.kn||void 0}An(){if(this.ctxName=this.Ht,!(!this.ctxName||this.ri)){if(this.isConnected){this.fo();return}this.Gi=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Ht,this.ctxName&&(this.ho?this.ho.setValue(this.ctxName):this.ho=new ze(this,{context:Un,initialValue:this.ctxName}));}Mn(){if(!(!this.vt||this.Ae.size===0)){for(let[o,{value:s,rewrite:n}]of this.Ae)this.vt.add(o,s,n);this.Ae.clear();}}On(){return !this.vt&&this.Ht&&this.mo(),this.vt&&this.Mn(),this.vt}qi(){let o=this.On();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}mo(){let o=this.init$,s=this.Ht;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.vt){this.vt=G.getCtx(s)??G.registerCtx(o,s);for(let[n,a]of Object.entries(this.init$))this.vt.add(n,a,this.ctxOwner);this.Mn();}}get $(){return this.Ht&&this.mo(),new Proxy({},{get:(o,s)=>{if(typeof s=="string")return this.vt?.read(s)},set:(o,s,n)=>(typeof s!="string"||this.vt?.pub(s,n),true)})}sub(o,s,n=true){let a=this.qi().sub(o,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.oi.delete(d));};return this.oi.add(d),d}pub(o,s){this.qi().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.qi()}has(o){return this.vt?.has(o)??false}add(o,s,n=false){let a=this.On();if(!a){if(!n&&this.Ae.has(o))return;this.Ae.set(o,{value:s,rewrite:n});return}this.Ae.delete(o),a.add(o,s,n);}add$(o,s=false){for(let[n,a]of Object.entries(o))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.ri?this.Kt&&this.po&&(this.po=false,this.initCallback()):this.ctxName?(this.Gi=false,this.fo()):this.Gi&&this.Ht&&(this.Gi=false,this.fo());}fo(){if(this.ri)return;this.ri=true,this.mo();let o=this.init$;if(Object.keys(o).length>0){let s=this.qi();for(let[n,a]of Object.entries(o))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Kt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.nu(),super.disconnectedCallback(),this.ri&&(this.po=true);}nu(){if(this.oi.size!==0){for(let o of [...this.oi])o();this.oi.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Sn",1),p([m()],i.prototype,"kn",2),p([m()],i.prototype,"ctxName",2),p([m()],i.prototype,"Kt",2),i}}var jo=class extends _e(gr()(Ne(hr(xt)))){};var nt=class r{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 Vc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function yt(r){for(let i in r){if(Vc.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);}}var Go="UC";function Nc(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Go]){t(window[Go]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[Go];i&&yt(s),t(s);},document.head.appendChild(o);})}var wi={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var qo=new Map,$n=new Map,Dn=(r,i)=>{qo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...wi,...i};return qo.set(r,t),t},_c=(r,i)=>{$n.set(r,i);},Fn=(r,i)=>{typeof i=="function"?_c(r,i):Dn(r,i);},Vn=async r=>{let i=qo.get(r);if(!i){let t=$n.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Dn(r,e);}return i};Fn("en",wi);var x=r=>`*cfg/${r}`;var Z=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],jt=r=>r.join(",");var Nn=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},vr=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>Nn(i)).join("/-/"),at=(...r)=>{let i=vr(...r);return i?`-/${i}/`:""};function yr(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}function br(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}function Wo(r){let i=_n(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Zo(r){return Wo(r).split("/-/").filter(Boolean).map(t=>Nn(t))}function _n(r){let i=new URL(r),t=yr(r),e=Bn(t)?zn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Bn(r){return r.startsWith("http")}function zn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var Q=(r,i,t)=>{let e=new URL(_n(r)),o=t??yr(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&Bn(o)){let n=zn(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()},ne=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var J=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Ei=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Kn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Bc(r,i){if(typeof i=="number"){let t=i;return Ei[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Ei[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Ei.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function ae(r){return vr(...Kn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Bc(i,t)}).filter(i=>!!i))}var wr=vr("format/auto","progressive/yes"),Gt=([r])=>typeof r<"u"?Number(r):void 0,Hn=()=>true,zc=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Hc=([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:J(r,"x").map(Number),coords:J(i).map(Number)}},Kc=Object.freeze({enhance:Gt,brightness:Gt,exposure:Gt,gamma:Gt,contrast:Gt,saturation:Gt,vibrance:Gt,warmth:Gt,filter:zc,mirror:Hn,flip:Hn,rotate:Gt,crop:r=>{let[i,t]=r,{dimensions:e,coords:o}=Hc([i,t]);return {dimensions:e,coords:o}}});function Yo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!Kn.includes(e))continue;let s=e,n=Kc[s];try{let a=n(o);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var j=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),lt=Object.freeze([j.CROP,j.TUNING,j.FILTERS]),jn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Gn=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"]),qn=Object.freeze(["rotate","mirror","flip"]),qt=Ei,Ot=Object.freeze({brightness:{zero:qt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:qt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:qt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:qt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:qt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:qt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:qt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:qt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:qt.filter,range:[0,100],keypointsNumber:1}});var Ti="https://ucarecdn.com",jc="https://upload.uploadcare.com",Gc="https://social.uploadcare.com",qc="https://ucarecd.net",Wc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:Ti,cdnCnamePrefixed:qc,baseUrl:jc,socialBaseUrl:Gc,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,tags:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,authToken:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:jt(lt),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"plain",dynamicButtonShowFirstIcon:true},et=Object.freeze(Wc);var Er=(r,i)=>(...t)=>{let e=r();if(!e.read(x("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);};var K=class{constructor(i){this.go=new Set;this.oe=null;this.E=Er(()=>this.e.ctx,this.constructor.name);this.e=i,this.r=i.ctx;}addSub(i){this.go.add(i);}get Ut(){if(!this.oe){let i={};this.oe=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let o=x(e);return this.e.ctx.has(o)?this.e.ctx.read(o):et[e]}});}return this.oe}destroy(){for(let i of this.go)try{i();}catch{}this.go.clear();}},Zc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",authTokenManager:"*authTokenManager",api:"*publicApi",validationManager:"*validationManager"},bt=(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`)},Wn=r=>({get ctx(){return r()},get modalManager(){return bt(r(),"*modalManager",false)},get pluginManager(){return bt(r(),"*pluginManager")},get telemetryManager(){return bt(r(),"*telemetryManager")},get localeManager(){return bt(r(),"*localeManager")},get a11y(){return bt(r(),"*a11y")},get routerLayer(){return bt(r(),"*routerLayer")},get blocksRegistry(){return bt(r(),"*blocksRegistry")},get eventEmitter(){return bt(r(),"*eventEmitter")},get uploadCollection(){return bt(r(),"*uploadCollection")},get secureUploadsManager(){return bt(r(),"*secureUploadsManager",false)},get authTokenManager(){return bt(r(),"*authTokenManager",false)},get api(){return bt(r(),"*publicApi")},get validationManager(){return bt(r(),"*validationManager")},when(i,t){let e=Zc[i],o=r(),s=o.has(e)?o.read(e):void 0;if(s)return t(s),()=>{};let n;return n=o.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,o=>{t(o),e?.();});})}});var tt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Tr=class extends K{constructor(){super(...arguments);this.se=new Map;this.At=new Set;this.f=new Map;}registerModal(t,e){this.se.set(t,e),this.Q(tt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.se.get(t);return e?(this.se.delete(t),this.At.delete(t),this.Q(tt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.se.get(t);return e?(this.At.add(t),this.Q(tt.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.se.get(t);return !e||!this.At.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.At.delete(t),this.Q(tt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.se.has(t)?this.At.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.At.size>0}back(){if(this.At.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.At).pop();return t?this.close(t):false}closeAll(){let t=this.At.size;return this.At.clear(),this.Q(tt.CLOSE_ALL,{}),t}subscribe(t,e){return this.f.has(t)||this.f.set(t,new Set),this.f.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.f.has(t)&&this.f.get(t)?.delete(e);}Q(t,e){if(this.f.has(t))for(let o of this.f.get(t)??new Set)try{o(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.E("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.se.clear(),this.f.clear(),this.Q(tt.DESTROY,{});}};var Cr=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("-");var Wt=class r extends Error{constructor(i){super(`Failed to resolve the auth token: ${i instanceof Error?i.message:String(i)}`),this.name="AuthTokenResolverError",this.cause=i,Object.setPrototypeOf(this,r.prototype);}},Xo=r=>r instanceof Wt?r:new Wt(r),Yc=r=>{let i=r.split(".")[1];if(i)try{let t=JSON.parse((o=>{let s=o.replaceAll("-","+").replaceAll("_","/"),n=s+"=".repeat((4-s.length%4)%4),a=atob(n),l=Uint8Array.from(a,c=>c.charCodeAt(0));return new TextDecoder().decode(l)})(i)),e=typeof t=="object"&&t!==null?t.exp:void 0;return typeof e=="number"?e:void 0}catch{return}},xr=class{fetchToken;t;i;o;h;u=0;constructor({fetchToken:i,skew:t=30,initialToken:e}){this.fetchToken=i,this.t=t,e&&this.l(e);}getToken=()=>{if(this.i!==void 0&&!this.v())return Promise.resolve(this.i);let i=this.u,t=()=>i===this.u;return this.h??=Promise.resolve().then(()=>this.fetchToken()).then(e=>(t()&&this.l(e),e),e=>{throw Xo(e)}).finally(()=>{t()&&(this.h=void 0);}),this.h};invalidate(){this.u++,this.i=void 0,this.o=void 0,this.h=void 0;}l(i){this.i=i,this.o=Yc(i);}v(){return this.o!==void 0&&Date.now()/1e3>=this.o-this.t}},Zn=r=>r?{Authorization:`Bearer ${r}`}:{};var Yn=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},Xn=r=>r.toString(36).slice(0,10),He=(r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}};var Qn=r=>{let i=new DataView(r),t=0n;for(let e=0;e<r.byteLength;e+=8)t=t<<64n|i.getBigUint64(e);return t};var Xc=async r=>Qn(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(r))),Qc=async r=>Xn(await Xc(r)),Sr=async(r,i)=>{let t=await Qc(r);return Yn(t,i)};function Jn(r){return Object.prototype.toString.call(r)==="[object Object]"}var Jc=/\W|_/g;function tu(r){return r.split(Jc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function ta(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Yt(t,{ignoreKeys:i})):r}function Yt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return ta(r,{ignoreKeys:i});if(!Jn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}Jn(o)?o=Yt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=ta(o,{ignoreKeys:i})),t[tu(e)]=o;}return t}var ra=(r,i)=>new Promise(t=>{if(i?.aborted){t();return}let e=()=>{clearTimeout(o),i?.removeEventListener("abort",e),t();},o=setTimeout(e,r);i?.addEventListener("abort",e,{once:true});});function ss({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("/"),a=[s,o].filter(Boolean).join("; ");return `${n} (${a})`}var eu={factor:2,time:100};function iu(r,i=eu){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a=>ra(a??s).then(()=>(t+=1,e(o)))})}return e(r)}var Me=class extends Error{},Ke=class r extends Me{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},ns=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},Ut=class r extends Me{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},ru=500,oa=async({check:r,interval:i=ru,timeout:t,signal:e})=>{let o=Date.now(),s=()=>t===void 0?1/0:t-(Date.now()-o);for(;;){if(e?.aborted)throw new Ut("Poll cancelled");if(s()<=0)throw new Ut("Timed out");let n;try{n=await r(e);}catch(a){throw e?.aborted?new Ut("Poll cancelled"):a}if(e?.aborted)throw new Ut("Poll cancelled");if(n)return n;await ra(Math.min(i,s()),e);}},ea=new Set,ou=r=>{ea.has(r)||(ea.add(r),console.warn(r));},L={baseCDN:"https://ucarecdn.com",prefixedBaseCDN:"https://ucarecd.net",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},kr="application/octet-stream",sa="original",ce=({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,f]=u;typeof f<"u"&&!Array.isArray(f)&&l.setRequestHeader(h,f);}),l.responseType="text",ns(o,()=>{d=true,l.abort(),a(new Ut);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(b){let E=b.split(": "),S=E.shift(),N=E.join(": ");S&&typeof S<"u"&&(f[S]=N);});let g=l.response,w=l.status;n({request:u,data:g,headers:f,status:w});}},l.onerror=u=>{d||a(new Ke(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function su(r,...i){return r}var nu=({name:r})=>r?[r]:[],au=su,lu=()=>new FormData,na=r=>false,Mr=r=>typeof Blob<"u"&&r instanceof Blob,Or=r=>typeof File<"u"&&r instanceof File,Ir=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",je=r=>Mr(r)||Or(r)||na()||Ir(r),cu=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",uu=r=>!!r&&typeof r=="object"&&!Array.isArray(r),du=r=>!!r&&typeof r=="object"&&"data"in r&&je(r.data);function aa(r,i,t){if(Array.isArray(t))for(let e of t)aa(r,`${i}[]`,e);else if(du(t)){let{name:e,contentType:o}=t,s=au(t.data,e,o??kr),n=nu({name:e});r.push([i,s,...n]);}else if(uu(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else cu(t)&&t&&r.push([i,t.toString()]);}function pu(r){let i=[];for(let[t,e]of Object.entries(r))aa(i,t,e);return i}function Lr(r){let i=lu(),t=pu(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}var $t=class r extends Me{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);}},hu=["AccessTokenExpiredError","OperationsLimitExceededError","ScopeForbiddenError","AccessTokenInvalidError"],fu=r=>!!r&&hu.includes(r),ts=class r extends $t{constructor(i,t,e,o,s){super(i,t,e,o,s),this.name="AuthError",Object.setPrototypeOf(this,r.prototype);}},Xt=(r,i,t,e,o)=>fu(i)?new ts(r,i,t,e,o):new $t(r,i,t,e,o),mu=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()},Zt=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=mu(t)),e.toString()},la=r=>typeof r=="function",gu=async r=>{if(!la(r))return r;try{return await r()}catch(i){throw Xo(i)}},vu="RequestThrottledError",yu="AccessTokenExpiredError",ia=15e3,bu=1e3,wu=1;function Eu(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return ia;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:ia}function ue(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e,authToken:o}=i,s=la(o),n=0;return iu(({attempt:a,retry:l})=>r().catch(c=>{if(c instanceof $t&&c.code===vu&&a<t)return l(Eu(c));if(c instanceof $t&&c.code===yu&&s&&n<wu)return n+=1,l(0);if(c instanceof Ke&&a<e)return l((a+1)*bu);throw c}))}var ca=r=>{let i="";return (Mr(r)||Or(r)||Ir(r))&&(i=r.type),i||kr},ua=r=>{let i="";return Or(r)&&r.name?i=r.name:Mr(r)||na()?i="":Ir(r)&&r.name&&(i=r.name),i||sa},Tu="6.22.0",Cu="UploadcareUploadClient",xu=Tu;function Su(r){return ss({libraryName:Cu,libraryVersion:xu,...r})}var Oe=async({publicKey:r,integration:i,userAgent:t,authToken:e})=>({...r?{"X-UC-User-Agent":Su({publicKey:r,integration:i,userAgent:t})}:{},...Zn(await gu(e))}),Pr=({authToken:r,secureSignature:i,secureExpire:t})=>r?((i||t)&&ou("[@uploadcare/upload-client] Both `authToken` and `secureSignature`/`secureExpire` are provided. These are mutually exclusive auth schemes; `authToken` takes precedence and the signature parameters are ignored."),{}):{signature:i,expire:t};function as(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function ls(r){return Array.isArray(r)?r.join(","):typeof r=="string"?r:void 0}function Au(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=L.baseURL,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,onProgress:d,source:u="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",url:Zt(o,"/base/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:a}),data:Lr({file:{data:r,name:t||ua(r),contentType:e||ca(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:as(l),...Pr({authToken:a,secureSignature:s,secureExpire:n}),source:u,metadata:b,tags:ls(E)}),signal:c,onProgress:d}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C}),{retryNetworkErrorMaxTimes:w,retryThrottledRequestMaxTimes:g,authToken:a})}var es;(function(r){r.Token="token",r.FileInfo="file_info";})(es||(es={}));function ku(r,{publicKey:i,baseURL:t=L.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,authToken:c,source:d="url",signal:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:c}),url:Zt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:as(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,...Pr({authToken:c,secureSignature:a,secureExpire:l}),source:d,metadata:b,tags:ls(E)}),signal:u}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C}),{retryNetworkErrorMaxTimes:w,retryThrottledRequestMaxTimes:g,authToken:c})}var ht;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ht||(ht={}));var Mu=r=>"status"in r&&r.status===ht.Error;function Ou(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=L.retryNetworkErrorMaxTimes}={}){return ue(async()=>ce({method:"GET",headers:await Oe({publicKey:i,integration:s,userAgent:n,authToken:e}),url:Zt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:o}).then(({data:c,headers:d,request:u})=>{let h=Yt(JSON.parse(c));if("error"in h&&!Mu(h))throw Xt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a,authToken:e})}function Iu(r,{publicKey:i,baseURL:t=L.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,authToken:n,signal:a,source:l,integration:c,userAgent:d,retryThrottledRequestMaxTimes:u=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"POST",headers:await Oe({publicKey:i,integration:c,userAgent:d,authToken:n}),url:Zt(t,"/group/",{jsonerrors:1}),data:Lr({files:r,callback:e,pub_key:i,...Pr({authToken:n,secureSignature:o,secureExpire:s}),source:l}),signal:a}).then(({data:f,headers:g,request:w})=>{let b=Yt(JSON.parse(f));if("error"in b)throw Xt(b.error.content,b.error.errorCode,w,b,g);return b}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:u,authToken:n})}function Lu(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,signal:o,source:s,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"GET",headers:await Oe({publicKey:i,integration:n,userAgent:a,authToken:e}),url:Zt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:o}).then(({data:d,headers:u,request:h})=>{let f=Yt(JSON.parse(d));if("error"in f)throw Xt(f.error.content,f.error.errorCode,h,f,u);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c,authToken:e})}function Pu(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=L.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,authToken:l,store:c,signal:d,source:u="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",url:Zt(s,"/multipart/start/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:l}),data:Lr({filename:e,size:r,content_type:t||kr,part_size:o,UPLOADCARE_STORE:as(c),UPLOADCARE_PUB_KEY:i,...Pr({authToken:l,secureSignature:n,secureExpire:a}),source:u,metadata:b,tags:ls(E)}),signal:d}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C.parts=Object.keys(C.parts).map(ot=>C.parts[Number(ot)]),C}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,authToken:l})}function Ru(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=L.retryNetworkErrorMaxTimes}){return ue(()=>ce({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||kr}}).then(a=>(o&&o({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Uu(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,source:o="local",signal:s,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"POST",url:Zt(t,"/multipart/complete/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:n,userAgent:a,authToken:e}),data:Lr({uuid:r,UPLOADCARE_PUB_KEY:i,source:o}),signal:s}).then(({data:d,headers:u,request:h})=>{let f=Yt(JSON.parse(d));if("error"in f)throw Xt(f.error.content,f.error.errorCode,h,f,u);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c,authToken:e})}function Rr(r,{publicKey:i,baseURL:t,authToken:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:d}){return oa({check:u=>Lu(r,{publicKey:i,baseURL:t,authToken:e,signal:u,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?(d&&d({isComputable:!0,value:1}),h):!1),signal:c})}var $u=(r,i)=>Sr(r,i),da=({publicKey:r,baseCDN:i,prefixedBaseCDN:t=L.prefixedBaseCDN})=>r?i===void 0||He(i,t)?$u(r,t):Promise.resolve(i):Promise.resolve(i??L.baseCDN);function Du(r){return "defaultEffects"in r}var Ar=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;tags;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=L.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=Zt(t,`${o}/`),a=s?Zt(`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.tags=i.tags||null,this.s3Bucket=s||null,this.s3Url=a,Du(i)&&(this.defaultEffects=i.defaultEffects);}},Ur=async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e,fileName:o})=>{let s=await da({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Ar(r,{baseCDN:s,fileName:o})},Fu=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,contentType:l,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,baseCDN:b,prefixedBaseCDN:E,metadata:S,tags:N})=>Au(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,metadata:S,tags:N}).then(({file:q})=>Rr(q,{publicKey:i,baseURL:e,authToken:n,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,onProgress:d,signal:c})).then(q=>Ur(q,{publicKey:i,baseCDN:b,prefixedBaseCDN:E})),Vu=(r,{publicKey:i,fileName:t,baseURL:e,authToken:o,signal:s,onProgress:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d,retryNetworkErrorMaxTimes:u,baseCDN:h,prefixedBaseCDN:f})=>Rr(r,{publicKey:i,baseURL:e,authToken:o,signal:s,onProgress:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d,retryNetworkErrorMaxTimes:u}).then(g=>Ur(g,{publicKey:i,baseCDN:h,prefixedBaseCDN:f,fileName:t})),Nu=(r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=n=>()=>{e=n,o.forEach((a,l)=>l!==n&&a.abort());};return ns(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:o[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},_u=window.WebSocket,is=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Bu=(r,i)=>r==="success"?{status:ht.Success,...i}:r==="progress"?{status:ht.Progress,...i}:{status:ht.Error,...i},rs=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new is;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 _u(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,Bu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,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)}},Qo=null,cs=r=>{if(!Qo){let i=typeof window>"u"?0:3e4;Qo=new rs(r,i);}return Qo},zu=r=>{cs(r).connect();};function Hu({token:r,publicKey:i,baseURL:t,authToken:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return oa({check:d=>Ou(r,{publicKey:i,baseURL:t,authToken:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:d}).then(u=>{switch(u.status){case ht.Error:return Xt(u.error,u.errorCode);case ht.Waiting:return !1;case ht.Unknown:return new $t(`Token "${r}" was not found.`);case ht.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case ht.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:c})}var Ku=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=cs(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(r);};ns(t,()=>{l(),s(new Ut("pusher cancelled"));}),n.subscribe(r,c=>{switch(c.status){case ht.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case ht.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),o(c);break}case ht.Error:l(),s(Xt(c.msg,c.error_code));}});}),ju=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,prefixedBaseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,authToken:d,store:u,signal:h,onProgress:f,source:g,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,pusherKey:S=L.pusherKey,metadata:N,tags:q})=>Promise.resolve(zu(S)).then(()=>ku(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,authToken:d,store:u,signal:h,source:g,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,metadata:N,tags:q})).catch(C=>(cs(S)?.disconnect(),Promise.reject(C))).then(C=>C.type===es.FileInfo?C:Nu([({signal:ot})=>Hu({token:C.token,publicKey:i,baseURL:e,authToken:d,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,onProgress:f,signal:ot}),({signal:ot})=>Ku({token:C.token,pusherKey:S,signal:ot,onProgress:f})],{signal:h})).then(C=>{if(C instanceof $t)throw C;return C}).then(C=>C.isReady?C:Rr(C.uuid,{publicKey:i,baseURL:e,authToken:d,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,onProgress:f,signal:h})).then(C=>Ur(C,{publicKey:i,baseCDN:o,prefixedBaseCDN:s})),Jo=new WeakMap,Gu=async r=>{if(Jo.has(r))return Jo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Jo.set(r,i),i},pa=async r=>{if(Or(r)||Mr(r))return r.size;if(Ir(r))return (await Gu(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},qu=(r,i=L.multipartMinFileSize)=>r>=i,ha=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 !je(r)&&t.test(r)},us=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !je(r)&&t.test(r)},Wu=(r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(o[c]=u,n-=1,n?l():t(o));}).catch(u=>{s=true,e(u);});};for(let c=0;c<r;c++)l();}),Zu=(r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},Yu=async(r,i,t)=>e=>Zu(r,e,i,t),Xu=(r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Ru(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),Qu=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,contentType:b,multipartChunkSize:E=L.multipartChunkSize,maxConcurrentRequests:S=L.maxConcurrentRequests,baseCDN:N,prefixedBaseCDN:q,metadata:C,tags:ot})=>{let we=e??await pa(r),Rt,Ee=(B,Ct)=>{if(!d)return;Rt||(Rt=Array(B).fill(0));let Te=kt=>kt.reduce((Fe,Ro)=>Fe+Ro,0);return kt=>{kt.isComputable&&(Rt[Ct]=kt.value,d({isComputable:true,value:Te(Rt)/B}));}};return b||=ca(r),Pu(we,{publicKey:i,contentType:b,fileName:t||ua(r),baseURL:o,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,metadata:C,tags:ot,multipartChunkSize:E}).then(async({uuid:B,parts:Ct})=>{let Te=await Yu(r,we,E);return Promise.all([B,Wu(S,Ct.map((kt,Fe)=>()=>Xu(Te(Fe),kt,{publicKey:i,contentType:b,onProgress:Ee(Ct.length,Fe),signal:c,integration:h,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w})))])}).then(([B])=>Uu(B,{publicKey:i,baseURL:o,authToken:a,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w})).then(B=>B.isReady?B:Rr(B.uuid,{publicKey:i,baseURL:o,authToken:a,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,onProgress:d,signal:c})).then(B=>Ur(B,{publicKey:i,baseCDN:N,prefixedBaseCDN:q}))};async function ds(r,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartMinFileSize:b,multipartChunkSize:E,maxConcurrentRequests:S,baseCDN:N,prefixedBaseCDN:q=L.prefixedBaseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:ot,pusherKey:we,metadata:Rt,tags:Ee}){if(je(r)){let B=await pa(r);return qu(B,b)?Qu(r,{publicKey:i,contentType:w,multipartChunkSize:E,fileSize:B,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,maxConcurrentRequests:S,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q,metadata:Rt,tags:Ee}):Fu(r,{publicKey:i,fileName:t,contentType:w,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q,metadata:Rt,tags:Ee})}if(us(r))return ju(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:N,prefixedBaseCDN:q,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:ot,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,pusherKey:we,metadata:Rt,tags:Ee});if(ha(r))return Vu(r,{publicKey:i,fileName:t,baseURL:e,authToken:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q});throw new TypeError(`File uploading from "${r}" is not supported`)}var Ju=(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}},os=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=L.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=Ju(i.cdnUrl,t),this.files=e.map(o=>new Ar(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},td=async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e})=>{let o=await da({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new os(r,{baseCDN:o})},ed=r=>{for(let i of r)if(!je(i))return false;return true},id=r=>{for(let i of r)if(!ha(i))return false;return true},rd=r=>{for(let i of r)if(!us(i))return false;return true};function fa(r,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartChunkSize:b=L.multipartChunkSize,baseCDN:E,prefixedBaseCDN:S=L.prefixedBaseCDN,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:q,jsonpCallback:C}){if(!ed(r)&&!rd(r)&&!id(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let ot,we=true,Rt=r.length,Ee=(B,Ct)=>{if(!c)return;ot||(ot=Array(B).fill(0));let Te=kt=>kt.reduce((Fe,Ro)=>Fe+Ro)/B;return kt=>{if(!kt.isComputable||!we){we=false,c({isComputable:false});return}ot[Ct]=kt.value,c({isComputable:true,value:Te(ot)});}};return Promise.all(r.map((B,Ct)=>je(B)||us(B)?ds(B,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:Ee(Rt,Ct),source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartChunkSize:b,baseCDN:E,prefixedBaseCDN:S,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:q}).then(Te=>Te.uuid):B)).then(B=>Iu(B,{publicKey:i,baseURL:e,jsonpCallback:C,secureSignature:o,secureExpire:s,authToken:n,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(Ct=>td(Ct,{publicKey:i,baseCDN:E,prefixedBaseCDN:S})).then(Ct=>(c&&c({isComputable:true,value:1}),Ct)))}var le=class{Wi=1;vo=[];Zi=0;yo=new Map;bo=new Map;constructor(i){this.Wi=i;}run(){let i=this.Wi-this.Zi;for(let t=0;t<i;t++){let e=this.vo.shift();if(!e)return;let o=this.yo.get(e),s=this.bo.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Zi+=1,e().finally(()=>{this.yo.delete(e),this.bo.delete(e),this.Zi-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.yo.set(i,e),this.bo.set(i,o),this.vo.push(i),t&&this.run();})}get pending(){return this.vo.length}get running(){return this.Zi}set concurrency(i){this.Wi=i,this.run();}get concurrency(){return this.Wi}};var ps=()=>({}),hs=r=>({...ps(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),fs=r=>({...hs(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new le(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*groupError":null,"*uploadTrigger":new Set}),ma=r=>({...fs(r),"*solution":null,"*lazyPlugins":null});var D=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var od=new Set([D.START_FROM,D.UPLOAD_LIST]),$r=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.au.bind(this),window.addEventListener("paste",this.listener);}lu(t){if(!(t instanceof Element))return false;if(t.closest("input, textarea, select"))return true;let e=t.closest("[contenteditable]");return !!(e&&e.getAttribute("contenteditable")?.toLowerCase()!=="false"||t.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}cu(t){return t.composedPath().some(e=>this.lu(e))}uu(t){return typeof t=="string"&&od.has(t)}du(){return [...this.scopes].some(t=>t.isConnected)}pu(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}hu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}fu(t){let e=t.trim();if(!e)return null;try{let o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"?null:o.toString()}catch{return null}}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async au(t){if(!t.clipboardData||this.cu(t)||!this.du())return;let e=this.e.ctx.read("*currentActivity"),o=e===null,s=this.uu(e);switch(this.Ut.pasteScope){case "global":if(!s&&!(o&&this.pu()))return;await this.handlePaste(t);return;case "local":{let n=t.target instanceof Node?t.target:null;if(!this.hu(n)||!s&&!o)return;await this.handlePaste(t);return}default:return}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),o=e.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),s=e.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.fu(c));});})),n=false;if(o.length>0&&(o.forEach(a=>{this.e.api.addFileFromObject(a,{source:"clipboard"});}),n=true),s.length>0){let a=(await Promise.all(s)).filter(l=>l!==null);a.forEach(l=>{this.e.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&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 Dr=class extends K{constructor(){super(...arguments);this.Yi=[];}registerAfterFileAddHook(t){return this.Yi.push(t),()=>{this.Yi=this.Yi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.Yi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST));}};var sd={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ci(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function ms(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=sd[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}function gs(r,i){return i.role==="toolbar"?ad(i):i.querySelectorAll(`[role=${r.role}]`)}function nd(r,i){return Array.from(r).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}function ad(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function ld(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"}function ga(r){return i=>{let t=false,e=300,o=0,s="";function n(u){let h=ms(u.target);if(!h){a();return}let f=gs(u.target,h),g=nd(f,h),w=Array.from(g).indexOf(u.target),b="ArrowDown",E="ArrowUp";if(ld(h)&&(i.document.dir==="rtl"?(b="ArrowLeft",E="ArrowRight"):(b="ArrowRight",E="ArrowLeft")),u.key===b)u.preventDefault(),Ci(u.target,g[w+1]||g[0]);else if(u.key===E)u.preventDefault(),Ci(u.target,g[w-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),Ci(u.target,g[0]);else if(u.key==="End")u.preventDefault(),Ci(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-o<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),o=u.timeStamp;let S=Array.from(f).find(N=>N.textContent?.trim()?.toLowerCase()?.startsWith(s));S&&(u.preventDefault(),Ci(u.target,S));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=ms(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=gs(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=ms(u.target);if(h){let f=gs(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function va(){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);}}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 r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}function ya(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let o=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function ba(r){let i,t=r.split(" "),e;function o(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",o),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",o),a.removeEventListener("keyup",s);})}function wa(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var vs=class{constructor(){this.yt=new Map;this.wo=[];}addEventListener(i,t){let e=o=>{let s=o.target;s instanceof Node&&this.wo.some(n=>n===s||n.contains(s))&&t(o);};this.yt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.yt.get(t);e&&window.removeEventListener(i,e),this.yt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.wo.push(i);}destroy(){this.wo=[];for(let i of this.yt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.yt.clear();}},Fr=class{constructor(){this.Xi=new vs,this.In=wa(this.Xi,[ga(),ba("is-pressed"),ya(),va()]);}registerBlock(i){this.Xi.registerScope(i);}destroy(){this.In?.(),this.Xi.destroy();}};var Qt=r=>`*l10n/${r}`,cd="en",Vr=class extends K{constructor(t){super(t);this.ke="";for(let[o,s]of Object.entries(wi)){let n=this.r.has(Qt(o))?!this.r.read(Qt(o)):true;this.r.add(Qt(o),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.ke&&this.Pn(this.ke);})),this.addSub(this.r.sub(x("localeName"),async o=>{if(!o)return;this.ke=o;let s=await Vn(o);o!==cd&&this.ke!==o||(this.Pn(o),this.Ln(o,s));})),this.addSub(this.r.sub(x("localeDefinitionOverride"),o=>{if(!o)return;let s=o[this.ke];s&&this.Ln(this.ke,s);}));}Ln(t,e){let o=this.Ut.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=o?.[s];this.r.add(Qt(s),a??n,true);}}Pn(t){let e=this.e.pluginManager;if(!e)return;let o=e.snapshot();for(let s of o.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.r.add(Qt(c),d,true);}}};var ud=()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},dd=()=>"capture"in document.createElement("input"),pd=()=>({safariDesktop:ud()}),hd=()=>({htmlMediaCapture:dd()}),Ea=pd(),Ta=hd();var xi="image/*",ys="video/*",fd=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],md=()=>Ea.safariDesktop?[xi]:[xi,...fd],Si=md(),Nr=r=>r?r.filter(i=>typeof i=="string").flatMap(i=>J(i)):[],bs=(r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),Ca=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),Ge=r=>{let i=r?.type;return i?bs(i,Si):false};function xa(r,i,t,e,o){return {registry:{registerSource:c=>r.addSource(e,c),registerActivity:c=>r.addActivity(e,c),registerFileAction:c=>r.addFileAction(e,c),registerFileHook:c=>r.addFileHook(e,c),registerIcon:c=>r.addIcon(e,c),registerL10n:c=>r.addL10n(e,c),registerConfig:c=>{r.addConfig(e,c);let d=x(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=x(c);return i.read(d)},subscribe:(c,d)=>{let u=x(c),h=i.sub(u,f=>{d(f);});return o.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return o.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var gd=async({entries:r,signal:i})=>(await Promise.all(r.map(async e=>{if(e.isEnabled())try{let o=await e.load();return i.aborted||!e.isEnabled()?void 0:o??void 0}catch(o){i.aborted||console.warn("Failed to load lazy plugin",o);return}}))).filter(e=>e!==void 0),_r=class{constructor(i,t){this.r=i;this.gu=t;this.si=new Set;this.Rn=this.r.sub("*lazyPlugins",e=>{this.mu(e??[]);});}mu(i){for(let o of this.si)o();if(this.si.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let o of i)for(let s of o.configDeps)t.add(x(s));let e=()=>this.Un(i);for(let o of t)this.si.add(this.r.sub(o,e,false));this.Un(i);}Un(i){this.Eo?.abort();let t=new AbortController;this.Eo=t;let e=n=>this.r.read(x(n)),o=e("plugins"),s=gd({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...o,...n]});this.gu(s);}destroy(){this.Rn();for(let i of this.si)i();this.si.clear(),this.Eo?.abort();}};var Br=class{constructor(){this.ne=new Map;}register(i,t){if(this.ne.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.ne.set(t.name,e);}unregister(i){this.ne.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.ne)e.pluginId===i&&this.ne.delete(t);}get(i){return this.ne.get(i)}getAll(){return new Map(this.ne)}};var zr=class{constructor(i=()=>{}){this.S=[];this.kt=[];this.Qi=[];this.Ji=[];this.tr=[];this.Me=[];this.config=new Br;this.$t=F(i,0);}destroy(){this.$t.cancel();}Oe(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.S.find(o=>o.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.S.push(this.Oe(i,t)),this.$t();}addActivity(i,t){let e=this.kt.find(o=>o.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.kt.push(this.Oe(i,t)),this.$t();}addFileAction(i,t){this.Qi.push(this.Oe(i,t)),this.$t();}addFileHook(i,t){this.Ji.push(this.Oe(i,{timeout:3e4,...t})),this.$t();}addIcon(i,t){this.tr.push(this.Oe(i,t)),this.$t();}addL10n(i,t){this.Me.push(this.Oe(i,t)),this.$t();}addConfig(i,t){this.config.register(i,t),this.$t();}purge(i){this.S=this.S.filter(t=>t.pluginId!==i),this.kt=this.kt.filter(t=>t.pluginId!==i),this.Qi=this.Qi.filter(t=>t.pluginId!==i),this.Ji=this.Ji.filter(t=>t.pluginId!==i),this.tr=this.tr.filter(t=>t.pluginId!==i),this.Me=this.Me.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.S],activities:[...this.kt],fileActions:[...this.Qi],fileHooks:[...this.Ji],icons:[...this.tr],l10n:[...this.Me]}}};var Hr=class extends K{constructor(t){super(t);this.ae=new Map;this.f=new Set;this.To=Promise.resolve();this.registry=new zr(()=>this.er());this.$n=new _r(this.r,e=>{this.To=this.To.then(()=>e).then(o=>{if(o)return this.vu(o)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.To}onPluginsChange(t){return this.f.add(t),()=>{this.f.delete(t);}}async vu(t){let e=new Set(this.ae.keys()),o=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(o.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(o.add(s.id),!this.ae.has(s.id))try{await this.yu(s);}catch(n){this.registry.purge(s.id),this.er(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.xo(s);}async yu(t){this.ae.has(t.id)&&this.xo(t.id);let e=[],o=xa(this.registry,this.r,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:o,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.E("Failed to unsubscribe config listener",c);}throw a}this.ae.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.er();}xo(t){let e=this.ae.get(t);if(e){this.registry.purge(t);for(let o of e.configSubscriptions)try{o();}catch(s){this.E("Failed to unsubscribe config listener",s);}e.dispose?.(),this.ae.delete(t),this.er();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let o=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(o.length===0)return;let s=e,n=new AbortController;for(let a of o){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",Ge(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.ae.keys()))this.xo(t);this.registry.destroy(),this.$n.destroy(),super.destroy();}er(){for(let t of this.f)try{t();}catch{}}};function vd(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Es(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Es(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=vd(i);return typeof t=="object"&&t!==null?[e,Es(t)]:[e,t]}))}function yd(r){return {ok:true,value:r}}function ws(r){return {ok:false,error:r}}var bd="https://tlm.uploadcare.com/api/",Ts=class{constructor(i=bd){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return ws(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return yd(s)}catch(s){return ws(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return ws(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(Es(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},wd=async(r,i)=>({success:true,data:i}),Ed=async r=>wd(void 0,r),Kr=class extends Ts{constructor(){super();}async sendEvent(i,t){let e=await Ed(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 Td=20,V=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),jr=class extends K{constructor(){super(...arguments);this.ni=new Map;this.ir=new Set;this.yt=new Map;}bindTarget(t){return this.ir.add(t),()=>{this.ir.delete(t);}}on(t,e){let o=this.yt.get(t);return o||(o=new Set,this.yt.set(t,o)),o.add(e),()=>this.yt.get(t)?.delete(e)}Dn(t,e){for(let s of this.ir)s.dispatchEvent(new CustomEvent(t,{detail:e}));let o=this.yt.get(t);if(o)for(let s of o)s(e);this.E?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Dn(t,typeof e=="function"?e():e);return}this.ni.has(t)&&window.clearTimeout(this.ni.get(t));let n=typeof s=="number"?s:Td,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Dn(t,l),this.ni.delete(t);}catch(l){this.E?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ni.set(t,a);}destroy(){for(let t of this.ni.values())window.clearTimeout(t);this.ir.clear(),this.yt.clear();}};var Sa="1.34.0";var Dt="blocks",Ft=Sa;var Aa=["authToken","secureSignature"],Cs="<redacted>",ka=r=>Aa.includes(r),Gr=r=>{let i={...r};for(let t of Aa)i[t]!==void 0&&i[t]!==null&&(i[t]=Cs);return i};var qr=class extends K{constructor(t){super(t);this.bu=nt.generateRandomUUID();this.Ie=structuredClone(et);this.Co=false;this.So=null;this.jt=false;this.Fn=new Kr,this.Pe=new le(10),this.addSub(this.r.sub(x("qualityInsights"),e=>{this.jt=!!e;}));for(let e of Object.keys(this.Ie))this.addSub(this.r.sub(x(e),o=>{if(!this.jt)return;let s=this.Co&&this.Ie[e]!==o;this.wu(e,o),s&&this.sendEvent({eventType:V.CHANGE_CONFIG});}));}Eu(t){t===V.INIT_SOLUTION&&!this.Co&&(this.Co=true);}wu(t,e){this.Ie[t]!==e&&(this.Ie[t]=e);}Tu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===V.INIT_SOLUTION||t.eventType===V.CHANGE_CONFIG)&&(o.config=Gr(this.Ie)),{...o,appVersion:Ft,appName:Dt,sessionId:this.bu,component:this.xu,activity:this.Cu,projectPubkey:this.Ie.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.Su,payload:{location:this.Au,...e}}}ku(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.jt)return;let e=this.Tu({eventType:t.eventType,payload:t.payload,config:t.config});this.Eu(t.eventType),!(this.ku(t.eventType)||this.So&&this.Nn(this.So,e))&&this.Pe.add(async()=>{this.So=e,await this.Fn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:V.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Nn(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.Nn(t[n],e[n]))return false;return true}get Su(){return Date.now()}get xu(){if(!this.r.has("*solution"))return null;let t=this.r.read("*solution");return t?t.toLowerCase():null}get Cu(){return this.r.has("*currentActivity")?this.r.read("*currentActivity"):null}get Au(){return location.origin}};var Ma=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};var xd=r=>r;var Oa="plural:";function qe(r,i={},t={}){let{openToken:e="{{",closeToken:o="}}",transform:s=xd}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);r=r.replaceAll(e+n+o,c);}return r}function Ia(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(Oa)){let s=r.substring(t+2,e).replace(Oa,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}var La="--uploadcare-blocks-window-height",Ai=class r{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(La,`${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(La);}};var Wr=(r,i)=>new Intl.PluralRules(r).select(i);var Sd=r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=Wr(o,t);return e(`${i}__${s}`)},Zr=r=>{let i=Sd(()=>t),t=(e,o={})=>{if(!e)return "";let n=r().read(Qt(e))||e,a=Ia(n);for(let c of a)o[c.variable]=i(c.pluralKey,Number(o[c.countVariable]));return qe(n,o)};return t};var Ra=r=>r.tagName?.includes("-")??false,Pa=r=>{for(let i=r.parentElement;i;i=i.parentElement)if(Ra(i))return i;return null},Yr=class{constructor(i){this.le=new Set;this.rr=new Map;this.Vn=false;this.ce=i,this.ce.addController(this);}hostDisconnected(){this.or?.(),this.or=void 0,this.le.clear(),this.rr.clear();}hostUpdated(){if(!this.or&&this.ce.has(x("testMode"))){let i=this.ce.subConfigValue("testMode",t=>{this.Vn=!!t,this._n();});this.or=i;}this.Mu(),this._n();}Mu(){let i=this.ce,t=i.renderRoot??i;if(!t)return;let e=this.ce,o=Array.from(t.querySelectorAll("[data-testid]")).filter(s=>!Ra(s));for(let s of o)if(Pa(s)===e&&!this.le.has(s)){let n=s.getAttribute("data-testid");if(!n)continue;this.le.add(s),this.rr.set(s,n);}for(let s of Array.from(this.le))(!s.isConnected||Pa(s)!==e)&&(this.le.delete(s),this.rr.delete(s));}_n(){if(!this.le.size)return;let i=this.ce.testId||"";for(let t of this.le){let e=this.rr.get(t);e&&(this.Vn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Ad=_e(gr()(Ne(hr(xt)))),T=class extends Ad{constructor(){super();this.init$=ps();this.l10n=Zr(()=>this.sharedCtx);this.debugPrint=Er(()=>this.sharedCtx,this.constructor.name);this.e=Wn(()=>this.sharedCtx);new Yr(this);}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(),Ai.registerClient(this);}initCallback(){this.W("*blocksRegistry",()=>new Set),this.W("*pluginManager",t=>new Hr(t)),this.W("*eventEmitter",t=>new jr(t)),this.W("*localeManager",t=>new Vr(t)),this.W("*modalManager",t=>new Tr(t)),this.W("*a11y",()=>new Fr),this.W("*routerLayer",t=>new Dr(t)),this.W("*clipboard",t=>new $r(t)),this.W("*telemetryManager",t=>new qr(t)),this.sub(Qt("locale-id"),t=>{let e=Ma(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.J("*modalManager",false)}get telemetryManager(){return this.J("*telemetryManager")}get localeManager(){return this.J("*localeManager")}get a11y(){return this.J("*a11y")}get clipboardLayer(){return this.J("*clipboard")}get routerLayer(){return this.J("*routerLayer")}get blocksRegistry(){return this.J("*blocksRegistry")}get eventEmitter(){return this.J("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ai.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Ou(),G.deleteCtx(this.ctxName);}Bn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}W(t,e){let o=this.Bn();if(!o.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),o.set(t,s);return}}Ou(){let t=this.Bn();for(let[e,o]of t.entries())o?.destroy?.(),this.pub(e,null);t.clear();}J(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:br(t),cdnUrlModifiers:Wo(t),fileName:yr(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?qe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.oe){let t={};this.oe=new Proxy(t,{set:(e,o,s)=>{if(typeof o!="string"||!(o in et))return false;let n=o,a=x(n);return this.has(a)||this.add(a,et[n]),this.$[a]=s,true},get:(e,o)=>{let s=x(o);return this.has(s)||this.add(s,et[o]),this.$[s]}});}return this.oe}subConfigValue(t,e){let o=x(t);return this.has(o)||this.add(o,et[t]),this.sub(o,e)}};var Vt={ATTRIBUTE:1,CHILD:2},ct=r=>(...i)=>({ao:r,values:i}),ft=class{constructor(i){}get tt(){return this.g.tt}lo(i,t,e){this.sr=i,this.g=t,this.Iu=e;}Jc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Ie=class extends ft{constructor(i){if(super(i),this.it=U,i.type!==Vt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.zn=void 0,this.it=i;if(i===st)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.zn;this.it=i;let t=[i];return t.raw=t,this.zn={zt:this.constructor.resultType,strings:t,values:[]}}};Ie.directiveName="unsafeHTML",Ie.resultType=1;var ki=class extends Ie{};ki.directiveName="unsafeSVG",ki.resultType=2;var We=ct(ki);var Ua="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 16 16' id='uc-icon-paperclip' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M13.264 9.743 9.03 13.977a4.217 4.217 0 0 1-5.96-.005 4.217 4.217 0 0 1-.004-5.96l6.416-6.416a2.743 2.743 0 0 1 3.88 3.88L7.637 11.2a1.232 1.232 0 1 1-1.743-1.743L9.42 5.932'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-preloader' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' style='stroke-dasharray:100 100;stroke-dashoffset:var(--l-progress-offset, 100);transition:stroke-dashoffset .6s linear' transform='rotate(-90 12 12)'/><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' opacity='.2'/></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 Jt=class extends T{constructor(){super(...arguments);this.init$=ma(this);}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return v`${We(Ua)}`}};var Xr=class extends K{constructor(){super(...arguments);this.Le=null;this.Pu=()=>{let{authToken:t}=this.Ut;return typeof t!="function"?Promise.resolve(typeof t=="string"?t:""):(this.Le?this.Le.fetchToken=t:(this.E("Creating the auth token cache."),this.Le=new xr({fetchToken:t})),this.Le.getToken())};}getAuthToken(){let{authToken:t}=this.Ut;if(t)return typeof t=="string"?t:this.Pu}invalidate(){this.Le?.invalidate();}destroy(){super.destroy(),this.Le=null;}};var $a=r=>typeof r!="number"?0:Math.floor(r/1e3),Da=(r,{threshold:i})=>{let{secureExpire:t}=r,e=$a(Date.now()),o=Number(t),s=$a(i);return e+s>=o};var Qr=class extends K{constructor(){super(...arguments);this.ue=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.Ut;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.ue||Da(this.ue,{threshold:s})){this.ue?this.E("Secure signature is expired. Resolving a new one..."):this.E("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.E("Secure signature resolved:",n),this.E("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.ue=n):(this.E("Secure signature resolver returned nothing."),this.ue=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ue}return t&&e?(this.E("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ue=null;}};var xs=(r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Ss=(r,i)=>{let t=i.Lu;if(t)return {type:"GROUP_ERROR",message:t.message,payload:{error:t}}};var As=(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}}};var ks=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=Nr([...t?Si:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let a=bs(s,o),l=Ca(n,o);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};var Ms=(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}}};var Nt=1e3,Le=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Mi=r=>Math.ceil(r*100)/100,Fa=(r,i=Le.AUTO)=>{let t=i===Le.AUTO;if(i===Le.BYTE||t&&r<Nt**1){let o=Wr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===Le.KB||t&&r<Nt**2?`${Mi(r/Nt**1)} KB`:i===Le.MB||t&&r<Nt**3?`${Mi(r/Nt**2)} MB`:i===Le.GB||t&&r<Nt**4?`${Mi(r/Nt**3)} GB`:i===Le.TB||t&&r<Nt**5?`${Mi(r/Nt**4)} TB`:`${Mi(r/Nt**5)} PB`};var Os=(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:Fa(t)}),payload:{entry:r}}};var Is=(r,i)=>{let{internalId:t}=r;if(!i.m.hasItem(t))return;let o=i.m.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof Wt)return {type:"AUTH_TOKEN_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof $t)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Ke)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}}};var Ze={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."},kd=r=>typeof r=="function"?{runOn:"change",validator:r}:r,Jr=class extends K{constructor(t){super(t);this.Ru=[Ms,ks,Os,Is];this.Uu=[As,xs,Ss];this.Pe=new le(20);this.Hn=F(()=>{this.Pe.run();},500);this.Gt=false;this.Re=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.r.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.r.sub(x("multipleMin"),e)),this.addSub(this.r.sub(x("multipleMax"),e)),this.addSub(this.r.sub(x("multiple"),e)),this.addSub(this.r.sub(x("imgOnly"),e)),this.addSub(this.r.sub(x("accept"),e)),this.addSub(this.r.sub(x("validationConcurrency"),o=>{this.Pe.concurrency=o;}));}get m(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Gt)return;let o=e??this.m.items();for(let s of o){let n=this.m.read(s);n&&this.$u(n,t);}}runCollectionValidators(){if(this.Gt)return;let t=this.e.api,e=t.getOutputCollectionState(),o=[],s=this.Ut.collectionValidators;for(let n of [...this.Uu,...s])try{let a=n(e,t);if(!a)continue;a&&(o.push(this.Kn(a)),a.message||console.warn(Ze.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Ze.COLLECTION_VALIDATION_FAILED,a);}this.r.pub("*collectionErrors",o),o.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Re.get(t.uid);e&&(e.abortController?.abort(),this.Re.delete(t.uid));}async $u(t,e){if(this.Gt)return;let o=this.e.api,s=this.jn(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Gt||(await n,this.Gt))return;let l=this.Du(t,e);if(l.length===0||!this.m.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=o.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.Ut.validationTimeout,h=this.Gn(),f=new Set(l.map(b=>b.validator)),g=[];for(let b of h)if(!f.has(b.validator)){let E=s.lastErrorThrownByValidator.get(b.validator);E&&g.push(E);}let w=l.map(b=>async()=>{if(this.Gt)return;let E=setTimeout(()=>{s.skippedValidators.add(b.validator),d.abort(),console.warn(Ze.FILE_VALIDATION_TIMEOUT);},u);try{let S=await b.validator(c,o,{signal:d.signal});if(!S||d.signal.aborted){s.lastErrorThrownByValidator.set(b.validator,void 0);return}let N=this.Kn(S);s.lastErrorThrownByValidator.set(b.validator,N),g.push(N),S.message||console.warn(Ze.MISSING_ERROR_MESSAGE);}catch(S){d.signal.aborted||(s.skippedValidators.add(b.validator),console.warn(Ze.FILE_VALIDATION_FAILED,S),this.e.telemetryManager.sendEventError(S,`file validator. ${Ze.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(E),b.runOn!=="change"&&s.skippedValidators.add(b.validator);}});if(this.Hn(),await this.Pe.add(async()=>{this.Gt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(b=>b())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Kn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}jn(t){let e=this.Re.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Re.set(t.uid,o),o}Gn(){let t=this.Ut.fileValidators;return [...this.Ru,...t].map(kd)}Du(t,e){let o=this.jn(t);return this.Gn().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Gt=true,this.Hn.cancel();for(let t of this.Re.values())t.abortController?.abort(),t.promise=void 0;this.Re.clear();}};var Va="[Typed State] Wrong property name: ",to=class{constructor(i){this.gt=nt.generateFastUid(),this.ot=G.registerCtx(i,this.gt);}get uid(){return this.gt}setValue(i,t){if(!this.ot.has(i)){console.warn(`${Va}${String(i)}`);return}this.ot.read(i)!==t&&this.ot.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.ot.has(i)||console.warn(`${Va}${String(i)}`),this.ot.read(i)}subscribe(i,t){return this.ot.sub(i,t)}destroy(){G.deleteCtx(this.gt);}};var eo=class r{constructor(i){this.qt=Object.create(null);this.nr=new Set;this.ar=new Set;this.at=new Set;this.Ao=new Set;this.ko=new Set;this.Ue=new Set;this.Zn=i.initialValue,this.gt=nt.generateFastUid(),this.ot=G.registerCtx({},this.gt),this.qn=i.watchList||[];let t=Object.create(null);this.Wn=(e,o)=>{this.ai&&window.clearTimeout(this.ai),t[e]||(t[e]=new Set),t[e].add(o),this.ai=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.nr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Yn();},i.handler&&this.observeCollection(i.handler);}static{this.Fu=1e4;}Q(){this.li&&window.clearTimeout(this.li),this.li=window.setTimeout(()=>{let i=new Set(this.ko),t=new Set(this.Ao);this.ko.clear(),this.Ao.clear();for(let e of this.ar)e?.([...this.at],i,t);this.Yn();});}Yn(){this.Ue.size!==0&&(this.ci&&window.clearTimeout(this.ci),this.ci=window.setTimeout(()=>{let i=[...this.Ue];this.Ue.clear();for(let t of i)t.destroy();},r.Fu));}observeCollection(i){return this.ar.add(i),this.at.size>0&&this.Q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.ar.delete(i);}add(i,t={}){let e=new to(this.Zn);for(let[o,s]of Object.entries(i))e.setValue(o,s);if(t.index===void 0)this.at.add(e.uid);else {let o=[...this.at],s=Math.min(Math.max(Math.trunc(t.index)||0,0),o.length);o.splice(s,0,e.uid),this.at=new Set(o);}return this.Q(),this.ot.add(e.uid,e),this.ko.add(e),this.qn.forEach(o=>{this.qt[e.uid]||(this.qt[e.uid]=[]),this.qt[e.uid]?.push(e.subscribe(o,()=>{this.Wn(o,e.uid);}));}),e.uid}hasItem(i){return this.at.has(i)}read(i){return this.ot.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.Ao.add(t),this.Ue.add(t)),this.at.delete(i),this.Q(),this.ot.pub(i,void 0),this.qt[i]?.forEach(e=>{e();}),delete this.qt[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.at.forEach(i=>{this.abort(i);});}clearAll(){this.at.forEach(i=>{this.remove(i);});}observeProperties(i){return this.nr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.nr.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.ai&&window.clearTimeout(this.ai),this.li&&window.clearTimeout(this.li),this.ci&&window.clearTimeout(this.ci);for(let i of this.Ue)i.destroy();this.Ue.clear(),G.deleteCtx(this.gt),this.nr=new Set,this.ar=new Set;for(let i of Object.keys(this.qt))this.qt[i]?.forEach(t=>{t();}),delete this.qt[i];}};var P=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Na=r=>({isVideoRecordingEnabled:Z(r.cameraModes).includes(P.VIDEO),isPhotoEnabled:Z(r.cameraModes).includes(P.PHOTO)});var _a=(r,i)=>{for(let t of r)if(i(t))return t};var Ls=(r,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(o=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of r)if(i(l)){clearTimeout(n),o(l);return}s=requestAnimationFrame(a);};a();});function io(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}var Md=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Od=new RegExp(`^/?(${Md.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Ba=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(Ti),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=Od.exec(o.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),Id=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),R=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Id,...mt}),Ld={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},za=r=>Ld[r]??r;var ro=r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e));function Ha(r){let i=new Map;return (...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s}}var Ka=new Set;function oo(r){Ka.has(r)||(Ka.add(r),console.warn(r));}function Pd(r){let i=false;return setTimeout(()=>{i=true;},0),e=>((...o)=>(i&&oo(r),e(...o)))}function ja(r){let i={},t=r.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>r.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>ro(r),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},o=Pd("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=Ha(o(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var Ga={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,tags:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};function Ps(r){return {fileInfo:r,uuid:r.uuid,cdnUrl:r.cdnUrl,fileName:r.originalFilename??null,fileSize:r.size,isImage:r.isImage??false,mimeType:r.contentInfo?.mime?.mime??r.mimeType??null,uploadProgress:100}}var so=class extends K{constructor(){super(...arguments);this.Me=Zr(()=>this.r);this.addFileFromUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({uuid:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=Ba({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.m.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let a=this.m.add({file:t,isImage:Ge(t),mimeType:t.type||null,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??R.API,fullPath:n??null});return this.getOutputItem(a)};this.addFileFromUploadcareFile=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({...Ps(t),fileName:o??t.originalFilename??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.replaceFile=(t,e,{silent:o,fileName:s,source:n}={})=>{let a=t,l=this.m,c=l.items().indexOf(a),d=l.read(a);if(c===-1||!d)throw new Error(`File with internalId ${t} not found`);let u={source:d.getValue("source"),metadata:d.getValue("metadata"),fullPath:d.getValue("fullPath"),silent:d.getValue("silent")};l.remove(a);let h=l.add({...Ps(e),fileName:s??e.originalFilename??null,silent:o??u.silent,source:n??u.source??R.API,metadata:u.metadata,fullPath:u.fullPath},{index:c});return this.getOutputItem(h)};this.removeFileByInternalId=t=>{if(!this.m.read(t))throw new Error(`File with internalId ${t} not found`);this.m.remove(t);};this.uploadAll=()=>{let t=this.m.items().filter(e=>{let o=this.m.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.r.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=jt(Nr([this.cfg.accept??"",...this.cfg.imgOnly?Si:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),io(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Na(this.cfg);t.modeCamera===P.PHOTO&&n?s.accept=xi:t.modeCamera===P.VIDEO&&a?s.accept=ys:s.accept=[xi,a&&ys].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?R.CAMERA:R.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.m.size>0&&!t)this.r.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST);else if(this.Xn?.length===1){let e=this.Xn[0];this.Mo().then(()=>{let o=this.e.pluginManager.snapshot().sources,s=o.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(o.find(l=>l.id===n[0])??s).onSelect():(this.r.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM));return}this.r.read("*currentActivity")&&this.e.modalManager?.open(this.r.read("*currentActivity"));});}else this.r.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM);};this.doneFlow=()=>{let t=_a(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.r.pub("*currentActivity",t.doneActivity),this.r.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.r.read("*currentActivity")||this.e.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.Mo().then(()=>{this.r.pub("*currentActivityParams",e[0]??{}),this.r.pub("*currentActivity",t),Ls(this.e.blocksRegistry,o=>o.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getAuthToken=()=>this.e.authTokenManager?.getAuthToken();this.invalidateAuthToken=()=>{this.e.authTokenManager?.invalidate();};this.getCurrentActivity=()=>this.r.read("*currentActivity");this.historyBack=()=>{this.r.read("*historyBack")?.();};this.setModalState=t=>{this.Mo().then(()=>{if(!t){this.e.modalManager?.close(this.r.read("*currentActivity")),this.r.pub("*currentActivity",null);return}let e=this.r.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return Ls(this.e.blocksRegistry,o=>o.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get m(){return this.e.uploadCollection}get Lu(){return this.r.read("*groupError")}get cfg(){return this.Ut}get l10n(){return this.Me}removeAllFiles(){this.m.clearAll();}getOutputItem(t){let e=G.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:o.fileName??s?.originalFilename??null,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,tags:o.tags??s?.tags??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 ja(this.e)}async Mo(){return (await this.e.wait("pluginManager")).pluginsReady()}get Xn(){let t=[];return this.cfg.sourceList&&(t=J(this.cfg.sourceList)),t}};var Oi=33.333333333333336,k=1,Rs=24,qa=6;function de(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function wt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return de(t,i),t}function Wa(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,o+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,o+l*n+1.5*d],f=[e+a*s-24*t*c+1.5*c,o+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,w=[h[0],h[1]];return {d:g,center:w}}function Za(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,g;a?(f=[e+c*s-34*t/2,o+d*n+1.5*h],g=[e+c*s+34*t/2,o+d*n+1.5*h]):(f=[e+c*s+1.5*u,o+d*n-34*t/2],g=[e+c*s+1.5*u,o+d*n+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,b=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:w,center:b}}function Ya(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function Xa({rect:r,delta:[i,t],imageBox:e}){return Xe({...r,x:r.x+i,y:r.y+t},e)}function Xe(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}}function Rd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;s+=o,a-=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,a=r.y+r.height-s,t&&(n=a*t,l=r.x+r.width/2-n/2)),l<=e.x&&(l=e.x,s=r.y+r.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y+r.height-a),a<k&&(a=k,t&&(n=a*t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),n<k&&(n=k,t&&(a=n/t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),{x:l,y:s,width:n,height:a}}function Ud({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;s+=o,n-=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(a=n/t,l=r.y+r.height/2-a/2)),l<=e.y&&(l=e.y,s=r.x+r.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x+r.width-n),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),{x:s,y:l,width:n,height:a}}function $d({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;a+=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=r.x+r.width/2-n/2),l<=e.x&&(l=e.x,s=r.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y),a<k&&(a=k,t&&(n=a*t),l=r.x+r.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:s,width:n,height:a}}function Dd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;n+=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=r.y+r.height/2-a/2),l<=e.y&&(l=e.y,s=r.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:s,y:l,width:n,height:a}}function Fd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+s<e.y&&(s=e.y-a),n+=o,l-=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x+r.width-l,a=e.y)):t&&(o=c*t-l,l=l+o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Vd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x,a=e.y)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Nd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=o,l-=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x+r.width-l,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function _d({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function Qa({direction:r,...i}){switch(r){case "n":return Rd(i);case "w":return Ud(i);case "s":return $d(i);case "e":return Dd(i);case "nw":return Fd(i);case "ne":return Vd(i);case "sw":return Nd(i);case "se":return _d(i);default:return i.rect}}function Ja(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function tl(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}function el(r,i){return Math.abs(r.width/r.height-i)<.1}function Qe({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function il(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),a=Math.round((i-s)/2);return n+o>r&&(o=r-n),a+s>i&&(s=i-a),{x:n,y:a,width:o,height:s}}function Je(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function pe(r,i,t){return Math.min(Math.max(r,i),t)}var Ii=["free"],ao=r=>{let i=J(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&&!Ii.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),a=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Ii.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:nt.generateFastUid(),type:"aspect-ratio",width:Ii.includes(o)?0:n,height:Ii.includes(o)?0:a,hasFreeform:Ii.includes(o)});}return t},rl=(r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(o-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(o-c)/c>e)return null}return s};function ol(r){return ss({...r,libraryName:Dt,libraryVersion:Ft})}var sl="active",ti="___ACTIVITY_IS_ACTIVE___",nl,$=class r extends(nl=T,nl){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=hs(this);this.Nu=F(this.Vu.bind(this),10);}Qn(){let t=r.ui.get(this);this[ti]=false,this.removeAttribute(sl),t?.deactivateCallback?.();}_u(){let t=r.ui.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[ti]=true,this.setAttribute(sl,""),t?.activateCallback?.(),this.Nu(),this.emit(A.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[ti]?this.Qn():this.activityType===t&&!this[ti]&&this._u();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let o=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=o??null;}t||(this.$["*history"]=[]);}));}Vu(){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);}Jn(){return !!this.activityType&&r.ui.has(this)}static{this.ui=new Map;}get isActivityActive(){return !!this[ti]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.ui.set(this,{activateCallback:o,deactivateCallback:s});}Bu(){this.isActivityActive&&this.Qn(),r.ui.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Jn()&&this.Bu();}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:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};$.activities=D;var M=class r extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.lr=false;this.init$=fs(this);this.Lo=0;this.Po=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Gu(e);},300);this.Ku=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.Lo+=1,this.$["*groupInfo"]=null,this.$["*groupError"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of 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(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.ia(),this.Po();}};this.ju=t=>{if(!this.isConnected)return;this.Po();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["file","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)&&!!G.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=G.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.ia();}if(t.isUploading)for(let s of t.isUploading){let n=G.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=G.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.qu();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=G.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.ia=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get zu(){return this.hasBlockInCtx(t=>t instanceof r?t.lr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.W("*uploadCollection",()=>new eo({initialValue:Ga,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.W("*secureUploadsManager",t=>new Qr(t)),this.W("*authTokenManager",t=>new Xr(t)),this.W("*validationManager",t=>new Jr(t)),this.W("*publicApi",t=>new so(t)),!this.zu&&this.couldBeCtxOwner&&this.Hu();}getAPI(){return this.api}get validationManager(){return this.J("*validationManager")}get api(){return this.J("*publicApi")}get uploadCollection(){return this.J("*uploadCollection")}get secureUploadsManager(){return this.J("*secureUploadsManager")}get authTokenManager(){return this.J("*authTokenManager")}disconnectedCallback(){super.disconnectedCallback(),this.lr&&this.ta(),this.Po.cancel();}connectedCallback(){super.connectedCallback(),this.lr&&this.ea();}Hu(){this.lr=true,this.ea(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}ea(){this.ta(),this.Oo=this.uploadCollection.observeCollection(this.Ku),this.Io=this.uploadCollection.observeProperties(this.ju);}ta(){this.Io?.(),this.Oo?.(),this.Io=void 0,this.Oo=void 0;}async Gu(t){let e=this.Lo,o=()=>e===this.Lo;try{let s=await this.getUploadClientOptions(),n=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),a=await fa(n,s);if(!o())return;this.$["*groupInfo"]=a,this.$["*groupError"]=null;let l=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,l),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l;}catch(s){if(!o())return;this.$["*groupError"]=s instanceof Error?s:new Error("Failed to create a group",{cause:s}),this.validationManager.runCollectionValidators();}}qu(){let t=ao(this.cfg.cropPreset);if(!t)return;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:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=il(a,l,c),u=at(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:Q(h,u)});}}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 getTagsFor(t){let e=this.cfg.tags||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}return e}async getUploadClientOptions(){let t=this.authTokenManager.getAuthToken(),e=t?null:await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:ol,integration:this.cfg.userAgentIntegration,authToken:t,secureSignature:e?.secureSignature,secureExpire:e?.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 ro(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...R});var he=class extends T{constructor(){super(...arguments);this.name="";this.cr="";this.di=null;this.ra=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.ra=e,this.Ro();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.Ro()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ro();}Ro(){if(!this.name){this.cr="",this.di=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.di=e.svg,this.cr="";return}this.di=null;let o=`#uc-icon-${this.name}`,s=this.ra?.(this.name);this.cr=s??o;}render(){return this.di?v`${this.yield("",v`${We(this.di)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.cr}></use></svg>`)} `}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback();}};p([y({type:String})],he.prototype,"name",2),p([m()],he.prototype,"cr",2),p([m()],he.prototype,"di",2);var al=r=>[...new Set(r)];var Pe="--uc-img-",Us="unresolved";var $s=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Ds=3e3,Fs=5e3,Vs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Bd="https://ucarecdn.com",ei=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Bd},"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 lo=class extends Ne(_e(xt)){constructor(){super();this.$e={};this.f=new Map;this.De=null;this.ur=null;for(let t in ei){let e=ei[t];this.$e[Pe+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.$e[Pe+t]}set$$(t){for(let e in t){let o=Pe+e,s=t[e];this.$e[o]=s,this.Q(o,s);}}sub$$(t,e){let o=Pe+t;this.f.has(o)||this.f.set(o,new Set),this.f.get(o)?.add(e);let s=this.$e[o];s!==null&&s!==""&&e(s);}Q(t,e){this.f.has(t)&&this.f.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${Dt}/${Ft}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;ei[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.De=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.De?.unobserve(t));});},o),this.De.observe(t),this.ur||(this.ur=new Set),this.ur.add(t);}connectedCallback(){super.connectedCallback(),this.Wu();}Wu(){for(let t in ei){let e=Pe+t,o=this.getCssData(e,true);o!=null&&(this.$e[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.De&&(this.ur?.forEach(t=>{this.De?.unobserve(t);}),this.De=null),this.f.clear();}static get observedAttributes(){return Object.keys(ei)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Pe+t;this.$e[s]=o,this.Q(s,o);});}};var ll=r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var po=class extends lo{constructor(){super(...arguments);this.Dt=new Image;this.Mt=new Image;}oa(t){return !t.includes("//")&&!$s&&(t=new URL(t,document.baseURI).href),t}dr(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)>Fs&&this.sa?Fs+s:Number(n)>Ds&&!this.sa?Ds+s:t}Zu(t,e){let o={format:this.Uo("format"),quality:this.Uo("quality"),resize:this.dr(t),blur:e,"cdn-operations":this.Uo("cdn-operations")??void 0,analytics:this.analyticsParams()};return at(...ll(o))}Uo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}bt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if($s&&o&&!o.includes("//"))return this.pi(o);let s=this.Zu(t,e),n=this.$$("cdn-cname"),a=n;if(o.startsWith(String(n)))return Q(o,s);let l=this.$$("uuid");if(a&&l)return this.pi(Q(ne(a,l),s));if(l)return this.pi(Q(ne(a,l),s));let c=this.$$("proxy-cname");if(c)return this.pi(Q(c,s,this.oa(o)));let d=this.$$("pubkey");if(d)return this.pi(Q(`https://${d}.ucr.io/`,s,this.oa(o)))}pi(t){let e=this.$$("secure-delivery-proxy");return e?qe(e,{previewUrl:t},{transform:o=>window.encodeURIComponent(o)}):t}Fe(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=o?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Yu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Ft||(this.$o({elNode:this.Dt}),this.appendChild(this.Dt)),this.Dt}get pr(){return this.Ft?{type:Vs.PREVIEW,img:this.Mt}:{type:Vs.MAIN,img:this.img}}get Ft(){return this.$$("is-preview-blur")}get na(){return this.$$("is-background-for")}get aa(){let t=this.$$("breakpoints");if(t){let e=J(t);return al(e.map(o=>parseInt(o,10)))}else return null}get sa(){return this.$$("format").toLowerCase()==="jpeg"}la(t){let e=new Set;e.add(`url("${this.bt(this.Fe(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.bt(this.Fe(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.bt(this.Fe(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}ca(){let t=new Set;return this.aa?this.aa.forEach(e=>{t.add(`${this.bt(`${e}x`)} ${this.dr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.bt(`${e*2}x`)} ${this.dr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.bt(`${e*3}x`)} ${this.dr(`${e*3}w`)}`);}):(t.add(`${this.bt(this.Fe(this.pr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.bt(this.Fe(this.pr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.bt(this.Fe(this.pr.img,3))} 3x`)),[...t].join()}ua(){return this.bt()}get da(){return this.bt("100x","100")}Xu(){let t=this.na;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.la(e);}):this.la(e);});}Qu({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}$o({elNode:t}){this.Yu(t),this.initAttributes(t);}Do({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.$o({elNode:o}),o.setAttribute(Us,""),o.addEventListener("load",()=>{o.removeAttribute(Us),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Qu({elNode:o,src:t,srcset:e});})}async Ju(){if(this.$$("intersection")){this.Ft&&(this.$o({elNode:this.Mt}),this.appendChild(this.Mt)),this.initIntersection(this.pr.img,async()=>{this.Ft&&(this.Mt.src=this.da);try{await this.Do({src:this.ua(),srcset:this.ca(),elNode:this.Dt}),this.Ft&&await this.Mt.remove(),this.appendChild(this.Dt);}catch{this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}});return}try{this.Ft&&(await this.Do({src:this.da,elNode:this.Mt}),this.appendChild(this.Mt)),await this.Do({src:this.ua(),srcset:this.ca(),elNode:this.Dt}),this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}catch{this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}}init(){this.na?this.Xu():this.Ju();}};var Ns=class extends po{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:zd}=Pn,cl=r=>r;var _s=(r,i)=>r?.zt!==void 0,dl=r=>r?.zt?.h!=null;var pl=r=>r.strings===void 0,ul=()=>document.createComment(""),te=(r,i,t)=>{let e=r.Rt.parentNode,o=i===void 0?r.Ce:i.Rt;if(t===void 0){let s=e.insertBefore(ul(),o),n=e.insertBefore(ul(),o);t=new zd(s,n,r,r.options);}else {let s=t.Ce.nextSibling,n=t.g,a=n!==r;if(a){let l;t.td?.(r),t.g=r,t.Hi!==void 0&&(l=r.tt)!==n.tt&&t.Hi(l);}if(s!==o||a){let l=t.Rt;for(;l!==s;){let c=cl(l).nextSibling;cl(e).insertBefore(l,o),l=c;}}}return t},fe=(r,i,t=r)=>(r.St(i,t),r),Hd={},Li=(r,i=Hd)=>r.s=i,Pi=r=>r.s,ho=r=>{r.Se(),r.Rt.remove();},hl=r=>{r.Se();};var Ri=(r,i)=>{let t=r.Ct;if(t===void 0)return false;for(let e of t)e.yn?.(i,false),Ri(e,i);return true},fo=r=>{let i,t;do{if((i=r.g)===void 0)break;t=i.Ct,t.delete(r),r=i;}while(t?.size===0)},fl=r=>{for(let i;i=r.g;r=i){let t=i.Ct;if(t===void 0)i.Ct=t=new Set;else if(t.has(r))break;t.add(r),Gd(i);}};function Kd(r){this.Ct!==void 0?(fo(this),this.g=r,fl(this)):this.g=r;}function jd(r,i=false,t=0){let e=this.s,o=this.Ct;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ri(e[s],false),fo(e[s]);else e!=null&&(Ri(e,false),fo(e));else Ri(this,r);}var Gd=r=>{r.type==Vt.CHILD&&(r.Hi??=jd,r.td??=Kd);},mo=class extends ft{constructor(){super(...arguments),this.Ct=void 0;}lo(i,t,e){super.lo(i,t,e),fl(this),this.isConnected=i.tt;}yn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ri(this,i),fo(this));}setValue(i){if(pl(this.sr))this.sr.St(i,this);else {let t=[...this.sr.s];t[this.Iu]=i,this.sr.St(t,this,0);}}disconnected(){}reconnected(){}};var O=()=>new zs,zs=class{},Bs=new WeakMap,I=ct(class extends mo{render(r){return U}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)),U}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Bs.get(i);t===void 0&&(t=new WeakMap,Bs.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"?Bs.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 Hs=null,Ui=class extends T{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]===this.id&&(this.$["*currentActivity"]=null));};this.ed=()=>{this.closeDialog();};this.rd=t=>{this.Fo=t.target;};this.od=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Fo&&this.closeDialog();};this.hi=({id:t})=>{t===this.id?(Hs=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.fi=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.pa=t=>{this.hide(),Hs===this.id&&this.emit(A.MODAL_CLOSE,{modalId:Hs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(tt.OPEN,this.hi),this.modalManager?.subscribe(tt.CLOSE,this.fi),this.modalManager?.subscribe(tt.CLOSE_ALL,this.pa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Fo=void 0,this.modalManager?.unsubscribe(tt.OPEN,this.hi),this.modalManager?.unsubscribe(tt.CLOSE,this.fi),this.modalManager?.unsubscribe(tt.CLOSE_ALL,this.pa);}sd(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.ed),this.dialogEl.value?.addEventListener("mousedown",this.rd),this.dialogEl.value?.addEventListener("mouseup",this.od);}render(){return v`<dialog data-testid="dialog" ${I(this.sd)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ui.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ui.prototype,"blockBodyScrolling",2);var go=class extends M{constructor(){super(...arguments);this.Z=null;this.hr=null;}get ha(){return this.nameAttrValue??this.ctxName}fa(){let t=document.createElement("input");return t.type="text",t.name=this.ha,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,io(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.Z=this.fa(),this.appendChild(this.Z),this.sub("*collectionState",t=>{if(!t)return;if(!this.hr){let n=document.createElement("div");this.appendChild(n),this.hr=n;}if(!this.Z){let n=this.fa();this.appendChild(n),this.Z=n;}if(this.hr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.Z.value="",this.Z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.Z.value="",this.Z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.Z.value=e.cdnUrl??"",this.Z.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.Z.value=o[0],this.Z.setCustomValidity("");return}this.Z.remove(),this.Z=null;let s=new DocumentFragment;for(let n of o){let a=document.createElement("input");a.type="hidden",a.name=`${this.ha}[]`,a.value=n,s.appendChild(a);}this.hr.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],go.prototype,"nameAttrValue",2);var Ks=class extends T{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var ii=class extends T{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.wt=0;this.fr=O();this.ma=()=>{let t=this.fr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.wt>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.wt=this.No(this.value),this.Vo(),this.fr.value?.addEventListener("animationiteration",this.ma);}updated(t){if(super.updated(t),t.has("value")){let e=this.No(this.value);if(!this.visible)this.wt=e;else {let o=Math.max(this.wt,e);o!==this.wt&&(this.wt=o,this.Vo());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Vo():this.wt=this.No(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.fr.value?.removeEventListener("animationiteration",this.ma);}No(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Vo(){this.visible&&this.style.setProperty("--l-progress-value",this.wt.toString());}render(){return v`<div ${I(this.fr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],ii.prototype,"hasFileName",2),p([y({type:Number})],ii.prototype,"value",2),p([y({type:Boolean,reflect:true})],ii.prototype,"visible",2);var $i=class extends M{constructor(){super();this.Ot=false;this.Ne=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this._o=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.Ot=t;}),this.sub("*commonProgress",t=>{this.Ne=t;});}updated(t){super.updated(t),t.has("visible")&&(this.Ot?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this._o?.(),this._o=void 0;}render(){return v`<uc-progress-bar .value=${this.Ne} .visible=${this.Ot}></uc-progress-bar>`}};p([m()],$i.prototype,"Ot",2),p([m()],$i.prototype,"Ne",2);var ri=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.nd=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return v`<select @change=${this.nd} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],ri.prototype,"value",2),p([y({type:Boolean,reflect:true})],ri.prototype,"disabled",2),p([y({type:Array,attribute:false})],ri.prototype,"options",2);var me=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Bo="default";this.mr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.ad(this.source);}ad(t){if(!t){this.mr="",this.Bo="default";return}let{label:e,icon:o,id:s}=t;this.mr=e,this.Bo=o??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.mr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Bo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.mr)}</div>`}</button>`}};p([y({attribute:false})],me.prototype,"source",2),p([y({type:Boolean})],me.prototype,"textOnly",2),p([y({type:Boolean})],me.prototype,"iconOnly",2),p([m()],me.prototype,"Bo",2),p([m()],me.prototype,"mr",2);var oi=class{constructor(i,t){this.ga=[];this.r=t.ctx,this.e=t.sharedInstancesBag,this.va=t.onSourcesChange,i.addController(this);}hostConnected(){this.zo=this.r.sub(x("sourceList"),t=>{this.ga=J(t),this.Ho();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.z=i.onPluginsChange(()=>this.Ho())),this.Ho();}hostDisconnected(){this.z?.(),this.z=void 0,this.zo?.(),this.zo=void 0;}Ho(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),o=[];this.ga.forEach(s=>{let n=this.ld(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let d=e.get(c);d&&o.push(this.ya(d));}return}let l=e.get(s);l&&o.push(this.ya(l));}),this.va(o);}ld(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}ya(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Di=class extends M{constructor(){super(...arguments);this.S=[];this.wrap=false;}initCallback(){super.initCallback(),new oi(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.S=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.S.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([m()],Di.prototype,"S",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Di.prototype,"wrap",2);var js=class extends T{render(){return v`<div class="uc-spinner"></div>`}};var It="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Re(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:()=>{i.naturalWidth===0&&(i.src=It);}}}function Fi(r){let i=[];for(let s of r){let n=Re(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Gs(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,a)=>{o.onload=()=>{let l=o.height/o.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},o.onerror=l=>{a(l);};});return o.src=URL.createObjectURL(r),s}var si=class extends M{constructor(){super(...arguments);this.gr=new Set;this.entry=null;}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 a=o.subscribe(s,l=>{this.isConnected&&n(l);});this.gr.add(a);})(t,e);}reset(){for(let t of this.gr)t();this.gr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.gr=new Set;}};function qd(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}function vo(r="hsl(209, 21%, 65%)",i=32,t=32){return qd(`<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>`)}var Wd=3e3,ni=class extends si{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Wt="";this.ba=false;this.vr=null;this.wa=false;this.cd=this.cfg.filesViewMode;this.Ea=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.ud(e);if(o&&s&&n){let d=await this.proxyUrl(Q(ne(this.cfg.cdnCname,n),at(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Re(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let f=await Gs(h,l);t.setValue("thumbUrl",f);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(f));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await Gs(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(d));}});this.yr=F(this.Ea.bind(this),100);}ud(t=false){t&&(this.vr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.vr?.height||0),10),parseInt(String(this?.vr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),Wd)}dd(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=It,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),o();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}jo(){this.Ko?.cancel(),this.Ko=void 0;}pd(t){if(this.jo(),!t){this.Wt&&(this.Wt="");return}if(t===this.Wt)return;let e=new AbortController,o={controller:e,cancel:()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);}};this.Ko=o,this.dd(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Wt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}br(t=false){if(this.entry){if(t){this.Ea(true);return}this.wa&&this.yr();}}firstUpdated(t){super.firstUpdated(t),this.Ta();}updated(t){super.updated(t),t.has("uid")&&this.Ta();}mi(t){let[e]=t;e&&(this.wa=e.isIntersecting,e.isIntersecting&&(this.vr=e.boundingClientRect,this.br(),this.n?.disconnect()),e.intersectionRatio===0&&this.yr.cancel());}reset(){super.reset(),this.yr.cancel(),this.jo(),this.Wt&&(this.Wt="");}Ta(){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=()=>{this.br();};this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.pd(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.br(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ba&&(this.cd==="list"&&this.br(true),this.ba=true);});}connectedCallback(){super.connectedCallback(),this.n?.disconnect(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:.1}),this.n.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.yr.cancel(),this.jo(),this.n?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Wt||It} role="img" alt="Preview of uploaded image" ?hidden=${!this.Wt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ni.prototype,"badgeIcon",2),p([y({attribute:false})],ni.prototype,"uid",2),p([m()],ni.prototype,"Wt",2);var qs=class extends ${};var Ws=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Zs=class extends M{constructor(){super(...arguments);this.xa=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.xa=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.xa?.();}};var ge=(r,i)=>{let t=false,e,o=0,s=((...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);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var ml=(r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},Vi=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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 a of r)o[n]=e?e(a,n):n,s[n]=t(a,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=Pi(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=o.length-1,f=0,g=s.length-1;for(;u<=h&&f<=g;)if(o[u]===null)u++;else if(o[h]===null)h--;else if(a[u]===n[f])l[f]=fe(o[u],s[f]),u++,f++;else if(a[h]===n[g])l[g]=fe(o[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=fe(o[u],s[g]),te(r,l[g+1],o[u]),u++,g--;else if(a[h]===n[f])l[f]=fe(o[h],s[f]),te(r,o[u],o[h]),h--,f++;else if(c===void 0&&(c=ml(n,f,g),d=ml(a,u,h)),c.has(a[u]))if(c.has(a[h])){let w=d.get(n[f]),b=w!==void 0?o[w]:null;if(b===null){let E=te(r,o[u]);fe(E,s[f]),l[f]=E;}else l[f]=fe(b,s[f]),te(r,o[u],b),o[w]=null;f++;}else ho(o[h]),h--;else ho(o[u]),u++;for(;f<=g;){let w=te(r,l[g+1]);fe(w,s[f]),l[f++]=w;}for(;u<=h;){let w=o[u++];w!==null&&ho(w);}return this.ut=n,Li(r,l),st}});var gl="important",Zd=" !"+gl,ee=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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(Zd);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?gl:""):t[e]=o;}}return st}});var ut=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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 st}});var Yd="file-item-remove-button",ie=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get hd(){return Math.min(Math.max(this.progress||0,0),100)}fd(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=ut({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-hide-remove":this.hideRemove,"uc-failed":this.failed,"uc-success":this.success}),e=100-this.hd,o=this.l10n(Yd);return v`<button type="button" @click=${this.fd} title=${o} aria-label=${o} class=${t} ><span class="uc-icon-wrap"><uc-icon name="close"></uc-icon><uc-icon name="remove-file"></uc-icon></span><uc-icon name="preloader" class="uc-preloader" style=${ee({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};p([y({type:Boolean})],ie.prototype,"uploading",2),p([y({type:Boolean})],ie.prototype,"failed",2),p([y({type:Boolean})],ie.prototype,"success",2),p([y({type:Boolean})],ie.prototype,"idle",2),p([y({type:Boolean})],ie.prototype,"hideRemove",2),p([y({type:Number})],ie.prototype,"progress",2);var Y=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")}),W=class W extends si{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ca=true;this.uid="";this.Go="";this.qo="";this.Wo="";this.wt=0;this.md=false;this.Zo="";this.Yo=false;this.Xo=false;this.Qo=false;this.Sa=false;this.Aa=false;this.Jo=false;this.ka="";this.wr=[];this.Ma=false;this.ts=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&(this.entry?.getValue("abortController")?.abort(),this.uploadCollection.remove(this.uid));};this.Bh=()=>{this.Oa();};this.K=F(()=>this.Ia(),100);this.vd=this.withEntry(ge((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===Y.FINISHED,l=e===Y.UPLOADING,c=e===Y.QUEUED_UPLOADING,d=e===Y.QUEUED_VALIDATION,u=e===Y.VALIDATION,h=t.getValue("fileName"),f="";o?f="":!a&&n&&s&&Object.values(mt).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${za(s)}`)})),this.Wo=f,this.qo=o,this.md=l||c||d||u,this.wt=d||u?0:t.getValue("uploadProgress"),this.ka=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Oa=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.K();try{let o=new AbortController;t.setValue("abortController",o);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of h)try{let g=f.handler({file:a,signal:o.signal}),w=new Promise((E,S)=>setTimeout(()=>S(new Error("beforeUpload hook timed out")),f.timeout)),{file:b}=await Promise.race([g,w]);b!==a&&(a=b,t.setValue("mimeType",a.type||null),t.setValue("isImage",Ge(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:o.signal,metadata:await this.getMetadataFor(t.uid),tags:await this.getTagsFor(t.uid)};return this.debugPrint("upload options",l,Gr(d)),ds(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.K();}catch(o){let s=o instanceof Ut&&o.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof Me||o instanceof Wt?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.K(),this.isConnected&&!s&&this.telemetryManager.sendEventError(o,"file upload. Failed to upload file");}}});}Ia(){let t=this.entry;if(!t)return;let e=Y.IDLE;t.getValue("errors").length>0?e=Y.FAILED:t.getValue("isQueuedForUploading")?e=Y.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Y.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Y.VALIDATION:t.getValue("isUploading")?e=Y.UPLOADING:t.getValue("fileInfo")&&(e=Y.FINISHED),this.gd(t,e);}gd(t,e){e===Y.FAILED?this.Zo="badge-error":e===Y.FINISHED&&(this.Zo="badge-success"),e===Y.UPLOADING&&(this.Aa=false,this.removeAttribute("focused")),this.Xo=e===Y.FAILED,this.Qo=e===Y.UPLOADING,this.Sa=e===Y.QUEUED_UPLOADING||e===Y.UPLOADING,this.Yo=e===Y.FINISHED,this.vd(e);}reset(){super.reset(),this.K.cancel();}mi(t){let[e]=t;e&&e.isIntersecting&&!this.Ma&&(this.Ca=false,this.Ma=true);}Pa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.de();return}this.subEntry("isQueuedForValidation",()=>{this.K();}),this.subEntry("isValidationPending",()=>{this.K();}),this.subEntry("uploadProgress",()=>{this.K();}),this.subEntry("isQueuedForUploading",()=>{this.K();}),this.subEntry("fileName",o=>{this.Go=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.K();}),this.subEntry("externalUrl",o=>{this.Go=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.K();}),this.subEntry("errors",()=>this.K()),this.subEntry("isUploading",()=>this.K()),this.subEntry("fileSize",()=>this.K()),this.subEntry("mimeType",()=>this.K()),this.subEntry("isImage",()=>this.K()),this.subEntry("fileInfo",()=>this.de()),this.subEntry("isUploading",()=>this.de()),this.subEntry("errors",()=>this.de()),this.Ia(),this.de();}La(t){if(this.cfg.filesViewMode==="list"){this.Jo=true;return}this.Jo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Pa(this.uid);}de(){let t=this.e.pluginManager;if(!t||!this.uid){this.wr=[];return}let e=t.snapshot().fileActions,o=this.api.getOutputItem(this.uid);if(!o){this.wr=[];return}this.wr=e.filter(s=>{try{return s.shouldRender(o)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}yd(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(o){console.error(`Error in plugin file action onClick (${t.id}):`,o);}}}initCallback(){super.initCallback(),this.Pa(this.uid),this.subConfigValue("filesViewMode",e=>{this.La(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.La(e);}),this.onclick=()=>{W.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Oa());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.de())),this.de(),W.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:[0,1]}),this.n.observe(this);}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback(),this.n?.disconnect(),W.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Ca?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Yo} ?data-uploading=${this.Qo} ?data-failed=${this.Xo} ?data-focused=${this.Aa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Zo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.ka}><span class="uc-file-name" data-testid="file-name" ?hidden=${!this.Jo}>${this.Go}</span><span class="uc-file-error" ?hidden=${!this.qo}>${this.qo}</span><span class="uc-file-hint" ?hidden=${!this.Wo}>${this.Wo}</span></div><div class="uc-file-actions">${this.wr.map(t=>v`<button type="button" @click=${()=>this.yd(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<uc-file-action-button @uc:remove=${this.ts} .uploading=${this.Qo} .hideRemove=${this.Sa} .progress=${this.wt} .failed=${this.Xo} .success=${this.Yo} ></uc-file-action-button></div></div>`}};p([m()],W.prototype,"Ca",2),p([y({attribute:false})],W.prototype,"uid",2),p([m()],W.prototype,"Go",2),p([m()],W.prototype,"qo",2),p([m()],W.prototype,"Wo",2),p([m()],W.prototype,"wt",2),p([m()],W.prototype,"md",2),p([m()],W.prototype,"Zo",2),p([m()],W.prototype,"Yo",2),p([m()],W.prototype,"Xo",2),p([m()],W.prototype,"Qo",2),p([m()],W.prototype,"Sa",2),p([m()],W.prototype,"Aa",2),p([m()],W.prototype,"Jo",2),p([m()],W.prototype,"ka",2),p([m()],W.prototype,"wr",2);var Ys=W;function Xd(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=o=>{o.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}function Qd(r,i){return new Promise(t=>{let e=0,o=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});o.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(o);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(o);});};s(r);})}function vl(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 l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(Qd(l,s).then(c=>{c&&i.push(...c);}));continue}let a=o.getAsFile();a&&t.push(Xd(a).then(l=>{l||i.push({type:"file",file:a});}));}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)}var dt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),yl=["focus"],Jd=100,Xs=new Map;function tp(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))}function Qs(r){let i=0,t=document.body,e=new Set,o=g=>{e.add(g);},s=dt.INACTIVE,n=g=>{r.shouldIgnore()&&g!==dt.INACTIVE||(s!==g&&e.forEach(w=>{w(g);}),s=g);},a=()=>i>0;o(g=>r.onChange(g));let l=()=>{i=0,n(dt.INACTIVE);},c=()=>{i+=1,s===dt.INACTIVE&&n(dt.ACTIVE);},d=()=>{i-=1,a()||n(dt.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(dt.INACTIVE);},h=g=>{if(r.shouldIgnore())return;a()||(i+=1);let w=[g.x,g.y],b=r.element.getBoundingClientRect(),E=Math.floor(tp(w,b)),S=E<Jd,N=g.composedPath().includes(r.element);Xs.set(r.element,E);let C=Math.min(...Xs.values())===E;N&&C?(g.preventDefault(),n(dt.OVER)):n(S&&C?dt.NEAR:dt.ACTIVE);},f=async g=>{if(r.shouldIgnore())return;g.preventDefault();let{dataTransfer:w}=g;if(!w)return;let b=await vl(w);r.onItems(b),n(dt.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),r.element.addEventListener("drop",f),yl.forEach(g=>{window.addEventListener(g,l);}),()=>{Xs.delete(r.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),r.element.removeEventListener("drop",f),yl.forEach(g=>{window.removeEventListener(g,l);});}}var Js=new Set,Et=class extends M{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.jt=true;this.Ra=true;this.es="drop-files-here";this.pe=false;this.$a=null;this.rs=null;this.Da=O();this.Ve=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.Fa=true;this._e=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ua(){let t=this.text;if(typeof t=="string"&&t.length>0){this.es=t;return}this.es=this.pe?"drop-files-here":"drop-file-here";}isActive(){if(!this.jt)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(),Js.add(this),this.os(),this.ss(),this.Na(),this.Va(dt.INACTIVE),this.$a=Qs({element:this,shouldIgnore:()=>this._a(),onChange:t=>{this.Va(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(o=>{o.type==="url"?this.api.addFileFromUrl(o.url,{source:R.DROP_AREA}):o.type==="file"&&this.api.addFileFromObject(o.file,{source:R.DROP_AREA,fullPath:o.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.bd()),this.subConfigValue("sourceList",t=>{let e=J(t);this.Fa=e.includes(R.LOCAL),this.os(),this.ss();}),this.subConfigValue("multiple",t=>{this.pe=!!t,this.Ua();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.os(),this.ss()),(t.has("text")||t.has("localeId"))&&this.Ua();}updated(t){super.updated(t),t.has("clickable")&&this.Na();}_a(){if(!this.jt||!this.wd())return true;if(!this.fullscreen)return false;let t=Js;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}wd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}os(){let t=this.Fa&&!this.disabled;this.jt=t;}ss(){let t=this.jt||!this.querySelector("[data-default-slot]");this.Ra=t,this.hidden=!t;}Va(t){let e=Object.entries(dt).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}bd(){if(this.rs)return;let t=this.Da.value;t&&(this.rs=Qs({element:t,onChange:e=>{let o=Object.entries(dt).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},onItems:()=>{},shouldIgnore:()=>this._a()}));}Na(){this.clickable&&!this._e?(this.addEventListener("keydown",this.Ve),this.addEventListener("click",this.Ve),this._e=true):!this.clickable&&this._e&&(this.removeEventListener("keydown",this.Ve),this.removeEventListener("click",this.Ve),this._e=false);}disconnectedCallback(){super.disconnectedCallback(),Js.delete(this),this.$a?.(),this.rs?.(),this._e&&(this.removeEventListener("keydown",this.Ve),this.removeEventListener("click",this.Ve),this._e=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${I(this.Da)} class="uc-content-wrapper" ?hidden=${!this.Ra} ><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.l10n(this.es)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],Et.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],Et.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],Et.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],Et.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],Et.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],Et.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],Et.prototype,"initflow",2),p([y({type:String})],Et.prototype,"text",2),p([m()],Et.prototype,"jt",2),p([m()],Et.prototype,"Ra",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.Ba=false;this.za=false;this.Ha=false;this.ns=false;this.as=false;this.Er=null;this.Ka=false;this.ls=null;this.ja=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.cs=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.Y();};this.us=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Nt=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Y=ge(()=>{this.isConnected&&(this.xd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get Ed(){return this.ls?this.Td(this.ls):""}xd(){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),a=t.allEntries.some(f=>f.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&l&&this.cfg.confirmUpload)c=true;else {d=true;let f=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&o&&l&&f;}this.Ba=d,this.za=u,this.Ha=c,this.as=e.total===0||!s&&!n,this.ns=!n||this.cfg.multiple,this.Ka=e.total>0,this.ls=e;}Td(t){let e=o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Y),this.subConfigValue("multipleMin",this.Y),this.subConfigValue("multipleMax",this.Y),this.sub("*groupInfo",t=>{t&&this.Y();}),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.Y),this.uploadCollection.observeCollection(this.Y),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Er=null;return}this.Er=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Y),this.uploadCollection.unobserveCollection(this.Y));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Ed}</span><button type="button" class="uc-mini-btn uc-close-btn" data-testid="close" @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.Ka}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Vi(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" data-testid="add-more" @click=${this.ja} ?disabled=${!this.as} ?hidden=${!this.ns} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Er} >${this.Er??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.ns} ?disabled=${!this.as} @click=${this.ja} ><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.Ha} @click=${this.cs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Ba} ?disabled=${!this.za} @click=${this.us} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([m()],Lt.prototype,"Ba",2),p([m()],Lt.prototype,"za",2),p([m()],Lt.prototype,"Ha",2),p([m()],Lt.prototype,"ns",2),p([m()],Lt.prototype,"as",2),p([m()],Lt.prototype,"Er",2),p([m()],Lt.prototype,"Ka",2),p([m()],Lt.prototype,"ls",2);var ep=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>!!r.authToken&&(!!r.secureSignature||!!r.secureExpire||!!r.secureUploadsSignatureResolver),message:"Both `authToken` and `secureSignature`/`secureExpire`/`secureUploadsSignatureResolver` parameters are set.\nThe `authToken` will be used and the secure signature will be ignored."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],bl=F(r=>{for(let{test:i,message:t}of ep)i(r)&&oo(t);},0);var wl=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var tn=r=>r,ip=[tn({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{let t=i();if(t===null)return r();let e=Z(r());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(o=>o!=="video")),jt(e)}}),tn({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{let t=i();if(t===null)return r();let e=Z(r());return e=e.sort((o,s)=>o===t?-1:s===t?1:0),jt(e)}}),tn({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>{let e=r(),o=i(),s=t();return e&&(o===Ti||He(o,s))?Sr(e,s):o}})],El=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of ip){if(!o.deps.includes(r))continue;let s={[o.key]:()=>t(o.key)};for(let l of o.deps)s[l]=()=>t(l);let n=new AbortController;e.get(o.fn)?.abort(),e.set(o.fn,n);let a;try{a=o.fn(s,{signal:n.signal});}catch(l){e.get(o.fn)===n&&e.delete(o.fn),console.error(`Failed to compute value for "${o.key}"`,l);return}wl(a)?a.then(l=>{n.signal.aborted||i(o.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,l);}).finally(()=>{e.get(o.fn)===n&&e.delete(o.fn);}):i(o.key,a);}};var _=r=>String(r),it=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},z=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}"`)},Tl=r=>r==="auto"?r:z(r),Cl=r=>{let i=_(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},xl=r=>{let i=_(r);if(!Object.values(P).includes(i))throw new Error(`Invalid value: "${i}"`);return i},Sl=r=>{let i=_(r),t=Z(i);if(t.some(e=>!Object.values(P).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Al=r=>{let i=_(r);if(i==="local"||i==="global")return i;if(z(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},kl=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.")},Ml=r=>{if(Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid tags value. Must be an array or function.")},Ol=r=>{if(typeof r=="string"||typeof r=="function")return r;throw new Error("Invalid authToken value. Must be a string or function.")},en=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},yo=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},bo=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},Il=r=>{let i=_(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},Ll=r=>{let i=_(r);if(["auto","menu","toolbar","compact","plain"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var rp={pubkey:_,multiple:z,multipleMin:it,multipleMax:it,confirmUpload:z,imgOnly:z,accept:_,externalSourcesPreferredTypes:_,externalSourcesEmbedCss:_,store:Tl,cameraMirror:z,cameraCapture:Cl,sourceList:_,topLevelOrigin:_,maxLocalFileSizeBytes:it,thumbSize:it,showEmptyList:z,useLocalImageEditor:z,useCloudImageEditor:z,cloudImageEditorTabs:_,removeCopyright:z,cropPreset:_,imageShrink:_,modalScrollLock:z,modalBackdropStrokes:z,sourceListWrap:z,remoteTabSessionKey:_,cdnCname:_,cdnCnamePrefixed:_,baseUrl:_,socialBaseUrl:_,secureSignature:_,secureExpire:_,secureDeliveryProxy:_,retryThrottledRequestMaxTimes:it,retryNetworkErrorMaxTimes:it,multipartMinFileSize:it,multipartChunkSize:it,maxConcurrentRequests:it,multipartMaxConcurrentRequests:it,multipartMaxAttempts:it,checkForUrlDuplicates:z,saveUrlForRecurrentUploads:z,groupOutput:z,userAgentIntegration:_,debug:z,localeName:_,metadata:kl,tags:Ml,secureUploadsExpireThreshold:it,localeDefinitionOverride:r=>en(r),secureUploadsSignatureResolver:r=>yo(r),authToken:Ol,secureDeliveryProxyUrlResolver:r=>yo(r),iconHrefResolver:r=>yo(r),plugins:r=>bo(r),fileValidators:bo,collectionValidators:bo,validationTimeout:it,validationConcurrency:it,cameraModes:Sl,defaultCameraMode:xl,enableAudioRecording:z,enableVideoRecording:z,mediaRecorderOptions:en,maxVideoRecordingDuration:it,filesViewMode:Il,gridShowFileNames:z,cloudImageEditorAutoOpen:z,cloudImageEditorMaskHref:_,testMode:z,qualityInsights:z,pasteScope:Al,dynamicButtonShowFirstIcon:z,dynamicButtonViewMode:Ll},Pl=(r,i)=>{if(!(typeof i>"u"||i===null))try{return rp[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),et[r]}};var wo=[...new Set(["debug",...Object.keys(et)])],op={metadata:{attribute:false},tags:{attribute:false},plugins:{attribute:false},localeDefinitionOverride:{attribute:false},secureUploadsSignatureResolver:{attribute:false},secureDeliveryProxyUrlResolver:{attribute:false},iconHrefResolver:{attribute:false},fileValidators:{attribute:false},collectionValidators:{attribute:false},mediaRecorderOptions:{attribute:false},authToken:{reflect:false}},Ul=r=>op[r]??{},$l=r=>Ul(r).attribute===false,sp=r=>Ul(r).reflect!==false,on=wo.filter(r=>!$l(r)),rn={...Object.fromEntries(on.map(r=>[Cr(r),r])),...Object.fromEntries(on.map(r=>[r.toLowerCase(),r]))},Rl=r=>`__${r}`,ai=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(et).map(([t,e])=>[x(t),e]))};this.Cd=new Map;this.vi={};this.Ga=new Set;this.Be=new Map;}ds(t){return this.Ga.has(t)}ps(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}hs(t){return [...new Set([Cr(t),t.toLowerCase()])]}Sd(t,e){return this.ds(t)?this.ps(t)?.attribute!==false:$l(t)||!sp(t)?false:typeof e!="function"}Ad(t,e){if(!this.Sd(t,e))return;let o=this.hs(t);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){let o=x(t);if(this.$[o]!==e)if(typeof e>"u"||e===null){let s=et[t];this.$[o]=s!==void 0?s:e;}else this.$[o]=e;}Zt(t,e){let o;if(this.ds(t)){let a=this.ps(t);try{o=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else o=Pl(t,e);let s=this,n=Rl(t);s[n]!==o&&(this.Md(t,s[n],o),s[n]=o,this.Ad(t,o),this.kd(t,o),this.debugPrint(`"${t}"`,ka(t)?Cs:o),this.ds(t)||bl(this.cfg));}xr(t){let e=this,o=Rl(t);return e[o]??this.$[x(t)]}Md(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));}qa(t){let e=t.configRegistry.getAll();this.vi={},this.Ga=new Set(e.keys());for(let[o,s]of this.Be)e.has(o)||(s(),this.Be.delete(o));for(let[o,s]of e){let a=x(o);if(s.attribute){let f=this.hs(o);for(let g of f)this.vi[g]=o;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,o);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&s.attribute)for(let f of this.hs(o)){let g=this.getAttribute(f);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(w){console.warn(`[uc-config] fromAttribute() for "${o}" threw an error, using raw attribute value`,w),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,o);if((!h||!h.set||!h.get)&&Object.defineProperty(this,o,{set:f=>{this.Zt(o,f);},get:()=>this.xr(o),enumerable:true,configurable:true}),!this.Be.has(o)){let f=this.sub(a,g=>{this.Zt(o,g);},false);this.Be.set(o,f);}c&&this.Zt(o,l);}}Od(){this.e.when("pluginManager",t=>{this.qa(t),this.Tr=t.onPluginsChange(()=>{this.qa(t);});});}Id(){this.gi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let o=e.attributeName,s=e.oldValue,n=this.getAttribute(o);if(s===n||o in rn)continue;if(o in this.vi){let l=this.vi[o],c=this.ps(l);this.attributeChangedCallback(o,s??"",n??c?.defaultValue??"");}}}),this.gi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Od(),this.Id();for(let o of on)this.sub(x(o),s=>{this.Zt(o,s);},false);for(let o of wo){let s=t[o]??this.$[x(o)];s!==et[o]&&this.Zt(o,s);let n=Object.getOwnPropertyDescriptor(this,o);(!n||!n.set||!n.get)&&Object.defineProperty(this,o,{set:a=>{this.Zt(o,a);},get:()=>this.xr(o)});}let e=o=>{El({key:o,setValue:this.Zt.bind(this),getValue:this.xr.bind(this),computationControllers:this.Cd});};for(let o of wo)this.sub(x(o),()=>e(o));}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=rn[t];n?s[n]=o:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==o)return;let c=this.vi[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(o):o;if(this.xr(c)===u)return;this.Zt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.Tr&&(this.Tr(),this.Tr=void 0),this.gi&&(this.gi.disconnect(),this.gi=void 0);for(let t of this.Be.values())t();this.Be.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(rn);return [...t,...e]}};for(let r of wo)ai.prototype[r]=void 0;var Ni=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.yi="upload-file";this.fs=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.yi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.fs}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.yi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Ni.prototype,"dropzone",2),p([m()],Ni.prototype,"yi",2);var Dl=r=>dl(r)?r.zt.h:r.strings,Ue=ct(class extends ft{constructor(r){super(r),this.et=new WeakMap;}render(r){return [r]}update(r,[i]){let t=_s(this.it)?Dl(this.it):null,e=_s(i)?Dl(i):null;if(t!==null&&(e===null||t!==e)){let o=Pi(r).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=pr(U,n),s.setConnected(false),this.et.set(t,s);}Li(s,[o]),te(s,void 0,o);}if(e!==null){if(t===null||t!==e){let o=this.et.get(e);if(o!==void 0){let s=Pi(o).pop();hl(r),te(r,void 0,s),Li(r,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var ve=class ve extends M{constructor(){super(...arguments);this.showIcon=false;this.pe=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.DEFAULT_ICON="upload";}static{this.SOURCE_TEXT_CONFIG={[R.LOCAL]:{action:"upload-from"},[R.URL]:{action:"upload-from"},[R.CAMERA]:{action:"capture-with"},[R.MOBILE_PHOTO_CAMERA]:{action:"take"},[R.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.pe=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}bi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.Pd();return t||(this.source?this.Ld():this.l10n(this.pe?"upload-files":"upload-file"))}Pd(){if(this.entries?.status==="uploading")return this.bi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.bi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.bi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.bi("header-total",{count:this.entries?.totalCount??0})}Ld(){if(!this.source?.id)return "";let e=ve.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",o;return this.source.id===R.MOBILE_PHOTO_CAMERA?o=this.l10n("photo").toLowerCase():this.source.id===R.MOBILE_VIDEO_CAMERA?o=this.l10n("video").toLowerCase():o=this.localizedSourceLabel,this.bi(e,{source:o})}fs(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}if(!this.source){this.api.initFlow();return}this.source.onClick();}Rd(){if(!this.pe&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.pe&&this.hasMultipleEntries)return null;if(!this.source)return v`<uc-icon .name=${ve.DEFAULT_ICON}></uc-icon>`;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button type="button" @click=${this.fs} aria-label=${this.textBasedOnLocale}>${this.Rd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],ve.prototype,"source",2),p([y({type:Object})],ve.prototype,"entries",2),p([m()],ve.prototype,"showIcon",2),p([m()],ve.prototype,"pe",2);var sn=ve;var Eo=class extends T{constructor(){super(...arguments);this.Wa=nt.generateFastUid();this.Ud=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Wa} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Wa} class="uc-dropdown-content" popover="auto" @click=${this.Ud}>${this.yield("dd-content")}</div>`}};p([m()],Eo.prototype,"Wa",2);var nn=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var np=(r,i)=>i==="compact"||i==="plain"||r.length===0?{main:null,remain:r}:{main:r[0]??null,remain:r.slice(1)},Fl={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},ap=3,Pt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Yt="auto";this.S=[];this.ze="idle";this.Ya=0;this.ms="arrow-dropdown";this.Y=ge(()=>{this.isConnected&&this.$d();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.ze==="idle"}get isSuccess(){return this.ze==="success"}get isFailed(){return this.ze==="failed"}get isUploading(){return this.ze==="uploading"}get isCollapsedMode(){return this.Yt==="compact"}get isPlainMode(){return this.Yt==="plain"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.S.length>1&&(this.Yt==="toolbar"||this.Yt==="auto"&&this.S.length<=ap)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.S.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.S.length===1}get hasCollectionEntries(){return (this.Sr?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}$d(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Sr=t,this.ze=t.status;}Xa(){this.Cr=np(this.S,this.Yt);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.Yt!==t&&(this.Yt=t,this.Xa());}),this.sub("*commonProgress",t=>{this.Ya=t;}),new oi(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.S=t,this.Xa();}}),this.uploadCollection.observeProperties(this.Y),this.uploadCollection.observeCollection(this.Y),this.Za=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.modalManager?.open(D.UPLOAD_LIST),true;if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.Y.cancel=="function"&&this.Y.cancel(),this.Za?.(),super.disconnectedCallback(),this.ms="arrow-dropdown";}Dd(){return v`<uc-no-wrap-mode-dynamic-btn>${this.Cr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t}></uc-source-btn>`)}</uc-no-wrap-mode-dynamic-btn>`}willUpdate(t){super.willUpdate(t),t.has("_mode")&&(this.ms=Fl[this.Yt]??"arrow-dropdown");}Fd(){this.uploadCollection.clearAll();}Nd(){this.Sr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Vd(){this.uploadCollection.abortAll();}ts(){switch(this.ze){case "failed":this.Nd();break;case "uploading":this.Vd();break;default:this.Fd();}}_d(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.ms}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.Cr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Bd(){let t=this.S[0],e=t&&{...t,icon:Fl.compact};return v`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}zd(){return v`<uc-primary-action .entries=${this.Sr} .source=${this.Cr?.main} ></uc-primary-action>`}Hd(){return v`<uc-file-action-button @uc:remove=${this.ts} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ya} ></uc-file-action-button>`}Kd(){return ut({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}jd(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Kd()}>${Ue(this.shouldShowPrimaryAction?this.zd():null)} ${Ue(!this.isPlainMode&&this.shouldShowInline?this.Dd():null)} ${Ue(!this.isPlainMode&&this.shouldShowCompactSingleSource?this.Bd():null)} ${Ue(!this.isPlainMode&&this.shouldShowDropdown?this._d():null)} ${Ue(this.shouldShowAbortAction||this.hasCollectionEntries?this.Hd():null)} ${Ue(this.jd())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Pt.prototype,"dropzone",2),p([m()],Pt.prototype,"Yt",2),p([m()],Pt.prototype,"S",2),p([m()],Pt.prototype,"ze",2),p([m()],Pt.prototype,"Cr",2),p([m()],Pt.prototype,"Sr",2),p([m()],Pt.prototype,"Ya",2),p([m()],Pt.prototype,"ms",2);var _i=class extends ${constructor(){super(...arguments);this.vs=O();}initCallback(){this.activityType=this.registration?.id??null,this.Qa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Qa(),this.isActivityActive&&(this.Ar(),this.Ja()));}Qa(){this.registration&&(this.Jn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Ja(),onDeactivate:()=>this.Ar()}));}async Ja(){await this.updateComplete;let t=this.vs.value;if(!t||!this.registration)return;this.Ar();let e=this.$["*currentActivityParams"];try{this.gs=this.registration.render(t,e)??void 0;}catch(o){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,o);}}Ar(){let t=this.vs.value;if(t){try{this.gs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.gs=void 0,t.replaceChildren();}}disconnectedCallback(){this.Ar(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${I(this.vs)}></div>`}};p([y({attribute:false})],_i.prototype,"registration",2);var li=class extends T{constructor(){super(...arguments);this.mode="modal";this.kt=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.tl())),this.tl();}tl(){let t=this.e.pluginManager;if(!t){this.kt=[];return}this.kt=t.snapshot().activities;}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Vi(this.kt,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Vi(this.kt,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],li.prototype,"mode",2),p([m()],li.prototype,"kt",2);function Bi(r,i,t){return r?i(r):t?.(r)}function Vl(...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},{})}function Tt(...r){let i=Vl(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Nl(r,...i){let t=Vl(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var lp=r=>lt.includes(r),_l=r=>{if(!r)return lt;let i=Z(r).filter(lp);return i.length===0?lt:i};function Bl(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":lt,"*tabId":j.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=It,t.src=e;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=at(ae(i),"preview"),o=Q(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.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var zl="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var $e={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ci=class extends T{constructor(){super(...arguments);this.Ot=false;this.il=$e;this.rl=$e.visible;this.ol=$e.hidden;this.ys=false;this.sl=false;}set visible(t){this.Ot=t,this.nl();}get visible(){return this.Ot}set styles(t){this.il=t,this.ys=true,this.rl=t.visible??$e.visible,this.ol=t.hidden??$e.hidden;}get styles(){return this.il}nl(){this.style.visibility=this.Ot?"inherit":"hidden",Nl(this,{[$e.transition]:!this.ys,[this.rl]:this.Ot,[this.ol]:!this.Ot}),this.toggleAttribute("inert",!this.Ot);}Gd(){this.sl||(this.sl=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ys||this.classList.add($e.transition),this.nl(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Gd();},0);}};p([y({type:Boolean})],ci.prototype,"visible",1),p([y({attribute:false})],ci.prototype,"styles",1);var zi=class extends T{constructor(){super(...arguments);this.active=false;this.he=O();this.bs=false;this.Es=()=>{let t=this.he.value;t&&(this.al(t),this.bs&&this.active&&this.Ts());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Ts();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Ts():this.qd());}Ts(){let t=this.he.value;if(!t)return;this.bs=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Es),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Es,{once:true});}qd(){let t=this.he.value;t&&(this.bs=false,t.removeEventListener("transitionend",this.Es),this.al(t));}al(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${I(this.he)}></div></div>`}};p([y({type:Boolean,reflect:true})],zi.prototype,"active",2);var X=r=>r??U;var At=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.ll(),this.cl();}updated(t){super.updated(t),t.has("reverse")&&this.ll(),t.has("theme")&&this.cl();}ll(){this.style.flexDirection=this.reverse?"row-reverse":"";}cl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Wd(){let t=this.xs;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Zd}}get xs(){return !this.icon}get Zd(){return !this.text&&!this.xs}render(){return v`<button type="button" role=${X(this.ariaRole||void 0)} aria-controls=${X(this.ariaControls||void 0)} aria-label=${X(this.l10n(this.titleProp))} title=${X(this.l10n(this.titleProp))} ><uc-icon class=${ut(this.Wd)} name=${X(this.icon||void 0)} ?hidden=${this.xs} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function Hl(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}function ui(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return Q(r,at(wr,ae(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Dt}/${Ft}/uc-cloud-image-editor/`))}var Hi=class extends T{constructor(){super(...arguments);this.ul=`uc-backdrop-mask-${nt.generateFastUid()}`;this.Mr=false;this.xi=false;this.hl=O();this.Ci=false;this.Si=null;this.ml=t=>{this.gl(),this.Ai&&(t.stopPropagation(),t.preventDefault(),this.Ai=false);};this.vl=t=>{if(!this.Ai||!this.kr||!this.Ss)return;t.stopPropagation(),t.preventDefault();let e=this.Xt;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,a=t.y-s,l=n-this.kr[0],c=a-this.kr[1],{direction:d}=this.Ss,u=this.op(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.yl=t=>{if(!this.Vt)return;let e=Object.values(this.Vt).find(o=>{if(!o||this.ks(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Ja(a,[t.x,t.y])});this.dl=e,this.gl();};}get Xt(){return this.hl.value??null}get Ai(){return this.xi}set Ai(t){this.xi!==t&&(this.xi=t,this.As());}As(){this.Ei&&this.Ei.setAttribute("class",Tt({"uc-guides--hidden":this.Mr,"uc-guides--visible":!this.Mr&&this.xi,"uc-guides--semi-hidden":!this.Mr&&!this.xi}));}ks(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let o=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return o||s}Yd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,a=this.Xt;if(!a)return;let l=wt("mask",{id:this.ul}),c=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=wt("rect",{x:e,y:o,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.ul})`});a.appendChild(u),a.appendChild(l),this.wi=l,this.Cs=d;}Xd(){this.wi&&(this.wi.style.display="none",window.requestAnimationFrame(()=>{this.wi&&(this.wi.style.display="block");}));}Qd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this.Cs&&de(this.Cs,{x:e,y:o,width:s,height:n});}Jd(){let t=this.$["*cropBox"];if(!(!t||!this.Ei||!this.Vt)){for(let e of Object.values(this.Vt)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:a}=e,l=o==="",c=o.length===2,{x:d,y:u,width:h,height:f}=t;if(l)de(n,{x:d,y:u,width:h,height:f});else {let w=pe(Math.min(h,f)/82/2,0,1),b=c?Wa(t,o,w):Za(t,o,w),E=b.center;if(!E)continue;let S=Math.max(Rs*pe(Math.min(h,f)/Rs/3,0,1),qa);de(n,{x:E[0]-S,y:E[1]-S,width:S*2,height:S*2}),de(s,{d:b.d});}let g=this.ks(o);a.setAttribute("class",Tt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}de(this.Ei,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}fl(t,e){let o=wt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=wt("rect",{fill:"transparent"}),n=wt("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.tp.bind(this,e));}ep(){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.fl(t,s);}return this.fl(t,""),t}ip(){let t=wt("svg"),e=wt("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=wt("line",{x1:`${Oi*o}%`,y1:"0%",x2:`${Oi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=wt("line",{x1:"0%",y1:`${Oi*o}%`,x2:"100%",y2:`${Oi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}rp(){let t=this.Xt;if(!t)return;let e=document.createDocumentFragment(),o=this.ip();e.appendChild(o);let s=this.ep();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Vt=s,this.Ei=o,this.As();}tp(t,e){if(!this.Vt)return;let o=this.Vt[t];if(!o||this.ks(t))return;let s=this.$["*cropBox"],n=this.Xt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Ai=true,this.Ss=o,this.kr=[c,d],this.pl={...s};}op(t,e){let[o,s]=e,n=this.$["*imageBox"],a=this.pl??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Xa({rect:a,delta:[o,s],imageBox:n}):a=Qa({rect:a,delta:[o,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Xe(Je(a),n)}gl(){let t=this.dl,e=this.Xt;e&&(e.style.cursor=t?Ya(t.direction):"initial");}bl(t){if(this.Ti){this.Ti.setAttribute("href",t);return}let e=this.Xt;if(!e){this.Si=t;return}this.Si=null;let o=document.createDocumentFragment(),s=wt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.Ti=s;}sp(){let t=this.$["*cropBox"];if(!t||!this.Ti)return;let{x:e,y:o,width:s,height:n}=t;de(this.Ti,{x:e,y:o,height:n,width:s});}Ms(){this.Ci&&(this.Qd(),this.Jd(),this.sp());}toggleThumbs(t){if(this.Vt)for(let e of Object.values(this.Vt)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",Tt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Xd(),this.Ci&&window.requestAnimationFrame(()=>{this.Ms();});}),this.sub("*cropBox",t=>{t&&(this.Mr=t.height<=k||t.width<=k,this.As(),this.Ci&&window.requestAnimationFrame(()=>{this.Ms();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.bl(t);}),document.addEventListener("pointermove",this.vl,true),document.addEventListener("pointerup",this.ml,true);}firstUpdated(t){super.firstUpdated(t),this.np();}np(){let t=this.Xt;if(!(!t||this.Ci)){if(this.Yd(),this.rp(),this.Ci=true,t.addEventListener("pointermove",this.yl,true),this.Si){let e=this.Si;this.Si=null,this.bl(e);}this.Ms();}}disconnectedCallback(){super.disconnectedCallback(),this.Xt?.removeEventListener("pointermove",this.yl,true),document.removeEventListener("pointermove",this.vl,true),document.removeEventListener("pointerup",this.ml,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${I(this.hl)}></svg>`}};p([m()],Hi.prototype,"xi",2);function up(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}var Ki=class extends T{constructor(){super();this.ctxOwner=true;this.fe={width:0,height:0};this.r=null;this.q=false;this.Et=null;this.El=O();this.Is=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.wl=F(this.Tl.bind(this),300),this.Os=ge(()=>{!this.isConnected||!this.q||(this.Ps(),this.xl(),this.Cl(),this.Ls(),this.Rs());},100);}firstUpdated(t){super.firstUpdated(t),this.Ps();}xl(){let t=this.$["*editorTransformations"],e=Hl(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}Ps(){let t=this.El.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.It=t,this.r=e;}Cl(){if(!this.q||!this.Et)return;let t=this.Et,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},a=Qe({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,g=e+(n.height-e*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,g=0+e;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Je(l);}Ls(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[g,w]}=n,{width:b}=Qe(this.fe,s),E=a/b;t=Xe(Je({x:l+g*E,y:c+w*E,width:h*E,height:f*E}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!tl(t,e)||u&&!el(t,u)){let h=e.width/e.height,f=e.width,g=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=Xe(Je(t),e);}ap(){let t=this.r;if(!t)return;let e=this.Et;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Qe({width:o.width,height:o.height},l);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Rs(){if(!this.q||!this.Et||!this.It||!this.r)return;let t=this.It;this.r.clearRect(0,0,t.width,t.height),this.ap();}lp({fromViewer:t}){this.Et&&(this.Is.value?.toggleThumbs(true),this.cp(),setTimeout(()=>{this.className=Tt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Sl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a}=e,{width:l,height:c}=Qe(this.fe,s),{width:d,height:u}=t,h=n/l,f=a/c;return [pe(Math.round(d/h),1,l),pe(Math.round(u/f),1,c)]}up(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Qe(this.fe,s),{x:h,y:f}=t,g=n/d,w=a/u,b=this.Sl(),E={dimensions:b,coords:[pe(Math.round((h-l)/g),0,d-b[0]),pe(Math.round((f-c)/w),0,u-b[1])]};if(!up(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(b[0]===d&&b[1]===u))return E}Tl(){if(!this.isConnected||!this.fe)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.up(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.q&&(this.Cl(),this.Ls(),this.Rs());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.q){this.q=true,await this.updateComplete,this.Ps(),this.fe=t,this.removeEventListener("transitionend",this.Al);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.Et=await this.dp(o,s),this.xl(),this.Os(),this.lp({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.n=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.q&&this.Et&&this.Os();}),this.n.observe(this);}}deactivate({reset:t=false}={}){this.q&&(!t&&this.Tl(),this.q=false,this.pp(),this.className=Tt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Is.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Al,{once:true}),this.n?.disconnect());}pp(){let t=this.Sl(),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),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}cp(){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`;}Al(){this.q||(this.Et=null);}async dp(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(ui(t,o,e)),{promise:n,cancel:a,image:l}=Re(s),c=this.He(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this._?.(),this._=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}He(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.Rs();}),this.sub("*cropBox",()=>{this.Et&&this.wl();}),this.sub("*currentAspectRatio",()=>{this.Ls();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.q&&this.fe&&this.activate(this.fe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.n?.disconnect(),this.Et&&(this.Et=null);}render(){return v`<canvas class="uc-canvas" ${I(this.El)}></canvas><uc-crop-frame ${I(this.Is)}></uc-crop-frame>`}};p([m()],Ki.prototype,"Et",2);function an(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}function dp(r){return typeof r=="string"&&r in Ot}function pp(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}function hp(r,i,t){let e=pp(r).find(([n,a])=>n<=i&&i<=a);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let a=Math.abs(o-s)||1,l=Math.abs(i-o)/a;return o===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function fp(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function Kl(r,i){let t=Ot[r].keypointsNumber,{range:e,zero:o}=Ot[r];return [...new Set([...an(e[0],o,t+1),...an(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}var To=class extends T{constructor(){super();this.q=false;this.Us=true;this.a="initial";this.kl={};this.Qt=[];this.Ml=0;this.Il=O();this.Or=O();this.classList.add("uc-inactive_to_cropper"),this.Ol=F(async(t,e,o)=>{let s=()=>!this.Pl(t,e)||this.Ne!==o||!!this.Qt.find(c=>c.value===o);if(s())return;let n=await this.Ll(t,o),a=new Image;a.src=n.src;let l=this.He(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Qt,d=c.findIndex(g=>g.value>o);d===-1&&(d=c.length);let h=c[d]?.image,f=this.Or.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.Fs(t,o));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}He(t){let e=this.a,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);}}Rl(){window.cancelAnimationFrame(this.Ml),this.Ml=window.requestAnimationFrame(()=>{for(let t of this.Qt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}me({url:t=this.Ke,filter:e=this.b??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.kl};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let a=this.offsetWidth;return this.proxyUrl(ui(t,a,n))}async Ll(t,e){return {src:await this.me({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Pl(t,e){return this.a===t&&this.b===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!dp(this.a)||!Number.isFinite(e)||(this.Fs(this.a,e),this.Ol(this.a,this.b,e));}Fs(t,e){this.a=t,this.Ne=e;let{zero:o}=Ot[t],s=this.Qt.map(l=>l.value),n=hp(s,e,o),a=fp(s,o);this.Qt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Rl();}Ul(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async hp(){this.c=this.c||this.Ul();let t=this.c;t&&this.$l(t);let e=this.Qt.map(c=>c.src),{images:o,promise:s,cancel:n}=Fi(e);o.forEach(c=>{let d=this.He(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.$s=()=>{n(),this.$s=void 0;};let a=this.a,l=this.b;if(await s,this.q&&this.Pl(a,l)){let c=this.Or.value;if(!c)return;c.replaceChildren(),this.Qt.forEach((d,u)=>{let h=o[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Rl();}}async setTransformations(t){if(this.kl=t,this.c){let e=await this.me(),o=this.He(e);this.c.src=e,this.c.addEventListener("load",o,{once:true}),this.c.addEventListener("error",o,{once:true}),this.c.style.opacity="1",this.c.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Ds?.();let n=Kl(o,s),a=await Promise.all(n.map(c=>this.me({url:t,filter:e,operation:o,value:c}))),{cancel:l}=Fi(a);this.Ds=l;}fp(t){let e=this.c||this.Ul();if(this.$l(e),this.c=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Tt({"uc-active_from_viewer":this.ki,"uc-active_from_cropper":!this.ki,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.He(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=Tt({"uc-active_from_viewer":this.ki,"uc-active_from_cropper":!this.ki,"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.q=true,this.Us=false,await this.updateComplete,this.Ke=t,this.a=e??"initial",this.Ne=o,this.b=s,this.ki=n,typeof o!="number"&&!s){let l=await this.me({operation:e,value:o});this.fp(l),this.Ns();return}!e||typeof o!="number"||(this.Qt=await Promise.all(Kl(e,o).map(l=>this.Ll(e,l))),this.Fs(e,o),this.hp());}deactivate({hide:t=true}={}){this.q=false,this.$s?.(),this.Ds?.(),t&&!this.Us?(this.Us=true,this.c&&(this.c.style.transform="scale(1)"),this.className=Tt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ns();},{once:true})):this.Ns();}$l(t){let e=this.Il.value;e&&(e.contains(t)||e.appendChild(t));}Ns(){this.Or.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${I(this.Il)}></div><div class="uc-fader-layers-host" ${I(this.Or)}></div>`}};var Bt=class extends T{constructor(){super();this.Vs=0;this.Ir=O();this.Fl=O();this.Nl=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Jt=0;this.gp=t=>{t.stopPropagation();let e=this.Vl(t);e!==null&&(this._s(e),this.mp("slider-input",e));};this.vp=t=>{t.stopPropagation();let e=this.Vl(t);e!==null&&this._s(e);};this._l=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Bl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}mp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Vs=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.zl(this.Jt),this.Bs(),this.n=new ResizeObserver(()=>{this.Bs(),this.Pr(this.Jt);}),this.n.observe(this);let e=this.Ir.value;e?.addEventListener("focus",this._l),e?.addEventListener("blur",this.Bl),window.setTimeout(()=>{this.Pr(this.Jt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Jt&&this._s(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Bs(),this.Pr(this.Jt)),t.has("zero")&&this.hasUpdated&&this.Hl(this.Jt);}Pr(t){this.Hl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(o-this.Vs)/100;window.requestAnimationFrame(()=>{let l=this.Fl.value;l&&(l.style.transform=`translateX(${a}px)`);});}Hl(t){if(!this.Mi)return;let e=this.max-this.min;if(e===0)return;this.Mi.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(o-this.Vs)/100;window.requestAnimationFrame(()=>{this.Mi&&(this.Mi.style.transform=`translateX(${a}px)`);});}Bs(){let e=this.Nl.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.Dl===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Mi=d,e.innerHTML="",e.appendChild(a),this.Dl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ir.value;t?.removeEventListener("focus",this._l),t?.removeEventListener("blur",this.Bl),this.n?.disconnect(),this.n=void 0;}_s(t){Number.isFinite(t)&&(this.Jt=t,this.hasUpdated&&(this.zl(t),this.Pr(t)));}zl(t){let e=this.Ir.value;e&&(e.value=String(t));}Vl(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return v`<div class="uc-steps" ${I(this.Nl)}></div><div class="uc-thumb" ${I(this.Fl)}></div><input class="uc-input" type="range" ${I(this.Ir)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Jt)} ?disabled=${this.disabled} @input=${this.gp} @change=${this.vp} />`}};p([y({type:Boolean,reflect:true})],Bt.prototype,"disabled",2),p([y({type:Number})],Bt.prototype,"min",2),p([y({type:Number})],Bt.prototype,"max",2),p([y({type:Number,attribute:false})],Bt.prototype,"defaultValue",2),p([y({type:Number})],Bt.prototype,"zero",2),p([m()],Bt.prototype,"Jt",2);var zt="original",ji=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.zs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.yp();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===zt?void 0:this.state.value,filter:this.state.filter===zt?void 0:this.state.filter,fromViewer:false});}yp(){let t=this.state.operation,{range:e,zero:o}=Ot[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:o;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===zt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.zs} ></uc-slider-ui>`}};p([m()],ji.prototype,"state",2);function di(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)}}var pt=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Kl(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Kl();}updated(t){super.updated(t),t.has("active")&&this.Kl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([m()],pt.prototype,"active",2),p([m()],pt.prototype,"title",2),p([m()],pt.prototype,"icon",2),p([m()],pt.prototype,"titleProp",2);var Co=12,xo=16,mp=r=>{let i=12,t=12;return r.width/r.height>=1?(i=Co,t=Math.round(Co*r.height/r.width)):(t=Co,i=Math.round(Co*r.width/r.height)),{width:i,height:t}},So=class extends pt{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.bp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}bp(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Gi=class extends pt{constructor(){super(...arguments);this.pt=null;}get aspectRatio(){return this.pt}set aspectRatio(t){if(this.pt===t)return;let e=this.pt;this.pt=t,this.requestUpdate("aspectRatio",e),t?this.jl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.pt&&this.jl(this.pt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.pt?.id||t?.width===this.pt?.width&&t?.height===this.pt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.pt?.id&&(this.$["*currentAspectRatio"]=this.pt);}jl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};o(),s(),e||this.requestUpdate();}wp(){let t=this.pt;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=mp(t),s=(xo-e)/2,n=(xo-o)/2;return v`<uc-icon><svg viewBox="0 0 ${xo} ${xo}" 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 v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} >${this.wp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Gi.prototype,"aspectRatio",1);function gp(r){let i=r+90;return i=i>=360?0:i,i}function vp(r,i){if(r==="rotate")return gp(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var qi=class extends pt{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=vp(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};p([y({type:String})],qi.prototype,"operation",2);var re=class extends pt{constructor(){super(...arguments);this.a="";this.b="";this.Oi="";this.Lr=0;this.c=null;this.Ge=false;this.isOriginal=false;this.Gl=20;}get filter(){return this.b}set filter(t){let e=t??"";if(this.b===e)return;let o=this.b;this.b=e,this.a="filter",this.isOriginal=e===zt,this.icon=this.isOriginal?"original":"slider",this.Gl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.ql(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.a,this.b),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.a,this.b),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:di(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.b;}Ep(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Gl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.a]=this.b!==zt?{name:this.b,amount:a}:void 0,Q(this.Oi,at(wr,ae(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Dt}/${Ft}/uc-cloud-image-editor/`))}async mi(t,e){t[0]?.isIntersecting?await this.Hs(e):this._?.();}initCallback(){super.initCallback(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Oi=t??"",this.sub("*originalUrl",e=>{this.Oi=e??"",!this.isOriginal&&this.Oi&&this.isConnected&&!this.c&&(this.n?.observe(this),this.ge());}),this.isOriginal||(this.n?.observe(this),this.ge()),this.b&&this.ql(this.b),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.b);}),this.sub("*networkProblems",async e=>{e||(this.c?await this.Hs():this.ge());});}disconnectedCallback(){super.disconnectedCallback(),this.n?.disconnect(),this._?.(),this.Rr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.n?.unobserve(this):(this.n?.observe(this),this.ge()));}ql(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Hs(t){if(!this.isConnected){t?.unobserve(this),this._?.(),this._=void 0;return}if(!this.Oi){!this.je&&!this.te&&this.ge();return}let e=++this.Lr,o="";try{o=await this.proxyUrl(this.Ep());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ge=false,this._?.();let{promise:s,cancel:n}=Re(o);this._=()=>{n(),this.Lr===e&&(this._=void 0);};try{if(await s,this.Lr!==e||!this.isConnected)return;this.c=o,this.Ge=!0,this.Rr(),(t??this.n)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.ge();}finally{this.Lr===e&&(this._=void 0);}}ge(){if(!this.isConnected||this.c||this.Ge||this.isOriginal||this.$["*networkProblems"]){this.Rr();return}this.te&&cancelAnimationFrame(this.te),this.te=requestAnimationFrame(()=>{if(this.te=void 0,!this.isConnected||this.c||this.Ge||this.isOriginal){this.Rr();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.Hs();return}this.je=window.setTimeout(()=>{this.je=void 0,this.ge();},500);});}Rr(){this.te&&(cancelAnimationFrame(this.te),this.te=void 0),this.je&&(window.clearTimeout(this.je),this.je=void 0);}get Tp(){return !!(this.Ge&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Tp?"1":"0"};this.c&&(e.backgroundImage=`url(${this.c})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><div class="uc-preview" data-testid="preview" ?data-loaded=${this.Ge} style=${ee(e)} ></div><uc-icon class=${ut({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ee(o)} ></uc-icon></button>`}};p([m()],re.prototype,"c",2),p([m()],re.prototype,"Ge",2),p([m()],re.prototype,"isOriginal",2),p([m()],re.prototype,"Gl",2),p([y({type:String})],re.prototype,"filter",1);var Wi=class extends pt{constructor(){super(...arguments);this.a="";}get operation(){return this.a}set operation(t){let e=t??"";if(this.a===e)return;let o=this.a;this.a=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.Wl(e);}Wl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},o=()=>{let s=this.l10n(t);return this.title=s,s};e(),o();}initCallback(){super.initCallback(),this.a&&this.Wl(this.a),this.sub("*editorTransformations",t=>{if(!this.a)return;let{zero:e}=Ot[this.a],o=t[this.a],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.a),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.a,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:di(this.$["*operationTooltip"])});}};p([y({type:String})],Wi.prototype,"operation",1);var yp=1,jl=()=>{},Zi=class extends T{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Zl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>yp){this.scrollLeft+=o;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Zl,{passive:false}),this.addEventListener("scroll",jl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Zl),this.removeEventListener("scroll",jl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Zi.prototype,"hiddenScrollbar",2);var gt=class extends T{constructor(){super(...arguments);this.Ii=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Yl=true;this.tabList=[...lt];this.activeTab=j.CROP;this.Ur=true;this.Ks=false;this.Xl=null;this.Ql=0;this.Jl=0;this.$r=O();this.tc=O();this.tabToggleRefs={[j.CROP]:O(),[j.TUNING]:O(),[j.FILTERS]:O()};this.ec=()=>{this.ve();};this.Pi=[];this.Dr=F(t=>{this.Ii=t;},500);this.Fr=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===j.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(zt);else if(this.showSubToolbar&&this.$["*tabId"]===j.TUNING&&e){s=true;let n=t?.[e]||Ot[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.Ks=s;},0);this.xp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Cp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Sp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Ap={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":zt,"*currentOperation":null,"*operationTooltip":null};this.Nt=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this._?.();let e=this.$["*on.cancel"];e?.();};this.Ws=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Fp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:di(this.$["*operationTooltip"])}),this.$r.value?.apply(),this.ic();};this.Np=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.$r.value?.cancel(),this.ic();};this.Vp=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.js(o,{fromViewer:false}));};}ic(){this.$["*showSlider"]=false,this.$["*tabId"]===j.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===j.TUNING&&(this.Ks=false);}js(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.rc(t,{fromViewer:e,force:o});}rc(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.ve();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===j.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of lt){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ve();}}ve(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.tc.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Ql!==s||this.Jl!==n)&&(this.Ql=s,this.Jl=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get Gs(){return this.Pi.length>=3}kp(t){switch(t){case j.CROP:return this.Mp();case j.FILTERS:return this.Op();case j.TUNING:return this.Ip();default:return []}}Mp(){let t=[];if(this.Gs)t.push(()=>this.Pp());else for(let e of this.Pi)t.push(()=>this.oc(e));for(let e of qn)t.push(()=>this.Lp(e));return this.qs(t)}Op(){let e=[zt,...Gn].map(o=>()=>this.Rp(o));return this.qs(e)}Ip(){let t=jn.map(e=>()=>this.Up(e));return this.qs(t)}qs(t){return t.length?t.map(o=>o()):[]}Pp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}oc(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Lp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Rp(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Up(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}$p(){return this.Gs?this.Pi.map(t=>this.oc(t)):[]}async Dp(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ui(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._?.();let{cancel:o}=Fi([e]);this._=()=>{o(),this._=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Pi=[...t],this.sub("*cropPresetList",e=>{this.Pi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.js(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.Fr();}),this.sub("*currentOperation",()=>{this.Fr();}),this.sub("*tabId",e=>{this.rc(e,{fromViewer:false,force:true}),this.Fr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Dp(),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.Dr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ur=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ur=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Yl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.js(o,{fromViewer:false});return}this.ve();}),this.sub("*operationTooltip",e=>{this.Xl=e;}),this.Fr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.ec);}firstUpdated(t){super.firstUpdated(t),this.Nr(),this.ve();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ve()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Nr();}disconnectedCallback(){window.removeEventListener("resize",this.ec),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Nr(){let t=this.$r.value;t&&(this.$["*sliderEl"]=t);}_p(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?ee({gridColumn:`${s+1}`}):U;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Sp}><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.Vp} ${I(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Bp(t){let e=this.kp(t);return v`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:U}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Ks?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Gs;return v`<uc-line-loader-ui .active=${this.Ii}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Xl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.xp} ><div class="uc-tab-content-row">${lt.map(o=>Bi(this.activeTab===o,()=>this.Bp(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Yl} .styles=${this.Ap} @initial-render=${()=>this.ve()} ><div class="uc-tab-toggles_indicator" ${I(this.tc)} ></div>${lt.map(o=>this._p(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Nt} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ws}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Cp}><div class="uc-slider" ?hidden=${!this.Ur}><uc-editor-slider ${I(this.$r)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ur||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.$p()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Np} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Fp} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([m()],gt.prototype,"Ii",2),p([m()],gt.prototype,"showMainToolbar",2),p([m()],gt.prototype,"showSubToolbar",2),p([m()],gt.prototype,"Yl",2),p([m()],gt.prototype,"tabList",2),p([m()],gt.prototype,"activeTab",2),p([m()],gt.prototype,"Ur",2),p([m()],gt.prototype,"Ks",2),p([m()],gt.prototype,"Xl",2),p([m()],gt.prototype,"Pi",2);var Gl=jt([...lt]),rt=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.zp="";this.me=It;this.Hp="";this.Ii=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Gl;this.sc=false;this.Kt=false;this.Zs=null;this.Li=null;this.Dr=F(t=>{this.Ii=t;},300);this.Vr=O();this.nc=O();this.ac=O();this.cc=O();this.uc=()=>{this.Dr(false),this.me!==It&&(this.$["*networkProblems"]=false);};this.dc=()=>{this.Dr(false),this.$["*networkProblems"]=true;};this.Kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Bl(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}jp(){this.Kt||this.Zs||(this.Zs=this.updateComplete.then(()=>{this.Zs=null,this.Kt=true;}));}initCallback(){super.initCallback(),this.pc(),this.hc();}Nr(){let t=this.ac.value;t&&(this.$["*faderEl"]=t);let e=this.nc.value;e&&(this.$["*cropperEl"]=e);let o=this.cc.value;o&&(this.$["*imgContainerEl"]=o);let s=this.Vr.value;s&&(this.$["*imgEl"]=s);}Gp(){let t=this.Vr.value;t&&(t.addEventListener("load",this.uc),t.addEventListener("error",this.dc));}qp(){let t=this.Vr.value;t&&(t.removeEventListener("load",this.uc),t.removeEventListener("error",this.dc));}get Wp(){let t=this.$["*tabId"];return Tt("uc-image",{"uc-image_hidden_to_cropper":t===j.CROP,"uc-image_hidden_effects":t!==j.CROP})}fc(){if(this.Li)return this.Li;let t=3e3;return this.Li=new Promise((e,o)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Li=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),o(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Li}firstUpdated(t){super.firstUpdated(t),this.Nr(),this.Gp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.qp(),super.disconnectedCallback();}render(){let t=this.Hp??"",e=this.zp??"",o=this.me||It,s=this.Ii,n=this.sc;return v` ${We(zl)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Kp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${I(this.cc)}><img src=${o} class=${this.Wp} ${I(this.Vr)} />${Bi(this.Kt,()=>v`<uc-editor-image-cropper ${I(this.nc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${I(this.ac)}></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">${Bi(this.Kt,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.pc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.hc();}pc(){let t=this.tabs||Gl;this.$["*tabList"]=_l(t);}hc(){let t=ao(this.cropPreset??""),e=null;if(this.cdnUrl){let o=Zo(this.cdnUrl),s=Yo(o);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=rl(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.fc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=br(t),o=ne(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=Zo(t),n=Yo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=ne(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"]===j.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Q(t,at("json"))),o=await fetch(e).then(a=>a.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===j.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.jp();}}}async initEditor(){try{await this.fc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.sc=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=at(ae(t),"preview"),s=Q(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([m()],rt.prototype,"zp",2),p([m()],rt.prototype,"me",2),p([m()],rt.prototype,"Hp",2),p([m()],rt.prototype,"Ii",2),p([y({type:String,reflect:true})],rt.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],rt.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],rt.prototype,"cropPreset",2),p([y({type:String,reflect:true})],rt.prototype,"tabs",2),p([m()],rt.prototype,"sc",2),p([m()],rt.prototype,"Kt",2);var ln={};hn(ln,{CloudImageEditorActivity:()=>Yi});var Ao=class extends rt{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Yi=class extends M{constructor(){super(...arguments);this.mt=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.mt&&this.mt.cropPreset!==t&&(this.mt={...this.mt,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.mt&&this.mt.tabs!==t&&(this.mt={...this.mt,tabs:t});}),this.Zp();}disconnectedCallback(){super.disconnectedCallback(),this.Yp();}Ws(t){if(!this.Ri)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ri.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}Nt(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Zp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ri=e;let o=this.Ri.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.mt=this.Xp(o);}Yp(){this.Ri=void 0,this.mt=null;}render(){if(!this.mt)return U;let{cdnUrl:t,cropPreset:e,tabs:o}=this.mt;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${X(e)} tabs=${X(o)} @apply=${this.Ws} @cancel=${this.Nt} @change=${this.handleChange} ></uc-cloud-image-editor>`}Xp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([m()],Yi.prototype,"mt",2);var pi=class extends M{constructor(){super(...arguments);this.Ke="";this.zs=t=>{this.Ke=t.target?.value??"";};this.cs=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Ke.trim();e&&(this.api.addFileFromUrl(e,{source:R.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.cs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.zs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Ke} >${this.l10n("upload-url")}</button></form>`}};p([m()],pi.prototype,"Ke",2);var ql=()=>{let r=globalThis.location.ancestorOrigins,i=r?.[r.length-1];if(i&&i!=="null")return i;let t=globalThis.top??globalThis.parent??globalThis.self;try{return t.location.origin}catch(e){return console.warn("Unable to access top-level window location:",e),globalThis.location.origin}};var bp=r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Wl=(r,i="i")=>{let t=r.split("*").map(bp);return new RegExp(`^${t.join(".+")}$`,i)};var wp=["--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"],Ep=(r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),Zl=r=>{let i={};for(let t of wp){let e=Ep(r,t);e&&(i[t]=e);}return i};var Tp=["selected-files-change","toolbar-state-change"],Cp=r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Tp.includes(i))},ko=class{constructor(i,t){this._r=new Map;this.gc=i=>{if(i.source!==this.Ys)return;let t=i.data;if(!Cp(t))return;let e=this._r.get(t.type);if(e)for(let o of e)o(t);};this.Ys=i,this.mc=t,window.addEventListener("message",this.gc);}on(i,t){let e=this._r.get(i)??new Set;this._r.has(i)||this._r.set(i,e),e.add(t);}send(i){let t=this.mc();this.Ys.postMessage(i,t);}destroy(){window.removeEventListener("message",this.gc);}};function Yl(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("&")}var xp={[mt.GDRIVE]:"ngdrive"},vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.qe=O();this.Br=null;this.Xs=[];this.Qs=false;this.Js=false;this.tn=false;this.en=false;this.zr=false;this.rn=false;this.sn="uc-hidden";this.vc=true;this.us=()=>{for(let t of this.Xs){let e=this.Jp(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Nt=()=>{this.historyBack();};this.sh=()=>{this.Tt?.send({type:"select-all"});};this.nh=()=>{this.Tt?.send({type:"deselect-all"});};}get Qp(){if(!this.Br)return "";let{selectedCount:t,total:e}=this.Br;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.yc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.bc(),this.yc());});}),this.subConfigValue("multiple",e=>{this.zr=e;}),this.subConfigValue("localeName",()=>{this.wc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.Ec(e);});}Jp(t){if(t.alternatives){let e=J(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=Wl(o);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}th(t){this.vc=t.isVisible;}async eh(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.ih(t.selectedCount,t.total),this.sn=t.isReady?"":"uc-hidden",this.Qs=t.isReady,this.Js=t.isReady&&t.selectedFiles.length>0,this.zr=t.isMultipleMode&&t.total>0,this.tn=t.selectedCount<t.total,this.en=t.selectedCount===t.total,this.Xs=t.selectedFiles??[],this.rn=t.total>0;}Tc(){this.Ec(this.cfg.externalSourcesEmbedCss),this.rh(),this.wc();}rh(){this.Tt?.send({type:"set-theme-definition",theme:Zl(this)});}Ec(t){this.Tt?.send({type:"set-embed-css",css:t});}wc(){this.Tt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}oh(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=xp[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ql(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,o);return d.search=Yl(c),d.toString()}ih(t,e){this.Br={selectedCount:t,total:e};}yc(){let t=document.createElement("iframe");t.src=this.oh(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Tc.bind(this)),t.addEventListener("load",this.Tc.bind(this)),this.qe.value&&(this.qe.value.innerHTML="",this.qe.value.appendChild(t)),t.contentWindow&&(this.Tt?.destroy(),this.Tt=new ko(t.contentWindow,()=>this.cfg.socialBaseUrl),this.Tt.on("selected-files-change",this.eh.bind(this)),this.Tt.on("toolbar-state-change",this.th.bind(this)),this.xc());}bc(){this.Tt?.destroy(),this.Tt=void 0,this.qe.value&&(this.qe.value.innerHTML=""),this.xc();}xc(){this.Xs=[],this.Qs=false,this.Js=false,this.tn=false,this.en=false,this.zr=false,this.rn=false,this.sn="uc-hidden",this.Br=null;}disconnectedCallback(){super.disconnectedCallback(),this.bc();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${I(this.qe)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.vc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.zr} ><span>${this.Qp}</span><button type="button" @click=${this.sh} ?hidden=${!this.tn} >${this.l10n("select-all")}</button><button type="button" @click=${this.nh} ?hidden=${!this.en} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.us} ?disabled=${!this.Js} ?hidden=${!this.rn} ><uc-spinner ?hidden=${this.Qs}></uc-spinner><span class=${this.sn}>${this.l10n("done")}</span></button></div></div>`}};p([m()],vt.prototype,"Xs",2),p([m()],vt.prototype,"Qs",2),p([m()],vt.prototype,"Js",2),p([m()],vt.prototype,"tn",2),p([m()],vt.prototype,"en",2),p([m()],vt.prototype,"zr",2),p([m()],vt.prototype,"rn",2),p([m()],vt.prototype,"sn",2),p([m()],vt.prototype,"vc",2);var Xl=()=>typeof navigator.permissions<"u";var Sp={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Ap=["camera","microphone"];function Mo(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}var Ql="image/jpeg",Jl="video/webm",H=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Hr=null;this.nn=false;this.Ui=[];this.Pt=null;this.Lt=null;this.Kr=null;this.jr=null;this.w=null;this.$i={};this.It=null;this.r=null;this.We=[];this.Ze=[];this.ah={};this.Gr=[];this.qr=null;this.Cc=()=>{this.Sc(),this.Di="pause";};this.Ac=()=>{this.Di="play",this.lh();};this.Fi=O();this.he=O();this.X=O();this.kc=0;this.Mc=0;this.Oc=null;this.Wr=true;this.Zr=true;this.ch=Xl();this.Ic=[];this.ye=true;this.an="";this.Ye=true;this.be=true;this.Xe=true;this.Pc=[];this.we=true;this.ln=true;this.Ee=true;this._t=true;this.Te=true;this.Qe="camera-full";this.Di="play";this.Lc="microphone";this.Yr="uc-shot-btn uc-camera-action";this.uh=()=>{if(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.w}}}),this.w===P.PHOTO&&this.dh(),this.w===P.VIDEO){if(this.Pt?.state==="recording"){this.Rc();return}this.ph();}};this.hh=t=>{let e=t.target;e&&(this.jr=e.value,this.Je());};this.fh=t=>{let e=t.target;e&&(this.Kr=e.value,this.Je());};this.mh=()=>{this.Je();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.w}}}),this.uh();};this.vh=()=>{this.yh();};this.bh=()=>{this.wh();};this.Eh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.w}}}),this.Th();};this.xh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.w}}}),this.Ch();};this.Uc=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.$c(o);};this.Dc=()=>{let t=Math.floor((performance.now()-this.kc+this.Mc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Fi.value;s&&(s.textContent=Mo(e)),this.Rc();return}let o=this.Fi.value;o&&(o.textContent=Mo(e));}else {let e=this.Fi.value;e&&(e.textContent=Mo(t));}this.ti=requestAnimationFrame(this.Dc);};this.Sh=()=>{this.kc=performance.now(),this.Mc=0,this.Dc();};this.Fc=()=>{this.ti&&cancelAnimationFrame(this.ti);};this.Sc=()=>{let t=this.X.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.he.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.Fi.value;n&&(n.textContent=Mo(e)),this.ti=requestAnimationFrame(this.Sc);};this.lh=()=>{this.ti&&cancelAnimationFrame(this.ti);};this.ti=null;this.ph=()=>{try{this.Ui=[],this.$i={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.$i.mimeType=t:MediaRecorder.isTypeSupported(Jl)?this.$i.mimeType=Jl:this.$i.mimeType="video/mp4",this.Lt&&(this.Pt=new MediaRecorder(this.Lt,this.$i),this.Pt.start(),this.Pt.addEventListener("dataavailable",e=>{this.Ui.push(e.data);}),this.Sh(),this.classList.add("uc-recording"),this.Ni(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Rc=()=>{this.Pt?.addEventListener("stop",()=>{this.Ah(),this.Fc(),this.Ni(St.STOP);}),this.Pt?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.w}}});};this.yh=()=>{if(this.Pt?.state==="recording")return;let t=this.X.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.wh=()=>{this.Lt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Lc=t.enabled?"microphone":"microphone-mute",this.ln=!t.enabled;});};this.Ah=()=>{try{let t=new Blob(this.Ui,{type:this.Pt?.mimeType}),e=URL.createObjectURL(t),o=this.X.value;if(!o)return;o.muted=!1,o.volume=1,this.Vi(null),o.src=e,this.kh(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Th=()=>{if(this.Ni(St.RETAKE),this.w===P.VIDEO){this.Vi(this.Lt);let t=this.X.value;t&&(t.muted=true);}this.X.value?.play?.();};this.Ch=()=>{if(this.Ni(St.ACCEPT),this.w===P.PHOTO){this.It?.toBlob(s=>{if(!s)return;let n=this.Nc("camera","jpeg",Ql,s);this.Vc(n);},Ql);return}let t=new Blob(this.Ui,{type:this.Pt?.mimeType}),e=this.Mh(this.Pt?.mimeType),o=this.Nc("video",e,`video/${e}`,t);this.Vc(o),this.Ui=[];};this.Oh=t=>{t===St.SHOT&&(this.Te=true,this.be=true,this._t=true,this.Xe=false,this.ye=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.Te=!this.Bt.includes(P.VIDEO),this._t=!this.Bt.includes(P.PHOTO),this.be=false,this.Xe=true,this.ye=this.We.length<=1);};this.Ih=t=>{t===St.PLAY&&(this.Ye=false,this._t=true,this.ye=true,this.we=true,this.Di="pause",this.Qe="square",this.Yr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.Ye=false,this.be=true,this.Ee=true,this.Xe=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.Ye=true,this.Te=!this.Bt.includes(P.VIDEO),this._t=!this.Bt.includes(P.PHOTO),this.be=false,this.Xe=true,this.Ee=!this.cfg.enableAudioRecording,this.Qe="video-camera-full",this.Yr="uc-shot-btn uc-camera-action",this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.ye=this.We.length<=1);};this.Ni=t=>{this.w===P.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Oh(t),this.w===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Ih(t);};this.$c=t=>{t===P.PHOTO&&(this.Qe="camera-full",this.we=true,this.Ee=true),t===P.VIDEO&&(this.Di="play",this.Qe="video-camera-full",this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.Ee=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.w=t;};this.Nc=(t,e,o,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:o})};this.Vc=t=>{this.api.addFileFromObject(t,{source:R.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this._i=F(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.w===P.VIDEO&&this.cfg.enableAudioRecording,o=this.w===P.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Wr=false,this.be=false,this._t=!this.Bt.includes(P.PHOTO),this.Te=!this.Bt.includes(P.VIDEO),this.Zr=true,this.Ye=true,this.Qe=o,this.Ee=!e,this.we=!e):t==="prompt"?(this.an="camera-permissions-prompt",this.Wr=true,this.be=true,this._t=true,this.Zr=false,this.dn()):(this.an="camera-permissions-denied",this.Wr=true,this.Zr=false,this._t=!this.Bt.includes(P.PHOTO),this.Te=!this.Bt.includes(P.VIDEO),this.Xe=true,this.Yr="uc-shot-btn uc-camera-action",this.dn());},300);this.Ph=()=>{if(!this.Lt)return false;let t=this.Lt?.getAudioTracks(),e=this.Lt?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.dn=()=>{this.nn&&(this.X.value&&(this.X.value.volume=0),this.qr?.getTracks?.()?.[0]?.stop(),this.cn(this.X.value),this.Vi(null),this.Ph(),this.Fc(),this.nn=false);};this.Je=async()=>{let t={video:{...Sp},audio:this.cfg.enableAudioRecording?{}:false};this.jr&&(t.video={deviceId:{exact:this.jr}}),this.Kr&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Kr}}),this.X.value&&(this.X.value.volume=0);try{this._i("prompt"),this.Lt=await navigator.mediaDevices.getUserMedia(t),this.Lt.addEventListener("inactive",()=>{this._i("denied");}),this.Vi(this.Lt),this.nn=!0,this._i("granted");}catch(e){this._i("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this._c=()=>{this.Je();};this.Lh=async()=>{try{this.Xr();for(let t of Ap){let e=await navigator.permissions.query({name:t});this.ah[t]=e,e.addEventListener("change",this._c),this.Gr.push(()=>{e.removeEventListener("change",this._c);});}this.Hr=()=>{this.Xr();};}catch(t){this.Xr(),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.Je();}};this.Rh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.pn(),navigator.mediaDevices.addEventListener("devicechange",this.pn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.pn=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.We=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ze=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Ic=this.We,this.ye=this.We.length<=1,this.jr=this.We[0]?.value??null,this.Pc=this.Ze,this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.Kr=this.Ze[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Uh=async()=>{await this.Lh(),await this.Rh(),await this.Je(),this.Bc(this.Bt);};this.$h=async()=>{this.Hr&&this.Hr(),window.chrome||this._i("denied"),this.dn();};this.Bc=t=>{this.Te=!t.includes(P.VIDEO),this._t=!t.includes(P.PHOTO);let e=t[0];e&&(!this.w||!t.includes(this.w))&&this.$c(e);};}kh(t){this.cn(t),t.addEventListener("play",this.Cc),t.addEventListener("pause",this.Ac);}cn(t){t?.removeEventListener("play",this.Cc),t?.removeEventListener("pause",this.Ac);}Vi(t){this.qr!==t&&(this.qr=t,this.un());}un(){let t=this.X.value;if(!t)return;let e=this.qr??null;t.srcObject!==e&&(t.srcObject=e);}dh(){if(this.Ni("shot"),this.It=document.createElement("canvas"),this.r=this.It.getContext("2d"),!this.r)throw new Error("Failed to get canvas context");let t=this.X.value;if(!t)throw new Error("Video element not found");this.It.height=t.videoHeight,this.It.width=t.videoWidth,this.cfg.cameraMirror&&(this.r.translate(this.It.width,0),this.r.scale(-1,1)),this.r.drawImage(t,0,0),t.pause();}Mh(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 Bt(){return J(this.cfg.cameraModes).filter(t=>t===P.PHOTO||t===P.VIDEO)}Xr(){if(this.Gr.length!==0){for(let t of this.Gr)t();this.Gr=[],this.Hr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Oc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.Ee=!t,this.ln=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=Z(t);this.Bc(e.filter(o=>o===P.PHOTO||o===P.VIDEO));}),this.Uh();}firstUpdated(t){super.firstUpdated(t),this.un();}updated(t){super.updated(t),this.un();}Dh(){this.Xr(),navigator.mediaDevices?.removeEventListener("devicechange",this.pn),this.cn(this.X.value),this.Vi(null);}disconnectedCallback(){super.disconnectedCallback(),this.$h(),this.Dh();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ye}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Ic} ?hidden=${this.ye} @change=${this.hh} ></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=${ee({transform:this.Oc})} ?hidden=${this.Wr} ${I(this.X)} ></video><div class="uc-message-box" ?hidden=${this.Zr}><span>${this.l10n(this.an)}</span><button type="button" @click=${this.mh} ?hidden=${this.ch} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Ye}><button data-id="photo" type="button" class=${ut({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.w===P.PHOTO})} @click=${this.Uc} ?hidden=${this._t} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${ut({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.w===P.VIDEO})} @click=${this.Uc} ?hidden=${this.Te} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.vh} ?hidden=${this.Ye} data-testid="recording-timer" ><uc-icon name=${this.Di}></uc-icon><span ${I(this.Fi)}> 00:00 </span><span ${I(this.he)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Xe} ><button type="button" class="uc-secondary-btn" @click=${this.Eh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.xh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.gh} class=${this.Yr} ?hidden=${this.be} ><uc-icon name=${this.Qe}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.bh} ?hidden=${this.Ee} data-testid="toggle-microphone" ><uc-icon name=${this.Lc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Pc} ?hidden=${this.we} ?disabled=${this.ln} @change=${this.fh} data-testid="audio-select" ></uc-select></div></div>`}};p([m()],H.prototype,"Oc",2),p([m()],H.prototype,"Wr",2),p([m()],H.prototype,"Zr",2),p([m()],H.prototype,"ch",2),p([m()],H.prototype,"Ic",2),p([m()],H.prototype,"ye",2),p([m()],H.prototype,"an",2),p([m()],H.prototype,"Ye",2),p([m()],H.prototype,"be",2),p([m()],H.prototype,"Xe",2),p([m()],H.prototype,"Pc",2),p([m()],H.prototype,"we",2),p([m()],H.prototype,"ln",2),p([m()],H.prototype,"Ee",2),p([m()],H.prototype,"_t",2),p([m()],H.prototype,"Te",2),p([m()],H.prototype,"Qe",2),p([m()],H.prototype,"Di",2),p([m()],H.prototype,"Lc",2),p([m()],H.prototype,"Yr",2);var tc={id:"camera",setup:async({pluginApi:r,uploaderApi:i})=>{yt({CameraSource:H}),r.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Ta.htmlMediaCapture)return ["camera"];let t=Z(r.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(D.CAMERA),i.setModalState(true);}}),r.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),r.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"video-camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),r.registry.registerActivity({id:D.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var cn={};hn(cn,{BtnUi:()=>At,CloudImageEditor:()=>Ao,CloudImageEditorBlock:()=>rt,Config:()=>ai,CropFrame:()=>Hi,EditorAspectRatioButtonControl:()=>Gi,EditorCropButtonControl:()=>qi,EditorFilterControl:()=>re,EditorFreeformButtonControl:()=>So,EditorImageCropper:()=>Ki,EditorImageFader:()=>To,EditorOperationControl:()=>Wi,EditorScroller:()=>Zi,EditorSlider:()=>ji,EditorToolbar:()=>gt,Icon:()=>he,LineLoaderUi:()=>zi,PresenceToggle:()=>ci,SliderUi:()=>Bt,defineComponents:()=>yt});var kp="cloud-image-editor",Mp="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",ec={id:kp,setup:async({pluginApi:r,uploaderApi:i})=>(yt({...cn,...ln}),r.registry.registerIcon({name:"edit-file",svg:Mp}),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),r.registry.registerActivity({id:D.CLOUD_IMG_EDIT,render:e=>{let o=document.createElement("uc-cloud-image-editor-activity");return e.append(o),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let o=r.config.get("cropPreset"),s=r.config.get("useCloudImageEditor"),n=r.config.get("cloudImageEditorAutoOpen"),a=i.m.size;s&&a===1&&(o||n)&&(i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var ic={id:"external-sources",setup:async({pluginApi:r,uploaderApi:i})=>{yt({ExternalSource:vt}),r.registry.registerActivity({id:D.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))r.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(D.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var Io=()=>{let r=[];return {stack:r,promiseReadJpegChunks:t=>new Promise((e,o)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{o(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){o("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),f=>{if(f.byteLength!==h){o("Corrupted");return}r.push({startPos:c,length:h,marker:u,view:f}),a();})})};FileReader&&DataView||o("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&o("Not jpeg"),a();});})}},Op=async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Io();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},oc=async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Io();await s(r),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),o.push(c.length)});let a=[r.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(r.slice(l,e[c])),l=e[c]+o[c]+4;return a.push(r.slice(l,r.size)),new Blob(a,{type:r.type})}};var sc=(r,i)=>oc(r,226,i.map(t=>t.buffer)),Ip=async r=>{try{return await sc(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Lp=(r,i,t)=>new Promise((e,o)=>{let s=n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);};r.toBlob(s,i,t),r.width=r.height=1;}),Xi=()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},Pp=r=>{let{ctx:t,canvas:e}=Xi();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},Rp=async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Io();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},Up="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Oo,$p=()=>new Promise(r=>{if(Oo!==void 0)r(Oo);else {let i=new Image;i.addEventListener("load",()=>{Oo=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Oo);}),i.src=Up;}}),Dp=(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;}},Fp=(r,i)=>{Dp(r,(t,e)=>r.setUint16(t,i,e));},Vp=async(r,i,t)=>(t&&Fp(i,1),oc(r,225,[i.buffer])),Np=(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."));}));}),_p=r=>Np(new Image,r),Bp=[1,3],zp=[192,193,194,195,197,198,199,201,202,203,205,206,207],rc={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hp=async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Io();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&zp.indexOf(o)>=0){let n=s.getUint8(5);Bp.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},nc=(r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},ac=(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},ye={R:55,G:110,B:165,A:255},Kp=`rgba(${ye.R}, ${ye.G}, ${ye.B}, ${ye.A/255})`,lc=(r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Xi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Xi();s.width=r,s.height=i,n&&(n.fillStyle=Kp,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let a=o&&o.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===ye.R&&a[1]===ye.G&&a[2]===ye.B&&a[3]===ye.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}};function cc(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}var jp=cc(nc(lc,ac)),Gp=cc(nc(lc,ac)),uc=async(r,i)=>{let t=rc.squareSide.find(n=>n*n>=r*i),e=rc.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([jp(t,t),Gp(e,1)]);if(o&&s)return true;throw new Error("Not supported")},dc=async(r,i,t)=>{try{let{ctx:e,canvas:o}=Xi();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})}},qp=({img:r,targetW:i,targetH:t})=>dc(r,i,t),Wp=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()},Zp=({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Wp({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[a,l],c)=>n.then(d=>uc(a,l).then(()=>dc(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(r))},Yp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Xp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),un=.71,Qp=(r,i)=>{if(r.width*un*r.height*un<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 uc(s,n).then(()=>{let{ctx:a}=Xi();return "imageSmoothingQuality"in a&&!Yp()&&!Xp?qp({img:r,targetW:s,targetH:n}):Zp({img:r,sourceW:t,targetW:s,targetH:n,step:un})}).catch(()=>Promise.reject("Not supported"))},pc=async(r,i)=>{try{if(await Hp(r))throw new Error("Should skipped");let e=await Promise.allSettled([Rp(r),$p(),Op(r)]),s=!e.some(w=>w.status==="rejected"),[n,a,l]=e,c=await Ip(r).catch(()=>r),d=await _p(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await Qp(d,i),h="image/jpeg",f=i?.quality||.8;!s&&Pp(u)&&(h="image/png",f=void 0);let g=await Lp(u,h,f);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,b=a.status==="fulfilled"?a.value:!1;g=await Vp(g,w,b);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await sc(g,l.value)),g}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};var Jp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,hc=r=>{if(typeof r!="string")return false;let i=Jp.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}};var fc={id:"image-shrink",setup({pluginApi:r}){r.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=r.config.get("imageShrink");if(!t)return {file:i};let e=hc(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await pc(i,e)}}catch{return {file:i}}}});}};var mc={id:"instagram",setup({pluginApi:r}){r.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var gc={id:R.LOCAL,setup:({pluginApi:r,uploaderApi:i})=>{r.registry.registerSource({id:R.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var vc={id:"url-source",setup:async({pluginApi:r,uploaderApi:i})=>{yt({UrlSource:pi}),r.registry.registerActivity({id:D.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),r.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(D.URL),i.setModalState(true);}});}};var hi=[{configDeps:["useCloudImageEditor"],isEnabled:r=>!!r("useCloudImageEditor"),load:()=>ec},{configDeps:["imageShrink"],isEnabled:r=>!!r("imageShrink"),load:()=>fc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.LOCAL),load:()=>gc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.CAMERA),load:()=>tc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes("instagram"),load:()=>mc},{configDeps:["sourceList"],isEnabled:r=>Object.values(mt).some(i=>Z(r("sourceList")).includes(i)),load:()=>ic},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.URL),load:()=>vc}];var Qi=class extends Jt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Fh(){return v`<uc-dynamic-btn></uc-dynamic-btn>`}Nh(){return v`<uc-simple-btn></uc-simple-btn>`}Vh(){return this.headless?null:this.dynamicButton?this.Fh():this.Nh()}render(){return v` ${super.render()} ${this.Vh()}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([y({type:Boolean})],Qi.prototype,"headless",2),p([y({attribute:"dynamic-button",type:Boolean})],Qi.prototype,"dynamicButton",2);var Lo=class extends Jt{constructor(){super();this.zc=false;this.Nt=()=>{if(this.Hc){let t=this.$["*historyBack"];t?.();return}this.Kc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Hc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Kc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}hn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.hn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.zc=this.Hc||this.Kc;});}render(){return v` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt} ?hidden=${!this.zc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};p([m()],Lo.prototype,"zc",2);var dn="active",Po="",be=class extends Jt{constructor(){super();this.mn=false;this.Qr=false;this.Jr=Po;this.gn=Po;this.yi="choose-file";this.hi=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Jr=dn),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Jr=dn,this.Qr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.gn=dn);};this.fi=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Qr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}hn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.hn();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.gn=Po):(this.Jr=Po,this.Qr=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.mn=!o):(this.style.removeProperty("--uc-grid-col"),this.mn=false);});}),this.subConfigValue("multiple",e=>{this.yi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(tt.OPEN,this.hi),this.modalManager?.subscribe(tt.CLOSE,this.fi);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(tt.OPEN,this.hi),this.modalManager?.unsubscribe(tt.CLOSE,this.fi);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Qr} class=${this.gn}><uc-drop-area ?single=${this.mn} initflow clickable tabindex="0" ><span>${this.l10n(this.yi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Jr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([m()],be.prototype,"mn",2),p([m()],be.prototype,"Qr",2),p([m()],be.prototype,"Jr",2),p([m()],be.prototype,"gn",2),p([m()],be.prototype,"yi",2);/*! For license information please see file-uploader.min.js.LEGAL.txt */
7
+ var pn=Object.defineProperty;var yc=Object.getOwnPropertyDescriptor;var hn=(r,i)=>{for(var t in i)pn(r,t,{get:i[t],enumerable:true});};var p=(r,i,t,e)=>{for(var o=e>1?void 0:e?yc(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&&pn(i,t,o),o};var Mt=[],oe=0,Ji=4,fn=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=oe+Ji;s<Mt.length;)Mt[s]===e?Mt.splice(s,Ji):s+=Ji;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,o);if(s){for(oe=0;oe<Mt.length;oe+=Ji)Mt[oe](Mt[oe+1],Mt[oe+2],Mt[oe+3]);Mt.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};function tr(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}function Uo(r,i,t){let e=tr(r,i,t);return t(r.value),e}var $o=(r={})=>{let i=fn(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};var G=class r{static{this.ei=new Map;}constructor(i,t){this.gt=i,this.xt=t;}get id(){return this.gt}pub(i,t){i in this.xt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.xt.setKey(i,t);}sub(i,t,e=true){return (e?Uo:tr)(this.xt,[i],s=>{t(s[i]);})}read(i){return i in this.xt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.xt.get()[i]}add(i,t,e=false){(!(i in this.xt.get())||e)&&this.xt.setKey(i,t);}has(i){return i in this.xt.get()}get store(){return this.xt.get()}static registerCtx(i,t){if(r.ei.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=$o(i);return r.ei.set(t,e),new r(t,e)}static deleteCtx(i){r.ei.delete(i);}static getCtx(i){let t=r.ei.get(i);return t?new r(i,t):null}static hasCtx(i){return r.ei.has(i)}};var er=globalThis,rr=er.ShadowRoot&&(er.ShadyCSS===void 0||er.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gn=Symbol(),mn=new WeakMap,ir=class{constructor(i,t,e){if(this.jc=true,e!==gn)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(rr&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=mn.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&mn.set(t,i));}return i}toString(){return this.cssText}},vn=r=>new ir(typeof r=="string"?r:r+"",void 0,gn);var yn=(r,i)=>{if(rr)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=er.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},Do=rr?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return vn(t)})(r):r;var{is:wc,defineProperty:Ec,getOwnPropertyDescriptor:Tc,getOwnPropertyNames:Cc,getOwnPropertySymbols:xc,getPrototypeOf:Sc}=Object,or=globalThis,bn=or.trustedTypes,Ac=bn?bn.emptyScript:"",kc=or.reactiveElementPolyfillSupport,fi=(r,i)=>r,mi={toAttribute(r,i){switch(i){case Boolean:r=r?Ac: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}},sr=(r,i)=>!wc(r,i),wn={attribute:true,type:String,converter:mi,reflect:false,useDefault:false,hasChanged:sr};Symbol.metadata??=Symbol("metadata"),or.litPropertyMetadata??=new WeakMap;var Ht=class extends HTMLElement{static addInitializer(i){this.to(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Bi&&[...this.Bi.keys()]}static createProperty(i,t=wn){if(t.state&&(t.attribute=false),this.to(),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&&Ec(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=Tc(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let a=o?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??wn}static to(){if(this.hasOwnProperty(fi("elementProperties")))return;let i=Sc(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(fi("finalized")))return;if(this.finalized=true,this.to(),this.hasOwnProperty(fi("properties"))){let t=this.properties,e=[...Cc(t),...xc(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.Bi=new Map;for(let[t,e]of this.elementProperties){let o=this.eo(t,e);o!==void 0&&this.Bi.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(Do(o));}else i!==void 0&&t.push(Do(i));return t}static eo(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.zi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.xe=null,this.Gc();}Gc(){this.io=new Promise(i=>this.enableUpdating=i),this.ee=new Map,this.qc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.ii??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.ii?.delete(i);}qc(){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.zi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.ii?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.ii?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.ro(i,e);}Wc(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.eo(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:mi).toAttribute(t,e.type);this.xe=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.xe=null;}}ro(i,t){let e=this.constructor,o=e.Bi.get(i);if(o!==void 0&&this.xe!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:mi;this.xe=o;let a=n.fromAttribute(t,s.type);this[o]=a??this.oo?.get(o)??a,this.xe=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??sr)(s,t)||e.useDefault&&e.reflect&&s===this.oo?.get(i)&&!this.hasAttribute(n.eo(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.io=this.Zc());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.oo??=new Map).has(i)&&(this.oo.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.ee.has(i)||(this.hasUpdated||e||(t=void 0),this.ee.set(i,t)),o===true&&this.xe!==i&&(this.vn??=new Set).add(i));}async Zc(){this.isUpdatePending=true;try{await this.io;}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.zi){for(let[o,s]of this.zi)this[o]=s;this.zi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,a=this[o];n!==true||this.ee.has(o)||a===void 0||this.C(o,void 0,s,a);}}let i=false,t=this.ee;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.ii?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.so();}catch(e){throw i=false,this.so(),e}i&&this.Yc(t);}willUpdate(i){}Yc(i){this.ii?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}so(){this.ee=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.io}shouldUpdate(i){return true}update(i){this.vn&&=this.vn.forEach(t=>this.Wc(t,this[t])),this.so();}updated(i){}firstUpdated(i){}};Ht.elementStyles=[],Ht.shadowRootOptions={mode:"open"},Ht[fi("elementProperties")]=new Map,Ht[fi("finalized")]=new Map,kc?.({ReactiveElement:Ht}),(or.reactiveElementVersions??=[]).push("2.1.2");var Vo=globalThis,En=r=>r,nr=Vo.trustedTypes,Tn=nr?nr.createPolicy("lit-html",{createHTML:r=>r}):void 0,No="$lit$",Kt=`lit$${Math.random().toFixed(9).slice(2)}$`,_o="?"+Kt,Mc=`<${_o}>`,Se=document,vi=()=>Se.createComment(""),yi=r=>r===null||typeof r!="object"&&typeof r!="function",Bo=Array.isArray,Mn=r=>Bo(r)||typeof r?.[Symbol.iterator]=="function",Fo=`[ \f\r]`,gi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Cn=/-->/g,xn=/>/g,Ce=RegExp(`>|${Fo}(?:([^\\s"'>=/]+)(${Fo}*=${Fo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Sn=/'/g,An=/"/g,On=/^(?:script|style|textarea|title)$/i,zo=r=>(i,...t)=>({zt:r,strings:i,values:t}),v=zo(1),st=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),kn=new WeakMap,xe=Se.createTreeWalker(Se,129);function In(r,i){if(!Bo(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tn!==void 0?Tn.createHTML(i):i}var Ln=(r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=gi;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===gi?d[1]==="!--"?n=Cn:d[1]!==void 0?n=xn:d[2]!==void 0?(On.test(d[2])&&(o=RegExp("</"+d[2],"g")),n=Ce):d[3]!==void 0&&(n=Ce):n===Ce?d[0]===">"?(n=o??gi,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?Ce:d[3]==='"'?An:Sn):n===An||n===Sn?n=Ce:n===Cn||n===xn?n=gi:(n=Ce,o=void 0);let f=n===Ce&&r[a+1].startsWith("/>")?" ":"";s+=n===gi?l+Mc:u>=0?(e.push(c),l.slice(0,u)+No+l.slice(u)+Kt+f):l+Kt+(u===-2?a:f);}return [In(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},bi=class r{constructor({strings:i,zt:t},e){let o;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ln(i,t);if(this.el=r.createElement(c,e),xe.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(o=xe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(No)){let h=d[n++],f=o.getAttribute(u).split(Kt),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?lr:g[1]==="?"?cr:g[1]==="@"?ur:ke}),o.removeAttribute(u);}else u.startsWith(Kt)&&(l.push({type:6,index:s}),o.removeAttribute(u));if(On.test(o.tagName)){let u=o.textContent.split(Kt),h=u.length-1;if(h>0){o.textContent=nr?nr.emptyScript:"";for(let f=0;f<h;f++)o.append(u[f],vi()),xe.nextNode(),l.push({type:2,index:++s});o.append(u[h],vi());}}}else if(o.nodeType===8)if(o.data===_o)l.push({type:2,index:s});else {let u=-1;for(;(u=o.data.indexOf(Kt,u+1))!==-1;)l.push({type:7,index:s}),u+=Kt.length-1;}s++;}}static createElement(i,t){let e=Se.createElement("template");return e.innerHTML=i,e}};function Ae(r,i,t=r,e){if(i===st)return i;let o=e!==void 0?t.Xc?.[e]:t.Qc,s=yi(i)?void 0:i.ao;return o?.constructor!==s&&(o?.yn?.(false),s===void 0?o=void 0:(o=new s(r),o.lo(r,t,e)),e!==void 0?(t.Xc??=[])[e]=o:t.Qc=o),o!==void 0&&(i=Ae(r,o.Jc(r,i.values),o,e)),i}var ar=class{constructor(i,t){this.bn=[],this.Ct=void 0,this.wn=i,this.g=t;}get parentNode(){return this.g.parentNode}get tt(){return this.g.tt}u(i){let{el:{content:t},parts:e}=this.wn,o=(i?.creationScope??Se).importNode(t,true);xe.currentNode=o;let s=xe.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Ve(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new dr(s,this,i)),this.bn.push(c),l=e[++a];}n!==l?.index&&(s=xe.nextNode(),n++);}return xe.currentNode=Se,o}p(i){let t=0;for(let e of this.bn)e!==void 0&&(e.strings!==void 0?(e.St(i,e,t),t+=e.strings.length-2):e.St(i[t])),t++;}},Ve=class r{get tt(){return this.g?.tt??this.En}constructor(i,t,e,o){this.type=2,this.s=U,this.Ct=void 0,this.Rt=i,this.Ce=t,this.g=e,this.options=o,this.En=o?.isConnected??true;}get parentNode(){let i=this.Rt.parentNode,t=this.g;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Rt}get endNode(){return this.Ce}St(i,t=this){i=Ae(this,i,t),yi(i)?i===U||i==null||i===""?(this.s!==U&&this.Se(),this.s=U):i!==this.s&&i!==st&&this.Tn(i):i.zt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Mn(i)?this.k(i):this.Tn(i);}O(i){return this.Rt.parentNode.insertBefore(i,this.Ce)}T(i){this.s!==i&&(this.Se(),this.s=this.O(i));}Tn(i){this.s!==U&&yi(this.s)?this.Rt.nextSibling.data=i:this.T(Se.createTextNode(i)),this.s=i;}$(i){let{values:t,zt:e}=i,o=typeof e=="number"?this.tu(i):(e.el===void 0&&(e.el=bi.createElement(In(e.h,e.h[0]),this.options)),e);if(this.s?.wn===o)this.s.p(t);else {let s=new ar(o,this),n=s.u(this.options);s.p(t),this.T(n),this.s=s;}}tu(i){let t=kn.get(i.strings);return t===void 0&&kn.set(i.strings,t=new bi(i)),t}k(i){Bo(this.s)||(this.s=[],this.Se());let t=this.s,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(vi()),this.O(vi()),this,this.options)):e=t[o],e.St(s),o++;o<t.length&&(this.Se(e&&e.Ce.nextSibling,o),t.length=o);}Se(i=this.Rt.nextSibling,t){for(this.Hi?.(false,true,t);i!==this.Ce;){let e=En(i).nextSibling;En(i).remove(),i=e;}}setConnected(i){this.g===void 0&&(this.En=i,this.Hi?.(i));}},ke=class{get tagName(){return this.element.tagName}get tt(){return this.g.tt}constructor(i,t,e,o,s){this.type=1,this.s=U,this.Ct=void 0,this.element=i,this.name=t,this.g=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.s=Array(e.length-1).fill(new String),this.strings=e):this.s=U;}St(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=Ae(this,i,t,0),n=!yi(i)||i!==this.s&&i!==st,n&&(this.s=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=Ae(this,a[e+l],t,l),c===st&&(c=this.s[l]),n||=!yi(c)||c!==this.s[l],c===U?i=U:i!==U&&(i+=(c??"")+s[l+1]),this.s[l]=c;}n&&!o&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},lr=class extends ke{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},cr=class extends ke{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},ur=class extends ke{constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}St(i,t=this){if((i=Ae(this,i,t,0)??U)===st)return;let e=this.s,o=i===U&&e!==U||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==U&&(e===U||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.s=i;}handleEvent(i){typeof this.s=="function"?this.s.call(this.options?.host??this.element,i):this.s.handleEvent(i);}},dr=class{constructor(i,t,e){this.element=i,this.type=6,this.Ct=void 0,this.g=t,this.options=e;}get tt(){return this.g.tt}St(i){Ae(this,i);}},Pn={I:Ve},Oc=Vo.litHtmlPolyfillSupport;Oc?.(bi,Ve),(Vo.litHtmlVersions??=[]).push("3.3.2");var pr=(r,i,t)=>{let e=t?.renderBefore??i,o=e.eu;if(o===void 0){let s=t?.renderBefore??null;e.eu=o=new Ve(i.insertBefore(vi(),s),s,void 0,t??{});}return o.St(r),o};var Ho=globalThis,xt=class extends Ht{constructor(){super(...arguments),this.renderOptions={host:this},this.co=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.co=pr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.co?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.co?.setConnected(false);}render(){return st}};xt._h=true,xt.finalized=true,Ho.litElementHydrateSupport?.({LitElement:xt});var Ic=Ho.litElementPolyfillSupport;Ic?.({LitElement:xt});(Ho.litElementVersions??=[]).push("4.2.2");var Lc=/\\([0-9a-fA-F]{1,6} ?)/g;function Pc(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Rc(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}function Uc(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}function Rn(r){let i=r;Pc(r)&&(i=Rc(i),i=i.replace(Lc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Uc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ne(r){class i extends r{constructor(){super(...arguments);this.xn=null;this.uo=null;}getCssData(o,s=false){let n=this.xn??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.uo||(this.uo=window.getComputedStyle(this));let a=this.uo.getPropertyValue(o).trim();try{n[o]=Rn(a);}catch(l){s||console.warn(`CSS Data error: ${o}`,l),n[o]=null;}}return this.xn=n,n[o]}}return i}function hr(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.ie={};this.re=null;this.Ki=false;}createRenderRoot(){return this}connectedCallback(){this.re||(this.re=Array.from(this.childNodes)),super.connectedCallback();}iu(){if(this.Ki)return;this.Ki=true,this.ie={};let o=Array.from(this.childNodes),s=o.length?o:this.re??[];for(let n of s){let a=this.Cn(n),l=this.ie[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.ie[a]=l;}this.re=null;}Cn(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Cn(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}ru(o){return !o.textContent||!o.textContent.trim()}ou(o){let s=this.ie[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.ru(n))}update(o){!this.hasUpdated&&this.willYield&&this.iu(),super.update(o);}yield(o,s){if(o===""&&!this.ie[o]&&!this.Ki&&this.re?.length){let a=[];for(let l of this.re)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.ie[o]=a,this.Ki=true,this.re=null;}let n=this.ie[o];return v` ${n} ${this.ou(o)?s:void 0} `}}return i}function _e(r){class i extends r{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}var se=class extends Event{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 Be=class{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 se(this.context,this.host,this.t,this.subscribe));}};var fr=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var Ko=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},ze=class extends fr{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:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new se(this.context,a,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 Ko(this.context,this.host));}};var Dc={attribute:true,type:String,converter:mi,reflect:false,hasChanged:sr},Fc=(r=Dc,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(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(r){return (i,t)=>typeof t=="object"?Fc(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)}function m(r){return y({...r,state:true,attribute:false})}function F(r,i){let t,e=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Un="ctx-name-context";function gr(){return function(r){class i extends r{constructor(...o){super(...o);this.vt=null;this.ri=false;this.po=false;this.ho=void 0;this.Ae=new Map;this.oi=new Set;this.init$={};this.ctxOwner=false;this.ji=void 0;this.Gi=false;this.ctxName=this.Ht;this.Kt=false;this.ji=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ht,this.su=new Be(this,{context:Un,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.kn=s,this.An();},subscribe:true});}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 Sn(){return this.ji}set Sn(o){let s=o??void 0;this.ji!==s&&(this.ji=s,this.An());}shouldUpdate(o){return this.Kt?super.shouldUpdate(o):false}get Ht(){return this.Sn||this.kn||void 0}An(){if(this.ctxName=this.Ht,!(!this.ctxName||this.ri)){if(this.isConnected){this.fo();return}this.Gi=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Ht,this.ctxName&&(this.ho?this.ho.setValue(this.ctxName):this.ho=new ze(this,{context:Un,initialValue:this.ctxName}));}Mn(){if(!(!this.vt||this.Ae.size===0)){for(let[o,{value:s,rewrite:n}]of this.Ae)this.vt.add(o,s,n);this.Ae.clear();}}On(){return !this.vt&&this.Ht&&this.mo(),this.vt&&this.Mn(),this.vt}qi(){let o=this.On();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}mo(){let o=this.init$,s=this.Ht;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.vt){this.vt=G.getCtx(s)??G.registerCtx(o,s);for(let[n,a]of Object.entries(this.init$))this.vt.add(n,a,this.ctxOwner);this.Mn();}}get $(){return this.Ht&&this.mo(),new Proxy({},{get:(o,s)=>{if(typeof s=="string")return this.vt?.read(s)},set:(o,s,n)=>(typeof s!="string"||this.vt?.pub(s,n),true)})}sub(o,s,n=true){let a=this.qi().sub(o,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.oi.delete(d));};return this.oi.add(d),d}pub(o,s){this.qi().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.qi()}has(o){return this.vt?.has(o)??false}add(o,s,n=false){let a=this.On();if(!a){if(!n&&this.Ae.has(o))return;this.Ae.set(o,{value:s,rewrite:n});return}this.Ae.delete(o),a.add(o,s,n);}add$(o,s=false){for(let[n,a]of Object.entries(o))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.ri?this.Kt&&this.po&&(this.po=false,this.initCallback()):this.ctxName?(this.Gi=false,this.fo()):this.Gi&&this.Ht&&(this.Gi=false,this.fo());}fo(){if(this.ri)return;this.ri=true,this.mo();let o=this.init$;if(Object.keys(o).length>0){let s=this.qi();for(let[n,a]of Object.entries(o))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Kt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.nu(),super.disconnectedCallback(),this.ri&&(this.po=true);}nu(){if(this.oi.size!==0){for(let o of [...this.oi])o();this.oi.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Sn",1),p([m()],i.prototype,"kn",2),p([m()],i.prototype,"ctxName",2),p([m()],i.prototype,"Kt",2),i}}var jo=class extends _e(gr()(Ne(hr(xt)))){};var nt=class r{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 Vc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function yt(r){for(let i in r){if(Vc.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);}}var Go="UC";function Nc(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Go]){t(window[Go]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[Go];i&&yt(s),t(s);},document.head.appendChild(o);})}var wi={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var qo=new Map,$n=new Map,Dn=(r,i)=>{qo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...wi,...i};return qo.set(r,t),t},_c=(r,i)=>{$n.set(r,i);},Fn=(r,i)=>{typeof i=="function"?_c(r,i):Dn(r,i);},Vn=async r=>{let i=qo.get(r);if(!i){let t=$n.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Dn(r,e);}return i};Fn("en",wi);var x=r=>`*cfg/${r}`;var Z=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],jt=r=>r.join(",");var Nn=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},vr=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>Nn(i)).join("/-/"),at=(...r)=>{let i=vr(...r);return i?`-/${i}/`:""};function yr(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}function br(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}function Wo(r){let i=_n(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Zo(r){return Wo(r).split("/-/").filter(Boolean).map(t=>Nn(t))}function _n(r){let i=new URL(r),t=yr(r),e=Bn(t)?zn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Bn(r){return r.startsWith("http")}function zn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var Q=(r,i,t)=>{let e=new URL(_n(r)),o=t??yr(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&Bn(o)){let n=zn(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()},ne=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var J=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Ei=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Kn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Bc(r,i){if(typeof i=="number"){let t=i;return Ei[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Ei[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Ei.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function ae(r){return vr(...Kn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Bc(i,t)}).filter(i=>!!i))}var wr=vr("format/auto","progressive/yes"),Gt=([r])=>typeof r<"u"?Number(r):void 0,Hn=()=>true,zc=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Hc=([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:J(r,"x").map(Number),coords:J(i).map(Number)}},Kc=Object.freeze({enhance:Gt,brightness:Gt,exposure:Gt,gamma:Gt,contrast:Gt,saturation:Gt,vibrance:Gt,warmth:Gt,filter:zc,mirror:Hn,flip:Hn,rotate:Gt,crop:r=>{let[i,t]=r,{dimensions:e,coords:o}=Hc([i,t]);return {dimensions:e,coords:o}}});function Yo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!Kn.includes(e))continue;let s=e,n=Kc[s];try{let a=n(o);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var j=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),lt=Object.freeze([j.CROP,j.TUNING,j.FILTERS]),jn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Gn=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"]),qn=Object.freeze(["rotate","mirror","flip"]),qt=Ei,Ot=Object.freeze({brightness:{zero:qt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:qt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:qt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:qt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:qt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:qt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:qt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:qt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:qt.filter,range:[0,100],keypointsNumber:1}});var Ti="https://ucarecdn.com",jc="https://upload.uploadcare.com",Gc="https://social.uploadcare.com",qc="https://ucarecd.net",Wc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:Ti,cdnCnamePrefixed:qc,baseUrl:jc,socialBaseUrl:Gc,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,tags:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,authToken:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:jt(lt),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"plain",dynamicButtonShowFirstIcon:true},et=Object.freeze(Wc);var Er=(r,i)=>(...t)=>{let e=r();if(!e.read(x("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);};var K=class{constructor(i){this.go=new Set;this.oe=null;this.E=Er(()=>this.e.ctx,this.constructor.name);this.e=i,this.r=i.ctx;}addSub(i){this.go.add(i);}get Ut(){if(!this.oe){let i={};this.oe=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let o=x(e);return this.e.ctx.has(o)?this.e.ctx.read(o):et[e]}});}return this.oe}destroy(){for(let i of this.go)try{i();}catch{}this.go.clear();}},Zc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",authTokenManager:"*authTokenManager",api:"*publicApi",validationManager:"*validationManager"},bt=(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`)},Wn=r=>({get ctx(){return r()},get modalManager(){return bt(r(),"*modalManager",false)},get pluginManager(){return bt(r(),"*pluginManager")},get telemetryManager(){return bt(r(),"*telemetryManager")},get localeManager(){return bt(r(),"*localeManager")},get a11y(){return bt(r(),"*a11y")},get routerLayer(){return bt(r(),"*routerLayer")},get blocksRegistry(){return bt(r(),"*blocksRegistry")},get eventEmitter(){return bt(r(),"*eventEmitter")},get uploadCollection(){return bt(r(),"*uploadCollection")},get secureUploadsManager(){return bt(r(),"*secureUploadsManager",false)},get authTokenManager(){return bt(r(),"*authTokenManager",false)},get api(){return bt(r(),"*publicApi")},get validationManager(){return bt(r(),"*validationManager")},when(i,t){let e=Zc[i],o=r(),s=o.has(e)?o.read(e):void 0;if(s)return t(s),()=>{};let n;return n=o.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,o=>{t(o),e?.();});})}});var tt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Tr=class extends K{constructor(){super(...arguments);this.se=new Map;this.At=new Set;this.f=new Map;}registerModal(t,e){this.se.set(t,e),this.Q(tt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.se.get(t);return e?(this.se.delete(t),this.At.delete(t),this.Q(tt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.se.get(t);return e?(this.At.add(t),this.Q(tt.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.se.get(t);return !e||!this.At.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.At.delete(t),this.Q(tt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.se.has(t)?this.At.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.At.size>0}back(){if(this.At.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.At).pop();return t?this.close(t):false}closeAll(){let t=this.At.size;return this.At.clear(),this.Q(tt.CLOSE_ALL,{}),t}subscribe(t,e){return this.f.has(t)||this.f.set(t,new Set),this.f.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.f.has(t)&&this.f.get(t)?.delete(e);}Q(t,e){if(this.f.has(t))for(let o of this.f.get(t)??new Set)try{o(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.E("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.se.clear(),this.f.clear(),this.Q(tt.DESTROY,{});}};var Cr=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("-");var Wt=class r extends Error{constructor(i){super(`Failed to resolve the auth token: ${i instanceof Error?i.message:String(i)}`),this.name="AuthTokenResolverError",this.cause=i,Object.setPrototypeOf(this,r.prototype);}},Xo=r=>r instanceof Wt?r:new Wt(r),Yc=r=>{let i=r.split(".")[1];if(i)try{let t=JSON.parse((o=>{let s=o.replaceAll("-","+").replaceAll("_","/"),n=s+"=".repeat((4-s.length%4)%4),a=atob(n),l=Uint8Array.from(a,c=>c.charCodeAt(0));return new TextDecoder().decode(l)})(i)),e=typeof t=="object"&&t!==null?t.exp:void 0;return typeof e=="number"?e:void 0}catch{return}},xr=class{fetchToken;t;i;o;h;u=0;constructor({fetchToken:i,skew:t=30,initialToken:e}){this.fetchToken=i,this.t=t,e&&this.l(e);}getToken=()=>{if(this.i!==void 0&&!this.v())return Promise.resolve(this.i);let i=this.u,t=()=>i===this.u;return this.h??=Promise.resolve().then(()=>this.fetchToken()).then(e=>(t()&&this.l(e),e),e=>{throw Xo(e)}).finally(()=>{t()&&(this.h=void 0);}),this.h};invalidate(){this.u++,this.i=void 0,this.o=void 0,this.h=void 0;}l(i){this.i=i,this.o=Yc(i);}v(){return this.o!==void 0&&Date.now()/1e3>=this.o-this.t}},Zn=r=>r?{Authorization:`Bearer ${r}`}:{};var Yn=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},Xn=r=>r.toString(36).slice(0,10),He=(r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}};var Qn=r=>{let i=new DataView(r),t=0n;for(let e=0;e<r.byteLength;e+=8)t=t<<64n|i.getBigUint64(e);return t};var Xc=async r=>Qn(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(r))),Qc=async r=>Xn(await Xc(r)),Sr=async(r,i)=>{let t=await Qc(r);return Yn(t,i)};function Jn(r){return Object.prototype.toString.call(r)==="[object Object]"}var Jc=/\W|_/g;function tu(r){return r.split(Jc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function ta(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Yt(t,{ignoreKeys:i})):r}function Yt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return ta(r,{ignoreKeys:i});if(!Jn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}Jn(o)?o=Yt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=ta(o,{ignoreKeys:i})),t[tu(e)]=o;}return t}var ra=(r,i)=>new Promise(t=>{if(i?.aborted){t();return}let e=()=>{clearTimeout(o),i?.removeEventListener("abort",e),t();},o=setTimeout(e,r);i?.addEventListener("abort",e,{once:true});});function ss({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("/"),a=[s,o].filter(Boolean).join("; ");return `${n} (${a})`}var eu={factor:2,time:100};function iu(r,i=eu){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a=>ra(a??s).then(()=>(t+=1,e(o)))})}return e(r)}var Me=class extends Error{},Ke=class r extends Me{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},ns=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},Ut=class r extends Me{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},ru=500,oa=async({check:r,interval:i=ru,timeout:t,signal:e})=>{let o=Date.now(),s=()=>t===void 0?1/0:t-(Date.now()-o);for(;;){if(e?.aborted)throw new Ut("Poll cancelled");if(s()<=0)throw new Ut("Timed out");let n;try{n=await r(e);}catch(a){throw e?.aborted?new Ut("Poll cancelled"):a}if(e?.aborted)throw new Ut("Poll cancelled");if(n)return n;await ra(Math.min(i,s()),e);}},ea=new Set,ou=r=>{ea.has(r)||(ea.add(r),console.warn(r));},L={baseCDN:"https://ucarecdn.com",prefixedBaseCDN:"https://ucarecd.net",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},kr="application/octet-stream",sa="original",ce=({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,f]=u;typeof f<"u"&&!Array.isArray(f)&&l.setRequestHeader(h,f);}),l.responseType="text",ns(o,()=>{d=true,l.abort(),a(new Ut);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(b){let E=b.split(": "),S=E.shift(),N=E.join(": ");S&&typeof S<"u"&&(f[S]=N);});let g=l.response,w=l.status;n({request:u,data:g,headers:f,status:w});}},l.onerror=u=>{d||a(new Ke(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function su(r,...i){return r}var nu=({name:r})=>r?[r]:[],au=su,lu=()=>new FormData,na=r=>false,Mr=r=>typeof Blob<"u"&&r instanceof Blob,Or=r=>typeof File<"u"&&r instanceof File,Ir=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",je=r=>Mr(r)||Or(r)||na()||Ir(r),cu=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",uu=r=>!!r&&typeof r=="object"&&!Array.isArray(r),du=r=>!!r&&typeof r=="object"&&"data"in r&&je(r.data);function aa(r,i,t){if(Array.isArray(t))for(let e of t)aa(r,`${i}[]`,e);else if(du(t)){let{name:e,contentType:o}=t,s=au(t.data,e,o??kr),n=nu({name:e});r.push([i,s,...n]);}else if(uu(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else cu(t)&&t&&r.push([i,t.toString()]);}function pu(r){let i=[];for(let[t,e]of Object.entries(r))aa(i,t,e);return i}function Lr(r){let i=lu(),t=pu(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}var $t=class r extends Me{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);}},hu=["AccessTokenExpiredError","OperationsLimitExceededError","ScopeForbiddenError","AccessTokenInvalidError"],fu=r=>!!r&&hu.includes(r),ts=class r extends $t{constructor(i,t,e,o,s){super(i,t,e,o,s),this.name="AuthError",Object.setPrototypeOf(this,r.prototype);}},Xt=(r,i,t,e,o)=>fu(i)?new ts(r,i,t,e,o):new $t(r,i,t,e,o),mu=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()},Zt=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=mu(t)),e.toString()},la=r=>typeof r=="function",gu=async r=>{if(!la(r))return r;try{return await r()}catch(i){throw Xo(i)}},vu="RequestThrottledError",yu="AccessTokenExpiredError",ia=15e3,bu=1e3,wu=1;function Eu(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return ia;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:ia}function ue(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e,authToken:o}=i,s=la(o),n=0;return iu(({attempt:a,retry:l})=>r().catch(c=>{if(c instanceof $t&&c.code===vu&&a<t)return l(Eu(c));if(c instanceof $t&&c.code===yu&&s&&n<wu)return n+=1,l(0);if(c instanceof Ke&&a<e)return l((a+1)*bu);throw c}))}var ca=r=>{let i="";return (Mr(r)||Or(r)||Ir(r))&&(i=r.type),i||kr},ua=r=>{let i="";return Or(r)&&r.name?i=r.name:Mr(r)||na()?i="":Ir(r)&&r.name&&(i=r.name),i||sa},Tu="6.22.0",Cu="UploadcareUploadClient",xu=Tu;function Su(r){return ss({libraryName:Cu,libraryVersion:xu,...r})}var Oe=async({publicKey:r,integration:i,userAgent:t,authToken:e})=>({...r?{"X-UC-User-Agent":Su({publicKey:r,integration:i,userAgent:t})}:{},...Zn(await gu(e))}),Pr=({authToken:r,secureSignature:i,secureExpire:t})=>r?((i||t)&&ou("[@uploadcare/upload-client] Both `authToken` and `secureSignature`/`secureExpire` are provided. These are mutually exclusive auth schemes; `authToken` takes precedence and the signature parameters are ignored."),{}):{signature:i,expire:t};function as(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function ls(r){return Array.isArray(r)?r.join(","):typeof r=="string"?r:void 0}function Au(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=L.baseURL,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,onProgress:d,source:u="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",url:Zt(o,"/base/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:a}),data:Lr({file:{data:r,name:t||ua(r),contentType:e||ca(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:as(l),...Pr({authToken:a,secureSignature:s,secureExpire:n}),source:u,metadata:b,tags:ls(E)}),signal:c,onProgress:d}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C}),{retryNetworkErrorMaxTimes:w,retryThrottledRequestMaxTimes:g,authToken:a})}var es;(function(r){r.Token="token",r.FileInfo="file_info";})(es||(es={}));function ku(r,{publicKey:i,baseURL:t=L.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,authToken:c,source:d="url",signal:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:c}),url:Zt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:as(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,...Pr({authToken:c,secureSignature:a,secureExpire:l}),source:d,metadata:b,tags:ls(E)}),signal:u}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C}),{retryNetworkErrorMaxTimes:w,retryThrottledRequestMaxTimes:g,authToken:c})}var ht;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ht||(ht={}));var Mu=r=>"status"in r&&r.status===ht.Error;function Ou(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=L.retryNetworkErrorMaxTimes}={}){return ue(async()=>ce({method:"GET",headers:await Oe({publicKey:i,integration:s,userAgent:n,authToken:e}),url:Zt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:o}).then(({data:c,headers:d,request:u})=>{let h=Yt(JSON.parse(c));if("error"in h&&!Mu(h))throw Xt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a,authToken:e})}function Iu(r,{publicKey:i,baseURL:t=L.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,authToken:n,signal:a,source:l,integration:c,userAgent:d,retryThrottledRequestMaxTimes:u=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"POST",headers:await Oe({publicKey:i,integration:c,userAgent:d,authToken:n}),url:Zt(t,"/group/",{jsonerrors:1}),data:Lr({files:r,callback:e,pub_key:i,...Pr({authToken:n,secureSignature:o,secureExpire:s}),source:l}),signal:a}).then(({data:f,headers:g,request:w})=>{let b=Yt(JSON.parse(f));if("error"in b)throw Xt(b.error.content,b.error.errorCode,w,b,g);return b}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:u,authToken:n})}function Lu(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,signal:o,source:s,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"GET",headers:await Oe({publicKey:i,integration:n,userAgent:a,authToken:e}),url:Zt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:o}).then(({data:d,headers:u,request:h})=>{let f=Yt(JSON.parse(d));if("error"in f)throw Xt(f.error.content,f.error.errorCode,h,f,u);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c,authToken:e})}function Pu(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=L.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,authToken:l,store:c,signal:d,source:u="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:g=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:w=L.retryNetworkErrorMaxTimes,metadata:b,tags:E}){return ue(async()=>ce({method:"POST",url:Zt(s,"/multipart/start/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:h,userAgent:f,authToken:l}),data:Lr({filename:e,size:r,content_type:t||kr,part_size:o,UPLOADCARE_STORE:as(c),UPLOADCARE_PUB_KEY:i,...Pr({authToken:l,secureSignature:n,secureExpire:a}),source:u,metadata:b,tags:ls(E)}),signal:d}).then(({data:S,headers:N,request:q})=>{let C=Yt(JSON.parse(S));if("error"in C)throw Xt(C.error.content,C.error.errorCode,q,C,N);return C.parts=Object.keys(C.parts).map(ot=>C.parts[Number(ot)]),C}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,authToken:l})}function Ru(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=L.retryNetworkErrorMaxTimes}){return ue(()=>ce({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||kr}}).then(a=>(o&&o({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Uu(r,{publicKey:i,baseURL:t=L.baseURL,authToken:e,source:o="local",signal:s,integration:n,userAgent:a,retryThrottledRequestMaxTimes:l=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=L.retryNetworkErrorMaxTimes}){return ue(async()=>ce({method:"POST",url:Zt(t,"/multipart/complete/",{jsonerrors:1}),headers:await Oe({publicKey:i,integration:n,userAgent:a,authToken:e}),data:Lr({uuid:r,UPLOADCARE_PUB_KEY:i,source:o}),signal:s}).then(({data:d,headers:u,request:h})=>{let f=Yt(JSON.parse(d));if("error"in f)throw Xt(f.error.content,f.error.errorCode,h,f,u);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c,authToken:e})}function Rr(r,{publicKey:i,baseURL:t,authToken:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:d}){return oa({check:u=>Lu(r,{publicKey:i,baseURL:t,authToken:e,signal:u,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?(d&&d({isComputable:!0,value:1}),h):!1),signal:c})}var $u=(r,i)=>Sr(r,i),da=({publicKey:r,baseCDN:i,prefixedBaseCDN:t=L.prefixedBaseCDN})=>r?i===void 0||He(i,t)?$u(r,t):Promise.resolve(i):Promise.resolve(i??L.baseCDN);function Du(r){return "defaultEffects"in r}var Ar=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;tags;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=L.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=Zt(t,`${o}/`),a=s?Zt(`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.tags=i.tags||null,this.s3Bucket=s||null,this.s3Url=a,Du(i)&&(this.defaultEffects=i.defaultEffects);}},Ur=async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e,fileName:o})=>{let s=await da({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Ar(r,{baseCDN:s,fileName:o})},Fu=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,contentType:l,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,baseCDN:b,prefixedBaseCDN:E,metadata:S,tags:N})=>Au(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,metadata:S,tags:N}).then(({file:q})=>Rr(q,{publicKey:i,baseURL:e,authToken:n,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,onProgress:d,signal:c})).then(q=>Ur(q,{publicKey:i,baseCDN:b,prefixedBaseCDN:E})),Vu=(r,{publicKey:i,fileName:t,baseURL:e,authToken:o,signal:s,onProgress:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d,retryNetworkErrorMaxTimes:u,baseCDN:h,prefixedBaseCDN:f})=>Rr(r,{publicKey:i,baseURL:e,authToken:o,signal:s,onProgress:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d,retryNetworkErrorMaxTimes:u}).then(g=>Ur(g,{publicKey:i,baseCDN:h,prefixedBaseCDN:f,fileName:t})),Nu=(r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=n=>()=>{e=n,o.forEach((a,l)=>l!==n&&a.abort());};return ns(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:o[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},_u=window.WebSocket,is=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Bu=(r,i)=>r==="success"?{status:ht.Success,...i}:r==="progress"?{status:ht.Progress,...i}:{status:ht.Error,...i},rs=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new is;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 _u(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,Bu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,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)}},Qo=null,cs=r=>{if(!Qo){let i=typeof window>"u"?0:3e4;Qo=new rs(r,i);}return Qo},zu=r=>{cs(r).connect();};function Hu({token:r,publicKey:i,baseURL:t,authToken:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return oa({check:d=>Ou(r,{publicKey:i,baseURL:t,authToken:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:d}).then(u=>{switch(u.status){case ht.Error:return Xt(u.error,u.errorCode);case ht.Waiting:return !1;case ht.Unknown:return new $t(`Token "${r}" was not found.`);case ht.Progress:return l&&(u.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:u.done/u.total})),!1;case ht.Success:return l&&l({isComputable:!0,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:c})}var Ku=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=cs(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(r);};ns(t,()=>{l(),s(new Ut("pusher cancelled"));}),n.subscribe(r,c=>{switch(c.status){case ht.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case ht.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),o(c);break}case ht.Error:l(),s(Xt(c.msg,c.error_code));}});}),ju=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,prefixedBaseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,authToken:d,store:u,signal:h,onProgress:f,source:g,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,pusherKey:S=L.pusherKey,metadata:N,tags:q})=>Promise.resolve(zu(S)).then(()=>ku(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,authToken:d,store:u,signal:h,source:g,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,metadata:N,tags:q})).catch(C=>(cs(S)?.disconnect(),Promise.reject(C))).then(C=>C.type===es.FileInfo?C:Nu([({signal:ot})=>Hu({token:C.token,publicKey:i,baseURL:e,authToken:d,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,onProgress:f,signal:ot}),({signal:ot})=>Ku({token:C.token,pusherKey:S,signal:ot,onProgress:f})],{signal:h})).then(C=>{if(C instanceof $t)throw C;return C}).then(C=>C.isReady?C:Rr(C.uuid,{publicKey:i,baseURL:e,authToken:d,integration:w,userAgent:b,retryThrottledRequestMaxTimes:E,onProgress:f,signal:h})).then(C=>Ur(C,{publicKey:i,baseCDN:o,prefixedBaseCDN:s})),Jo=new WeakMap,Gu=async r=>{if(Jo.has(r))return Jo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Jo.set(r,i),i},pa=async r=>{if(Or(r)||Mr(r))return r.size;if(Ir(r))return (await Gu(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},qu=(r,i=L.multipartMinFileSize)=>r>=i,ha=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 !je(r)&&t.test(r)},us=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !je(r)&&t.test(r)},Wu=(r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(o[c]=u,n-=1,n?l():t(o));}).catch(u=>{s=true,e(u);});};for(let c=0;c<r;c++)l();}),Zu=(r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},Yu=async(r,i,t)=>e=>Zu(r,e,i,t),Xu=(r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Ru(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),Qu=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,onProgress:d,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,contentType:b,multipartChunkSize:E=L.multipartChunkSize,maxConcurrentRequests:S=L.maxConcurrentRequests,baseCDN:N,prefixedBaseCDN:q,metadata:C,tags:ot})=>{let we=e??await pa(r),Rt,Ee=(B,Ct)=>{if(!d)return;Rt||(Rt=Array(B).fill(0));let Te=kt=>kt.reduce((Fe,Ro)=>Fe+Ro,0);return kt=>{kt.isComputable&&(Rt[Ct]=kt.value,d({isComputable:true,value:Te(Rt)/B}));}};return b||=ca(r),Pu(we,{publicKey:i,contentType:b,fileName:t||ua(r),baseURL:o,secureSignature:s,secureExpire:n,authToken:a,store:l,signal:c,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,metadata:C,tags:ot,multipartChunkSize:E}).then(async({uuid:B,parts:Ct})=>{let Te=await Yu(r,we,E);return Promise.all([B,Wu(S,Ct.map((kt,Fe)=>()=>Xu(Te(Fe),kt,{publicKey:i,contentType:b,onProgress:Ee(Ct.length,Fe),signal:c,integration:h,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w})))])}).then(([B])=>Uu(B,{publicKey:i,baseURL:o,authToken:a,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w})).then(B=>B.isReady?B:Rr(B.uuid,{publicKey:i,baseURL:o,authToken:a,source:u,integration:h,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:w,onProgress:d,signal:c})).then(B=>Ur(B,{publicKey:i,baseCDN:N,prefixedBaseCDN:q}))};async function ds(r,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartMinFileSize:b,multipartChunkSize:E,maxConcurrentRequests:S,baseCDN:N,prefixedBaseCDN:q=L.prefixedBaseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:ot,pusherKey:we,metadata:Rt,tags:Ee}){if(je(r)){let B=await pa(r);return qu(B,b)?Qu(r,{publicKey:i,contentType:w,multipartChunkSize:E,fileSize:B,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,maxConcurrentRequests:S,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q,metadata:Rt,tags:Ee}):Fu(r,{publicKey:i,fileName:t,contentType:w,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q,metadata:Rt,tags:Ee})}if(us(r))return ju(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:N,prefixedBaseCDN:q,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:ot,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,pusherKey:we,metadata:Rt,tags:Ee});if(ha(r))return Vu(r,{publicKey:i,fileName:t,baseURL:e,authToken:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:N,prefixedBaseCDN:q});throw new TypeError(`File uploading from "${r}" is not supported`)}var Ju=(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}},os=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=L.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=Ju(i.cdnUrl,t),this.files=e.map(o=>new Ar(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},td=async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e})=>{let o=await da({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new os(r,{baseCDN:o})},ed=r=>{for(let i of r)if(!je(i))return false;return true},id=r=>{for(let i of r)if(!ha(i))return false;return true},rd=r=>{for(let i of r)if(!us(i))return false;return true};function fa(r,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartChunkSize:b=L.multipartChunkSize,baseCDN:E,prefixedBaseCDN:S=L.prefixedBaseCDN,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:q,jsonpCallback:C}){if(!ed(r)&&!rd(r)&&!id(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let ot,we=true,Rt=r.length,Ee=(B,Ct)=>{if(!c)return;ot||(ot=Array(B).fill(0));let Te=kt=>kt.reduce((Fe,Ro)=>Fe+Ro)/B;return kt=>{if(!kt.isComputable||!we){we=false,c({isComputable:false});return}ot[Ct]=kt.value,c({isComputable:true,value:Te(ot)});}};return Promise.all(r.map((B,Ct)=>je(B)||us(B)?ds(B,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,authToken:n,store:a,signal:l,onProgress:Ee(Rt,Ct),source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:w,multipartChunkSize:b,baseCDN:E,prefixedBaseCDN:S,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:q}).then(Te=>Te.uuid):B)).then(B=>Iu(B,{publicKey:i,baseURL:e,jsonpCallback:C,secureSignature:o,secureExpire:s,authToken:n,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(Ct=>td(Ct,{publicKey:i,baseCDN:E,prefixedBaseCDN:S})).then(Ct=>(c&&c({isComputable:true,value:1}),Ct)))}var le=class{Wi=1;vo=[];Zi=0;yo=new Map;bo=new Map;constructor(i){this.Wi=i;}run(){let i=this.Wi-this.Zi;for(let t=0;t<i;t++){let e=this.vo.shift();if(!e)return;let o=this.yo.get(e),s=this.bo.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Zi+=1,e().finally(()=>{this.yo.delete(e),this.bo.delete(e),this.Zi-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.yo.set(i,e),this.bo.set(i,o),this.vo.push(i),t&&this.run();})}get pending(){return this.vo.length}get running(){return this.Zi}set concurrency(i){this.Wi=i,this.run();}get concurrency(){return this.Wi}};var ps=()=>({}),hs=r=>({...ps(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),fs=r=>({...hs(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new le(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*groupError":null,"*uploadTrigger":new Set}),ma=r=>({...fs(r),"*solution":null,"*lazyPlugins":null});var D=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var od=new Set([D.START_FROM,D.UPLOAD_LIST]),$r=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.au.bind(this),window.addEventListener("paste",this.listener);}lu(t){if(!(t instanceof Element))return false;if(t.closest("input, textarea, select"))return true;let e=t.closest("[contenteditable]");return !!(e&&e.getAttribute("contenteditable")?.toLowerCase()!=="false"||t.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}cu(t){return t.composedPath().some(e=>this.lu(e))}uu(t){return typeof t=="string"&&od.has(t)}du(){return [...this.scopes].some(t=>t.isConnected)}pu(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}hu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}fu(t){let e=t.trim();if(!e)return null;try{let o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"?null:o.toString()}catch{return null}}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async au(t){if(!t.clipboardData||this.cu(t)||!this.du())return;let e=this.e.ctx.read("*currentActivity"),o=e===null,s=this.uu(e);switch(this.Ut.pasteScope){case "global":if(!s&&!(o&&this.pu()))return;await this.handlePaste(t);return;case "local":{let n=t.target instanceof Node?t.target:null;if(!this.hu(n)||!s&&!o)return;await this.handlePaste(t);return}default:return}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),o=e.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),s=e.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.fu(c));});})),n=false;if(o.length>0&&(o.forEach(a=>{this.e.api.addFileFromObject(a,{source:"clipboard"});}),n=true),s.length>0){let a=(await Promise.all(s)).filter(l=>l!==null);a.forEach(l=>{this.e.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&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 Dr=class extends K{constructor(){super(...arguments);this.Yi=[];}registerAfterFileAddHook(t){return this.Yi.push(t),()=>{this.Yi=this.Yi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.Yi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST));}};var sd={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ci(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function ms(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=sd[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}function gs(r,i){return i.role==="toolbar"?ad(i):i.querySelectorAll(`[role=${r.role}]`)}function nd(r,i){return Array.from(r).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}function ad(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function ld(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"}function ga(r){return i=>{let t=false,e=300,o=0,s="";function n(u){let h=ms(u.target);if(!h){a();return}let f=gs(u.target,h),g=nd(f,h),w=Array.from(g).indexOf(u.target),b="ArrowDown",E="ArrowUp";if(ld(h)&&(i.document.dir==="rtl"?(b="ArrowLeft",E="ArrowRight"):(b="ArrowRight",E="ArrowLeft")),u.key===b)u.preventDefault(),Ci(u.target,g[w+1]||g[0]);else if(u.key===E)u.preventDefault(),Ci(u.target,g[w-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),Ci(u.target,g[0]);else if(u.key==="End")u.preventDefault(),Ci(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-o<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),o=u.timeStamp;let S=Array.from(f).find(N=>N.textContent?.trim()?.toLowerCase()?.startsWith(s));S&&(u.preventDefault(),Ci(u.target,S));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=ms(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=gs(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=ms(u.target);if(h){let f=gs(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function va(){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);}}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 r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}function ya(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let o=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function ba(r){let i,t=r.split(" "),e;function o(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",o),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",o),a.removeEventListener("keyup",s);})}function wa(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var vs=class{constructor(){this.yt=new Map;this.wo=[];}addEventListener(i,t){let e=o=>{let s=o.target;s instanceof Node&&this.wo.some(n=>n===s||n.contains(s))&&t(o);};this.yt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.yt.get(t);e&&window.removeEventListener(i,e),this.yt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.wo.push(i);}destroy(){this.wo=[];for(let i of this.yt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.yt.clear();}},Fr=class{constructor(){this.Xi=new vs,this.In=wa(this.Xi,[ga(),ba("is-pressed"),ya(),va()]);}registerBlock(i){this.Xi.registerScope(i);}destroy(){this.In?.(),this.Xi.destroy();}};var Qt=r=>`*l10n/${r}`,cd="en",Vr=class extends K{constructor(t){super(t);this.ke="";for(let[o,s]of Object.entries(wi)){let n=this.r.has(Qt(o))?!this.r.read(Qt(o)):true;this.r.add(Qt(o),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.ke&&this.Pn(this.ke);})),this.addSub(this.r.sub(x("localeName"),async o=>{if(!o)return;this.ke=o;let s=await Vn(o);o!==cd&&this.ke!==o||(this.Pn(o),this.Ln(o,s));})),this.addSub(this.r.sub(x("localeDefinitionOverride"),o=>{if(!o)return;let s=o[this.ke];s&&this.Ln(this.ke,s);}));}Ln(t,e){let o=this.Ut.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=o?.[s];this.r.add(Qt(s),a??n,true);}}Pn(t){let e=this.e.pluginManager;if(!e)return;let o=e.snapshot();for(let s of o.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.r.add(Qt(c),d,true);}}};var ud=()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},dd=()=>"capture"in document.createElement("input"),pd=()=>({safariDesktop:ud()}),hd=()=>({htmlMediaCapture:dd()}),Ea=pd(),Ta=hd();var xi="image/*",ys="video/*",fd=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],md=()=>Ea.safariDesktop?[xi]:[xi,...fd],Si=md(),Nr=r=>r?r.filter(i=>typeof i=="string").flatMap(i=>J(i)):[],bs=(r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),Ca=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),Ge=r=>{let i=r?.type;return i?bs(i,Si):false};function xa(r,i,t,e,o){return {registry:{registerSource:c=>r.addSource(e,c),registerActivity:c=>r.addActivity(e,c),registerFileAction:c=>r.addFileAction(e,c),registerFileHook:c=>r.addFileHook(e,c),registerIcon:c=>r.addIcon(e,c),registerL10n:c=>r.addL10n(e,c),registerConfig:c=>{r.addConfig(e,c);let d=x(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=x(c);return i.read(d)},subscribe:(c,d)=>{let u=x(c),h=i.sub(u,f=>{d(f);});return o.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return o.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var gd=async({entries:r,signal:i})=>(await Promise.all(r.map(async e=>{if(e.isEnabled())try{let o=await e.load();return i.aborted||!e.isEnabled()?void 0:o??void 0}catch(o){i.aborted||console.warn("Failed to load lazy plugin",o);return}}))).filter(e=>e!==void 0),_r=class{constructor(i,t){this.r=i;this.gu=t;this.si=new Set;this.Rn=this.r.sub("*lazyPlugins",e=>{this.mu(e??[]);});}mu(i){for(let o of this.si)o();if(this.si.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let o of i)for(let s of o.configDeps)t.add(x(s));let e=()=>this.Un(i);for(let o of t)this.si.add(this.r.sub(o,e,false));this.Un(i);}Un(i){this.Eo?.abort();let t=new AbortController;this.Eo=t;let e=n=>this.r.read(x(n)),o=e("plugins"),s=gd({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...o,...n]});this.gu(s);}destroy(){this.Rn();for(let i of this.si)i();this.si.clear(),this.Eo?.abort();}};var Br=class{constructor(){this.ne=new Map;}register(i,t){if(this.ne.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.ne.set(t.name,e);}unregister(i){this.ne.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.ne)e.pluginId===i&&this.ne.delete(t);}get(i){return this.ne.get(i)}getAll(){return new Map(this.ne)}};var zr=class{constructor(i=()=>{}){this.S=[];this.kt=[];this.Qi=[];this.Ji=[];this.tr=[];this.Me=[];this.config=new Br;this.$t=F(i,0);}destroy(){this.$t.cancel();}Oe(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.S.find(o=>o.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.S.push(this.Oe(i,t)),this.$t();}addActivity(i,t){let e=this.kt.find(o=>o.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.kt.push(this.Oe(i,t)),this.$t();}addFileAction(i,t){this.Qi.push(this.Oe(i,t)),this.$t();}addFileHook(i,t){this.Ji.push(this.Oe(i,{timeout:3e4,...t})),this.$t();}addIcon(i,t){this.tr.push(this.Oe(i,t)),this.$t();}addL10n(i,t){this.Me.push(this.Oe(i,t)),this.$t();}addConfig(i,t){this.config.register(i,t),this.$t();}purge(i){this.S=this.S.filter(t=>t.pluginId!==i),this.kt=this.kt.filter(t=>t.pluginId!==i),this.Qi=this.Qi.filter(t=>t.pluginId!==i),this.Ji=this.Ji.filter(t=>t.pluginId!==i),this.tr=this.tr.filter(t=>t.pluginId!==i),this.Me=this.Me.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.S],activities:[...this.kt],fileActions:[...this.Qi],fileHooks:[...this.Ji],icons:[...this.tr],l10n:[...this.Me]}}};var Hr=class extends K{constructor(t){super(t);this.ae=new Map;this.f=new Set;this.To=Promise.resolve();this.registry=new zr(()=>this.er());this.$n=new _r(this.r,e=>{this.To=this.To.then(()=>e).then(o=>{if(o)return this.vu(o)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.To}onPluginsChange(t){return this.f.add(t),()=>{this.f.delete(t);}}async vu(t){let e=new Set(this.ae.keys()),o=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(o.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(o.add(s.id),!this.ae.has(s.id))try{await this.yu(s);}catch(n){this.registry.purge(s.id),this.er(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.xo(s);}async yu(t){this.ae.has(t.id)&&this.xo(t.id);let e=[],o=xa(this.registry,this.r,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:o,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.E("Failed to unsubscribe config listener",c);}throw a}this.ae.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.er();}xo(t){let e=this.ae.get(t);if(e){this.registry.purge(t);for(let o of e.configSubscriptions)try{o();}catch(s){this.E("Failed to unsubscribe config listener",s);}e.dispose?.(),this.ae.delete(t),this.er();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let o=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(o.length===0)return;let s=e,n=new AbortController;for(let a of o){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",Ge(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.ae.keys()))this.xo(t);this.registry.destroy(),this.$n.destroy(),super.destroy();}er(){for(let t of this.f)try{t();}catch{}}};function vd(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Es(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Es(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=vd(i);return typeof t=="object"&&t!==null?[e,Es(t)]:[e,t]}))}function yd(r){return {ok:true,value:r}}function ws(r){return {ok:false,error:r}}var bd="https://tlm.uploadcare.com/api/",Ts=class{constructor(i=bd){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return ws(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return yd(s)}catch(s){return ws(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return ws(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(Es(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},wd=async(r,i)=>({success:true,data:i}),Ed=async r=>wd(void 0,r),Kr=class extends Ts{constructor(){super();}async sendEvent(i,t){let e=await Ed(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 Td=20,V=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),jr=class extends K{constructor(){super(...arguments);this.ni=new Map;this.ir=new Set;this.yt=new Map;}bindTarget(t){return this.ir.add(t),()=>{this.ir.delete(t);}}on(t,e){let o=this.yt.get(t);return o||(o=new Set,this.yt.set(t,o)),o.add(e),()=>this.yt.get(t)?.delete(e)}Dn(t,e){for(let s of this.ir)s.dispatchEvent(new CustomEvent(t,{detail:e}));let o=this.yt.get(t);if(o)for(let s of o)s(e);this.E?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Dn(t,typeof e=="function"?e():e);return}this.ni.has(t)&&window.clearTimeout(this.ni.get(t));let n=typeof s=="number"?s:Td,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Dn(t,l),this.ni.delete(t);}catch(l){this.E?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ni.set(t,a);}destroy(){for(let t of this.ni.values())window.clearTimeout(t);this.ir.clear(),this.yt.clear();}};var Sa="1.34.1";var Dt="blocks",Ft=Sa;var Aa=["authToken","secureSignature"],Cs="<redacted>",ka=r=>Aa.includes(r),Gr=r=>{let i={...r};for(let t of Aa)i[t]!==void 0&&i[t]!==null&&(i[t]=Cs);return i};var qr=class extends K{constructor(t){super(t);this.bu=nt.generateRandomUUID();this.Ie=structuredClone(et);this.Co=false;this.So=null;this.jt=false;this.Fn=new Kr,this.Pe=new le(10),this.addSub(this.r.sub(x("qualityInsights"),e=>{this.jt=!!e;}));for(let e of Object.keys(this.Ie))this.addSub(this.r.sub(x(e),o=>{if(!this.jt)return;let s=this.Co&&this.Ie[e]!==o;this.wu(e,o),s&&this.sendEvent({eventType:V.CHANGE_CONFIG});}));}Eu(t){t===V.INIT_SOLUTION&&!this.Co&&(this.Co=true);}wu(t,e){this.Ie[t]!==e&&(this.Ie[t]=e);}Tu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===V.INIT_SOLUTION||t.eventType===V.CHANGE_CONFIG)&&(o.config=Gr(this.Ie)),{...o,appVersion:Ft,appName:Dt,sessionId:this.bu,component:this.xu,activity:this.Cu,projectPubkey:this.Ie.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.Su,payload:{location:this.Au,...e}}}ku(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.jt)return;let e=this.Tu({eventType:t.eventType,payload:t.payload,config:t.config});this.Eu(t.eventType),!(this.ku(t.eventType)||this.So&&this.Nn(this.So,e))&&this.Pe.add(async()=>{this.So=e,await this.Fn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:V.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Nn(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.Nn(t[n],e[n]))return false;return true}get Su(){return Date.now()}get xu(){if(!this.r.has("*solution"))return null;let t=this.r.read("*solution");return t?t.toLowerCase():null}get Cu(){return this.r.has("*currentActivity")?this.r.read("*currentActivity"):null}get Au(){return location.origin}};var Ma=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};var xd=r=>r;var Oa="plural:";function qe(r,i={},t={}){let{openToken:e="{{",closeToken:o="}}",transform:s=xd}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);r=r.replaceAll(e+n+o,c);}return r}function Ia(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(Oa)){let s=r.substring(t+2,e).replace(Oa,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}var La="--uploadcare-blocks-window-height",Ai=class r{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(La,`${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(La);}};var Wr=(r,i)=>new Intl.PluralRules(r).select(i);var Sd=r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=Wr(o,t);return e(`${i}__${s}`)},Zr=r=>{let i=Sd(()=>t),t=(e,o={})=>{if(!e)return "";let n=r().read(Qt(e))||e,a=Ia(n);for(let c of a)o[c.variable]=i(c.pluralKey,Number(o[c.countVariable]));return qe(n,o)};return t};var Ra=r=>r.tagName?.includes("-")??false,Pa=r=>{for(let i=r.parentElement;i;i=i.parentElement)if(Ra(i))return i;return null},Yr=class{constructor(i){this.le=new Set;this.rr=new Map;this.Vn=false;this.ce=i,this.ce.addController(this);}hostDisconnected(){this.or?.(),this.or=void 0,this.le.clear(),this.rr.clear();}hostUpdated(){if(!this.or&&this.ce.has(x("testMode"))){let i=this.ce.subConfigValue("testMode",t=>{this.Vn=!!t,this._n();});this.or=i;}this.Mu(),this._n();}Mu(){let i=this.ce,t=i.renderRoot??i;if(!t)return;let e=this.ce,o=Array.from(t.querySelectorAll("[data-testid]")).filter(s=>!Ra(s));for(let s of o)if(Pa(s)===e&&!this.le.has(s)){let n=s.getAttribute("data-testid");if(!n)continue;this.le.add(s),this.rr.set(s,n);}for(let s of Array.from(this.le))(!s.isConnected||Pa(s)!==e)&&(this.le.delete(s),this.rr.delete(s));}_n(){if(!this.le.size)return;let i=this.ce.testId||"";for(let t of this.le){let e=this.rr.get(t);e&&(this.Vn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Ad=_e(gr()(Ne(hr(xt)))),T=class extends Ad{constructor(){super();this.init$=ps();this.l10n=Zr(()=>this.sharedCtx);this.debugPrint=Er(()=>this.sharedCtx,this.constructor.name);this.e=Wn(()=>this.sharedCtx);new Yr(this);}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(),Ai.registerClient(this);}initCallback(){this.W("*blocksRegistry",()=>new Set),this.W("*pluginManager",t=>new Hr(t)),this.W("*eventEmitter",t=>new jr(t)),this.W("*localeManager",t=>new Vr(t)),this.W("*modalManager",t=>new Tr(t)),this.W("*a11y",()=>new Fr),this.W("*routerLayer",t=>new Dr(t)),this.W("*clipboard",t=>new $r(t)),this.W("*telemetryManager",t=>new qr(t)),this.sub(Qt("locale-id"),t=>{let e=Ma(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.J("*modalManager",false)}get telemetryManager(){return this.J("*telemetryManager")}get localeManager(){return this.J("*localeManager")}get a11y(){return this.J("*a11y")}get clipboardLayer(){return this.J("*clipboard")}get routerLayer(){return this.J("*routerLayer")}get blocksRegistry(){return this.J("*blocksRegistry")}get eventEmitter(){return this.J("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ai.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Ou(),G.deleteCtx(this.ctxName);}Bn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}W(t,e){let o=this.Bn();if(!o.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),o.set(t,s);return}}Ou(){let t=this.Bn();for(let[e,o]of t.entries())o?.destroy?.(),this.pub(e,null);t.clear();}J(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:br(t),cdnUrlModifiers:Wo(t),fileName:yr(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?qe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.oe){let t={};this.oe=new Proxy(t,{set:(e,o,s)=>{if(typeof o!="string"||!(o in et))return false;let n=o,a=x(n);return this.has(a)||this.add(a,et[n]),this.$[a]=s,true},get:(e,o)=>{let s=x(o);return this.has(s)||this.add(s,et[o]),this.$[s]}});}return this.oe}subConfigValue(t,e){let o=x(t);return this.has(o)||this.add(o,et[t]),this.sub(o,e)}};var Vt={ATTRIBUTE:1,CHILD:2},ct=r=>(...i)=>({ao:r,values:i}),ft=class{constructor(i){}get tt(){return this.g.tt}lo(i,t,e){this.sr=i,this.g=t,this.Iu=e;}Jc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Ie=class extends ft{constructor(i){if(super(i),this.it=U,i.type!==Vt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.zn=void 0,this.it=i;if(i===st)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.zn;this.it=i;let t=[i];return t.raw=t,this.zn={zt:this.constructor.resultType,strings:t,values:[]}}};Ie.directiveName="unsafeHTML",Ie.resultType=1;var ki=class extends Ie{};ki.directiveName="unsafeSVG",ki.resultType=2;var We=ct(ki);var Ua="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 16 16' id='uc-icon-paperclip' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M13.264 9.743 9.03 13.977a4.217 4.217 0 0 1-5.96-.005 4.217 4.217 0 0 1-.004-5.96l6.416-6.416a2.743 2.743 0 0 1 3.88 3.88L7.637 11.2a1.232 1.232 0 1 1-1.743-1.743L9.42 5.932'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-preloader' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' style='stroke-dasharray:100 100;stroke-dashoffset:var(--l-progress-offset, 100);transition:stroke-dashoffset .6s linear' transform='rotate(-90 12 12)'/><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' opacity='.2'/></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 Jt=class extends T{constructor(){super(...arguments);this.init$=ma(this);}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return v`${We(Ua)}`}};var Xr=class extends K{constructor(){super(...arguments);this.Le=null;this.Pu=()=>{let{authToken:t}=this.Ut;return typeof t!="function"?Promise.resolve(typeof t=="string"?t:""):(this.Le?this.Le.fetchToken=t:(this.E("Creating the auth token cache."),this.Le=new xr({fetchToken:t})),this.Le.getToken())};}getAuthToken(){let{authToken:t}=this.Ut;if(t)return typeof t=="string"?t:this.Pu}invalidate(){this.Le?.invalidate();}destroy(){super.destroy(),this.Le=null;}};var $a=r=>typeof r!="number"?0:Math.floor(r/1e3),Da=(r,{threshold:i})=>{let{secureExpire:t}=r,e=$a(Date.now()),o=Number(t),s=$a(i);return e+s>=o};var Qr=class extends K{constructor(){super(...arguments);this.ue=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.Ut;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.ue||Da(this.ue,{threshold:s})){this.ue?this.E("Secure signature is expired. Resolving a new one..."):this.E("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.E("Secure signature resolved:",n),this.E("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.ue=n):(this.E("Secure signature resolver returned nothing."),this.ue=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ue}return t&&e?(this.E("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ue=null;}};var xs=(r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Ss=(r,i)=>{let t=i.Lu;if(t)return {type:"GROUP_ERROR",message:t.message,payload:{error:t}}};var As=(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}}};var ks=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=Nr([...t?Si:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let a=bs(s,o),l=Ca(n,o);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};var Ms=(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}}};var Nt=1e3,Le=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Mi=r=>Math.ceil(r*100)/100,Fa=(r,i=Le.AUTO)=>{let t=i===Le.AUTO;if(i===Le.BYTE||t&&r<Nt**1){let o=Wr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===Le.KB||t&&r<Nt**2?`${Mi(r/Nt**1)} KB`:i===Le.MB||t&&r<Nt**3?`${Mi(r/Nt**2)} MB`:i===Le.GB||t&&r<Nt**4?`${Mi(r/Nt**3)} GB`:i===Le.TB||t&&r<Nt**5?`${Mi(r/Nt**4)} TB`:`${Mi(r/Nt**5)} PB`};var Os=(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:Fa(t)}),payload:{entry:r}}};var Is=(r,i)=>{let{internalId:t}=r;if(!i.m.hasItem(t))return;let o=i.m.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof Wt)return {type:"AUTH_TOKEN_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof $t)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Ke)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}}};var Ze={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."},kd=r=>typeof r=="function"?{runOn:"change",validator:r}:r,Jr=class extends K{constructor(t){super(t);this.Ru=[Ms,ks,Os,Is];this.Uu=[As,xs,Ss];this.Pe=new le(20);this.Hn=F(()=>{this.Pe.run();},500);this.Gt=false;this.Re=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.r.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.r.sub(x("multipleMin"),e)),this.addSub(this.r.sub(x("multipleMax"),e)),this.addSub(this.r.sub(x("multiple"),e)),this.addSub(this.r.sub(x("imgOnly"),e)),this.addSub(this.r.sub(x("accept"),e)),this.addSub(this.r.sub(x("validationConcurrency"),o=>{this.Pe.concurrency=o;}));}get m(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Gt)return;let o=e??this.m.items();for(let s of o){let n=this.m.read(s);n&&this.$u(n,t);}}runCollectionValidators(){if(this.Gt)return;let t=this.e.api,e=t.getOutputCollectionState(),o=[],s=this.Ut.collectionValidators;for(let n of [...this.Uu,...s])try{let a=n(e,t);if(!a)continue;a&&(o.push(this.Kn(a)),a.message||console.warn(Ze.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Ze.COLLECTION_VALIDATION_FAILED,a);}this.r.pub("*collectionErrors",o),o.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Re.get(t.uid);e&&(e.abortController?.abort(),this.Re.delete(t.uid));}async $u(t,e){if(this.Gt)return;let o=this.e.api,s=this.jn(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Gt||(await n,this.Gt))return;let l=this.Du(t,e);if(l.length===0||!this.m.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=o.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.Ut.validationTimeout,h=this.Gn(),f=new Set(l.map(b=>b.validator)),g=[];for(let b of h)if(!f.has(b.validator)){let E=s.lastErrorThrownByValidator.get(b.validator);E&&g.push(E);}let w=l.map(b=>async()=>{if(this.Gt)return;let E=setTimeout(()=>{s.skippedValidators.add(b.validator),d.abort(),console.warn(Ze.FILE_VALIDATION_TIMEOUT);},u);try{let S=await b.validator(c,o,{signal:d.signal});if(!S||d.signal.aborted){s.lastErrorThrownByValidator.set(b.validator,void 0);return}let N=this.Kn(S);s.lastErrorThrownByValidator.set(b.validator,N),g.push(N),S.message||console.warn(Ze.MISSING_ERROR_MESSAGE);}catch(S){d.signal.aborted||(s.skippedValidators.add(b.validator),console.warn(Ze.FILE_VALIDATION_FAILED,S),this.e.telemetryManager.sendEventError(S,`file validator. ${Ze.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(E),b.runOn!=="change"&&s.skippedValidators.add(b.validator);}});if(this.Hn(),await this.Pe.add(async()=>{this.Gt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(b=>b())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Kn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}jn(t){let e=this.Re.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Re.set(t.uid,o),o}Gn(){let t=this.Ut.fileValidators;return [...this.Ru,...t].map(kd)}Du(t,e){let o=this.jn(t);return this.Gn().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Gt=true,this.Hn.cancel();for(let t of this.Re.values())t.abortController?.abort(),t.promise=void 0;this.Re.clear();}};var Va="[Typed State] Wrong property name: ",to=class{constructor(i){this.gt=nt.generateFastUid(),this.ot=G.registerCtx(i,this.gt);}get uid(){return this.gt}setValue(i,t){if(!this.ot.has(i)){console.warn(`${Va}${String(i)}`);return}this.ot.read(i)!==t&&this.ot.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.ot.has(i)||console.warn(`${Va}${String(i)}`),this.ot.read(i)}subscribe(i,t){return this.ot.sub(i,t)}destroy(){G.deleteCtx(this.gt);}};var eo=class r{constructor(i){this.qt=Object.create(null);this.nr=new Set;this.ar=new Set;this.at=new Set;this.Ao=new Set;this.ko=new Set;this.Ue=new Set;this.Zn=i.initialValue,this.gt=nt.generateFastUid(),this.ot=G.registerCtx({},this.gt),this.qn=i.watchList||[];let t=Object.create(null);this.Wn=(e,o)=>{this.ai&&window.clearTimeout(this.ai),t[e]||(t[e]=new Set),t[e].add(o),this.ai=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.nr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Yn();},i.handler&&this.observeCollection(i.handler);}static{this.Fu=1e4;}Q(){this.li&&window.clearTimeout(this.li),this.li=window.setTimeout(()=>{let i=new Set(this.ko),t=new Set(this.Ao);this.ko.clear(),this.Ao.clear();for(let e of this.ar)e?.([...this.at],i,t);this.Yn();});}Yn(){this.Ue.size!==0&&(this.ci&&window.clearTimeout(this.ci),this.ci=window.setTimeout(()=>{let i=[...this.Ue];this.Ue.clear();for(let t of i)t.destroy();},r.Fu));}observeCollection(i){return this.ar.add(i),this.at.size>0&&this.Q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.ar.delete(i);}add(i,t={}){let e=new to(this.Zn);for(let[o,s]of Object.entries(i))e.setValue(o,s);if(t.index===void 0)this.at.add(e.uid);else {let o=[...this.at],s=Math.min(Math.max(Math.trunc(t.index)||0,0),o.length);o.splice(s,0,e.uid),this.at=new Set(o);}return this.Q(),this.ot.add(e.uid,e),this.ko.add(e),this.qn.forEach(o=>{this.qt[e.uid]||(this.qt[e.uid]=[]),this.qt[e.uid]?.push(e.subscribe(o,()=>{this.Wn(o,e.uid);}));}),e.uid}hasItem(i){return this.at.has(i)}read(i){return this.ot.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.Ao.add(t),this.Ue.add(t)),this.at.delete(i),this.Q(),this.ot.pub(i,void 0),this.qt[i]?.forEach(e=>{e();}),delete this.qt[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.at.forEach(i=>{this.abort(i);});}clearAll(){this.at.forEach(i=>{this.remove(i);});}observeProperties(i){return this.nr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.nr.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.ai&&window.clearTimeout(this.ai),this.li&&window.clearTimeout(this.li),this.ci&&window.clearTimeout(this.ci);for(let i of this.Ue)i.destroy();this.Ue.clear(),G.deleteCtx(this.gt),this.nr=new Set,this.ar=new Set;for(let i of Object.keys(this.qt))this.qt[i]?.forEach(t=>{t();}),delete this.qt[i];}};var P=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Na=r=>({isVideoRecordingEnabled:Z(r.cameraModes).includes(P.VIDEO),isPhotoEnabled:Z(r.cameraModes).includes(P.PHOTO)});var _a=(r,i)=>{for(let t of r)if(i(t))return t};var Ls=(r,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(o=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of r)if(i(l)){clearTimeout(n),o(l);return}s=requestAnimationFrame(a);};a();});function io(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}var Md=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Od=new RegExp(`^/?(${Md.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Ba=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(Ti),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=Od.exec(o.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),Id=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),R=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Id,...mt}),Ld={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},za=r=>Ld[r]??r;var ro=r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e));function Ha(r){let i=new Map;return (...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s}}var Ka=new Set;function oo(r){Ka.has(r)||(Ka.add(r),console.warn(r));}function Pd(r){let i=false;return setTimeout(()=>{i=true;},0),e=>((...o)=>(i&&oo(r),e(...o)))}function ja(r){let i={},t=r.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>r.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>ro(r),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},o=Pd("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=Ha(o(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var Ga={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,tags:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};function Ps(r){return {fileInfo:r,uuid:r.uuid,cdnUrl:r.cdnUrl,fileName:r.originalFilename??null,fileSize:r.size,isImage:r.isImage??false,mimeType:r.contentInfo?.mime?.mime??r.mimeType??null,uploadProgress:100}}var so=class extends K{constructor(){super(...arguments);this.Me=Zr(()=>this.r);this.addFileFromUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({uuid:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=Ba({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.m.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let a=this.m.add({file:t,isImage:Ge(t),mimeType:t.type||null,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??R.API,fullPath:n??null});return this.getOutputItem(a)};this.addFileFromUploadcareFile=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.m.add({...Ps(t),fileName:o??t.originalFilename??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.replaceFile=(t,e,{silent:o,fileName:s,source:n}={})=>{let a=t,l=this.m,c=l.items().indexOf(a),d=l.read(a);if(c===-1||!d)throw new Error(`File with internalId ${t} not found`);let u={source:d.getValue("source"),metadata:d.getValue("metadata"),fullPath:d.getValue("fullPath"),silent:d.getValue("silent")};l.remove(a);let h=l.add({...Ps(e),fileName:s??e.originalFilename??null,silent:o??u.silent,source:n??u.source??R.API,metadata:u.metadata,fullPath:u.fullPath},{index:c});return this.getOutputItem(h)};this.removeFileByInternalId=t=>{if(!this.m.read(t))throw new Error(`File with internalId ${t} not found`);this.m.remove(t);};this.uploadAll=()=>{let t=this.m.items().filter(e=>{let o=this.m.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.r.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=jt(Nr([this.cfg.accept??"",...this.cfg.imgOnly?Si:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),io(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Na(this.cfg);t.modeCamera===P.PHOTO&&n?s.accept=xi:t.modeCamera===P.VIDEO&&a?s.accept=ys:s.accept=[xi,a&&ys].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?R.CAMERA:R.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.m.size>0&&!t)this.r.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST);else if(this.Xn?.length===1){let e=this.Xn[0];this.Mo().then(()=>{let o=this.e.pluginManager.snapshot().sources,s=o.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(o.find(l=>l.id===n[0])??s).onSelect():(this.r.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM));return}this.r.read("*currentActivity")&&this.e.modalManager?.open(this.r.read("*currentActivity"));});}else this.r.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM);};this.doneFlow=()=>{let t=_a(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.r.pub("*currentActivity",t.doneActivity),this.r.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.r.read("*currentActivity")||this.e.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.Mo().then(()=>{this.r.pub("*currentActivityParams",e[0]??{}),this.r.pub("*currentActivity",t),Ls(this.e.blocksRegistry,o=>o.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getAuthToken=()=>this.e.authTokenManager?.getAuthToken();this.invalidateAuthToken=()=>{this.e.authTokenManager?.invalidate();};this.getCurrentActivity=()=>this.r.read("*currentActivity");this.historyBack=()=>{this.r.read("*historyBack")?.();};this.setModalState=t=>{this.Mo().then(()=>{if(!t){this.e.modalManager?.close(this.r.read("*currentActivity")),this.r.pub("*currentActivity",null);return}let e=this.r.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return Ls(this.e.blocksRegistry,o=>o.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get m(){return this.e.uploadCollection}get Lu(){return this.r.read("*groupError")}get cfg(){return this.Ut}get l10n(){return this.Me}removeAllFiles(){this.m.clearAll();}getOutputItem(t){let e=G.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:o.fileName??s?.originalFilename??null,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,tags:o.tags??s?.tags??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 ja(this.e)}async Mo(){return (await this.e.wait("pluginManager")).pluginsReady()}get Xn(){let t=[];return this.cfg.sourceList&&(t=J(this.cfg.sourceList)),t}};var Oi=33.333333333333336,k=1,Rs=24,qa=6;function de(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function wt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return de(t,i),t}function Wa(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,o+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,o+l*n+1.5*d],f=[e+a*s-24*t*c+1.5*c,o+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,w=[h[0],h[1]];return {d:g,center:w}}function Za(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,g;a?(f=[e+c*s-34*t/2,o+d*n+1.5*h],g=[e+c*s+34*t/2,o+d*n+1.5*h]):(f=[e+c*s+1.5*u,o+d*n-34*t/2],g=[e+c*s+1.5*u,o+d*n+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,b=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:w,center:b}}function Ya(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function Xa({rect:r,delta:[i,t],imageBox:e}){return Xe({...r,x:r.x+i,y:r.y+t},e)}function Xe(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}}function Rd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;s+=o,a-=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,a=r.y+r.height-s,t&&(n=a*t,l=r.x+r.width/2-n/2)),l<=e.x&&(l=e.x,s=r.y+r.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y+r.height-a),a<k&&(a=k,t&&(n=a*t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),n<k&&(n=k,t&&(a=n/t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),{x:l,y:s,width:n,height:a}}function Ud({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;s+=o,n-=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(a=n/t,l=r.y+r.height/2-a/2)),l<=e.y&&(l=e.y,s=r.x+r.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x+r.width-n),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),{x:s,y:l,width:n,height:a}}function $d({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;a+=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=r.x+r.width/2-n/2),l<=e.x&&(l=e.x,s=r.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y),a<k&&(a=k,t&&(n=a*t),l=r.x+r.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:s,width:n,height:a}}function Dd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;n+=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=r.y+r.height/2-a/2),l<=e.y&&(l=e.y,s=r.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:s,y:l,width:n,height:a}}function Fd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+s<e.y&&(s=e.y-a),n+=o,l-=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x+r.width-l,a=e.y)):t&&(o=c*t-l,l=l+o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Vd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x,a=e.y)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Nd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=o,l-=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x+r.width-l,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function _d({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function Qa({direction:r,...i}){switch(r){case "n":return Rd(i);case "w":return Ud(i);case "s":return $d(i);case "e":return Dd(i);case "nw":return Fd(i);case "ne":return Vd(i);case "sw":return Nd(i);case "se":return _d(i);default:return i.rect}}function Ja(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function tl(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}function el(r,i){return Math.abs(r.width/r.height-i)<.1}function Qe({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function il(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),a=Math.round((i-s)/2);return n+o>r&&(o=r-n),a+s>i&&(s=i-a),{x:n,y:a,width:o,height:s}}function Je(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function pe(r,i,t){return Math.min(Math.max(r,i),t)}var Ii=["free"],ao=r=>{let i=J(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&&!Ii.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),a=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Ii.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:nt.generateFastUid(),type:"aspect-ratio",width:Ii.includes(o)?0:n,height:Ii.includes(o)?0:a,hasFreeform:Ii.includes(o)});}return t},rl=(r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(o-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(o-c)/c>e)return null}return s};function ol(r){return ss({...r,libraryName:Dt,libraryVersion:Ft})}var sl="active",ti="___ACTIVITY_IS_ACTIVE___",nl,$=class r extends(nl=T,nl){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=hs(this);this.Nu=F(this.Vu.bind(this),10);}Qn(){let t=r.ui.get(this);this[ti]=false,this.removeAttribute(sl),t?.deactivateCallback?.();}_u(){let t=r.ui.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[ti]=true,this.setAttribute(sl,""),t?.activateCallback?.(),this.Nu(),this.emit(A.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[ti]?this.Qn():this.activityType===t&&!this[ti]&&this._u();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let o=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=o??null;}t||(this.$["*history"]=[]);}));}Vu(){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);}Jn(){return !!this.activityType&&r.ui.has(this)}static{this.ui=new Map;}get isActivityActive(){return !!this[ti]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.ui.set(this,{activateCallback:o,deactivateCallback:s});}Bu(){this.isActivityActive&&this.Qn(),r.ui.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Jn()&&this.Bu();}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:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};$.activities=D;var M=class r extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.lr=false;this.init$=fs(this);this.Lo=0;this.Po=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Gu(e);},300);this.Ku=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.Lo+=1,this.$["*groupInfo"]=null,this.$["*groupError"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of 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(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.ia(),this.Po();}};this.ju=t=>{if(!this.isConnected)return;this.Po();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["file","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)&&!!G.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=G.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.ia();}if(t.isUploading)for(let s of t.isUploading){let n=G.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=G.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.qu();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=G.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.ia=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get zu(){return this.hasBlockInCtx(t=>t instanceof r?t.lr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.W("*uploadCollection",()=>new eo({initialValue:Ga,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.W("*secureUploadsManager",t=>new Qr(t)),this.W("*authTokenManager",t=>new Xr(t)),this.W("*validationManager",t=>new Jr(t)),this.W("*publicApi",t=>new so(t)),!this.zu&&this.couldBeCtxOwner&&this.Hu();}getAPI(){return this.api}get validationManager(){return this.J("*validationManager")}get api(){return this.J("*publicApi")}get uploadCollection(){return this.J("*uploadCollection")}get secureUploadsManager(){return this.J("*secureUploadsManager")}get authTokenManager(){return this.J("*authTokenManager")}disconnectedCallback(){super.disconnectedCallback(),this.lr&&this.ta(),this.Po.cancel();}connectedCallback(){super.connectedCallback(),this.lr&&this.ea();}Hu(){this.lr=true,this.ea(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}ea(){this.ta(),this.Oo=this.uploadCollection.observeCollection(this.Ku),this.Io=this.uploadCollection.observeProperties(this.ju);}ta(){this.Io?.(),this.Oo?.(),this.Io=void 0,this.Oo=void 0;}async Gu(t){let e=this.Lo,o=()=>e===this.Lo;try{let s=await this.getUploadClientOptions(),n=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),a=await fa(n,s);if(!o())return;this.$["*groupInfo"]=a,this.$["*groupError"]=null;let l=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,l),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l;}catch(s){if(!o())return;this.$["*groupError"]=s instanceof Error?s:new Error("Failed to create a group",{cause:s}),this.validationManager.runCollectionValidators();}}qu(){let t=ao(this.cfg.cropPreset);if(!t)return;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:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=il(a,l,c),u=at(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:Q(h,u)});}}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 getTagsFor(t){let e=this.cfg.tags||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}return e}async getUploadClientOptions(){let t=this.authTokenManager.getAuthToken(),e=t?null:await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:ol,integration:this.cfg.userAgentIntegration,authToken:t,secureSignature:e?.secureSignature,secureExpire:e?.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 ro(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...R});var he=class extends T{constructor(){super(...arguments);this.name="";this.cr="";this.di=null;this.ra=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.ra=e,this.Ro();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.Ro()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ro();}Ro(){if(!this.name){this.cr="",this.di=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.di=e.svg,this.cr="";return}this.di=null;let o=`#uc-icon-${this.name}`,s=this.ra?.(this.name);this.cr=s??o;}render(){return this.di?v`${this.yield("",v`${We(this.di)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.cr}></use></svg>`)} `}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback();}};p([y({type:String})],he.prototype,"name",2),p([m()],he.prototype,"cr",2),p([m()],he.prototype,"di",2);var al=r=>[...new Set(r)];var Pe="--uc-img-",Us="unresolved";var $s=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Ds=3e3,Fs=5e3,Vs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Bd="https://ucarecdn.com",ei=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Bd},"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 lo=class extends Ne(_e(xt)){constructor(){super();this.$e={};this.f=new Map;this.De=null;this.ur=null;for(let t in ei){let e=ei[t];this.$e[Pe+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.$e[Pe+t]}set$$(t){for(let e in t){let o=Pe+e,s=t[e];this.$e[o]=s,this.Q(o,s);}}sub$$(t,e){let o=Pe+t;this.f.has(o)||this.f.set(o,new Set),this.f.get(o)?.add(e);let s=this.$e[o];s!==null&&s!==""&&e(s);}Q(t,e){this.f.has(t)&&this.f.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${Dt}/${Ft}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;ei[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.De=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.De?.unobserve(t));});},o),this.De.observe(t),this.ur||(this.ur=new Set),this.ur.add(t);}connectedCallback(){super.connectedCallback(),this.Wu();}Wu(){for(let t in ei){let e=Pe+t,o=this.getCssData(e,true);o!=null&&(this.$e[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.De&&(this.ur?.forEach(t=>{this.De?.unobserve(t);}),this.De=null),this.f.clear();}static get observedAttributes(){return Object.keys(ei)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Pe+t;this.$e[s]=o,this.Q(s,o);});}};var ll=r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var po=class extends lo{constructor(){super(...arguments);this.Dt=new Image;this.Mt=new Image;}oa(t){return !t.includes("//")&&!$s&&(t=new URL(t,document.baseURI).href),t}dr(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)>Fs&&this.sa?Fs+s:Number(n)>Ds&&!this.sa?Ds+s:t}Zu(t,e){let o={format:this.Uo("format"),quality:this.Uo("quality"),resize:this.dr(t),blur:e,"cdn-operations":this.Uo("cdn-operations")??void 0,analytics:this.analyticsParams()};return at(...ll(o))}Uo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}bt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if($s&&o&&!o.includes("//"))return this.pi(o);let s=this.Zu(t,e),n=this.$$("cdn-cname"),a=n;if(o.startsWith(String(n)))return Q(o,s);let l=this.$$("uuid");if(a&&l)return this.pi(Q(ne(a,l),s));if(l)return this.pi(Q(ne(a,l),s));let c=this.$$("proxy-cname");if(c)return this.pi(Q(c,s,this.oa(o)));let d=this.$$("pubkey");if(d)return this.pi(Q(`https://${d}.ucr.io/`,s,this.oa(o)))}pi(t){let e=this.$$("secure-delivery-proxy");return e?qe(e,{previewUrl:t},{transform:o=>window.encodeURIComponent(o)}):t}Fe(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=o?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Yu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Ft||(this.$o({elNode:this.Dt}),this.appendChild(this.Dt)),this.Dt}get pr(){return this.Ft?{type:Vs.PREVIEW,img:this.Mt}:{type:Vs.MAIN,img:this.img}}get Ft(){return this.$$("is-preview-blur")}get na(){return this.$$("is-background-for")}get aa(){let t=this.$$("breakpoints");if(t){let e=J(t);return al(e.map(o=>parseInt(o,10)))}else return null}get sa(){return this.$$("format").toLowerCase()==="jpeg"}la(t){let e=new Set;e.add(`url("${this.bt(this.Fe(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.bt(this.Fe(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.bt(this.Fe(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}ca(){let t=new Set;return this.aa?this.aa.forEach(e=>{t.add(`${this.bt(`${e}x`)} ${this.dr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.bt(`${e*2}x`)} ${this.dr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.bt(`${e*3}x`)} ${this.dr(`${e*3}w`)}`);}):(t.add(`${this.bt(this.Fe(this.pr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.bt(this.Fe(this.pr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.bt(this.Fe(this.pr.img,3))} 3x`)),[...t].join()}ua(){return this.bt()}get da(){return this.bt("100x","100")}Xu(){let t=this.na;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.la(e);}):this.la(e);});}Qu({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}$o({elNode:t}){this.Yu(t),this.initAttributes(t);}Do({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.$o({elNode:o}),o.setAttribute(Us,""),o.addEventListener("load",()=>{o.removeAttribute(Us),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Qu({elNode:o,src:t,srcset:e});})}async Ju(){if(this.$$("intersection")){this.Ft&&(this.$o({elNode:this.Mt}),this.appendChild(this.Mt)),this.initIntersection(this.pr.img,async()=>{this.Ft&&(this.Mt.src=this.da);try{await this.Do({src:this.ua(),srcset:this.ca(),elNode:this.Dt}),this.Ft&&await this.Mt.remove(),this.appendChild(this.Dt);}catch{this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}});return}try{this.Ft&&(await this.Do({src:this.da,elNode:this.Mt}),this.appendChild(this.Mt)),await this.Do({src:this.ua(),srcset:this.ca(),elNode:this.Dt}),this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}catch{this.Ft&&await this.Mt?.remove(),this.appendChild(this.Dt);}}init(){this.na?this.Xu():this.Ju();}};var Ns=class extends po{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:zd}=Pn,cl=r=>r;var _s=(r,i)=>r?.zt!==void 0,dl=r=>r?.zt?.h!=null;var pl=r=>r.strings===void 0,ul=()=>document.createComment(""),te=(r,i,t)=>{let e=r.Rt.parentNode,o=i===void 0?r.Ce:i.Rt;if(t===void 0){let s=e.insertBefore(ul(),o),n=e.insertBefore(ul(),o);t=new zd(s,n,r,r.options);}else {let s=t.Ce.nextSibling,n=t.g,a=n!==r;if(a){let l;t.td?.(r),t.g=r,t.Hi!==void 0&&(l=r.tt)!==n.tt&&t.Hi(l);}if(s!==o||a){let l=t.Rt;for(;l!==s;){let c=cl(l).nextSibling;cl(e).insertBefore(l,o),l=c;}}}return t},fe=(r,i,t=r)=>(r.St(i,t),r),Hd={},Li=(r,i=Hd)=>r.s=i,Pi=r=>r.s,ho=r=>{r.Se(),r.Rt.remove();},hl=r=>{r.Se();};var Ri=(r,i)=>{let t=r.Ct;if(t===void 0)return false;for(let e of t)e.yn?.(i,false),Ri(e,i);return true},fo=r=>{let i,t;do{if((i=r.g)===void 0)break;t=i.Ct,t.delete(r),r=i;}while(t?.size===0)},fl=r=>{for(let i;i=r.g;r=i){let t=i.Ct;if(t===void 0)i.Ct=t=new Set;else if(t.has(r))break;t.add(r),Gd(i);}};function Kd(r){this.Ct!==void 0?(fo(this),this.g=r,fl(this)):this.g=r;}function jd(r,i=false,t=0){let e=this.s,o=this.Ct;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ri(e[s],false),fo(e[s]);else e!=null&&(Ri(e,false),fo(e));else Ri(this,r);}var Gd=r=>{r.type==Vt.CHILD&&(r.Hi??=jd,r.td??=Kd);},mo=class extends ft{constructor(){super(...arguments),this.Ct=void 0;}lo(i,t,e){super.lo(i,t,e),fl(this),this.isConnected=i.tt;}yn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ri(this,i),fo(this));}setValue(i){if(pl(this.sr))this.sr.St(i,this);else {let t=[...this.sr.s];t[this.Iu]=i,this.sr.St(t,this,0);}}disconnected(){}reconnected(){}};var O=()=>new zs,zs=class{},Bs=new WeakMap,I=ct(class extends mo{render(r){return U}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)),U}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Bs.get(i);t===void 0&&(t=new WeakMap,Bs.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"?Bs.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 Hs=null,Ui=class extends T{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]===this.id&&(this.$["*currentActivity"]=null));};this.ed=()=>{this.closeDialog();};this.rd=t=>{this.Fo=t.target;};this.od=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Fo&&this.closeDialog();};this.hi=({id:t})=>{t===this.id?(Hs=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.fi=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.pa=t=>{this.hide(),Hs===this.id&&this.emit(A.MODAL_CLOSE,{modalId:Hs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(tt.OPEN,this.hi),this.modalManager?.subscribe(tt.CLOSE,this.fi),this.modalManager?.subscribe(tt.CLOSE_ALL,this.pa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Fo=void 0,this.modalManager?.unsubscribe(tt.OPEN,this.hi),this.modalManager?.unsubscribe(tt.CLOSE,this.fi),this.modalManager?.unsubscribe(tt.CLOSE_ALL,this.pa);}sd(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.ed),this.dialogEl.value?.addEventListener("mousedown",this.rd),this.dialogEl.value?.addEventListener("mouseup",this.od);}render(){return v`<dialog data-testid="dialog" ${I(this.sd)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ui.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ui.prototype,"blockBodyScrolling",2);var go=class extends M{constructor(){super(...arguments);this.Z=null;this.hr=null;}get ha(){return this.nameAttrValue??this.ctxName}fa(){let t=document.createElement("input");return t.type="text",t.name=this.ha,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,io(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.Z=this.fa(),this.appendChild(this.Z),this.sub("*collectionState",t=>{if(!t)return;if(!this.hr){let n=document.createElement("div");this.appendChild(n),this.hr=n;}if(!this.Z){let n=this.fa();this.appendChild(n),this.Z=n;}if(this.hr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.Z.value="",this.Z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.Z.value="",this.Z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.Z.value=e.cdnUrl??"",this.Z.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.Z.value=o[0],this.Z.setCustomValidity("");return}this.Z.remove(),this.Z=null;let s=new DocumentFragment;for(let n of o){let a=document.createElement("input");a.type="hidden",a.name=`${this.ha}[]`,a.value=n,s.appendChild(a);}this.hr.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],go.prototype,"nameAttrValue",2);var Ks=class extends T{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var ii=class extends T{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.wt=0;this.fr=O();this.ma=()=>{let t=this.fr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.wt>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.wt=this.No(this.value),this.Vo(),this.fr.value?.addEventListener("animationiteration",this.ma);}updated(t){if(super.updated(t),t.has("value")){let e=this.No(this.value);if(!this.visible)this.wt=e;else {let o=Math.max(this.wt,e);o!==this.wt&&(this.wt=o,this.Vo());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Vo():this.wt=this.No(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.fr.value?.removeEventListener("animationiteration",this.ma);}No(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Vo(){this.visible&&this.style.setProperty("--l-progress-value",this.wt.toString());}render(){return v`<div ${I(this.fr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],ii.prototype,"hasFileName",2),p([y({type:Number})],ii.prototype,"value",2),p([y({type:Boolean,reflect:true})],ii.prototype,"visible",2);var $i=class extends M{constructor(){super();this.Ot=false;this.Ne=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this._o=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.Ot=t;}),this.sub("*commonProgress",t=>{this.Ne=t;});}updated(t){super.updated(t),t.has("visible")&&(this.Ot?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this._o?.(),this._o=void 0;}render(){return v`<uc-progress-bar .value=${this.Ne} .visible=${this.Ot}></uc-progress-bar>`}};p([m()],$i.prototype,"Ot",2),p([m()],$i.prototype,"Ne",2);var ri=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.nd=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return v`<select @change=${this.nd} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],ri.prototype,"value",2),p([y({type:Boolean,reflect:true})],ri.prototype,"disabled",2),p([y({type:Array,attribute:false})],ri.prototype,"options",2);var me=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Bo="default";this.mr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.ad(this.source);}ad(t){if(!t){this.mr="",this.Bo="default";return}let{label:e,icon:o,id:s}=t;this.mr=e,this.Bo=o??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.mr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Bo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.mr)}</div>`}</button>`}};p([y({attribute:false})],me.prototype,"source",2),p([y({type:Boolean})],me.prototype,"textOnly",2),p([y({type:Boolean})],me.prototype,"iconOnly",2),p([m()],me.prototype,"Bo",2),p([m()],me.prototype,"mr",2);var oi=class{constructor(i,t){this.ga=[];this.r=t.ctx,this.e=t.sharedInstancesBag,this.va=t.onSourcesChange,i.addController(this);}hostConnected(){this.zo=this.r.sub(x("sourceList"),t=>{this.ga=J(t),this.Ho();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.z=i.onPluginsChange(()=>this.Ho())),this.Ho();}hostDisconnected(){this.z?.(),this.z=void 0,this.zo?.(),this.zo=void 0;}Ho(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),o=[];this.ga.forEach(s=>{let n=this.ld(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let d=e.get(c);d&&o.push(this.ya(d));}return}let l=e.get(s);l&&o.push(this.ya(l));}),this.va(o);}ld(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}ya(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Di=class extends M{constructor(){super(...arguments);this.S=[];this.wrap=false;}initCallback(){super.initCallback(),new oi(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.S=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.S.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([m()],Di.prototype,"S",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Di.prototype,"wrap",2);var js=class extends T{render(){return v`<div class="uc-spinner"></div>`}};var It="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Re(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:()=>{i.naturalWidth===0&&(i.src=It);}}}function Fi(r){let i=[];for(let s of r){let n=Re(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Gs(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,a)=>{o.onload=()=>{let l=o.height/o.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},o.onerror=l=>{a(l);};});return o.src=URL.createObjectURL(r),s}var si=class extends M{constructor(){super(...arguments);this.gr=new Set;this.entry=null;}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 a=o.subscribe(s,l=>{this.isConnected&&n(l);});this.gr.add(a);})(t,e);}reset(){for(let t of this.gr)t();this.gr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.gr=new Set;}};function qd(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}function vo(r="hsl(209, 21%, 65%)",i=32,t=32){return qd(`<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>`)}var Wd=3e3,ni=class extends si{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Wt="";this.ba=false;this.vr=null;this.wa=false;this.cd=this.cfg.filesViewMode;this.Ea=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.ud(e);if(o&&s&&n){let d=await this.proxyUrl(Q(ne(this.cfg.cdnCname,n),at(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Re(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let f=await Gs(h,l);t.setValue("thumbUrl",f);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(f));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await Gs(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",vo(d));}});this.yr=F(this.Ea.bind(this),100);}ud(t=false){t&&(this.vr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.vr?.height||0),10),parseInt(String(this?.vr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),Wd)}dd(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=It,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),o();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}jo(){this.Ko?.cancel(),this.Ko=void 0;}pd(t){if(this.jo(),!t){this.Wt&&(this.Wt="");return}if(t===this.Wt)return;let e=new AbortController,o={controller:e,cancel:()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);}};this.Ko=o,this.dd(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Wt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}br(t=false){if(this.entry){if(t){this.Ea(true);return}this.wa&&this.yr();}}firstUpdated(t){super.firstUpdated(t),this.Ta();}updated(t){super.updated(t),t.has("uid")&&this.Ta();}mi(t){let[e]=t;e&&(this.wa=e.isIntersecting,e.isIntersecting&&(this.vr=e.boundingClientRect,this.br(),this.n?.disconnect()),e.intersectionRatio===0&&this.yr.cancel());}reset(){super.reset(),this.yr.cancel(),this.jo(),this.Wt&&(this.Wt="");}Ta(){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=()=>{this.br();};this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.pd(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.br(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ba&&(this.cd==="list"&&this.br(true),this.ba=true);});}connectedCallback(){super.connectedCallback(),this.n?.disconnect(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:.1}),this.n.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.yr.cancel(),this.jo(),this.n?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Wt||It} role="img" alt="Preview of uploaded image" ?hidden=${!this.Wt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ni.prototype,"badgeIcon",2),p([y({attribute:false})],ni.prototype,"uid",2),p([m()],ni.prototype,"Wt",2);var qs=class extends ${};var Ws=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Zs=class extends M{constructor(){super(...arguments);this.xa=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.xa=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.xa?.();}};var ge=(r,i)=>{let t=false,e,o=0,s=((...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);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var ml=(r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},Vi=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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 a of r)o[n]=e?e(a,n):n,s[n]=t(a,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=Pi(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=o.length-1,f=0,g=s.length-1;for(;u<=h&&f<=g;)if(o[u]===null)u++;else if(o[h]===null)h--;else if(a[u]===n[f])l[f]=fe(o[u],s[f]),u++,f++;else if(a[h]===n[g])l[g]=fe(o[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=fe(o[u],s[g]),te(r,l[g+1],o[u]),u++,g--;else if(a[h]===n[f])l[f]=fe(o[h],s[f]),te(r,o[u],o[h]),h--,f++;else if(c===void 0&&(c=ml(n,f,g),d=ml(a,u,h)),c.has(a[u]))if(c.has(a[h])){let w=d.get(n[f]),b=w!==void 0?o[w]:null;if(b===null){let E=te(r,o[u]);fe(E,s[f]),l[f]=E;}else l[f]=fe(b,s[f]),te(r,o[u],b),o[w]=null;f++;}else ho(o[h]),h--;else ho(o[u]),u++;for(;f<=g;){let w=te(r,l[g+1]);fe(w,s[f]),l[f++]=w;}for(;u<=h;){let w=o[u++];w!==null&&ho(w);}return this.ut=n,Li(r,l),st}});var gl="important",Zd=" !"+gl,ee=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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(Zd);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?gl:""):t[e]=o;}}return st}});var ut=ct(class extends ft{constructor(r){if(super(r),r.type!==Vt.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 st}});var Yd="file-item-remove-button",ie=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get hd(){return Math.min(Math.max(this.progress||0,0),100)}fd(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=ut({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-hide-remove":this.hideRemove,"uc-failed":this.failed,"uc-success":this.success}),e=100-this.hd,o=this.l10n(Yd);return v`<button type="button" @click=${this.fd} title=${o} aria-label=${o} class=${t} ><span class="uc-icon-wrap"><uc-icon name="close"></uc-icon><uc-icon name="remove-file"></uc-icon></span><uc-icon name="preloader" class="uc-preloader" style=${ee({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};p([y({type:Boolean})],ie.prototype,"uploading",2),p([y({type:Boolean})],ie.prototype,"failed",2),p([y({type:Boolean})],ie.prototype,"success",2),p([y({type:Boolean})],ie.prototype,"idle",2),p([y({type:Boolean})],ie.prototype,"hideRemove",2),p([y({type:Number})],ie.prototype,"progress",2);var Y=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")}),W=class W extends si{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ca=true;this.uid="";this.Go="";this.qo="";this.Wo="";this.wt=0;this.md=false;this.Zo="";this.Yo=false;this.Xo=false;this.Qo=false;this.Sa=false;this.Aa=false;this.Jo=false;this.ka="";this.wr=[];this.Ma=false;this.ts=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&(this.entry?.getValue("abortController")?.abort(),this.uploadCollection.remove(this.uid));};this.Bh=()=>{this.Oa();};this.K=F(()=>this.Ia(),100);this.vd=this.withEntry(ge((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===Y.FINISHED,l=e===Y.UPLOADING,c=e===Y.QUEUED_UPLOADING,d=e===Y.QUEUED_VALIDATION,u=e===Y.VALIDATION,h=t.getValue("fileName"),f="";o?f="":!a&&n&&s&&Object.values(mt).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${za(s)}`)})),this.Wo=f,this.qo=o,this.md=l||c||d||u,this.wt=d||u?0:t.getValue("uploadProgress"),this.ka=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Oa=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.K();try{let o=new AbortController;t.setValue("abortController",o);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of h)try{let g=f.handler({file:a,signal:o.signal}),w=new Promise((E,S)=>setTimeout(()=>S(new Error("beforeUpload hook timed out")),f.timeout)),{file:b}=await Promise.race([g,w]);b!==a&&(a=b,t.setValue("mimeType",a.type||null),t.setValue("isImage",Ge(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:o.signal,metadata:await this.getMetadataFor(t.uid),tags:await this.getTagsFor(t.uid)};return this.debugPrint("upload options",l,Gr(d)),ds(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.K();}catch(o){let s=o instanceof Ut&&o.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof Me||o instanceof Wt?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.K(),this.isConnected&&!s&&this.telemetryManager.sendEventError(o,"file upload. Failed to upload file");}}});}Ia(){let t=this.entry;if(!t)return;let e=Y.IDLE;t.getValue("errors").length>0?e=Y.FAILED:t.getValue("isQueuedForUploading")?e=Y.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Y.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Y.VALIDATION:t.getValue("isUploading")?e=Y.UPLOADING:t.getValue("fileInfo")&&(e=Y.FINISHED),this.gd(t,e);}gd(t,e){e===Y.FAILED?this.Zo="badge-error":e===Y.FINISHED&&(this.Zo="badge-success"),e===Y.UPLOADING&&(this.Aa=false,this.removeAttribute("focused")),this.Xo=e===Y.FAILED,this.Qo=e===Y.UPLOADING,this.Sa=e===Y.QUEUED_UPLOADING||e===Y.UPLOADING,this.Yo=e===Y.FINISHED,this.vd(e);}reset(){super.reset(),this.K.cancel();}mi(t){let[e]=t;e&&e.isIntersecting&&!this.Ma&&(this.Ca=false,this.Ma=true);}Pa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.de();return}this.subEntry("isQueuedForValidation",()=>{this.K();}),this.subEntry("isValidationPending",()=>{this.K();}),this.subEntry("uploadProgress",()=>{this.K();}),this.subEntry("isQueuedForUploading",()=>{this.K();}),this.subEntry("fileName",o=>{this.Go=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.K();}),this.subEntry("externalUrl",o=>{this.Go=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.K();}),this.subEntry("errors",()=>this.K()),this.subEntry("isUploading",()=>this.K()),this.subEntry("fileSize",()=>this.K()),this.subEntry("mimeType",()=>this.K()),this.subEntry("isImage",()=>this.K()),this.subEntry("fileInfo",()=>this.de()),this.subEntry("isUploading",()=>this.de()),this.subEntry("errors",()=>this.de()),this.Ia(),this.de();}La(t){if(this.cfg.filesViewMode==="list"){this.Jo=true;return}this.Jo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Pa(this.uid);}de(){let t=this.e.pluginManager;if(!t||!this.uid){this.wr=[];return}let e=t.snapshot().fileActions,o=this.api.getOutputItem(this.uid);if(!o){this.wr=[];return}this.wr=e.filter(s=>{try{return s.shouldRender(o)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}yd(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(o){console.error(`Error in plugin file action onClick (${t.id}):`,o);}}}initCallback(){super.initCallback(),this.Pa(this.uid),this.subConfigValue("filesViewMode",e=>{this.La(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.La(e);}),this.onclick=()=>{W.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Oa());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.de())),this.de(),W.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:[0,1]}),this.n.observe(this);}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback(),this.n?.disconnect(),W.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Ca?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Yo} ?data-uploading=${this.Qo} ?data-failed=${this.Xo} ?data-focused=${this.Aa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Zo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.ka}><span class="uc-file-name" data-testid="file-name" ?hidden=${!this.Jo}>${this.Go}</span><span class="uc-file-error" ?hidden=${!this.qo}>${this.qo}</span><span class="uc-file-hint" ?hidden=${!this.Wo}>${this.Wo}</span></div><div class="uc-file-actions">${this.wr.map(t=>v`<button type="button" @click=${()=>this.yd(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<uc-file-action-button @uc:remove=${this.ts} .uploading=${this.Qo} .hideRemove=${this.Sa} .progress=${this.wt} .failed=${this.Xo} .success=${this.Yo} ></uc-file-action-button></div></div>`}};p([m()],W.prototype,"Ca",2),p([y({attribute:false})],W.prototype,"uid",2),p([m()],W.prototype,"Go",2),p([m()],W.prototype,"qo",2),p([m()],W.prototype,"Wo",2),p([m()],W.prototype,"wt",2),p([m()],W.prototype,"md",2),p([m()],W.prototype,"Zo",2),p([m()],W.prototype,"Yo",2),p([m()],W.prototype,"Xo",2),p([m()],W.prototype,"Qo",2),p([m()],W.prototype,"Sa",2),p([m()],W.prototype,"Aa",2),p([m()],W.prototype,"Jo",2),p([m()],W.prototype,"ka",2),p([m()],W.prototype,"wr",2);var Ys=W;function Xd(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=o=>{o.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}function Qd(r,i){return new Promise(t=>{let e=0,o=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});o.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(o);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(o);});};s(r);})}function vl(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 l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(Qd(l,s).then(c=>{c&&i.push(...c);}));continue}let a=o.getAsFile();a&&t.push(Xd(a).then(l=>{l||i.push({type:"file",file:a});}));}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)}var dt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),yl=["focus"],Jd=100,Xs=new Map;function tp(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))}function Qs(r){let i=0,t=document.body,e=new Set,o=g=>{e.add(g);},s=dt.INACTIVE,n=g=>{r.shouldIgnore()&&g!==dt.INACTIVE||(s!==g&&e.forEach(w=>{w(g);}),s=g);},a=()=>i>0;o(g=>r.onChange(g));let l=()=>{i=0,n(dt.INACTIVE);},c=()=>{i+=1,s===dt.INACTIVE&&n(dt.ACTIVE);},d=()=>{i-=1,a()||n(dt.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(dt.INACTIVE);},h=g=>{if(r.shouldIgnore())return;a()||(i+=1);let w=[g.x,g.y],b=r.element.getBoundingClientRect(),E=Math.floor(tp(w,b)),S=E<Jd,N=g.composedPath().includes(r.element);Xs.set(r.element,E);let C=Math.min(...Xs.values())===E;N&&C?(g.preventDefault(),n(dt.OVER)):n(S&&C?dt.NEAR:dt.ACTIVE);},f=async g=>{if(r.shouldIgnore())return;g.preventDefault();let{dataTransfer:w}=g;if(!w)return;let b=await vl(w);r.onItems(b),n(dt.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),r.element.addEventListener("drop",f),yl.forEach(g=>{window.addEventListener(g,l);}),()=>{Xs.delete(r.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),r.element.removeEventListener("drop",f),yl.forEach(g=>{window.removeEventListener(g,l);});}}var Js=new Set,Et=class extends M{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.jt=true;this.Ra=true;this.es="drop-files-here";this.pe=false;this.$a=null;this.rs=null;this.Da=O();this.Ve=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.Fa=true;this._e=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ua(){let t=this.text;if(typeof t=="string"&&t.length>0){this.es=t;return}this.es=this.pe?"drop-files-here":"drop-file-here";}isActive(){if(!this.jt)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(),Js.add(this),this.os(),this.ss(),this.Na(),this.Va(dt.INACTIVE),this.$a=Qs({element:this,shouldIgnore:()=>this._a(),onChange:t=>{this.Va(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(o=>{o.type==="url"?this.api.addFileFromUrl(o.url,{source:R.DROP_AREA}):o.type==="file"&&this.api.addFileFromObject(o.file,{source:R.DROP_AREA,fullPath:o.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.bd()),this.subConfigValue("sourceList",t=>{let e=J(t);this.Fa=e.includes(R.LOCAL),this.os(),this.ss();}),this.subConfigValue("multiple",t=>{this.pe=!!t,this.Ua();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.os(),this.ss()),(t.has("text")||t.has("localeId"))&&this.Ua();}updated(t){super.updated(t),t.has("clickable")&&this.Na();}_a(){if(!this.jt||!this.wd())return true;if(!this.fullscreen)return false;let t=Js;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}wd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}os(){let t=this.Fa&&!this.disabled;this.jt=t;}ss(){let t=this.jt||!this.querySelector("[data-default-slot]");this.Ra=t,this.hidden=!t;}Va(t){let e=Object.entries(dt).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}bd(){if(this.rs)return;let t=this.Da.value;t&&(this.rs=Qs({element:t,onChange:e=>{let o=Object.entries(dt).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},onItems:()=>{},shouldIgnore:()=>this._a()}));}Na(){this.clickable&&!this._e?(this.addEventListener("keydown",this.Ve),this.addEventListener("click",this.Ve),this._e=true):!this.clickable&&this._e&&(this.removeEventListener("keydown",this.Ve),this.removeEventListener("click",this.Ve),this._e=false);}disconnectedCallback(){super.disconnectedCallback(),Js.delete(this),this.$a?.(),this.rs?.(),this._e&&(this.removeEventListener("keydown",this.Ve),this.removeEventListener("click",this.Ve),this._e=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${I(this.Da)} class="uc-content-wrapper" ?hidden=${!this.Ra} ><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.l10n(this.es)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],Et.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],Et.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],Et.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],Et.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],Et.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],Et.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],Et.prototype,"initflow",2),p([y({type:String})],Et.prototype,"text",2),p([m()],Et.prototype,"jt",2),p([m()],Et.prototype,"Ra",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.Ba=false;this.za=false;this.Ha=false;this.ns=false;this.as=false;this.Er=null;this.Ka=false;this.ls=null;this.ja=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.cs=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.Y();};this.us=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Nt=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Y=ge(()=>{this.isConnected&&(this.xd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get Ed(){return this.ls?this.Td(this.ls):""}xd(){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),a=t.allEntries.some(f=>f.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&l&&this.cfg.confirmUpload)c=true;else {d=true;let f=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&o&&l&&f;}this.Ba=d,this.za=u,this.Ha=c,this.as=e.total===0||!s&&!n,this.ns=!n||this.cfg.multiple,this.Ka=e.total>0,this.ls=e;}Td(t){let e=o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Y),this.subConfigValue("multipleMin",this.Y),this.subConfigValue("multipleMax",this.Y),this.sub("*groupInfo",t=>{t&&this.Y();}),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.Y),this.uploadCollection.observeCollection(this.Y),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Er=null;return}this.Er=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Y),this.uploadCollection.unobserveCollection(this.Y));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Ed}</span><button type="button" class="uc-mini-btn uc-close-btn" data-testid="close" @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.Ka}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Vi(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" data-testid="add-more" @click=${this.ja} ?disabled=${!this.as} ?hidden=${!this.ns} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Er} >${this.Er??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.ns} ?disabled=${!this.as} @click=${this.ja} ><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.Ha} @click=${this.cs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Ba} ?disabled=${!this.za} @click=${this.us} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([m()],Lt.prototype,"Ba",2),p([m()],Lt.prototype,"za",2),p([m()],Lt.prototype,"Ha",2),p([m()],Lt.prototype,"ns",2),p([m()],Lt.prototype,"as",2),p([m()],Lt.prototype,"Er",2),p([m()],Lt.prototype,"Ka",2),p([m()],Lt.prototype,"ls",2);var ep=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>!!r.authToken&&(!!r.secureSignature||!!r.secureExpire||!!r.secureUploadsSignatureResolver),message:"Both `authToken` and `secureSignature`/`secureExpire`/`secureUploadsSignatureResolver` parameters are set.\nThe `authToken` will be used and the secure signature will be ignored."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],bl=F(r=>{for(let{test:i,message:t}of ep)i(r)&&oo(t);},0);var wl=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var tn=r=>r,ip=[tn({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{let t=i();if(t===null)return r();let e=Z(r());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(o=>o!=="video")),jt(e)}}),tn({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{let t=i();if(t===null)return r();let e=Z(r());return e=e.sort((o,s)=>o===t?-1:s===t?1:0),jt(e)}}),tn({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>{let e=r(),o=i(),s=t();return e&&(o===Ti||He(o,s))?Sr(e,s):o}})],El=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of ip){if(!o.deps.includes(r))continue;let s={[o.key]:()=>t(o.key)};for(let l of o.deps)s[l]=()=>t(l);let n=new AbortController;e.get(o.fn)?.abort(),e.set(o.fn,n);let a;try{a=o.fn(s,{signal:n.signal});}catch(l){e.get(o.fn)===n&&e.delete(o.fn),console.error(`Failed to compute value for "${o.key}"`,l);return}wl(a)?a.then(l=>{n.signal.aborted||i(o.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,l);}).finally(()=>{e.get(o.fn)===n&&e.delete(o.fn);}):i(o.key,a);}};var _=r=>String(r),it=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},z=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}"`)},Tl=r=>r==="auto"?r:z(r),Cl=r=>{let i=_(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},xl=r=>{let i=_(r);if(!Object.values(P).includes(i))throw new Error(`Invalid value: "${i}"`);return i},Sl=r=>{let i=_(r),t=Z(i);if(t.some(e=>!Object.values(P).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Al=r=>{let i=_(r);if(i==="local"||i==="global")return i;if(z(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},kl=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.")},Ml=r=>{if(Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid tags value. Must be an array or function.")},Ol=r=>{if(typeof r=="string"||typeof r=="function")return r;throw new Error("Invalid authToken value. Must be a string or function.")},en=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},yo=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},bo=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},Il=r=>{let i=_(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},Ll=r=>{let i=_(r);if(["auto","menu","toolbar","compact","plain"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var rp={pubkey:_,multiple:z,multipleMin:it,multipleMax:it,confirmUpload:z,imgOnly:z,accept:_,externalSourcesPreferredTypes:_,externalSourcesEmbedCss:_,store:Tl,cameraMirror:z,cameraCapture:Cl,sourceList:_,topLevelOrigin:_,maxLocalFileSizeBytes:it,thumbSize:it,showEmptyList:z,useLocalImageEditor:z,useCloudImageEditor:z,cloudImageEditorTabs:_,removeCopyright:z,cropPreset:_,imageShrink:_,modalScrollLock:z,modalBackdropStrokes:z,sourceListWrap:z,remoteTabSessionKey:_,cdnCname:_,cdnCnamePrefixed:_,baseUrl:_,socialBaseUrl:_,secureSignature:_,secureExpire:_,secureDeliveryProxy:_,retryThrottledRequestMaxTimes:it,retryNetworkErrorMaxTimes:it,multipartMinFileSize:it,multipartChunkSize:it,maxConcurrentRequests:it,multipartMaxConcurrentRequests:it,multipartMaxAttempts:it,checkForUrlDuplicates:z,saveUrlForRecurrentUploads:z,groupOutput:z,userAgentIntegration:_,debug:z,localeName:_,metadata:kl,tags:Ml,secureUploadsExpireThreshold:it,localeDefinitionOverride:r=>en(r),secureUploadsSignatureResolver:r=>yo(r),authToken:Ol,secureDeliveryProxyUrlResolver:r=>yo(r),iconHrefResolver:r=>yo(r),plugins:r=>bo(r),fileValidators:bo,collectionValidators:bo,validationTimeout:it,validationConcurrency:it,cameraModes:Sl,defaultCameraMode:xl,enableAudioRecording:z,enableVideoRecording:z,mediaRecorderOptions:en,maxVideoRecordingDuration:it,filesViewMode:Il,gridShowFileNames:z,cloudImageEditorAutoOpen:z,cloudImageEditorMaskHref:_,testMode:z,qualityInsights:z,pasteScope:Al,dynamicButtonShowFirstIcon:z,dynamicButtonViewMode:Ll},Pl=(r,i)=>{if(!(typeof i>"u"||i===null))try{return rp[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),et[r]}};var wo=[...new Set(["debug",...Object.keys(et)])],op={metadata:{attribute:false},tags:{attribute:false},plugins:{attribute:false},localeDefinitionOverride:{attribute:false},secureUploadsSignatureResolver:{attribute:false},secureDeliveryProxyUrlResolver:{attribute:false},iconHrefResolver:{attribute:false},fileValidators:{attribute:false},collectionValidators:{attribute:false},mediaRecorderOptions:{attribute:false},authToken:{reflect:false}},Ul=r=>op[r]??{},$l=r=>Ul(r).attribute===false,sp=r=>Ul(r).reflect!==false,on=wo.filter(r=>!$l(r)),rn={...Object.fromEntries(on.map(r=>[Cr(r),r])),...Object.fromEntries(on.map(r=>[r.toLowerCase(),r]))},Rl=r=>`__${r}`,ai=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(et).map(([t,e])=>[x(t),e]))};this.Cd=new Map;this.vi={};this.Ga=new Set;this.Be=new Map;}ds(t){return this.Ga.has(t)}ps(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}hs(t){return [...new Set([Cr(t),t.toLowerCase()])]}Sd(t,e){return this.ds(t)?this.ps(t)?.attribute!==false:$l(t)||!sp(t)?false:typeof e!="function"}Ad(t,e){if(!this.Sd(t,e))return;let o=this.hs(t);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){let o=x(t);if(this.$[o]!==e)if(typeof e>"u"||e===null){let s=et[t];this.$[o]=s!==void 0?s:e;}else this.$[o]=e;}Zt(t,e){let o;if(this.ds(t)){let a=this.ps(t);try{o=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else o=Pl(t,e);let s=this,n=Rl(t);s[n]!==o&&(this.Md(t,s[n],o),s[n]=o,this.Ad(t,o),this.kd(t,o),this.debugPrint(`"${t}"`,ka(t)?Cs:o),this.ds(t)||bl(this.cfg));}xr(t){let e=this,o=Rl(t);return e[o]??this.$[x(t)]}Md(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));}qa(t){let e=t.configRegistry.getAll();this.vi={},this.Ga=new Set(e.keys());for(let[o,s]of this.Be)e.has(o)||(s(),this.Be.delete(o));for(let[o,s]of e){let a=x(o);if(s.attribute){let f=this.hs(o);for(let g of f)this.vi[g]=o;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,o);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&s.attribute)for(let f of this.hs(o)){let g=this.getAttribute(f);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(w){console.warn(`[uc-config] fromAttribute() for "${o}" threw an error, using raw attribute value`,w),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,o);if((!h||!h.set||!h.get)&&Object.defineProperty(this,o,{set:f=>{this.Zt(o,f);},get:()=>this.xr(o),enumerable:true,configurable:true}),!this.Be.has(o)){let f=this.sub(a,g=>{this.Zt(o,g);},false);this.Be.set(o,f);}c&&this.Zt(o,l);}}Od(){this.e.when("pluginManager",t=>{this.qa(t),this.Tr=t.onPluginsChange(()=>{this.qa(t);});});}Id(){this.gi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let o=e.attributeName,s=e.oldValue,n=this.getAttribute(o);if(s===n||o in rn)continue;if(o in this.vi){let l=this.vi[o],c=this.ps(l);this.attributeChangedCallback(o,s??"",n??c?.defaultValue??"");}}}),this.gi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Od(),this.Id();for(let o of on)this.sub(x(o),s=>{this.Zt(o,s);},false);for(let o of wo){let s=t[o]??this.$[x(o)];s!==et[o]&&this.Zt(o,s);let n=Object.getOwnPropertyDescriptor(this,o);(!n||!n.set||!n.get)&&Object.defineProperty(this,o,{set:a=>{this.Zt(o,a);},get:()=>this.xr(o)});}let e=o=>{El({key:o,setValue:this.Zt.bind(this),getValue:this.xr.bind(this),computationControllers:this.Cd});};for(let o of wo)this.sub(x(o),()=>e(o));}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=rn[t];n?s[n]=o:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==o)return;let c=this.vi[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(o):o;if(this.xr(c)===u)return;this.Zt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.Tr&&(this.Tr(),this.Tr=void 0),this.gi&&(this.gi.disconnect(),this.gi=void 0);for(let t of this.Be.values())t();this.Be.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(rn);return [...t,...e]}};for(let r of wo)ai.prototype[r]=void 0;var Ni=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.yi="upload-file";this.fs=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.yi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.fs}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.yi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Ni.prototype,"dropzone",2),p([m()],Ni.prototype,"yi",2);var Dl=r=>dl(r)?r.zt.h:r.strings,Ue=ct(class extends ft{constructor(r){super(r),this.et=new WeakMap;}render(r){return [r]}update(r,[i]){let t=_s(this.it)?Dl(this.it):null,e=_s(i)?Dl(i):null;if(t!==null&&(e===null||t!==e)){let o=Pi(r).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=pr(U,n),s.setConnected(false),this.et.set(t,s);}Li(s,[o]),te(s,void 0,o);}if(e!==null){if(t===null||t!==e){let o=this.et.get(e);if(o!==void 0){let s=Pi(o).pop();hl(r),te(r,void 0,s),Li(r,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var ve=class ve extends M{constructor(){super(...arguments);this.showIcon=false;this.pe=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.DEFAULT_ICON="upload";}static{this.SOURCE_TEXT_CONFIG={[R.LOCAL]:{action:"upload-from"},[R.URL]:{action:"upload-from"},[R.CAMERA]:{action:"capture-with"},[R.MOBILE_PHOTO_CAMERA]:{action:"take"},[R.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.pe=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}bi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.Pd();return t||(this.source?this.Ld():this.l10n(this.pe?"upload-files":"upload-file"))}Pd(){if(this.entries?.status==="uploading")return this.bi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.bi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.bi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.bi("header-total",{count:this.entries?.totalCount??0})}Ld(){if(!this.source?.id)return "";let e=ve.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",o;return this.source.id===R.MOBILE_PHOTO_CAMERA?o=this.l10n("photo").toLowerCase():this.source.id===R.MOBILE_VIDEO_CAMERA?o=this.l10n("video").toLowerCase():o=this.localizedSourceLabel,this.bi(e,{source:o})}fs(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}if(!this.source){this.api.initFlow();return}this.source.onClick();}Rd(){if(!this.pe&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.pe&&this.hasMultipleEntries)return null;if(!this.source)return v`<uc-icon .name=${ve.DEFAULT_ICON}></uc-icon>`;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button type="button" @click=${this.fs} aria-label=${this.textBasedOnLocale}>${this.Rd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],ve.prototype,"source",2),p([y({type:Object})],ve.prototype,"entries",2),p([m()],ve.prototype,"showIcon",2),p([m()],ve.prototype,"pe",2);var sn=ve;var Eo=class extends T{constructor(){super(...arguments);this.Wa=nt.generateFastUid();this.Ud=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Wa} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Wa} class="uc-dropdown-content" popover="auto" @click=${this.Ud}>${this.yield("dd-content")}</div>`}};p([m()],Eo.prototype,"Wa",2);var nn=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var np=(r,i)=>i==="compact"||i==="plain"||r.length===0?{main:null,remain:r}:{main:r[0]??null,remain:r.slice(1)},Fl={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},ap=3,Pt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Yt="auto";this.S=[];this.ze="idle";this.Ya=0;this.ms="arrow-dropdown";this.Y=ge(()=>{this.isConnected&&this.$d();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.ze==="idle"}get isSuccess(){return this.ze==="success"}get isFailed(){return this.ze==="failed"}get isUploading(){return this.ze==="uploading"}get isCollapsedMode(){return this.Yt==="compact"}get isPlainMode(){return this.Yt==="plain"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.S.length>1&&(this.Yt==="toolbar"||this.Yt==="auto"&&this.S.length<=ap)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.S.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.S.length===1}get hasCollectionEntries(){return (this.Sr?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}$d(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Sr=t,this.ze=t.status;}Xa(){this.Cr=np(this.S,this.Yt);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.Yt!==t&&(this.Yt=t,this.Xa());}),this.sub("*commonProgress",t=>{this.Ya=t;}),new oi(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.S=t,this.Xa();}}),this.uploadCollection.observeProperties(this.Y),this.uploadCollection.observeCollection(this.Y),this.Za=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.modalManager?.open(D.UPLOAD_LIST),true;if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.Y.cancel=="function"&&this.Y.cancel(),this.Za?.(),super.disconnectedCallback(),this.ms="arrow-dropdown";}Dd(){return v`<uc-no-wrap-mode-dynamic-btn>${this.Cr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t}></uc-source-btn>`)}</uc-no-wrap-mode-dynamic-btn>`}willUpdate(t){super.willUpdate(t),t.has("_mode")&&(this.ms=Fl[this.Yt]??"arrow-dropdown");}Fd(){this.uploadCollection.clearAll();}Nd(){this.Sr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Vd(){this.uploadCollection.abortAll();}ts(){switch(this.ze){case "failed":this.Nd();break;case "uploading":this.Vd();break;default:this.Fd();}}_d(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.ms}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.Cr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Bd(){let t=this.S[0],e=t&&{...t,icon:Fl.compact};return v`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}zd(){return v`<uc-primary-action .entries=${this.Sr} .source=${this.Cr?.main} ></uc-primary-action>`}Hd(){return v`<uc-file-action-button @uc:remove=${this.ts} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ya} ></uc-file-action-button>`}Kd(){return ut({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}jd(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Kd()}>${Ue(this.shouldShowPrimaryAction?this.zd():null)} ${Ue(!this.isPlainMode&&this.shouldShowInline?this.Dd():null)} ${Ue(!this.isPlainMode&&this.shouldShowCompactSingleSource?this.Bd():null)} ${Ue(!this.isPlainMode&&this.shouldShowDropdown?this._d():null)} ${Ue(this.shouldShowAbortAction||this.hasCollectionEntries?this.Hd():null)} ${Ue(this.jd())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Pt.prototype,"dropzone",2),p([m()],Pt.prototype,"Yt",2),p([m()],Pt.prototype,"S",2),p([m()],Pt.prototype,"ze",2),p([m()],Pt.prototype,"Cr",2),p([m()],Pt.prototype,"Sr",2),p([m()],Pt.prototype,"Ya",2),p([m()],Pt.prototype,"ms",2);var _i=class extends ${constructor(){super(...arguments);this.vs=O();}initCallback(){this.activityType=this.registration?.id??null,this.Qa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Qa(),this.isActivityActive&&(this.Ar(),this.Ja()));}Qa(){this.registration&&(this.Jn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Ja(),onDeactivate:()=>this.Ar()}));}async Ja(){await this.updateComplete;let t=this.vs.value;if(!t||!this.registration)return;this.Ar();let e=this.$["*currentActivityParams"];try{this.gs=this.registration.render(t,e)??void 0;}catch(o){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,o);}}Ar(){let t=this.vs.value;if(t){try{this.gs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.gs=void 0,t.replaceChildren();}}disconnectedCallback(){this.Ar(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${I(this.vs)}></div>`}};p([y({attribute:false})],_i.prototype,"registration",2);var li=class extends T{constructor(){super(...arguments);this.mode="modal";this.kt=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.z=t.onPluginsChange(()=>this.tl())),this.tl();}tl(){let t=this.e.pluginManager;if(!t){this.kt=[];return}this.kt=t.snapshot().activities;}disconnectedCallback(){this.z?.(),this.z=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Vi(this.kt,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Vi(this.kt,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],li.prototype,"mode",2),p([m()],li.prototype,"kt",2);function Bi(r,i,t){return r?i(r):t?.(r)}function Vl(...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},{})}function Tt(...r){let i=Vl(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Nl(r,...i){let t=Vl(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var lp=r=>lt.includes(r),_l=r=>{if(!r)return lt;let i=Z(r).filter(lp);return i.length===0?lt:i};function Bl(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":lt,"*tabId":j.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=It,t.src=e;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=at(ae(i),"preview"),o=Q(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.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var zl="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var $e={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ci=class extends T{constructor(){super(...arguments);this.Ot=false;this.il=$e;this.rl=$e.visible;this.ol=$e.hidden;this.ys=false;this.sl=false;}set visible(t){this.Ot=t,this.nl();}get visible(){return this.Ot}set styles(t){this.il=t,this.ys=true,this.rl=t.visible??$e.visible,this.ol=t.hidden??$e.hidden;}get styles(){return this.il}nl(){this.style.visibility=this.Ot?"inherit":"hidden",Nl(this,{[$e.transition]:!this.ys,[this.rl]:this.Ot,[this.ol]:!this.Ot}),this.toggleAttribute("inert",!this.Ot);}Gd(){this.sl||(this.sl=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ys||this.classList.add($e.transition),this.nl(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Gd();},0);}};p([y({type:Boolean})],ci.prototype,"visible",1),p([y({attribute:false})],ci.prototype,"styles",1);var zi=class extends T{constructor(){super(...arguments);this.active=false;this.he=O();this.bs=false;this.Es=()=>{let t=this.he.value;t&&(this.al(t),this.bs&&this.active&&this.Ts());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Ts();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Ts():this.qd());}Ts(){let t=this.he.value;if(!t)return;this.bs=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Es),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Es,{once:true});}qd(){let t=this.he.value;t&&(this.bs=false,t.removeEventListener("transitionend",this.Es),this.al(t));}al(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${I(this.he)}></div></div>`}};p([y({type:Boolean,reflect:true})],zi.prototype,"active",2);var X=r=>r??U;var At=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.ll(),this.cl();}updated(t){super.updated(t),t.has("reverse")&&this.ll(),t.has("theme")&&this.cl();}ll(){this.style.flexDirection=this.reverse?"row-reverse":"";}cl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Wd(){let t=this.xs;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Zd}}get xs(){return !this.icon}get Zd(){return !this.text&&!this.xs}render(){return v`<button type="button" role=${X(this.ariaRole||void 0)} aria-controls=${X(this.ariaControls||void 0)} aria-label=${X(this.l10n(this.titleProp))} title=${X(this.l10n(this.titleProp))} ><uc-icon class=${ut(this.Wd)} name=${X(this.icon||void 0)} ?hidden=${this.xs} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function Hl(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}function ui(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return Q(r,at(wr,ae(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Dt}/${Ft}/uc-cloud-image-editor/`))}var Hi=class extends T{constructor(){super(...arguments);this.ul=`uc-backdrop-mask-${nt.generateFastUid()}`;this.Mr=false;this.xi=false;this.hl=O();this.Ci=false;this.Si=null;this.ml=t=>{this.gl(),this.Ai&&(t.stopPropagation(),t.preventDefault(),this.Ai=false);};this.vl=t=>{if(!this.Ai||!this.kr||!this.Ss)return;t.stopPropagation(),t.preventDefault();let e=this.Xt;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,a=t.y-s,l=n-this.kr[0],c=a-this.kr[1],{direction:d}=this.Ss,u=this.op(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.yl=t=>{if(!this.Vt)return;let e=Object.values(this.Vt).find(o=>{if(!o||this.ks(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Ja(a,[t.x,t.y])});this.dl=e,this.gl();};}get Xt(){return this.hl.value??null}get Ai(){return this.xi}set Ai(t){this.xi!==t&&(this.xi=t,this.As());}As(){this.Ei&&this.Ei.setAttribute("class",Tt({"uc-guides--hidden":this.Mr,"uc-guides--visible":!this.Mr&&this.xi,"uc-guides--semi-hidden":!this.Mr&&!this.xi}));}ks(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let o=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return o||s}Yd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,a=this.Xt;if(!a)return;let l=wt("mask",{id:this.ul}),c=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=wt("rect",{x:e,y:o,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.ul})`});a.appendChild(u),a.appendChild(l),this.wi=l,this.Cs=d;}Xd(){this.wi&&(this.wi.style.display="none",window.requestAnimationFrame(()=>{this.wi&&(this.wi.style.display="block");}));}Qd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this.Cs&&de(this.Cs,{x:e,y:o,width:s,height:n});}Jd(){let t=this.$["*cropBox"];if(!(!t||!this.Ei||!this.Vt)){for(let e of Object.values(this.Vt)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:a}=e,l=o==="",c=o.length===2,{x:d,y:u,width:h,height:f}=t;if(l)de(n,{x:d,y:u,width:h,height:f});else {let w=pe(Math.min(h,f)/82/2,0,1),b=c?Wa(t,o,w):Za(t,o,w),E=b.center;if(!E)continue;let S=Math.max(Rs*pe(Math.min(h,f)/Rs/3,0,1),qa);de(n,{x:E[0]-S,y:E[1]-S,width:S*2,height:S*2}),de(s,{d:b.d});}let g=this.ks(o);a.setAttribute("class",Tt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}de(this.Ei,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}fl(t,e){let o=wt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=wt("rect",{fill:"transparent"}),n=wt("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.tp.bind(this,e));}ep(){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.fl(t,s);}return this.fl(t,""),t}ip(){let t=wt("svg"),e=wt("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=wt("line",{x1:`${Oi*o}%`,y1:"0%",x2:`${Oi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=wt("line",{x1:"0%",y1:`${Oi*o}%`,x2:"100%",y2:`${Oi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}rp(){let t=this.Xt;if(!t)return;let e=document.createDocumentFragment(),o=this.ip();e.appendChild(o);let s=this.ep();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Vt=s,this.Ei=o,this.As();}tp(t,e){if(!this.Vt)return;let o=this.Vt[t];if(!o||this.ks(t))return;let s=this.$["*cropBox"],n=this.Xt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Ai=true,this.Ss=o,this.kr=[c,d],this.pl={...s};}op(t,e){let[o,s]=e,n=this.$["*imageBox"],a=this.pl??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Xa({rect:a,delta:[o,s],imageBox:n}):a=Qa({rect:a,delta:[o,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Xe(Je(a),n)}gl(){let t=this.dl,e=this.Xt;e&&(e.style.cursor=t?Ya(t.direction):"initial");}bl(t){if(this.Ti){this.Ti.setAttribute("href",t);return}let e=this.Xt;if(!e){this.Si=t;return}this.Si=null;let o=document.createDocumentFragment(),s=wt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.Ti=s;}sp(){let t=this.$["*cropBox"];if(!t||!this.Ti)return;let{x:e,y:o,width:s,height:n}=t;de(this.Ti,{x:e,y:o,height:n,width:s});}Ms(){this.Ci&&(this.Qd(),this.Jd(),this.sp());}toggleThumbs(t){if(this.Vt)for(let e of Object.values(this.Vt)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",Tt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Xd(),this.Ci&&window.requestAnimationFrame(()=>{this.Ms();});}),this.sub("*cropBox",t=>{t&&(this.Mr=t.height<=k||t.width<=k,this.As(),this.Ci&&window.requestAnimationFrame(()=>{this.Ms();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.bl(t);}),document.addEventListener("pointermove",this.vl,true),document.addEventListener("pointerup",this.ml,true);}firstUpdated(t){super.firstUpdated(t),this.np();}np(){let t=this.Xt;if(!(!t||this.Ci)){if(this.Yd(),this.rp(),this.Ci=true,t.addEventListener("pointermove",this.yl,true),this.Si){let e=this.Si;this.Si=null,this.bl(e);}this.Ms();}}disconnectedCallback(){super.disconnectedCallback(),this.Xt?.removeEventListener("pointermove",this.yl,true),document.removeEventListener("pointermove",this.vl,true),document.removeEventListener("pointerup",this.ml,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${I(this.hl)}></svg>`}};p([m()],Hi.prototype,"xi",2);function up(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}var Ki=class extends T{constructor(){super();this.ctxOwner=true;this.fe={width:0,height:0};this.r=null;this.q=false;this.Et=null;this.El=O();this.Is=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.wl=F(this.Tl.bind(this),300),this.Os=ge(()=>{!this.isConnected||!this.q||(this.Ps(),this.xl(),this.Cl(),this.Ls(),this.Rs());},100);}firstUpdated(t){super.firstUpdated(t),this.Ps();}xl(){let t=this.$["*editorTransformations"],e=Hl(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}Ps(){let t=this.El.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.It=t,this.r=e;}Cl(){if(!this.q||!this.Et)return;let t=this.Et,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},a=Qe({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,g=e+(n.height-e*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,g=0+e;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Je(l);}Ls(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[g,w]}=n,{width:b}=Qe(this.fe,s),E=a/b;t=Xe(Je({x:l+g*E,y:c+w*E,width:h*E,height:f*E}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!tl(t,e)||u&&!el(t,u)){let h=e.width/e.height,f=e.width,g=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=Xe(Je(t),e);}ap(){let t=this.r;if(!t)return;let e=this.Et;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Qe({width:o.width,height:o.height},l);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Rs(){if(!this.q||!this.Et||!this.It||!this.r)return;let t=this.It;this.r.clearRect(0,0,t.width,t.height),this.ap();}lp({fromViewer:t}){this.Et&&(this.Is.value?.toggleThumbs(true),this.cp(),setTimeout(()=>{this.className=Tt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Sl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a}=e,{width:l,height:c}=Qe(this.fe,s),{width:d,height:u}=t,h=n/l,f=a/c;return [pe(Math.round(d/h),1,l),pe(Math.round(u/f),1,c)]}up(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Qe(this.fe,s),{x:h,y:f}=t,g=n/d,w=a/u,b=this.Sl(),E={dimensions:b,coords:[pe(Math.round((h-l)/g),0,d-b[0]),pe(Math.round((f-c)/w),0,u-b[1])]};if(!up(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(b[0]===d&&b[1]===u))return E}Tl(){if(!this.isConnected||!this.fe)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.up(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.q&&(this.Cl(),this.Ls(),this.Rs());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.q){this.q=true,await this.updateComplete,this.Ps(),this.fe=t,this.removeEventListener("transitionend",this.Al);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.Et=await this.dp(o,s),this.xl(),this.Os(),this.lp({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.n=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.q&&this.Et&&this.Os();}),this.n.observe(this);}}deactivate({reset:t=false}={}){this.q&&(!t&&this.Tl(),this.q=false,this.pp(),this.className=Tt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Is.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Al,{once:true}),this.n?.disconnect());}pp(){let t=this.Sl(),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),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}cp(){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`;}Al(){this.q||(this.Et=null);}async dp(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(ui(t,o,e)),{promise:n,cancel:a,image:l}=Re(s),c=this.He(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this._?.(),this._=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}He(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.Rs();}),this.sub("*cropBox",()=>{this.Et&&this.wl();}),this.sub("*currentAspectRatio",()=>{this.Ls();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.q&&this.fe&&this.activate(this.fe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.n?.disconnect(),this.Et&&(this.Et=null);}render(){return v`<canvas class="uc-canvas" ${I(this.El)}></canvas><uc-crop-frame ${I(this.Is)}></uc-crop-frame>`}};p([m()],Ki.prototype,"Et",2);function an(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}function dp(r){return typeof r=="string"&&r in Ot}function pp(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}function hp(r,i,t){let e=pp(r).find(([n,a])=>n<=i&&i<=a);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let a=Math.abs(o-s)||1,l=Math.abs(i-o)/a;return o===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function fp(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function Kl(r,i){let t=Ot[r].keypointsNumber,{range:e,zero:o}=Ot[r];return [...new Set([...an(e[0],o,t+1),...an(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}var To=class extends T{constructor(){super();this.q=false;this.Us=true;this.a="initial";this.kl={};this.Qt=[];this.Ml=0;this.Il=O();this.Or=O();this.classList.add("uc-inactive_to_cropper"),this.Ol=F(async(t,e,o)=>{let s=()=>!this.Pl(t,e)||this.Ne!==o||!!this.Qt.find(c=>c.value===o);if(s())return;let n=await this.Ll(t,o),a=new Image;a.src=n.src;let l=this.He(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Qt,d=c.findIndex(g=>g.value>o);d===-1&&(d=c.length);let h=c[d]?.image,f=this.Or.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.Fs(t,o));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}He(t){let e=this.a,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);}}Rl(){window.cancelAnimationFrame(this.Ml),this.Ml=window.requestAnimationFrame(()=>{for(let t of this.Qt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}me({url:t=this.Ke,filter:e=this.b??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.kl};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let a=this.offsetWidth;return this.proxyUrl(ui(t,a,n))}async Ll(t,e){return {src:await this.me({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Pl(t,e){return this.a===t&&this.b===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!dp(this.a)||!Number.isFinite(e)||(this.Fs(this.a,e),this.Ol(this.a,this.b,e));}Fs(t,e){this.a=t,this.Ne=e;let{zero:o}=Ot[t],s=this.Qt.map(l=>l.value),n=hp(s,e,o),a=fp(s,o);this.Qt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Rl();}Ul(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async hp(){this.c=this.c||this.Ul();let t=this.c;t&&this.$l(t);let e=this.Qt.map(c=>c.src),{images:o,promise:s,cancel:n}=Fi(e);o.forEach(c=>{let d=this.He(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.$s=()=>{n(),this.$s=void 0;};let a=this.a,l=this.b;if(await s,this.q&&this.Pl(a,l)){let c=this.Or.value;if(!c)return;c.replaceChildren(),this.Qt.forEach((d,u)=>{let h=o[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Rl();}}async setTransformations(t){if(this.kl=t,this.c){let e=await this.me(),o=this.He(e);this.c.src=e,this.c.addEventListener("load",o,{once:true}),this.c.addEventListener("error",o,{once:true}),this.c.style.opacity="1",this.c.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Ds?.();let n=Kl(o,s),a=await Promise.all(n.map(c=>this.me({url:t,filter:e,operation:o,value:c}))),{cancel:l}=Fi(a);this.Ds=l;}fp(t){let e=this.c||this.Ul();if(this.$l(e),this.c=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Tt({"uc-active_from_viewer":this.ki,"uc-active_from_cropper":!this.ki,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.He(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=Tt({"uc-active_from_viewer":this.ki,"uc-active_from_cropper":!this.ki,"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.q=true,this.Us=false,await this.updateComplete,this.Ke=t,this.a=e??"initial",this.Ne=o,this.b=s,this.ki=n,typeof o!="number"&&!s){let l=await this.me({operation:e,value:o});this.fp(l),this.Ns();return}!e||typeof o!="number"||(this.Qt=await Promise.all(Kl(e,o).map(l=>this.Ll(e,l))),this.Fs(e,o),this.hp());}deactivate({hide:t=true}={}){this.q=false,this.$s?.(),this.Ds?.(),t&&!this.Us?(this.Us=true,this.c&&(this.c.style.transform="scale(1)"),this.className=Tt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ns();},{once:true})):this.Ns();}$l(t){let e=this.Il.value;e&&(e.contains(t)||e.appendChild(t));}Ns(){this.Or.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${I(this.Il)}></div><div class="uc-fader-layers-host" ${I(this.Or)}></div>`}};var Bt=class extends T{constructor(){super();this.Vs=0;this.Ir=O();this.Fl=O();this.Nl=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Jt=0;this.gp=t=>{t.stopPropagation();let e=this.Vl(t);e!==null&&(this._s(e),this.mp("slider-input",e));};this.vp=t=>{t.stopPropagation();let e=this.Vl(t);e!==null&&this._s(e);};this._l=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Bl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}mp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Vs=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.zl(this.Jt),this.Bs(),this.n=new ResizeObserver(()=>{this.Bs(),this.Pr(this.Jt);}),this.n.observe(this);let e=this.Ir.value;e?.addEventListener("focus",this._l),e?.addEventListener("blur",this.Bl),window.setTimeout(()=>{this.Pr(this.Jt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Jt&&this._s(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Bs(),this.Pr(this.Jt)),t.has("zero")&&this.hasUpdated&&this.Hl(this.Jt);}Pr(t){this.Hl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(o-this.Vs)/100;window.requestAnimationFrame(()=>{let l=this.Fl.value;l&&(l.style.transform=`translateX(${a}px)`);});}Hl(t){if(!this.Mi)return;let e=this.max-this.min;if(e===0)return;this.Mi.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(o-this.Vs)/100;window.requestAnimationFrame(()=>{this.Mi&&(this.Mi.style.transform=`translateX(${a}px)`);});}Bs(){let e=this.Nl.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.Dl===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Mi=d,e.innerHTML="",e.appendChild(a),this.Dl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ir.value;t?.removeEventListener("focus",this._l),t?.removeEventListener("blur",this.Bl),this.n?.disconnect(),this.n=void 0;}_s(t){Number.isFinite(t)&&(this.Jt=t,this.hasUpdated&&(this.zl(t),this.Pr(t)));}zl(t){let e=this.Ir.value;e&&(e.value=String(t));}Vl(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return v`<div class="uc-steps" ${I(this.Nl)}></div><div class="uc-thumb" ${I(this.Fl)}></div><input class="uc-input" type="range" ${I(this.Ir)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Jt)} ?disabled=${this.disabled} @input=${this.gp} @change=${this.vp} />`}};p([y({type:Boolean,reflect:true})],Bt.prototype,"disabled",2),p([y({type:Number})],Bt.prototype,"min",2),p([y({type:Number})],Bt.prototype,"max",2),p([y({type:Number,attribute:false})],Bt.prototype,"defaultValue",2),p([y({type:Number})],Bt.prototype,"zero",2),p([m()],Bt.prototype,"Jt",2);var zt="original",ji=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.zs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.yp();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===zt?void 0:this.state.value,filter:this.state.filter===zt?void 0:this.state.filter,fromViewer:false});}yp(){let t=this.state.operation,{range:e,zero:o}=Ot[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:o;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===zt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.zs} ></uc-slider-ui>`}};p([m()],ji.prototype,"state",2);function di(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)}}var pt=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Kl(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Kl();}updated(t){super.updated(t),t.has("active")&&this.Kl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([m()],pt.prototype,"active",2),p([m()],pt.prototype,"title",2),p([m()],pt.prototype,"icon",2),p([m()],pt.prototype,"titleProp",2);var Co=12,xo=16,mp=r=>{let i=12,t=12;return r.width/r.height>=1?(i=Co,t=Math.round(Co*r.height/r.width)):(t=Co,i=Math.round(Co*r.width/r.height)),{width:i,height:t}},So=class extends pt{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.bp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}bp(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Gi=class extends pt{constructor(){super(...arguments);this.pt=null;}get aspectRatio(){return this.pt}set aspectRatio(t){if(this.pt===t)return;let e=this.pt;this.pt=t,this.requestUpdate("aspectRatio",e),t?this.jl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.pt&&this.jl(this.pt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.pt?.id||t?.width===this.pt?.width&&t?.height===this.pt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.pt?.id&&(this.$["*currentAspectRatio"]=this.pt);}jl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};o(),s(),e||this.requestUpdate();}wp(){let t=this.pt;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=mp(t),s=(xo-e)/2,n=(xo-o)/2;return v`<uc-icon><svg viewBox="0 0 ${xo} ${xo}" 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 v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} >${this.wp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Gi.prototype,"aspectRatio",1);function gp(r){let i=r+90;return i=i>=360?0:i,i}function vp(r,i){if(r==="rotate")return gp(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var qi=class extends pt{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=vp(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};p([y({type:String})],qi.prototype,"operation",2);var re=class extends pt{constructor(){super(...arguments);this.a="";this.b="";this.Oi="";this.Lr=0;this.c=null;this.Ge=false;this.isOriginal=false;this.Gl=20;}get filter(){return this.b}set filter(t){let e=t??"";if(this.b===e)return;let o=this.b;this.b=e,this.a="filter",this.isOriginal=e===zt,this.icon=this.isOriginal?"original":"slider",this.Gl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.ql(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.a,this.b),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.a,this.b),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:di(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.b;}Ep(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Gl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.a]=this.b!==zt?{name:this.b,amount:a}:void 0,Q(this.Oi,at(wr,ae(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Dt}/${Ft}/uc-cloud-image-editor/`))}async mi(t,e){t[0]?.isIntersecting?await this.Hs(e):this._?.();}initCallback(){super.initCallback(),this.n=new window.IntersectionObserver(this.mi.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Oi=t??"",this.sub("*originalUrl",e=>{this.Oi=e??"",!this.isOriginal&&this.Oi&&this.isConnected&&!this.c&&(this.n?.observe(this),this.ge());}),this.isOriginal||(this.n?.observe(this),this.ge()),this.b&&this.ql(this.b),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.b);}),this.sub("*networkProblems",async e=>{e||(this.c?await this.Hs():this.ge());});}disconnectedCallback(){super.disconnectedCallback(),this.n?.disconnect(),this._?.(),this.Rr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.n?.unobserve(this):(this.n?.observe(this),this.ge()));}ql(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Hs(t){if(!this.isConnected){t?.unobserve(this),this._?.(),this._=void 0;return}if(!this.Oi){!this.je&&!this.te&&this.ge();return}let e=++this.Lr,o="";try{o=await this.proxyUrl(this.Ep());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ge=false,this._?.();let{promise:s,cancel:n}=Re(o);this._=()=>{n(),this.Lr===e&&(this._=void 0);};try{if(await s,this.Lr!==e||!this.isConnected)return;this.c=o,this.Ge=!0,this.Rr(),(t??this.n)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.ge();}finally{this.Lr===e&&(this._=void 0);}}ge(){if(!this.isConnected||this.c||this.Ge||this.isOriginal||this.$["*networkProblems"]){this.Rr();return}this.te&&cancelAnimationFrame(this.te),this.te=requestAnimationFrame(()=>{if(this.te=void 0,!this.isConnected||this.c||this.Ge||this.isOriginal){this.Rr();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.Hs();return}this.je=window.setTimeout(()=>{this.je=void 0,this.ge();},500);});}Rr(){this.te&&(cancelAnimationFrame(this.te),this.te=void 0),this.je&&(window.clearTimeout(this.je),this.je=void 0);}get Tp(){return !!(this.Ge&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Tp?"1":"0"};this.c&&(e.backgroundImage=`url(${this.c})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${ut(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><div class="uc-preview" data-testid="preview" ?data-loaded=${this.Ge} style=${ee(e)} ></div><uc-icon class=${ut({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ee(o)} ></uc-icon></button>`}};p([m()],re.prototype,"c",2),p([m()],re.prototype,"Ge",2),p([m()],re.prototype,"isOriginal",2),p([m()],re.prototype,"Gl",2),p([y({type:String})],re.prototype,"filter",1);var Wi=class extends pt{constructor(){super(...arguments);this.a="";}get operation(){return this.a}set operation(t){let e=t??"";if(this.a===e)return;let o=this.a;this.a=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.Wl(e);}Wl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},o=()=>{let s=this.l10n(t);return this.title=s,s};e(),o();}initCallback(){super.initCallback(),this.a&&this.Wl(this.a),this.sub("*editorTransformations",t=>{if(!this.a)return;let{zero:e}=Ot[this.a],o=t[this.a],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.a),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.a,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:di(this.$["*operationTooltip"])});}};p([y({type:String})],Wi.prototype,"operation",1);var yp=1,jl=()=>{},Zi=class extends T{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Zl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>yp){this.scrollLeft+=o;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Zl,{passive:false}),this.addEventListener("scroll",jl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Zl),this.removeEventListener("scroll",jl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Zi.prototype,"hiddenScrollbar",2);var gt=class extends T{constructor(){super(...arguments);this.Ii=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Yl=true;this.tabList=[...lt];this.activeTab=j.CROP;this.Ur=true;this.Ks=false;this.Xl=null;this.Ql=0;this.Jl=0;this.$r=O();this.tc=O();this.tabToggleRefs={[j.CROP]:O(),[j.TUNING]:O(),[j.FILTERS]:O()};this.ec=()=>{this.ve();};this.Pi=[];this.Dr=F(t=>{this.Ii=t;},500);this.Fr=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===j.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(zt);else if(this.showSubToolbar&&this.$["*tabId"]===j.TUNING&&e){s=true;let n=t?.[e]||Ot[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.Ks=s;},0);this.xp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Cp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Sp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Ap={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":zt,"*currentOperation":null,"*operationTooltip":null};this.Nt=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this._?.();let e=this.$["*on.cancel"];e?.();};this.Ws=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Fp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:di(this.$["*operationTooltip"])}),this.$r.value?.apply(),this.ic();};this.Np=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.$r.value?.cancel(),this.ic();};this.Vp=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.js(o,{fromViewer:false}));};}ic(){this.$["*showSlider"]=false,this.$["*tabId"]===j.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===j.TUNING&&(this.Ks=false);}js(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.rc(t,{fromViewer:e,force:o});}rc(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.ve();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===j.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of lt){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ve();}}ve(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.tc.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Ql!==s||this.Jl!==n)&&(this.Ql=s,this.Jl=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get Gs(){return this.Pi.length>=3}kp(t){switch(t){case j.CROP:return this.Mp();case j.FILTERS:return this.Op();case j.TUNING:return this.Ip();default:return []}}Mp(){let t=[];if(this.Gs)t.push(()=>this.Pp());else for(let e of this.Pi)t.push(()=>this.oc(e));for(let e of qn)t.push(()=>this.Lp(e));return this.qs(t)}Op(){let e=[zt,...Gn].map(o=>()=>this.Rp(o));return this.qs(e)}Ip(){let t=jn.map(e=>()=>this.Up(e));return this.qs(t)}qs(t){return t.length?t.map(o=>o()):[]}Pp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}oc(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Lp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Rp(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Up(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}$p(){return this.Gs?this.Pi.map(t=>this.oc(t)):[]}async Dp(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ui(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this._?.();let{cancel:o}=Fi([e]);this._=()=>{o(),this._=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Pi=[...t],this.sub("*cropPresetList",e=>{this.Pi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.js(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.Fr();}),this.sub("*currentOperation",()=>{this.Fr();}),this.sub("*tabId",e=>{this.rc(e,{fromViewer:false,force:true}),this.Fr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Dp(),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.Dr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ur=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ur=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Yl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.js(o,{fromViewer:false});return}this.ve();}),this.sub("*operationTooltip",e=>{this.Xl=e;}),this.Fr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.ec);}firstUpdated(t){super.firstUpdated(t),this.Nr(),this.ve();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ve()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Nr();}disconnectedCallback(){window.removeEventListener("resize",this.ec),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Nr(){let t=this.$r.value;t&&(this.$["*sliderEl"]=t);}_p(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?ee({gridColumn:`${s+1}`}):U;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Sp}><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.Vp} ${I(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Bp(t){let e=this.kp(t);return v`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:U}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Ks?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Gs;return v`<uc-line-loader-ui .active=${this.Ii}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Xl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.xp} ><div class="uc-tab-content-row">${lt.map(o=>Bi(this.activeTab===o,()=>this.Bp(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Yl} .styles=${this.Ap} @initial-render=${()=>this.ve()} ><div class="uc-tab-toggles_indicator" ${I(this.tc)} ></div>${lt.map(o=>this._p(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Nt} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ws}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Cp}><div class="uc-slider" ?hidden=${!this.Ur}><uc-editor-slider ${I(this.$r)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ur||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.$p()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Np} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Fp} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([m()],gt.prototype,"Ii",2),p([m()],gt.prototype,"showMainToolbar",2),p([m()],gt.prototype,"showSubToolbar",2),p([m()],gt.prototype,"Yl",2),p([m()],gt.prototype,"tabList",2),p([m()],gt.prototype,"activeTab",2),p([m()],gt.prototype,"Ur",2),p([m()],gt.prototype,"Ks",2),p([m()],gt.prototype,"Xl",2),p([m()],gt.prototype,"Pi",2);var Gl=jt([...lt]),rt=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.zp="";this.me=It;this.Hp="";this.Ii=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Gl;this.sc=false;this.Kt=false;this.Zs=null;this.Li=null;this.Dr=F(t=>{this.Ii=t;},300);this.Vr=O();this.nc=O();this.ac=O();this.cc=O();this.uc=()=>{this.Dr(false),this.me!==It&&(this.$["*networkProblems"]=false);};this.dc=()=>{this.Dr(false),this.$["*networkProblems"]=true;};this.Kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Bl(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}jp(){this.Kt||this.Zs||(this.Zs=this.updateComplete.then(()=>{this.Zs=null,this.Kt=true;}));}initCallback(){super.initCallback(),this.pc(),this.hc();}Nr(){let t=this.ac.value;t&&(this.$["*faderEl"]=t);let e=this.nc.value;e&&(this.$["*cropperEl"]=e);let o=this.cc.value;o&&(this.$["*imgContainerEl"]=o);let s=this.Vr.value;s&&(this.$["*imgEl"]=s);}Gp(){let t=this.Vr.value;t&&(t.addEventListener("load",this.uc),t.addEventListener("error",this.dc));}qp(){let t=this.Vr.value;t&&(t.removeEventListener("load",this.uc),t.removeEventListener("error",this.dc));}get Wp(){let t=this.$["*tabId"];return Tt("uc-image",{"uc-image_hidden_to_cropper":t===j.CROP,"uc-image_hidden_effects":t!==j.CROP})}fc(){if(this.Li)return this.Li;let t=3e3;return this.Li=new Promise((e,o)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Li=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),o(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Li}firstUpdated(t){super.firstUpdated(t),this.Nr(),this.Gp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.qp(),super.disconnectedCallback();}render(){let t=this.Hp??"",e=this.zp??"",o=this.me||It,s=this.Ii,n=this.sc;return v` ${We(zl)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Kp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${I(this.cc)}><img src=${o} class=${this.Wp} ${I(this.Vr)} />${Bi(this.Kt,()=>v`<uc-editor-image-cropper ${I(this.nc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${I(this.ac)}></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">${Bi(this.Kt,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.pc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.hc();}pc(){let t=this.tabs||Gl;this.$["*tabList"]=_l(t);}hc(){let t=ao(this.cropPreset??""),e=null;if(this.cdnUrl){let o=Zo(this.cdnUrl),s=Yo(o);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=rl(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.fc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=br(t),o=ne(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=Zo(t),n=Yo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=ne(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"]===j.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Q(t,at("json"))),o=await fetch(e).then(a=>a.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===j.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.jp();}}}async initEditor(){try{await this.fc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.sc=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=at(ae(t),"preview"),s=Q(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([m()],rt.prototype,"zp",2),p([m()],rt.prototype,"me",2),p([m()],rt.prototype,"Hp",2),p([m()],rt.prototype,"Ii",2),p([y({type:String,reflect:true})],rt.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],rt.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],rt.prototype,"cropPreset",2),p([y({type:String,reflect:true})],rt.prototype,"tabs",2),p([m()],rt.prototype,"sc",2),p([m()],rt.prototype,"Kt",2);var ln={};hn(ln,{CloudImageEditorActivity:()=>Yi});var Ao=class extends rt{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Yi=class extends M{constructor(){super(...arguments);this.mt=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.mt&&this.mt.cropPreset!==t&&(this.mt={...this.mt,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.mt&&this.mt.tabs!==t&&(this.mt={...this.mt,tabs:t});}),this.Zp();}disconnectedCallback(){super.disconnectedCallback(),this.Yp();}Ws(t){if(!this.Ri)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ri.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}Nt(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Zp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ri=e;let o=this.Ri.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.mt=this.Xp(o);}Yp(){this.Ri=void 0,this.mt=null;}render(){if(!this.mt)return U;let{cdnUrl:t,cropPreset:e,tabs:o}=this.mt;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${X(e)} tabs=${X(o)} @apply=${this.Ws} @cancel=${this.Nt} @change=${this.handleChange} ></uc-cloud-image-editor>`}Xp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([m()],Yi.prototype,"mt",2);var pi=class extends M{constructor(){super(...arguments);this.Ke="";this.zs=t=>{this.Ke=t.target?.value??"";};this.cs=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Ke.trim();e&&(this.api.addFileFromUrl(e,{source:R.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.cs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.zs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Ke} >${this.l10n("upload-url")}</button></form>`}};p([m()],pi.prototype,"Ke",2);var ql=()=>{let r=globalThis.location.ancestorOrigins,i=r?.[r.length-1];if(i&&i!=="null")return i;let t=globalThis.top??globalThis.parent??globalThis.self;try{return t.location.origin}catch(e){return console.warn("Unable to access top-level window location:",e),globalThis.location.origin}};var bp=r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Wl=(r,i="i")=>{let t=r.split("*").map(bp);return new RegExp(`^${t.join(".+")}$`,i)};var wp=["--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"],Ep=(r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),Zl=r=>{let i={};for(let t of wp){let e=Ep(r,t);e&&(i[t]=e);}return i};var Tp=["selected-files-change","toolbar-state-change"],Cp=r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Tp.includes(i))},ko=class{constructor(i,t){this._r=new Map;this.gc=i=>{if(i.source!==this.Ys)return;let t=i.data;if(!Cp(t))return;let e=this._r.get(t.type);if(e)for(let o of e)o(t);};this.Ys=i,this.mc=t,window.addEventListener("message",this.gc);}on(i,t){let e=this._r.get(i)??new Set;this._r.has(i)||this._r.set(i,e),e.add(t);}send(i){let t=this.mc();this.Ys.postMessage(i,t);}destroy(){window.removeEventListener("message",this.gc);}};function Yl(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("&")}var xp={[mt.GDRIVE]:"ngdrive"},vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.qe=O();this.Br=null;this.Xs=[];this.Qs=false;this.Js=false;this.tn=false;this.en=false;this.zr=false;this.rn=false;this.sn="uc-hidden";this.vc=true;this.us=()=>{for(let t of this.Xs){let e=this.Jp(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Nt=()=>{this.historyBack();};this.sh=()=>{this.Tt?.send({type:"select-all"});};this.nh=()=>{this.Tt?.send({type:"deselect-all"});};}get Qp(){if(!this.Br)return "";let{selectedCount:t,total:e}=this.Br;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.yc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.bc(),this.yc());});}),this.subConfigValue("multiple",e=>{this.zr=e;}),this.subConfigValue("localeName",()=>{this.wc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.Ec(e);});}Jp(t){if(t.alternatives){let e=J(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=Wl(o);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}th(t){this.vc=t.isVisible;}async eh(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.ih(t.selectedCount,t.total),this.sn=t.isReady?"":"uc-hidden",this.Qs=t.isReady,this.Js=t.isReady&&t.selectedFiles.length>0,this.zr=t.isMultipleMode&&t.total>0,this.tn=t.selectedCount<t.total,this.en=t.selectedCount===t.total,this.Xs=t.selectedFiles??[],this.rn=t.total>0;}Tc(){this.Ec(this.cfg.externalSourcesEmbedCss),this.rh(),this.wc();}rh(){this.Tt?.send({type:"set-theme-definition",theme:Zl(this)});}Ec(t){this.Tt?.send({type:"set-embed-css",css:t});}wc(){this.Tt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}oh(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=xp[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ql(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,o);return d.search=Yl(c),d.toString()}ih(t,e){this.Br={selectedCount:t,total:e};}yc(){let t=document.createElement("iframe");t.src=this.oh(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Tc.bind(this)),t.addEventListener("load",this.Tc.bind(this)),this.qe.value&&(this.qe.value.innerHTML="",this.qe.value.appendChild(t)),t.contentWindow&&(this.Tt?.destroy(),this.Tt=new ko(t.contentWindow,()=>this.cfg.socialBaseUrl),this.Tt.on("selected-files-change",this.eh.bind(this)),this.Tt.on("toolbar-state-change",this.th.bind(this)),this.xc());}bc(){this.Tt?.destroy(),this.Tt=void 0,this.qe.value&&(this.qe.value.innerHTML=""),this.xc();}xc(){this.Xs=[],this.Qs=false,this.Js=false,this.tn=false,this.en=false,this.zr=false,this.rn=false,this.sn="uc-hidden",this.Br=null;}disconnectedCallback(){super.disconnectedCallback(),this.bc();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${I(this.qe)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.vc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.zr} ><span>${this.Qp}</span><button type="button" @click=${this.sh} ?hidden=${!this.tn} >${this.l10n("select-all")}</button><button type="button" @click=${this.nh} ?hidden=${!this.en} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.us} ?disabled=${!this.Js} ?hidden=${!this.rn} ><uc-spinner ?hidden=${this.Qs}></uc-spinner><span class=${this.sn}>${this.l10n("done")}</span></button></div></div>`}};p([m()],vt.prototype,"Xs",2),p([m()],vt.prototype,"Qs",2),p([m()],vt.prototype,"Js",2),p([m()],vt.prototype,"tn",2),p([m()],vt.prototype,"en",2),p([m()],vt.prototype,"zr",2),p([m()],vt.prototype,"rn",2),p([m()],vt.prototype,"sn",2),p([m()],vt.prototype,"vc",2);var Xl=()=>typeof navigator.permissions<"u";var Sp={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Ap=["camera","microphone"];function Mo(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}var Ql="image/jpeg",Jl="video/webm",H=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Hr=null;this.nn=false;this.Ui=[];this.Pt=null;this.Lt=null;this.Kr=null;this.jr=null;this.w=null;this.$i={};this.It=null;this.r=null;this.We=[];this.Ze=[];this.ah={};this.Gr=[];this.qr=null;this.Cc=()=>{this.Sc(),this.Di="pause";};this.Ac=()=>{this.Di="play",this.lh();};this.Fi=O();this.he=O();this.X=O();this.kc=0;this.Mc=0;this.Oc=null;this.Wr=true;this.Zr=true;this.ch=Xl();this.Ic=[];this.ye=true;this.an="";this.Ye=true;this.be=true;this.Xe=true;this.Pc=[];this.we=true;this.ln=true;this.Ee=true;this._t=true;this.Te=true;this.Qe="camera-full";this.Di="play";this.Lc="microphone";this.Yr="uc-shot-btn uc-camera-action";this.uh=()=>{if(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.w}}}),this.w===P.PHOTO&&this.dh(),this.w===P.VIDEO){if(this.Pt?.state==="recording"){this.Rc();return}this.ph();}};this.hh=t=>{let e=t.target;e&&(this.jr=e.value,this.Je());};this.fh=t=>{let e=t.target;e&&(this.Kr=e.value,this.Je());};this.mh=()=>{this.Je();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.w}}}),this.uh();};this.vh=()=>{this.yh();};this.bh=()=>{this.wh();};this.Eh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.w}}}),this.Th();};this.xh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.w}}}),this.Ch();};this.Uc=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.$c(o);};this.Dc=()=>{let t=Math.floor((performance.now()-this.kc+this.Mc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Fi.value;s&&(s.textContent=Mo(e)),this.Rc();return}let o=this.Fi.value;o&&(o.textContent=Mo(e));}else {let e=this.Fi.value;e&&(e.textContent=Mo(t));}this.ti=requestAnimationFrame(this.Dc);};this.Sh=()=>{this.kc=performance.now(),this.Mc=0,this.Dc();};this.Fc=()=>{this.ti&&cancelAnimationFrame(this.ti);};this.Sc=()=>{let t=this.X.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.he.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.Fi.value;n&&(n.textContent=Mo(e)),this.ti=requestAnimationFrame(this.Sc);};this.lh=()=>{this.ti&&cancelAnimationFrame(this.ti);};this.ti=null;this.ph=()=>{try{this.Ui=[],this.$i={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.$i.mimeType=t:MediaRecorder.isTypeSupported(Jl)?this.$i.mimeType=Jl:this.$i.mimeType="video/mp4",this.Lt&&(this.Pt=new MediaRecorder(this.Lt,this.$i),this.Pt.start(),this.Pt.addEventListener("dataavailable",e=>{this.Ui.push(e.data);}),this.Sh(),this.classList.add("uc-recording"),this.Ni(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Rc=()=>{this.Pt?.addEventListener("stop",()=>{this.Ah(),this.Fc(),this.Ni(St.STOP);}),this.Pt?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.w}}});};this.yh=()=>{if(this.Pt?.state==="recording")return;let t=this.X.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.wh=()=>{this.Lt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Lc=t.enabled?"microphone":"microphone-mute",this.ln=!t.enabled;});};this.Ah=()=>{try{let t=new Blob(this.Ui,{type:this.Pt?.mimeType}),e=URL.createObjectURL(t),o=this.X.value;if(!o)return;o.muted=!1,o.volume=1,this.Vi(null),o.src=e,this.kh(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Th=()=>{if(this.Ni(St.RETAKE),this.w===P.VIDEO){this.Vi(this.Lt);let t=this.X.value;t&&(t.muted=true);}this.X.value?.play?.();};this.Ch=()=>{if(this.Ni(St.ACCEPT),this.w===P.PHOTO){this.It?.toBlob(s=>{if(!s)return;let n=this.Nc("camera","jpeg",Ql,s);this.Vc(n);},Ql);return}let t=new Blob(this.Ui,{type:this.Pt?.mimeType}),e=this.Mh(this.Pt?.mimeType),o=this.Nc("video",e,`video/${e}`,t);this.Vc(o),this.Ui=[];};this.Oh=t=>{t===St.SHOT&&(this.Te=true,this.be=true,this._t=true,this.Xe=false,this.ye=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.Te=!this.Bt.includes(P.VIDEO),this._t=!this.Bt.includes(P.PHOTO),this.be=false,this.Xe=true,this.ye=this.We.length<=1);};this.Ih=t=>{t===St.PLAY&&(this.Ye=false,this._t=true,this.ye=true,this.we=true,this.Di="pause",this.Qe="square",this.Yr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.Ye=false,this.be=true,this.Ee=true,this.Xe=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.Ye=true,this.Te=!this.Bt.includes(P.VIDEO),this._t=!this.Bt.includes(P.PHOTO),this.be=false,this.Xe=true,this.Ee=!this.cfg.enableAudioRecording,this.Qe="video-camera-full",this.Yr="uc-shot-btn uc-camera-action",this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.ye=this.We.length<=1);};this.Ni=t=>{this.w===P.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Oh(t),this.w===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Ih(t);};this.$c=t=>{t===P.PHOTO&&(this.Qe="camera-full",this.we=true,this.Ee=true),t===P.VIDEO&&(this.Di="play",this.Qe="video-camera-full",this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.Ee=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.w=t;};this.Nc=(t,e,o,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:o})};this.Vc=t=>{this.api.addFileFromObject(t,{source:R.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this._i=F(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.w===P.VIDEO&&this.cfg.enableAudioRecording,o=this.w===P.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Wr=false,this.be=false,this._t=!this.Bt.includes(P.PHOTO),this.Te=!this.Bt.includes(P.VIDEO),this.Zr=true,this.Ye=true,this.Qe=o,this.Ee=!e,this.we=!e):t==="prompt"?(this.an="camera-permissions-prompt",this.Wr=true,this.be=true,this._t=true,this.Zr=false,this.dn()):(this.an="camera-permissions-denied",this.Wr=true,this.Zr=false,this._t=!this.Bt.includes(P.PHOTO),this.Te=!this.Bt.includes(P.VIDEO),this.Xe=true,this.Yr="uc-shot-btn uc-camera-action",this.dn());},300);this.Ph=()=>{if(!this.Lt)return false;let t=this.Lt?.getAudioTracks(),e=this.Lt?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.dn=()=>{this.nn&&(this.X.value&&(this.X.value.volume=0),this.qr?.getTracks?.()?.[0]?.stop(),this.cn(this.X.value),this.Vi(null),this.Ph(),this.Fc(),this.nn=false);};this.Je=async()=>{let t={video:{...Sp},audio:this.cfg.enableAudioRecording?{}:false};this.jr&&(t.video={deviceId:{exact:this.jr}}),this.Kr&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Kr}}),this.X.value&&(this.X.value.volume=0);try{this._i("prompt"),this.Lt=await navigator.mediaDevices.getUserMedia(t),this.Lt.addEventListener("inactive",()=>{this._i("denied");}),this.Vi(this.Lt),this.nn=!0,this._i("granted");}catch(e){this._i("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this._c=()=>{this.Je();};this.Lh=async()=>{try{this.Xr();for(let t of Ap){let e=await navigator.permissions.query({name:t});this.ah[t]=e,e.addEventListener("change",this._c),this.Gr.push(()=>{e.removeEventListener("change",this._c);});}this.Hr=()=>{this.Xr();};}catch(t){this.Xr(),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.Je();}};this.Rh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.pn(),navigator.mediaDevices.addEventListener("devicechange",this.pn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.pn=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.We=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ze=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Ic=this.We,this.ye=this.We.length<=1,this.jr=this.We[0]?.value??null,this.Pc=this.Ze,this.we=!this.cfg.enableAudioRecording||this.Ze.length<=1,this.Kr=this.Ze[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Uh=async()=>{await this.Lh(),await this.Rh(),await this.Je(),this.Bc(this.Bt);};this.$h=async()=>{this.Hr&&this.Hr(),window.chrome||this._i("denied"),this.dn();};this.Bc=t=>{this.Te=!t.includes(P.VIDEO),this._t=!t.includes(P.PHOTO);let e=t[0];e&&(!this.w||!t.includes(this.w))&&this.$c(e);};}kh(t){this.cn(t),t.addEventListener("play",this.Cc),t.addEventListener("pause",this.Ac);}cn(t){t?.removeEventListener("play",this.Cc),t?.removeEventListener("pause",this.Ac);}Vi(t){this.qr!==t&&(this.qr=t,this.un());}un(){let t=this.X.value;if(!t)return;let e=this.qr??null;t.srcObject!==e&&(t.srcObject=e);}dh(){if(this.Ni("shot"),this.It=document.createElement("canvas"),this.r=this.It.getContext("2d"),!this.r)throw new Error("Failed to get canvas context");let t=this.X.value;if(!t)throw new Error("Video element not found");this.It.height=t.videoHeight,this.It.width=t.videoWidth,this.cfg.cameraMirror&&(this.r.translate(this.It.width,0),this.r.scale(-1,1)),this.r.drawImage(t,0,0),t.pause();}Mh(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 Bt(){return J(this.cfg.cameraModes).filter(t=>t===P.PHOTO||t===P.VIDEO)}Xr(){if(this.Gr.length!==0){for(let t of this.Gr)t();this.Gr=[],this.Hr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Oc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.Ee=!t,this.ln=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=Z(t);this.Bc(e.filter(o=>o===P.PHOTO||o===P.VIDEO));}),this.Uh();}firstUpdated(t){super.firstUpdated(t),this.un();}updated(t){super.updated(t),this.un();}Dh(){this.Xr(),navigator.mediaDevices?.removeEventListener("devicechange",this.pn),this.cn(this.X.value),this.Vi(null);}disconnectedCallback(){super.disconnectedCallback(),this.$h(),this.Dh();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ye}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Ic} ?hidden=${this.ye} @change=${this.hh} ></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=${ee({transform:this.Oc})} ?hidden=${this.Wr} ${I(this.X)} ></video><div class="uc-message-box" ?hidden=${this.Zr}><span>${this.l10n(this.an)}</span><button type="button" @click=${this.mh} ?hidden=${this.ch} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Ye}><button data-id="photo" type="button" class=${ut({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.w===P.PHOTO})} @click=${this.Uc} ?hidden=${this._t} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${ut({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.w===P.VIDEO})} @click=${this.Uc} ?hidden=${this.Te} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.vh} ?hidden=${this.Ye} data-testid="recording-timer" ><uc-icon name=${this.Di}></uc-icon><span ${I(this.Fi)}> 00:00 </span><span ${I(this.he)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Xe} ><button type="button" class="uc-secondary-btn" @click=${this.Eh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.xh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.gh} class=${this.Yr} ?hidden=${this.be} ><uc-icon name=${this.Qe}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.bh} ?hidden=${this.Ee} data-testid="toggle-microphone" ><uc-icon name=${this.Lc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Pc} ?hidden=${this.we} ?disabled=${this.ln} @change=${this.fh} data-testid="audio-select" ></uc-select></div></div>`}};p([m()],H.prototype,"Oc",2),p([m()],H.prototype,"Wr",2),p([m()],H.prototype,"Zr",2),p([m()],H.prototype,"ch",2),p([m()],H.prototype,"Ic",2),p([m()],H.prototype,"ye",2),p([m()],H.prototype,"an",2),p([m()],H.prototype,"Ye",2),p([m()],H.prototype,"be",2),p([m()],H.prototype,"Xe",2),p([m()],H.prototype,"Pc",2),p([m()],H.prototype,"we",2),p([m()],H.prototype,"ln",2),p([m()],H.prototype,"Ee",2),p([m()],H.prototype,"_t",2),p([m()],H.prototype,"Te",2),p([m()],H.prototype,"Qe",2),p([m()],H.prototype,"Di",2),p([m()],H.prototype,"Lc",2),p([m()],H.prototype,"Yr",2);var tc={id:"camera",setup:async({pluginApi:r,uploaderApi:i})=>{yt({CameraSource:H}),r.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Ta.htmlMediaCapture)return ["camera"];let t=Z(r.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(D.CAMERA),i.setModalState(true);}}),r.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),r.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"video-camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),r.registry.registerActivity({id:D.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var cn={};hn(cn,{BtnUi:()=>At,CloudImageEditor:()=>Ao,CloudImageEditorBlock:()=>rt,Config:()=>ai,CropFrame:()=>Hi,EditorAspectRatioButtonControl:()=>Gi,EditorCropButtonControl:()=>qi,EditorFilterControl:()=>re,EditorFreeformButtonControl:()=>So,EditorImageCropper:()=>Ki,EditorImageFader:()=>To,EditorOperationControl:()=>Wi,EditorScroller:()=>Zi,EditorSlider:()=>ji,EditorToolbar:()=>gt,Icon:()=>he,LineLoaderUi:()=>zi,PresenceToggle:()=>ci,SliderUi:()=>Bt,defineComponents:()=>yt});var kp="cloud-image-editor",Mp="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",ec={id:kp,setup:async({pluginApi:r,uploaderApi:i})=>(yt({...cn,...ln}),r.registry.registerIcon({name:"edit-file",svg:Mp}),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),r.registry.registerActivity({id:D.CLOUD_IMG_EDIT,render:e=>{let o=document.createElement("uc-cloud-image-editor-activity");return e.append(o),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let o=r.config.get("cropPreset"),s=r.config.get("useCloudImageEditor"),n=r.config.get("cloudImageEditorAutoOpen"),a=i.m.size;s&&a===1&&(o||n)&&(i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var ic={id:"external-sources",setup:async({pluginApi:r,uploaderApi:i})=>{yt({ExternalSource:vt}),r.registry.registerActivity({id:D.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))r.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(D.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var Io=()=>{let r=[];return {stack:r,promiseReadJpegChunks:t=>new Promise((e,o)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{o(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){o("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),f=>{if(f.byteLength!==h){o("Corrupted");return}r.push({startPos:c,length:h,marker:u,view:f}),a();})})};FileReader&&DataView||o("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&o("Not jpeg"),a();});})}},Op=async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Io();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},oc=async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Io();await s(r),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),o.push(c.length)});let a=[r.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(r.slice(l,e[c])),l=e[c]+o[c]+4;return a.push(r.slice(l,r.size)),new Blob(a,{type:r.type})}};var sc=(r,i)=>oc(r,226,i.map(t=>t.buffer)),Ip=async r=>{try{return await sc(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Lp=(r,i,t)=>new Promise((e,o)=>{let s=n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);};r.toBlob(s,i,t),r.width=r.height=1;}),Xi=()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},Pp=r=>{let{ctx:t,canvas:e}=Xi();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},Rp=async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Io();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},Up="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Oo,$p=()=>new Promise(r=>{if(Oo!==void 0)r(Oo);else {let i=new Image;i.addEventListener("load",()=>{Oo=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Oo);}),i.src=Up;}}),Dp=(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;}},Fp=(r,i)=>{Dp(r,(t,e)=>r.setUint16(t,i,e));},Vp=async(r,i,t)=>(t&&Fp(i,1),oc(r,225,[i.buffer])),Np=(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."));}));}),_p=r=>Np(new Image,r),Bp=[1,3],zp=[192,193,194,195,197,198,199,201,202,203,205,206,207],rc={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hp=async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Io();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&zp.indexOf(o)>=0){let n=s.getUint8(5);Bp.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},nc=(r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},ac=(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},ye={R:55,G:110,B:165,A:255},Kp=`rgba(${ye.R}, ${ye.G}, ${ye.B}, ${ye.A/255})`,lc=(r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Xi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Xi();s.width=r,s.height=i,n&&(n.fillStyle=Kp,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let a=o&&o.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===ye.R&&a[1]===ye.G&&a[2]===ye.B&&a[3]===ye.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}};function cc(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}var jp=cc(nc(lc,ac)),Gp=cc(nc(lc,ac)),uc=async(r,i)=>{let t=rc.squareSide.find(n=>n*n>=r*i),e=rc.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([jp(t,t),Gp(e,1)]);if(o&&s)return true;throw new Error("Not supported")},dc=async(r,i,t)=>{try{let{ctx:e,canvas:o}=Xi();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})}},qp=({img:r,targetW:i,targetH:t})=>dc(r,i,t),Wp=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()},Zp=({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Wp({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[a,l],c)=>n.then(d=>uc(a,l).then(()=>dc(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(r))},Yp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Xp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),un=.71,Qp=(r,i)=>{if(r.width*un*r.height*un<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 uc(s,n).then(()=>{let{ctx:a}=Xi();return "imageSmoothingQuality"in a&&!Yp()&&!Xp?qp({img:r,targetW:s,targetH:n}):Zp({img:r,sourceW:t,targetW:s,targetH:n,step:un})}).catch(()=>Promise.reject("Not supported"))},pc=async(r,i)=>{try{if(await Hp(r))throw new Error("Should skipped");let e=await Promise.allSettled([Rp(r),$p(),Op(r)]),s=!e.some(w=>w.status==="rejected"),[n,a,l]=e,c=await Ip(r).catch(()=>r),d=await _p(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await Qp(d,i),h="image/jpeg",f=i?.quality||.8;!s&&Pp(u)&&(h="image/png",f=void 0);let g=await Lp(u,h,f);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,b=a.status==="fulfilled"?a.value:!1;g=await Vp(g,w,b);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await sc(g,l.value)),g}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};var Jp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,hc=r=>{if(typeof r!="string")return false;let i=Jp.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}};var fc={id:"image-shrink",setup({pluginApi:r}){r.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=r.config.get("imageShrink");if(!t)return {file:i};let e=hc(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await pc(i,e)}}catch{return {file:i}}}});}};var mc={id:"instagram",setup({pluginApi:r}){r.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var gc={id:R.LOCAL,setup:({pluginApi:r,uploaderApi:i})=>{r.registry.registerSource({id:R.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var vc={id:"url-source",setup:async({pluginApi:r,uploaderApi:i})=>{yt({UrlSource:pi}),r.registry.registerActivity({id:D.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),r.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(D.URL),i.setModalState(true);}});}};var hi=[{configDeps:["useCloudImageEditor"],isEnabled:r=>!!r("useCloudImageEditor"),load:()=>ec},{configDeps:["imageShrink"],isEnabled:r=>!!r("imageShrink"),load:()=>fc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.LOCAL),load:()=>gc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.CAMERA),load:()=>tc},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes("instagram"),load:()=>mc},{configDeps:["sourceList"],isEnabled:r=>Object.values(mt).some(i=>Z(r("sourceList")).includes(i)),load:()=>ic},{configDeps:["sourceList"],isEnabled:r=>Z(r("sourceList")).includes(R.URL),load:()=>vc}];var Qi=class extends Jt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Fh(){return v`<uc-dynamic-btn></uc-dynamic-btn>`}Nh(){return v`<uc-simple-btn></uc-simple-btn>`}Vh(){return this.headless?null:this.dynamicButton?this.Fh():this.Nh()}render(){return v` ${super.render()} ${this.Vh()}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([y({type:Boolean})],Qi.prototype,"headless",2),p([y({attribute:"dynamic-button",type:Boolean})],Qi.prototype,"dynamicButton",2);var Lo=class extends Jt{constructor(){super();this.zc=false;this.Nt=()=>{if(this.Hc){let t=this.$["*historyBack"];t?.();return}this.Kc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Hc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Kc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}hn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.hn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.zc=this.Hc||this.Kc;});}render(){return v` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Nt} ?hidden=${!this.zc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};p([m()],Lo.prototype,"zc",2);var dn="active",Po="",be=class extends Jt{constructor(){super();this.mn=false;this.Qr=false;this.Jr=Po;this.gn=Po;this.yi="choose-file";this.hi=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Jr=dn),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Jr=dn,this.Qr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.gn=dn);};this.fi=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Qr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=hi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}hn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.hn();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.gn=Po):(this.Jr=Po,this.Qr=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.mn=!o):(this.style.removeProperty("--uc-grid-col"),this.mn=false);});}),this.subConfigValue("multiple",e=>{this.yi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(tt.OPEN,this.hi),this.modalManager?.subscribe(tt.CLOSE,this.fi);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(tt.OPEN,this.hi),this.modalManager?.unsubscribe(tt.CLOSE,this.fi);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Qr} class=${this.gn}><uc-drop-area ?single=${this.mn} initflow clickable tabindex="0" ><span>${this.l10n(this.yi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Jr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([m()],be.prototype,"mn",2),p([m()],be.prototype,"Qr",2),p([m()],be.prototype,"Jr",2),p([m()],be.prototype,"gn",2),p([m()],be.prototype,"yi",2);/*! For license information please see file-uploader.min.js.LEGAL.txt */
8
8
  export{$ as ActivityBlock,qs as ActivityHeader,jo as BaseComponent,T as Block,At as BtnUi,H as CameraSource,Ao as CloudImageEditor,Yi as CloudImageEditorActivity,rt as CloudImageEditorBlock,ai as Config,Ks as Copyright,Hi as CropFrame,G as Data,Et as DropArea,Eo as DropDown,Pt as DynamicBtn,Gi as EditorAspectRatioButtonControl,qi as EditorCropButtonControl,re as EditorFilterControl,So as EditorFreeformButtonControl,Ki as EditorImageCropper,To as EditorImageFader,Wi as EditorOperationControl,Zi as EditorScroller,ji as EditorSlider,gt as EditorToolbar,vt as ExternalSource,mt as ExternalUploadSource,ie as FileActionButton,Ys as FileItem,Lo as FileUploaderInline,be as FileUploaderMinimal,Qi as FileUploaderRegular,go as FormInput,he as Icon,Ns as Img,zi as LineLoaderUi,Ui as Modal,tt as ModalEvents,nn as NoWrapModeDynamicBtn,Dt as PACKAGE_NAME,Ft as PACKAGE_VERSION,_i as PluginActivityHost,li as PluginActivityRenderer,ci as PresenceToggle,sn as PrimaryAction,ii as ProgressBar,$i as ProgressBarCommon,ri as Select,Ni as SimpleBtn,Bt as SliderUi,Jt as SolutionBlock,me as SourceBtn,Di as SourceList,js as Spinner,Ws as StartFrom,ni as Thumb,nt as UID,Zs as UploadCtxProvider,Lt as UploadList,R as UploadSource,M as UploaderBlock,pi as UrlSource,yt as defineComponents,Fn as defineLocale,Nc as loadFileUploaderFrom,Cr as toKebabCase};