@uploadcare/file-uploader 1.33.1-alpha.0 → 1.33.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 +2 -2
  4. package/dist/index.js +3 -3
  5. package/dist/index.layered.css +2 -2
  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 +2 -2
  46. package/web/uc-basic.min.css +2 -2
  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 +2 -2
  51. package/web/uc-file-uploader-inline.min.css +2 -2
  52. package/web/uc-file-uploader-inline.min.js +3 -3
  53. package/web/uc-file-uploader-minimal.layered.min.css +2 -2
  54. package/web/uc-file-uploader-minimal.min.css +2 -2
  55. package/web/uc-file-uploader-minimal.min.js +3 -3
  56. package/web/uc-file-uploader-regular.layered.min.css +2 -2
  57. package/web/uc-file-uploader-regular.min.css +2 -2
  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
  var UC=(function(exports){'use strict';/**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.33.1-alpha.0 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.33.1 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-07-29T15:31:16.294Z
5
+ * Built: 2026-07-29T16:02:52.747Z
6
6
  */
7
- var ko=Object.defineProperty;var Jl=Object.getOwnPropertyDescriptor;var n=(r,i)=>ko(r,"name",{value:i,configurable:true});var rn=(r,i)=>{for(var t in i)ko(r,t,{get:i[t],enumerable:true});};var h=(r,i,t,e)=>{for(var o=e>1?void 0:e?Jl(i,t):i,s=r.length-1,a;s>=0;s--)(a=r[s])&&(o=(e?a(i,t,o):a(o))||o);return e&&o&&ko(i,t,o),o};var It=[],ee=0,Yi=4,on=n(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=ee+Yi;s<It.length;)It[s]===e?It.splice(s,Yi):s+=Yi;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!It.length;for(let a of i)It.push(a,t.value,e,o);if(s){for(ee=0;ee<It.length;ee+=Yi)It[ee](It[ee+1],It[ee+2],It[ee+3]);It.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t},"atom");function Xi(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,a)=>{e.has(a)&&t(o,s,a);})}n(Xi,"listenKeys");function Mo(r,i,t){let e=Xi(r,i,t);return t(r.value),e}n(Mo,"subscribeKeys");var Io=n((r={})=>{let i=on(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i},"map");var G=class r{static{n(this,"PubSub");}static{this.Qe=new Map;}constructor(i,t){this.pt=i,this.xt=t;}get id(){return this.pt}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?Mo:Xi)(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.Qe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Io(i);return r.Qe.set(t,e),new r(t,e)}static deleteCtx(i){r.Qe.delete(i);}static getCtx(i){let t=r.Qe.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Qe.has(i)}};var Qi=globalThis,tr=Qi.ShadowRoot&&(Qi.ShadyCSS===void 0||Qi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nn=Symbol(),sn=new WeakMap,Ji=class{static{n(this,"n");}constructor(i,t,e){if(this.Bc=true,e!==nn)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(tr&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=sn.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&sn.set(t,i));}return i}toString(){return this.cssText}},an=n(r=>new Ji(typeof r=="string"?r:r+"",void 0,nn),"r");var ln=n((r,i)=>{if(tr)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Qi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},"S"),Oo=tr?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return an(t)})(r):r;var{is:ec,defineProperty:ic,getOwnPropertyDescriptor:rc,getOwnPropertyNames:oc,getOwnPropertySymbols:sc,getPrototypeOf:nc}=Object,er=globalThis,cn=er.trustedTypes,ac=cn?cn.emptyScript:"",lc=er.reactiveElementPolyfillSupport,di=n((r,i)=>r,"d"),pi={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}},ir=n((r,i)=>!ec(r,i),"f"),un={attribute:true,type:String,converter:pi,reflect:false,useDefault:false,hasChanged:ir};Symbol.metadata??=Symbol("metadata"),er.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static{n(this,"y");}static addInitializer(i){this.Xr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=un){if(t.state&&(t.attribute=false),this.Xr(),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&&ic(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=rc(this.prototype,i)??{get(){return this[t]},set(a){this[t]=a;}};return {get:o,set(a){let l=o?.call(this);s?.call(this,a),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??un}static Xr(){if(this.hasOwnProperty(di("elementProperties")))return;let i=nc(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(di("finalized")))return;if(this.finalized=true,this.Xr(),this.hasOwnProperty(di("properties"))){let t=this.properties,e=[...oc(t),...sc(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.Ni=new Map;for(let[t,e]of this.elementProperties){let o=this.Qr(t,e);o!==void 0&&this.Ni.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(Oo(o));}else i!==void 0&&t.push(Oo(i));return t}static Qr(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.xe=null,this.zc();}zc(){this.Jr=new Promise(i=>this.enableUpdating=i),this.Qt=new Map,this.Hc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Je??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Je?.delete(i);}Hc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ln(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Je?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Je?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.to(i,e);}Kc(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.Qr(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:pi).toAttribute(t,e.type);this.xe=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.xe=null;}}to(i,t){let e=this.constructor,o=e.Ni.get(i);if(o!==void 0&&this.xe!==o){let s=e.getPropertyOptions(o),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:pi;this.xe=o;let l=a.fromAttribute(t,s.type);this[o]=l??this.eo?.get(o)??l,this.xe=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let a=this.constructor;if(o===false&&(s=this[i]),e??=a.getPropertyOptions(i),!((e.hasChanged??ir)(s,t)||e.useDefault&&e.reflect&&s===this.eo?.get(i)&&!this.hasAttribute(a.Qr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Jr=this.jc());}C(i,t,{useDefault:e,reflect:o,wrapped:s},a){e&&!(this.eo??=new Map).has(i)&&(this.eo.set(i,a??t??this[i]),s!==true||a!==void 0)||(this.Qt.has(i)||(this.hasUpdated||e||(t=void 0),this.Qt.set(i,t)),o===true&&this.xe!==i&&(this.pn??=new Set).add(i));}async jc(){this.isUpdatePending=true;try{await this.Jr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Vi){for(let[o,s]of this.Vi)this[o]=s;this.Vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:a}=s,l=this[o];a!==true||this.Qt.has(o)||l===void 0||this.C(o,void 0,s,l);}}let i=false,t=this.Qt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Je?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.io();}catch(e){throw i=false,this.io(),e}i&&this.Gc(t);}willUpdate(i){}Gc(i){this.Je?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}io(){this.Qt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Jr}shouldUpdate(i){return true}update(i){this.pn&&=this.pn.forEach(t=>this.Kc(t,this[t])),this.io();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[di("elementProperties")]=new Map,zt[di("finalized")]=new Map,lc?.({ReactiveElement:zt}),(er.reactiveElementVersions??=[]).push("2.1.2");var Po=globalThis,dn=n(r=>r,"i"),rr=Po.trustedTypes,pn=rr?rr.createPolicy("lit-html",{createHTML:n(r=>r,"createHTML")}):void 0,Uo="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Ro="?"+Ht,cc=`<${Ro}>`,Ee=document,mi=n(()=>Ee.createComment(""),"c"),fi=n(r=>r===null||typeof r!="object"&&typeof r!="function","a"),$o=Array.isArray,yn=n(r=>$o(r)||typeof r?.[Symbol.iterator]=="function","d"),Lo=`[ \f\r]`,hi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hn=/-->/g,mn=/>/g,Te=RegExp(`>|${Lo}(?:([^\\s"'>=/]+)(${Lo}*=${Lo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),fn=/'/g,gn=/"/g,bn=/^(?:script|style|textarea|title)$/i,Do=n(r=>(i,...t)=>({Vt:r,strings:i,values:t}),"x"),y=Do(1);Do(2);Do(3);var st=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),vn=new WeakMap,Ce=Ee.createTreeWalker(Ee,129);function wn(r,i){if(!$o(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return pn!==void 0?pn.createHTML(i):i}n(wn,"V");var Tn=n((r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",a=hi;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,m=0;for(;m<c.length&&(a.lastIndex=m,p=a.exec(c),p!==null);)m=a.lastIndex,a===hi?p[1]==="!--"?a=hn:p[1]!==void 0?a=mn:p[2]!==void 0?(bn.test(p[2])&&(o=RegExp("</"+p[2],"g")),a=Te):p[3]!==void 0&&(a=Te):a===Te?p[0]===">"?(a=o??hi,d=-1):p[1]===void 0?d=-2:(d=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?Te:p[3]==='"'?gn:fn):a===gn||a===fn?a=Te:a===hn||a===mn?a=hi:(a=Te,o=void 0);let f=a===Te&&r[l+1].startsWith("/>")?" ":"";s+=a===hi?c+cc:d>=0?(e.push(u),c.slice(0,d)+Uo+c.slice(d)+Ht+f):c+Ht+(d===-2?l:f);}return [wn(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),gi=class r{static{n(this,"S");}constructor({strings:i,Vt:t},e){let o;this.parts=[];let s=0,a=0,l=i.length-1,c=this.parts,[u,p]=Tn(i,t);if(this.el=r.createElement(u,e),Ce.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(o=Ce.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Uo)){let m=p[a++],f=o.getAttribute(d).split(Ht),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?sr:v[1]==="?"?nr:v[1]==="@"?ar:Se}),o.removeAttribute(d);}else d.startsWith(Ht)&&(c.push({type:6,index:s}),o.removeAttribute(d));if(bn.test(o.tagName)){let d=o.textContent.split(Ht),m=d.length-1;if(m>0){o.textContent=rr?rr.emptyScript:"";for(let f=0;f<m;f++)o.append(d[f],mi()),Ce.nextNode(),c.push({type:2,index:++s});o.append(d[m],mi());}}}else if(o.nodeType===8)if(o.data===Ro)c.push({type:2,index:s});else {let d=-1;for(;(d=o.data.indexOf(Ht,d+1))!==-1;)c.push({type:7,index:s}),d+=Ht.length-1;}s++;}}static createElement(i,t){let e=Ee.createElement("template");return e.innerHTML=i,e}};function xe(r,i,t=r,e){if(i===st)return i;let o=e!==void 0?t.qc?.[e]:t.Wc,s=fi(i)?void 0:i.ro;return o?.constructor!==s&&(o?.hn?.(false),s===void 0?o=void 0:(o=new s(r),o.oo(r,t,e)),e!==void 0?(t.qc??=[])[e]=o:t.Wc=o),o!==void 0&&(i=xe(r,o.Zc(r,i.values),o,e)),i}n(xe,"M");var or=class{static{n(this,"R");}constructor(i,t){this.mn=[],this.Tt=void 0,this.gn=i,this.m=t;}get parentNode(){return this.m.parentNode}get X(){return this.m.X}u(i){let{el:{content:t},parts:e}=this.gn,o=(i?.creationScope??Ee).importNode(t,true);Ce.currentNode=o;let s=Ce.nextNode(),a=0,l=0,c=e[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new De(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new lr(s,this,i)),this.mn.push(u),c=e[++l];}a!==c?.index&&(s=Ce.nextNode(),a++);}return Ce.currentNode=Ee,o}p(i){let t=0;for(let e of this.mn)e!==void 0&&(e.strings!==void 0?(e.Et(i,e,t),t+=e.strings.length-2):e.Et(i[t])),t++;}},De=class r{static{n(this,"k");}get X(){return this.m?.X??this.vn}constructor(i,t,e,o){this.type=2,this.r=$,this.Tt=void 0,this.Pt=i,this.Te=t,this.m=e,this.options=o,this.vn=o?.isConnected??true;}get parentNode(){let i=this.Pt.parentNode,t=this.m;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Pt}get endNode(){return this.Te}Et(i,t=this){i=xe(this,i,t),fi(i)?i===$||i==null||i===""?(this.r!==$&&this.Ee(),this.r=$):i!==this.r&&i!==st&&this.yn(i):i.Vt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):yn(i)?this.k(i):this.yn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.Te)}T(i){this.r!==i&&(this.Ee(),this.r=this.O(i));}yn(i){this.r!==$&&fi(this.r)?this.Pt.nextSibling.data=i:this.T(Ee.createTextNode(i)),this.r=i;}$(i){let{values:t,Vt:e}=i,o=typeof e=="number"?this.Yc(i):(e.el===void 0&&(e.el=gi.createElement(wn(e.h,e.h[0]),this.options)),e);if(this.r?.gn===o)this.r.p(t);else {let s=new or(o,this),a=s.u(this.options);s.p(t),this.T(a),this.r=s;}}Yc(i){let t=vn.get(i.strings);return t===void 0&&vn.set(i.strings,t=new gi(i)),t}k(i){$o(this.r)||(this.r=[],this.Ee());let t=this.r,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(mi()),this.O(mi()),this,this.options)):e=t[o],e.Et(s),o++;o<t.length&&(this.Ee(e&&e.Te.nextSibling,o),t.length=o);}Ee(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.Te;){let e=dn(i).nextSibling;dn(i).remove(),i=e;}}setConnected(i){this.m===void 0&&(this.vn=i,this._i?.(i));}},Se=class{static{n(this,"H");}get tagName(){return this.element.tagName}get X(){return this.m.X}constructor(i,t,e,o,s){this.type=1,this.r=$,this.Tt=void 0,this.element=i,this.name=t,this.m=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=$;}Et(i,t=this,e,o){let s=this.strings,a=false;if(s===void 0)i=xe(this,i,t,0),a=!fi(i)||i!==this.r&&i!==st,a&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=xe(this,l[e+c],t,c),u===st&&(u=this.r[c]),a||=!fi(u)||u!==this.r[c],u===$?i=$:i!==$&&(i+=(u??"")+s[c+1]),this.r[c]=u;}a&&!o&&this.j(i);}j(i){i===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},sr=class extends Se{static{n(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===$?void 0:i;}},nr=class extends Se{static{n(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==$);}},ar=class extends Se{static{n(this,"z");}constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}Et(i,t=this){if((i=xe(this,i,t,0)??$)===st)return;let e=this.r,o=i===$&&e!==$||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==$&&(e===$||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},lr=class{static{n(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.Tt=void 0,this.m=t,this.options=e;}get X(){return this.m.X}Et(i){xe(this,i);}},Cn={I:De},uc=Po.litHtmlPolyfillSupport;uc?.(gi,De),(Po.litHtmlVersions??=[]).push("3.3.2");var cr=n((r,i,t)=>{let e=t?.renderBefore??i,o=e.Xc;if(o===void 0){let s=t?.renderBefore??null;e.Xc=o=new De(i.insertBefore(mi(),s),s,void 0,t??{});}return o.Et(r),o},"D");var Fo=globalThis,xt=class extends zt{static{n(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.so=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.so=cr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.so?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.so?.setConnected(false);}render(){return st}};xt.Rh=true,xt.finalized=true,Fo.litElementHydrateSupport?.({LitElement:xt});var dc=Fo.litElementPolyfillSupport;dc?.({LitElement:xt});(Fo.litElementVersions??=[]).push("4.2.2");var pc=/\\([0-9a-fA-F]{1,6} ?)/g;function hc(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}n(hc,"hasLeadingTrailingQuotes");function mc(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}n(mc,"trimQuotes");function fc(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}n(fc,"escapeQuotes");function En(r){let i=r;hc(r)&&(i=mc(i),i=i.replace(pc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=fc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}n(En,"parseCssPropertyValue");function Fe(r){class i extends r{constructor(){super(...arguments);this.bn=null;this.ao=null;}static{n(this,"CssDataMixinClass");}getCssData(o,s=false){let a=this.bn??Object.create(null);if(!Object.keys(a).includes(o)||!a[o]){this.ao||(this.ao=window.getComputedStyle(this));let l=this.ao.getPropertyValue(o).trim();try{a[o]=En(l);}catch(c){s||console.warn(`CSS Data error: ${o}`,c),a[o]=null;}}return this.bn=a,a[o]}}return i}n(Fe,"CssDataMixin");function ur(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Jt={};this.te=null;this.Bi=false;}static{n(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.te||(this.te=Array.from(this.childNodes)),super.connectedCallback();}Qc(){if(this.Bi)return;this.Bi=true,this.Jt={};let o=Array.from(this.childNodes),s=o.length?o:this.te??[];for(let a of s){let l=this.wn(a),c=this.Jt[l]??[];a instanceof Element&&(a.removeAttribute("slot"),a.removeAttribute("content-for")),c.push(a),this.Jt[l]=c;}this.te=null;}wn(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.wn(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}Jc(o){return !o.textContent||!o.textContent.trim()}tu(o){let s=this.Jt[o];return !s||s.every(a=>a instanceof Comment||a instanceof Text&&this.Jc(a))}update(o){!this.hasUpdated&&this.willYield&&this.Qc(),super.update(o);}yield(o,s){if(o===""&&!this.Jt[o]&&!this.Bi&&this.te?.length){let l=[];for(let c of this.te)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Jt[o]=l,this.Bi=true,this.te=null;}let a=this.Jt[o];return y` ${a} ${this.tu(o)?s:void 0} `}}return i}n(ur,"LightDomMixin");function Ve(r){class i extends r{static{n(this,"RegisterableElementMixinClass");}static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,o);}}return i}n(Ve,"RegisterableElementMixin");var ie=class extends Event{static{n(this,"s");}constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Ne=class{static{n(this,"s");}constructor(i,t,e,o){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(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,a)),this.unsubscribe=a;},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 ie(this.context,this.host,this.t,this.subscribe));}};var dr=class{static{n(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:n(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var Vo=class extends Event{static{n(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},_e=class extends dr{static{n(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[a,{consumerHost:l}]of this.subscriptions)s.has(a)||(s.add(a),l.dispatchEvent(new ie(this.context,l,a,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 Vo(this.context,this.host));}};var vc={attribute:true,type:String,converter:pi,reflect:false,hasChanged:ir},yc=n((r=vc,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:a}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(a,c,r,true,l);},init(l){return l!==void 0&&this.C(a,void 0,r,l),l}}}if(e==="setter"){let{name:a}=t;return function(l){let c=this[a];i.call(this,l),this.requestUpdate(a,c,r,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(r){return (i,t)=>typeof t=="object"?yc(r,i,t):((e,o,s)=>{let a=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),a?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}n(b,"n");function g(r){return b({...r,state:true,attribute:false})}n(g,"r");function V(r,i){let t,e=n(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}n(V,"debounce");var xn="ctx-name-context";function hr(){return function(r){class i extends r{constructor(...o){super(...o);this.mt=null;this.ti=false;this.lo=false;this.co=void 0;this.Ce=new Map;this.ei=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this._t;this.Bt=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this._t,this.eu=new Ne(this,{context:xn,callback:n(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.En=s,this.Tn();},"callback"),subscribe:true});}static{n(this,"SymbioteMixinClass");}static set template(o){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get xn(){return this.zi}set xn(o){let s=o??void 0;this.zi!==s&&(this.zi=s,this.Tn());}shouldUpdate(o){return this.Bt?super.shouldUpdate(o):false}get _t(){return this.xn||this.En||void 0}Tn(){if(this.ctxName=this._t,!(!this.ctxName||this.ti)){if(this.isConnected){this.uo();return}this.Hi=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this._t,this.ctxName&&(this.co?this.co.setValue(this.ctxName):this.co=new _e(this,{context:xn,initialValue:this.ctxName}));}Cn(){if(!(!this.mt||this.Ce.size===0)){for(let[o,{value:s,rewrite:a}]of this.Ce)this.mt.add(o,s,a);this.Ce.clear();}}Sn(){return !this.mt&&this._t&&this.po(),this.mt&&this.Cn(),this.mt}Ki(){let o=this.Sn();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}po(){let o=this.init$,s=this._t;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.mt){this.mt=G.getCtx(s)??G.registerCtx(o,s);for(let[a,l]of Object.entries(this.init$))this.mt.add(a,l,this.ctxOwner);this.Cn();}}get $(){return this._t&&this.po(),new Proxy({},{get:n((o,s)=>{if(typeof s=="string")return this.mt?.read(s)},"get"),set:n((o,s,a)=>(typeof s!="string"||this.mt?.pub(s,a),true),"set")})}sub(o,s,a=true){let l=this.Ki().sub(o,s,a);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=n(()=>{u||(u=true,c(),this.ei.delete(p));},"trackedRemove");return this.ei.add(p),p}pub(o,s){this.Ki().pub(o,s);}set$(o){for(let[s,a]of Object.entries(o))this.pub(s,a);}get sharedCtx(){return this.Ki()}has(o){return this.mt?.has(o)??false}add(o,s,a=false){let l=this.Sn();if(!l){if(!a&&this.Ce.has(o))return;this.Ce.set(o,{value:s,rewrite:a});return}this.Ce.delete(o),l.add(o,s,a);}add$(o,s=false){for(let[a,l]of Object.entries(o))this.add(a,l,s);}connectedCallback(){super.connectedCallback(),this.ti?this.Bt&&this.lo&&(this.lo=false,this.initCallback()):this.ctxName?(this.Hi=false,this.uo()):this.Hi&&this._t&&(this.Hi=false,this.uo());}uo(){if(this.ti)return;this.ti=true,this.po();let o=this.init$;if(Object.keys(o).length>0){let s=this.Ki();for(let[a,l]of Object.entries(o))s.read(a)===void 0&&s.pub(a,l),this.sub(a,V(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Bt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.iu(),super.disconnectedCallback(),this.ti&&(this.lo=true);}iu(){if(this.ei.size!==0){for(let o of [...this.ei])o();this.ei.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"xn",1),h([g()],i.prototype,"En",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Bt",2),i}}n(hr,"SymbioteMixin");var No=class extends Ve(hr()(Fe(ur(xt)))){static{n(this,"BaseComponent");}};var nt=class r{static{n(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var bc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function bt(r){for(let i in r){if(bc.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);}}n(bt,"defineComponents");var _o="UC";function wc(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[_o]){t(window[_o]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[_o];i&&bt(s),t(s);},document.head.appendChild(o);})}n(wc,"loadFileUploaderFrom");var vi={"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 Bo=new Map,Sn=new Map,An=n((r,i)=>{Bo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...vi,...i};return Bo.set(r,t),t},"defineLocaleSync"),Tc=n((r,i)=>{Sn.set(r,i);},"defineLocaleAsync"),kn=n((r,i)=>{typeof i=="function"?Tc(r,i):An(r,i);},"defineLocale"),Mn=n(async r=>{let i=Bo.get(r);if(!i){let t=Sn.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=An(r,e);}return i},"resolveLocaleDefinition");kn("en",vi);var S=n(r=>`*cfg/${r}`,"sharedConfigKey");var Z=n(r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),jt=n(r=>r.join(","),"serializeCsv");var In=n(r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),mr=n((...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>In(i)).join("/-/"),"joinCdnOperations"),at=n((...r)=>{let i=mr(...r);return i?`-/${i}/`:""},"createCdnUrlModifiers");function fr(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}n(fr,"extractFilename");function gr(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}n(gr,"extractUuid");function zo(r){let i=On(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}n(zo,"extractCdnUrlModifiers");function Ho(r){return zo(r).split("/-/").filter(Boolean).map(t=>In(t))}n(Ho,"extractOperations");function On(r){let i=new URL(r),t=fr(r),e=Ln(t)?Pn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}n(On,"trimFilename");function Ln(r){return r.startsWith("http")}n(Ln,"isFileUrl");function Pn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}n(Pn,"splitFileUrl");var Q=n((r,i,t)=>{let e=new URL(On(r)),o=t??fr(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&Ln(o)){let a=Pn(o);e.pathname=`${e.pathname}${s}${a.pathname||""}`,e.search=a.search,e.hash=a.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},"createCdnUrl"),re=n((r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var J=n((r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var yi=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}),Rn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Cc(r,i){if(typeof i=="number"){let t=i;return yi[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return yi[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return yi.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}n(Cc,"transformationToStr");function oe(r){return mr(...Rn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Cc(i,t)}).filter(i=>!!i))}n(oe,"transformationsToOperations");var vr=mr("format/auto","progressive/yes"),Kt=n(([r])=>typeof r<"u"?Number(r):void 0,"asNumber"),Un=n(()=>true,"asBoolean"),Ec=n(([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),"asFilter"),xc=n(([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)}},"asCrop"),Sc=Object.freeze({enhance:Kt,brightness:Kt,exposure:Kt,gamma:Kt,contrast:Kt,saturation:Kt,vibrance:Kt,warmth:Kt,filter:Ec,mirror:Un,flip:Un,rotate:Kt,crop:n(r=>{let[i,t]=r,{dimensions:e,coords:o}=xc([i,t]);return {dimensions:e,coords:o}},"crop")});function jo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!Rn.includes(e))continue;let s=e,a=Sc[s];try{let l=a(o);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}n(jo,"operationsToTransformations");var K=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),lt=Object.freeze([K.CROP,K.TUNING,K.FILTERS]),$n=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Dn=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"]),Fn=Object.freeze(["rotate","mirror","flip"]),Gt=yi,Ot=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var bi="https://ucarecdn.com",Ac="https://upload.uploadcare.com",kc="https://social.uploadcare.com",Mc="https://ucarecd.net",Ic={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:bi,cdnCnamePrefixed:Mc,baseUrl:Ac,socialBaseUrl:kc,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,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},it=Object.freeze(Ic);var yr=n((r,i)=>(...t)=>{let e=r();if(!e.read(S("debug")))return;let o=t;if(typeof t?.[0]=="function"){let a=t[0];o=a();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);},"createDebugPrinter");var q=class{constructor(i){this.ho=new Set;this.ee=null;this.E=yr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}static{n(this,"SharedInstance");}addSub(i){this.ho.add(i);}get ie(){if(!this.ee){let i={};this.ee=new Proxy(i,{set:n(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:n((t,e)=>{if(typeof e!="string")return;let o=S(e);return this.e.ctx.has(o)?this.e.ctx.read(o):it[e]},"get")});}return this.ee}destroy(){for(let i of this.ho)try{i();}catch{}this.ho.clear();}},Oc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},St=n((r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),Vn=n(r=>({get ctx(){return r()},get modalManager(){return St(r(),"*modalManager",false)},get pluginManager(){return St(r(),"*pluginManager")},get telemetryManager(){return St(r(),"*telemetryManager")},get localeManager(){return St(r(),"*localeManager")},get a11y(){return St(r(),"*a11y")},get routerLayer(){return St(r(),"*routerLayer")},get blocksRegistry(){return St(r(),"*blocksRegistry")},get eventEmitter(){return St(r(),"*eventEmitter")},get uploadCollection(){return St(r(),"*uploadCollection")},get secureUploadsManager(){return St(r(),"*secureUploadsManager",false)},get api(){return St(r(),"*publicApi")},get validationManager(){return St(r(),"*validationManager")},when(i,t){let e=Oc[i],o=r(),s=o.has(e)?o.read(e):void 0;if(s)return t(s),()=>{};let a;return a=o.sub(e,l=>{l&&(t(l),a?.());}),a},wait(i){return new Promise(t=>{let e;e=this.when(i,o=>{t(o),e?.();});})}}),"createSharedInstancesBag");var tt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),br=class extends q{constructor(){super(...arguments);this.re=new Map;this.Ct=new Set;this.c=new Map;}static{n(this,"ModalManager");}registerModal(t,e){this.re.set(t,e),this.Z(tt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.re.get(t);return e?(this.re.delete(t),this.Ct.delete(t),this.Z(tt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.re.get(t);return e?(this.Ct.add(t),this.Z(tt.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.re.get(t);return !e||!this.Ct.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.Ct.delete(t),this.Z(tt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.re.has(t)?this.Ct.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Ct.size>0}back(){if(this.Ct.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.Ct).pop();return t?this.close(t):false}closeAll(){let t=this.Ct.size;return this.Ct.clear(),this.Z(tt.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}Z(t,e){if(this.c.has(t))for(let o of this.c.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.re.clear(),this.c.clear(),this.Z(tt.DESTROY,{});}};var wr=n(r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function Nn(r){return Object.prototype.toString.call(r)==="[object Object]"}n(Nn,"isObject");var Lc=/\W|_/g;function Pc(r){return r.split(Lc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}n(Pc,"camelizeString");function _n(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Wt(t,{ignoreKeys:i})):r}n(_n,"camelizeArrayItems");function Wt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return _n(r,{ignoreKeys:i});if(!Nn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}Nn(o)?o=Wt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=_n(o,{ignoreKeys:i})),t[Pc(e)]=o;}return t}n(Wt,"camelizeKeys");var Uc=n(r=>new Promise(i=>setTimeout(i,r)),"delay");function Xo({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 a=[r,i,e].filter(Boolean).join("/"),l=[s,o].filter(Boolean).join("; ");return `${a} (${l})`}n(Xo,"getUserAgent$1");var Rc={factor:2,time:100};function $c(r,i=Rc){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:n(l=>Uc(l??s).then(()=>(t+=1,e(o))),"retry")})}return n(e,"runAttempt"),e(r)}n($c,"retrier");var Ae=class extends Error{static{n(this,"UploadcareError");}},Be=class r extends Ae{static{n(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Cr=n((r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),se=class r extends Ae{static{n(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Dc=500,zn=n(({check:r,interval:i=Dc,timeout:t,signal:e})=>new Promise((o,s)=>{let a,l;Cr(e,()=>{a&&clearTimeout(a),s(new se("Poll cancelled"));}),t&&(l=setTimeout(()=>{a&&clearTimeout(a),s(new se("Timed out"));},t));let c=n(()=>{try{Promise.resolve(r(e)).then(u=>{u?(l&&clearTimeout(l),o(u)):a=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");a=setTimeout(c,0);}),"poll"),P={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"},Er="application/octet-stream",Hn="original",ae=n(({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=r?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",Cr(o,()=>{p=true,c.abort(),l(new se);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(T){let C=T.split(": "),A=C.shift(),N=C.join(": ");A&&typeof A<"u"&&(f[A]=N);});let v=c.response,w=c.status;a({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new Be(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function Fc(r,...i){return r}n(Fc,"identity");var Vc=n(({name:r})=>r?[r]:[],"getFileOptions"),Nc=Fc,_c=n(()=>new FormData,"getFormData"),jn=n(r=>false,"isBuffer"),xr=n(r=>typeof Blob<"u"&&r instanceof Blob,"isBlob"),Sr=n(r=>typeof File<"u"&&r instanceof File,"isFile"),Ar=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),ze=n(r=>xr(r)||Sr(r)||jn()||Ar(r),"isFileData"),Bc=n(r=>typeof r=="string"||typeof r=="number"||typeof r>"u","isSimpleValue"),zc=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),Hc=n(r=>!!r&&typeof r=="object"&&"data"in r&&ze(r.data),"isFileValue");function Kn(r,i,t){if(Array.isArray(t))for(let e of t)Kn(r,`${i}[]`,e);else if(Hc(t)){let{name:e,contentType:o}=t,s=Nc(t.data,e,o??Er),a=Vc({name:e,contentType:o});r.push([i,s,...a]);}else if(zc(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else Bc(t)&&t&&r.push([i,t.toString()]);}n(Kn,"collectParams");function jc(r){let i=[];for(let[t,e]of Object.entries(r))Kn(i,t,e);return i}n(jc,"getFormDataParams");function kr(r){let i=_c(),t=jc(r);for(let e of t){let[o,s,...a]=e;i.append(o,s,...a);}return i}n(kr,"buildFormData");var ct=class r extends Ae{static{n(this,"UploadError");}code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},Kc=n(r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),qt=n((r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Kc(t)),e.toString()},"getUrl"),Gc="6.19.0",qc="UploadcareUploadClient",Wc=Gc;function ke(r){return Xo({libraryName:qc,libraryVersion:Wc,...r})}n(ke,"getUserAgent");var Zc="RequestThrottledError",Bn=15e3,Yc=1e3;function Xc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return Bn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Bn}n(Xc,"getTimeoutFromThrottledRequest");function le(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return $c(({attempt:o,retry:s})=>r().catch(a=>{if("response"in a&&a?.code===Zc&&o<t)return s(Xc(a));if(a instanceof Be&&o<e)return s((o+1)*Yc);throw a}))}n(le,"retryIfFailed");var Gn=n(r=>{let i="";return (xr(r)||Sr(r)||Ar(r))&&(i=r.type),i||Er},"getContentType"),qn=n(r=>{let i="";return Sr(r)&&r.name?i=r.name:xr(r)||jn()?i="":Ar(r)&&r.name&&(i=r.name),i||Hn},"getFileName");function Qo(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}n(Qo,"getStoreValue");function Jo(r){return Array.isArray(r)?r.join(","):typeof r=="string"?r:void 0}n(Jo,"getTagsValue");function Qc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=P.baseURL,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",url:qt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},data:kr({file:{data:r,name:t||qn(r),contentType:e||Gn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Qo(l),signature:s,expire:a,source:p,metadata:w,tags:Jo(T)}),signal:c,onProgress:u}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(Qc,"base");var qo;(function(r){r.Token="token",r.FileInfo="file_info";})(qo||(qo={}));function Jc(r,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Qo(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:w,tags:Jo(T)}),signal:p}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(Jc,"fromUrl");var mt;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(mt||(mt={}));var tu=n(r=>"status"in r&&r.status===mt.Error,"isErrorResponse");function eu(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}={}){return le(()=>ae({method:"GET",headers:i?{"X-UC-User-Agent":ke({publicKey:i,integration:o,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Wt(JSON.parse(c));if("error"in d&&!tu(d))throw new ct(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(eu,"fromUrlStatus");function iu(r,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:c,userAgent:u})},url:qt(t,"/group/",{jsonerrors:1}),data:kr({files:r,callback:e,pub_key:i,signature:o,expire:s,source:l}),signal:a}).then(({data:m,headers:f,request:v})=>{let w=Wt(JSON.parse(m));if("error"in w)throw new ct(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}n(iu,"group");function ru(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:o,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"GET",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:s,userAgent:a})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=Wt(JSON.parse(u));if("error"in m)throw new ct(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(ru,"info");function ou(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=P.multipartChunkSize,baseURL:s="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},data:kr({filename:e||Hn,size:r,content_type:t||Er,part_size:o,UPLOADCARE_STORE:Qo(c),UPLOADCARE_PUB_KEY:i,signature:a,expire:l,source:p,metadata:w,tags:Jo(T)}),signal:u}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x.parts=Object.keys(x.parts).map(et=>x.parts[Number(et)]),x}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}n(ou,"multipartStart");function su(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Er}}).then(l=>(o&&o({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a})}n(su,"multipartUpload");function nu(r,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:o,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:s,userAgent:a})},data:kr({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:u,headers:p,request:d})=>{let m=Wt(JSON.parse(u));if("error"in m)throw new ct(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(nu,"multipartComplete");function Mr(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return zn({check:n(p=>ru(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?(u&&u({isComputable:true,value:1}),d):false),"check"),signal:c})}n(Mr,"isReadyPoll");var au=n((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),lu="0123456789abcdefghijklmnopqrstuvwxyz",cu=n(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=lu[Number(t)]+i,r=r/36n;}return i},"a"),uu=n((r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}},"c$1"),du=n(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),pu=10,hu=n(async r=>{let i=await du(r);return cu(i).slice(0,pu)},"d"),mu=n(async(r,i)=>{let t=await hu(r);return au(t,i)},"f"),fu=n((r,i)=>mu(r,i),"getPrefixedCdnBase"),Wn=n(({publicKey:r,baseCDN:i,prefixedBaseCDN:t=P.prefixedBaseCDN})=>r?i===void 0||uu(i,t)?fu(r,t):Promise.resolve(i):Promise.resolve(i??P.baseCDN),"resolveCdnBase");function gu(r){return "defaultEffects"in r}n(gu,"isGroupFileInfo");var Tr=class{static{n(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;tags;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=P.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,a=qt(t,`${o}/`),l=s?qt(`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=a,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=l,gu(i)&&(this.defaultEffects=i.defaultEffects);}},Ir=n(async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e,fileName:o})=>{let s=await Wn({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Tr(r,{baseCDN:s,fileName:o})},"toUploadcareFile"),vu=n((r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,prefixedBaseCDN:T,metadata:C,tags:A})=>Qc(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:C,tags:A}).then(({file:N})=>Mr(N,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(N=>Ir(N,{publicKey:i,baseCDN:w,prefixedBaseCDN:T})),"uploadDirect"),yu=n((r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d,prefixedBaseCDN:m})=>Mr(r,{publicKey:i,baseURL:e,signal:o,onProgress:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>Ir(f,{publicKey:i,baseCDN:d,prefixedBaseCDN:m,fileName:t})),"uploadFromUploaded"),bu=n((r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=n(a=>()=>{e=a,o.forEach((l,c)=>c!==a&&l.abort());},"createStopRaceCallback");return Cr(i,()=>{o.forEach(a=>a.abort());}),Promise.all(r.map((a,l)=>{let c=s(l);return Promise.resolve().then(()=>a({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(a=>{if(e===null)throw t;return a[e]})},"race"),wu=window.WebSocket,Wo=class{static{n(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Tu=n((r,i)=>r==="success"?{status:mt.Success,...i}:r==="progress"?{status:mt.Progress,...i}:{status:mt.Error,...i},"response"),Zo=class{static{n(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Wo;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 wu(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,Tu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=n(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Ko=null,ts=n(r=>{if(!Ko){let i=typeof window>"u"?0:3e4;Ko=new Zo(r,i);}return Ko},"getPusher"),Cu=n(r=>{ts(r).connect();},"preconnect");function Eu({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return zn({check:n(u=>eu(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case mt.Error:return new ct(p.error,p.errorCode);case mt.Waiting:return false;case mt.Unknown:return new ct(`Token "${r}" was not found.`);case mt.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case mt.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(Eu,"pollStrategy");var xu=n(({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let a=ts(i),l=a.onError(s),c=n(()=>{l(),a.unsubscribe(r);},"destroy");Cr(t,()=>{c(),s(new se("pusher cancelled"));}),a.subscribe(r,u=>{switch(u.status){case mt.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case mt.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),o(u);break}case mt.Error:c(),s(new ct(u.msg,u.error_code));}});}),"pushStrategy"),Su=n((r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,prefixedBaseCDN:s,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:l,secureSignature:c,secureExpire:u,store:p,signal:d,onProgress:m,source:f,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,pusherKey:C=P.pusherKey,metadata:A,tags:N})=>Promise.resolve(Cu(C)).then(()=>Jc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:l,secureSignature:c,secureExpire:u,store:p,signal:d,source:f,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,metadata:A,tags:N})).catch(x=>(ts(C)?.disconnect(),Promise.reject(x))).then(x=>x.type===qo.FileInfo?x:bu([({signal:et})=>Eu({token:x.token,publicKey:i,baseURL:e,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,onProgress:m,signal:et}),({signal:et})=>xu({token:x.token,pusherKey:C,signal:et,onProgress:m})],{signal:d})).then(x=>{if(x instanceof ct)throw x;return x}).then(x=>x.isReady?x:Mr(x.uuid,{publicKey:i,baseURL:e,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,onProgress:m,signal:d})).then(x=>Ir(x,{publicKey:i,baseCDN:o,prefixedBaseCDN:s})),"uploadFromUrl"),Go=new WeakMap,Au=n(async r=>{if(Go.has(r))return Go.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Go.set(r,i),i},"getBlobFromReactNativeAsset"),Zn=n(async r=>{if(Sr(r)||xr(r))return r.size;if(Ar(r))return (await Au(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),ku=n((r,i=P.multipartMinFileSize)=>r>=i,"isMultipart"),Yn=n(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 !ze(r)&&t.test(r)},"isUuid"),es=n(r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !ze(r)&&t.test(r)},"isUrl"),Mu=n((r,i)=>new Promise((t,e)=>{let o=[],s=false,a=i.length,l=[...i],c=n(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(o[u]=d,a-=1,a?c():t(o));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<r;u++)c();}),"runWithConcurrency"),Iu=n((r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},"sliceChunk"),Ou=n(async(r,i,t)=>e=>Iu(r,e,i,t),"prepareChunks"),Lu=n((r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>su(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Pu=n(async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=P.multipartChunkSize,maxConcurrentRequests:C=P.maxConcurrentRequests,baseCDN:A,prefixedBaseCDN:N,metadata:x,tags:et})=>{let ye=e??await Zn(r),Rt,be=n((z,Et)=>{if(!u)return;Rt||(Rt=Array(z).fill(0));let we=n(Mt=>Mt.reduce(($e,Ao)=>$e+Ao,0),"sum");return Mt=>{Mt.isComputable&&(Rt[Et]=Mt.value,u({isComputable:true,value:we(Rt)/z}));}},"createProgressHandler");return w||=Gn(r),ou(ye,{publicKey:i,contentType:w,fileName:t||qn(r),baseURL:o,secureSignature:s,secureExpire:a,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:x,tags:et,multipartChunkSize:T}).then(async({uuid:z,parts:Et})=>{let we=await Ou(r,ye,T);return Promise.all([z,Mu(C,Et.map((Mt,$e)=>()=>Lu(we($e),Mt,{publicKey:i,contentType:w,onProgress:be(Et.length,$e),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([z])=>nu(z,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(z=>z.isReady?z:Mr(z.uuid,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(z=>Ir(z,{publicKey:i,baseCDN:A,prefixedBaseCDN:N}))},"uploadMultipart");async function is(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:A,prefixedBaseCDN:N=P.prefixedBaseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:et,pusherKey:ye,metadata:Rt,tags:be}){if(ze(r)){let z=await Zn(r);return ku(z,w)?Pu(r,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:z,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N,metadata:Rt,tags:be}):vu(r,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N,metadata:Rt,tags:be})}if(es(r))return Su(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,prefixedBaseCDN:N,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:et,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:ye,metadata:Rt,tags:be});if(Yn(r))return yu(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N});throw new TypeError(`File uploading from "${r}" is not supported`)}n(is,"uploadFile");var Uu=n((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},"replaceUrlBase"),Yo=class{static{n(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=P.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Uu(i.cdnUrl,t),this.files=e.map(o=>new Tr(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},Ru=n(async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e})=>{let o=await Wn({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Yo(r,{baseCDN:o})},"toUploadcareGroup"),$u=n(r=>{for(let i of r)if(!ze(i))return false;return true},"isFileDataArray"),Du=n(r=>{for(let i of r)if(!Yn(i))return false;return true},"isUuidArray"),Fu=n(r=>{for(let i of r)if(!es(i))return false;return true},"isUrlArray");function Xn(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=P.multipartChunkSize,baseCDN:T,prefixedBaseCDN:C=P.prefixedBaseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,jsonpCallback:x}){if(!$u(r)&&!Fu(r)&&!Du(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let et,ye=true,Rt=r.length,be=n((z,Et)=>{if(!c)return;et||(et=Array(z).fill(0));let we=n(Mt=>Mt.reduce(($e,Ao)=>$e+Ao)/z,"normalize");return Mt=>{if(!Mt.isComputable||!ye){ye=false,c({isComputable:false});return}et[Et]=Mt.value,c({isComputable:true,value:we(et)});}},"createProgressHandler");return Promise.all(r.map((z,Et)=>ze(z)||es(z)?is(z,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:be(Rt,Et),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:T,prefixedBaseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N}).then(we=>we.uuid):z)).then(z=>iu(z,{publicKey:i,baseURL:e,jsonpCallback:x,secureSignature:o,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(Et=>Ru(Et,{publicKey:i,baseCDN:T,prefixedBaseCDN:C})).then(Et=>(c&&c({isComputable:true,value:1}),Et)))}n(Xn,"uploadFileGroup");var ne=class{static{n(this,"Queue");}ji=1;fo=[];Gi=0;mo=new Map;go=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.fo.shift();if(!e)return;let o=this.mo.get(e),s=this.go.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.mo.delete(e),this.go.delete(e),this.Gi-=1,this.run();}).then(a=>o(a)).catch(a=>s(a));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.mo.set(i,e),this.go.set(i,o),this.fo.push(i),t&&this.run();})}get pending(){return this.fo.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var rs=n(()=>({}),"blockCtx"),os=n(r=>({...rs(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),ss=n(r=>({...os(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ne(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),Qn=n(r=>({...ss(r),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var F=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Vu=new Set([F.START_FROM,F.UPLOAD_LIST]),Or=class extends q{constructor(t){super(t);this.scopes=new Set;this.listener=this.ru.bind(this),window.addEventListener("paste",this.listener);}static{n(this,"ClipboardLayer");}ou(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"]'))}su(t){return t.composedPath().some(e=>this.ou(e))}nu(t){return typeof t=="string"&&Vu.has(t)}au(){return [...this.scopes].some(t=>t.isConnected)}lu(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}cu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}uu(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 ru(t){if(!t.clipboardData||this.su(t)||!this.au())return;let e=this.e.ctx.read("*currentActivity"),o=e===null,s=this.nu(e);switch(this.ie.pasteScope){case "global":if(!s&&!(o&&this.lu()))return;await this.handlePaste(t);return;case "local":{let a=t.target instanceof Node?t.target:null;if(!this.cu(a)||!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(l=>l.kind==="file").map(l=>l.getAsFile()).filter(l=>l!==null),s=e.filter(l=>l.kind==="string"&&(l.type==="text/plain"||l.type==="text/uri-list")).map(l=>new Promise(c=>{l.getAsString(u=>{c(this.uu(u));});})),a=false;if(o.length>0&&(o.forEach(l=>{this.e.api.addFileFromObject(l,{source:"clipboard"});}),a=true),s.length>0){let l=(await Promise.all(s)).filter(c=>c!==null);l.forEach(c=>{this.e.api.addFileFromUrl(c,{source:"clipboard"});}),a||=l.length>0;}a&&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 Lr=class extends q{constructor(){super(...arguments);this.qi=[];}static{n(this,"RouterHooksLayer");}registerAfterFileAddHook(t){return this.qi.push(t),()=>{this.qi=this.qi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.qi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",F.UPLOAD_LIST),this.e.modalManager?.open(F.UPLOAD_LIST));}};var Nu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function wi(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}n(wi,"focus");function ns(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Nu[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}n(ns,"findGroupNodeByEventTarget");function as(r,i){return i.role==="toolbar"?Bu(i):i.querySelectorAll(`[role=${r.role}]`)}n(as,"getItems");function _u(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})}n(_u,"filterNested");function Bu(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}n(Bu,"getToolbarItems");function zu(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"}n(zu,"isHorizontalOrientation");function Jn(r){return i=>{let t=false,e=r?.searchDelayMs||300,o=0,s="";function a(d){let m=ns(d.target);if(!m){l();return}let f=as(d.target,m),v=_u(f,m),w=Array.from(v).indexOf(d.target),T="ArrowDown",C="ArrowUp";if(zu(m)&&(i.document.dir==="rtl"?(T="ArrowLeft",C="ArrowRight"):(T="ArrowRight",C="ArrowLeft")),d.key===T)d.preventDefault(),wi(d.target,v[w+1]||v[0]);else if(d.key===C)d.preventDefault(),wi(d.target,v[w-1]||v[v.length-1]);else if(d.key==="Home")d.preventDefault(),wi(d.target,v[0]);else if(d.key==="End")d.preventDefault(),wi(d.target,v[v.length-1]);else if(d.key.length===1&&m.role!=="tablist"){d.timeStamp-o<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),o=d.timeStamp;let A=Array.from(f).find(N=>N.textContent?.trim()?.toLowerCase()?.startsWith(s));A&&(d.preventDefault(),wi(d.target,A));}}n(a,"keyDown");function l(){t=false,i.removeEventListener("keydown",a);}n(l,"stop");function c(d){let m=ns(d.target);if(m){t||(t=true,i.addEventListener("keydown",a));let f=as(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}n(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}n(u,"focusOut");function p(d){let m=ns(d.target);if(m){let f=as(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return n(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}n(Jn,"focusGroupKeyUX");function ta(){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 a=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0);}}n(e,"jump");function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return n(o,"focusOut"),r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}n(ta,"hiddenKeyUX");function ea(){return r=>{let i=[];function t(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}n(t,"focus");function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}n(e,"back");let o=0,s;function a(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let p=r.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&e();}return n(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l);}}}n(ea,"jumpKeyUX");function ia(r){let i,t=r.split(" "),e;function o(l){(l.key==="Enter"||l.key===" ")&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}n(o,"keyDown");function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}n(s,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(s(),e!==l.target&&(l.target.classList.add(...t),i=l.target));}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",o),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",o),l.removeEventListener("keyup",s);})}n(ia,"pressKeyUX");function ra(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}n(ra,"startKeyUX");var ls=class{constructor(){this.gt=new Map;this.vo=[];}static{n(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=n(o=>{let s=o.target;s instanceof Node&&this.vo.some(a=>a===s||a.contains(s))&&t(o);},"wrappedListener");this.gt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.gt.get(t);e&&window.removeEventListener(i,e),this.gt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.vo.push(i);}destroy(){this.vo=[];for(let i of this.gt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.gt.clear();}},Pr=class{static{n(this,"A11y");}constructor(){this.Wi=new ls,this.An=ra(this.Wi,[Jn(),ia("is-pressed"),ea(),ta()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.An?.(),this.Wi.destroy();}};var Zt=n(r=>`*l10n/${r}`,"localeStateKey"),Hu="en",Ur=class extends q{constructor(t){super(t);this.Se="";for(let[o,s]of Object.entries(vi)){let a=this.i.has(Zt(o))?!this.i.read(Zt(o)):true;this.i.add(Zt(o),s,a);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Se&&this.kn(this.Se);})),this.addSub(this.i.sub(S("localeName"),async o=>{if(!o)return;this.Se=o;let s=await Mn(o);o!==Hu&&this.Se!==o||(this.kn(o),this.Mn(o,s));})),this.addSub(this.i.sub(S("localeDefinitionOverride"),o=>{if(!o)return;let s=o[this.Se];s&&this.Mn(this.Se,s);}));}static{n(this,"LocaleManager");}Mn(t,e){let o=this.ie.localeDefinitionOverride?.[t];for(let[s,a]of Object.entries(e)){let l=o?.[s];this.i.add(Zt(s),l??a,true);}}kn(t){let e=this.e.pluginManager;if(!e)return;let o=e.snapshot();for(let s of o.l10n){let{pluginId:a,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.i.add(Zt(u),p,true);}}};var ju=n(()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),Ku=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),Gu=n(()=>({safariDesktop:ju()}),"calcBrowserInfo"),qu=n(()=>({htmlMediaCapture:Ku()}),"calcBrowserFeatures"),oa=Gu(),sa=qu();var Ti="image/*",cs="video/*",Wu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Zu=n(()=>oa.safariDesktop?[Ti]:[Ti,...Wu],"calcImageAcceptList"),Ci=Zu(),Rr=n(r=>r?r.filter(i=>typeof i=="string").flatMap(i=>J(i)):[],"mergeFileTypes"),us=n((r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),"matchMimeType"),na=n((r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),He=n(r=>{let i=r?.type;return i?us(i,Ci):false},"fileIsImage");function aa(r,i,t,e,o){return {registry:{registerSource:n(u=>r.addSource(e,u),"registerSource"),registerActivity:n(u=>r.addActivity(e,u),"registerActivity"),registerFileAction:n(u=>r.addFileAction(e,u),"registerFileAction"),registerFileHook:n(u=>r.addFileHook(e,u),"registerFileHook"),registerIcon:n(u=>r.addIcon(e,u),"registerIcon"),registerL10n:n(u=>r.addL10n(e,u),"registerL10n"),registerConfig:n(u=>{r.addConfig(e,u);let p=S(u.name);i.has(p)||i.add(p,u.defaultValue);},"registerConfig")},config:{get:n(u=>{let p=S(u);return i.read(p)},"get"),subscribe:n((u,p)=>{let d=S(u),m=i.sub(d,f=>{p(f);});return o.push(m),m},"subscribe")},activity:{getParams:n(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:n(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return o.push(p),p},"subscribeToParams")},files:{update:n((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}n(aa,"buildPluginApi");var Yu=n(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),"resolveLazyPlugins"),$r=class{constructor(i,t){this.i=i;this.pu=t;this.ii=new Set;this.In=this.i.sub("*lazyPlugins",e=>{this.du(e??[]);});}static{n(this,"LazyPluginLoader");}du(i){for(let o of this.ii)o();if(this.ii.clear(),i.length===0)return;let t=new Set([S("plugins")]);for(let o of i)for(let s of o.configDeps)t.add(S(s));let e=n(()=>this.On(i),"recompute");for(let o of t)this.ii.add(this.i.sub(o,e,false));this.On(i);}On(i){this.yo?.abort();let t=new AbortController;this.yo=t;let e=n(a=>this.i.read(S(a)),"get"),o=e("plugins"),s=Yu({entries:i.map(a=>({isEnabled:n(()=>a.isEnabled(e),"isEnabled"),load:a.load})),signal:t.signal}).then(a=>{if(!t.signal.aborted)return [...o,...a]});this.pu(s);}destroy(){this.In();for(let i of this.ii)i();this.ii.clear(),this.yo?.abort();}};var Dr=class{constructor(){this.oe=new Map;}static{n(this,"CustomConfigRegistry");}register(i,t){if(this.oe.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.oe.set(t.name,e);}unregister(i){this.oe.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.oe)e.pluginId===i&&this.oe.delete(t);}get(i){return this.oe.get(i)}getAll(){return new Map(this.oe)}};var Fr=class{constructor(i=()=>{}){this.b=[];this.St=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Ae=[];this.config=new Dr;this.Lt=V(i,0);}static{n(this,"PluginRegistry");}destroy(){this.Lt.cancel();}ke(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.b.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.b.push(this.ke(i,t)),this.Lt();}addActivity(i,t){let e=this.St.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.St.push(this.ke(i,t)),this.Lt();}addFileAction(i,t){this.Zi.push(this.ke(i,t)),this.Lt();}addFileHook(i,t){this.Yi.push(this.ke(i,{timeout:3e4,...t})),this.Lt();}addIcon(i,t){this.Xi.push(this.ke(i,t)),this.Lt();}addL10n(i,t){this.Ae.push(this.ke(i,t)),this.Lt();}addConfig(i,t){this.config.register(i,t),this.Lt();}purge(i){this.b=this.b.filter(t=>t.pluginId!==i),this.St=this.St.filter(t=>t.pluginId!==i),this.Zi=this.Zi.filter(t=>t.pluginId!==i),this.Yi=this.Yi.filter(t=>t.pluginId!==i),this.Xi=this.Xi.filter(t=>t.pluginId!==i),this.Ae=this.Ae.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.b],activities:[...this.St],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Ae]}}};var Vr=class extends q{constructor(t){super(t);this.se=new Map;this.c=new Set;this.bo=Promise.resolve();this.registry=new Fr(()=>this.Qi());this.Pn=new $r(this.i,e=>{this.bo=this.bo.then(()=>e).then(o=>{if(o)return this.hu(o)});});}static{n(this,"PluginManager");}get configRegistry(){return this.registry.config}pluginsReady(){return this.bo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async hu(t){let e=new Set(this.se.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.se.has(s.id))try{await this.fu(s);}catch(a){this.registry.purge(s.id),this.Qi(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,a);}e.delete(s.id);}for(let s of e)this.wo(s);}async fu(t){this.se.has(t.id)&&this.wo(t.id);let e=[],o=aa(this.registry,this.i,this.e,t.id,e),s=this.e.api,a;try{a=await t.setup({pluginApi:o,uploaderApi:s})??void 0;}catch(l){for(let c of e)try{c();}catch(u){this.E("Failed to unsubscribe config listener",u);}throw l}this.se.set(t.id,{plugin:t,dispose:a,configSubscriptions:e}),this.Qi();}wo(t){let e=this.se.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.se.delete(t),this.Qi();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let o=this.registry.snapshot().fileHooks.filter(l=>l.type==="onAdd");if(o.length===0)return;let s=e,a=new AbortController;for(let l of o){if(a.signal.aborted)break;try{let c=l.handler({file:s,signal:a.signal}),u=new Promise((p,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),l.timeout));({file:s}=await Promise.race([c,u]));}catch(c){console.warn(`File hook "onAdd" from plugin "${l.pluginId}" failed`,c);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",He(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.se.keys()))this.wo(t);this.registry.destroy(),this.Pn.destroy(),super.destroy();}Qi(){for(let t of this.c)try{t();}catch{}}};function Xu(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}n(Xu,"i");function ps(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?ps(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=Xu(i);return typeof t=="object"&&t!==null?[e,ps(t)]:[e,t]}))}n(ps,"c");function Qu(r){return {ok:true,value:r}}n(Qu,"u");function ds(r){return {ok:false,error:r}}n(ds,"a");var Ju="https://tlm.uploadcare.com/api/",hs=class{static{n(this,"y");}constructor(i=Ju){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return ds(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return Qu(s)}catch(s){return ds(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return ds(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(ps(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},td=n(async(r,i)=>({success:true,data:i}),"p"),ed=n(async r=>td(void 0,r),"f"),Nr=class extends hs{static{n(this,"h");}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 id=20,_=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),k=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),_r=class extends q{constructor(){super(...arguments);this.ri=new Map;this.Ji=new Set;this.gt=new Map;}static{n(this,"EventEmitter");}bindTarget(t){return this.Ji.add(t),()=>{this.Ji.delete(t);}}on(t,e){let o=this.gt.get(t);return o||(o=new Set,this.gt.set(t,o)),o.add(e),()=>this.gt.get(t)?.delete(e)}Ln(t,e){for(let s of this.Ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let o=this.gt.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.Ln(t,typeof e=="function"?e():e);return}this.ri.has(t)&&window.clearTimeout(this.ri.get(t));let a=typeof s=="number"?s:id,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.Ln(t,c),this.ri.delete(t);}catch(c){this.E?.(()=>`Error while getting payload for event "${t}"`,c);}},a);this.ri.set(t,l);}destroy(){for(let t of this.ri.values())window.clearTimeout(t);this.Ji.clear(),this.gt.clear();}};var la="1.33.1-alpha.0";var $t="blocks",Dt=la;var Br=class extends q{constructor(t){super(t);this.mu=nt.generateRandomUUID();this.Me=structuredClone(it);this.xo=false;this.To=null;this.zt=false;this.Rn=new Nr,this.Ie=new ne(10),this.addSub(this.i.sub(S("qualityInsights"),e=>{this.zt=!!e;}));for(let e of Object.keys(this.Me))this.addSub(this.i.sub(S(e),o=>{this.zt&&(this.xo&&this.Me[e]!==o&&this.sendEvent({eventType:_.CHANGE_CONFIG}),this.gu(e,o));}));}static{n(this,"TelemetryManager");}vu(t){t===_.INIT_SOLUTION&&!this.xo&&(this.xo=true);}gu(t,e){this.Me[t]!==e&&(this.Me[t]=e);}yu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===_.INIT_SOLUTION||t.eventType===_.CHANGE_CONFIG)&&(o.config=this.Me),{...o,appVersion:Dt,appName:$t,sessionId:this.mu,component:this.bu,activity:this.wu,projectPubkey:this.Me.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.xu,payload:{location:this.Tu,...e}}}Eu(t){return !!(t&&[k.CHANGE,k.COMMON_UPLOAD_PROGRESS,k.FILE_ADDED,k.FILE_REMOVED,k.FILE_UPLOAD_START,k.FILE_UPLOAD_PROGRESS,k.FILE_UPLOAD_SUCCESS,k.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.zt)return;let e=this.yu({eventType:t.eventType,payload:t.payload,config:t.config});this.vu(t.eventType),!(this.Eu(t.eventType)||this.To&&this.Un(this.To,e))&&this.Ie.add(async()=>{this.To=e,await this.Rn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:_.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Un(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 a of o)if(!Object.hasOwn(e,a)||!this.Un(t[a],e[a]))return false;return true}get xu(){return Date.now()}get bu(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get wu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get Tu(){return location.origin}};var ca=n(r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var od=n(r=>r,"DEFAULT_TRANSFORMER"),ms="{{",da="}}",ua="plural:";function je(r,i={},t={}){let{openToken:e=ms,closeToken:o=da,transform:s=od}=t;for(let a in i){let l=i[a],c=l?.toString(),u=typeof c=="string"?s(c):String(c);r=r.replaceAll(e+a+o,u);}return r}n(je,"applyTemplateData");function pa(r){let i=[],t=r.indexOf(ms);for(;t!==-1;){let e=r.indexOf(da,t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(ua)){let s=r.substring(t+2,e).replace(ua,""),a=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:a,countVariable:l});}t=r.indexOf(ms,e);}return i}n(pa,"getPluralObjects");var ha="--uploadcare-blocks-window-height",Ei=class r{static{n(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=V(()=>{document.documentElement.style.setProperty(ha,`${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(ha);}};var zr=n((r,i)=>new Intl.PluralRules(r).select(i),"getPluralForm");var sd=n(r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=zr(o,t);return e(`${i}__${s}`)},"createPluralizer"),Hr=n(r=>{let i=sd(()=>t),t=n((e,o={})=>{if(!e)return "";let a=r().read(Zt(e))||e,l=pa(a);for(let u of l)o[u.variable]=i(u.pluralKey,Number(o[u.countVariable]));return je(a,o)},"l10n");return t},"createL10n");var nd=n(r=>r.tagName?.includes("-")??false,"isCustomElement"),jr=class{constructor(i){this.ne=new Set;this.tr=new Map;this.$n=false;this.ae=i,this.ae.addController(this);}static{n(this,"TestModeController");}hostDisconnected(){this.er?.(),this.er=void 0,this.ne.clear(),this.tr.clear();}hostUpdated(){if(!this.er&&this.ae.has(S("testMode"))){let i=this.ae.subConfigValue("testMode",t=>{this.$n=!!t,this.Dn();});this.er=i;}this.Cu(),this.Dn();}Cu(){let i=this.ae,t=i.renderRoot??i;if(!t)return;let e=this.ae,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(a=>!nd(a));for(let a of s)if(!(o&&a.closest(o)!==e)&&!this.ne.has(a)){let l=a.getAttribute("data-testid");if(!l)continue;this.ne.add(a),this.tr.set(a,l);}for(let a of Array.from(this.ne))(!a.isConnected||o&&a.closest(o)!==e)&&(this.ne.delete(a),this.tr.delete(a));}Dn(){if(!this.ne.size)return;let i=this.ae.testId||"";for(let t of this.ne){let e=this.tr.get(t);e&&(this.$n?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var ad=Ve(hr()(Fe(ur(xt)))),E=class extends ad{constructor(){super();this.init$=rs();this.l10n=Hr(()=>this.sharedCtx);this.debugPrint=yr(()=>this.sharedCtx,this.constructor.name);this.e=Vn(()=>this.sharedCtx);new jr(this);}static{n(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);let a=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:a??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Vr(t)),this.Y("*eventEmitter",t=>new _r(t)),this.Y("*localeManager",t=>new Ur(t)),this.Y("*modalManager",t=>new br(t)),this.Y("*a11y",()=>new Pr),this.Y("*routerLayer",t=>new Lr(t)),this.Y("*clipboard",t=>new Or(t)),this.Y("*telemetryManager",t=>new Br(t)),this.sub(Zt("locale-id"),t=>{let e=ca(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.Q("*modalManager",false)}get telemetryManager(){return this.Q("*telemetryManager")}get localeManager(){return this.Q("*localeManager")}get a11y(){return this.Q("*a11y")}get clipboardLayer(){return this.Q("*clipboard")}get routerLayer(){return this.Q("*routerLayer")}get blocksRegistry(){return this.Q("*blocksRegistry")}get eventEmitter(){return this.Q("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Su(),G.deleteCtx(this.ctxName);}Fn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Y(t,e){let o=this.Fn();if(!o.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),o.set(t,s);return}}Su(){let t=this.Fn();for(let[e,o]of t.entries())o?.destroy?.(),this.pub(e,null);t.clear();}Q(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:gr(t),cdnUrlModifiers:zo(t),fileName:fr(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?je(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:n(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.ee){let t={};this.ee=new Proxy(t,{set:n((e,o,s)=>{if(typeof o!="string"||!(o in it))return false;let a=o,l=S(a);return this.has(l)||this.add(l,it[a]),this.$[l]=s,true},"set"),get:n((e,o)=>{let s=S(o);return this.has(s)||this.add(s,it[o]),this.$[s]},"get")});}return this.ee}subConfigValue(t,e){let o=S(t);return this.has(o)||this.add(o,it[t]),this.sub(o,e)}};var Ft={ATTRIBUTE:1,CHILD:2},ut=n(r=>(...i)=>({ro:r,values:i}),"e"),ft=class{static{n(this,"i");}constructor(i){}get X(){return this.m.X}oo(i,t,e){this.ir=i,this.m=t,this.Au=e;}Zc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Me=class extends ft{static{n(this,"e");}constructor(i){if(super(i),this.it=$,i.type!==Ft.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===$||i==null)return this.Nn=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.Nn;this.it=i;let t=[i];return t.raw=t,this.Nn={Vt:this.constructor.resultType,strings:t,values:[]}}};Me.directiveName="unsafeHTML",Me.resultType=1;ut(Me);var xi=class extends Me{static{n(this,"t");}};xi.directiveName="unsafeSVG",xi.resultType=2;var Ke=ut(xi);var ma="<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 Yt=class extends E{constructor(){super(...arguments);this.init$=Qn(this);}static{n(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return y`${Ke(ma)}`}};var fa=n(r=>typeof r!="number"?0:Math.floor(r/1e3),"msToUnixTimestamp"),ga=n((r,{threshold:i})=>{let{secureExpire:t}=r,e=fa(Date.now()),o=Number(t),s=fa(i);return e+s>=o},"isSecureTokenExpired");var Kr=class extends q{constructor(){super(...arguments);this.le=null;}static{n(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.ie;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.le||ga(this.le,{threshold:s})){this.le?this.E("Secure signature is expired. Resolving a new one..."):this.E("Secure signature is not set yet.");try{let a=await o();a?!a.secureSignature||!a.secureExpire?console.error("Secure signature resolver returned an invalid result:",a):(this.E("Secure signature resolved:",a),this.E("Secure signature will expire in",new Date(Number(a.secureExpire)*1e3).toISOString()),this.le=a):(this.E("Secure signature resolver returned nothing."),this.le=null);}catch(a){console.error("Secure signature resolving failed. Falling back to the previous one.",a),this.e.telemetryManager.sendEventError(a,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.le}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.le=null;}};var fs=n((r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var gs=n((r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}},"validateMultiple");var vs=n((r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=Rr([...t?Ci:[],e]);if(!o.length)return;let s=r.mimeType,a=r.name;if(!s||!a)return;let l=us(s,o),c=na(a,o);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var ys=n((r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var Vt=1e3,Ie=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Si=n(r=>Math.ceil(r*100)/100,"round"),va=n((r,i=Ie.AUTO)=>{let t=i===Ie.AUTO;if(i===Ie.BYTE||t&&r<Vt**1){let o=zr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===Ie.KB||t&&r<Vt**2?`${Si(r/Vt**1)} KB`:i===Ie.MB||t&&r<Vt**3?`${Si(r/Vt**2)} MB`:i===Ie.GB||t&&r<Vt**4?`${Si(r/Vt**3)} GB`:i===Ie.TB||t&&r<Vt**5?`${Si(r/Vt**4)} TB`:`${Si(r/Vt**5)} PB`},"prettyBytes");var bs=n((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:va(t)}),payload:{entry:r}}},"validateMaxSizeLimit");var ws=n((r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof ct)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Be)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}},"validateUploadError");var Ge={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."},ld=n(r=>typeof r=="function"?{runOn:"change",validator:r}:r,"getValidatorDescriptor"),Gr=class extends q{constructor(t){super(t);this.ku=[ys,vs,bs,ws];this.Mu=[gs,fs];this.Ie=new ne(20);this.Vn=V(()=>{this.Ie.run();},500);this.Ht=false;this.Oe=new Map;let e=V(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(S("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(S("multipleMin"),e)),this.addSub(this.i.sub(S("multipleMax"),e)),this.addSub(this.i.sub(S("multiple"),e)),this.addSub(this.i.sub(S("imgOnly"),e)),this.addSub(this.i.sub(S("accept"),e)),this.addSub(this.i.sub(S("validationConcurrency"),o=>{this.Ie.concurrency=o;}));}static{n(this,"ValidationManager");}get f(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Ht)return;let o=e??this.f.items();for(let s of o){let a=this.f.read(s);a&&this.Iu(a,t);}}runCollectionValidators(){if(this.Ht)return;let t=this.e.api,e=t.getOutputCollectionState(),o=[],s=this.ie.collectionValidators;for(let a of [...this.Mu,...s])try{let l=a(e,t);if(!l)continue;l&&(o.push(this._n(l)),l.message||console.warn(Ge.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ge.COLLECTION_VALIDATION_FAILED,l);}this.i.pub("*collectionErrors",o),o.length>0&&this.e.eventEmitter.emit(k.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Oe.get(t.uid);e&&(e.abortController?.abort(),this.Oe.delete(t.uid));}async Iu(t,e){if(this.Ht)return;let o=this.e.api,s=this.Bn(t),a=s.promise??Promise.resolve(),l=(async()=>{if(this.Ht||(await a,this.Ht))return;let c=this.Ou(t,e);if(c.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=o.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.ie.validationTimeout,m=this.zn(),f=new Set(c.map(T=>T.validator)),v=[];for(let T of m)if(!f.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Ht)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ge.FILE_VALIDATION_TIMEOUT);},d);try{let A=await T.validator(u,o,{signal:p.signal});if(!A||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let N=this._n(A);s.lastErrorThrownByValidator.set(T.validator,N),v.push(N),A.message||console.warn(Ge.MISSING_ERROR_MESSAGE);}catch(A){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ge.FILE_VALIDATION_FAILED,A),this.e.telemetryManager.sendEventError(A,`file validator. ${Ge.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.Vn(),await this.Ie.add(async()=>{this.Ht||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}_n(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Bn(t){let e=this.Oe.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Oe.set(t.uid,o),o}zn(){let t=this.ie.fileValidators;return [...this.ku,...t].map(ld)}Ou(t,e){let o=this.Bn(t);return this.zn().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Ht=true,this.Vn.cancel();for(let t of this.Oe.values())t.abortController?.abort(),t.promise=void 0;this.Oe.clear();}};var ya="[Typed State] Wrong property name: ",qr=class{static{n(this,"TypedData");}constructor(i){this.pt=nt.generateFastUid(),this.J=G.registerCtx(i,this.pt);}get uid(){return this.pt}setValue(i,t){if(!this.J.has(i)){console.warn(`${ya}${String(i)}`);return}this.J.read(i)!==t&&this.J.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.J.has(i)||console.warn(`${ya}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){G.deleteCtx(this.pt);}};var Wr=class r{constructor(i){this.Kt=Object.create(null);this.rr=new Set;this.or=new Set;this.tt=new Set;this.Eo=new Set;this.Co=new Set;this.Pe=new Set;this.jn=i.initialValue,this.pt=nt.generateFastUid(),this.J=G.registerCtx({},this.pt),this.Hn=i.watchList||[];let t=Object.create(null);this.Kn=(e,o)=>{this.oi&&window.clearTimeout(this.oi),t[e]||(t[e]=new Set),t[e].add(o),this.oi=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.rr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Gn();},i.handler&&this.observeCollection(i.handler);}static{n(this,"TypedCollection");}static{this.Pu=1e4;}Z(){this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.Eo);this.Co.clear(),this.Eo.clear();for(let e of this.or)e?.([...this.tt],i,t);this.Gn();});}Gn(){this.Pe.size!==0&&(this.ni&&window.clearTimeout(this.ni),this.ni=window.setTimeout(()=>{let i=[...this.Pe];this.Pe.clear();for(let t of i)t.destroy();},r.Pu));}observeCollection(i){return this.or.add(i),this.tt.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.or.delete(i);}add(i,t={}){let e=new qr(this.jn);for(let[o,s]of Object.entries(i))e.setValue(o,s);if(t.index===void 0)this.tt.add(e.uid);else {let o=[...this.tt],s=Math.min(Math.max(Math.trunc(t.index)||0,0),o.length);o.splice(s,0,e.uid),this.tt=new Set(o);}return this.Z(),this.J.add(e.uid,e),this.Co.add(e),this.Hn.forEach(o=>{this.Kt[e.uid]||(this.Kt[e.uid]=[]),this.Kt[e.uid]?.push(e.subscribe(o,()=>{this.Kn(o,e.uid);}));}),e.uid}hasItem(i){return this.tt.has(i)}read(i){return this.J.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let 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.Eo.add(t),this.Pe.add(t)),this.tt.delete(i),this.Z(),this.J.pub(i,void 0),this.Kt[i]?.forEach(e=>{e();}),delete this.Kt[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.tt.forEach(i=>{this.abort(i);});}clearAll(){this.tt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.rr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.rr.delete(i);}findItems(i){let t=[];return this.tt.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.tt]}get size(){return this.tt.size}destroy(){this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si),this.ni&&window.clearTimeout(this.ni);for(let i of this.Pe)i.destroy();this.Pe.clear(),G.deleteCtx(this.pt),this.rr=new Set,this.or=new Set;for(let i of Object.keys(this.Kt))this.Kt[i]?.forEach(t=>{t();}),delete this.Kt[i];}};var U=Object.freeze({PHOTO:"photo",VIDEO:"video"}),At=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ba=n(r=>({isVideoRecordingEnabled:Z(r.cameraModes).includes(U.VIDEO),isPhotoEnabled:Z(r.cameraModes).includes(U.PHOTO)}),"calcCameraModes");var wa=n((r,i)=>{for(let t of r)if(i(t))return t},"findBlockInCtx");var Ts=n((r,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(o=>{let s,a=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=n(()=>{for(let c of r)if(i(c)){clearTimeout(a),o(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function Zr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}n(Zr,"applyStyles");var cd=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ud=new RegExp(`^/?(${cd.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Ta=n(({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(bi),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=ud.exec(o.pathname);if(!s)return null;let[,a,l,c]=s;return a?{uuid:a,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var gt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),dd=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",...dd,...gt}),pd={[gt.DROPBOX_CHOOSER]:gt.DROPBOX},Ca=n(r=>pd[r]??r,"canonicalSourceName");var Yr=n(r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e)),"getOutputData");function Ea(r){let i=new Map;return n((...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s},"memoized")}n(Ea,"memoize");var xa=new Set;function Xr(r){xa.has(r)||(xa.add(r),console.warn(r));}n(Xr,"warnOnce");function hd(r){let i=false;return setTimeout(()=>{i=true;},0),n(e=>((...o)=>(i&&Xr(r),e(...o))),"withAssert")}n(hd,"createAsyncAssertWrapper");function Sa(r){let i={},t=r.ctx,e={progress:n(()=>t.read("*commonProgress"),"progress"),errors:n(()=>t.read("*collectionErrors"),"errors"),group:n(()=>t.read("*groupInfo"),"group"),totalCount:n(()=>r.uploadCollection.size,"totalCount"),failedCount:n(()=>i.failedEntries.length,"failedCount"),successCount:n(()=>i.successEntries.length,"successCount"),uploadingCount:n(()=>i.uploadingEntries.length,"uploadingCount"),status:n(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:n(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:n(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:n(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:n(()=>Yr(r),"allEntries"),successEntries:n(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:n(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:n(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},o=hd("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,a]of Object.entries(e)){let l=s,u=Ea(o(a));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}n(Sa,"buildOutputCollectionState");var Aa={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 Cs(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}}n(Cs,"uploadcareFileToEntryData");var Qr=class extends q{constructor(){super(...arguments);this.Ae=Hr(()=>this.i);this.addFileFromUrl=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUrl");this.addFileFromUuid=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUuid");this.addFileFromCdnUrl=n((t,{silent:e,fileName:o,source:s}={})=>{let a=Ta({url:t,cdnBase:this.cfg.cdnCname});if(!a)throw new Error("Invalid CDN URL");let l=this.f.add({uuid:a.uuid,cdnUrl:t,cdnUrlModifiers:a.cdnUrlModifiers,fileName:o??a.filename??null,silent:e??false,source:s??R.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=n((t,{silent:e,fileName:o,source:s,fullPath:a}={})=>{let l=this.f.add({file:t,isImage:He(t),mimeType:t.type||null,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??R.API,fullPath:a??null});return this.getOutputItem(l)},"addFileFromObject");this.addFileFromUploadcareFile=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({...Cs(t),fileName:o??t.originalFilename??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUploadcareFile");this.replaceFile=n((t,e,{silent:o,fileName:s,source:a}={})=>{let l=t,c=this.f,u=c.items().indexOf(l),p=c.read(l);if(u===-1||!p)throw new Error(`File with internalId ${t} not found`);let d={source:p.getValue("source"),metadata:p.getValue("metadata"),fullPath:p.getValue("fullPath"),silent:p.getValue("silent")};c.remove(l);let m=c.add({...Cs(e),fileName:s??e.originalFilename??null,silent:o??d.silent,source:a??d.source??R.API,metadata:d.metadata,fullPath:d.fullPath},{index:u});return this.getOutputItem(m)},"replaceFile");this.removeFileByInternalId=n(t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);},"removeFileByInternalId");this.uploadAll=n(()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.i.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(k.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=n((t={})=>{let e=jt(Rr([this.cfg.accept??"",...this.cfg.imgOnly?Ci:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),Zr(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:a,isVideoRecordingEnabled:l}=ba(this.cfg);t.modeCamera===U.PHOTO&&a?s.accept=Ti:t.modeCamera===U.VIDEO&&l?s.accept=cs:s.accept=[Ti,l&&cs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(a=>{this.addFileFromObject(a,{source:t.captureCamera?R.CAMERA:R.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(a=>{a.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=n((t=false)=>{if(this.f.size>0&&!t)this.i.pub("*currentActivity",F.UPLOAD_LIST),this.e.modalManager?.open(F.UPLOAD_LIST);else if(this.qn?.length===1){let e=this.qn[0];this.So().then(()=>{let o=this.e.pluginManager.snapshot().sources,s=o.find(a=>a.id===e);if(s){let a=s.expand?.()??[e];a.length===1?(o.find(c=>c.id===a[0])??s).onSelect():(this.i.pub("*currentActivity",F.START_FROM),this.e.modalManager?.open(F.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",F.START_FROM),this.e.modalManager?.open(F.START_FROM);},"initFlow");this.doneFlow=n(()=>{let t=wa(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.i.pub("*currentActivity",t.doneActivity),this.i.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.i.read("*currentActivity")||this.e.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=n((t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),Ts(this.e.blocksRegistry,o=>o.activityType===t,{onTimeout:n(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=n((t,e)=>this.e.eventEmitter.on(t,e),"on");this.getCurrentActivity=n(()=>this.i.read("*currentActivity"),"getCurrentActivity");this.historyBack=n(()=>{this.i.read("*historyBack")?.();},"historyBack");this.setModalState=n(t=>{this.So().then(()=>{if(!t){this.e.modalManager?.close(this.i.read("*currentActivity")),this.i.pub("*currentActivity",null);return}let e=this.i.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return Ts(this.e.blocksRegistry,o=>o.activityType===e,{onTimeout:n(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.e.modalManager?.open(e);})});},"setModalState");}static{n(this,"UploaderPublicApi");}get f(){return this.e.uploadCollection}get cfg(){return this.ie}get l10n(){return this.Ae}removeAllFiles(){this.f.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,a=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:a==="success",isUploading:a==="uploading",isFailed:a==="failed",isRemoved:a==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:a,source:o?.source}}getOutputCollectionState(){return Sa(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get qn(){let t=[];return this.cfg.sourceList&&(t=J(this.cfg.sourceList)),t}};var Ai=33.333333333333336,M=1,Es=24,ka=6;function ce(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}n(ce,"setSvgNodeAttrs");function wt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return ce(t,i),t}n(wt,"createSvgNode");function Ma(r,i,t){let{x:e,y:o,width:s,height:a}=r,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,o+c*a+1.5*p-24*t*p],m=[e+l*s+1.5*u,o+c*a+1.5*p],f=[e+l*s-24*t*u+1.5*u,o+c*a+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}n(Ma,"cornerPath");function Ia(r,i,t){let{x:e,y:o,width:s,height:a}=r,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,o+p*a+1.5*m],v=[e+u*s+34*t/2,o+p*a+1.5*m]):(f=[e+u*s+1.5*d,o+p*a-34*t/2],v=[e+u*s+1.5*d,o+p*a+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,T=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:T}}n(Ia,"sidePath");function Oa(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}n(Oa,"thumbCursor");function La({rect:r,delta:[i,t],imageBox:e}){return We({...r,x:r.x+i,y:r.y+t},e)}n(La,"moveRect");function We(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}}n(We,"constraintRect");function md({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:a,height:l}=r;s+=o,l-=o,t&&(a=l*t);let c=r.x+r.width/2-a/2;return s<=e.y&&(s=e.y,l=r.y+r.height-s,t&&(a=l*t,c=r.x+r.width/2-a/2)),c<=e.x&&(c=e.x,s=r.y+r.height-l),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=r.y+r.height-l),l<M&&(l=M,t&&(a=l*t,c=r.x+r.width/2-a/2),s=r.y+r.height-l),a<M&&(a=M,t&&(l=a/t,c=r.x+r.width/2-a/2),s=r.y+r.height-l),{x:c,y:s,width:a,height:l}}n(md,"resizeNorth");function fd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:a,height:l}=r;s+=o,a-=o,t&&(l=a/t);let c=r.y+r.height/2-l/2;return s<=e.x&&(s=e.x,a=r.x+r.width-s,t&&(l=a/t,c=r.y+r.height/2-l/2)),c<=e.y&&(c=e.y,s=r.x+r.width-a),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=r.x+r.width-a),l<M&&(l=M,t&&(a=l*t),c=r.y+r.height/2-l/2,s=r.x+r.width-a),a<M&&(a=M,t&&(l=a/t),c=r.y+r.height/2-l/2,s=r.x+r.width-a),{x:s,y:c,width:a,height:l}}n(fd,"resizeWest");function gd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:a,height:l}=r;l+=o,t&&(a=l*t);let c=r.x+r.width/2-a/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(a=l*t),c=r.x+r.width/2-a/2),c<=e.x&&(c=e.x,s=r.y),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=r.y),l<M&&(l=M,t&&(a=l*t),c=r.x+r.width/2-a/2),a<M&&(a=M,t&&(l=a/t),c=r.x+r.width/2-a/2),{x:c,y:s,width:a,height:l}}n(gd,"resizeSouth");function vd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:a,height:l}=r;a+=o,t&&(l=a/t);let c=r.y+r.height/2-l/2;return s+a>=e.x+e.width&&(a=e.x+e.width-s,t&&(l=a/t),c=r.y+r.height/2-l/2),c<=e.y&&(c=e.y,s=r.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=r.x),l<M&&(l=M,t&&(a=l*t),c=r.y+r.height/2-l/2),a<M&&(a=M,t&&(l=a/t),c=r.y+r.height/2-l/2),{x:s,y:c,width:a,height:l}}n(vd,"resizeEast");function yd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+o<e.x&&(o=e.x-a),l+s<e.y&&(s=e.y-l),a+=o,c-=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=r.x+r.width-c,l=e.y)):t&&(o=u*t-c,c=c+o,a-=o,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),a=r.x+r.width-c,l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),a=r.x+r.width-c,l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(yd,"resizeNorthWest");function bd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+c+o>e.x+e.width&&(o=e.x+e.width-a-c),l+s<e.y&&(s=e.y-l),c+=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=r.x,l=e.y)):t&&(o=u*t-c,c+=o,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(bd,"resizeNorthEast");function wd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+o<e.x&&(o=e.x-a),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),a+=o,c-=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=r.x+r.width-c,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,a-=o,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=r.y)),u<M&&(u=M,t&&(c=u*t),a=r.x+r.width-c),c<M&&(c=M,t&&(u=c/t),a=r.x+r.width-c),{x:a,y:l,width:c,height:u}}n(wd,"resizeSouthWest");function Td({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+c+o>e.x+e.width&&(o=e.x+e.width-a-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=r.x,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=r.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:a,y:l,width:c,height:u}}n(Td,"resizeSouthEast");function Pa({direction:r,...i}){switch(r){case "n":return md(i);case "w":return fd(i);case "s":return gd(i);case "e":return vd(i);case "nw":return yd(i);case "ne":return bd(i);case "sw":return wd(i);case "se":return Td(i);default:return i.rect}}n(Pa,"resizeRect");function Ua(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}n(Ua,"rectContainsPoint");function Ra(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}n(Ra,"isRectInsideRect");function $a(r,i){return Math.abs(r.width/r.height-i)<.1}n($a,"isRectMatchesAspectRatio");function Ze({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}n(Ze,"rotateSize");function Da(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 a=Math.round((r-o)/2),l=Math.round((i-s)/2);return a+o>r&&(o=r-a),l+s>i&&(s=i-l),{x:a,y:l,width:o,height:s}}n(Da,"calculateMaxCenteredCropFrame");function Ye(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}n(Ye,"roundRect");function ue(r,i,t){return Math.min(Math.max(r,i),t)}n(ue,"clamp");var ki=["free"],to=n(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&&!ki.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let a=Number(o.slice(0,s)),l=Number(o.slice(s+1));if((!Number.isFinite(a)||!Number.isFinite(l)||a<=0||l<=0)&&!ki.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:nt.generateFastUid(),type:"aspect-ratio",width:ki.includes(o)?0:a,height:ki.includes(o)?0:l,hasFreeform:ki.includes(o)});}return t},"parseCropPreset"),Fa=n((r,i,t,e=.1)=>{let o=r/i,s=null,a=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(o-p);d<a&&(a=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(o-u)/u>e)return null}return s},"getClosestAspectRatio");function Va(r){return Xo({...r,libraryName:$t,libraryVersion:Dt})}n(Va,"customUserAgent");var Na="active",Xe="___ACTIVITY_IS_ACTIVE___",_a,D=class r extends(_a=E,_a){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=os(this);this.Lu=V(this.Ru.bind(this),10);}static{n(this,"LitActivityBlock");}Wn(){let t=r.ai.get(this);this[Xe]=false,this.removeAttribute(Na),t?.deactivateCallback?.();}Uu(){let t=r.ai.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Xe]=true,this.setAttribute(Na,""),t?.activateCallback?.(),this.Lu(),this.emit(k.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[Xe]?this.Wn():this.activityType===t&&!this[Xe]&&this.Uu();}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"]=[]);}));}Ru(){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);}Zn(){return !!this.activityType&&r.ai.has(this)}static{this.ai=new Map;}get isActivityActive(){return !!this[Xe]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.ai.set(this,{activateCallback:o,deactivateCallback:s});}$u(){this.isActivityActive&&this.Wn(),r.ai.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Zn()&&this.$u();}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(a=>a.activityType===e)?.couldOpenActivity??false),e=o?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};D.activities=F;var I=class r extends D{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.sr=false;this.init$=ss(this);this.Mo=V(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._u(e);},300);this.Nu=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(k.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(a=>a.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 a=s?.getValue("thumbUrl");a&&URL.revokeObjectURL(a),this.emit(k.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Qn(),this.Mo();}};this.Vu=t=>{if(!this.isConnected)return;this.Mo();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(a=>t.fileInfo?.has(a)&&!!G.getCtx(a)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let a=G.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Qn();}if(t.isUploading)for(let s of t.isUploading){let a=G.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let a=G.getCtx(s);if(!a)continue;let{fileInfo:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Bu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=G.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(k.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(k.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),a=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&a.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(k.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(a=>!!this.uploadCollection.read(a)?.getValue("cdnUrl")).forEach(a=>{this.emit(k.FILE_URL_CHANGED,this.api.getOutputItem(a));}),this.$["*groupInfo"]=null);};this.Qn=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));o.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(t+=l);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(k.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{n(this,"LitUploaderBlock");}get Du(){return this.hasBlockInCtx(t=>t instanceof r?t.sr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Wr({initialValue:Aa,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new Kr(t)),this.Y("*validationManager",t=>new Gr(t)),this.Y("*publicApi",t=>new Qr(t)),!this.Du&&this.couldBeCtxOwner&&this.Fu();}getAPI(){return this.api}get validationManager(){return this.Q("*validationManager")}get api(){return this.Q("*publicApi")}get uploadCollection(){return this.Q("*uploadCollection")}get secureUploadsManager(){return this.Q("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.sr&&this.Yn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.sr&&this.Xn();}Fu(){this.sr=true,this.Xn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Xn(){this.Yn(),this.Ao=this.uploadCollection.observeCollection(this.Nu),this.ko=this.uploadCollection.observeProperties(this.Vu);}Yn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async _u(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,a=await Xn(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit(k.GROUP_CREATED,l),this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Bu(){let t=to(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 a=s.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=a.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=Da(l,c,u),d=at(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Q(m,d)});}}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=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Va,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return Yr(this.e)}};I.extSrcList=Object.freeze({...gt});I.sourceTypes=Object.freeze({...R});var de=class extends E{constructor(){super(...arguments);this.name="";this.nr="";this.li=null;this.Jn=null;}static{n(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Jn=e,this.Io();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Io()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Io();}Io(){if(!this.name){this.nr="",this.li=null;return}let e=this.e.pluginManager?.snapshot().icons.find(a=>a.name===this.name);if(e){this.li=e.svg,this.nr="";return}this.li=null;let o=`#uc-icon-${this.name}`,s=this.Jn?.(this.name);this.nr=s??o;}render(){return this.li?y`${this.yield("",y`${Ke(this.li)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.nr}></use></svg>`)} `}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}};h([b({type:String})],de.prototype,"name",2),h([g()],de.prototype,"nr",2),h([g()],de.prototype,"li",2);var Ba=n(r=>[...new Set(r)],"uniqueArray");var Oe="--uc-img-",xs="unresolved";var Ss=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),As=3e3,ks=5e3,Ms=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Cd="https://ucarecdn.com",Qe=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Cd},"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 eo=class extends Fe(Ve(xt)){constructor(){super();this.Le={};this.c=new Map;this.Re=null;this.ar=null;for(let t in Qe){let e=Qe[t];this.Le[Oe+t]=e?.default||"";}}static{n(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Le[Oe+t]}set$$(t){for(let e in t){let o=Oe+e,s=t[e];this.Le[o]=s,this.Z(o,s);}}sub$$(t,e){let o=Oe+t;this.c.has(o)||this.c.set(o,new Set),this.c.get(o)?.add(e);let s=this.Le[o];s!==null&&s!==""&&e(s);}Z(t,e){this.c.has(t)&&this.c.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${$t}/${Dt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;Qe[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.Re=new IntersectionObserver(s=>{s.forEach(a=>{a.isIntersecting&&(e(),this.Re?.unobserve(t));});},o),this.Re.observe(t),this.ar||(this.ar=new Set),this.ar.add(t);}connectedCallback(){super.connectedCallback(),this.zu();}zu(){for(let t in Qe){let e=Oe+t,o=this.getCssData(e,true);o!=null&&(this.Le[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.Re&&(this.ar?.forEach(t=>{this.Re?.unobserve(t);}),this.Re=null),this.c.clear();}static get observedAttributes(){return Object.keys(Qe)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Oe+t;this.Le[s]=o,this.Z(s,o);});}};var za=n(r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var oo=class extends eo{constructor(){super(...arguments);this.Rt=new Image;this.At=new Image;}static{n(this,"ImgBase");}ta(t){return !t.includes("//")&&!Ss&&(t=new URL(t,document.baseURI).href),t}lr(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let a=parseInt(o,10);return Number(a)>ks&&this.ea?ks+s:Number(a)>As&&!this.ea?As+s:t}Hu(t,e){let o={format:this.Oo("format"),quality:this.Oo("quality"),resize:this.lr(t),blur:e,"cdn-operations":this.Oo("cdn-operations")??void 0,analytics:this.analyticsParams()};return at(...za(o))}Oo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}vt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(Ss&&o&&!o.includes("//"))return this.ci(o);let s=this.Hu(t,e),a=this.$$("cdn-cname"),l=a;if(o.startsWith(String(a)))return Q(o,s);let c=this.$$("uuid");if(l&&c)return this.ci(Q(re(l,c),s));if(c)return this.ci(Q(re(l,c),s));let u=this.$$("proxy-cname");if(u)return this.ci(Q(u,s,this.ta(o)));let p=this.$$("pubkey");if(p)return this.ci(Q(`https://${p}.ucr.io/`,s,this.ta(o)))}ci(t){let e=this.$$("secure-delivery-proxy");return e?je(e,{previewUrl:t},{transform:n(o=>window.encodeURIComponent(o),"transform")}):t}Ue(t,e=1,o=true){let s=t.getBoundingClientRect(),a=e*Math.round(s.width),l=o?"":e*Math.round(s.height);return a||l?`${a||""}x${l||""}`:null}Ku(t){let e=n(s=>{s.stopPropagation();let a=new Event(s.type,s);this.dispatchEvent(a);},"proxifyEvent"),o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Ut||(this.Po({elNode:this.Rt}),this.appendChild(this.Rt)),this.Rt}get cr(){return this.Ut?{type:Ms.PREVIEW,img:this.At}:{type:Ms.MAIN,img:this.img}}get Ut(){return this.$$("is-preview-blur")}get ia(){return this.$$("is-background-for")}get ra(){let t=this.$$("breakpoints");if(t){let e=J(t);return Ba(e.map(o=>parseInt(o,10)))}else return null}get ea(){return this.$$("format").toLowerCase()==="jpeg"}oa(t){let e=new Set;e.add(`url("${this.vt(this.Ue(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.vt(this.Ue(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.vt(this.Ue(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}sa(){let t=new Set;return this.ra?this.ra.forEach(e=>{t.add(`${this.vt(`${e}x`)} ${this.lr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.vt(`${e*2}x`)} ${this.lr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.vt(`${e*3}x`)} ${this.lr(`${e*3}w`)}`);}):(t.add(`${this.vt(this.Ue(this.cr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.vt(this.Ue(this.cr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.vt(this.Ue(this.cr.img,3))} 3x`)),[...t].join()}na(){return this.vt()}get aa(){return this.vt("100x","100")}ju(){let t=this.ia;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.oa(e);}):this.oa(e);});}Gu({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}Po({elNode:t}){this.Ku(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:o}){return new Promise((s,a)=>{this.Po({elNode:o}),o.setAttribute(xs,""),o.addEventListener("load",()=>{o.removeAttribute(xs),s(o);}),o.addEventListener("error",()=>{a(false);}),this.Gu({elNode:o,src:t,srcset:e});})}async qu(){if(this.$$("intersection")){this.Ut&&(this.Po({elNode:this.At}),this.appendChild(this.At)),this.initIntersection(this.cr.img,async()=>{this.Ut&&(this.At.src=this.aa);try{await this.Lo({src:this.na(),srcset:this.sa(),elNode:this.Rt}),this.Ut&&await this.At.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}});return}try{this.Ut&&(await this.Lo({src:this.aa,elNode:this.At}),this.appendChild(this.At)),await this.Lo({src:this.na(),srcset:this.sa(),elNode:this.Rt}),this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}}init(){this.ia?this.ju():this.qu();}};var Is=class extends oo{static{n(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Ed}=Cn,Ha=n(r=>r,"i");var Os=n((r,i)=>i===void 0?r?.Vt!==void 0:r?.Vt===i,"l"),Ka=n(r=>r?.Vt?.h!=null,"d");var Ga=n(r=>r.strings===void 0,"r"),ja=n(()=>document.createComment(""),"s"),Xt=n((r,i,t)=>{let e=r.Pt.parentNode,o=i===void 0?r.Te:i.Pt;if(t===void 0){let s=e.insertBefore(ja(),o),a=e.insertBefore(ja(),o);t=new Ed(s,a,r,r.options);}else {let s=t.Te.nextSibling,a=t.m,l=a!==r;if(l){let c;t.Wu?.(r),t.m=r,t._i!==void 0&&(c=r.X)!==a.X&&t._i(c);}if(s!==o||l){let c=t.Pt;for(;c!==s;){let u=Ha(c).nextSibling;Ha(e).insertBefore(c,o),c=u;}}}return t},"v"),pe=n((r,i,t=r)=>(r.Et(i,t),r),"u"),xd={},Mi=n((r,i=xd)=>r.r=i,"p"),Ii=n(r=>r.r,"M"),so=n(r=>{r.Ee(),r.Pt.remove();},"h"),qa=n(r=>{r.Ee();},"j");var Oi=n((r,i)=>{let t=r.Tt;if(t===void 0)return false;for(let e of t)e.hn?.(i,false),Oi(e,i);return true},"s"),no=n(r=>{let i,t;do{if((i=r.m)===void 0)break;t=i.Tt,t.delete(r),r=i;}while(t?.size===0)},"o"),Wa=n(r=>{for(let i;i=r.m;r=i){let t=i.Tt;if(t===void 0)i.Tt=t=new Set;else if(t.has(r))break;t.add(r),kd(i);}},"r");function Sd(r){this.Tt!==void 0?(no(this),this.m=r,Wa(this)):this.m=r;}n(Sd,"h");function Ad(r,i=false,t=0){let e=this.r,o=this.Tt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Oi(e[s],false),no(e[s]);else e!=null&&(Oi(e,false),no(e));else Oi(this,r);}n(Ad,"n");var kd=n(r=>{r.type==Ft.CHILD&&(r._i??=Ad,r.Wu??=Sd);},"c"),ao=class extends ft{static{n(this,"f");}constructor(){super(...arguments),this.Tt=void 0;}oo(i,t,e){super.oo(i,t,e),Wa(this),this.isConnected=i.X;}hn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Oi(this,i),no(this));}setValue(i){if(Ga(this.ir))this.ir.Et(i,this);else {let t=[...this.ir.r];t[this.Au]=i,this.ir.Et(t,this,0);}}disconnected(){}reconnected(){}};var O=n(()=>new Ps,"e"),Ps=class{static{n(this,"h");}},Ls=new WeakMap,L=ut(class extends ao{render(r){return $}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)),$}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Ls.get(i);t===void 0&&(t=new WeakMap,Ls.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"?Ls.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 Us=null,Li=class extends E{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=n(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.Zu=()=>{this.closeDialog();};this.Yu=t=>{this.Ro=t.target;};this.Xu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ui=({id:t})=>{t===this.id?(Us=t,this.show(),this.emit(k.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.di=({id:t})=>{t===this.id&&(this.hide(),this.emit(k.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.la=t=>{this.hide(),Us===this.id&&this.emit(k.MODAL_CLOSE,{modalId:Us,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{n(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(tt.OPEN,this.ui),this.modalManager?.subscribe(tt.CLOSE,this.di),this.modalManager?.subscribe(tt.CLOSE_ALL,this.la);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(tt.OPEN,this.ui),this.modalManager?.unsubscribe(tt.CLOSE,this.di),this.modalManager?.unsubscribe(tt.CLOSE_ALL,this.la);}Qu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Zu),this.dialogEl.value?.addEventListener("mousedown",this.Yu),this.dialogEl.value?.addEventListener("mouseup",this.Xu);}render(){return y`<dialog ${L(this.Qu)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Li.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Li.prototype,"blockBodyScrolling",2);var lo=class extends I{constructor(){super(...arguments);this.K=null;this.ur=null;}static{n(this,"FormInput");}get ca(){return this.nameAttrValue??this.ctxName}ua(){let t=document.createElement("input");return t.type="text",t.name=this.ca,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Zr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.ua(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.ur){let a=document.createElement("div");this.appendChild(a),this.ur=a;}if(!this.K){let a=this.ua();this.appendChild(a),this.K=a;}if(this.ur.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let a=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(a??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl).filter(a=>typeof a=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.K.value=o[0],this.K.setCustomValidity("");return}this.K.remove(),this.K=null;let s=new DocumentFragment;for(let a of o){let l=document.createElement("input");l.type="hidden",l.name=`${this.ca}[]`,l.value=a,s.appendChild(l);}this.ur.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],lo.prototype,"nameAttrValue",2);var Rs=class extends E{static{n(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Je=class extends E{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.yt=0;this.dr=O();this.da=()=>{let t=this.dr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.yt>0&&t.classList.add("uc-fake-progress--hidden");}};}static{n(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.yt=this.Uo(this.value),this.$o(),this.dr.value?.addEventListener("animationiteration",this.da);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.yt=e;else {let o=Math.max(this.yt,e);o!==this.yt&&(this.yt=o,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.yt=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.dr.value?.removeEventListener("animationiteration",this.da);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.yt.toString());}render(){return y`<div ${L(this.dr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Je.prototype,"hasFileName",2),h([b({type:Number})],Je.prototype,"value",2),h([b({type:Boolean,reflect:true})],Je.prototype,"visible",2);var Pi=class extends I{constructor(){super();this.kt=false;this.$e=0;this.init$={...this.init$,"*commonProgress":0};}static{n(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.kt=t;}),this.sub("*commonProgress",t=>{this.$e=t;});}updated(t){super.updated(t),t.has("visible")&&(this.kt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return y`<uc-progress-bar .value=${this.$e} .visible=${this.kt}></uc-progress-bar>`}};h([g()],Pi.prototype,"kt",2),h([g()],Pi.prototype,"$e",2);var ti=class extends E{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Ju=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{n(this,"Select");}render(){return y`<select @change=${this.Ju} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],ti.prototype,"value",2),h([b({type:Boolean,reflect:true})],ti.prototype,"disabled",2),h([b({type:Array,attribute:false})],ti.prototype,"options",2);var he=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.pr="";}static{n(this,"SourceBtn");}willUpdate(t){super.willUpdate(t),t.has("source")&&this.td(this.source);}td(t){if(!t){this.pr="",this.Fo="default";return}let{label:e,icon:o,id:s}=t;this.pr=e,this.Fo=o??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return y`<button aria-label=${this.l10n(this.pr)} type="button" @click=${this.activate}>${this.textOnly?"":y`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":y`<div class="uc-txt">${this.l10n(this.pr)}</div>`}</button>`}};h([b({attribute:false})],he.prototype,"source",2),h([b({type:Boolean})],he.prototype,"textOnly",2),h([b({type:Boolean})],he.prototype,"iconOnly",2),h([g()],he.prototype,"Fo",2),h([g()],he.prototype,"pr",2);var ei=class{constructor(i,t){this.pa=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ha=t.onSourcesChange,i.addController(this);}static{n(this,"SourceListController");}hostConnected(){this.No=this.i.sub(S("sourceList"),t=>{this.pa=J(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.S=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.S?.(),this.S=void 0,this.No?.(),this.No=void 0;}Vo(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),o=[];this.pa.forEach(s=>{let a=this.ed(s,e);if(a.length!==1||a[0]!==s){for(let u of a){let p=e.get(u);p&&o.push(this.fa(p));}return}let c=e.get(s);c&&o.push(this.fa(c));}),this.ha(o);}ed(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}fa(i){return {id:i.id,label:i.label,icon:i.icon,onClick:n(()=>i.onSelect(),"onClick")}}};var Ui=class extends I{constructor(){super(...arguments);this.b=[];this.wrap=false;}static{n(this,"SourceList");}initCallback(){super.initCallback(),new ei(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.b=t;},"onSourcesChange")});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return y`${this.b.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};h([g()],Ui.prototype,"b",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Ui.prototype,"wrap",2);var $s=class extends E{static{n(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Lt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Le(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=a=>s(a);}),image:i,cancel:n(()=>{i.naturalWidth===0&&(i.src=Lt);},"cancel")}}n(Le,"preloadImage");function Ri(r){let i=[];for(let s of r){let a=Le(s);i.push(a);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:n(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}n(Ri,"batchPreloadImages");function Ds(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((a,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p);});},o.onerror=c=>{l(c);};});return o.src=URL.createObjectURL(r),s}n(Ds,"generateThumb");var ii=class extends I{constructor(){super(...arguments);this.hr=new Set;this.entry=null;}static{n(this,"FileItemConfig");}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,a)=>{let l=o.subscribe(s,c=>{this.isConnected&&a(c);});this.hr.add(l);})(t,e);}reset(){for(let t of this.hr)t();this.hr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.hr=new Set;}};function Md(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}n(Md,"createSvgBlobUrl");function co(r="hsl(209, 21%, 65%)",i=32,t=32){return Md(`<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>`)}n(co,"fileCssBg");var Id=3e3,ri=class extends ii{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.jt="";this.ma=false;this.fr=null;this.ga=false;this.rd=this.cfg.filesViewMode;this.va=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),a=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.od(e);if(o&&s&&a){let p=await this.proxyUrl(Q(re(this.cfg.cdnCname,a),at(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Le(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await Ds(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await Ds(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(p));}});this.mr=V(this.va.bind(this),100);}static{n(this,"Thumb");}od(t=false){t&&(this.fr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.fr?.height||0),10),parseInt(String(this?.fr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),Id)}sd(t,e){return new Promise((o,s)=>{let a=new Image;a.decoding="async";let l=n(()=>{a&&(a.onload=null,a.onerror=null,a.src=Lt,e?.removeEventListener("abort",c),a=null);},"cleanup"),c=n(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=n(()=>{l(),o();},"resolveSafe"),p=n(d=>{l(),s(d);},"rejectSafe");if(typeof a.decode=="function"){a.src=t,a.decode().then(u).catch(p);return}a.onload=u,a.onerror=p,a.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}nd(t){if(this.Bo(),!t){this.jt&&(this.jt="");return}if(t===this.jt)return;let e=new AbortController,o={controller:e,cancel:n(()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);},"cancel")};this._o=o,this.sd(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.jt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}gr(t=false){if(this.entry){if(t){this.va(true);return}this.ga&&this.mr();}}firstUpdated(t){super.firstUpdated(t),this.ya();}updated(t){super.updated(t),t.has("uid")&&this.ya();}pi(t){let[e]=t;e&&(this.ga=e.isIntersecting,e.isIntersecting&&(this.fr=e.boundingClientRect,this.gr(),this.s?.disconnect()),e.intersectionRatio===0&&this.mr.cancel());}reset(){super.reset(),this.mr.cancel(),this.Bo(),this.jt&&(this.jt="");}ya(){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=n(()=>{this.gr();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.nd(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.gr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ma&&(this.rd==="list"&&this.gr(true),this.ma=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.mr.cancel(),this.Bo(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.jt||Lt} role="img" alt="Preview of uploaded image" ?hidden=${!this.jt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],ri.prototype,"badgeIcon",2),h([b({attribute:false})],ri.prototype,"uid",2),h([g()],ri.prototype,"jt",2);var Fs=class extends D{static{n(this,"ActivityHeader");}};var Vs=class extends D{constructor(){super(...arguments);this.historyTracked=true;this.activityType=D.activities.START_FROM;}static{n(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Ns=class extends I{constructor(){super(...arguments);this.ba=null;}static{n(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=k;}initCallback(){super.initCallback(),this.ba=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ba?.();}};var me=n((r,i)=>{let t=false,e,o=0,s=n(((...a)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...a),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...a),o=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:n(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var Za=n((r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},"u"),$i=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.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=[],a=0;for(let l of r)o[a]=e?e(l,a):a,s[a]=t(l,a),a++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=Ii(r),{values:s,keys:a}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=a,s;let l=this.ut??=[],c=[],u,p,d=0,m=o.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(o[d]===null)d++;else if(o[m]===null)m--;else if(l[d]===a[f])c[f]=pe(o[d],s[f]),d++,f++;else if(l[m]===a[v])c[v]=pe(o[m],s[v]),m--,v--;else if(l[d]===a[v])c[v]=pe(o[d],s[v]),Xt(r,c[v+1],o[d]),d++,v--;else if(l[m]===a[f])c[f]=pe(o[m],s[f]),Xt(r,o[d],o[m]),m--,f++;else if(u===void 0&&(u=Za(a,f,v),p=Za(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(a[f]),T=w!==void 0?o[w]:null;if(T===null){let C=Xt(r,o[d]);pe(C,s[f]),c[f]=C;}else c[f]=pe(T,s[f]),Xt(r,o[d],T),o[w]=null;f++;}else so(o[m]),m--;else so(o[d]),d++;for(;f<=v;){let w=Xt(r,c[v+1]);pe(w,s[f]),c[f++]=w;}for(;d<=m;){let w=o[d++];w!==null&&so(w);}return this.ut=a,Mi(r,c),st}});var Ya="important",Od=" !"+Ya,Qt=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(Od);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?Ya:""):t[e]=o;}}return st}});var dt=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.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 Ld="file-item-remove-button",Jt=class extends I{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{n(this,"FileActionButton");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get ad(){return Math.min(Math.max(this.progress||0,0),100)}ld(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=dt({"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.ad,o=this.l10n(Ld);return y`<button type="button" @click=${this.ld} 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=${Qt({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};h([b({type:Boolean})],Jt.prototype,"uploading",2),h([b({type:Boolean})],Jt.prototype,"failed",2),h([b({type:Boolean})],Jt.prototype,"success",2),h([b({type:Boolean})],Jt.prototype,"idle",2),h([b({type:Boolean})],Jt.prototype,"hideRemove",2),h([b({type:Number})],Jt.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 ii{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.wa=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.yt=0;this.cd=false;this.jo="";this.Go=false;this.qo=false;this.Wo=false;this.xa=false;this.Ta=false;this.Zo=false;this.Ea="";this.vr=[];this.Ca=false;this.Yo=()=>{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.Uh=()=>{this.Sa();};this._=V(()=>this.Aa(),100);this.dd=this.withEntry(me((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),a=t.getValue("externalUrl"),l=e===Y.FINISHED,c=e===Y.UPLOADING,u=e===Y.QUEUED_UPLOADING,p=e===Y.QUEUED_VALIDATION,d=e===Y.VALIDATION,m=t.getValue("fileName"),f="";o?f="":!l&&a&&s&&Object.values(gt).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${Ca(s)}`)})),this.Ko=f,this.Ho=o,this.cd=c||u||p||d,this.yt=p||d?0:t.getValue("uploadProgress"),this.Ea=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Sa=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._();try{let o=new AbortController;t.setValue("abortController",o);let s=n(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let m=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of m)try{let v=f.handler({file:l,signal:o.signal}),w=new Promise((C,A)=>setTimeout(()=>A(new Error("beforeUpload hook timed out")),f.timeout)),{file:T}=await Promise.race([v,w]);T!==l&&(l=T,t.setValue("mimeType",l.type||null),t.setValue("isImage",He(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:n(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:o.signal,metadata:await this.getMetadataFor(t.uid),tags:await this.getTagsFor(t.uid)};return this.debugPrint("upload options",c,p),is(c,p)},"uploadTask"),a=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:a,isQueuedForUploading:!1,isUploading:!1,fileName:a.originalFilename,fileSize:a.size,isImage:a.isImage??!1,mimeType:a.contentInfo?.mime?.mime??a.mimeType,uuid:a.uuid,cdnUrl:t.getValue("cdnUrl")??a.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this._();}catch(o){let s=o instanceof se&&o.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof Ae?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._(),this.isConnected&&!s&&this.telemetryManager.sendEventError(o,"file upload. Failed to upload file");}}});}static{n(this,"FileItem");}Aa(){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.ud(t,e);}ud(t,e){e===Y.FAILED?this.jo="badge-error":e===Y.FINISHED&&(this.jo="badge-success"),e===Y.UPLOADING&&(this.Ta=false,this.removeAttribute("focused")),this.qo=e===Y.FAILED,this.Wo=e===Y.UPLOADING,this.xa=e===Y.QUEUED_UPLOADING||e===Y.UPLOADING,this.Go=e===Y.FINISHED,this.dd(e);}reset(){super.reset(),this._.cancel();}pi(t){let[e]=t;e&&e.isIntersecting&&!this.Ca&&(this.wa=false,this.Ca=true);}ka(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.ce();return}this.subEntry("isQueuedForValidation",()=>{this._();}),this.subEntry("isValidationPending",()=>{this._();}),this.subEntry("uploadProgress",()=>{this._();}),this.subEntry("isQueuedForUploading",()=>{this._();}),this.subEntry("fileName",o=>{this.zo=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._();}),this.subEntry("externalUrl",o=>{this.zo=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this._();}),this.subEntry("errors",()=>this._()),this.subEntry("isUploading",()=>this._()),this.subEntry("fileSize",()=>this._()),this.subEntry("mimeType",()=>this._()),this.subEntry("isImage",()=>this._()),this.subEntry("fileInfo",()=>this.ce()),this.subEntry("isUploading",()=>this.ce()),this.subEntry("errors",()=>this.ce()),this.Aa(),this.ce();}Ma(t){if(this.cfg.filesViewMode==="list"){this.Zo=true;return}this.Zo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.ka(this.uid);}ce(){let t=this.e.pluginManager;if(!t||!this.uid){this.vr=[];return}let e=t.snapshot().fileActions,o=this.api.getOutputItem(this.uid);if(!o){this.vr=[];return}this.vr=e.filter(s=>{try{return s.shouldRender(o)}catch(a){return console.error(`Error in plugin file action shouldRender (${s.id}):`,a),false}});}pd(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.ka(this.uid),this.subConfigValue("filesViewMode",e=>{this.Ma(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Ma(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.Sa());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.ce())),this.ce(),W.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback(),this.s?.disconnect(),W.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.wa?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.Wo} ?data-failed=${this.qo} ?data-focused=${this.Ta} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Ea}><span class="uc-file-name" ?hidden=${!this.Zo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.vr.map(t=>y`<button type="button" @click=${()=>this.pd(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.Yo} .uploading=${this.Wo} .hideRemove=${this.xa} .progress=${this.yt} .failed=${this.qo} .success=${this.Go} ></uc-file-action-button></div></div>`}};h([g()],W.prototype,"wa",2),h([b({attribute:false})],W.prototype,"uid",2),h([g()],W.prototype,"zo",2),h([g()],W.prototype,"Ho",2),h([g()],W.prototype,"Ko",2),h([g()],W.prototype,"yt",2),h([g()],W.prototype,"cd",2),h([g()],W.prototype,"jo",2),h([g()],W.prototype,"Go",2),h([g()],W.prototype,"qo",2),h([g()],W.prototype,"Wo",2),h([g()],W.prototype,"xa",2),h([g()],W.prototype,"Ta",2),h([g()],W.prototype,"Zo",2),h([g()],W.prototype,"Ea",2),h([g()],W.prototype,"vr",2);var _s=W;function Pd(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=n(o=>{o.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}n(Pd,"checkIsDirectory");function Ud(r,i){return new Promise(t=>{let e=0,o=[],s=n(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});o.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(o);})):l.isDirectory&&a(l.createReader());},"readEntry"),a=n(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(o);});},"readReaderContent");s(r);})}n(Ud,"readEntryContentAsync");function Xa(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,a=o;if(typeof a.webkitGetAsEntry=="function"||typeof a.getAsEntry=="function"){let c=typeof a.webkitGetAsEntry=="function"?a.webkitGetAsEntry():a.getAsEntry?.();c&&t.push(Ud(c,s).then(u=>{u&&i.push(...u);}));continue}let l=o.getAsFile();l&&t.push(Pd(l).then(c=>{c||i.push({type:"file",file:l});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(a=>{i.push({type:"url",url:a}),s();});}));}return Promise.all(t).then(()=>i)}n(Xa,"getDropItems");var pt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Qa=["focus"],Rd=100,Bs=new Map;function $d(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))}n($d,"distance");function zs(r){let i=0,t=document.body,e=new Set,o=n(v=>{e.add(v);},"handleSwitch"),s=pt.INACTIVE,a=n(v=>{r.shouldIgnore()&&v!==pt.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=n(()=>i>0,"isDragging");o(v=>r.onChange(v));let c=n(()=>{i=0,a(pt.INACTIVE);},"onResetEvent"),u=n(()=>{i+=1,s===pt.INACTIVE&&a(pt.ACTIVE);},"onDragEnter"),p=n(()=>{i-=1,l()||a(pt.INACTIVE);},"onDragLeave"),d=n(v=>{v.preventDefault(),i=0,a(pt.INACTIVE);},"onDrop"),m=n(v=>{if(r.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=r.element.getBoundingClientRect(),C=Math.floor($d(w,T)),A=C<Rd,N=v.composedPath().includes(r.element);Bs.set(r.element,C);let et=Math.min(...Bs.values())===C;N&&et?(v.preventDefault(),a(pt.OVER)):a(A&&et?pt.NEAR:pt.ACTIVE);},"onDragOver"),f=n(async v=>{if(r.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Xa(w);r.onItems(T),a(pt.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),r.element.addEventListener("drop",f),Qa.forEach(v=>{window.addEventListener(v,c);}),()=>{Bs.delete(r.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),r.element.removeEventListener("drop",f),Qa.forEach(v=>{window.removeEventListener(v,c);});}}n(zs,"addDropzone");var Hs=new Set,Tt=class extends I{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.zt=true;this.Ia=true;this.Xo="drop-files-here";this.ue=false;this.Pa=null;this.Qo=null;this.La=O();this.De=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.Ra=true;this.Fe=false;}static{n(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Oa(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Xo=t;return}this.Xo=this.ue?"drop-files-here":"drop-file-here";}isActive(){if(!this.zt)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),a=s.visibility!=="hidden"&&s.display!=="none";return e&&a&&o}initCallback(){super.initCallback(),Hs.add(this),this.Jo(),this.ts(),this.Ua(),this.$a(pt.INACTIVE),this.Pa=zs({element:this,shouldIgnore:n(()=>this.Da(),"shouldIgnore"),onChange:n(t=>{this.$a(t);},"onChange"),onItems:n(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();},"onItems")}),this.updateComplete.then(()=>this.hd()),this.subConfigValue("sourceList",t=>{let e=J(t);this.Ra=e.includes(R.LOCAL),this.Jo(),this.ts();}),this.subConfigValue("multiple",t=>{this.ue=!!t,this.Oa();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Jo(),this.ts()),(t.has("text")||t.has("localeId"))&&this.Oa();}updated(t){super.updated(t),t.has("clickable")&&this.Ua();}Da(){if(!this.zt||!this.fd())return true;if(!this.fullscreen)return false;let t=Hs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}fd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}Jo(){let t=this.Ra&&!this.disabled;this.zt=t;}ts(){let t=this.zt||!this.querySelector("[data-default-slot]");this.Ia=t,this.hidden=!t;}$a(t){let e=Object.entries(pt).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}hd(){if(this.Qo)return;let t=this.La.value;t&&(this.Qo=zs({element:t,onChange:n(e=>{let o=Object.entries(pt).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this.Da(),"shouldIgnore")}));}Ua(){this.clickable&&!this.Fe?(this.addEventListener("keydown",this.De),this.addEventListener("click",this.De),this.Fe=true):!this.clickable&&this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}disconnectedCallback(){super.disconnectedCallback(),Hs.delete(this),this.Pa?.(),this.Qo?.(),this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.La)} class="uc-content-wrapper" ?hidden=${!this.Ia} ><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.Xo)}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],Tt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],Tt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],Tt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"initflow",2),h([b({type:String})],Tt.prototype,"text",2),h([g()],Tt.prototype,"zt",2),h([g()],Tt.prototype,"Ia",2);var Pt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=D.activities.UPLOAD_LIST;this.Fa=false;this.Na=false;this.Va=false;this.es=false;this.rs=false;this.yr=null;this._a=false;this.os=null;this.Ba=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.ss=()=>{this.emit(k.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.ns=()=>{this.emit(k.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.$t=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=me(()=>{this.isConnected&&(this.vd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{n(this,"UploadList");}get md(){return this.os?this.gd(this.os):""}vd(){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"),a=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&o&&c&&f;}this.Fa=p,this.Na=d,this.Va=u,this.rs=e.total===0||!s&&!a,this.es=!a||this.cfg.multiple,this._a=e.total>0,this.os=e;}gd(t){let e=n(o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.q),this.subConfigValue("multipleMin",this.q),this.subConfigValue("multipleMax",this.q),this.sub("*groupInfo",t=>{t&&this.q();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.yr=null;return}this.yr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.md}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this._a}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${$i(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Ba} ?disabled=${!this.rs} ?hidden=${!this.es} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.yr} >${this.yr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.es} ?disabled=${!this.rs} @click=${this.Ba} ><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.Va} @click=${this.ss} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Fa} ?disabled=${!this.Na} @click=${this.ns} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"Fa",2),h([g()],Pt.prototype,"Na",2),h([g()],Pt.prototype,"Va",2),h([g()],Pt.prototype,"es",2),h([g()],Pt.prototype,"rs",2),h([g()],Pt.prototype,"yr",2),h([g()],Pt.prototype,"_a",2),h([g()],Pt.prototype,"os",2);var Dd=[{test:n(r=>!!r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:n(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ja=V(r=>{for(let{test:i,message:t}of Dd)i(r)&&Xr(t);},0);var tl=n((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),Fd="0123456789abcdefghijklmnopqrstuvwxyz",el=n(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Fd[Number(t)]+i,r=r/36n;}return i},"a"),js=n((r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}},"c");var Vd=n(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Nd=10,_d=n(async r=>{let i=await Vd(r);return el(i).slice(0,Nd)},"d"),il=n(async(r,i)=>{let t=await _d(r);return tl(t,i)},"f");var rl=n(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var Ks=n(r=>r,"defineComputedProperty"),Bd=[Ks({key:"cameraModes",deps:["enableVideoRecording"],fn:n(({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)},"fn")}),Ks({key:"cameraModes",deps:["defaultCameraMode"],fn:n(({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)},"fn")}),Ks({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:n(({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>{let e=r(),o=i(),s=t();return e&&(o===bi||js(o,s))?il(e,s):o},"fn")})],ol=n(({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of Bd){if(!o.deps.includes(r))continue;let s={[o.key]:()=>t(o.key)};for(let c of o.deps)s[c]=()=>t(c);let a=new AbortController;e.get(o.fn)?.abort(),e.set(o.fn,a);let l;try{l=o.fn(s,{signal:a.signal});}catch(c){e.get(o.fn)===a&&e.delete(o.fn),console.error(`Failed to compute value for "${o.key}"`,c);return}rl(l)?l.then(c=>{a.signal.aborted||i(o.key,c);}).catch(c=>{a.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,c);}).finally(()=>{e.get(o.fn)===a&&e.delete(o.fn);}):i(o.key,l);}},"computeProperty");var B=n(r=>String(r),"asString"),rt=n(r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},"asNumber"),H=n(r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},"asBoolean"),sl=n(r=>r==="auto"?r:H(r),"asStore"),nl=n(r=>{let i=B(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),al=n(r=>{let i=B(r);if(!Object.values(U).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),ll=n(r=>{let i=B(r),t=Z(i);if(t.some(e=>!Object.values(U).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),cl=n(r=>{let i=B(r);if(i==="local"||i==="global")return i;if(H(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),ul=n(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),dl=n(r=>{if(Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid tags value. Must be an array or function.")},"asTags"),Gs=n(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),uo=n(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),po=n(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),pl=n(r=>{let i=B(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode"),hl=n(r=>{let i=B(r);if(["auto","menu","toolbar","compact","plain"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asDynamicButtonViewMode");var zd={pubkey:B,multiple:H,multipleMin:rt,multipleMax:rt,confirmUpload:H,imgOnly:H,accept:B,externalSourcesPreferredTypes:B,externalSourcesEmbedCss:B,store:sl,cameraMirror:H,cameraCapture:nl,sourceList:B,topLevelOrigin:B,maxLocalFileSizeBytes:rt,thumbSize:rt,showEmptyList:H,useLocalImageEditor:H,useCloudImageEditor:H,cloudImageEditorTabs:B,removeCopyright:H,cropPreset:B,imageShrink:B,modalScrollLock:H,modalBackdropStrokes:H,sourceListWrap:H,remoteTabSessionKey:B,cdnCname:B,cdnCnamePrefixed:B,baseUrl:B,socialBaseUrl:B,secureSignature:B,secureExpire:B,secureDeliveryProxy:B,retryThrottledRequestMaxTimes:rt,retryNetworkErrorMaxTimes:rt,multipartMinFileSize:rt,multipartChunkSize:rt,maxConcurrentRequests:rt,multipartMaxConcurrentRequests:rt,multipartMaxAttempts:rt,checkForUrlDuplicates:H,saveUrlForRecurrentUploads:H,groupOutput:H,userAgentIntegration:B,debug:H,localeName:B,metadata:ul,tags:dl,secureUploadsExpireThreshold:rt,localeDefinitionOverride:n(r=>Gs(r),"localeDefinitionOverride"),secureUploadsSignatureResolver:n(r=>uo(r),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:n(r=>uo(r),"secureDeliveryProxyUrlResolver"),iconHrefResolver:n(r=>uo(r),"iconHrefResolver"),plugins:n(r=>po(r),"plugins"),fileValidators:po,collectionValidators:po,validationTimeout:rt,validationConcurrency:rt,cameraModes:ll,defaultCameraMode:al,enableAudioRecording:H,enableVideoRecording:H,mediaRecorderOptions:Gs,maxVideoRecordingDuration:rt,filesViewMode:pl,gridShowFileNames:H,cloudImageEditorAutoOpen:H,cloudImageEditorMaskHref:B,testMode:H,qualityInsights:H,pasteScope:cl,dynamicButtonShowFirstIcon:H,dynamicButtonViewMode:hl},ml=n((r,i)=>{if(!(typeof i>"u"||i===null))try{return zd[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),it[r]}},"normalizeConfigValue");var ho=[...new Set(["debug",...Object.keys(it)])],Hd=["metadata","tags","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],gl=n(r=>Hd.includes(r),"isComplexKey"),Ws=ho.filter(r=>!gl(r)),qs={...Object.fromEntries(Ws.map(r=>[wr(r),r])),...Object.fromEntries(Ws.map(r=>[r.toLowerCase(),r]))},fl=n(r=>`__${r}`,"getLocalPropName"),oi=class extends E{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(it).map(([t,e])=>[S(t),e]))};this.yd=new Map;this.fi={};this.za=new Set;this.Ne=new Map;}static{n(this,"Config");}as(t){return this.za.has(t)}ls(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}cs(t){return [...new Set([wr(t),t.toLowerCase()])]}bd(t,e){if(gl(t)||this.as(t)&&this.ls(t)?.attribute===false)return;let o=this.cs(t);for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}wd(t,e){let o=S(t);if(this.$[o]!==e)if(typeof e>"u"||e===null){let s=it[t];this.$[o]=s!==void 0?s:e;}else this.$[o]=e;}Gt(t,e){let o;if(this.as(t)){let l=this.ls(t);try{o=l?.normalize?.(e)??e;}catch(c){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,c);return}}else o=ml(t,e);let s=this,a=fl(t);s[a]!==o&&(this.xd(t,s[a],o),s[a]=o,this.bd(t,o),this.wd(t,o),this.debugPrint(`"${t}"`,o),this.as(t)||Ja(this.cfg));}wr(t){let e=this,o=fl(t);return e[o]??this.$[S(t)]}xd(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));}Ha(t){let e=t.configRegistry.getAll();this.fi={},this.za=new Set(e.keys());for(let[o,s]of this.Ne)e.has(o)||(s(),this.Ne.delete(o));for(let[o,s]of e){let l=S(o);if(s.attribute){let f=this.cs(o);for(let v of f)this.fi[v]=o;}let c,u=false,p=Object.getOwnPropertyDescriptor(this,o);if(p&&!p.get&&!p.set&&p.value!==void 0&&(c=p.value,u=true),!u&&s.attribute)for(let f of this.cs(o)){let v=this.getAttribute(f);if(v!=null){try{c=s.fromAttribute?s.fromAttribute(v):v;}catch(w){console.warn(`[uc-config] fromAttribute() for "${o}" threw an error, using raw attribute value`,w),c=v;}u=true;break}}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let m=Object.getOwnPropertyDescriptor(this,o);if((!m||!m.set||!m.get)&&Object.defineProperty(this,o,{set:n(f=>{this.Gt(o,f);},"set"),get:n(()=>this.wr(o),"get"),enumerable:true,configurable:true}),!this.Ne.has(o)){let f=this.sub(l,v=>{this.Gt(o,v);},false);this.Ne.set(o,f);}u&&this.Gt(o,c);}}Td(){this.e.when("pluginManager",t=>{this.Ha(t),this.br=t.onPluginsChange(()=>{this.Ha(t);});});}Ed(){this.hi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let o=e.attributeName,s=e.oldValue,a=this.getAttribute(o);if(s===a||o in qs)continue;if(o in this.fi){let c=this.fi[o],u=this.ls(c);this.attributeChangedCallback(o,s??"",a??u?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Td(),this.Ed();for(let o of Ws)this.sub(S(o),s=>{this.Gt(o,s);},false);for(let o of ho){let s=t[o]??this.$[S(o)];s!==it[o]&&this.Gt(o,s);let a=Object.getOwnPropertyDescriptor(this,o);(!a||!a.set||!a.get)&&Object.defineProperty(this,o,{set:n(l=>{this.Gt(o,l);},"set"),get:n(()=>this.wr(o),"get")});}let e=n(o=>{ol({key:o,setValue:this.Gt.bind(this),getValue:this.wr.bind(this),computationControllers:this.yd});},"runComputeProperty");for(let o of ho)this.sub(S(o),()=>e(o));}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,a=qs[t];a?s[a]=o:this.e.when("pluginManager",l=>{let c=this.getAttribute(t);if(c&&c!==o)return;let u=this.fi[t],p=u?l.configRegistry.get(u):void 0;if(u&&p){let d=p.fromAttribute?p.fromAttribute(o):o;if(this.wr(u)===d)return;this.Gt(u,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.br&&(this.br(),this.br=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Ne.values())t();this.Ne.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(qs);return [...t,...e]}};for(let r of ho)oi.prototype[r]=void 0;var Di=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.us=()=>{this.api.initFlow();};}static{n(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.us}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.mi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Di.prototype,"dropzone",2),h([g()],Di.prototype,"mi",2);var vl=n(r=>Ka(r)?r.Vt.h:r.strings,"d"),Pe=ut(class extends ft{constructor(r){super(r),this.et=new WeakMap;}render(r){return [r]}update(r,[i]){let t=Os(this.it)?vl(this.it):null,e=Os(i)?vl(i):null;if(t!==null&&(e===null||t!==e)){let o=Ii(r).pop(),s=this.et.get(t);if(s===void 0){let a=document.createDocumentFragment();s=cr($,a),s.setConnected(false),this.et.set(t,s);}Mi(s,[o]),Xt(s,void 0,o);}if(e!==null){if(t===null||t!==e){let o=this.et.get(e);if(o!==void 0){let s=Ii(o).pop();qa(r),Xt(r,void 0,s),Mi(r,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var fe=class fe extends I{constructor(){super(...arguments);this.showIcon=false;this.ue=false;}static{n(this,"PrimaryAction");}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.ue=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}gi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.Cd();return t||(this.source?this.Sd():this.l10n(this.ue?"upload-files":"upload-file"))}Cd(){if(this.entries?.status==="uploading")return this.gi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.gi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.gi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.gi("header-total",{count:this.entries?.totalCount??0})}Sd(){if(!this.source?.id)return "";let e=fe.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.gi(e,{source:o})}us(){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();}Ad(){if(!this.ue&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?y`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.ue&&this.hasMultipleEntries)return null;if(!this.source)return y`<uc-icon .name=${fe.DEFAULT_ICON}></uc-icon>`;let t=this.source?.icon;return this.showIcon&&t?y`<uc-icon .name=${t}></uc-icon>`:null}render(){return y`<button type="button" @click=${this.us} aria-label=${this.textBasedOnLocale}>${this.Ad()}<span>${this.textBasedOnLocale}</span></button>`}};h([b({type:Object})],fe.prototype,"source",2),h([b({type:Object})],fe.prototype,"entries",2),h([g()],fe.prototype,"showIcon",2),h([g()],fe.prototype,"ue",2);var Zs=fe;var mo=class extends E{constructor(){super(...arguments);this.Ka=nt.generateFastUid();this.kd=t=>{t.currentTarget.hidePopover();};}static{n(this,"DropDown");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return y`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Ka} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Ka} class="uc-dropdown-content" popover="auto" @click=${this.kd}>${this.yield("dd-content")}</div>`}};h([g()],mo.prototype,"Ka",2);var Ys=class extends I{static{n(this,"NoWrapModeDynamicBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var jd=n((r,i)=>i==="compact"||i==="plain"||r.length===0?{main:null,remain:r}:{main:r[0]??null,remain:r.slice(1)},"adjustSourceBasedOnMode"),yl={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},Kd=3,Ut=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.qt="auto";this.b=[];this.Ve="idle";this.Ga=0;this.ds="arrow-dropdown";this.q=me(()=>{this.isConnected&&this.Md();},300);}static{n(this,"DynamicBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.Ve==="idle"}get isSuccess(){return this.Ve==="success"}get isFailed(){return this.Ve==="failed"}get isUploading(){return this.Ve==="uploading"}get isCollapsedMode(){return this.qt==="compact"}get isPlainMode(){return this.qt==="plain"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.b.length>1&&(this.qt==="toolbar"||this.qt==="auto"&&this.b.length<=Kd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.b.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.b.length===1}get hasCollectionEntries(){return (this.Tr?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}Md(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Tr=t,this.Ve=t.status;}qa(){this.xr=jd(this.b,this.qt);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.qt!==t&&(this.qt=t,this.qa());}),this.sub("*commonProgress",t=>{this.Ga=t;}),new ei(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.b=t,this.qa();},"onSourcesChange")}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.ja=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",F.UPLOAD_LIST),this.modalManager?.open(F.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.q.cancel=="function"&&this.q.cancel(),this.ja?.(),super.disconnectedCallback(),this.ds="arrow-dropdown";}Id(){return y`<uc-no-wrap-mode-dynamic-btn>${this.xr?.remain?.map(t=>y`<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.ds=yl[this.qt]??"arrow-dropdown");}Od(){this.uploadCollection.clearAll();}Pd(){this.Tr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Ld(){this.uploadCollection.abortAll();}Yo(){switch(this.Ve){case "failed":this.Pd();break;case "uploading":this.Ld();break;default:this.Od();}}Rd(){return y`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.ds}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.xr?.remain?.map(t=>y`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Ud(){let t=this.b[0],e=t&&{...t,icon:yl.compact};return y`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}$d(){return y`<uc-primary-action .entries=${this.Tr} .source=${this.xr?.main} ></uc-primary-action>`}Dd(){return y`<uc-file-action-button @uc:remove=${this.Yo} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ga} ></uc-file-action-button>`}Fd(){return dt({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Nd(){return y`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Fd()}>${Pe(this.shouldShowPrimaryAction?this.$d():null)} ${Pe(!this.isPlainMode&&this.shouldShowInline?this.Id():null)} ${Pe(!this.isPlainMode&&this.shouldShowCompactSingleSource?this.Ud():null)} ${Pe(!this.isPlainMode&&this.shouldShowDropdown?this.Rd():null)} ${Pe(this.shouldShowAbortAction||this.hasCollectionEntries?this.Dd():null)} ${Pe(this.Nd())}</div></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Ut.prototype,"dropzone",2),h([g()],Ut.prototype,"qt",2),h([g()],Ut.prototype,"b",2),h([g()],Ut.prototype,"Ve",2),h([g()],Ut.prototype,"xr",2),h([g()],Ut.prototype,"Tr",2),h([g()],Ut.prototype,"Ga",2),h([g()],Ut.prototype,"ds",2);var Fi=class extends D{constructor(){super(...arguments);this.hs=O();}static{n(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Wa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Wa(),this.isActivityActive&&(this.Er(),this.Za()));}Wa(){this.registration&&(this.Zn()||this.registerActivity(this.activityType??"",{onActivate:n(()=>this.Za(),"onActivate"),onDeactivate:n(()=>this.Er(),"onDeactivate")}));}async Za(){await this.updateComplete;let t=this.hs.value;if(!t||!this.registration)return;this.Er();let e=this.$["*currentActivityParams"];try{this.ps=this.registration.render(t,e)??void 0;}catch(o){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,o);}}Er(){let t=this.hs.value;if(t){try{this.ps?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.ps=void 0,t.replaceChildren();}}disconnectedCallback(){this.Er(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${L(this.hs)}></div>`}};h([b({attribute:false})],Fi.prototype,"registration",2);var si=class extends E{constructor(){super(...arguments);this.mode="modal";this.St=[];}static{n(this,"PluginActivityRenderer");}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Ya())),this.Ya();}Ya(){let t=this.e.pluginManager;if(!t){this.St=[];return}this.St=t.snapshot().activities;}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${$i(this.St,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${$i(this.St,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],si.prototype,"mode",2),h([g()],si.prototype,"St",2);function Vi(r,i,t){return r?i(r):t?.(r)}n(Vi,"n");function bl(...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},{})}n(bl,"normalize");function Ct(...r){let i=bl(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}n(Ct,"classNames");function wl(r,...i){let t=bl(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}n(wl,"applyClassNames");var Gd=n(r=>lt.includes(r),"isTabIdValue"),Tl=n(r=>{if(!r)return lt;let i=Z(r).filter(Gd);return i.length===0?lt:i},"parseTabs");function Cl(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":K.CROP,"*on.retryNetwork":n(()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Lt,t.src=e;}r.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":n(i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=at(oe(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.apply"),"*on.cancel":n(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}n(Cl,"initState");var El="<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 Ue={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ni=class extends E{constructor(){super(...arguments);this.kt=false;this.Xa=Ue;this.Qa=Ue.visible;this.Ja=Ue.hidden;this.fs=false;this.tl=false;}static{n(this,"PresenceToggle");}set visible(t){this.kt=t,this.il();}get visible(){return this.kt}set styles(t){this.Xa=t,this.fs=true,this.Qa=t.visible??Ue.visible,this.Ja=t.hidden??Ue.hidden;}get styles(){return this.Xa}il(){this.style.visibility=this.kt?"inherit":"hidden",wl(this,{[Ue.transition]:!this.fs,[this.Qa]:this.kt,[this.Ja]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Vd(){this.tl||(this.tl=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.fs||this.classList.add(Ue.transition),this.il(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Vd();},0);}};h([b({type:Boolean})],ni.prototype,"visible",1),h([b({attribute:false})],ni.prototype,"styles",1);var Ni=class extends E{constructor(){super(...arguments);this.active=false;this.de=O();this.ms=false;this.gs=()=>{let t=this.de.value;t&&(this.rl(t),this.ms&&this.active&&this.vs());};}static{n(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.vs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.vs():this._d());}vs(){let t=this.de.value;if(!t)return;this.ms=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.gs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.gs,{once:true});}_d(){let t=this.de.value;t&&(this.ms=false,t.removeEventListener("transitionend",this.gs),this.rl(t));}rl(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.de)}></div></div>`}};h([b({type:Boolean,reflect:true})],Ni.prototype,"active",2);var X=n(r=>r??$,"o");var kt=class extends E{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{n(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.ol(),this.sl();}updated(t){super.updated(t),t.has("reverse")&&this.ol(),t.has("theme")&&this.sl();}ol(){this.style.flexDirection=this.reverse?"row-reverse":"";}sl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Bd(){let t=this.ys;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.zd}}get ys(){return !this.icon}get zd(){return !this.text&&!this.ys}render(){return y`<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=${dt(this.Bd)} name=${X(this.icon||void 0)} ?hidden=${this.ys} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],kt.prototype,"text",2),h([b({type:String})],kt.prototype,"icon",2),h([b({type:Boolean,reflect:true})],kt.prototype,"reverse",2),h([b({type:String,reflect:true})],kt.prototype,"theme",2),h([b({attribute:"aria-role"})],kt.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],kt.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],kt.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],kt.prototype,"active",2);function xl(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}n(xl,"pick");function ai(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),a=o>=2?"lightest":"normal";return Q(r,at(vr,oe(t),`quality/${a}`,`stretch/off/-/resize/${s}x`,`@clib/${$t}/${Dt}/uc-cloud-image-editor/`))}n(ai,"viewerImageSrc");var _i=class extends E{constructor(){super(...arguments);this.nl=`uc-backdrop-mask-${nt.generateFastUid()}`;this.Sr=false;this.wi=false;this.cl=O();this.xi=false;this.Ti=null;this.dl=t=>{this.pl(),this.Ei&&(t.stopPropagation(),t.preventDefault(),this.Ei=false);};this.hl=t=>{if(!this.Ei||!this.Cr||!this.xs)return;t.stopPropagation(),t.preventDefault();let e=this.Wt;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),a=t.x-o,l=t.y-s,c=a-this.Cr[0],u=l-this.Cr[1],{direction:p}=this.xs,d=this.Xd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.fl=t=>{if(!this.Dt)return;let e=Object.values(this.Dt).find(o=>{if(!o||this.Es(o.direction))return false;let a=o.interactionNode.getBoundingClientRect(),l={x:a.x,y:a.y,width:a.width,height:a.height};return Ua(l,[t.x,t.y])});this.al=e,this.pl();};}static{n(this,"CropFrame");}get Wt(){return this.cl.value??null}get Ei(){return this.wi}set Ei(t){this.wi!==t&&(this.wi=t,this.Ts());}Ts(){this.yi&&this.yi.setAttribute("class",Ct({"uc-guides--hidden":this.Sr,"uc-guides--visible":!this.Sr&&this.wi,"uc-guides--semi-hidden":!this.Sr&&!this.wi}));}Es(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let o=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return o||s}Hd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:a}=t,l=this.Wt;if(!l)return;let c=wt("mask",{id:this.nl}),u=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=wt("rect",{x:e,y:o,width:s,height:a,fill:"black"});c.appendChild(u),c.appendChild(p);let d=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.nl})`});l.appendChild(d),l.appendChild(c),this.vi=c,this.bs=p;}Kd(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}jd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:a}=t;this.bs&&ce(this.bs,{x:e,y:o,width:s,height:a});}Gd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.Dt)){for(let e of Object.values(this.Dt)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:a,groupNode:l}=e,c=o==="",u=o.length===2,{x:p,y:d,width:m,height:f}=t;if(c)ce(a,{x:p,y:d,width:m,height:f});else {let w=ue(Math.min(m,f)/82/2,0,1),T=u?Ma(t,o,w):Ia(t,o,w),C=T.center;if(!C)continue;let A=Math.max(Es*ue(Math.min(m,f)/Es/3,0,1),ka);ce(a,{x:C[0]-A,y:C[1]-A,width:A*2,height:A*2}),ce(s,{d:T.d});}let v=this.Es(o);l.setAttribute("class",Ct("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ce(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ul(t,e){let o=wt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=wt("rect",{fill:"transparent"}),a=wt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(s),t[e]={direction:e,pathNode:a,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.qd.bind(this,e));}Wd(){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.ul(t,s);}return this.ul(t,""),t}Zd(){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:`${Ai*o}%`,y1:"0%",x2:`${Ai*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:`${Ai*o}%`,x2:"100%",y2:`${Ai*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Yd(){let t=this.Wt;if(!t)return;let e=document.createDocumentFragment(),o=this.Zd();e.appendChild(o);let s=this.Wd();for(let{groupNode:a}of Object.values(s))e.appendChild(a);t.appendChild(e),this.Dt=s,this.yi=o,this.Ts();}qd(t,e){if(!this.Dt)return;let o=this.Dt[t];if(!o||this.Es(t))return;let s=this.$["*cropBox"],a=this.Wt;if(!a)return;let{x:l,y:c}=a.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.Ei=true,this.xs=o,this.Cr=[u,p],this.ll={...s};}Xd(t,e){let[o,s]=e,a=this.$["*imageBox"],l=this.ll??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=La({rect:l,delta:[o,s],imageBox:a}):l=Pa({rect:l,delta:[o,s],direction:t,aspectRatio:u,imageBox:a}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return We(Ye(l),a)}pl(){let t=this.al,e=this.Wt;e&&(e.style.cursor=t?Oa(t.direction):"initial");}ml(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.Wt;if(!e){this.Ti=t;return}this.Ti=null;let o=document.createDocumentFragment(),s=wt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.bi=s;}Qd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:o,width:s,height:a}=t;ce(this.bi,{x:e,y:o,height:a,width:s});}Cs(){this.xi&&(this.jd(),this.Gd(),this.Qd());}toggleThumbs(t){if(this.Dt)for(let e of Object.values(this.Dt)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",Ct("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Kd(),this.xi&&window.requestAnimationFrame(()=>{this.Cs();});}),this.sub("*cropBox",t=>{t&&(this.Sr=t.height<=M||t.width<=M,this.Ts(),this.xi&&window.requestAnimationFrame(()=>{this.Cs();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.ml(t);}),document.addEventListener("pointermove",this.hl,true),document.addEventListener("pointerup",this.dl,true);}firstUpdated(t){super.firstUpdated(t),this.Jd();}Jd(){let t=this.Wt;if(!(!t||this.xi)){if(this.Hd(),this.Yd(),this.xi=true,t.addEventListener("pointermove",this.fl,true),this.Ti){let e=this.Ti;this.Ti=null,this.ml(e);}this.Cs();}}disconnectedCallback(){super.disconnectedCallback(),this.Wt?.removeEventListener("pointermove",this.fl,true),document.removeEventListener("pointermove",this.hl,true),document.removeEventListener("pointerup",this.dl,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.cl)}></svg>`}};h([g()],_i.prototype,"wi",2);function Wd(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}n(Wd,"validateCrop");var Bi=class extends E{constructor(){super();this.ctxOwner=true;this.pe={width:0,height:0};this.i=null;this.z=false;this.bt=null;this.vl=O();this.As=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.gl=V(this.yl.bind(this),300),this.Ss=me(()=>{!this.isConnected||!this.z||(this.ks(),this.bl(),this.wl(),this.Ms(),this.Is());},100);}static{n(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.ks();}bl(){let t=this.$["*editorTransformations"],e=xl(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}ks(){let t=this.vl.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,a=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*a,t.height=s*a,e?.scale(a,a),this.Mt=t,this.i=e;}wl(){if(!this.z||!this.bt)return;let t=this.bt,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,a={width:this.offsetWidth,height:this.offsetHeight},l=Ze({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>a.width-e*2||l.height>a.height-e*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let d=a.width-e*2,m=d/u,f=0+e,v=e+(a.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=a.height-e*2,m=d*u,f=e+(a.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(a.width-e*2)/2-u/2,m=e+(a.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=Ye(c);}Ms(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(a){let{dimensions:[m,f],coords:[v,w]}=a,{width:T}=Ze(this.pe,s),C=l/T;t=We(Ye({x:c+v*C,y:u+w*C,width:m*C,height:f*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!Ra(t,e)||d&&!$a(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=We(Ye(t),e);}tp(){let t=this.i;if(!t)return;let e=this.bt;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:a,flip:l,rotate:c}=s,u=Ze({width:o.width,height:o.height},c);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(c*Math.PI*-1/180),t.scale(a?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}Is(){if(!this.z||!this.bt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.tp();}ep({fromViewer:t}){this.bt&&(this.As.value?.toggleThumbs(true),this.ip(),setTimeout(()=>{this.className=Ct({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}xl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:a,height:l}=e,{width:c,height:u}=Ze(this.pe,s),{width:p,height:d}=t,m=a/c,f=l/u;return [ue(Math.round(p/m),1,c),ue(Math.round(d/f),1,u)]}rp(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:a,height:l,x:c,y:u}=e,{width:p,height:d}=Ze(this.pe,s),{x:m,y:f}=t,v=a/p,w=l/d,T=this.xl(),C={dimensions:T,coords:[ue(Math.round((m-c)/v),0,p-T[0]),ue(Math.round((f-u)/w),0,d-T[1])]};if(!Wd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}yl(){if(!this.isConnected||!this.pe)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,a=this.rp(),c={...this.$["*editorTransformations"],crop:a,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.z&&(this.wl(),this.Ms(),this.Is());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.z){this.z=true,await this.updateComplete,this.ks(),this.pe=t,this.removeEventListener("transitionend",this.Tl);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.bt=await this.op(o,s),this.bl(),this.Ss(),this.ep({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.z&&this.bt&&this.Ss();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.z&&(!t&&this.yl(),this.z=false,this.sp(),this.className=Ct({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.As.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Tl,{once:true}),this.s?.disconnect());}sp(){let t=this.xl(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,a=Math.min(o,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${a}) translate(${(this.offsetWidth/2-l)/a}px, ${(this.offsetHeight/2-c)/a}px)`,this.style.transformOrigin=`${l}px ${c}px`;}ip(){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`;}Tl(){this.z||(this.bt=null);}async op(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(ai(t,o,e)),{promise:a,cancel:l,image:c}=Le(s),u=this._e(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.w?.(),this.w=l,a.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}_e(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 a=o.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Is();}),this.sub("*cropBox",()=>{this.bt&&this.gl();}),this.sub("*currentAspectRatio",()=>{this.Ms();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.z&&this.pe&&this.activate(this.pe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.bt&&(this.bt=null);}render(){return y`<canvas class="uc-canvas" ${L(this.vl)}></canvas><uc-crop-frame ${L(this.As)}></uc-crop-frame>`}};h([g()],Bi.prototype,"bt",2);function Xs(r,i,t){let e=t,o=t-1,s=new Array(e);for(let a=o;a>=0;a-=1)s[a]=Math.ceil((a*i+(o-a)*r)/o);return s}n(Xs,"linspace");function Zd(r){return typeof r=="string"&&r in Ot}n(Zd,"isOperationKey");function Yd(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}n(Yd,"splitBySections");function Xd(r,i,t){let e=Yd(r).find(([a,l])=>a<=i&&i<=l);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(a=>{let l=Math.abs(o-s)||1,c=Math.abs(i-o)/l;return o===a?i>t?1:1-c:s===a?i>=t?c:1:0})}n(Xd,"calculateOpacities");function Qd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}n(Qd,"calculateZIndices");function Sl(r,i){let t=Ot[r].keypointsNumber,{range:e,zero:o}=Ot[r];return [...new Set([...Xs(e[0],o,t+1),...Xs(o,e[1],t+1),o,i])].sort((s,a)=>s-a)}n(Sl,"keypointsRange");var fo=class extends E{constructor(){super();this.z=false;this.Os=true;this.n="initial";this.El={};this.Zt=[];this.Cl=0;this.Al=O();this.Ar=O();this.classList.add("uc-inactive_to_cropper"),this.Sl=V(async(t,e,o)=>{let s=n(()=>!this.kl(t,e)||this.$e!==o||!!this.Zt.find(u=>u.value===o),"shouldSkip");if(s())return;let a=await this.Ml(t,o),l=new Image;l.src=a.src;let c=this._e(a.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),a.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Zt,p=u.findIndex(v=>v.value>o);p===-1&&(p=u.length);let m=u[p]?.image,f=this.Ar.value;!f||m&&!f.contains(m)||(u.splice(p,0,a),m?f.insertBefore(l,m):f.appendChild(l),this.Rs(t,o));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{n(this,"EditorImageFader");}_e(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let a=o.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=o);}}Il(){window.cancelAnimationFrame(this.Cl),this.Cl=window.requestAnimationFrame(()=>{for(let t of this.Zt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}he({url:t=this.Be,filter:e=this.g??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let a={...this.El};o&&(o==="filter"?e&&typeof s=="number"&&(a.filter={name:e,amount:s}):typeof s=="number"&&(a[o]=s));let l=this.offsetWidth;return this.proxyUrl(ai(t,l,a))}async Ml(t,e){return {src:await this.he({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}kl(t,e){return this.n===t&&this.g===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Zd(this.n)||!Number.isFinite(e)||(this.Rs(this.n,e),this.Sl(this.n,this.g,e));}Rs(t,e){this.n=t,this.$e=e;let{zero:o}=Ot[t],s=this.Zt.map(c=>c.value),a=Xd(s,e,o),l=Qd(s,o);this.Zt.forEach((c,u)=>{let p=a[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.Il();}Ol(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async np(){this.a=this.a||this.Ol();let t=this.a;t&&this.Pl(t);let e=this.Zt.map(u=>u.src),{images:o,promise:s,cancel:a}=Ri(e);o.forEach(u=>{let p=this._e(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Ps=()=>{a(),this.Ps=void 0;};let l=this.n,c=this.g;if(await s,this.z&&this.kl(l,c)){let u=this.Ar.value;if(!u)return;u.replaceChildren(),this.Zt.forEach((p,d)=>{let m=o[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.Il();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.he(),o=this._e(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Ls?.();let a=Sl(o,s),l=await Promise.all(a.map(u=>this.he({url:t,filter:e,operation:o,value:u}))),{cancel:c}=Ri(l);this.Ls=c;}ap(t){let e=this.a||this.Ol();if(this.Pl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Ct({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this._e(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=Ct({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:a}){if(this.z=true,this.Os=false,await this.updateComplete,this.Be=t,this.n=e??"initial",this.$e=o,this.g=s,this.Ci=a,typeof o!="number"&&!s){let c=await this.he({operation:e,value:o});this.ap(c),this.Us();return}!e||typeof o!="number"||(this.Zt=await Promise.all(Sl(e,o).map(c=>this.Ml(e,c))),this.Rs(e,o),this.np());}deactivate({hide:t=true}={}){this.z=false,this.Ps?.(),this.Ls?.(),t&&!this.Os?(this.Os=true,this.a&&(this.a.style.transform="scale(1)"),this.className=Ct({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Us();},{once:true})):this.Us();}Pl(t){let e=this.Al.value;e&&(e.contains(t)||e.appendChild(t));}Us(){this.Ar.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Al)}></div><div class="uc-fader-layers-host" ${L(this.Ar)}></div>`}};var _t=class extends E{constructor(){super();this.$s=0;this.kr=O();this.Rl=O();this.Ul=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Yt=0;this.cp=t=>{t.stopPropagation();let e=this.$l(t);e!==null&&(this.Ds(e),this.lp("slider-input",e));};this.up=t=>{t.stopPropagation();let e=this.$l(t);e!==null&&this.Ds(e);};this.Dl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Fl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{n(this,"SliderUi");}lp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.$s=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Nl(this.Yt),this.Fs(),this.s=new ResizeObserver(()=>{this.Fs(),this.Mr(this.Yt);}),this.s.observe(this);let e=this.kr.value;e?.addEventListener("focus",this.Dl),e?.addEventListener("blur",this.Fl),window.setTimeout(()=>{this.Mr(this.Yt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Yt&&this.Ds(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Fs(),this.Mr(this.Yt)),t.has("zero")&&this.hasUpdated&&this.Vl(this.Yt);}Mr(t){this.Vl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(o-this.$s)/100;window.requestAnimationFrame(()=>{let c=this.Rl.value;c&&(c.style.transform=`translateX(${l}px)`);});}Vl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(o-this.$s)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${l}px)`);});}Fs(){let e=this.Ul.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),a=Math.ceil(s/15)-2;if(this.Ll===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.Si=p,e.innerHTML="",e.appendChild(l),this.Ll=a;}disconnectedCallback(){super.disconnectedCallback();let t=this.kr.value;t?.removeEventListener("focus",this.Dl),t?.removeEventListener("blur",this.Fl),this.s?.disconnect(),this.s=void 0;}Ds(t){Number.isFinite(t)&&(this.Yt=t,this.hasUpdated&&(this.Nl(t),this.Mr(t)));}Nl(t){let e=this.kr.value;e&&(e.value=String(t));}$l(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return y`<div class="uc-steps" ${L(this.Ul)}></div><div class="uc-thumb" ${L(this.Rl)}></div><input class="uc-input" type="range" ${L(this.kr)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Yt)} ?disabled=${this.disabled} @input=${this.cp} @change=${this.up} />`}};h([b({type:Boolean,reflect:true})],_t.prototype,"disabled",2),h([b({type:Number})],_t.prototype,"min",2),h([b({type:Number})],_t.prototype,"max",2),h([b({type:Number,attribute:false})],_t.prototype,"defaultValue",2),h([b({type:Number})],_t.prototype,"zero",2),h([g()],_t.prototype,"Yt",2);var Bt="original",zi=class extends E{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Ns=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{n(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.dp();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===Bt?void 0:this.state.value,filter:this.state.filter===Bt?void 0:this.state.filter,fromViewer:false});}dp(){let t=this.state.operation,{range:e,zero:o}=Ot[t],[s,a]=e;this.state={...this.state,min:s,max:a,zero:o};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(a),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:a;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:o;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Bt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.Ns} ></uc-slider-ui>`}};h([g()],zi.prototype,"state",2);function li(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)}}n(li,"parseFilterValue");var ht=class extends E{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{n(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}_l(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this._l();}updated(t){super.updated(t),t.has("active")&&this._l();}render(){let t=this.onClick,e=this.title;return y`<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>`}};h([g()],ht.prototype,"active",2),h([g()],ht.prototype,"title",2),h([g()],ht.prototype,"icon",2),h([g()],ht.prototype,"titleProp",2);var go=12,vo=16,Jd=n(r=>{let i=12,t=12;return r.width/r.height>=1?(i=go,t=Math.round(go*r.height/r.width)):(t=go,i=Math.round(go*r.width/r.height)),{width:i,height:t}},"getAdjustResolutions"),yo=class extends ht{static{n(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.pp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}pp(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${dt(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>`}},Hi=class extends ht{constructor(){super(...arguments);this.ot=null;}static{n(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.ot}set aspectRatio(t){if(this.ot===t)return;let e=this.ot;this.ot=t,this.requestUpdate("aspectRatio",e),t?this.Bl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.ot&&this.Bl(this.ot),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.ot?.id||t?.width===this.ot?.width&&t?.height===this.ot?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.ot?.id&&(this.$["*currentAspectRatio"]=this.ot);}Bl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=n(()=>{let a=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=a,a},"resolveTitle"),s=n(()=>{let a=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=a,a},"resolveTitleProp");o(),s(),e||this.requestUpdate();}hp(){let t=this.ot;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=Jd(t),s=(vo-e)/2,a=(vo-o)/2;return y`<uc-icon><svg viewBox="0 0 ${vo} ${vo}" aria-hidden="true" focusable="false" ><rect x=${s} y=${a} width=${e} height=${o} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${dt(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} >${this.hp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],Hi.prototype,"aspectRatio",1);function tp(r){let i=r+90;return i=i>=360?0:i,i}n(tp,"nextAngle");function ep(r,i){if(r==="rotate")return tp(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}n(ep,"nextValue");var ji=class extends ht{constructor(){super(...arguments);this.operation=void 0;}static{n(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=ep(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};h([b({type:String})],ji.prototype,"operation",2);var te=class extends ht{constructor(){super(...arguments);this.n="";this.g="";this.Ai="";this.Ir=0;this.a=null;this.He=false;this.isOriginal=false;this.zl=20;}static{n(this,"EditorFilterControl");}get filter(){return this.g}set filter(t){let e=t??"";if(this.g===e)return;let o=this.g;this.g=e,this.n="filter",this.isOriginal=e===Bt,this.icon=this.isOriginal?"original":"slider",this.zl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.Hl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.g),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.g),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:li(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.g;}fp(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.zl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),a=o>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.g!==Bt?{name:this.g,amount:l}:void 0,Q(this.Ai,at(vr,oe(c),`quality/${a}`,`scale_crop/${s}x${s}/center`,`@clib/${$t}/${Dt}/uc-cloud-image-editor/`))}async pi(t,e){t[0]?.isIntersecting?await this.Vs(e):this.w?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Ai=t??"",this.sub("*originalUrl",e=>{this.Ai=e??"",!this.isOriginal&&this.Ai&&this.isConnected&&!this.a&&(this.s?.observe(this),this.fe());}),this.isOriginal||(this.s?.observe(this),this.fe()),this.g&&this.Hl(this.g),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.g);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Vs():this.fe());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.w?.(),this.Or();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.fe()));}Hl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Vs(t){if(!this.isConnected){t?.unobserve(this),this.w?.(),this.w=void 0;return}if(!this.Ai){!this.ze&&!this.Xt&&this.fe();return}let e=++this.Ir,o="";try{o=await this.proxyUrl(this.fp());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.He=false,this.w?.();let{promise:s,cancel:a}=Le(o);this.w=()=>{a(),this.Ir===e&&(this.w=void 0);};try{if(await s,this.Ir!==e||!this.isConnected)return;this.a=o,this.He=!0,this.Or(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.fe();}finally{this.Ir===e&&(this.w=void 0);}}fe(){if(!this.isConnected||this.a||this.He||this.isOriginal||this.$["*networkProblems"]){this.Or();return}this.Xt&&cancelAnimationFrame(this.Xt),this.Xt=requestAnimationFrame(()=>{if(this.Xt=void 0,!this.isConnected||this.a||this.He||this.isOriginal){this.Or();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.Vs();return}this.ze=window.setTimeout(()=>{this.ze=void 0,this.fe();},500);});}Or(){this.Xt&&(cancelAnimationFrame(this.Xt),this.Xt=void 0),this.ze&&(window.clearTimeout(this.ze),this.ze=void 0);}get mp(){return !!(this.He&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.mp?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${dt(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.He} style=${Qt(e)}></div><uc-icon class=${dt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Qt(o)} ></uc-icon></button>`}};h([g()],te.prototype,"a",2),h([g()],te.prototype,"He",2),h([g()],te.prototype,"isOriginal",2),h([g()],te.prototype,"zl",2),h([b({type:String})],te.prototype,"filter",1);var Ki=class extends ht{constructor(){super(...arguments);this.n="";}static{n(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.Kl(e);}Kl(t){this.icon=t;let e=n(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),o=n(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),o();}initCallback(){super.initCallback(),this.n&&this.Kl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Ot[this.n],o=t[this.n],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:li(this.$["*operationTooltip"])});}};h([b({type:String})],Ki.prototype,"operation",1);var ip=1,Al=n(()=>{},"noopScrollListener"),Gi=class extends E{constructor(){super(...arguments);this.hiddenScrollbar=false;this.jl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>ip){this.scrollLeft+=o;return}this.scrollLeft+=e;};}static{n(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.jl,{passive:false}),this.addEventListener("scroll",Al,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.jl),this.removeEventListener("scroll",Al),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Gi.prototype,"hiddenScrollbar",2);var vt=class extends E{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Gl=true;this.tabList=[...lt];this.activeTab=K.CROP;this.Pr=true;this._s=false;this.ql=null;this.Wl=0;this.Zl=0;this.Lr=O();this.Yl=O();this.tabToggleRefs={[K.CROP]:O(),[K.TUNING]:O(),[K.FILTERS]:O()};this.Xl=()=>{this.me();};this.Mi=[];this.Rr=V(t=>{this.ki=t;},500);this.Ur=V(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===K.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let a=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${a}`;}else o=this.l10n(Bt);else if(this.showSubToolbar&&this.$["*tabId"]===K.TUNING&&e){s=true;let a=t?.[e]||Ot[e].zero;o=`${this.l10n(e)} ${a}`;}s&&(this.$["*operationTooltip"]=o),this._s=s;},0);this.gp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.vp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.yp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.bp={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Bt,"*currentOperation":null,"*operationTooltip":null};this.$t=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.w?.();let e=this.$["*on.cancel"];e?.();};this.Ks=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Op=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:li(this.$["*operationTooltip"])}),this.Lr.value?.apply(),this.Ql();};this.Pp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Lr.value?.cancel(),this.Ql();};this.Lp=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.Bs(o,{fromViewer:false}));};}static{n(this,"EditorToolbar");}Ql(){this.$["*showSlider"]=false,this.$["*tabId"]===K.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===K.TUNING&&(this._s=false);}Bs(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Jl(t,{fromViewer:e,force:o});}Jl(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.me();return}this.activeTab=t;let s=this.$["*faderEl"],a=this.$["*cropperEl"];t===K.CROP?(s?.deactivate(),this.$["*imageSize"]&&a?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),a?.deactivate());for(let l of lt){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.me();}}me(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.Yl.value;if(!e||!o)return;let s=e.offsetLeft,a=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Wl!==s||this.Zl!==a)&&(this.Wl=s,this.Zl=a,o.style.transform=`translateX(${s}px)`,o.style.width=`${a}px`);}get zs(){return this.Mi.length>=3}wp(t){switch(t){case K.CROP:return this.xp();case K.FILTERS:return this.Tp();case K.TUNING:return this.Ep();default:return []}}xp(){let t=[];if(this.zs)t.push(()=>this.Cp());else for(let e of this.Mi)t.push(()=>this.tc(e));for(let e of Fn)t.push(()=>this.Sp(e));return this.Hs(t)}Tp(){let e=[Bt,...Dn].map(o=>()=>this.Ap(o));return this.Hs(e)}Ep(){let t=$n.map(e=>()=>this.kp(e));return this.Hs(t)}Hs(t){return t.length?t.map(o=>o()):[]}Cp(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}tc(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Sp(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Ap(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}kp(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Mp(){return this.zs?this.Mi.map(t=>this.tc(t)):[]}async Ip(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ai(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.w?.();let{cancel:o}=Ri([e]);this.w=()=>{o(),this.w=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Mi=[...t],this.sub("*cropPresetList",e=>{this.Mi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Bs(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.Ur();}),this.sub("*currentOperation",()=>{this.Ur();}),this.sub("*tabId",e=>{this.Jl(e,{fromViewer:false,force:true}),this.Ur();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Ip(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,a]of s.entries())if(a){o=true;break}}this.Rr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Gl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.Bs(o,{fromViewer:false});return}this.me();}),this.sub("*operationTooltip",e=>{this.ql=e;}),this.Ur();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Xl);}firstUpdated(t){super.firstUpdated(t),this.$r(),this.me();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.me()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.$r();}disconnectedCallback(){window.removeEventListener("resize",this.Xl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}$r(){let t=this.Lr.value;t&&(this.$["*sliderEl"]=t);}Rp(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),a=s>=0?Qt({gridColumn:`${s+1}`}):$;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.yp}><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=${a} @click=${this.Lp} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Up(t){let e=this.wp(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:$}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this._s?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.zs;return y`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.ql??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.gp} ><div class="uc-tab-content-row">${lt.map(o=>Vi(this.activeTab===o,()=>this.Up(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Gl} .styles=${this.bp} @initial-render=${()=>this.me()} ><div class="uc-tab-toggles_indicator" ${L(this.Yl)} ></div>${lt.map(o=>this.Rp(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.$t} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ks}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.vp}><div class="uc-slider" ?hidden=${!this.Pr}><uc-editor-slider ${L(this.Lr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Pr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.Mp()}</div>`:$}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Pp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Op} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],vt.prototype,"ki",2),h([g()],vt.prototype,"showMainToolbar",2),h([g()],vt.prototype,"showSubToolbar",2),h([g()],vt.prototype,"Gl",2),h([g()],vt.prototype,"tabList",2),h([g()],vt.prototype,"activeTab",2),h([g()],vt.prototype,"Pr",2),h([g()],vt.prototype,"_s",2),h([g()],vt.prototype,"ql",2),h([g()],vt.prototype,"Mi",2);var kl=jt([...lt]),ot=class extends E{constructor(){super(...arguments);this.ctxOwner=true;this.$p="";this.he=Lt;this.Dp="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=kl;this.ec=false;this.Bt=false;this.js=null;this.Ii=null;this.Rr=V(t=>{this.ki=t;},300);this.Dr=O();this.ic=O();this.rc=O();this.oc=O();this.sc=()=>{this.Rr(false),this.he!==Lt&&(this.$["*networkProblems"]=false);};this.nc=()=>{this.Rr(false),this.$["*networkProblems"]=true;};this.Fp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Cl(this)};}static{n(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Np(){this.Bt||this.js||(this.js=this.updateComplete.then(()=>{this.js=null,this.Bt=true;}));}initCallback(){super.initCallback(),this.ac(),this.cc();}$r(){let t=this.rc.value;t&&(this.$["*faderEl"]=t);let e=this.ic.value;e&&(this.$["*cropperEl"]=e);let o=this.oc.value;o&&(this.$["*imgContainerEl"]=o);let s=this.Dr.value;s&&(this.$["*imgEl"]=s);}Vp(){let t=this.Dr.value;t&&(t.addEventListener("load",this.sc),t.addEventListener("error",this.nc));}_p(){let t=this.Dr.value;t&&(t.removeEventListener("load",this.sc),t.removeEventListener("error",this.nc));}get Bp(){let t=this.$["*tabId"];return Ct("uc-image",{"uc-image_hidden_to_cropper":t===K.CROP,"uc-image_hidden_effects":t!==K.CROP})}uc(){if(this.Ii)return this.Ii;let t=3e3;return this.Ii=new Promise((e,o)=>{let s=n(()=>{window.clearTimeout(p),u.disconnect(),this.Ii=null;},"cleanup"),a=n(()=>{let{width:d,height:m}=this.getBoundingClientRect();return d>0&&m>0},"hasNonZeroSize"),l=n(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=n(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),o(d);},"rejectWait"),u=new ResizeObserver(d=>{let[m]=d;m&&m.contentRect.width>0&&m.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(a()){l();return}u.observe(this);}),this.Ii}firstUpdated(t){super.firstUpdated(t),this.$r(),this.Vp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this._p(),super.disconnectedCallback();}render(){let t=this.Dp??"",e=this.$p??"",o=this.he||Lt,s=this.ki,a=this.ec;return y` ${Ke(El)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${a}><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.Fp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${L(this.oc)}><img src=${o} class=${this.Bp} ${L(this.Dr)} />${Vi(this.Bt,()=>y`<uc-editor-image-cropper ${L(this.ic)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.rc)}></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">${Vi(this.Bt,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.ac(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.cc();}ac(){let t=this.tabs||kl;this.$["*tabList"]=Tl(t);}cc(){let t=to(this.cropPreset??""),e=null;if(this.cdnUrl){let o=Ho(this.cdnUrl),s=jo(o);if(Array.isArray(s?.crop?.dimensions)){let[a,l]=s.crop.dimensions;e=Fa(a,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.uc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=gr(t),o=re(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=Ho(t),a=jo(s);this.$["*editorTransformations"]=a;}else if(this.uuid){let t=re(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"]===K.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(l=>l.json()),{width:s,height:a}=o;this.$["*imageSize"]={width:s,height:a},this.$["*tabId"]===K.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.Np();}}}async initEditor(){try{await this.uc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ec=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=at(oe(t),"preview"),s=Q(e,o),a={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:true,composed:true}));},false);}};h([g()],ot.prototype,"$p",2),h([g()],ot.prototype,"he",2),h([g()],ot.prototype,"Dp",2),h([g()],ot.prototype,"ki",2),h([b({type:String,reflect:true})],ot.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],ot.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],ot.prototype,"cropPreset",2),h([b({type:String,reflect:true})],ot.prototype,"tabs",2),h([g()],ot.prototype,"ec",2),h([g()],ot.prototype,"Bt",2);var Qs={};rn(Qs,{CloudImageEditorActivity:()=>qi});var bo=class extends ot{static{n(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var qi=class extends I{constructor(){super(...arguments);this.at=null;}static{n(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.at&&this.at.cropPreset!==t&&(this.at={...this.at,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.at&&this.at.tabs!==t&&(this.at={...this.at,tabs:t});}),this.zp();}disconnectedCallback(){super.disconnectedCallback(),this.Hp();}Ks(t){if(!this.Oi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Oi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(D.activities.CLOUD_IMG_EDIT),this.historyBack();}$t(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(D.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.Oi=e;let o=this.Oi.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.at=this.Kp(o);}Hp(){this.Oi=void 0,this.at=null;}render(){if(!this.at)return $;let{cdnUrl:t,cropPreset:e,tabs:o}=this.at;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${X(e)} tabs=${X(o)} @apply=${this.Ks} @cancel=${this.$t} @change=${this.handleChange} ></uc-cloud-image-editor>`}Kp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],qi.prototype,"at",2);var ci=class extends I{constructor(){super(...arguments);this.Be="";this.Ns=t=>{this.Be=t.target?.value??"";};this.ss=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Be.trim();e&&(this.api.addFileFromUrl(e,{source:R.URL}),this.routerLayer.navigateAfterFileAdd());};}static{n(this,"UrlSource");}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.ss}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.Ns} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Be} >${this.l10n("upload-url")}</button></form>`}};h([g()],ci.prototype,"Be",2);var Ml=n(()=>{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}},"getTopLevelOrigin");var rp=n(r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),Il=n((r,i="i")=>{let t=r.split("*").map(rp);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var op=["--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"],sp=n((r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),"getCssValue"),Ol=n(r=>{let i={};for(let t of op){let e=sp(r,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var np=["selected-files-change","toolbar-state-change"],ap=n(r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!np.includes(i))},"isWhitelistedMessage"),wo=class{constructor(i,t){this.Fr=new Map;this.pc=i=>{if(i.source!==this.Gs)return;let t=i.data;if(!ap(t))return;let e=this.Fr.get(t.type);if(e)for(let o of e)o(t);};this.Gs=i,this.dc=t,window.addEventListener("message",this.pc);}static{n(this,"MessageBridge");}on(i,t){let e=this.Fr.get(i)??new Set;this.Fr.has(i)||this.Fr.set(i,e),e.add(t);}send(i){let t=this.dc();this.Gs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.pc);}};function Ll(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("&")}n(Ll,"queryString");var lp={[gt.GDRIVE]:"ngdrive"},yt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ke=O();this.Nr=null;this.qs=[];this.Ws=false;this.Zs=false;this.Ys=false;this.Xs=false;this.Vr=false;this.Qs=false;this.Js="uc-hidden";this.hc=true;this.ns=()=>{for(let t of this.qs){let e=this.Gp(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.routerLayer.navigateAfterFileAdd();};this.$t=()=>{this.historyBack();};this.Qp=()=>{this.wt?.send({type:"select-all"});};this.Jp=()=>{this.wt?.send({type:"deselect-all"});};}static{n(this,"ExternalSource");}get jp(){if(!this.Nr)return "";let{selectedCount:t,total:e}=this.Nr;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.fc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.mc(),this.fc());});}),this.subConfigValue("multiple",e=>{this.Vr=e;}),this.subConfigValue("localeName",()=>{this.gc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.vc(e);});}Gp(t){if(t.alternatives){let e=J(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=Il(o);for(let[a,l]of Object.entries(t.alternatives))if(s.test(a))return l}}return t.url}qp(t){this.hc=t.isVisible;}async Wp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Zp(t.selectedCount,t.total),this.Js=t.isReady?"":"uc-hidden",this.Ws=t.isReady,this.Zs=t.isReady&&t.selectedFiles.length>0,this.Vr=t.isMultipleMode&&t.total>0,this.Ys=t.selectedCount<t.total,this.Xs=t.selectedCount===t.total,this.qs=t.selectedFiles??[],this.Qs=t.total>0;}yc(){this.vc(this.cfg.externalSourcesEmbedCss),this.Yp(),this.gc();}Yp(){this.wt?.send({type:"set-theme-definition",theme:Ol(this)});}vc(t){this.wt?.send({type:"set-embed-css",css:t});}gc(){this.wt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Xp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:a}=this.activityParams,l=lp[a]??a,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Ml(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,o);return p.search=Ll(u),p.toString()}Zp(t,e){this.Nr={selectedCount:t,total:e};}fc(){let t=document.createElement("iframe");t.src=this.Xp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.yc.bind(this)),t.addEventListener("load",this.yc.bind(this)),this.Ke.value&&(this.Ke.value.innerHTML="",this.Ke.value.appendChild(t)),t.contentWindow&&(this.wt?.destroy(),this.wt=new wo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.wt.on("selected-files-change",this.Wp.bind(this)),this.wt.on("toolbar-state-change",this.qp.bind(this)),this.bc());}mc(){this.wt?.destroy(),this.wt=void 0,this.Ke.value&&(this.Ke.value.innerHTML=""),this.bc();}bc(){this.qs=[],this.Ws=false,this.Zs=false,this.Ys=false,this.Xs=false,this.Vr=false,this.Qs=false,this.Js="uc-hidden",this.Nr=null;}disconnectedCallback(){super.disconnectedCallback(),this.mc();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.Ke)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.hc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Vr} ><span>${this.jp}</span><button type="button" @click=${this.Qp} ?hidden=${!this.Ys} >${this.l10n("select-all")}</button><button type="button" @click=${this.Jp} ?hidden=${!this.Xs} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ns} ?disabled=${!this.Zs} ?hidden=${!this.Qs} ><uc-spinner ?hidden=${this.Ws}></uc-spinner><span class=${this.Js}>${this.l10n("done")}</span></button></div></div>`}};h([g()],yt.prototype,"qs",2),h([g()],yt.prototype,"Ws",2),h([g()],yt.prototype,"Zs",2),h([g()],yt.prototype,"Ys",2),h([g()],yt.prototype,"Xs",2),h([g()],yt.prototype,"Vr",2),h([g()],yt.prototype,"Qs",2),h([g()],yt.prototype,"Js",2),h([g()],yt.prototype,"hc",2);var Pl=n(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var cp={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},up=["camera","microphone"];function To(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}n(To,"formatTime");var Ul="image/jpeg",Rl="video/webm",j=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._r=null;this.tn=false;this.Pi=[];this.It=null;this.Ot=null;this.Br=null;this.zr=null;this.v=null;this.Li={};this.Mt=null;this.i=null;this.je=[];this.Ge=[];this.th={};this.Hr=[];this.Kr=null;this.wc=()=>{this.xc(),this.Ri="pause";};this.Tc=()=>{this.Ri="play",this.eh();};this.Ui=O();this.de=O();this.W=O();this.Ec=0;this.Cc=0;this.Sc=null;this.jr=true;this.Gr=true;this.ih=Pl();this.Ac=[];this.ge=true;this.en="";this.qe=true;this.ve=true;this.We=true;this.kc=[];this.ye=true;this.rn=true;this.be=true;this.Ft=true;this.we=true;this.Ze="camera-full";this.Ri="play";this.Mc="microphone";this.qr="uc-shot-btn uc-camera-action";this.rh=()=>{if(this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===U.PHOTO&&this.oh(),this.v===U.VIDEO){if(this.It?.state==="recording"){this.Ic();return}this.sh();}};this.nh=t=>{let e=t.target;e&&(this.zr=e.value,this.Ye());};this.ah=t=>{let e=t.target;e&&(this.Br=e.value,this.Ye());};this.lh=()=>{this.Ye();};this.ch=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.rh();};this.uh=()=>{this.dh();};this.ph=()=>{this.hh();};this.fh=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.mh();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.vh();};this.Oc=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.Pc(o);};this.Lc=()=>{let t=Math.floor((performance.now()-this.Ec+this.Cc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ui.value;s&&(s.textContent=To(e)),this.Ic();return}let o=this.Ui.value;o&&(o.textContent=To(e));}else {let e=this.Ui.value;e&&(e.textContent=To(t));}this.Xe=requestAnimationFrame(this.Lc);};this.yh=()=>{this.Ec=performance.now(),this.Cc=0,this.Lc();};this.Rc=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.xc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.de.value;s&&(s.style.transform=`scaleX(${e/o})`);let a=this.Ui.value;a&&(a.textContent=To(e)),this.Xe=requestAnimationFrame(this.xc);};this.eh=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.Xe=null;this.sh=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Rl)?this.Li.mimeType=Rl:this.Li.mimeType="video/mp4",this.Ot&&(this.It=new MediaRecorder(this.Ot,this.Li),this.It.start(),this.It.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.yh(),this.classList.add("uc-recording"),this.$i(At.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Ic=()=>{this.It?.addEventListener("stop",()=>{this.bh(),this.Rc(),this.$i(At.STOP);}),this.It?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.dh=()=>{if(this.It?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.hh=()=>{this.Ot?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Mc=t.enabled?"microphone":"microphone-mute",this.rn=!t.enabled;});};this.bh=()=>{try{let t=new Blob(this.Pi,{type:this.It?.mimeType}),e=URL.createObjectURL(t),o=this.W.value;if(!o)return;o.muted=!1,o.volume=1,this.Di(null),o.src=e,this.wh(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.mh=()=>{if(this.$i(At.RETAKE),this.v===U.VIDEO){this.Di(this.Ot);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.vh=()=>{if(this.$i(At.ACCEPT),this.v===U.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let a=this.Uc("camera","jpeg",Ul,s);this.$c(a);},Ul);return}let t=new Blob(this.Pi,{type:this.It?.mimeType}),e=this.xh(this.It?.mimeType),o=this.Uc("video",e,`video/${e}`,t);this.$c(o),this.Pi=[];};this.Th=t=>{t===At.SHOT&&(this.we=true,this.ve=true,this.Ft=true,this.We=false,this.ge=true),(t===At.RETAKE||t===At.ACCEPT)&&(this.we=!this.Nt.includes(U.VIDEO),this.Ft=!this.Nt.includes(U.PHOTO),this.ve=false,this.We=true,this.ge=this.je.length<=1);};this.Eh=t=>{t===At.PLAY&&(this.qe=false,this.Ft=true,this.ge=true,this.ye=true,this.Ri="pause",this.Ze="square",this.qr="uc-shot-btn uc-camera-action uc-stop-record"),t===At.STOP&&(this.qe=false,this.ve=true,this.be=true,this.We=false),(t===At.RETAKE||t===At.ACCEPT)&&(this.qe=true,this.we=!this.Nt.includes(U.VIDEO),this.Ft=!this.Nt.includes(U.PHOTO),this.ve=false,this.We=true,this.be=!this.cfg.enableAudioRecording,this.Ze="video-camera-full",this.qr="uc-shot-btn uc-camera-action",this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.ge=this.je.length<=1);};this.$i=t=>{this.v===U.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Th(t),this.v===U.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Eh(t);};this.Pc=t=>{t===U.PHOTO&&(this.Ze="camera-full",this.ye=true,this.be=true),t===U.VIDEO&&(this.Ri="play",this.Ze="video-camera-full",this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.be=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.Uc=(t,e,o,s)=>{let a=Date.now(),l=`${t}-${a}.${e}`;return new File([s],l,{lastModified:a,type:o})};this.$c=t=>{this.api.addFileFromObject(t,{source:R.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=V(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===U.VIDEO&&this.cfg.enableAudioRecording,o=this.v===U.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.jr=false,this.ve=false,this.Ft=!this.Nt.includes(U.PHOTO),this.we=!this.Nt.includes(U.VIDEO),this.Gr=true,this.qe=true,this.Ze=o,this.be=!e,this.ye=!e):t==="prompt"?(this.en="camera-permissions-prompt",this.jr=true,this.ve=true,this.Ft=true,this.Gr=false,this.an()):(this.en="camera-permissions-denied",this.jr=true,this.Gr=false,this.Ft=!this.Nt.includes(U.PHOTO),this.we=!this.Nt.includes(U.VIDEO),this.We=true,this.qr="uc-shot-btn uc-camera-action",this.an());},300);this.Ch=()=>{if(!this.Ot)return false;let t=this.Ot?.getAudioTracks(),e=this.Ot?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.an=()=>{this.tn&&(this.W.value&&(this.W.value.volume=0),this.Kr?.getTracks?.()?.[0]?.stop(),this.sn(this.W.value),this.Di(null),this.Ch(),this.Rc(),this.tn=false);};this.Ye=async()=>{let t={video:{...cp},audio:this.cfg.enableAudioRecording?{}:false};this.zr&&(t.video={deviceId:{exact:this.zr}}),this.Br&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Br}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.Ot=await navigator.mediaDevices.getUserMedia(t),this.Ot.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.Ot),this.tn=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Dc=()=>{this.Ye();};this.Sh=async()=>{try{this.Wr();for(let t of up){let e=await navigator.permissions.query({name:t});this.th[t]=e,e.addEventListener("change",this.Dc),this.Hr.push(()=>{e.removeEventListener("change",this.Dc);});}this._r=()=>{this.Wr();};}catch(t){this.Wr(),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.Ye();}};this.Ah=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.ln(),navigator.mediaDevices.addEventListener("devicechange",this.ln);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.ln=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.je=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ge=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Ac=this.je,this.ge=this.je.length<=1,this.zr=this.je[0]?.value??null,this.kc=this.Ge,this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.Br=this.Ge[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.kh=async()=>{await this.Sh(),await this.Ah(),await this.Ye(),this.Fc(this.Nt);};this.Mh=async()=>{this._r&&this._r(),window.chrome||this.Fi("denied"),this.an();};this.Fc=t=>{this.we=!t.includes(U.VIDEO),this.Ft=!t.includes(U.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.Pc(e);};}static{n(this,"CameraSource");}wh(t){this.sn(t),t.addEventListener("play",this.wc),t.addEventListener("pause",this.Tc);}sn(t){t?.removeEventListener("play",this.wc),t?.removeEventListener("pause",this.Tc);}Di(t){this.Kr!==t&&(this.Kr=t,this.nn());}nn(){let t=this.W.value;if(!t)return;let e=this.Kr??null;t.srcObject!==e&&(t.srcObject=e);}oh(){if(this.$i("shot"),this.Mt=document.createElement("canvas"),this.i=this.Mt.getContext("2d"),!this.i)throw new Error("Failed to get canvas context");let t=this.W.value;if(!t)throw new Error("Video element not found");this.Mt.height=t.videoHeight,this.Mt.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.Mt.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}xh(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 a=o.slice(1).join("/")?.split(";")[0];if(a&&e[a])return e[a]}}return "avi"}get Nt(){return J(this.cfg.cameraModes).filter(t=>t===U.PHOTO||t===U.VIDEO)}Wr(){if(this.Hr.length!==0){for(let t of this.Hr)t();this.Hr=[],this._r=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Sc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.be=!t,this.rn=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=Z(t);this.Fc(e.filter(o=>o===U.PHOTO||o===U.VIDEO));}),this.kh();}firstUpdated(t){super.firstUpdated(t),this.nn();}updated(t){super.updated(t),this.nn();}Ih(){this.Wr(),navigator.mediaDevices?.removeEventListener("devicechange",this.ln),this.sn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.Mh(),this.Ih();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ge}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Ac} ?hidden=${this.ge} @change=${this.nh} ></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=${Qt({transform:this.Sc})} ?hidden=${this.jr} ${L(this.W)} ></video><div class="uc-message-box" ?hidden=${this.Gr}><span>${this.l10n(this.en)}</span><button type="button" @click=${this.lh} ?hidden=${this.ih} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.qe}><button data-id="photo" type="button" class=${dt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===U.PHOTO})} @click=${this.Oc} ?hidden=${this.Ft} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${dt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===U.VIDEO})} @click=${this.Oc} ?hidden=${this.we} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.uh} ?hidden=${this.qe} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${L(this.Ui)}> 00:00 </span><span ${L(this.de)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.We} ><button type="button" class="uc-secondary-btn" @click=${this.fh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.gh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.ch} class=${this.qr} ?hidden=${this.ve} ><uc-icon name=${this.Ze}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ph} ?hidden=${this.be} data-testid="toggle-microphone" ><uc-icon name=${this.Mc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.kc} ?hidden=${this.ye} ?disabled=${this.rn} @change=${this.ah} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],j.prototype,"Sc",2),h([g()],j.prototype,"jr",2),h([g()],j.prototype,"Gr",2),h([g()],j.prototype,"ih",2),h([g()],j.prototype,"Ac",2),h([g()],j.prototype,"ge",2),h([g()],j.prototype,"en",2),h([g()],j.prototype,"qe",2),h([g()],j.prototype,"ve",2),h([g()],j.prototype,"We",2),h([g()],j.prototype,"kc",2),h([g()],j.prototype,"ye",2),h([g()],j.prototype,"rn",2),h([g()],j.prototype,"be",2),h([g()],j.prototype,"Ft",2),h([g()],j.prototype,"we",2),h([g()],j.prototype,"Ze",2),h([g()],j.prototype,"Ri",2),h([g()],j.prototype,"Mc",2),h([g()],j.prototype,"qr",2);var $l={id:"camera",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({CameraSource:j}),r.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:n(()=>{if(!sa.htmlMediaCapture)return ["camera"];let t=Z(r.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:n(()=>{i.setCurrentActivity(F.CAMERA),i.setModalState(true);},"onSelect")}),r.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),r.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),r.registry.registerActivity({id:F.CAMERA,render:n(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var Js={};rn(Js,{BtnUi:()=>kt,CloudImageEditor:()=>bo,CloudImageEditorBlock:()=>ot,Config:()=>oi,CropFrame:()=>_i,EditorAspectRatioButtonControl:()=>Hi,EditorCropButtonControl:()=>ji,EditorFilterControl:()=>te,EditorFreeformButtonControl:()=>yo,EditorImageCropper:()=>Bi,EditorImageFader:()=>fo,EditorOperationControl:()=>Ki,EditorScroller:()=>Gi,EditorSlider:()=>zi,EditorToolbar:()=>vt,Icon:()=>de,LineLoaderUi:()=>Ni,PresenceToggle:()=>ni,SliderUi:()=>_t,defineComponents:()=>bt});var dp="cloud-image-editor",pp="<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>",Dl={id:dp,setup:n(async({pluginApi:r,uploaderApi:i})=>(bt({...Js,...Qs}),r.registry.registerIcon({name:"edit-file",svg:pp}),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:n(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:n(e=>{i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),r.registry.registerActivity({id:F.CLOUD_IMG_EDIT,render:n(e=>{let o=document.createElement("uc-cloud-image-editor-activity");return e.append(o),()=>{e.replaceChildren();}},"render")}),i.on(k.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let o=r.config.get("cropPreset"),s=r.config.get("useCloudImageEditor"),a=r.config.get("cloudImageEditorAutoOpen"),l=i.f.size;s&&l===1&&(o||a)&&(i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var Fl={id:"external-sources",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({ExternalSource:yt}),r.registry.registerActivity({id:F.EXTERNAL,render:n(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(gt))r.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:n(()=>{i.setCurrentActivity(F.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var Eo=n(()=>{let r=[];return {stack:r,promiseReadJpegChunks:n(t=>new Promise((e,o)=>{let s=2,a=n((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{o(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=n(()=>a(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=n(()=>{let u=s;return a(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){o("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return a(t.slice(s,s+=m),f=>{if(f.byteLength!==m){o("Corrupted");return}r.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||o("Not Support"),a(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),hp=n(async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Nl=n(async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:a}=Eo();await s(r),a.forEach(u=>{if(u.marker===i)return e.push(u.startPos),o.push(u.length)});let l=[r.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(r.slice(c,e[u])),c=e[u]+o[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),mp=226,_l=n((r,i)=>Nl(r,mp,i.map(t=>t.buffer)),"replaceIccProfile"),fp=n(async r=>{try{return await _l(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),gp=n((r,i,t)=>new Promise((e,o)=>{let s=n(a=>{if(!a){o("Failed to convert canvas to blob");return}e(a);},"callback");r.toBlob(s,i,t),r.width=r.height=1;}),"canvasToBlob"),Wi=n(()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},"createCanvas"),vp=n(r=>{let{ctx:t,canvas:e}=Wi();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},"hasTransparency"),yp=n(async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),bp="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Co,wp=n(()=>new Promise(r=>{if(Co!==void 0)r(Co);else {let i=new Image;i.addEventListener("load",()=>{Co=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Co);}),i.src=bp;}}),"isBrowserApplyExifOrientation"),Tp=n((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 a=r.getUint16(o-2,e);for(t=0,s=a;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},"findExifOrientation"),Cp=n((r,i)=>{Tp(r,(t,e)=>r.setUint16(t,i,e));},"setExifOrientation"),Ep=n(async(r,i,t)=>(t&&Cp(i,1),Nl(r,225,[i.buffer])),"replaceExif"),xp=n((r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),Sp=n(r=>xp(new Image,r),"imageLoader"),Ap=[1,3],kp=[192,193,194,195,197,198,199,201,202,203,205,206,207],Vl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Mp=n(async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&kp.indexOf(o)>=0){let a=s.getUint8(5);Ap.indexOf(a)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Bl=n((r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},"memoize"),zl=n((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],a=!!i[s];if(s>t&&a||s<t&&!a)return s}return t},"memoKeySerializer"),ge={R:55,G:110,B:165,A:255},Ip=`rgba(${ge.R}, ${ge.G}, ${ge.B}, ${ge.A/255})`,Hl=n((r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Wi();e.width=1,e.height=1;let{canvas:s,ctx:a}=Wi();s.width=r,s.height=i,a&&(a.fillStyle=Ip,a.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ge.R&&l[1]===ge.G&&l[2]===ge.B&&l[3]===ge.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}},"canvasTest");function jl(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}n(jl,"wrapAsync");var Op=jl(Bl(Hl,zl)),Lp=jl(Bl(Hl,zl)),Kl=n(async(r,i)=>{let t=Vl.squareSide.find(a=>a*a>=r*i),e=Vl.dimension.find(a=>a>=r&&a>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([Op(t,t),Lp(e,1)]);if(o&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Gl=n(async(r,i,t)=>{try{let{ctx:e,canvas:o}=Wi();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Pp=n(({img:r,targetW:i,targetH:t})=>Gl(r,i,t),"native"),Up=n(function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,a=t;do o.push([s,a]),s=Math.round(s/e),a=Math.round(a/e);while(s<r*e);return o.reverse()},"calcShrinkSteps"),Rp=n(({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Up({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((a,[l,c],u)=>a.then(p=>Kl(l,c).then(()=>Gl(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),$p=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Dp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),tn=.71,Fp=n((r,i)=>{if(r.width*tn*r.height*tn<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)),a=Math.floor(i.size/Math.sqrt(i.size*o));return Kl(s,a).then(()=>{let{ctx:l}=Wi();return "imageSmoothingQuality"in l&&!$p()&&!Dp?Pp({img:r,targetW:s,targetH:a}):Rp({img:r,sourceW:t,targetW:s,targetH:a,step:tn})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),ql=n(async(r,i)=>{try{if(await Mp(r))throw new Error("Should skipped");let e=await Promise.allSettled([yp(r),wp(),hp(r)]),s=!e.some(w=>w.status==="rejected"),[a,l,c]=e,u=await fp(r).catch(()=>r),p=await Sp(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Fp(p,i),m="image/jpeg",f=i?.quality||.8;!s&&vp(d)&&(m="image/png",f=void 0);let v=await gp(d,m,f);if(s&&a.status==="fulfilled"&&a.value){let w=a.value,T=l.status==="fulfilled"?l.value:!1;v=await Ep(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await _l(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var Vp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Wl=n(r=>{if(typeof r!="string")return false;let i=Vp.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Zl={id:"image-shrink",setup({pluginApi:r}){r.registry.registerFileHook({type:"beforeUpload",handler:n(async({file:i})=>{let t=r.config.get("imageShrink");if(!t)return {file:i};let e=Wl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await ql(i,e)}}catch{return {file:i}}},"handler")});}};var Yl={id:"instagram",setup({pluginApi:r}){r.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:n(()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),"expand"),onSelect:n(()=>{},"onSelect")});}};var Xl={id:R.LOCAL,setup:n(({pluginApi:r,uploaderApi:i})=>{r.registry.registerSource({id:R.LOCAL,label:"src-type-local",icon:"local",onSelect:n(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Ql={id:"url-source",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({UrlSource:ci}),r.registry.registerActivity({id:F.URL,render:n(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),r.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:n(()=>{i.setCurrentActivity(F.URL),i.setModalState(true);},"onSelect")});},"setup")};var ui=[{configDeps:["useCloudImageEditor"],isEnabled:n(r=>!!r("useCloudImageEditor"),"isEnabled"),load:n(()=>Dl,"load")},{configDeps:["imageShrink"],isEnabled:n(r=>!!r("imageShrink"),"isEnabled"),load:n(()=>Zl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.LOCAL),"isEnabled"),load:n(()=>Xl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.CAMERA),"isEnabled"),load:n(()=>$l,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes("instagram"),"isEnabled"),load:n(()=>Yl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Object.values(gt).some(i=>Z(r("sourceList")).includes(i)),"isEnabled"),load:n(()=>Fl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.URL),"isEnabled"),load:n(()=>Ql,"load")}];var Zi=class extends Yt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{n(this,"FileUploaderRegular");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Oh(){return y`<uc-dynamic-btn></uc-dynamic-btn>`}Ph(){return y`<uc-simple-btn></uc-simple-btn>`}Lh(){return this.headless?null:this.dynamicButton?this.Oh():this.Ph()}render(){return y` ${super.render()} ${this.Lh()}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([b({type:Boolean})],Zi.prototype,"headless",2),h([b({attribute:"dynamic-button",type:Boolean})],Zi.prototype,"dynamicButton",2);var xo=class extends Yt{constructor(){super();this.Nc=false;this.$t=()=>{if(this.Vc){let t=this.$["*historyBack"];t?.();return}this._c&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderInline");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Vc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==D.activities.START_FROM}get _c(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}cn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});let t=this.cn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Nc=this.Vc||this._c;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t} ?hidden=${!this.Nc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};h([g()],xo.prototype,"Nc",2);var en="active",So="",ve=class extends Yt{constructor(){super();this.un=false;this.Zr=false;this.Yr=So;this.dn=So;this.mi="choose-file";this.ui=t=>{t.id===D.activities.CLOUD_IMG_EDIT&&(this.Yr=en),this.$["*currentActivity"]===D.activities.UPLOAD_LIST&&(this.Yr=en,this.Zr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.dn=en);};this.di=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.Zr=false),t.id===D.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderMinimal");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}cn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});let t=this.cn();this.sub("*currentActivity",e=>{e===D.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.dn=So):(this.Yr=So,this.Zr=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.un=!o):(this.style.removeProperty("--uc-grid-col"),this.un=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(tt.OPEN,this.ui),this.modalManager?.subscribe(tt.CLOSE,this.di);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(tt.OPEN,this.ui),this.modalManager?.unsubscribe(tt.CLOSE,this.di);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Zr} class=${this.dn}><uc-drop-area ?single=${this.un} initflow clickable tabindex="0" ><span>${this.l10n(this.mi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Yr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([g()],ve.prototype,"un",2),h([g()],ve.prototype,"Zr",2),h([g()],ve.prototype,"Yr",2),h([g()],ve.prototype,"dn",2),h([g()],ve.prototype,"mi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
7
+ var ko=Object.defineProperty;var Jl=Object.getOwnPropertyDescriptor;var n=(r,i)=>ko(r,"name",{value:i,configurable:true});var rn=(r,i)=>{for(var t in i)ko(r,t,{get:i[t],enumerable:true});};var h=(r,i,t,e)=>{for(var o=e>1?void 0:e?Jl(i,t):i,s=r.length-1,a;s>=0;s--)(a=r[s])&&(o=(e?a(i,t,o):a(o))||o);return e&&o&&ko(i,t,o),o};var It=[],ee=0,Yi=4,on=n(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=ee+Yi;s<It.length;)It[s]===e?It.splice(s,Yi):s+=Yi;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!It.length;for(let a of i)It.push(a,t.value,e,o);if(s){for(ee=0;ee<It.length;ee+=Yi)It[ee](It[ee+1],It[ee+2],It[ee+3]);It.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t},"atom");function Xi(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,a)=>{e.has(a)&&t(o,s,a);})}n(Xi,"listenKeys");function Mo(r,i,t){let e=Xi(r,i,t);return t(r.value),e}n(Mo,"subscribeKeys");var Io=n((r={})=>{let i=on(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i},"map");var G=class r{static{n(this,"PubSub");}static{this.Qe=new Map;}constructor(i,t){this.pt=i,this.xt=t;}get id(){return this.pt}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?Mo:Xi)(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.Qe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Io(i);return r.Qe.set(t,e),new r(t,e)}static deleteCtx(i){r.Qe.delete(i);}static getCtx(i){let t=r.Qe.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Qe.has(i)}};var Qi=globalThis,tr=Qi.ShadowRoot&&(Qi.ShadyCSS===void 0||Qi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nn=Symbol(),sn=new WeakMap,Ji=class{static{n(this,"n");}constructor(i,t,e){if(this.Bc=true,e!==nn)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(tr&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=sn.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&sn.set(t,i));}return i}toString(){return this.cssText}},an=n(r=>new Ji(typeof r=="string"?r:r+"",void 0,nn),"r");var ln=n((r,i)=>{if(tr)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Qi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},"S"),Oo=tr?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return an(t)})(r):r;var{is:ec,defineProperty:ic,getOwnPropertyDescriptor:rc,getOwnPropertyNames:oc,getOwnPropertySymbols:sc,getPrototypeOf:nc}=Object,er=globalThis,cn=er.trustedTypes,ac=cn?cn.emptyScript:"",lc=er.reactiveElementPolyfillSupport,di=n((r,i)=>r,"d"),pi={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}},ir=n((r,i)=>!ec(r,i),"f"),un={attribute:true,type:String,converter:pi,reflect:false,useDefault:false,hasChanged:ir};Symbol.metadata??=Symbol("metadata"),er.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static{n(this,"y");}static addInitializer(i){this.Xr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=un){if(t.state&&(t.attribute=false),this.Xr(),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&&ic(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=rc(this.prototype,i)??{get(){return this[t]},set(a){this[t]=a;}};return {get:o,set(a){let l=o?.call(this);s?.call(this,a),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??un}static Xr(){if(this.hasOwnProperty(di("elementProperties")))return;let i=nc(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(di("finalized")))return;if(this.finalized=true,this.Xr(),this.hasOwnProperty(di("properties"))){let t=this.properties,e=[...oc(t),...sc(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.Ni=new Map;for(let[t,e]of this.elementProperties){let o=this.Qr(t,e);o!==void 0&&this.Ni.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(Oo(o));}else i!==void 0&&t.push(Oo(i));return t}static Qr(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.xe=null,this.zc();}zc(){this.Jr=new Promise(i=>this.enableUpdating=i),this.Qt=new Map,this.Hc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Je??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Je?.delete(i);}Hc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ln(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Je?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Je?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.to(i,e);}Kc(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.Qr(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:pi).toAttribute(t,e.type);this.xe=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.xe=null;}}to(i,t){let e=this.constructor,o=e.Ni.get(i);if(o!==void 0&&this.xe!==o){let s=e.getPropertyOptions(o),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:pi;this.xe=o;let l=a.fromAttribute(t,s.type);this[o]=l??this.eo?.get(o)??l,this.xe=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let a=this.constructor;if(o===false&&(s=this[i]),e??=a.getPropertyOptions(i),!((e.hasChanged??ir)(s,t)||e.useDefault&&e.reflect&&s===this.eo?.get(i)&&!this.hasAttribute(a.Qr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Jr=this.jc());}C(i,t,{useDefault:e,reflect:o,wrapped:s},a){e&&!(this.eo??=new Map).has(i)&&(this.eo.set(i,a??t??this[i]),s!==true||a!==void 0)||(this.Qt.has(i)||(this.hasUpdated||e||(t=void 0),this.Qt.set(i,t)),o===true&&this.xe!==i&&(this.pn??=new Set).add(i));}async jc(){this.isUpdatePending=true;try{await this.Jr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Vi){for(let[o,s]of this.Vi)this[o]=s;this.Vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:a}=s,l=this[o];a!==true||this.Qt.has(o)||l===void 0||this.C(o,void 0,s,l);}}let i=false,t=this.Qt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Je?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.io();}catch(e){throw i=false,this.io(),e}i&&this.Gc(t);}willUpdate(i){}Gc(i){this.Je?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}io(){this.Qt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Jr}shouldUpdate(i){return true}update(i){this.pn&&=this.pn.forEach(t=>this.Kc(t,this[t])),this.io();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[di("elementProperties")]=new Map,zt[di("finalized")]=new Map,lc?.({ReactiveElement:zt}),(er.reactiveElementVersions??=[]).push("2.1.2");var Po=globalThis,dn=n(r=>r,"i"),rr=Po.trustedTypes,pn=rr?rr.createPolicy("lit-html",{createHTML:n(r=>r,"createHTML")}):void 0,Uo="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Ro="?"+Ht,cc=`<${Ro}>`,Ee=document,mi=n(()=>Ee.createComment(""),"c"),fi=n(r=>r===null||typeof r!="object"&&typeof r!="function","a"),$o=Array.isArray,yn=n(r=>$o(r)||typeof r?.[Symbol.iterator]=="function","d"),Lo=`[ \f\r]`,hi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hn=/-->/g,mn=/>/g,Te=RegExp(`>|${Lo}(?:([^\\s"'>=/]+)(${Lo}*=${Lo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),fn=/'/g,gn=/"/g,bn=/^(?:script|style|textarea|title)$/i,Do=n(r=>(i,...t)=>({Vt:r,strings:i,values:t}),"x"),y=Do(1);Do(2);Do(3);var st=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),vn=new WeakMap,Ce=Ee.createTreeWalker(Ee,129);function wn(r,i){if(!$o(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return pn!==void 0?pn.createHTML(i):i}n(wn,"V");var Tn=n((r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",a=hi;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,m=0;for(;m<c.length&&(a.lastIndex=m,p=a.exec(c),p!==null);)m=a.lastIndex,a===hi?p[1]==="!--"?a=hn:p[1]!==void 0?a=mn:p[2]!==void 0?(bn.test(p[2])&&(o=RegExp("</"+p[2],"g")),a=Te):p[3]!==void 0&&(a=Te):a===Te?p[0]===">"?(a=o??hi,d=-1):p[1]===void 0?d=-2:(d=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?Te:p[3]==='"'?gn:fn):a===gn||a===fn?a=Te:a===hn||a===mn?a=hi:(a=Te,o=void 0);let f=a===Te&&r[l+1].startsWith("/>")?" ":"";s+=a===hi?c+cc:d>=0?(e.push(u),c.slice(0,d)+Uo+c.slice(d)+Ht+f):c+Ht+(d===-2?l:f);}return [wn(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),gi=class r{static{n(this,"S");}constructor({strings:i,Vt:t},e){let o;this.parts=[];let s=0,a=0,l=i.length-1,c=this.parts,[u,p]=Tn(i,t);if(this.el=r.createElement(u,e),Ce.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(o=Ce.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Uo)){let m=p[a++],f=o.getAttribute(d).split(Ht),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?sr:v[1]==="?"?nr:v[1]==="@"?ar:Se}),o.removeAttribute(d);}else d.startsWith(Ht)&&(c.push({type:6,index:s}),o.removeAttribute(d));if(bn.test(o.tagName)){let d=o.textContent.split(Ht),m=d.length-1;if(m>0){o.textContent=rr?rr.emptyScript:"";for(let f=0;f<m;f++)o.append(d[f],mi()),Ce.nextNode(),c.push({type:2,index:++s});o.append(d[m],mi());}}}else if(o.nodeType===8)if(o.data===Ro)c.push({type:2,index:s});else {let d=-1;for(;(d=o.data.indexOf(Ht,d+1))!==-1;)c.push({type:7,index:s}),d+=Ht.length-1;}s++;}}static createElement(i,t){let e=Ee.createElement("template");return e.innerHTML=i,e}};function xe(r,i,t=r,e){if(i===st)return i;let o=e!==void 0?t.qc?.[e]:t.Wc,s=fi(i)?void 0:i.ro;return o?.constructor!==s&&(o?.hn?.(false),s===void 0?o=void 0:(o=new s(r),o.oo(r,t,e)),e!==void 0?(t.qc??=[])[e]=o:t.Wc=o),o!==void 0&&(i=xe(r,o.Zc(r,i.values),o,e)),i}n(xe,"M");var or=class{static{n(this,"R");}constructor(i,t){this.mn=[],this.Tt=void 0,this.gn=i,this.m=t;}get parentNode(){return this.m.parentNode}get X(){return this.m.X}u(i){let{el:{content:t},parts:e}=this.gn,o=(i?.creationScope??Ee).importNode(t,true);Ce.currentNode=o;let s=Ce.nextNode(),a=0,l=0,c=e[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new De(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new lr(s,this,i)),this.mn.push(u),c=e[++l];}a!==c?.index&&(s=Ce.nextNode(),a++);}return Ce.currentNode=Ee,o}p(i){let t=0;for(let e of this.mn)e!==void 0&&(e.strings!==void 0?(e.Et(i,e,t),t+=e.strings.length-2):e.Et(i[t])),t++;}},De=class r{static{n(this,"k");}get X(){return this.m?.X??this.vn}constructor(i,t,e,o){this.type=2,this.r=$,this.Tt=void 0,this.Pt=i,this.Te=t,this.m=e,this.options=o,this.vn=o?.isConnected??true;}get parentNode(){let i=this.Pt.parentNode,t=this.m;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Pt}get endNode(){return this.Te}Et(i,t=this){i=xe(this,i,t),fi(i)?i===$||i==null||i===""?(this.r!==$&&this.Ee(),this.r=$):i!==this.r&&i!==st&&this.yn(i):i.Vt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):yn(i)?this.k(i):this.yn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.Te)}T(i){this.r!==i&&(this.Ee(),this.r=this.O(i));}yn(i){this.r!==$&&fi(this.r)?this.Pt.nextSibling.data=i:this.T(Ee.createTextNode(i)),this.r=i;}$(i){let{values:t,Vt:e}=i,o=typeof e=="number"?this.Yc(i):(e.el===void 0&&(e.el=gi.createElement(wn(e.h,e.h[0]),this.options)),e);if(this.r?.gn===o)this.r.p(t);else {let s=new or(o,this),a=s.u(this.options);s.p(t),this.T(a),this.r=s;}}Yc(i){let t=vn.get(i.strings);return t===void 0&&vn.set(i.strings,t=new gi(i)),t}k(i){$o(this.r)||(this.r=[],this.Ee());let t=this.r,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(mi()),this.O(mi()),this,this.options)):e=t[o],e.Et(s),o++;o<t.length&&(this.Ee(e&&e.Te.nextSibling,o),t.length=o);}Ee(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.Te;){let e=dn(i).nextSibling;dn(i).remove(),i=e;}}setConnected(i){this.m===void 0&&(this.vn=i,this._i?.(i));}},Se=class{static{n(this,"H");}get tagName(){return this.element.tagName}get X(){return this.m.X}constructor(i,t,e,o,s){this.type=1,this.r=$,this.Tt=void 0,this.element=i,this.name=t,this.m=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=$;}Et(i,t=this,e,o){let s=this.strings,a=false;if(s===void 0)i=xe(this,i,t,0),a=!fi(i)||i!==this.r&&i!==st,a&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=xe(this,l[e+c],t,c),u===st&&(u=this.r[c]),a||=!fi(u)||u!==this.r[c],u===$?i=$:i!==$&&(i+=(u??"")+s[c+1]),this.r[c]=u;}a&&!o&&this.j(i);}j(i){i===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},sr=class extends Se{static{n(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===$?void 0:i;}},nr=class extends Se{static{n(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==$);}},ar=class extends Se{static{n(this,"z");}constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}Et(i,t=this){if((i=xe(this,i,t,0)??$)===st)return;let e=this.r,o=i===$&&e!==$||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==$&&(e===$||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},lr=class{static{n(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.Tt=void 0,this.m=t,this.options=e;}get X(){return this.m.X}Et(i){xe(this,i);}},Cn={I:De},uc=Po.litHtmlPolyfillSupport;uc?.(gi,De),(Po.litHtmlVersions??=[]).push("3.3.2");var cr=n((r,i,t)=>{let e=t?.renderBefore??i,o=e.Xc;if(o===void 0){let s=t?.renderBefore??null;e.Xc=o=new De(i.insertBefore(mi(),s),s,void 0,t??{});}return o.Et(r),o},"D");var Fo=globalThis,xt=class extends zt{static{n(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.so=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.so=cr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.so?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.so?.setConnected(false);}render(){return st}};xt.Rh=true,xt.finalized=true,Fo.litElementHydrateSupport?.({LitElement:xt});var dc=Fo.litElementPolyfillSupport;dc?.({LitElement:xt});(Fo.litElementVersions??=[]).push("4.2.2");var pc=/\\([0-9a-fA-F]{1,6} ?)/g;function hc(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}n(hc,"hasLeadingTrailingQuotes");function mc(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}n(mc,"trimQuotes");function fc(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}n(fc,"escapeQuotes");function En(r){let i=r;hc(r)&&(i=mc(i),i=i.replace(pc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=fc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}n(En,"parseCssPropertyValue");function Fe(r){class i extends r{constructor(){super(...arguments);this.bn=null;this.ao=null;}static{n(this,"CssDataMixinClass");}getCssData(o,s=false){let a=this.bn??Object.create(null);if(!Object.keys(a).includes(o)||!a[o]){this.ao||(this.ao=window.getComputedStyle(this));let l=this.ao.getPropertyValue(o).trim();try{a[o]=En(l);}catch(c){s||console.warn(`CSS Data error: ${o}`,c),a[o]=null;}}return this.bn=a,a[o]}}return i}n(Fe,"CssDataMixin");function ur(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Jt={};this.te=null;this.Bi=false;}static{n(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.te||(this.te=Array.from(this.childNodes)),super.connectedCallback();}Qc(){if(this.Bi)return;this.Bi=true,this.Jt={};let o=Array.from(this.childNodes),s=o.length?o:this.te??[];for(let a of s){let l=this.wn(a),c=this.Jt[l]??[];a instanceof Element&&(a.removeAttribute("slot"),a.removeAttribute("content-for")),c.push(a),this.Jt[l]=c;}this.te=null;}wn(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.wn(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}Jc(o){return !o.textContent||!o.textContent.trim()}tu(o){let s=this.Jt[o];return !s||s.every(a=>a instanceof Comment||a instanceof Text&&this.Jc(a))}update(o){!this.hasUpdated&&this.willYield&&this.Qc(),super.update(o);}yield(o,s){if(o===""&&!this.Jt[o]&&!this.Bi&&this.te?.length){let l=[];for(let c of this.te)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Jt[o]=l,this.Bi=true,this.te=null;}let a=this.Jt[o];return y` ${a} ${this.tu(o)?s:void 0} `}}return i}n(ur,"LightDomMixin");function Ve(r){class i extends r{static{n(this,"RegisterableElementMixinClass");}static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,o);}}return i}n(Ve,"RegisterableElementMixin");var ie=class extends Event{static{n(this,"s");}constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Ne=class{static{n(this,"s");}constructor(i,t,e,o){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(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,a)),this.unsubscribe=a;},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 ie(this.context,this.host,this.t,this.subscribe));}};var dr=class{static{n(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:n(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var Vo=class extends Event{static{n(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},_e=class extends dr{static{n(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[a,{consumerHost:l}]of this.subscriptions)s.has(a)||(s.add(a),l.dispatchEvent(new ie(this.context,l,a,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 Vo(this.context,this.host));}};var vc={attribute:true,type:String,converter:pi,reflect:false,hasChanged:ir},yc=n((r=vc,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:a}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(a,c,r,true,l);},init(l){return l!==void 0&&this.C(a,void 0,r,l),l}}}if(e==="setter"){let{name:a}=t;return function(l){let c=this[a];i.call(this,l),this.requestUpdate(a,c,r,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(r){return (i,t)=>typeof t=="object"?yc(r,i,t):((e,o,s)=>{let a=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),a?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}n(b,"n");function g(r){return b({...r,state:true,attribute:false})}n(g,"r");function V(r,i){let t,e=n(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}n(V,"debounce");var xn="ctx-name-context";function hr(){return function(r){class i extends r{constructor(...o){super(...o);this.mt=null;this.ti=false;this.lo=false;this.co=void 0;this.Ce=new Map;this.ei=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this._t;this.Bt=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this._t,this.eu=new Ne(this,{context:xn,callback:n(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.En=s,this.Tn();},"callback"),subscribe:true});}static{n(this,"SymbioteMixinClass");}static set template(o){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get xn(){return this.zi}set xn(o){let s=o??void 0;this.zi!==s&&(this.zi=s,this.Tn());}shouldUpdate(o){return this.Bt?super.shouldUpdate(o):false}get _t(){return this.xn||this.En||void 0}Tn(){if(this.ctxName=this._t,!(!this.ctxName||this.ti)){if(this.isConnected){this.uo();return}this.Hi=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this._t,this.ctxName&&(this.co?this.co.setValue(this.ctxName):this.co=new _e(this,{context:xn,initialValue:this.ctxName}));}Cn(){if(!(!this.mt||this.Ce.size===0)){for(let[o,{value:s,rewrite:a}]of this.Ce)this.mt.add(o,s,a);this.Ce.clear();}}Sn(){return !this.mt&&this._t&&this.po(),this.mt&&this.Cn(),this.mt}Ki(){let o=this.Sn();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}po(){let o=this.init$,s=this._t;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.mt){this.mt=G.getCtx(s)??G.registerCtx(o,s);for(let[a,l]of Object.entries(this.init$))this.mt.add(a,l,this.ctxOwner);this.Cn();}}get $(){return this._t&&this.po(),new Proxy({},{get:n((o,s)=>{if(typeof s=="string")return this.mt?.read(s)},"get"),set:n((o,s,a)=>(typeof s!="string"||this.mt?.pub(s,a),true),"set")})}sub(o,s,a=true){let l=this.Ki().sub(o,s,a);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=n(()=>{u||(u=true,c(),this.ei.delete(p));},"trackedRemove");return this.ei.add(p),p}pub(o,s){this.Ki().pub(o,s);}set$(o){for(let[s,a]of Object.entries(o))this.pub(s,a);}get sharedCtx(){return this.Ki()}has(o){return this.mt?.has(o)??false}add(o,s,a=false){let l=this.Sn();if(!l){if(!a&&this.Ce.has(o))return;this.Ce.set(o,{value:s,rewrite:a});return}this.Ce.delete(o),l.add(o,s,a);}add$(o,s=false){for(let[a,l]of Object.entries(o))this.add(a,l,s);}connectedCallback(){super.connectedCallback(),this.ti?this.Bt&&this.lo&&(this.lo=false,this.initCallback()):this.ctxName?(this.Hi=false,this.uo()):this.Hi&&this._t&&(this.Hi=false,this.uo());}uo(){if(this.ti)return;this.ti=true,this.po();let o=this.init$;if(Object.keys(o).length>0){let s=this.Ki();for(let[a,l]of Object.entries(o))s.read(a)===void 0&&s.pub(a,l),this.sub(a,V(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Bt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.iu(),super.disconnectedCallback(),this.ti&&(this.lo=true);}iu(){if(this.ei.size!==0){for(let o of [...this.ei])o();this.ei.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"xn",1),h([g()],i.prototype,"En",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Bt",2),i}}n(hr,"SymbioteMixin");var No=class extends Ve(hr()(Fe(ur(xt)))){static{n(this,"BaseComponent");}};var nt=class r{static{n(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var bc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function bt(r){for(let i in r){if(bc.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);}}n(bt,"defineComponents");var _o="UC";function wc(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[_o]){t(window[_o]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[_o];i&&bt(s),t(s);},document.head.appendChild(o);})}n(wc,"loadFileUploaderFrom");var vi={"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 Bo=new Map,Sn=new Map,An=n((r,i)=>{Bo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...vi,...i};return Bo.set(r,t),t},"defineLocaleSync"),Tc=n((r,i)=>{Sn.set(r,i);},"defineLocaleAsync"),kn=n((r,i)=>{typeof i=="function"?Tc(r,i):An(r,i);},"defineLocale"),Mn=n(async r=>{let i=Bo.get(r);if(!i){let t=Sn.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=An(r,e);}return i},"resolveLocaleDefinition");kn("en",vi);var S=n(r=>`*cfg/${r}`,"sharedConfigKey");var Z=n(r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),jt=n(r=>r.join(","),"serializeCsv");var In=n(r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),mr=n((...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>In(i)).join("/-/"),"joinCdnOperations"),at=n((...r)=>{let i=mr(...r);return i?`-/${i}/`:""},"createCdnUrlModifiers");function fr(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}n(fr,"extractFilename");function gr(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}n(gr,"extractUuid");function zo(r){let i=On(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}n(zo,"extractCdnUrlModifiers");function Ho(r){return zo(r).split("/-/").filter(Boolean).map(t=>In(t))}n(Ho,"extractOperations");function On(r){let i=new URL(r),t=fr(r),e=Ln(t)?Pn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}n(On,"trimFilename");function Ln(r){return r.startsWith("http")}n(Ln,"isFileUrl");function Pn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}n(Pn,"splitFileUrl");var Q=n((r,i,t)=>{let e=new URL(On(r)),o=t??fr(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&Ln(o)){let a=Pn(o);e.pathname=`${e.pathname}${s}${a.pathname||""}`,e.search=a.search,e.hash=a.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},"createCdnUrl"),re=n((r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var J=n((r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var yi=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}),Rn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Cc(r,i){if(typeof i=="number"){let t=i;return yi[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return yi[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return yi.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}n(Cc,"transformationToStr");function oe(r){return mr(...Rn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Cc(i,t)}).filter(i=>!!i))}n(oe,"transformationsToOperations");var vr=mr("format/auto","progressive/yes"),Kt=n(([r])=>typeof r<"u"?Number(r):void 0,"asNumber"),Un=n(()=>true,"asBoolean"),Ec=n(([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),"asFilter"),xc=n(([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)}},"asCrop"),Sc=Object.freeze({enhance:Kt,brightness:Kt,exposure:Kt,gamma:Kt,contrast:Kt,saturation:Kt,vibrance:Kt,warmth:Kt,filter:Ec,mirror:Un,flip:Un,rotate:Kt,crop:n(r=>{let[i,t]=r,{dimensions:e,coords:o}=xc([i,t]);return {dimensions:e,coords:o}},"crop")});function jo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!Rn.includes(e))continue;let s=e,a=Sc[s];try{let l=a(o);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}n(jo,"operationsToTransformations");var K=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),lt=Object.freeze([K.CROP,K.TUNING,K.FILTERS]),$n=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Dn=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"]),Fn=Object.freeze(["rotate","mirror","flip"]),Gt=yi,Ot=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var bi="https://ucarecdn.com",Ac="https://upload.uploadcare.com",kc="https://social.uploadcare.com",Mc="https://ucarecd.net",Ic={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:bi,cdnCnamePrefixed:Mc,baseUrl:Ac,socialBaseUrl:kc,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,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},it=Object.freeze(Ic);var yr=n((r,i)=>(...t)=>{let e=r();if(!e.read(S("debug")))return;let o=t;if(typeof t?.[0]=="function"){let a=t[0];o=a();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);},"createDebugPrinter");var q=class{constructor(i){this.ho=new Set;this.ee=null;this.E=yr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}static{n(this,"SharedInstance");}addSub(i){this.ho.add(i);}get ie(){if(!this.ee){let i={};this.ee=new Proxy(i,{set:n(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:n((t,e)=>{if(typeof e!="string")return;let o=S(e);return this.e.ctx.has(o)?this.e.ctx.read(o):it[e]},"get")});}return this.ee}destroy(){for(let i of this.ho)try{i();}catch{}this.ho.clear();}},Oc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},St=n((r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),Vn=n(r=>({get ctx(){return r()},get modalManager(){return St(r(),"*modalManager",false)},get pluginManager(){return St(r(),"*pluginManager")},get telemetryManager(){return St(r(),"*telemetryManager")},get localeManager(){return St(r(),"*localeManager")},get a11y(){return St(r(),"*a11y")},get routerLayer(){return St(r(),"*routerLayer")},get blocksRegistry(){return St(r(),"*blocksRegistry")},get eventEmitter(){return St(r(),"*eventEmitter")},get uploadCollection(){return St(r(),"*uploadCollection")},get secureUploadsManager(){return St(r(),"*secureUploadsManager",false)},get api(){return St(r(),"*publicApi")},get validationManager(){return St(r(),"*validationManager")},when(i,t){let e=Oc[i],o=r(),s=o.has(e)?o.read(e):void 0;if(s)return t(s),()=>{};let a;return a=o.sub(e,l=>{l&&(t(l),a?.());}),a},wait(i){return new Promise(t=>{let e;e=this.when(i,o=>{t(o),e?.();});})}}),"createSharedInstancesBag");var tt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),br=class extends q{constructor(){super(...arguments);this.re=new Map;this.Ct=new Set;this.c=new Map;}static{n(this,"ModalManager");}registerModal(t,e){this.re.set(t,e),this.Z(tt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.re.get(t);return e?(this.re.delete(t),this.Ct.delete(t),this.Z(tt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.re.get(t);return e?(this.Ct.add(t),this.Z(tt.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.re.get(t);return !e||!this.Ct.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.Ct.delete(t),this.Z(tt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.re.has(t)?this.Ct.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Ct.size>0}back(){if(this.Ct.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.Ct).pop();return t?this.close(t):false}closeAll(){let t=this.Ct.size;return this.Ct.clear(),this.Z(tt.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}Z(t,e){if(this.c.has(t))for(let o of this.c.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.re.clear(),this.c.clear(),this.Z(tt.DESTROY,{});}};var wr=n(r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function Nn(r){return Object.prototype.toString.call(r)==="[object Object]"}n(Nn,"isObject");var Lc=/\W|_/g;function Pc(r){return r.split(Lc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}n(Pc,"camelizeString");function _n(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Wt(t,{ignoreKeys:i})):r}n(_n,"camelizeArrayItems");function Wt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return _n(r,{ignoreKeys:i});if(!Nn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}Nn(o)?o=Wt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=_n(o,{ignoreKeys:i})),t[Pc(e)]=o;}return t}n(Wt,"camelizeKeys");var Uc=n(r=>new Promise(i=>setTimeout(i,r)),"delay");function Xo({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 a=[r,i,e].filter(Boolean).join("/"),l=[s,o].filter(Boolean).join("; ");return `${a} (${l})`}n(Xo,"getUserAgent$1");var Rc={factor:2,time:100};function $c(r,i=Rc){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:n(l=>Uc(l??s).then(()=>(t+=1,e(o))),"retry")})}return n(e,"runAttempt"),e(r)}n($c,"retrier");var Ae=class extends Error{static{n(this,"UploadcareError");}},Be=class r extends Ae{static{n(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Cr=n((r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),se=class r extends Ae{static{n(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Dc=500,zn=n(({check:r,interval:i=Dc,timeout:t,signal:e})=>new Promise((o,s)=>{let a,l;Cr(e,()=>{a&&clearTimeout(a),s(new se("Poll cancelled"));}),t&&(l=setTimeout(()=>{a&&clearTimeout(a),s(new se("Timed out"));},t));let c=n(()=>{try{Promise.resolve(r(e)).then(u=>{u?(l&&clearTimeout(l),o(u)):a=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");a=setTimeout(c,0);}),"poll"),P={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"},Er="application/octet-stream",Hn="original",ae=n(({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=r?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",Cr(o,()=>{p=true,c.abort(),l(new se);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(T){let C=T.split(": "),A=C.shift(),N=C.join(": ");A&&typeof A<"u"&&(f[A]=N);});let v=c.response,w=c.status;a({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new Be(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function Fc(r,...i){return r}n(Fc,"identity");var Vc=n(({name:r})=>r?[r]:[],"getFileOptions"),Nc=Fc,_c=n(()=>new FormData,"getFormData"),jn=n(r=>false,"isBuffer"),xr=n(r=>typeof Blob<"u"&&r instanceof Blob,"isBlob"),Sr=n(r=>typeof File<"u"&&r instanceof File,"isFile"),Ar=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),ze=n(r=>xr(r)||Sr(r)||jn()||Ar(r),"isFileData"),Bc=n(r=>typeof r=="string"||typeof r=="number"||typeof r>"u","isSimpleValue"),zc=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),Hc=n(r=>!!r&&typeof r=="object"&&"data"in r&&ze(r.data),"isFileValue");function Kn(r,i,t){if(Array.isArray(t))for(let e of t)Kn(r,`${i}[]`,e);else if(Hc(t)){let{name:e,contentType:o}=t,s=Nc(t.data,e,o??Er),a=Vc({name:e,contentType:o});r.push([i,s,...a]);}else if(zc(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else Bc(t)&&t&&r.push([i,t.toString()]);}n(Kn,"collectParams");function jc(r){let i=[];for(let[t,e]of Object.entries(r))Kn(i,t,e);return i}n(jc,"getFormDataParams");function kr(r){let i=_c(),t=jc(r);for(let e of t){let[o,s,...a]=e;i.append(o,s,...a);}return i}n(kr,"buildFormData");var ct=class r extends Ae{static{n(this,"UploadError");}code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},Kc=n(r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),qt=n((r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Kc(t)),e.toString()},"getUrl"),Gc="6.19.0",qc="UploadcareUploadClient",Wc=Gc;function ke(r){return Xo({libraryName:qc,libraryVersion:Wc,...r})}n(ke,"getUserAgent");var Zc="RequestThrottledError",Bn=15e3,Yc=1e3;function Xc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return Bn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Bn}n(Xc,"getTimeoutFromThrottledRequest");function le(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return $c(({attempt:o,retry:s})=>r().catch(a=>{if("response"in a&&a?.code===Zc&&o<t)return s(Xc(a));if(a instanceof Be&&o<e)return s((o+1)*Yc);throw a}))}n(le,"retryIfFailed");var Gn=n(r=>{let i="";return (xr(r)||Sr(r)||Ar(r))&&(i=r.type),i||Er},"getContentType"),qn=n(r=>{let i="";return Sr(r)&&r.name?i=r.name:xr(r)||jn()?i="":Ar(r)&&r.name&&(i=r.name),i||Hn},"getFileName");function Qo(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}n(Qo,"getStoreValue");function Jo(r){return Array.isArray(r)?r.join(","):typeof r=="string"?r:void 0}n(Jo,"getTagsValue");function Qc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=P.baseURL,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",url:qt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},data:kr({file:{data:r,name:t||qn(r),contentType:e||Gn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Qo(l),signature:s,expire:a,source:p,metadata:w,tags:Jo(T)}),signal:c,onProgress:u}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(Qc,"base");var qo;(function(r){r.Token="token",r.FileInfo="file_info";})(qo||(qo={}));function Jc(r,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Qo(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:w,tags:Jo(T)}),signal:p}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(Jc,"fromUrl");var mt;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(mt||(mt={}));var tu=n(r=>"status"in r&&r.status===mt.Error,"isErrorResponse");function eu(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}={}){return le(()=>ae({method:"GET",headers:i?{"X-UC-User-Agent":ke({publicKey:i,integration:o,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Wt(JSON.parse(c));if("error"in d&&!tu(d))throw new ct(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(eu,"fromUrlStatus");function iu(r,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:c,userAgent:u})},url:qt(t,"/group/",{jsonerrors:1}),data:kr({files:r,callback:e,pub_key:i,signature:o,expire:s,source:l}),signal:a}).then(({data:m,headers:f,request:v})=>{let w=Wt(JSON.parse(m));if("error"in w)throw new ct(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}n(iu,"group");function ru(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:o,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"GET",headers:{"X-UC-User-Agent":ke({publicKey:i,integration:s,userAgent:a})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=Wt(JSON.parse(u));if("error"in m)throw new ct(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(ru,"info");function ou(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=P.multipartChunkSize,baseURL:s="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w,tags:T}){return le(()=>ae({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:d,userAgent:m})},data:kr({filename:e||Hn,size:r,content_type:t||Er,part_size:o,UPLOADCARE_STORE:Qo(c),UPLOADCARE_PUB_KEY:i,signature:a,expire:l,source:p,metadata:w,tags:Jo(T)}),signal:u}).then(({data:C,headers:A,request:N})=>{let x=Wt(JSON.parse(C));if("error"in x)throw new ct(x.error.content,x.error.errorCode,N,x,A);return x.parts=Object.keys(x.parts).map(et=>x.parts[Number(et)]),x}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}n(ou,"multipartStart");function su(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Er}}).then(l=>(o&&o({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a})}n(su,"multipartUpload");function nu(r,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:o,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ke({publicKey:i,integration:s,userAgent:a})},data:kr({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:u,headers:p,request:d})=>{let m=Wt(JSON.parse(u));if("error"in m)throw new ct(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(nu,"multipartComplete");function Mr(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return zn({check:n(p=>ru(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?(u&&u({isComputable:true,value:1}),d):false),"check"),signal:c})}n(Mr,"isReadyPoll");var au=n((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),lu="0123456789abcdefghijklmnopqrstuvwxyz",cu=n(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=lu[Number(t)]+i,r=r/36n;}return i},"a"),uu=n((r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}},"c$1"),du=n(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),pu=10,hu=n(async r=>{let i=await du(r);return cu(i).slice(0,pu)},"d"),mu=n(async(r,i)=>{let t=await hu(r);return au(t,i)},"f"),fu=n((r,i)=>mu(r,i),"getPrefixedCdnBase"),Wn=n(({publicKey:r,baseCDN:i,prefixedBaseCDN:t=P.prefixedBaseCDN})=>r?i===void 0||uu(i,t)?fu(r,t):Promise.resolve(i):Promise.resolve(i??P.baseCDN),"resolveCdnBase");function gu(r){return "defaultEffects"in r}n(gu,"isGroupFileInfo");var Tr=class{static{n(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;tags;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=P.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,a=qt(t,`${o}/`),l=s?qt(`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=a,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=l,gu(i)&&(this.defaultEffects=i.defaultEffects);}},Ir=n(async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e,fileName:o})=>{let s=await Wn({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Tr(r,{baseCDN:s,fileName:o})},"toUploadcareFile"),vu=n((r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,prefixedBaseCDN:T,metadata:C,tags:A})=>Qc(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:C,tags:A}).then(({file:N})=>Mr(N,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(N=>Ir(N,{publicKey:i,baseCDN:w,prefixedBaseCDN:T})),"uploadDirect"),yu=n((r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d,prefixedBaseCDN:m})=>Mr(r,{publicKey:i,baseURL:e,signal:o,onProgress:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>Ir(f,{publicKey:i,baseCDN:d,prefixedBaseCDN:m,fileName:t})),"uploadFromUploaded"),bu=n((r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=n(a=>()=>{e=a,o.forEach((l,c)=>c!==a&&l.abort());},"createStopRaceCallback");return Cr(i,()=>{o.forEach(a=>a.abort());}),Promise.all(r.map((a,l)=>{let c=s(l);return Promise.resolve().then(()=>a({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(a=>{if(e===null)throw t;return a[e]})},"race"),wu=window.WebSocket,Wo=class{static{n(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Tu=n((r,i)=>r==="success"?{status:mt.Success,...i}:r==="progress"?{status:mt.Progress,...i}:{status:mt.Error,...i},"response"),Zo=class{static{n(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Wo;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 wu(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,Tu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=n(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Ko=null,ts=n(r=>{if(!Ko){let i=typeof window>"u"?0:3e4;Ko=new Zo(r,i);}return Ko},"getPusher"),Cu=n(r=>{ts(r).connect();},"preconnect");function Eu({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return zn({check:n(u=>eu(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case mt.Error:return new ct(p.error,p.errorCode);case mt.Waiting:return false;case mt.Unknown:return new ct(`Token "${r}" was not found.`);case mt.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case mt.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(Eu,"pollStrategy");var xu=n(({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let a=ts(i),l=a.onError(s),c=n(()=>{l(),a.unsubscribe(r);},"destroy");Cr(t,()=>{c(),s(new se("pusher cancelled"));}),a.subscribe(r,u=>{switch(u.status){case mt.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case mt.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),o(u);break}case mt.Error:c(),s(new ct(u.msg,u.error_code));}});}),"pushStrategy"),Su=n((r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,prefixedBaseCDN:s,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:l,secureSignature:c,secureExpire:u,store:p,signal:d,onProgress:m,source:f,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,pusherKey:C=P.pusherKey,metadata:A,tags:N})=>Promise.resolve(Cu(C)).then(()=>Jc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:l,secureSignature:c,secureExpire:u,store:p,signal:d,source:f,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,metadata:A,tags:N})).catch(x=>(ts(C)?.disconnect(),Promise.reject(x))).then(x=>x.type===qo.FileInfo?x:bu([({signal:et})=>Eu({token:x.token,publicKey:i,baseURL:e,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,onProgress:m,signal:et}),({signal:et})=>xu({token:x.token,pusherKey:C,signal:et,onProgress:m})],{signal:d})).then(x=>{if(x instanceof ct)throw x;return x}).then(x=>x.isReady?x:Mr(x.uuid,{publicKey:i,baseURL:e,integration:v,userAgent:w,retryThrottledRequestMaxTimes:T,onProgress:m,signal:d})).then(x=>Ir(x,{publicKey:i,baseCDN:o,prefixedBaseCDN:s})),"uploadFromUrl"),Go=new WeakMap,Au=n(async r=>{if(Go.has(r))return Go.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Go.set(r,i),i},"getBlobFromReactNativeAsset"),Zn=n(async r=>{if(Sr(r)||xr(r))return r.size;if(Ar(r))return (await Au(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),ku=n((r,i=P.multipartMinFileSize)=>r>=i,"isMultipart"),Yn=n(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 !ze(r)&&t.test(r)},"isUuid"),es=n(r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !ze(r)&&t.test(r)},"isUrl"),Mu=n((r,i)=>new Promise((t,e)=>{let o=[],s=false,a=i.length,l=[...i],c=n(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(o[u]=d,a-=1,a?c():t(o));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<r;u++)c();}),"runWithConcurrency"),Iu=n((r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},"sliceChunk"),Ou=n(async(r,i,t)=>e=>Iu(r,e,i,t),"prepareChunks"),Lu=n((r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>su(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),Pu=n(async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=P.multipartChunkSize,maxConcurrentRequests:C=P.maxConcurrentRequests,baseCDN:A,prefixedBaseCDN:N,metadata:x,tags:et})=>{let ye=e??await Zn(r),Rt,be=n((z,Et)=>{if(!u)return;Rt||(Rt=Array(z).fill(0));let we=n(Mt=>Mt.reduce(($e,Ao)=>$e+Ao,0),"sum");return Mt=>{Mt.isComputable&&(Rt[Et]=Mt.value,u({isComputable:true,value:we(Rt)/z}));}},"createProgressHandler");return w||=Gn(r),ou(ye,{publicKey:i,contentType:w,fileName:t||qn(r),baseURL:o,secureSignature:s,secureExpire:a,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:x,tags:et,multipartChunkSize:T}).then(async({uuid:z,parts:Et})=>{let we=await Ou(r,ye,T);return Promise.all([z,Mu(C,Et.map((Mt,$e)=>()=>Lu(we($e),Mt,{publicKey:i,contentType:w,onProgress:be(Et.length,$e),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([z])=>nu(z,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(z=>z.isReady?z:Mr(z.uuid,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(z=>Ir(z,{publicKey:i,baseCDN:A,prefixedBaseCDN:N}))},"uploadMultipart");async function is(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:A,prefixedBaseCDN:N=P.prefixedBaseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:et,pusherKey:ye,metadata:Rt,tags:be}){if(ze(r)){let z=await Zn(r);return ku(z,w)?Pu(r,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:z,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N,metadata:Rt,tags:be}):vu(r,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N,metadata:Rt,tags:be})}if(es(r))return Su(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,prefixedBaseCDN:N,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:et,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:ye,metadata:Rt,tags:be});if(Yn(r))return yu(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:A,prefixedBaseCDN:N});throw new TypeError(`File uploading from "${r}" is not supported`)}n(is,"uploadFile");var Uu=n((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},"replaceUrlBase"),Yo=class{static{n(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=P.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Uu(i.cdnUrl,t),this.files=e.map(o=>new Tr(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},Ru=n(async(r,{publicKey:i,baseCDN:t,prefixedBaseCDN:e})=>{let o=await Wn({publicKey:i,baseCDN:t,prefixedBaseCDN:e});return new Yo(r,{baseCDN:o})},"toUploadcareGroup"),$u=n(r=>{for(let i of r)if(!ze(i))return false;return true},"isFileDataArray"),Du=n(r=>{for(let i of r)if(!Yn(i))return false;return true},"isUuidArray"),Fu=n(r=>{for(let i of r)if(!es(i))return false;return true},"isUrlArray");function Xn(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=P.multipartChunkSize,baseCDN:T,prefixedBaseCDN:C=P.prefixedBaseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,jsonpCallback:x}){if(!$u(r)&&!Fu(r)&&!Du(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let et,ye=true,Rt=r.length,be=n((z,Et)=>{if(!c)return;et||(et=Array(z).fill(0));let we=n(Mt=>Mt.reduce(($e,Ao)=>$e+Ao)/z,"normalize");return Mt=>{if(!Mt.isComputable||!ye){ye=false,c({isComputable:false});return}et[Et]=Mt.value,c({isComputable:true,value:we(et)});}},"createProgressHandler");return Promise.all(r.map((z,Et)=>ze(z)||es(z)?is(z,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:a,signal:l,onProgress:be(Rt,Et),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:T,prefixedBaseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N}).then(we=>we.uuid):z)).then(z=>iu(z,{publicKey:i,baseURL:e,jsonpCallback:x,secureSignature:o,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(Et=>Ru(Et,{publicKey:i,baseCDN:T,prefixedBaseCDN:C})).then(Et=>(c&&c({isComputable:true,value:1}),Et)))}n(Xn,"uploadFileGroup");var ne=class{static{n(this,"Queue");}ji=1;fo=[];Gi=0;mo=new Map;go=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.fo.shift();if(!e)return;let o=this.mo.get(e),s=this.go.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.mo.delete(e),this.go.delete(e),this.Gi-=1,this.run();}).then(a=>o(a)).catch(a=>s(a));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.mo.set(i,e),this.go.set(i,o),this.fo.push(i),t&&this.run();})}get pending(){return this.fo.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var rs=n(()=>({}),"blockCtx"),os=n(r=>({...rs(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),ss=n(r=>({...os(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ne(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),Qn=n(r=>({...ss(r),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var F=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Vu=new Set([F.START_FROM,F.UPLOAD_LIST]),Or=class extends q{constructor(t){super(t);this.scopes=new Set;this.listener=this.ru.bind(this),window.addEventListener("paste",this.listener);}static{n(this,"ClipboardLayer");}ou(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"]'))}su(t){return t.composedPath().some(e=>this.ou(e))}nu(t){return typeof t=="string"&&Vu.has(t)}au(){return [...this.scopes].some(t=>t.isConnected)}lu(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}cu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}uu(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 ru(t){if(!t.clipboardData||this.su(t)||!this.au())return;let e=this.e.ctx.read("*currentActivity"),o=e===null,s=this.nu(e);switch(this.ie.pasteScope){case "global":if(!s&&!(o&&this.lu()))return;await this.handlePaste(t);return;case "local":{let a=t.target instanceof Node?t.target:null;if(!this.cu(a)||!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(l=>l.kind==="file").map(l=>l.getAsFile()).filter(l=>l!==null),s=e.filter(l=>l.kind==="string"&&(l.type==="text/plain"||l.type==="text/uri-list")).map(l=>new Promise(c=>{l.getAsString(u=>{c(this.uu(u));});})),a=false;if(o.length>0&&(o.forEach(l=>{this.e.api.addFileFromObject(l,{source:"clipboard"});}),a=true),s.length>0){let l=(await Promise.all(s)).filter(c=>c!==null);l.forEach(c=>{this.e.api.addFileFromUrl(c,{source:"clipboard"});}),a||=l.length>0;}a&&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 Lr=class extends q{constructor(){super(...arguments);this.qi=[];}static{n(this,"RouterHooksLayer");}registerAfterFileAddHook(t){return this.qi.push(t),()=>{this.qi=this.qi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.qi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",F.UPLOAD_LIST),this.e.modalManager?.open(F.UPLOAD_LIST));}};var Nu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function wi(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}n(wi,"focus");function ns(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Nu[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}n(ns,"findGroupNodeByEventTarget");function as(r,i){return i.role==="toolbar"?Bu(i):i.querySelectorAll(`[role=${r.role}]`)}n(as,"getItems");function _u(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})}n(_u,"filterNested");function Bu(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}n(Bu,"getToolbarItems");function zu(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"}n(zu,"isHorizontalOrientation");function Jn(r){return i=>{let t=false,e=r?.searchDelayMs||300,o=0,s="";function a(d){let m=ns(d.target);if(!m){l();return}let f=as(d.target,m),v=_u(f,m),w=Array.from(v).indexOf(d.target),T="ArrowDown",C="ArrowUp";if(zu(m)&&(i.document.dir==="rtl"?(T="ArrowLeft",C="ArrowRight"):(T="ArrowRight",C="ArrowLeft")),d.key===T)d.preventDefault(),wi(d.target,v[w+1]||v[0]);else if(d.key===C)d.preventDefault(),wi(d.target,v[w-1]||v[v.length-1]);else if(d.key==="Home")d.preventDefault(),wi(d.target,v[0]);else if(d.key==="End")d.preventDefault(),wi(d.target,v[v.length-1]);else if(d.key.length===1&&m.role!=="tablist"){d.timeStamp-o<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),o=d.timeStamp;let A=Array.from(f).find(N=>N.textContent?.trim()?.toLowerCase()?.startsWith(s));A&&(d.preventDefault(),wi(d.target,A));}}n(a,"keyDown");function l(){t=false,i.removeEventListener("keydown",a);}n(l,"stop");function c(d){let m=ns(d.target);if(m){t||(t=true,i.addEventListener("keydown",a));let f=as(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}n(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}n(u,"focusOut");function p(d){let m=ns(d.target);if(m){let f=as(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return n(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}n(Jn,"focusGroupKeyUX");function ta(){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 a=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0);}}n(e,"jump");function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return n(o,"focusOut"),r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}n(ta,"hiddenKeyUX");function ea(){return r=>{let i=[];function t(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}n(t,"focus");function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}n(e,"back");let o=0,s;function a(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let p=r.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&e();}return n(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l);}}}n(ea,"jumpKeyUX");function ia(r){let i,t=r.split(" "),e;function o(l){(l.key==="Enter"||l.key===" ")&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}n(o,"keyDown");function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}n(s,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(s(),e!==l.target&&(l.target.classList.add(...t),i=l.target));}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",o),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",o),l.removeEventListener("keyup",s);})}n(ia,"pressKeyUX");function ra(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}n(ra,"startKeyUX");var ls=class{constructor(){this.gt=new Map;this.vo=[];}static{n(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=n(o=>{let s=o.target;s instanceof Node&&this.vo.some(a=>a===s||a.contains(s))&&t(o);},"wrappedListener");this.gt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.gt.get(t);e&&window.removeEventListener(i,e),this.gt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.vo.push(i);}destroy(){this.vo=[];for(let i of this.gt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.gt.clear();}},Pr=class{static{n(this,"A11y");}constructor(){this.Wi=new ls,this.An=ra(this.Wi,[Jn(),ia("is-pressed"),ea(),ta()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.An?.(),this.Wi.destroy();}};var Zt=n(r=>`*l10n/${r}`,"localeStateKey"),Hu="en",Ur=class extends q{constructor(t){super(t);this.Se="";for(let[o,s]of Object.entries(vi)){let a=this.i.has(Zt(o))?!this.i.read(Zt(o)):true;this.i.add(Zt(o),s,a);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Se&&this.kn(this.Se);})),this.addSub(this.i.sub(S("localeName"),async o=>{if(!o)return;this.Se=o;let s=await Mn(o);o!==Hu&&this.Se!==o||(this.kn(o),this.Mn(o,s));})),this.addSub(this.i.sub(S("localeDefinitionOverride"),o=>{if(!o)return;let s=o[this.Se];s&&this.Mn(this.Se,s);}));}static{n(this,"LocaleManager");}Mn(t,e){let o=this.ie.localeDefinitionOverride?.[t];for(let[s,a]of Object.entries(e)){let l=o?.[s];this.i.add(Zt(s),l??a,true);}}kn(t){let e=this.e.pluginManager;if(!e)return;let o=e.snapshot();for(let s of o.l10n){let{pluginId:a,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.i.add(Zt(u),p,true);}}};var ju=n(()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),Ku=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),Gu=n(()=>({safariDesktop:ju()}),"calcBrowserInfo"),qu=n(()=>({htmlMediaCapture:Ku()}),"calcBrowserFeatures"),oa=Gu(),sa=qu();var Ti="image/*",cs="video/*",Wu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Zu=n(()=>oa.safariDesktop?[Ti]:[Ti,...Wu],"calcImageAcceptList"),Ci=Zu(),Rr=n(r=>r?r.filter(i=>typeof i=="string").flatMap(i=>J(i)):[],"mergeFileTypes"),us=n((r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),"matchMimeType"),na=n((r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),He=n(r=>{let i=r?.type;return i?us(i,Ci):false},"fileIsImage");function aa(r,i,t,e,o){return {registry:{registerSource:n(u=>r.addSource(e,u),"registerSource"),registerActivity:n(u=>r.addActivity(e,u),"registerActivity"),registerFileAction:n(u=>r.addFileAction(e,u),"registerFileAction"),registerFileHook:n(u=>r.addFileHook(e,u),"registerFileHook"),registerIcon:n(u=>r.addIcon(e,u),"registerIcon"),registerL10n:n(u=>r.addL10n(e,u),"registerL10n"),registerConfig:n(u=>{r.addConfig(e,u);let p=S(u.name);i.has(p)||i.add(p,u.defaultValue);},"registerConfig")},config:{get:n(u=>{let p=S(u);return i.read(p)},"get"),subscribe:n((u,p)=>{let d=S(u),m=i.sub(d,f=>{p(f);});return o.push(m),m},"subscribe")},activity:{getParams:n(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:n(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return o.push(p),p},"subscribeToParams")},files:{update:n((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}n(aa,"buildPluginApi");var Yu=n(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),"resolveLazyPlugins"),$r=class{constructor(i,t){this.i=i;this.pu=t;this.ii=new Set;this.In=this.i.sub("*lazyPlugins",e=>{this.du(e??[]);});}static{n(this,"LazyPluginLoader");}du(i){for(let o of this.ii)o();if(this.ii.clear(),i.length===0)return;let t=new Set([S("plugins")]);for(let o of i)for(let s of o.configDeps)t.add(S(s));let e=n(()=>this.On(i),"recompute");for(let o of t)this.ii.add(this.i.sub(o,e,false));this.On(i);}On(i){this.yo?.abort();let t=new AbortController;this.yo=t;let e=n(a=>this.i.read(S(a)),"get"),o=e("plugins"),s=Yu({entries:i.map(a=>({isEnabled:n(()=>a.isEnabled(e),"isEnabled"),load:a.load})),signal:t.signal}).then(a=>{if(!t.signal.aborted)return [...o,...a]});this.pu(s);}destroy(){this.In();for(let i of this.ii)i();this.ii.clear(),this.yo?.abort();}};var Dr=class{constructor(){this.oe=new Map;}static{n(this,"CustomConfigRegistry");}register(i,t){if(this.oe.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.oe.set(t.name,e);}unregister(i){this.oe.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.oe)e.pluginId===i&&this.oe.delete(t);}get(i){return this.oe.get(i)}getAll(){return new Map(this.oe)}};var Fr=class{constructor(i=()=>{}){this.b=[];this.St=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Ae=[];this.config=new Dr;this.Lt=V(i,0);}static{n(this,"PluginRegistry");}destroy(){this.Lt.cancel();}ke(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.b.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.b.push(this.ke(i,t)),this.Lt();}addActivity(i,t){let e=this.St.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.St.push(this.ke(i,t)),this.Lt();}addFileAction(i,t){this.Zi.push(this.ke(i,t)),this.Lt();}addFileHook(i,t){this.Yi.push(this.ke(i,{timeout:3e4,...t})),this.Lt();}addIcon(i,t){this.Xi.push(this.ke(i,t)),this.Lt();}addL10n(i,t){this.Ae.push(this.ke(i,t)),this.Lt();}addConfig(i,t){this.config.register(i,t),this.Lt();}purge(i){this.b=this.b.filter(t=>t.pluginId!==i),this.St=this.St.filter(t=>t.pluginId!==i),this.Zi=this.Zi.filter(t=>t.pluginId!==i),this.Yi=this.Yi.filter(t=>t.pluginId!==i),this.Xi=this.Xi.filter(t=>t.pluginId!==i),this.Ae=this.Ae.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.b],activities:[...this.St],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Ae]}}};var Vr=class extends q{constructor(t){super(t);this.se=new Map;this.c=new Set;this.bo=Promise.resolve();this.registry=new Fr(()=>this.Qi());this.Pn=new $r(this.i,e=>{this.bo=this.bo.then(()=>e).then(o=>{if(o)return this.hu(o)});});}static{n(this,"PluginManager");}get configRegistry(){return this.registry.config}pluginsReady(){return this.bo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async hu(t){let e=new Set(this.se.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.se.has(s.id))try{await this.fu(s);}catch(a){this.registry.purge(s.id),this.Qi(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,a);}e.delete(s.id);}for(let s of e)this.wo(s);}async fu(t){this.se.has(t.id)&&this.wo(t.id);let e=[],o=aa(this.registry,this.i,this.e,t.id,e),s=this.e.api,a;try{a=await t.setup({pluginApi:o,uploaderApi:s})??void 0;}catch(l){for(let c of e)try{c();}catch(u){this.E("Failed to unsubscribe config listener",u);}throw l}this.se.set(t.id,{plugin:t,dispose:a,configSubscriptions:e}),this.Qi();}wo(t){let e=this.se.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.se.delete(t),this.Qi();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let o=this.registry.snapshot().fileHooks.filter(l=>l.type==="onAdd");if(o.length===0)return;let s=e,a=new AbortController;for(let l of o){if(a.signal.aborted)break;try{let c=l.handler({file:s,signal:a.signal}),u=new Promise((p,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),l.timeout));({file:s}=await Promise.race([c,u]));}catch(c){console.warn(`File hook "onAdd" from plugin "${l.pluginId}" failed`,c);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",He(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.se.keys()))this.wo(t);this.registry.destroy(),this.Pn.destroy(),super.destroy();}Qi(){for(let t of this.c)try{t();}catch{}}};function Xu(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}n(Xu,"i");function ps(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?ps(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=Xu(i);return typeof t=="object"&&t!==null?[e,ps(t)]:[e,t]}))}n(ps,"c");function Qu(r){return {ok:true,value:r}}n(Qu,"u");function ds(r){return {ok:false,error:r}}n(ds,"a");var Ju="https://tlm.uploadcare.com/api/",hs=class{static{n(this,"y");}constructor(i=Ju){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return ds(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return Qu(s)}catch(s){return ds(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return ds(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(ps(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},td=n(async(r,i)=>({success:true,data:i}),"p"),ed=n(async r=>td(void 0,r),"f"),Nr=class extends hs{static{n(this,"h");}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 id=20,_=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),k=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),_r=class extends q{constructor(){super(...arguments);this.ri=new Map;this.Ji=new Set;this.gt=new Map;}static{n(this,"EventEmitter");}bindTarget(t){return this.Ji.add(t),()=>{this.Ji.delete(t);}}on(t,e){let o=this.gt.get(t);return o||(o=new Set,this.gt.set(t,o)),o.add(e),()=>this.gt.get(t)?.delete(e)}Ln(t,e){for(let s of this.Ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let o=this.gt.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.Ln(t,typeof e=="function"?e():e);return}this.ri.has(t)&&window.clearTimeout(this.ri.get(t));let a=typeof s=="number"?s:id,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.Ln(t,c),this.ri.delete(t);}catch(c){this.E?.(()=>`Error while getting payload for event "${t}"`,c);}},a);this.ri.set(t,l);}destroy(){for(let t of this.ri.values())window.clearTimeout(t);this.Ji.clear(),this.gt.clear();}};var la="1.33.1";var $t="blocks",Dt=la;var Br=class extends q{constructor(t){super(t);this.mu=nt.generateRandomUUID();this.Me=structuredClone(it);this.xo=false;this.To=null;this.zt=false;this.Rn=new Nr,this.Ie=new ne(10),this.addSub(this.i.sub(S("qualityInsights"),e=>{this.zt=!!e;}));for(let e of Object.keys(this.Me))this.addSub(this.i.sub(S(e),o=>{this.zt&&(this.xo&&this.Me[e]!==o&&this.sendEvent({eventType:_.CHANGE_CONFIG}),this.gu(e,o));}));}static{n(this,"TelemetryManager");}vu(t){t===_.INIT_SOLUTION&&!this.xo&&(this.xo=true);}gu(t,e){this.Me[t]!==e&&(this.Me[t]=e);}yu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===_.INIT_SOLUTION||t.eventType===_.CHANGE_CONFIG)&&(o.config=this.Me),{...o,appVersion:Dt,appName:$t,sessionId:this.mu,component:this.bu,activity:this.wu,projectPubkey:this.Me.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.xu,payload:{location:this.Tu,...e}}}Eu(t){return !!(t&&[k.CHANGE,k.COMMON_UPLOAD_PROGRESS,k.FILE_ADDED,k.FILE_REMOVED,k.FILE_UPLOAD_START,k.FILE_UPLOAD_PROGRESS,k.FILE_UPLOAD_SUCCESS,k.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.zt)return;let e=this.yu({eventType:t.eventType,payload:t.payload,config:t.config});this.vu(t.eventType),!(this.Eu(t.eventType)||this.To&&this.Un(this.To,e))&&this.Ie.add(async()=>{this.To=e,await this.Rn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:_.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Un(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 a of o)if(!Object.hasOwn(e,a)||!this.Un(t[a],e[a]))return false;return true}get xu(){return Date.now()}get bu(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get wu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get Tu(){return location.origin}};var ca=n(r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var od=n(r=>r,"DEFAULT_TRANSFORMER"),ms="{{",da="}}",ua="plural:";function je(r,i={},t={}){let{openToken:e=ms,closeToken:o=da,transform:s=od}=t;for(let a in i){let l=i[a],c=l?.toString(),u=typeof c=="string"?s(c):String(c);r=r.replaceAll(e+a+o,u);}return r}n(je,"applyTemplateData");function pa(r){let i=[],t=r.indexOf(ms);for(;t!==-1;){let e=r.indexOf(da,t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(ua)){let s=r.substring(t+2,e).replace(ua,""),a=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:a,countVariable:l});}t=r.indexOf(ms,e);}return i}n(pa,"getPluralObjects");var ha="--uploadcare-blocks-window-height",Ei=class r{static{n(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=V(()=>{document.documentElement.style.setProperty(ha,`${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(ha);}};var zr=n((r,i)=>new Intl.PluralRules(r).select(i),"getPluralForm");var sd=n(r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=zr(o,t);return e(`${i}__${s}`)},"createPluralizer"),Hr=n(r=>{let i=sd(()=>t),t=n((e,o={})=>{if(!e)return "";let a=r().read(Zt(e))||e,l=pa(a);for(let u of l)o[u.variable]=i(u.pluralKey,Number(o[u.countVariable]));return je(a,o)},"l10n");return t},"createL10n");var nd=n(r=>r.tagName?.includes("-")??false,"isCustomElement"),jr=class{constructor(i){this.ne=new Set;this.tr=new Map;this.$n=false;this.ae=i,this.ae.addController(this);}static{n(this,"TestModeController");}hostDisconnected(){this.er?.(),this.er=void 0,this.ne.clear(),this.tr.clear();}hostUpdated(){if(!this.er&&this.ae.has(S("testMode"))){let i=this.ae.subConfigValue("testMode",t=>{this.$n=!!t,this.Dn();});this.er=i;}this.Cu(),this.Dn();}Cu(){let i=this.ae,t=i.renderRoot??i;if(!t)return;let e=this.ae,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(a=>!nd(a));for(let a of s)if(!(o&&a.closest(o)!==e)&&!this.ne.has(a)){let l=a.getAttribute("data-testid");if(!l)continue;this.ne.add(a),this.tr.set(a,l);}for(let a of Array.from(this.ne))(!a.isConnected||o&&a.closest(o)!==e)&&(this.ne.delete(a),this.tr.delete(a));}Dn(){if(!this.ne.size)return;let i=this.ae.testId||"";for(let t of this.ne){let e=this.tr.get(t);e&&(this.$n?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var ad=Ve(hr()(Fe(ur(xt)))),E=class extends ad{constructor(){super();this.init$=rs();this.l10n=Hr(()=>this.sharedCtx);this.debugPrint=yr(()=>this.sharedCtx,this.constructor.name);this.e=Vn(()=>this.sharedCtx);new jr(this);}static{n(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);let a=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:a??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Vr(t)),this.Y("*eventEmitter",t=>new _r(t)),this.Y("*localeManager",t=>new Ur(t)),this.Y("*modalManager",t=>new br(t)),this.Y("*a11y",()=>new Pr),this.Y("*routerLayer",t=>new Lr(t)),this.Y("*clipboard",t=>new Or(t)),this.Y("*telemetryManager",t=>new Br(t)),this.sub(Zt("locale-id"),t=>{let e=ca(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.Q("*modalManager",false)}get telemetryManager(){return this.Q("*telemetryManager")}get localeManager(){return this.Q("*localeManager")}get a11y(){return this.Q("*a11y")}get clipboardLayer(){return this.Q("*clipboard")}get routerLayer(){return this.Q("*routerLayer")}get blocksRegistry(){return this.Q("*blocksRegistry")}get eventEmitter(){return this.Q("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Su(),G.deleteCtx(this.ctxName);}Fn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Y(t,e){let o=this.Fn();if(!o.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),o.set(t,s);return}}Su(){let t=this.Fn();for(let[e,o]of t.entries())o?.destroy?.(),this.pub(e,null);t.clear();}Q(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:gr(t),cdnUrlModifiers:zo(t),fileName:fr(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?je(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:n(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.ee){let t={};this.ee=new Proxy(t,{set:n((e,o,s)=>{if(typeof o!="string"||!(o in it))return false;let a=o,l=S(a);return this.has(l)||this.add(l,it[a]),this.$[l]=s,true},"set"),get:n((e,o)=>{let s=S(o);return this.has(s)||this.add(s,it[o]),this.$[s]},"get")});}return this.ee}subConfigValue(t,e){let o=S(t);return this.has(o)||this.add(o,it[t]),this.sub(o,e)}};var Ft={ATTRIBUTE:1,CHILD:2},ut=n(r=>(...i)=>({ro:r,values:i}),"e"),ft=class{static{n(this,"i");}constructor(i){}get X(){return this.m.X}oo(i,t,e){this.ir=i,this.m=t,this.Au=e;}Zc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Me=class extends ft{static{n(this,"e");}constructor(i){if(super(i),this.it=$,i.type!==Ft.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===$||i==null)return this.Nn=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.Nn;this.it=i;let t=[i];return t.raw=t,this.Nn={Vt:this.constructor.resultType,strings:t,values:[]}}};Me.directiveName="unsafeHTML",Me.resultType=1;ut(Me);var xi=class extends Me{static{n(this,"t");}};xi.directiveName="unsafeSVG",xi.resultType=2;var Ke=ut(xi);var ma="<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 Yt=class extends E{constructor(){super(...arguments);this.init$=Qn(this);}static{n(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return y`${Ke(ma)}`}};var fa=n(r=>typeof r!="number"?0:Math.floor(r/1e3),"msToUnixTimestamp"),ga=n((r,{threshold:i})=>{let{secureExpire:t}=r,e=fa(Date.now()),o=Number(t),s=fa(i);return e+s>=o},"isSecureTokenExpired");var Kr=class extends q{constructor(){super(...arguments);this.le=null;}static{n(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.ie;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.le||ga(this.le,{threshold:s})){this.le?this.E("Secure signature is expired. Resolving a new one..."):this.E("Secure signature is not set yet.");try{let a=await o();a?!a.secureSignature||!a.secureExpire?console.error("Secure signature resolver returned an invalid result:",a):(this.E("Secure signature resolved:",a),this.E("Secure signature will expire in",new Date(Number(a.secureExpire)*1e3).toISOString()),this.le=a):(this.E("Secure signature resolver returned nothing."),this.le=null);}catch(a){console.error("Secure signature resolving failed. Falling back to the previous one.",a),this.e.telemetryManager.sendEventError(a,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.le}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.le=null;}};var fs=n((r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var gs=n((r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}},"validateMultiple");var vs=n((r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=Rr([...t?Ci:[],e]);if(!o.length)return;let s=r.mimeType,a=r.name;if(!s||!a)return;let l=us(s,o),c=na(a,o);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var ys=n((r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var Vt=1e3,Ie=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Si=n(r=>Math.ceil(r*100)/100,"round"),va=n((r,i=Ie.AUTO)=>{let t=i===Ie.AUTO;if(i===Ie.BYTE||t&&r<Vt**1){let o=zr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===Ie.KB||t&&r<Vt**2?`${Si(r/Vt**1)} KB`:i===Ie.MB||t&&r<Vt**3?`${Si(r/Vt**2)} MB`:i===Ie.GB||t&&r<Vt**4?`${Si(r/Vt**3)} GB`:i===Ie.TB||t&&r<Vt**5?`${Si(r/Vt**4)} TB`:`${Si(r/Vt**5)} PB`},"prettyBytes");var bs=n((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:va(t)}),payload:{entry:r}}},"validateMaxSizeLimit");var ws=n((r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof ct)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Be)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}},"validateUploadError");var Ge={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."},ld=n(r=>typeof r=="function"?{runOn:"change",validator:r}:r,"getValidatorDescriptor"),Gr=class extends q{constructor(t){super(t);this.ku=[ys,vs,bs,ws];this.Mu=[gs,fs];this.Ie=new ne(20);this.Vn=V(()=>{this.Ie.run();},500);this.Ht=false;this.Oe=new Map;let e=V(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(S("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(S("multipleMin"),e)),this.addSub(this.i.sub(S("multipleMax"),e)),this.addSub(this.i.sub(S("multiple"),e)),this.addSub(this.i.sub(S("imgOnly"),e)),this.addSub(this.i.sub(S("accept"),e)),this.addSub(this.i.sub(S("validationConcurrency"),o=>{this.Ie.concurrency=o;}));}static{n(this,"ValidationManager");}get f(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Ht)return;let o=e??this.f.items();for(let s of o){let a=this.f.read(s);a&&this.Iu(a,t);}}runCollectionValidators(){if(this.Ht)return;let t=this.e.api,e=t.getOutputCollectionState(),o=[],s=this.ie.collectionValidators;for(let a of [...this.Mu,...s])try{let l=a(e,t);if(!l)continue;l&&(o.push(this._n(l)),l.message||console.warn(Ge.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ge.COLLECTION_VALIDATION_FAILED,l);}this.i.pub("*collectionErrors",o),o.length>0&&this.e.eventEmitter.emit(k.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Oe.get(t.uid);e&&(e.abortController?.abort(),this.Oe.delete(t.uid));}async Iu(t,e){if(this.Ht)return;let o=this.e.api,s=this.Bn(t),a=s.promise??Promise.resolve(),l=(async()=>{if(this.Ht||(await a,this.Ht))return;let c=this.Ou(t,e);if(c.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=o.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.ie.validationTimeout,m=this.zn(),f=new Set(c.map(T=>T.validator)),v=[];for(let T of m)if(!f.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Ht)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ge.FILE_VALIDATION_TIMEOUT);},d);try{let A=await T.validator(u,o,{signal:p.signal});if(!A||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let N=this._n(A);s.lastErrorThrownByValidator.set(T.validator,N),v.push(N),A.message||console.warn(Ge.MISSING_ERROR_MESSAGE);}catch(A){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ge.FILE_VALIDATION_FAILED,A),this.e.telemetryManager.sendEventError(A,`file validator. ${Ge.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.Vn(),await this.Ie.add(async()=>{this.Ht||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}_n(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Bn(t){let e=this.Oe.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Oe.set(t.uid,o),o}zn(){let t=this.ie.fileValidators;return [...this.ku,...t].map(ld)}Ou(t,e){let o=this.Bn(t);return this.zn().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Ht=true,this.Vn.cancel();for(let t of this.Oe.values())t.abortController?.abort(),t.promise=void 0;this.Oe.clear();}};var ya="[Typed State] Wrong property name: ",qr=class{static{n(this,"TypedData");}constructor(i){this.pt=nt.generateFastUid(),this.J=G.registerCtx(i,this.pt);}get uid(){return this.pt}setValue(i,t){if(!this.J.has(i)){console.warn(`${ya}${String(i)}`);return}this.J.read(i)!==t&&this.J.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.J.has(i)||console.warn(`${ya}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){G.deleteCtx(this.pt);}};var Wr=class r{constructor(i){this.Kt=Object.create(null);this.rr=new Set;this.or=new Set;this.tt=new Set;this.Eo=new Set;this.Co=new Set;this.Pe=new Set;this.jn=i.initialValue,this.pt=nt.generateFastUid(),this.J=G.registerCtx({},this.pt),this.Hn=i.watchList||[];let t=Object.create(null);this.Kn=(e,o)=>{this.oi&&window.clearTimeout(this.oi),t[e]||(t[e]=new Set),t[e].add(o),this.oi=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.rr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Gn();},i.handler&&this.observeCollection(i.handler);}static{n(this,"TypedCollection");}static{this.Pu=1e4;}Z(){this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.Eo);this.Co.clear(),this.Eo.clear();for(let e of this.or)e?.([...this.tt],i,t);this.Gn();});}Gn(){this.Pe.size!==0&&(this.ni&&window.clearTimeout(this.ni),this.ni=window.setTimeout(()=>{let i=[...this.Pe];this.Pe.clear();for(let t of i)t.destroy();},r.Pu));}observeCollection(i){return this.or.add(i),this.tt.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.or.delete(i);}add(i,t={}){let e=new qr(this.jn);for(let[o,s]of Object.entries(i))e.setValue(o,s);if(t.index===void 0)this.tt.add(e.uid);else {let o=[...this.tt],s=Math.min(Math.max(Math.trunc(t.index)||0,0),o.length);o.splice(s,0,e.uid),this.tt=new Set(o);}return this.Z(),this.J.add(e.uid,e),this.Co.add(e),this.Hn.forEach(o=>{this.Kt[e.uid]||(this.Kt[e.uid]=[]),this.Kt[e.uid]?.push(e.subscribe(o,()=>{this.Kn(o,e.uid);}));}),e.uid}hasItem(i){return this.tt.has(i)}read(i){return this.J.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let 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.Eo.add(t),this.Pe.add(t)),this.tt.delete(i),this.Z(),this.J.pub(i,void 0),this.Kt[i]?.forEach(e=>{e();}),delete this.Kt[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.tt.forEach(i=>{this.abort(i);});}clearAll(){this.tt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.rr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.rr.delete(i);}findItems(i){let t=[];return this.tt.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.tt]}get size(){return this.tt.size}destroy(){this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si),this.ni&&window.clearTimeout(this.ni);for(let i of this.Pe)i.destroy();this.Pe.clear(),G.deleteCtx(this.pt),this.rr=new Set,this.or=new Set;for(let i of Object.keys(this.Kt))this.Kt[i]?.forEach(t=>{t();}),delete this.Kt[i];}};var U=Object.freeze({PHOTO:"photo",VIDEO:"video"}),At=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ba=n(r=>({isVideoRecordingEnabled:Z(r.cameraModes).includes(U.VIDEO),isPhotoEnabled:Z(r.cameraModes).includes(U.PHOTO)}),"calcCameraModes");var wa=n((r,i)=>{for(let t of r)if(i(t))return t},"findBlockInCtx");var Ts=n((r,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(o=>{let s,a=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=n(()=>{for(let c of r)if(i(c)){clearTimeout(a),o(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function Zr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}n(Zr,"applyStyles");var cd=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ud=new RegExp(`^/?(${cd.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Ta=n(({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(bi),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=ud.exec(o.pathname);if(!s)return null;let[,a,l,c]=s;return a?{uuid:a,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var gt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),dd=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",...dd,...gt}),pd={[gt.DROPBOX_CHOOSER]:gt.DROPBOX},Ca=n(r=>pd[r]??r,"canonicalSourceName");var Yr=n(r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e)),"getOutputData");function Ea(r){let i=new Map;return n((...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s},"memoized")}n(Ea,"memoize");var xa=new Set;function Xr(r){xa.has(r)||(xa.add(r),console.warn(r));}n(Xr,"warnOnce");function hd(r){let i=false;return setTimeout(()=>{i=true;},0),n(e=>((...o)=>(i&&Xr(r),e(...o))),"withAssert")}n(hd,"createAsyncAssertWrapper");function Sa(r){let i={},t=r.ctx,e={progress:n(()=>t.read("*commonProgress"),"progress"),errors:n(()=>t.read("*collectionErrors"),"errors"),group:n(()=>t.read("*groupInfo"),"group"),totalCount:n(()=>r.uploadCollection.size,"totalCount"),failedCount:n(()=>i.failedEntries.length,"failedCount"),successCount:n(()=>i.successEntries.length,"successCount"),uploadingCount:n(()=>i.uploadingEntries.length,"uploadingCount"),status:n(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:n(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:n(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:n(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:n(()=>Yr(r),"allEntries"),successEntries:n(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:n(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:n(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},o=hd("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,a]of Object.entries(e)){let l=s,u=Ea(o(a));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}n(Sa,"buildOutputCollectionState");var Aa={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 Cs(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}}n(Cs,"uploadcareFileToEntryData");var Qr=class extends q{constructor(){super(...arguments);this.Ae=Hr(()=>this.i);this.addFileFromUrl=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUrl");this.addFileFromUuid=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUuid");this.addFileFromCdnUrl=n((t,{silent:e,fileName:o,source:s}={})=>{let a=Ta({url:t,cdnBase:this.cfg.cdnCname});if(!a)throw new Error("Invalid CDN URL");let l=this.f.add({uuid:a.uuid,cdnUrl:t,cdnUrlModifiers:a.cdnUrlModifiers,fileName:o??a.filename??null,silent:e??false,source:s??R.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=n((t,{silent:e,fileName:o,source:s,fullPath:a}={})=>{let l=this.f.add({file:t,isImage:He(t),mimeType:t.type||null,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??R.API,fullPath:a??null});return this.getOutputItem(l)},"addFileFromObject");this.addFileFromUploadcareFile=n((t,{silent:e,fileName:o,source:s}={})=>{let a=this.f.add({...Cs(t),fileName:o??t.originalFilename??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)},"addFileFromUploadcareFile");this.replaceFile=n((t,e,{silent:o,fileName:s,source:a}={})=>{let l=t,c=this.f,u=c.items().indexOf(l),p=c.read(l);if(u===-1||!p)throw new Error(`File with internalId ${t} not found`);let d={source:p.getValue("source"),metadata:p.getValue("metadata"),fullPath:p.getValue("fullPath"),silent:p.getValue("silent")};c.remove(l);let m=c.add({...Cs(e),fileName:s??e.originalFilename??null,silent:o??d.silent,source:a??d.source??R.API,metadata:d.metadata,fullPath:d.fullPath},{index:u});return this.getOutputItem(m)},"replaceFile");this.removeFileByInternalId=n(t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);},"removeFileByInternalId");this.uploadAll=n(()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.i.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(k.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=n((t={})=>{let e=jt(Rr([this.cfg.accept??"",...this.cfg.imgOnly?Ci:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),Zr(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:a,isVideoRecordingEnabled:l}=ba(this.cfg);t.modeCamera===U.PHOTO&&a?s.accept=Ti:t.modeCamera===U.VIDEO&&l?s.accept=cs:s.accept=[Ti,l&&cs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(a=>{this.addFileFromObject(a,{source:t.captureCamera?R.CAMERA:R.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(a=>{a.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=n((t=false)=>{if(this.f.size>0&&!t)this.i.pub("*currentActivity",F.UPLOAD_LIST),this.e.modalManager?.open(F.UPLOAD_LIST);else if(this.qn?.length===1){let e=this.qn[0];this.So().then(()=>{let o=this.e.pluginManager.snapshot().sources,s=o.find(a=>a.id===e);if(s){let a=s.expand?.()??[e];a.length===1?(o.find(c=>c.id===a[0])??s).onSelect():(this.i.pub("*currentActivity",F.START_FROM),this.e.modalManager?.open(F.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",F.START_FROM),this.e.modalManager?.open(F.START_FROM);},"initFlow");this.doneFlow=n(()=>{let t=wa(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.i.pub("*currentActivity",t.doneActivity),this.i.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.i.read("*currentActivity")||this.e.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=n((t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),Ts(this.e.blocksRegistry,o=>o.activityType===t,{onTimeout:n(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=n((t,e)=>this.e.eventEmitter.on(t,e),"on");this.getCurrentActivity=n(()=>this.i.read("*currentActivity"),"getCurrentActivity");this.historyBack=n(()=>{this.i.read("*historyBack")?.();},"historyBack");this.setModalState=n(t=>{this.So().then(()=>{if(!t){this.e.modalManager?.close(this.i.read("*currentActivity")),this.i.pub("*currentActivity",null);return}let e=this.i.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return Ts(this.e.blocksRegistry,o=>o.activityType===e,{onTimeout:n(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.e.modalManager?.open(e);})});},"setModalState");}static{n(this,"UploaderPublicApi");}get f(){return this.e.uploadCollection}get cfg(){return this.ie}get l10n(){return this.Ae}removeAllFiles(){this.f.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,a=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:a==="success",isUploading:a==="uploading",isFailed:a==="failed",isRemoved:a==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:a,source:o?.source}}getOutputCollectionState(){return Sa(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get qn(){let t=[];return this.cfg.sourceList&&(t=J(this.cfg.sourceList)),t}};var Ai=33.333333333333336,M=1,Es=24,ka=6;function ce(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}n(ce,"setSvgNodeAttrs");function wt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return ce(t,i),t}n(wt,"createSvgNode");function Ma(r,i,t){let{x:e,y:o,width:s,height:a}=r,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,o+c*a+1.5*p-24*t*p],m=[e+l*s+1.5*u,o+c*a+1.5*p],f=[e+l*s-24*t*u+1.5*u,o+c*a+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}n(Ma,"cornerPath");function Ia(r,i,t){let{x:e,y:o,width:s,height:a}=r,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,o+p*a+1.5*m],v=[e+u*s+34*t/2,o+p*a+1.5*m]):(f=[e+u*s+1.5*d,o+p*a-34*t/2],v=[e+u*s+1.5*d,o+p*a+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,T=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:T}}n(Ia,"sidePath");function Oa(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}n(Oa,"thumbCursor");function La({rect:r,delta:[i,t],imageBox:e}){return We({...r,x:r.x+i,y:r.y+t},e)}n(La,"moveRect");function We(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}}n(We,"constraintRect");function md({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:a,height:l}=r;s+=o,l-=o,t&&(a=l*t);let c=r.x+r.width/2-a/2;return s<=e.y&&(s=e.y,l=r.y+r.height-s,t&&(a=l*t,c=r.x+r.width/2-a/2)),c<=e.x&&(c=e.x,s=r.y+r.height-l),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=r.y+r.height-l),l<M&&(l=M,t&&(a=l*t,c=r.x+r.width/2-a/2),s=r.y+r.height-l),a<M&&(a=M,t&&(l=a/t,c=r.x+r.width/2-a/2),s=r.y+r.height-l),{x:c,y:s,width:a,height:l}}n(md,"resizeNorth");function fd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:a,height:l}=r;s+=o,a-=o,t&&(l=a/t);let c=r.y+r.height/2-l/2;return s<=e.x&&(s=e.x,a=r.x+r.width-s,t&&(l=a/t,c=r.y+r.height/2-l/2)),c<=e.y&&(c=e.y,s=r.x+r.width-a),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=r.x+r.width-a),l<M&&(l=M,t&&(a=l*t),c=r.y+r.height/2-l/2,s=r.x+r.width-a),a<M&&(a=M,t&&(l=a/t),c=r.y+r.height/2-l/2,s=r.x+r.width-a),{x:s,y:c,width:a,height:l}}n(fd,"resizeWest");function gd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:a,height:l}=r;l+=o,t&&(a=l*t);let c=r.x+r.width/2-a/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(a=l*t),c=r.x+r.width/2-a/2),c<=e.x&&(c=e.x,s=r.y),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=r.y),l<M&&(l=M,t&&(a=l*t),c=r.x+r.width/2-a/2),a<M&&(a=M,t&&(l=a/t),c=r.x+r.width/2-a/2),{x:c,y:s,width:a,height:l}}n(gd,"resizeSouth");function vd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:a,height:l}=r;a+=o,t&&(l=a/t);let c=r.y+r.height/2-l/2;return s+a>=e.x+e.width&&(a=e.x+e.width-s,t&&(l=a/t),c=r.y+r.height/2-l/2),c<=e.y&&(c=e.y,s=r.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=r.x),l<M&&(l=M,t&&(a=l*t),c=r.y+r.height/2-l/2),a<M&&(a=M,t&&(l=a/t),c=r.y+r.height/2-l/2),{x:s,y:c,width:a,height:l}}n(vd,"resizeEast");function yd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+o<e.x&&(o=e.x-a),l+s<e.y&&(s=e.y-l),a+=o,c-=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=r.x+r.width-c,l=e.y)):t&&(o=u*t-c,c=c+o,a-=o,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),a=r.x+r.width-c,l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),a=r.x+r.width-c,l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(yd,"resizeNorthWest");function bd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+c+o>e.x+e.width&&(o=e.x+e.width-a-c),l+s<e.y&&(s=e.y-l),c+=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=r.x,l=e.y)):t&&(o=u*t-c,c+=o,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(bd,"resizeNorthEast");function wd({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+o<e.x&&(o=e.x-a),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),a+=o,c-=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=r.x+r.width-c,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,a-=o,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=r.y)),u<M&&(u=M,t&&(c=u*t),a=r.x+r.width-c),c<M&&(c=M,t&&(u=c/t),a=r.x+r.width-c),{x:a,y:l,width:c,height:u}}n(wd,"resizeSouthWest");function Td({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:a,y:l,width:c,height:u}=r;return a+c+o>e.x+e.width&&(o=e.x+e.width-a-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=r.x,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=r.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:a,y:l,width:c,height:u}}n(Td,"resizeSouthEast");function Pa({direction:r,...i}){switch(r){case "n":return md(i);case "w":return fd(i);case "s":return gd(i);case "e":return vd(i);case "nw":return yd(i);case "ne":return bd(i);case "sw":return wd(i);case "se":return Td(i);default:return i.rect}}n(Pa,"resizeRect");function Ua(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}n(Ua,"rectContainsPoint");function Ra(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}n(Ra,"isRectInsideRect");function $a(r,i){return Math.abs(r.width/r.height-i)<.1}n($a,"isRectMatchesAspectRatio");function Ze({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}n(Ze,"rotateSize");function Da(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 a=Math.round((r-o)/2),l=Math.round((i-s)/2);return a+o>r&&(o=r-a),l+s>i&&(s=i-l),{x:a,y:l,width:o,height:s}}n(Da,"calculateMaxCenteredCropFrame");function Ye(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}n(Ye,"roundRect");function ue(r,i,t){return Math.min(Math.max(r,i),t)}n(ue,"clamp");var ki=["free"],to=n(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&&!ki.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let a=Number(o.slice(0,s)),l=Number(o.slice(s+1));if((!Number.isFinite(a)||!Number.isFinite(l)||a<=0||l<=0)&&!ki.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:nt.generateFastUid(),type:"aspect-ratio",width:ki.includes(o)?0:a,height:ki.includes(o)?0:l,hasFreeform:ki.includes(o)});}return t},"parseCropPreset"),Fa=n((r,i,t,e=.1)=>{let o=r/i,s=null,a=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(o-p);d<a&&(a=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(o-u)/u>e)return null}return s},"getClosestAspectRatio");function Va(r){return Xo({...r,libraryName:$t,libraryVersion:Dt})}n(Va,"customUserAgent");var Na="active",Xe="___ACTIVITY_IS_ACTIVE___",_a,D=class r extends(_a=E,_a){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=os(this);this.Lu=V(this.Ru.bind(this),10);}static{n(this,"LitActivityBlock");}Wn(){let t=r.ai.get(this);this[Xe]=false,this.removeAttribute(Na),t?.deactivateCallback?.();}Uu(){let t=r.ai.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Xe]=true,this.setAttribute(Na,""),t?.activateCallback?.(),this.Lu(),this.emit(k.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[Xe]?this.Wn():this.activityType===t&&!this[Xe]&&this.Uu();}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"]=[]);}));}Ru(){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);}Zn(){return !!this.activityType&&r.ai.has(this)}static{this.ai=new Map;}get isActivityActive(){return !!this[Xe]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.ai.set(this,{activateCallback:o,deactivateCallback:s});}$u(){this.isActivityActive&&this.Wn(),r.ai.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Zn()&&this.$u();}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(a=>a.activityType===e)?.couldOpenActivity??false),e=o?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};D.activities=F;var I=class r extends D{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.sr=false;this.init$=ss(this);this.Mo=V(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._u(e);},300);this.Nu=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(k.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(a=>a.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 a=s?.getValue("thumbUrl");a&&URL.revokeObjectURL(a),this.emit(k.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Qn(),this.Mo();}};this.Vu=t=>{if(!this.isConnected)return;this.Mo();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(a=>t.fileInfo?.has(a)&&!!G.getCtx(a)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let a=G.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Qn();}if(t.isUploading)for(let s of t.isUploading){let a=G.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let a=G.getCtx(s);if(!a)continue;let{fileInfo:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Bu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=G.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(k.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(k.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),a=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&a.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(k.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(a=>!!this.uploadCollection.read(a)?.getValue("cdnUrl")).forEach(a=>{this.emit(k.FILE_URL_CHANGED,this.api.getOutputItem(a));}),this.$["*groupInfo"]=null);};this.Qn=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));o.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(t+=l);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(k.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{n(this,"LitUploaderBlock");}get Du(){return this.hasBlockInCtx(t=>t instanceof r?t.sr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Wr({initialValue:Aa,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new Kr(t)),this.Y("*validationManager",t=>new Gr(t)),this.Y("*publicApi",t=>new Qr(t)),!this.Du&&this.couldBeCtxOwner&&this.Fu();}getAPI(){return this.api}get validationManager(){return this.Q("*validationManager")}get api(){return this.Q("*publicApi")}get uploadCollection(){return this.Q("*uploadCollection")}get secureUploadsManager(){return this.Q("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.sr&&this.Yn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.sr&&this.Xn();}Fu(){this.sr=true,this.Xn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Xn(){this.Yn(),this.Ao=this.uploadCollection.observeCollection(this.Nu),this.ko=this.uploadCollection.observeProperties(this.Vu);}Yn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async _u(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,a=await Xn(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit(k.GROUP_CREATED,l),this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Bu(){let t=to(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 a=s.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=a.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=Da(l,c,u),d=at(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Q(m,d)});}}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=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Va,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return Yr(this.e)}};I.extSrcList=Object.freeze({...gt});I.sourceTypes=Object.freeze({...R});var de=class extends E{constructor(){super(...arguments);this.name="";this.nr="";this.li=null;this.Jn=null;}static{n(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Jn=e,this.Io();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Io()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Io();}Io(){if(!this.name){this.nr="",this.li=null;return}let e=this.e.pluginManager?.snapshot().icons.find(a=>a.name===this.name);if(e){this.li=e.svg,this.nr="";return}this.li=null;let o=`#uc-icon-${this.name}`,s=this.Jn?.(this.name);this.nr=s??o;}render(){return this.li?y`${this.yield("",y`${Ke(this.li)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.nr}></use></svg>`)} `}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}};h([b({type:String})],de.prototype,"name",2),h([g()],de.prototype,"nr",2),h([g()],de.prototype,"li",2);var Ba=n(r=>[...new Set(r)],"uniqueArray");var Oe="--uc-img-",xs="unresolved";var Ss=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),As=3e3,ks=5e3,Ms=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Cd="https://ucarecdn.com",Qe=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Cd},"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 eo=class extends Fe(Ve(xt)){constructor(){super();this.Le={};this.c=new Map;this.Re=null;this.ar=null;for(let t in Qe){let e=Qe[t];this.Le[Oe+t]=e?.default||"";}}static{n(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Le[Oe+t]}set$$(t){for(let e in t){let o=Oe+e,s=t[e];this.Le[o]=s,this.Z(o,s);}}sub$$(t,e){let o=Oe+t;this.c.has(o)||this.c.set(o,new Set),this.c.get(o)?.add(e);let s=this.Le[o];s!==null&&s!==""&&e(s);}Z(t,e){this.c.has(t)&&this.c.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${$t}/${Dt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;Qe[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.Re=new IntersectionObserver(s=>{s.forEach(a=>{a.isIntersecting&&(e(),this.Re?.unobserve(t));});},o),this.Re.observe(t),this.ar||(this.ar=new Set),this.ar.add(t);}connectedCallback(){super.connectedCallback(),this.zu();}zu(){for(let t in Qe){let e=Oe+t,o=this.getCssData(e,true);o!=null&&(this.Le[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.Re&&(this.ar?.forEach(t=>{this.Re?.unobserve(t);}),this.Re=null),this.c.clear();}static get observedAttributes(){return Object.keys(Qe)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Oe+t;this.Le[s]=o,this.Z(s,o);});}};var za=n(r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var oo=class extends eo{constructor(){super(...arguments);this.Rt=new Image;this.At=new Image;}static{n(this,"ImgBase");}ta(t){return !t.includes("//")&&!Ss&&(t=new URL(t,document.baseURI).href),t}lr(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let a=parseInt(o,10);return Number(a)>ks&&this.ea?ks+s:Number(a)>As&&!this.ea?As+s:t}Hu(t,e){let o={format:this.Oo("format"),quality:this.Oo("quality"),resize:this.lr(t),blur:e,"cdn-operations":this.Oo("cdn-operations")??void 0,analytics:this.analyticsParams()};return at(...za(o))}Oo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}vt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(Ss&&o&&!o.includes("//"))return this.ci(o);let s=this.Hu(t,e),a=this.$$("cdn-cname"),l=a;if(o.startsWith(String(a)))return Q(o,s);let c=this.$$("uuid");if(l&&c)return this.ci(Q(re(l,c),s));if(c)return this.ci(Q(re(l,c),s));let u=this.$$("proxy-cname");if(u)return this.ci(Q(u,s,this.ta(o)));let p=this.$$("pubkey");if(p)return this.ci(Q(`https://${p}.ucr.io/`,s,this.ta(o)))}ci(t){let e=this.$$("secure-delivery-proxy");return e?je(e,{previewUrl:t},{transform:n(o=>window.encodeURIComponent(o),"transform")}):t}Ue(t,e=1,o=true){let s=t.getBoundingClientRect(),a=e*Math.round(s.width),l=o?"":e*Math.round(s.height);return a||l?`${a||""}x${l||""}`:null}Ku(t){let e=n(s=>{s.stopPropagation();let a=new Event(s.type,s);this.dispatchEvent(a);},"proxifyEvent"),o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Ut||(this.Po({elNode:this.Rt}),this.appendChild(this.Rt)),this.Rt}get cr(){return this.Ut?{type:Ms.PREVIEW,img:this.At}:{type:Ms.MAIN,img:this.img}}get Ut(){return this.$$("is-preview-blur")}get ia(){return this.$$("is-background-for")}get ra(){let t=this.$$("breakpoints");if(t){let e=J(t);return Ba(e.map(o=>parseInt(o,10)))}else return null}get ea(){return this.$$("format").toLowerCase()==="jpeg"}oa(t){let e=new Set;e.add(`url("${this.vt(this.Ue(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.vt(this.Ue(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.vt(this.Ue(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}sa(){let t=new Set;return this.ra?this.ra.forEach(e=>{t.add(`${this.vt(`${e}x`)} ${this.lr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.vt(`${e*2}x`)} ${this.lr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.vt(`${e*3}x`)} ${this.lr(`${e*3}w`)}`);}):(t.add(`${this.vt(this.Ue(this.cr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.vt(this.Ue(this.cr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.vt(this.Ue(this.cr.img,3))} 3x`)),[...t].join()}na(){return this.vt()}get aa(){return this.vt("100x","100")}ju(){let t=this.ia;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.oa(e);}):this.oa(e);});}Gu({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}Po({elNode:t}){this.Ku(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:o}){return new Promise((s,a)=>{this.Po({elNode:o}),o.setAttribute(xs,""),o.addEventListener("load",()=>{o.removeAttribute(xs),s(o);}),o.addEventListener("error",()=>{a(false);}),this.Gu({elNode:o,src:t,srcset:e});})}async qu(){if(this.$$("intersection")){this.Ut&&(this.Po({elNode:this.At}),this.appendChild(this.At)),this.initIntersection(this.cr.img,async()=>{this.Ut&&(this.At.src=this.aa);try{await this.Lo({src:this.na(),srcset:this.sa(),elNode:this.Rt}),this.Ut&&await this.At.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}});return}try{this.Ut&&(await this.Lo({src:this.aa,elNode:this.At}),this.appendChild(this.At)),await this.Lo({src:this.na(),srcset:this.sa(),elNode:this.Rt}),this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}}init(){this.ia?this.ju():this.qu();}};var Is=class extends oo{static{n(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Ed}=Cn,Ha=n(r=>r,"i");var Os=n((r,i)=>i===void 0?r?.Vt!==void 0:r?.Vt===i,"l"),Ka=n(r=>r?.Vt?.h!=null,"d");var Ga=n(r=>r.strings===void 0,"r"),ja=n(()=>document.createComment(""),"s"),Xt=n((r,i,t)=>{let e=r.Pt.parentNode,o=i===void 0?r.Te:i.Pt;if(t===void 0){let s=e.insertBefore(ja(),o),a=e.insertBefore(ja(),o);t=new Ed(s,a,r,r.options);}else {let s=t.Te.nextSibling,a=t.m,l=a!==r;if(l){let c;t.Wu?.(r),t.m=r,t._i!==void 0&&(c=r.X)!==a.X&&t._i(c);}if(s!==o||l){let c=t.Pt;for(;c!==s;){let u=Ha(c).nextSibling;Ha(e).insertBefore(c,o),c=u;}}}return t},"v"),pe=n((r,i,t=r)=>(r.Et(i,t),r),"u"),xd={},Mi=n((r,i=xd)=>r.r=i,"p"),Ii=n(r=>r.r,"M"),so=n(r=>{r.Ee(),r.Pt.remove();},"h"),qa=n(r=>{r.Ee();},"j");var Oi=n((r,i)=>{let t=r.Tt;if(t===void 0)return false;for(let e of t)e.hn?.(i,false),Oi(e,i);return true},"s"),no=n(r=>{let i,t;do{if((i=r.m)===void 0)break;t=i.Tt,t.delete(r),r=i;}while(t?.size===0)},"o"),Wa=n(r=>{for(let i;i=r.m;r=i){let t=i.Tt;if(t===void 0)i.Tt=t=new Set;else if(t.has(r))break;t.add(r),kd(i);}},"r");function Sd(r){this.Tt!==void 0?(no(this),this.m=r,Wa(this)):this.m=r;}n(Sd,"h");function Ad(r,i=false,t=0){let e=this.r,o=this.Tt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Oi(e[s],false),no(e[s]);else e!=null&&(Oi(e,false),no(e));else Oi(this,r);}n(Ad,"n");var kd=n(r=>{r.type==Ft.CHILD&&(r._i??=Ad,r.Wu??=Sd);},"c"),ao=class extends ft{static{n(this,"f");}constructor(){super(...arguments),this.Tt=void 0;}oo(i,t,e){super.oo(i,t,e),Wa(this),this.isConnected=i.X;}hn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Oi(this,i),no(this));}setValue(i){if(Ga(this.ir))this.ir.Et(i,this);else {let t=[...this.ir.r];t[this.Au]=i,this.ir.Et(t,this,0);}}disconnected(){}reconnected(){}};var O=n(()=>new Ps,"e"),Ps=class{static{n(this,"h");}},Ls=new WeakMap,L=ut(class extends ao{render(r){return $}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)),$}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Ls.get(i);t===void 0&&(t=new WeakMap,Ls.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"?Ls.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 Us=null,Li=class extends E{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=n(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.Zu=()=>{this.closeDialog();};this.Yu=t=>{this.Ro=t.target;};this.Xu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ui=({id:t})=>{t===this.id?(Us=t,this.show(),this.emit(k.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.di=({id:t})=>{t===this.id&&(this.hide(),this.emit(k.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.la=t=>{this.hide(),Us===this.id&&this.emit(k.MODAL_CLOSE,{modalId:Us,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{n(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(tt.OPEN,this.ui),this.modalManager?.subscribe(tt.CLOSE,this.di),this.modalManager?.subscribe(tt.CLOSE_ALL,this.la);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(tt.OPEN,this.ui),this.modalManager?.unsubscribe(tt.CLOSE,this.di),this.modalManager?.unsubscribe(tt.CLOSE_ALL,this.la);}Qu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Zu),this.dialogEl.value?.addEventListener("mousedown",this.Yu),this.dialogEl.value?.addEventListener("mouseup",this.Xu);}render(){return y`<dialog ${L(this.Qu)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Li.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Li.prototype,"blockBodyScrolling",2);var lo=class extends I{constructor(){super(...arguments);this.K=null;this.ur=null;}static{n(this,"FormInput");}get ca(){return this.nameAttrValue??this.ctxName}ua(){let t=document.createElement("input");return t.type="text",t.name=this.ca,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Zr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.ua(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.ur){let a=document.createElement("div");this.appendChild(a),this.ur=a;}if(!this.K){let a=this.ua();this.appendChild(a),this.K=a;}if(this.ur.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let a=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(a??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl).filter(a=>typeof a=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.K.value=o[0],this.K.setCustomValidity("");return}this.K.remove(),this.K=null;let s=new DocumentFragment;for(let a of o){let l=document.createElement("input");l.type="hidden",l.name=`${this.ca}[]`,l.value=a,s.appendChild(l);}this.ur.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],lo.prototype,"nameAttrValue",2);var Rs=class extends E{static{n(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Je=class extends E{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.yt=0;this.dr=O();this.da=()=>{let t=this.dr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.yt>0&&t.classList.add("uc-fake-progress--hidden");}};}static{n(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.yt=this.Uo(this.value),this.$o(),this.dr.value?.addEventListener("animationiteration",this.da);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.yt=e;else {let o=Math.max(this.yt,e);o!==this.yt&&(this.yt=o,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.yt=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.dr.value?.removeEventListener("animationiteration",this.da);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.yt.toString());}render(){return y`<div ${L(this.dr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Je.prototype,"hasFileName",2),h([b({type:Number})],Je.prototype,"value",2),h([b({type:Boolean,reflect:true})],Je.prototype,"visible",2);var Pi=class extends I{constructor(){super();this.kt=false;this.$e=0;this.init$={...this.init$,"*commonProgress":0};}static{n(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.kt=t;}),this.sub("*commonProgress",t=>{this.$e=t;});}updated(t){super.updated(t),t.has("visible")&&(this.kt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return y`<uc-progress-bar .value=${this.$e} .visible=${this.kt}></uc-progress-bar>`}};h([g()],Pi.prototype,"kt",2),h([g()],Pi.prototype,"$e",2);var ti=class extends E{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Ju=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{n(this,"Select");}render(){return y`<select @change=${this.Ju} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],ti.prototype,"value",2),h([b({type:Boolean,reflect:true})],ti.prototype,"disabled",2),h([b({type:Array,attribute:false})],ti.prototype,"options",2);var he=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.pr="";}static{n(this,"SourceBtn");}willUpdate(t){super.willUpdate(t),t.has("source")&&this.td(this.source);}td(t){if(!t){this.pr="",this.Fo="default";return}let{label:e,icon:o,id:s}=t;this.pr=e,this.Fo=o??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return y`<button aria-label=${this.l10n(this.pr)} type="button" @click=${this.activate}>${this.textOnly?"":y`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":y`<div class="uc-txt">${this.l10n(this.pr)}</div>`}</button>`}};h([b({attribute:false})],he.prototype,"source",2),h([b({type:Boolean})],he.prototype,"textOnly",2),h([b({type:Boolean})],he.prototype,"iconOnly",2),h([g()],he.prototype,"Fo",2),h([g()],he.prototype,"pr",2);var ei=class{constructor(i,t){this.pa=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ha=t.onSourcesChange,i.addController(this);}static{n(this,"SourceListController");}hostConnected(){this.No=this.i.sub(S("sourceList"),t=>{this.pa=J(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.S=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.S?.(),this.S=void 0,this.No?.(),this.No=void 0;}Vo(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),o=[];this.pa.forEach(s=>{let a=this.ed(s,e);if(a.length!==1||a[0]!==s){for(let u of a){let p=e.get(u);p&&o.push(this.fa(p));}return}let c=e.get(s);c&&o.push(this.fa(c));}),this.ha(o);}ed(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}fa(i){return {id:i.id,label:i.label,icon:i.icon,onClick:n(()=>i.onSelect(),"onClick")}}};var Ui=class extends I{constructor(){super(...arguments);this.b=[];this.wrap=false;}static{n(this,"SourceList");}initCallback(){super.initCallback(),new ei(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.b=t;},"onSourcesChange")});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return y`${this.b.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};h([g()],Ui.prototype,"b",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Ui.prototype,"wrap",2);var $s=class extends E{static{n(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Lt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Le(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=a=>s(a);}),image:i,cancel:n(()=>{i.naturalWidth===0&&(i.src=Lt);},"cancel")}}n(Le,"preloadImage");function Ri(r){let i=[];for(let s of r){let a=Le(s);i.push(a);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:n(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}n(Ri,"batchPreloadImages");function Ds(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((a,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p);});},o.onerror=c=>{l(c);};});return o.src=URL.createObjectURL(r),s}n(Ds,"generateThumb");var ii=class extends I{constructor(){super(...arguments);this.hr=new Set;this.entry=null;}static{n(this,"FileItemConfig");}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,a)=>{let l=o.subscribe(s,c=>{this.isConnected&&a(c);});this.hr.add(l);})(t,e);}reset(){for(let t of this.hr)t();this.hr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.hr=new Set;}};function Md(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}n(Md,"createSvgBlobUrl");function co(r="hsl(209, 21%, 65%)",i=32,t=32){return Md(`<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>`)}n(co,"fileCssBg");var Id=3e3,ri=class extends ii{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.jt="";this.ma=false;this.fr=null;this.ga=false;this.rd=this.cfg.filesViewMode;this.va=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),a=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.od(e);if(o&&s&&a){let p=await this.proxyUrl(Q(re(this.cfg.cdnCname,a),at(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Le(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await Ds(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await Ds(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",co(p));}});this.mr=V(this.va.bind(this),100);}static{n(this,"Thumb");}od(t=false){t&&(this.fr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.fr?.height||0),10),parseInt(String(this?.fr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),Id)}sd(t,e){return new Promise((o,s)=>{let a=new Image;a.decoding="async";let l=n(()=>{a&&(a.onload=null,a.onerror=null,a.src=Lt,e?.removeEventListener("abort",c),a=null);},"cleanup"),c=n(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=n(()=>{l(),o();},"resolveSafe"),p=n(d=>{l(),s(d);},"rejectSafe");if(typeof a.decode=="function"){a.src=t,a.decode().then(u).catch(p);return}a.onload=u,a.onerror=p,a.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}nd(t){if(this.Bo(),!t){this.jt&&(this.jt="");return}if(t===this.jt)return;let e=new AbortController,o={controller:e,cancel:n(()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);},"cancel")};this._o=o,this.sd(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.jt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}gr(t=false){if(this.entry){if(t){this.va(true);return}this.ga&&this.mr();}}firstUpdated(t){super.firstUpdated(t),this.ya();}updated(t){super.updated(t),t.has("uid")&&this.ya();}pi(t){let[e]=t;e&&(this.ga=e.isIntersecting,e.isIntersecting&&(this.fr=e.boundingClientRect,this.gr(),this.s?.disconnect()),e.intersectionRatio===0&&this.mr.cancel());}reset(){super.reset(),this.mr.cancel(),this.Bo(),this.jt&&(this.jt="");}ya(){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=n(()=>{this.gr();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.nd(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.gr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ma&&(this.rd==="list"&&this.gr(true),this.ma=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.mr.cancel(),this.Bo(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.jt||Lt} role="img" alt="Preview of uploaded image" ?hidden=${!this.jt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],ri.prototype,"badgeIcon",2),h([b({attribute:false})],ri.prototype,"uid",2),h([g()],ri.prototype,"jt",2);var Fs=class extends D{static{n(this,"ActivityHeader");}};var Vs=class extends D{constructor(){super(...arguments);this.historyTracked=true;this.activityType=D.activities.START_FROM;}static{n(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Ns=class extends I{constructor(){super(...arguments);this.ba=null;}static{n(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=k;}initCallback(){super.initCallback(),this.ba=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ba?.();}};var me=n((r,i)=>{let t=false,e,o=0,s=n(((...a)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...a),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...a),o=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:n(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var Za=n((r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},"u"),$i=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.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=[],a=0;for(let l of r)o[a]=e?e(l,a):a,s[a]=t(l,a),a++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=Ii(r),{values:s,keys:a}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=a,s;let l=this.ut??=[],c=[],u,p,d=0,m=o.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(o[d]===null)d++;else if(o[m]===null)m--;else if(l[d]===a[f])c[f]=pe(o[d],s[f]),d++,f++;else if(l[m]===a[v])c[v]=pe(o[m],s[v]),m--,v--;else if(l[d]===a[v])c[v]=pe(o[d],s[v]),Xt(r,c[v+1],o[d]),d++,v--;else if(l[m]===a[f])c[f]=pe(o[m],s[f]),Xt(r,o[d],o[m]),m--,f++;else if(u===void 0&&(u=Za(a,f,v),p=Za(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(a[f]),T=w!==void 0?o[w]:null;if(T===null){let C=Xt(r,o[d]);pe(C,s[f]),c[f]=C;}else c[f]=pe(T,s[f]),Xt(r,o[d],T),o[w]=null;f++;}else so(o[m]),m--;else so(o[d]),d++;for(;f<=v;){let w=Xt(r,c[v+1]);pe(w,s[f]),c[f++]=w;}for(;d<=m;){let w=o[d++];w!==null&&so(w);}return this.ut=a,Mi(r,c),st}});var Ya="important",Od=" !"+Ya,Qt=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(Od);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?Ya:""):t[e]=o;}}return st}});var dt=ut(class extends ft{constructor(r){if(super(r),r.type!==Ft.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 Ld="file-item-remove-button",Jt=class extends I{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{n(this,"FileActionButton");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get ad(){return Math.min(Math.max(this.progress||0,0),100)}ld(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=dt({"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.ad,o=this.l10n(Ld);return y`<button type="button" @click=${this.ld} 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=${Qt({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};h([b({type:Boolean})],Jt.prototype,"uploading",2),h([b({type:Boolean})],Jt.prototype,"failed",2),h([b({type:Boolean})],Jt.prototype,"success",2),h([b({type:Boolean})],Jt.prototype,"idle",2),h([b({type:Boolean})],Jt.prototype,"hideRemove",2),h([b({type:Number})],Jt.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 ii{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.wa=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.yt=0;this.cd=false;this.jo="";this.Go=false;this.qo=false;this.Wo=false;this.xa=false;this.Ta=false;this.Zo=false;this.Ea="";this.vr=[];this.Ca=false;this.Yo=()=>{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.Uh=()=>{this.Sa();};this._=V(()=>this.Aa(),100);this.dd=this.withEntry(me((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),a=t.getValue("externalUrl"),l=e===Y.FINISHED,c=e===Y.UPLOADING,u=e===Y.QUEUED_UPLOADING,p=e===Y.QUEUED_VALIDATION,d=e===Y.VALIDATION,m=t.getValue("fileName"),f="";o?f="":!l&&a&&s&&Object.values(gt).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${Ca(s)}`)})),this.Ko=f,this.Ho=o,this.cd=c||u||p||d,this.yt=p||d?0:t.getValue("uploadProgress"),this.Ea=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Sa=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._();try{let o=new AbortController;t.setValue("abortController",o);let s=n(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let m=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of m)try{let v=f.handler({file:l,signal:o.signal}),w=new Promise((C,A)=>setTimeout(()=>A(new Error("beforeUpload hook timed out")),f.timeout)),{file:T}=await Promise.race([v,w]);T!==l&&(l=T,t.setValue("mimeType",l.type||null),t.setValue("isImage",He(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:n(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:o.signal,metadata:await this.getMetadataFor(t.uid),tags:await this.getTagsFor(t.uid)};return this.debugPrint("upload options",c,p),is(c,p)},"uploadTask"),a=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:a,isQueuedForUploading:!1,isUploading:!1,fileName:a.originalFilename,fileSize:a.size,isImage:a.isImage??!1,mimeType:a.contentInfo?.mime?.mime??a.mimeType,uuid:a.uuid,cdnUrl:t.getValue("cdnUrl")??a.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this._();}catch(o){let s=o instanceof se&&o.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof Ae?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._(),this.isConnected&&!s&&this.telemetryManager.sendEventError(o,"file upload. Failed to upload file");}}});}static{n(this,"FileItem");}Aa(){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.ud(t,e);}ud(t,e){e===Y.FAILED?this.jo="badge-error":e===Y.FINISHED&&(this.jo="badge-success"),e===Y.UPLOADING&&(this.Ta=false,this.removeAttribute("focused")),this.qo=e===Y.FAILED,this.Wo=e===Y.UPLOADING,this.xa=e===Y.QUEUED_UPLOADING||e===Y.UPLOADING,this.Go=e===Y.FINISHED,this.dd(e);}reset(){super.reset(),this._.cancel();}pi(t){let[e]=t;e&&e.isIntersecting&&!this.Ca&&(this.wa=false,this.Ca=true);}ka(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.ce();return}this.subEntry("isQueuedForValidation",()=>{this._();}),this.subEntry("isValidationPending",()=>{this._();}),this.subEntry("uploadProgress",()=>{this._();}),this.subEntry("isQueuedForUploading",()=>{this._();}),this.subEntry("fileName",o=>{this.zo=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._();}),this.subEntry("externalUrl",o=>{this.zo=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this._();}),this.subEntry("errors",()=>this._()),this.subEntry("isUploading",()=>this._()),this.subEntry("fileSize",()=>this._()),this.subEntry("mimeType",()=>this._()),this.subEntry("isImage",()=>this._()),this.subEntry("fileInfo",()=>this.ce()),this.subEntry("isUploading",()=>this.ce()),this.subEntry("errors",()=>this.ce()),this.Aa(),this.ce();}Ma(t){if(this.cfg.filesViewMode==="list"){this.Zo=true;return}this.Zo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.ka(this.uid);}ce(){let t=this.e.pluginManager;if(!t||!this.uid){this.vr=[];return}let e=t.snapshot().fileActions,o=this.api.getOutputItem(this.uid);if(!o){this.vr=[];return}this.vr=e.filter(s=>{try{return s.shouldRender(o)}catch(a){return console.error(`Error in plugin file action shouldRender (${s.id}):`,a),false}});}pd(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.ka(this.uid),this.subConfigValue("filesViewMode",e=>{this.Ma(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Ma(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.Sa());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.ce())),this.ce(),W.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback(),this.s?.disconnect(),W.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.wa?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.Wo} ?data-failed=${this.qo} ?data-focused=${this.Ta} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Ea}><span class="uc-file-name" ?hidden=${!this.Zo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.vr.map(t=>y`<button type="button" @click=${()=>this.pd(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.Yo} .uploading=${this.Wo} .hideRemove=${this.xa} .progress=${this.yt} .failed=${this.qo} .success=${this.Go} ></uc-file-action-button></div></div>`}};h([g()],W.prototype,"wa",2),h([b({attribute:false})],W.prototype,"uid",2),h([g()],W.prototype,"zo",2),h([g()],W.prototype,"Ho",2),h([g()],W.prototype,"Ko",2),h([g()],W.prototype,"yt",2),h([g()],W.prototype,"cd",2),h([g()],W.prototype,"jo",2),h([g()],W.prototype,"Go",2),h([g()],W.prototype,"qo",2),h([g()],W.prototype,"Wo",2),h([g()],W.prototype,"xa",2),h([g()],W.prototype,"Ta",2),h([g()],W.prototype,"Zo",2),h([g()],W.prototype,"Ea",2),h([g()],W.prototype,"vr",2);var _s=W;function Pd(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=n(o=>{o.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}n(Pd,"checkIsDirectory");function Ud(r,i){return new Promise(t=>{let e=0,o=[],s=n(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});o.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(o);})):l.isDirectory&&a(l.createReader());},"readEntry"),a=n(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(o);});},"readReaderContent");s(r);})}n(Ud,"readEntryContentAsync");function Xa(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,a=o;if(typeof a.webkitGetAsEntry=="function"||typeof a.getAsEntry=="function"){let c=typeof a.webkitGetAsEntry=="function"?a.webkitGetAsEntry():a.getAsEntry?.();c&&t.push(Ud(c,s).then(u=>{u&&i.push(...u);}));continue}let l=o.getAsFile();l&&t.push(Pd(l).then(c=>{c||i.push({type:"file",file:l});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(a=>{i.push({type:"url",url:a}),s();});}));}return Promise.all(t).then(()=>i)}n(Xa,"getDropItems");var pt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Qa=["focus"],Rd=100,Bs=new Map;function $d(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))}n($d,"distance");function zs(r){let i=0,t=document.body,e=new Set,o=n(v=>{e.add(v);},"handleSwitch"),s=pt.INACTIVE,a=n(v=>{r.shouldIgnore()&&v!==pt.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=n(()=>i>0,"isDragging");o(v=>r.onChange(v));let c=n(()=>{i=0,a(pt.INACTIVE);},"onResetEvent"),u=n(()=>{i+=1,s===pt.INACTIVE&&a(pt.ACTIVE);},"onDragEnter"),p=n(()=>{i-=1,l()||a(pt.INACTIVE);},"onDragLeave"),d=n(v=>{v.preventDefault(),i=0,a(pt.INACTIVE);},"onDrop"),m=n(v=>{if(r.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=r.element.getBoundingClientRect(),C=Math.floor($d(w,T)),A=C<Rd,N=v.composedPath().includes(r.element);Bs.set(r.element,C);let et=Math.min(...Bs.values())===C;N&&et?(v.preventDefault(),a(pt.OVER)):a(A&&et?pt.NEAR:pt.ACTIVE);},"onDragOver"),f=n(async v=>{if(r.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Xa(w);r.onItems(T),a(pt.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),r.element.addEventListener("drop",f),Qa.forEach(v=>{window.addEventListener(v,c);}),()=>{Bs.delete(r.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),r.element.removeEventListener("drop",f),Qa.forEach(v=>{window.removeEventListener(v,c);});}}n(zs,"addDropzone");var Hs=new Set,Tt=class extends I{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.zt=true;this.Ia=true;this.Xo="drop-files-here";this.ue=false;this.Pa=null;this.Qo=null;this.La=O();this.De=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.Ra=true;this.Fe=false;}static{n(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Oa(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Xo=t;return}this.Xo=this.ue?"drop-files-here":"drop-file-here";}isActive(){if(!this.zt)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),a=s.visibility!=="hidden"&&s.display!=="none";return e&&a&&o}initCallback(){super.initCallback(),Hs.add(this),this.Jo(),this.ts(),this.Ua(),this.$a(pt.INACTIVE),this.Pa=zs({element:this,shouldIgnore:n(()=>this.Da(),"shouldIgnore"),onChange:n(t=>{this.$a(t);},"onChange"),onItems:n(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();},"onItems")}),this.updateComplete.then(()=>this.hd()),this.subConfigValue("sourceList",t=>{let e=J(t);this.Ra=e.includes(R.LOCAL),this.Jo(),this.ts();}),this.subConfigValue("multiple",t=>{this.ue=!!t,this.Oa();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Jo(),this.ts()),(t.has("text")||t.has("localeId"))&&this.Oa();}updated(t){super.updated(t),t.has("clickable")&&this.Ua();}Da(){if(!this.zt||!this.fd())return true;if(!this.fullscreen)return false;let t=Hs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}fd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}Jo(){let t=this.Ra&&!this.disabled;this.zt=t;}ts(){let t=this.zt||!this.querySelector("[data-default-slot]");this.Ia=t,this.hidden=!t;}$a(t){let e=Object.entries(pt).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}hd(){if(this.Qo)return;let t=this.La.value;t&&(this.Qo=zs({element:t,onChange:n(e=>{let o=Object.entries(pt).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this.Da(),"shouldIgnore")}));}Ua(){this.clickable&&!this.Fe?(this.addEventListener("keydown",this.De),this.addEventListener("click",this.De),this.Fe=true):!this.clickable&&this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}disconnectedCallback(){super.disconnectedCallback(),Hs.delete(this),this.Pa?.(),this.Qo?.(),this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.La)} class="uc-content-wrapper" ?hidden=${!this.Ia} ><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.Xo)}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],Tt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],Tt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],Tt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],Tt.prototype,"initflow",2),h([b({type:String})],Tt.prototype,"text",2),h([g()],Tt.prototype,"zt",2),h([g()],Tt.prototype,"Ia",2);var Pt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=D.activities.UPLOAD_LIST;this.Fa=false;this.Na=false;this.Va=false;this.es=false;this.rs=false;this.yr=null;this._a=false;this.os=null;this.Ba=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.ss=()=>{this.emit(k.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.ns=()=>{this.emit(k.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.$t=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=me(()=>{this.isConnected&&(this.vd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{n(this,"UploadList");}get md(){return this.os?this.gd(this.os):""}vd(){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"),a=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&o&&c&&f;}this.Fa=p,this.Na=d,this.Va=u,this.rs=e.total===0||!s&&!a,this.es=!a||this.cfg.multiple,this._a=e.total>0,this.os=e;}gd(t){let e=n(o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.q),this.subConfigValue("multipleMin",this.q),this.subConfigValue("multipleMax",this.q),this.sub("*groupInfo",t=>{t&&this.q();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.yr=null;return}this.yr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.md}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this._a}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${$i(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Ba} ?disabled=${!this.rs} ?hidden=${!this.es} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.yr} >${this.yr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.es} ?disabled=${!this.rs} @click=${this.Ba} ><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.Va} @click=${this.ss} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Fa} ?disabled=${!this.Na} @click=${this.ns} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"Fa",2),h([g()],Pt.prototype,"Na",2),h([g()],Pt.prototype,"Va",2),h([g()],Pt.prototype,"es",2),h([g()],Pt.prototype,"rs",2),h([g()],Pt.prototype,"yr",2),h([g()],Pt.prototype,"_a",2),h([g()],Pt.prototype,"os",2);var Dd=[{test:n(r=>!!r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:n(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ja=V(r=>{for(let{test:i,message:t}of Dd)i(r)&&Xr(t);},0);var tl=n((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),Fd="0123456789abcdefghijklmnopqrstuvwxyz",el=n(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Fd[Number(t)]+i,r=r/36n;}return i},"a"),js=n((r,i)=>{try{let t=new URL(r).hostname,e=new URL(i).hostname;return t===e||t.endsWith(`.${e}`)}catch{return false}},"c");var Vd=n(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Nd=10,_d=n(async r=>{let i=await Vd(r);return el(i).slice(0,Nd)},"d"),il=n(async(r,i)=>{let t=await _d(r);return tl(t,i)},"f");var rl=n(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var Ks=n(r=>r,"defineComputedProperty"),Bd=[Ks({key:"cameraModes",deps:["enableVideoRecording"],fn:n(({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)},"fn")}),Ks({key:"cameraModes",deps:["defaultCameraMode"],fn:n(({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)},"fn")}),Ks({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:n(({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>{let e=r(),o=i(),s=t();return e&&(o===bi||js(o,s))?il(e,s):o},"fn")})],ol=n(({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of Bd){if(!o.deps.includes(r))continue;let s={[o.key]:()=>t(o.key)};for(let c of o.deps)s[c]=()=>t(c);let a=new AbortController;e.get(o.fn)?.abort(),e.set(o.fn,a);let l;try{l=o.fn(s,{signal:a.signal});}catch(c){e.get(o.fn)===a&&e.delete(o.fn),console.error(`Failed to compute value for "${o.key}"`,c);return}rl(l)?l.then(c=>{a.signal.aborted||i(o.key,c);}).catch(c=>{a.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,c);}).finally(()=>{e.get(o.fn)===a&&e.delete(o.fn);}):i(o.key,l);}},"computeProperty");var B=n(r=>String(r),"asString"),rt=n(r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},"asNumber"),H=n(r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},"asBoolean"),sl=n(r=>r==="auto"?r:H(r),"asStore"),nl=n(r=>{let i=B(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),al=n(r=>{let i=B(r);if(!Object.values(U).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),ll=n(r=>{let i=B(r),t=Z(i);if(t.some(e=>!Object.values(U).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),cl=n(r=>{let i=B(r);if(i==="local"||i==="global")return i;if(H(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),ul=n(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),dl=n(r=>{if(Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid tags value. Must be an array or function.")},"asTags"),Gs=n(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),uo=n(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),po=n(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),pl=n(r=>{let i=B(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode"),hl=n(r=>{let i=B(r);if(["auto","menu","toolbar","compact","plain"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asDynamicButtonViewMode");var zd={pubkey:B,multiple:H,multipleMin:rt,multipleMax:rt,confirmUpload:H,imgOnly:H,accept:B,externalSourcesPreferredTypes:B,externalSourcesEmbedCss:B,store:sl,cameraMirror:H,cameraCapture:nl,sourceList:B,topLevelOrigin:B,maxLocalFileSizeBytes:rt,thumbSize:rt,showEmptyList:H,useLocalImageEditor:H,useCloudImageEditor:H,cloudImageEditorTabs:B,removeCopyright:H,cropPreset:B,imageShrink:B,modalScrollLock:H,modalBackdropStrokes:H,sourceListWrap:H,remoteTabSessionKey:B,cdnCname:B,cdnCnamePrefixed:B,baseUrl:B,socialBaseUrl:B,secureSignature:B,secureExpire:B,secureDeliveryProxy:B,retryThrottledRequestMaxTimes:rt,retryNetworkErrorMaxTimes:rt,multipartMinFileSize:rt,multipartChunkSize:rt,maxConcurrentRequests:rt,multipartMaxConcurrentRequests:rt,multipartMaxAttempts:rt,checkForUrlDuplicates:H,saveUrlForRecurrentUploads:H,groupOutput:H,userAgentIntegration:B,debug:H,localeName:B,metadata:ul,tags:dl,secureUploadsExpireThreshold:rt,localeDefinitionOverride:n(r=>Gs(r),"localeDefinitionOverride"),secureUploadsSignatureResolver:n(r=>uo(r),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:n(r=>uo(r),"secureDeliveryProxyUrlResolver"),iconHrefResolver:n(r=>uo(r),"iconHrefResolver"),plugins:n(r=>po(r),"plugins"),fileValidators:po,collectionValidators:po,validationTimeout:rt,validationConcurrency:rt,cameraModes:ll,defaultCameraMode:al,enableAudioRecording:H,enableVideoRecording:H,mediaRecorderOptions:Gs,maxVideoRecordingDuration:rt,filesViewMode:pl,gridShowFileNames:H,cloudImageEditorAutoOpen:H,cloudImageEditorMaskHref:B,testMode:H,qualityInsights:H,pasteScope:cl,dynamicButtonShowFirstIcon:H,dynamicButtonViewMode:hl},ml=n((r,i)=>{if(!(typeof i>"u"||i===null))try{return zd[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),it[r]}},"normalizeConfigValue");var ho=[...new Set(["debug",...Object.keys(it)])],Hd=["metadata","tags","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],gl=n(r=>Hd.includes(r),"isComplexKey"),Ws=ho.filter(r=>!gl(r)),qs={...Object.fromEntries(Ws.map(r=>[wr(r),r])),...Object.fromEntries(Ws.map(r=>[r.toLowerCase(),r]))},fl=n(r=>`__${r}`,"getLocalPropName"),oi=class extends E{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(it).map(([t,e])=>[S(t),e]))};this.yd=new Map;this.fi={};this.za=new Set;this.Ne=new Map;}static{n(this,"Config");}as(t){return this.za.has(t)}ls(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}cs(t){return [...new Set([wr(t),t.toLowerCase()])]}bd(t,e){if(gl(t)||this.as(t)&&this.ls(t)?.attribute===false)return;let o=this.cs(t);for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}wd(t,e){let o=S(t);if(this.$[o]!==e)if(typeof e>"u"||e===null){let s=it[t];this.$[o]=s!==void 0?s:e;}else this.$[o]=e;}Gt(t,e){let o;if(this.as(t)){let l=this.ls(t);try{o=l?.normalize?.(e)??e;}catch(c){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,c);return}}else o=ml(t,e);let s=this,a=fl(t);s[a]!==o&&(this.xd(t,s[a],o),s[a]=o,this.bd(t,o),this.wd(t,o),this.debugPrint(`"${t}"`,o),this.as(t)||Ja(this.cfg));}wr(t){let e=this,o=fl(t);return e[o]??this.$[S(t)]}xd(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));}Ha(t){let e=t.configRegistry.getAll();this.fi={},this.za=new Set(e.keys());for(let[o,s]of this.Ne)e.has(o)||(s(),this.Ne.delete(o));for(let[o,s]of e){let l=S(o);if(s.attribute){let f=this.cs(o);for(let v of f)this.fi[v]=o;}let c,u=false,p=Object.getOwnPropertyDescriptor(this,o);if(p&&!p.get&&!p.set&&p.value!==void 0&&(c=p.value,u=true),!u&&s.attribute)for(let f of this.cs(o)){let v=this.getAttribute(f);if(v!=null){try{c=s.fromAttribute?s.fromAttribute(v):v;}catch(w){console.warn(`[uc-config] fromAttribute() for "${o}" threw an error, using raw attribute value`,w),c=v;}u=true;break}}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let m=Object.getOwnPropertyDescriptor(this,o);if((!m||!m.set||!m.get)&&Object.defineProperty(this,o,{set:n(f=>{this.Gt(o,f);},"set"),get:n(()=>this.wr(o),"get"),enumerable:true,configurable:true}),!this.Ne.has(o)){let f=this.sub(l,v=>{this.Gt(o,v);},false);this.Ne.set(o,f);}u&&this.Gt(o,c);}}Td(){this.e.when("pluginManager",t=>{this.Ha(t),this.br=t.onPluginsChange(()=>{this.Ha(t);});});}Ed(){this.hi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let o=e.attributeName,s=e.oldValue,a=this.getAttribute(o);if(s===a||o in qs)continue;if(o in this.fi){let c=this.fi[o],u=this.ls(c);this.attributeChangedCallback(o,s??"",a??u?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Td(),this.Ed();for(let o of Ws)this.sub(S(o),s=>{this.Gt(o,s);},false);for(let o of ho){let s=t[o]??this.$[S(o)];s!==it[o]&&this.Gt(o,s);let a=Object.getOwnPropertyDescriptor(this,o);(!a||!a.set||!a.get)&&Object.defineProperty(this,o,{set:n(l=>{this.Gt(o,l);},"set"),get:n(()=>this.wr(o),"get")});}let e=n(o=>{ol({key:o,setValue:this.Gt.bind(this),getValue:this.wr.bind(this),computationControllers:this.yd});},"runComputeProperty");for(let o of ho)this.sub(S(o),()=>e(o));}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,a=qs[t];a?s[a]=o:this.e.when("pluginManager",l=>{let c=this.getAttribute(t);if(c&&c!==o)return;let u=this.fi[t],p=u?l.configRegistry.get(u):void 0;if(u&&p){let d=p.fromAttribute?p.fromAttribute(o):o;if(this.wr(u)===d)return;this.Gt(u,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.br&&(this.br(),this.br=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Ne.values())t();this.Ne.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(qs);return [...t,...e]}};for(let r of ho)oi.prototype[r]=void 0;var Di=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.us=()=>{this.api.initFlow();};}static{n(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.us}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.mi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Di.prototype,"dropzone",2),h([g()],Di.prototype,"mi",2);var vl=n(r=>Ka(r)?r.Vt.h:r.strings,"d"),Pe=ut(class extends ft{constructor(r){super(r),this.et=new WeakMap;}render(r){return [r]}update(r,[i]){let t=Os(this.it)?vl(this.it):null,e=Os(i)?vl(i):null;if(t!==null&&(e===null||t!==e)){let o=Ii(r).pop(),s=this.et.get(t);if(s===void 0){let a=document.createDocumentFragment();s=cr($,a),s.setConnected(false),this.et.set(t,s);}Mi(s,[o]),Xt(s,void 0,o);}if(e!==null){if(t===null||t!==e){let o=this.et.get(e);if(o!==void 0){let s=Ii(o).pop();qa(r),Xt(r,void 0,s),Mi(r,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var fe=class fe extends I{constructor(){super(...arguments);this.showIcon=false;this.ue=false;}static{n(this,"PrimaryAction");}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.ue=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}gi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.Cd();return t||(this.source?this.Sd():this.l10n(this.ue?"upload-files":"upload-file"))}Cd(){if(this.entries?.status==="uploading")return this.gi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.gi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.gi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.gi("header-total",{count:this.entries?.totalCount??0})}Sd(){if(!this.source?.id)return "";let e=fe.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.gi(e,{source:o})}us(){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();}Ad(){if(!this.ue&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?y`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.ue&&this.hasMultipleEntries)return null;if(!this.source)return y`<uc-icon .name=${fe.DEFAULT_ICON}></uc-icon>`;let t=this.source?.icon;return this.showIcon&&t?y`<uc-icon .name=${t}></uc-icon>`:null}render(){return y`<button type="button" @click=${this.us} aria-label=${this.textBasedOnLocale}>${this.Ad()}<span>${this.textBasedOnLocale}</span></button>`}};h([b({type:Object})],fe.prototype,"source",2),h([b({type:Object})],fe.prototype,"entries",2),h([g()],fe.prototype,"showIcon",2),h([g()],fe.prototype,"ue",2);var Zs=fe;var mo=class extends E{constructor(){super(...arguments);this.Ka=nt.generateFastUid();this.kd=t=>{t.currentTarget.hidePopover();};}static{n(this,"DropDown");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return y`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Ka} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Ka} class="uc-dropdown-content" popover="auto" @click=${this.kd}>${this.yield("dd-content")}</div>`}};h([g()],mo.prototype,"Ka",2);var Ys=class extends I{static{n(this,"NoWrapModeDynamicBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var jd=n((r,i)=>i==="compact"||i==="plain"||r.length===0?{main:null,remain:r}:{main:r[0]??null,remain:r.slice(1)},"adjustSourceBasedOnMode"),yl={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},Kd=3,Ut=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.qt="auto";this.b=[];this.Ve="idle";this.Ga=0;this.ds="arrow-dropdown";this.q=me(()=>{this.isConnected&&this.Md();},300);}static{n(this,"DynamicBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.Ve==="idle"}get isSuccess(){return this.Ve==="success"}get isFailed(){return this.Ve==="failed"}get isUploading(){return this.Ve==="uploading"}get isCollapsedMode(){return this.qt==="compact"}get isPlainMode(){return this.qt==="plain"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.b.length>1&&(this.qt==="toolbar"||this.qt==="auto"&&this.b.length<=Kd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.b.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.b.length===1}get hasCollectionEntries(){return (this.Tr?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}Md(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Tr=t,this.Ve=t.status;}qa(){this.xr=jd(this.b,this.qt);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.qt!==t&&(this.qt=t,this.qa());}),this.sub("*commonProgress",t=>{this.Ga=t;}),new ei(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.b=t,this.qa();},"onSourcesChange")}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.ja=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",F.UPLOAD_LIST),this.modalManager?.open(F.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.q.cancel=="function"&&this.q.cancel(),this.ja?.(),super.disconnectedCallback(),this.ds="arrow-dropdown";}Id(){return y`<uc-no-wrap-mode-dynamic-btn>${this.xr?.remain?.map(t=>y`<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.ds=yl[this.qt]??"arrow-dropdown");}Od(){this.uploadCollection.clearAll();}Pd(){this.Tr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Ld(){this.uploadCollection.abortAll();}Yo(){switch(this.Ve){case "failed":this.Pd();break;case "uploading":this.Ld();break;default:this.Od();}}Rd(){return y`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.ds}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.xr?.remain?.map(t=>y`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Ud(){let t=this.b[0],e=t&&{...t,icon:yl.compact};return y`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}$d(){return y`<uc-primary-action .entries=${this.Tr} .source=${this.xr?.main} ></uc-primary-action>`}Dd(){return y`<uc-file-action-button @uc:remove=${this.Yo} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ga} ></uc-file-action-button>`}Fd(){return dt({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Nd(){return y`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Fd()}>${Pe(this.shouldShowPrimaryAction?this.$d():null)} ${Pe(!this.isPlainMode&&this.shouldShowInline?this.Id():null)} ${Pe(!this.isPlainMode&&this.shouldShowCompactSingleSource?this.Ud():null)} ${Pe(!this.isPlainMode&&this.shouldShowDropdown?this.Rd():null)} ${Pe(this.shouldShowAbortAction||this.hasCollectionEntries?this.Dd():null)} ${Pe(this.Nd())}</div></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Ut.prototype,"dropzone",2),h([g()],Ut.prototype,"qt",2),h([g()],Ut.prototype,"b",2),h([g()],Ut.prototype,"Ve",2),h([g()],Ut.prototype,"xr",2),h([g()],Ut.prototype,"Tr",2),h([g()],Ut.prototype,"Ga",2),h([g()],Ut.prototype,"ds",2);var Fi=class extends D{constructor(){super(...arguments);this.hs=O();}static{n(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Wa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Wa(),this.isActivityActive&&(this.Er(),this.Za()));}Wa(){this.registration&&(this.Zn()||this.registerActivity(this.activityType??"",{onActivate:n(()=>this.Za(),"onActivate"),onDeactivate:n(()=>this.Er(),"onDeactivate")}));}async Za(){await this.updateComplete;let t=this.hs.value;if(!t||!this.registration)return;this.Er();let e=this.$["*currentActivityParams"];try{this.ps=this.registration.render(t,e)??void 0;}catch(o){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,o);}}Er(){let t=this.hs.value;if(t){try{this.ps?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.ps=void 0,t.replaceChildren();}}disconnectedCallback(){this.Er(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${L(this.hs)}></div>`}};h([b({attribute:false})],Fi.prototype,"registration",2);var si=class extends E{constructor(){super(...arguments);this.mode="modal";this.St=[];}static{n(this,"PluginActivityRenderer");}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Ya())),this.Ya();}Ya(){let t=this.e.pluginManager;if(!t){this.St=[];return}this.St=t.snapshot().activities;}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${$i(this.St,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${$i(this.St,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],si.prototype,"mode",2),h([g()],si.prototype,"St",2);function Vi(r,i,t){return r?i(r):t?.(r)}n(Vi,"n");function bl(...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},{})}n(bl,"normalize");function Ct(...r){let i=bl(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}n(Ct,"classNames");function wl(r,...i){let t=bl(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}n(wl,"applyClassNames");var Gd=n(r=>lt.includes(r),"isTabIdValue"),Tl=n(r=>{if(!r)return lt;let i=Z(r).filter(Gd);return i.length===0?lt:i},"parseTabs");function Cl(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":K.CROP,"*on.retryNetwork":n(()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Lt,t.src=e;}r.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":n(i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=at(oe(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.apply"),"*on.cancel":n(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}n(Cl,"initState");var El="<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 Ue={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ni=class extends E{constructor(){super(...arguments);this.kt=false;this.Xa=Ue;this.Qa=Ue.visible;this.Ja=Ue.hidden;this.fs=false;this.tl=false;}static{n(this,"PresenceToggle");}set visible(t){this.kt=t,this.il();}get visible(){return this.kt}set styles(t){this.Xa=t,this.fs=true,this.Qa=t.visible??Ue.visible,this.Ja=t.hidden??Ue.hidden;}get styles(){return this.Xa}il(){this.style.visibility=this.kt?"inherit":"hidden",wl(this,{[Ue.transition]:!this.fs,[this.Qa]:this.kt,[this.Ja]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Vd(){this.tl||(this.tl=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.fs||this.classList.add(Ue.transition),this.il(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Vd();},0);}};h([b({type:Boolean})],ni.prototype,"visible",1),h([b({attribute:false})],ni.prototype,"styles",1);var Ni=class extends E{constructor(){super(...arguments);this.active=false;this.de=O();this.ms=false;this.gs=()=>{let t=this.de.value;t&&(this.rl(t),this.ms&&this.active&&this.vs());};}static{n(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.vs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.vs():this._d());}vs(){let t=this.de.value;if(!t)return;this.ms=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.gs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.gs,{once:true});}_d(){let t=this.de.value;t&&(this.ms=false,t.removeEventListener("transitionend",this.gs),this.rl(t));}rl(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.de)}></div></div>`}};h([b({type:Boolean,reflect:true})],Ni.prototype,"active",2);var X=n(r=>r??$,"o");var kt=class extends E{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{n(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.ol(),this.sl();}updated(t){super.updated(t),t.has("reverse")&&this.ol(),t.has("theme")&&this.sl();}ol(){this.style.flexDirection=this.reverse?"row-reverse":"";}sl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Bd(){let t=this.ys;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.zd}}get ys(){return !this.icon}get zd(){return !this.text&&!this.ys}render(){return y`<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=${dt(this.Bd)} name=${X(this.icon||void 0)} ?hidden=${this.ys} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],kt.prototype,"text",2),h([b({type:String})],kt.prototype,"icon",2),h([b({type:Boolean,reflect:true})],kt.prototype,"reverse",2),h([b({type:String,reflect:true})],kt.prototype,"theme",2),h([b({attribute:"aria-role"})],kt.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],kt.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],kt.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],kt.prototype,"active",2);function xl(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}n(xl,"pick");function ai(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),a=o>=2?"lightest":"normal";return Q(r,at(vr,oe(t),`quality/${a}`,`stretch/off/-/resize/${s}x`,`@clib/${$t}/${Dt}/uc-cloud-image-editor/`))}n(ai,"viewerImageSrc");var _i=class extends E{constructor(){super(...arguments);this.nl=`uc-backdrop-mask-${nt.generateFastUid()}`;this.Sr=false;this.wi=false;this.cl=O();this.xi=false;this.Ti=null;this.dl=t=>{this.pl(),this.Ei&&(t.stopPropagation(),t.preventDefault(),this.Ei=false);};this.hl=t=>{if(!this.Ei||!this.Cr||!this.xs)return;t.stopPropagation(),t.preventDefault();let e=this.Wt;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),a=t.x-o,l=t.y-s,c=a-this.Cr[0],u=l-this.Cr[1],{direction:p}=this.xs,d=this.Xd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.fl=t=>{if(!this.Dt)return;let e=Object.values(this.Dt).find(o=>{if(!o||this.Es(o.direction))return false;let a=o.interactionNode.getBoundingClientRect(),l={x:a.x,y:a.y,width:a.width,height:a.height};return Ua(l,[t.x,t.y])});this.al=e,this.pl();};}static{n(this,"CropFrame");}get Wt(){return this.cl.value??null}get Ei(){return this.wi}set Ei(t){this.wi!==t&&(this.wi=t,this.Ts());}Ts(){this.yi&&this.yi.setAttribute("class",Ct({"uc-guides--hidden":this.Sr,"uc-guides--visible":!this.Sr&&this.wi,"uc-guides--semi-hidden":!this.Sr&&!this.wi}));}Es(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let o=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return o||s}Hd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:a}=t,l=this.Wt;if(!l)return;let c=wt("mask",{id:this.nl}),u=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=wt("rect",{x:e,y:o,width:s,height:a,fill:"black"});c.appendChild(u),c.appendChild(p);let d=wt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.nl})`});l.appendChild(d),l.appendChild(c),this.vi=c,this.bs=p;}Kd(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}jd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:a}=t;this.bs&&ce(this.bs,{x:e,y:o,width:s,height:a});}Gd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.Dt)){for(let e of Object.values(this.Dt)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:a,groupNode:l}=e,c=o==="",u=o.length===2,{x:p,y:d,width:m,height:f}=t;if(c)ce(a,{x:p,y:d,width:m,height:f});else {let w=ue(Math.min(m,f)/82/2,0,1),T=u?Ma(t,o,w):Ia(t,o,w),C=T.center;if(!C)continue;let A=Math.max(Es*ue(Math.min(m,f)/Es/3,0,1),ka);ce(a,{x:C[0]-A,y:C[1]-A,width:A*2,height:A*2}),ce(s,{d:T.d});}let v=this.Es(o);l.setAttribute("class",Ct("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ce(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ul(t,e){let o=wt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=wt("rect",{fill:"transparent"}),a=wt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(s),t[e]={direction:e,pathNode:a,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.qd.bind(this,e));}Wd(){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.ul(t,s);}return this.ul(t,""),t}Zd(){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:`${Ai*o}%`,y1:"0%",x2:`${Ai*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:`${Ai*o}%`,x2:"100%",y2:`${Ai*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Yd(){let t=this.Wt;if(!t)return;let e=document.createDocumentFragment(),o=this.Zd();e.appendChild(o);let s=this.Wd();for(let{groupNode:a}of Object.values(s))e.appendChild(a);t.appendChild(e),this.Dt=s,this.yi=o,this.Ts();}qd(t,e){if(!this.Dt)return;let o=this.Dt[t];if(!o||this.Es(t))return;let s=this.$["*cropBox"],a=this.Wt;if(!a)return;let{x:l,y:c}=a.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.Ei=true,this.xs=o,this.Cr=[u,p],this.ll={...s};}Xd(t,e){let[o,s]=e,a=this.$["*imageBox"],l=this.ll??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=La({rect:l,delta:[o,s],imageBox:a}):l=Pa({rect:l,delta:[o,s],direction:t,aspectRatio:u,imageBox:a}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return We(Ye(l),a)}pl(){let t=this.al,e=this.Wt;e&&(e.style.cursor=t?Oa(t.direction):"initial");}ml(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.Wt;if(!e){this.Ti=t;return}this.Ti=null;let o=document.createDocumentFragment(),s=wt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.bi=s;}Qd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:o,width:s,height:a}=t;ce(this.bi,{x:e,y:o,height:a,width:s});}Cs(){this.xi&&(this.jd(),this.Gd(),this.Qd());}toggleThumbs(t){if(this.Dt)for(let e of Object.values(this.Dt)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",Ct("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Kd(),this.xi&&window.requestAnimationFrame(()=>{this.Cs();});}),this.sub("*cropBox",t=>{t&&(this.Sr=t.height<=M||t.width<=M,this.Ts(),this.xi&&window.requestAnimationFrame(()=>{this.Cs();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.ml(t);}),document.addEventListener("pointermove",this.hl,true),document.addEventListener("pointerup",this.dl,true);}firstUpdated(t){super.firstUpdated(t),this.Jd();}Jd(){let t=this.Wt;if(!(!t||this.xi)){if(this.Hd(),this.Yd(),this.xi=true,t.addEventListener("pointermove",this.fl,true),this.Ti){let e=this.Ti;this.Ti=null,this.ml(e);}this.Cs();}}disconnectedCallback(){super.disconnectedCallback(),this.Wt?.removeEventListener("pointermove",this.fl,true),document.removeEventListener("pointermove",this.hl,true),document.removeEventListener("pointerup",this.dl,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.cl)}></svg>`}};h([g()],_i.prototype,"wi",2);function Wd(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}n(Wd,"validateCrop");var Bi=class extends E{constructor(){super();this.ctxOwner=true;this.pe={width:0,height:0};this.i=null;this.z=false;this.bt=null;this.vl=O();this.As=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.gl=V(this.yl.bind(this),300),this.Ss=me(()=>{!this.isConnected||!this.z||(this.ks(),this.bl(),this.wl(),this.Ms(),this.Is());},100);}static{n(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.ks();}bl(){let t=this.$["*editorTransformations"],e=xl(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}ks(){let t=this.vl.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,a=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*a,t.height=s*a,e?.scale(a,a),this.Mt=t,this.i=e;}wl(){if(!this.z||!this.bt)return;let t=this.bt,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,a={width:this.offsetWidth,height:this.offsetHeight},l=Ze({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>a.width-e*2||l.height>a.height-e*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let d=a.width-e*2,m=d/u,f=0+e,v=e+(a.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=a.height-e*2,m=d*u,f=e+(a.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(a.width-e*2)/2-u/2,m=e+(a.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=Ye(c);}Ms(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(a){let{dimensions:[m,f],coords:[v,w]}=a,{width:T}=Ze(this.pe,s),C=l/T;t=We(Ye({x:c+v*C,y:u+w*C,width:m*C,height:f*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!Ra(t,e)||d&&!$a(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=We(Ye(t),e);}tp(){let t=this.i;if(!t)return;let e=this.bt;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:a,flip:l,rotate:c}=s,u=Ze({width:o.width,height:o.height},c);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(c*Math.PI*-1/180),t.scale(a?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}Is(){if(!this.z||!this.bt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.tp();}ep({fromViewer:t}){this.bt&&(this.As.value?.toggleThumbs(true),this.ip(),setTimeout(()=>{this.className=Ct({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}xl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:a,height:l}=e,{width:c,height:u}=Ze(this.pe,s),{width:p,height:d}=t,m=a/c,f=l/u;return [ue(Math.round(p/m),1,c),ue(Math.round(d/f),1,u)]}rp(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:a,height:l,x:c,y:u}=e,{width:p,height:d}=Ze(this.pe,s),{x:m,y:f}=t,v=a/p,w=l/d,T=this.xl(),C={dimensions:T,coords:[ue(Math.round((m-c)/v),0,p-T[0]),ue(Math.round((f-u)/w),0,d-T[1])]};if(!Wd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}yl(){if(!this.isConnected||!this.pe)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,a=this.rp(),c={...this.$["*editorTransformations"],crop:a,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.z&&(this.wl(),this.Ms(),this.Is());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.z){this.z=true,await this.updateComplete,this.ks(),this.pe=t,this.removeEventListener("transitionend",this.Tl);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.bt=await this.op(o,s),this.bl(),this.Ss(),this.ep({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.z&&this.bt&&this.Ss();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.z&&(!t&&this.yl(),this.z=false,this.sp(),this.className=Ct({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.As.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Tl,{once:true}),this.s?.disconnect());}sp(){let t=this.xl(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,a=Math.min(o,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${a}) translate(${(this.offsetWidth/2-l)/a}px, ${(this.offsetHeight/2-c)/a}px)`,this.style.transformOrigin=`${l}px ${c}px`;}ip(){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`;}Tl(){this.z||(this.bt=null);}async op(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(ai(t,o,e)),{promise:a,cancel:l,image:c}=Le(s),u=this._e(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.w?.(),this.w=l,a.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}_e(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 a=o.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Is();}),this.sub("*cropBox",()=>{this.bt&&this.gl();}),this.sub("*currentAspectRatio",()=>{this.Ms();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.z&&this.pe&&this.activate(this.pe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.bt&&(this.bt=null);}render(){return y`<canvas class="uc-canvas" ${L(this.vl)}></canvas><uc-crop-frame ${L(this.As)}></uc-crop-frame>`}};h([g()],Bi.prototype,"bt",2);function Xs(r,i,t){let e=t,o=t-1,s=new Array(e);for(let a=o;a>=0;a-=1)s[a]=Math.ceil((a*i+(o-a)*r)/o);return s}n(Xs,"linspace");function Zd(r){return typeof r=="string"&&r in Ot}n(Zd,"isOperationKey");function Yd(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}n(Yd,"splitBySections");function Xd(r,i,t){let e=Yd(r).find(([a,l])=>a<=i&&i<=l);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(a=>{let l=Math.abs(o-s)||1,c=Math.abs(i-o)/l;return o===a?i>t?1:1-c:s===a?i>=t?c:1:0})}n(Xd,"calculateOpacities");function Qd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}n(Qd,"calculateZIndices");function Sl(r,i){let t=Ot[r].keypointsNumber,{range:e,zero:o}=Ot[r];return [...new Set([...Xs(e[0],o,t+1),...Xs(o,e[1],t+1),o,i])].sort((s,a)=>s-a)}n(Sl,"keypointsRange");var fo=class extends E{constructor(){super();this.z=false;this.Os=true;this.n="initial";this.El={};this.Zt=[];this.Cl=0;this.Al=O();this.Ar=O();this.classList.add("uc-inactive_to_cropper"),this.Sl=V(async(t,e,o)=>{let s=n(()=>!this.kl(t,e)||this.$e!==o||!!this.Zt.find(u=>u.value===o),"shouldSkip");if(s())return;let a=await this.Ml(t,o),l=new Image;l.src=a.src;let c=this._e(a.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),a.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Zt,p=u.findIndex(v=>v.value>o);p===-1&&(p=u.length);let m=u[p]?.image,f=this.Ar.value;!f||m&&!f.contains(m)||(u.splice(p,0,a),m?f.insertBefore(l,m):f.appendChild(l),this.Rs(t,o));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{n(this,"EditorImageFader");}_e(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let a=o.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=o);}}Il(){window.cancelAnimationFrame(this.Cl),this.Cl=window.requestAnimationFrame(()=>{for(let t of this.Zt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}he({url:t=this.Be,filter:e=this.g??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let a={...this.El};o&&(o==="filter"?e&&typeof s=="number"&&(a.filter={name:e,amount:s}):typeof s=="number"&&(a[o]=s));let l=this.offsetWidth;return this.proxyUrl(ai(t,l,a))}async Ml(t,e){return {src:await this.he({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}kl(t,e){return this.n===t&&this.g===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Zd(this.n)||!Number.isFinite(e)||(this.Rs(this.n,e),this.Sl(this.n,this.g,e));}Rs(t,e){this.n=t,this.$e=e;let{zero:o}=Ot[t],s=this.Zt.map(c=>c.value),a=Xd(s,e,o),l=Qd(s,o);this.Zt.forEach((c,u)=>{let p=a[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.Il();}Ol(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async np(){this.a=this.a||this.Ol();let t=this.a;t&&this.Pl(t);let e=this.Zt.map(u=>u.src),{images:o,promise:s,cancel:a}=Ri(e);o.forEach(u=>{let p=this._e(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Ps=()=>{a(),this.Ps=void 0;};let l=this.n,c=this.g;if(await s,this.z&&this.kl(l,c)){let u=this.Ar.value;if(!u)return;u.replaceChildren(),this.Zt.forEach((p,d)=>{let m=o[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.Il();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.he(),o=this._e(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Ls?.();let a=Sl(o,s),l=await Promise.all(a.map(u=>this.he({url:t,filter:e,operation:o,value:u}))),{cancel:c}=Ri(l);this.Ls=c;}ap(t){let e=this.a||this.Ol();if(this.Pl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Ct({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this._e(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=Ct({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:a}){if(this.z=true,this.Os=false,await this.updateComplete,this.Be=t,this.n=e??"initial",this.$e=o,this.g=s,this.Ci=a,typeof o!="number"&&!s){let c=await this.he({operation:e,value:o});this.ap(c),this.Us();return}!e||typeof o!="number"||(this.Zt=await Promise.all(Sl(e,o).map(c=>this.Ml(e,c))),this.Rs(e,o),this.np());}deactivate({hide:t=true}={}){this.z=false,this.Ps?.(),this.Ls?.(),t&&!this.Os?(this.Os=true,this.a&&(this.a.style.transform="scale(1)"),this.className=Ct({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Us();},{once:true})):this.Us();}Pl(t){let e=this.Al.value;e&&(e.contains(t)||e.appendChild(t));}Us(){this.Ar.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Al)}></div><div class="uc-fader-layers-host" ${L(this.Ar)}></div>`}};var _t=class extends E{constructor(){super();this.$s=0;this.kr=O();this.Rl=O();this.Ul=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Yt=0;this.cp=t=>{t.stopPropagation();let e=this.$l(t);e!==null&&(this.Ds(e),this.lp("slider-input",e));};this.up=t=>{t.stopPropagation();let e=this.$l(t);e!==null&&this.Ds(e);};this.Dl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Fl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{n(this,"SliderUi");}lp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.$s=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Nl(this.Yt),this.Fs(),this.s=new ResizeObserver(()=>{this.Fs(),this.Mr(this.Yt);}),this.s.observe(this);let e=this.kr.value;e?.addEventListener("focus",this.Dl),e?.addEventListener("blur",this.Fl),window.setTimeout(()=>{this.Mr(this.Yt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Yt&&this.Ds(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Fs(),this.Mr(this.Yt)),t.has("zero")&&this.hasUpdated&&this.Vl(this.Yt);}Mr(t){this.Vl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(o-this.$s)/100;window.requestAnimationFrame(()=>{let c=this.Rl.value;c&&(c.style.transform=`translateX(${l}px)`);});}Vl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(o-this.$s)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${l}px)`);});}Fs(){let e=this.Ul.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),a=Math.ceil(s/15)-2;if(this.Ll===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.Si=p,e.innerHTML="",e.appendChild(l),this.Ll=a;}disconnectedCallback(){super.disconnectedCallback();let t=this.kr.value;t?.removeEventListener("focus",this.Dl),t?.removeEventListener("blur",this.Fl),this.s?.disconnect(),this.s=void 0;}Ds(t){Number.isFinite(t)&&(this.Yt=t,this.hasUpdated&&(this.Nl(t),this.Mr(t)));}Nl(t){let e=this.kr.value;e&&(e.value=String(t));}$l(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return y`<div class="uc-steps" ${L(this.Ul)}></div><div class="uc-thumb" ${L(this.Rl)}></div><input class="uc-input" type="range" ${L(this.kr)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Yt)} ?disabled=${this.disabled} @input=${this.cp} @change=${this.up} />`}};h([b({type:Boolean,reflect:true})],_t.prototype,"disabled",2),h([b({type:Number})],_t.prototype,"min",2),h([b({type:Number})],_t.prototype,"max",2),h([b({type:Number,attribute:false})],_t.prototype,"defaultValue",2),h([b({type:Number})],_t.prototype,"zero",2),h([g()],_t.prototype,"Yt",2);var Bt="original",zi=class extends E{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Ns=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{n(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.dp();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===Bt?void 0:this.state.value,filter:this.state.filter===Bt?void 0:this.state.filter,fromViewer:false});}dp(){let t=this.state.operation,{range:e,zero:o}=Ot[t],[s,a]=e;this.state={...this.state,min:s,max:a,zero:o};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(a),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:a;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:o;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Bt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.Ns} ></uc-slider-ui>`}};h([g()],zi.prototype,"state",2);function li(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)}}n(li,"parseFilterValue");var ht=class extends E{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{n(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}_l(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this._l();}updated(t){super.updated(t),t.has("active")&&this._l();}render(){let t=this.onClick,e=this.title;return y`<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>`}};h([g()],ht.prototype,"active",2),h([g()],ht.prototype,"title",2),h([g()],ht.prototype,"icon",2),h([g()],ht.prototype,"titleProp",2);var go=12,vo=16,Jd=n(r=>{let i=12,t=12;return r.width/r.height>=1?(i=go,t=Math.round(go*r.height/r.width)):(t=go,i=Math.round(go*r.width/r.height)),{width:i,height:t}},"getAdjustResolutions"),yo=class extends ht{static{n(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.pp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}pp(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${dt(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>`}},Hi=class extends ht{constructor(){super(...arguments);this.ot=null;}static{n(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.ot}set aspectRatio(t){if(this.ot===t)return;let e=this.ot;this.ot=t,this.requestUpdate("aspectRatio",e),t?this.Bl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.ot&&this.Bl(this.ot),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.ot?.id||t?.width===this.ot?.width&&t?.height===this.ot?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.ot?.id&&(this.$["*currentAspectRatio"]=this.ot);}Bl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=n(()=>{let a=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=a,a},"resolveTitle"),s=n(()=>{let a=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=a,a},"resolveTitleProp");o(),s(),e||this.requestUpdate();}hp(){let t=this.ot;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=Jd(t),s=(vo-e)/2,a=(vo-o)/2;return y`<uc-icon><svg viewBox="0 0 ${vo} ${vo}" aria-hidden="true" focusable="false" ><rect x=${s} y=${a} width=${e} height=${o} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${dt(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} >${this.hp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],Hi.prototype,"aspectRatio",1);function tp(r){let i=r+90;return i=i>=360?0:i,i}n(tp,"nextAngle");function ep(r,i){if(r==="rotate")return tp(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}n(ep,"nextValue");var ji=class extends ht{constructor(){super(...arguments);this.operation=void 0;}static{n(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=ep(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};h([b({type:String})],ji.prototype,"operation",2);var te=class extends ht{constructor(){super(...arguments);this.n="";this.g="";this.Ai="";this.Ir=0;this.a=null;this.He=false;this.isOriginal=false;this.zl=20;}static{n(this,"EditorFilterControl");}get filter(){return this.g}set filter(t){let e=t??"";if(this.g===e)return;let o=this.g;this.g=e,this.n="filter",this.isOriginal=e===Bt,this.icon=this.isOriginal?"original":"slider",this.zl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.Hl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.g),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.g),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:li(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.g;}fp(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.zl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),a=o>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.g!==Bt?{name:this.g,amount:l}:void 0,Q(this.Ai,at(vr,oe(c),`quality/${a}`,`scale_crop/${s}x${s}/center`,`@clib/${$t}/${Dt}/uc-cloud-image-editor/`))}async pi(t,e){t[0]?.isIntersecting?await this.Vs(e):this.w?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Ai=t??"",this.sub("*originalUrl",e=>{this.Ai=e??"",!this.isOriginal&&this.Ai&&this.isConnected&&!this.a&&(this.s?.observe(this),this.fe());}),this.isOriginal||(this.s?.observe(this),this.fe()),this.g&&this.Hl(this.g),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.g);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Vs():this.fe());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.w?.(),this.Or();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.fe()));}Hl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Vs(t){if(!this.isConnected){t?.unobserve(this),this.w?.(),this.w=void 0;return}if(!this.Ai){!this.ze&&!this.Xt&&this.fe();return}let e=++this.Ir,o="";try{o=await this.proxyUrl(this.fp());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.He=false,this.w?.();let{promise:s,cancel:a}=Le(o);this.w=()=>{a(),this.Ir===e&&(this.w=void 0);};try{if(await s,this.Ir!==e||!this.isConnected)return;this.a=o,this.He=!0,this.Or(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.fe();}finally{this.Ir===e&&(this.w=void 0);}}fe(){if(!this.isConnected||this.a||this.He||this.isOriginal||this.$["*networkProblems"]){this.Or();return}this.Xt&&cancelAnimationFrame(this.Xt),this.Xt=requestAnimationFrame(()=>{if(this.Xt=void 0,!this.isConnected||this.a||this.He||this.isOriginal){this.Or();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.Vs();return}this.ze=window.setTimeout(()=>{this.ze=void 0,this.fe();},500);});}Or(){this.Xt&&(cancelAnimationFrame(this.Xt),this.Xt=void 0),this.ze&&(window.clearTimeout(this.ze),this.ze=void 0);}get mp(){return !!(this.He&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.mp?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${dt(this.buttonClasses)} aria-label=${X(this.titleProp)} title=${X(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.He} style=${Qt(e)}></div><uc-icon class=${dt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Qt(o)} ></uc-icon></button>`}};h([g()],te.prototype,"a",2),h([g()],te.prototype,"He",2),h([g()],te.prototype,"isOriginal",2),h([g()],te.prototype,"zl",2),h([b({type:String})],te.prototype,"filter",1);var Ki=class extends ht{constructor(){super(...arguments);this.n="";}static{n(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.Kl(e);}Kl(t){this.icon=t;let e=n(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),o=n(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),o();}initCallback(){super.initCallback(),this.n&&this.Kl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Ot[this.n],o=t[this.n],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:li(this.$["*operationTooltip"])});}};h([b({type:String})],Ki.prototype,"operation",1);var ip=1,Al=n(()=>{},"noopScrollListener"),Gi=class extends E{constructor(){super(...arguments);this.hiddenScrollbar=false;this.jl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>ip){this.scrollLeft+=o;return}this.scrollLeft+=e;};}static{n(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.jl,{passive:false}),this.addEventListener("scroll",Al,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.jl),this.removeEventListener("scroll",Al),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Gi.prototype,"hiddenScrollbar",2);var vt=class extends E{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Gl=true;this.tabList=[...lt];this.activeTab=K.CROP;this.Pr=true;this._s=false;this.ql=null;this.Wl=0;this.Zl=0;this.Lr=O();this.Yl=O();this.tabToggleRefs={[K.CROP]:O(),[K.TUNING]:O(),[K.FILTERS]:O()};this.Xl=()=>{this.me();};this.Mi=[];this.Rr=V(t=>{this.ki=t;},500);this.Ur=V(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===K.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let a=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${a}`;}else o=this.l10n(Bt);else if(this.showSubToolbar&&this.$["*tabId"]===K.TUNING&&e){s=true;let a=t?.[e]||Ot[e].zero;o=`${this.l10n(e)} ${a}`;}s&&(this.$["*operationTooltip"]=o),this._s=s;},0);this.gp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.vp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.yp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.bp={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Bt,"*currentOperation":null,"*operationTooltip":null};this.$t=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.w?.();let e=this.$["*on.cancel"];e?.();};this.Ks=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Op=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:li(this.$["*operationTooltip"])}),this.Lr.value?.apply(),this.Ql();};this.Pp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Lr.value?.cancel(),this.Ql();};this.Lp=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.Bs(o,{fromViewer:false}));};}static{n(this,"EditorToolbar");}Ql(){this.$["*showSlider"]=false,this.$["*tabId"]===K.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===K.TUNING&&(this._s=false);}Bs(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Jl(t,{fromViewer:e,force:o});}Jl(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.me();return}this.activeTab=t;let s=this.$["*faderEl"],a=this.$["*cropperEl"];t===K.CROP?(s?.deactivate(),this.$["*imageSize"]&&a?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),a?.deactivate());for(let l of lt){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.me();}}me(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.Yl.value;if(!e||!o)return;let s=e.offsetLeft,a=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Wl!==s||this.Zl!==a)&&(this.Wl=s,this.Zl=a,o.style.transform=`translateX(${s}px)`,o.style.width=`${a}px`);}get zs(){return this.Mi.length>=3}wp(t){switch(t){case K.CROP:return this.xp();case K.FILTERS:return this.Tp();case K.TUNING:return this.Ep();default:return []}}xp(){let t=[];if(this.zs)t.push(()=>this.Cp());else for(let e of this.Mi)t.push(()=>this.tc(e));for(let e of Fn)t.push(()=>this.Sp(e));return this.Hs(t)}Tp(){let e=[Bt,...Dn].map(o=>()=>this.Ap(o));return this.Hs(e)}Ep(){let t=$n.map(e=>()=>this.kp(e));return this.Hs(t)}Hs(t){return t.length?t.map(o=>o()):[]}Cp(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}tc(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Sp(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Ap(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}kp(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Mp(){return this.zs?this.Mi.map(t=>this.tc(t)):[]}async Ip(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ai(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.w?.();let{cancel:o}=Ri([e]);this.w=()=>{o(),this.w=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Mi=[...t],this.sub("*cropPresetList",e=>{this.Mi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Bs(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.Ur();}),this.sub("*currentOperation",()=>{this.Ur();}),this.sub("*tabId",e=>{this.Jl(e,{fromViewer:false,force:true}),this.Ur();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Ip(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,a]of s.entries())if(a){o=true;break}}this.Rr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Gl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.Bs(o,{fromViewer:false});return}this.me();}),this.sub("*operationTooltip",e=>{this.ql=e;}),this.Ur();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Xl);}firstUpdated(t){super.firstUpdated(t),this.$r(),this.me();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.me()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.$r();}disconnectedCallback(){window.removeEventListener("resize",this.Xl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}$r(){let t=this.Lr.value;t&&(this.$["*sliderEl"]=t);}Rp(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),a=s>=0?Qt({gridColumn:`${s+1}`}):$;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.yp}><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=${a} @click=${this.Lp} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Up(t){let e=this.wp(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:$}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this._s?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.zs;return y`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.ql??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.gp} ><div class="uc-tab-content-row">${lt.map(o=>Vi(this.activeTab===o,()=>this.Up(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Gl} .styles=${this.bp} @initial-render=${()=>this.me()} ><div class="uc-tab-toggles_indicator" ${L(this.Yl)} ></div>${lt.map(o=>this.Rp(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.$t} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ks}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.vp}><div class="uc-slider" ?hidden=${!this.Pr}><uc-editor-slider ${L(this.Lr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Pr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.Mp()}</div>`:$}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Pp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Op} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],vt.prototype,"ki",2),h([g()],vt.prototype,"showMainToolbar",2),h([g()],vt.prototype,"showSubToolbar",2),h([g()],vt.prototype,"Gl",2),h([g()],vt.prototype,"tabList",2),h([g()],vt.prototype,"activeTab",2),h([g()],vt.prototype,"Pr",2),h([g()],vt.prototype,"_s",2),h([g()],vt.prototype,"ql",2),h([g()],vt.prototype,"Mi",2);var kl=jt([...lt]),ot=class extends E{constructor(){super(...arguments);this.ctxOwner=true;this.$p="";this.he=Lt;this.Dp="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=kl;this.ec=false;this.Bt=false;this.js=null;this.Ii=null;this.Rr=V(t=>{this.ki=t;},300);this.Dr=O();this.ic=O();this.rc=O();this.oc=O();this.sc=()=>{this.Rr(false),this.he!==Lt&&(this.$["*networkProblems"]=false);};this.nc=()=>{this.Rr(false),this.$["*networkProblems"]=true;};this.Fp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Cl(this)};}static{n(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Np(){this.Bt||this.js||(this.js=this.updateComplete.then(()=>{this.js=null,this.Bt=true;}));}initCallback(){super.initCallback(),this.ac(),this.cc();}$r(){let t=this.rc.value;t&&(this.$["*faderEl"]=t);let e=this.ic.value;e&&(this.$["*cropperEl"]=e);let o=this.oc.value;o&&(this.$["*imgContainerEl"]=o);let s=this.Dr.value;s&&(this.$["*imgEl"]=s);}Vp(){let t=this.Dr.value;t&&(t.addEventListener("load",this.sc),t.addEventListener("error",this.nc));}_p(){let t=this.Dr.value;t&&(t.removeEventListener("load",this.sc),t.removeEventListener("error",this.nc));}get Bp(){let t=this.$["*tabId"];return Ct("uc-image",{"uc-image_hidden_to_cropper":t===K.CROP,"uc-image_hidden_effects":t!==K.CROP})}uc(){if(this.Ii)return this.Ii;let t=3e3;return this.Ii=new Promise((e,o)=>{let s=n(()=>{window.clearTimeout(p),u.disconnect(),this.Ii=null;},"cleanup"),a=n(()=>{let{width:d,height:m}=this.getBoundingClientRect();return d>0&&m>0},"hasNonZeroSize"),l=n(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=n(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),o(d);},"rejectWait"),u=new ResizeObserver(d=>{let[m]=d;m&&m.contentRect.width>0&&m.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(a()){l();return}u.observe(this);}),this.Ii}firstUpdated(t){super.firstUpdated(t),this.$r(),this.Vp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this._p(),super.disconnectedCallback();}render(){let t=this.Dp??"",e=this.$p??"",o=this.he||Lt,s=this.ki,a=this.ec;return y` ${Ke(El)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${a}><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.Fp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${L(this.oc)}><img src=${o} class=${this.Bp} ${L(this.Dr)} />${Vi(this.Bt,()=>y`<uc-editor-image-cropper ${L(this.ic)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.rc)}></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">${Vi(this.Bt,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.ac(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.cc();}ac(){let t=this.tabs||kl;this.$["*tabList"]=Tl(t);}cc(){let t=to(this.cropPreset??""),e=null;if(this.cdnUrl){let o=Ho(this.cdnUrl),s=jo(o);if(Array.isArray(s?.crop?.dimensions)){let[a,l]=s.crop.dimensions;e=Fa(a,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.uc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=gr(t),o=re(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=Ho(t),a=jo(s);this.$["*editorTransformations"]=a;}else if(this.uuid){let t=re(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"]===K.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(l=>l.json()),{width:s,height:a}=o;this.$["*imageSize"]={width:s,height:a},this.$["*tabId"]===K.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.Np();}}}async initEditor(){try{await this.uc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ec=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=at(oe(t),"preview"),s=Q(e,o),a={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:true,composed:true}));},false);}};h([g()],ot.prototype,"$p",2),h([g()],ot.prototype,"he",2),h([g()],ot.prototype,"Dp",2),h([g()],ot.prototype,"ki",2),h([b({type:String,reflect:true})],ot.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],ot.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],ot.prototype,"cropPreset",2),h([b({type:String,reflect:true})],ot.prototype,"tabs",2),h([g()],ot.prototype,"ec",2),h([g()],ot.prototype,"Bt",2);var Qs={};rn(Qs,{CloudImageEditorActivity:()=>qi});var bo=class extends ot{static{n(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var qi=class extends I{constructor(){super(...arguments);this.at=null;}static{n(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.at&&this.at.cropPreset!==t&&(this.at={...this.at,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.at&&this.at.tabs!==t&&(this.at={...this.at,tabs:t});}),this.zp();}disconnectedCallback(){super.disconnectedCallback(),this.Hp();}Ks(t){if(!this.Oi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Oi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(D.activities.CLOUD_IMG_EDIT),this.historyBack();}$t(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(D.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.Oi=e;let o=this.Oi.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.at=this.Kp(o);}Hp(){this.Oi=void 0,this.at=null;}render(){if(!this.at)return $;let{cdnUrl:t,cropPreset:e,tabs:o}=this.at;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${X(e)} tabs=${X(o)} @apply=${this.Ks} @cancel=${this.$t} @change=${this.handleChange} ></uc-cloud-image-editor>`}Kp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],qi.prototype,"at",2);var ci=class extends I{constructor(){super(...arguments);this.Be="";this.Ns=t=>{this.Be=t.target?.value??"";};this.ss=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Be.trim();e&&(this.api.addFileFromUrl(e,{source:R.URL}),this.routerLayer.navigateAfterFileAdd());};}static{n(this,"UrlSource");}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.ss}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.Ns} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Be} >${this.l10n("upload-url")}</button></form>`}};h([g()],ci.prototype,"Be",2);var Ml=n(()=>{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}},"getTopLevelOrigin");var rp=n(r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),Il=n((r,i="i")=>{let t=r.split("*").map(rp);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var op=["--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"],sp=n((r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),"getCssValue"),Ol=n(r=>{let i={};for(let t of op){let e=sp(r,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var np=["selected-files-change","toolbar-state-change"],ap=n(r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!np.includes(i))},"isWhitelistedMessage"),wo=class{constructor(i,t){this.Fr=new Map;this.pc=i=>{if(i.source!==this.Gs)return;let t=i.data;if(!ap(t))return;let e=this.Fr.get(t.type);if(e)for(let o of e)o(t);};this.Gs=i,this.dc=t,window.addEventListener("message",this.pc);}static{n(this,"MessageBridge");}on(i,t){let e=this.Fr.get(i)??new Set;this.Fr.has(i)||this.Fr.set(i,e),e.add(t);}send(i){let t=this.dc();this.Gs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.pc);}};function Ll(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("&")}n(Ll,"queryString");var lp={[gt.GDRIVE]:"ngdrive"},yt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ke=O();this.Nr=null;this.qs=[];this.Ws=false;this.Zs=false;this.Ys=false;this.Xs=false;this.Vr=false;this.Qs=false;this.Js="uc-hidden";this.hc=true;this.ns=()=>{for(let t of this.qs){let e=this.Gp(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.routerLayer.navigateAfterFileAdd();};this.$t=()=>{this.historyBack();};this.Qp=()=>{this.wt?.send({type:"select-all"});};this.Jp=()=>{this.wt?.send({type:"deselect-all"});};}static{n(this,"ExternalSource");}get jp(){if(!this.Nr)return "";let{selectedCount:t,total:e}=this.Nr;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.fc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.mc(),this.fc());});}),this.subConfigValue("multiple",e=>{this.Vr=e;}),this.subConfigValue("localeName",()=>{this.gc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.vc(e);});}Gp(t){if(t.alternatives){let e=J(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=Il(o);for(let[a,l]of Object.entries(t.alternatives))if(s.test(a))return l}}return t.url}qp(t){this.hc=t.isVisible;}async Wp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Zp(t.selectedCount,t.total),this.Js=t.isReady?"":"uc-hidden",this.Ws=t.isReady,this.Zs=t.isReady&&t.selectedFiles.length>0,this.Vr=t.isMultipleMode&&t.total>0,this.Ys=t.selectedCount<t.total,this.Xs=t.selectedCount===t.total,this.qs=t.selectedFiles??[],this.Qs=t.total>0;}yc(){this.vc(this.cfg.externalSourcesEmbedCss),this.Yp(),this.gc();}Yp(){this.wt?.send({type:"set-theme-definition",theme:Ol(this)});}vc(t){this.wt?.send({type:"set-embed-css",css:t});}gc(){this.wt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Xp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:a}=this.activityParams,l=lp[a]??a,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Ml(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,o);return p.search=Ll(u),p.toString()}Zp(t,e){this.Nr={selectedCount:t,total:e};}fc(){let t=document.createElement("iframe");t.src=this.Xp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.yc.bind(this)),t.addEventListener("load",this.yc.bind(this)),this.Ke.value&&(this.Ke.value.innerHTML="",this.Ke.value.appendChild(t)),t.contentWindow&&(this.wt?.destroy(),this.wt=new wo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.wt.on("selected-files-change",this.Wp.bind(this)),this.wt.on("toolbar-state-change",this.qp.bind(this)),this.bc());}mc(){this.wt?.destroy(),this.wt=void 0,this.Ke.value&&(this.Ke.value.innerHTML=""),this.bc();}bc(){this.qs=[],this.Ws=false,this.Zs=false,this.Ys=false,this.Xs=false,this.Vr=false,this.Qs=false,this.Js="uc-hidden",this.Nr=null;}disconnectedCallback(){super.disconnectedCallback(),this.mc();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.Ke)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.hc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Vr} ><span>${this.jp}</span><button type="button" @click=${this.Qp} ?hidden=${!this.Ys} >${this.l10n("select-all")}</button><button type="button" @click=${this.Jp} ?hidden=${!this.Xs} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ns} ?disabled=${!this.Zs} ?hidden=${!this.Qs} ><uc-spinner ?hidden=${this.Ws}></uc-spinner><span class=${this.Js}>${this.l10n("done")}</span></button></div></div>`}};h([g()],yt.prototype,"qs",2),h([g()],yt.prototype,"Ws",2),h([g()],yt.prototype,"Zs",2),h([g()],yt.prototype,"Ys",2),h([g()],yt.prototype,"Xs",2),h([g()],yt.prototype,"Vr",2),h([g()],yt.prototype,"Qs",2),h([g()],yt.prototype,"Js",2),h([g()],yt.prototype,"hc",2);var Pl=n(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var cp={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},up=["camera","microphone"];function To(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}n(To,"formatTime");var Ul="image/jpeg",Rl="video/webm",j=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._r=null;this.tn=false;this.Pi=[];this.It=null;this.Ot=null;this.Br=null;this.zr=null;this.v=null;this.Li={};this.Mt=null;this.i=null;this.je=[];this.Ge=[];this.th={};this.Hr=[];this.Kr=null;this.wc=()=>{this.xc(),this.Ri="pause";};this.Tc=()=>{this.Ri="play",this.eh();};this.Ui=O();this.de=O();this.W=O();this.Ec=0;this.Cc=0;this.Sc=null;this.jr=true;this.Gr=true;this.ih=Pl();this.Ac=[];this.ge=true;this.en="";this.qe=true;this.ve=true;this.We=true;this.kc=[];this.ye=true;this.rn=true;this.be=true;this.Ft=true;this.we=true;this.Ze="camera-full";this.Ri="play";this.Mc="microphone";this.qr="uc-shot-btn uc-camera-action";this.rh=()=>{if(this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===U.PHOTO&&this.oh(),this.v===U.VIDEO){if(this.It?.state==="recording"){this.Ic();return}this.sh();}};this.nh=t=>{let e=t.target;e&&(this.zr=e.value,this.Ye());};this.ah=t=>{let e=t.target;e&&(this.Br=e.value,this.Ye());};this.lh=()=>{this.Ye();};this.ch=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.rh();};this.uh=()=>{this.dh();};this.ph=()=>{this.hh();};this.fh=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.mh();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.vh();};this.Oc=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.Pc(o);};this.Lc=()=>{let t=Math.floor((performance.now()-this.Ec+this.Cc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ui.value;s&&(s.textContent=To(e)),this.Ic();return}let o=this.Ui.value;o&&(o.textContent=To(e));}else {let e=this.Ui.value;e&&(e.textContent=To(t));}this.Xe=requestAnimationFrame(this.Lc);};this.yh=()=>{this.Ec=performance.now(),this.Cc=0,this.Lc();};this.Rc=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.xc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.de.value;s&&(s.style.transform=`scaleX(${e/o})`);let a=this.Ui.value;a&&(a.textContent=To(e)),this.Xe=requestAnimationFrame(this.xc);};this.eh=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.Xe=null;this.sh=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Rl)?this.Li.mimeType=Rl:this.Li.mimeType="video/mp4",this.Ot&&(this.It=new MediaRecorder(this.Ot,this.Li),this.It.start(),this.It.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.yh(),this.classList.add("uc-recording"),this.$i(At.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Ic=()=>{this.It?.addEventListener("stop",()=>{this.bh(),this.Rc(),this.$i(At.STOP);}),this.It?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.dh=()=>{if(this.It?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.hh=()=>{this.Ot?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Mc=t.enabled?"microphone":"microphone-mute",this.rn=!t.enabled;});};this.bh=()=>{try{let t=new Blob(this.Pi,{type:this.It?.mimeType}),e=URL.createObjectURL(t),o=this.W.value;if(!o)return;o.muted=!1,o.volume=1,this.Di(null),o.src=e,this.wh(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.mh=()=>{if(this.$i(At.RETAKE),this.v===U.VIDEO){this.Di(this.Ot);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.vh=()=>{if(this.$i(At.ACCEPT),this.v===U.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let a=this.Uc("camera","jpeg",Ul,s);this.$c(a);},Ul);return}let t=new Blob(this.Pi,{type:this.It?.mimeType}),e=this.xh(this.It?.mimeType),o=this.Uc("video",e,`video/${e}`,t);this.$c(o),this.Pi=[];};this.Th=t=>{t===At.SHOT&&(this.we=true,this.ve=true,this.Ft=true,this.We=false,this.ge=true),(t===At.RETAKE||t===At.ACCEPT)&&(this.we=!this.Nt.includes(U.VIDEO),this.Ft=!this.Nt.includes(U.PHOTO),this.ve=false,this.We=true,this.ge=this.je.length<=1);};this.Eh=t=>{t===At.PLAY&&(this.qe=false,this.Ft=true,this.ge=true,this.ye=true,this.Ri="pause",this.Ze="square",this.qr="uc-shot-btn uc-camera-action uc-stop-record"),t===At.STOP&&(this.qe=false,this.ve=true,this.be=true,this.We=false),(t===At.RETAKE||t===At.ACCEPT)&&(this.qe=true,this.we=!this.Nt.includes(U.VIDEO),this.Ft=!this.Nt.includes(U.PHOTO),this.ve=false,this.We=true,this.be=!this.cfg.enableAudioRecording,this.Ze="video-camera-full",this.qr="uc-shot-btn uc-camera-action",this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.ge=this.je.length<=1);};this.$i=t=>{this.v===U.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Th(t),this.v===U.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Eh(t);};this.Pc=t=>{t===U.PHOTO&&(this.Ze="camera-full",this.ye=true,this.be=true),t===U.VIDEO&&(this.Ri="play",this.Ze="video-camera-full",this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.be=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:_.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.Uc=(t,e,o,s)=>{let a=Date.now(),l=`${t}-${a}.${e}`;return new File([s],l,{lastModified:a,type:o})};this.$c=t=>{this.api.addFileFromObject(t,{source:R.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=V(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===U.VIDEO&&this.cfg.enableAudioRecording,o=this.v===U.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.jr=false,this.ve=false,this.Ft=!this.Nt.includes(U.PHOTO),this.we=!this.Nt.includes(U.VIDEO),this.Gr=true,this.qe=true,this.Ze=o,this.be=!e,this.ye=!e):t==="prompt"?(this.en="camera-permissions-prompt",this.jr=true,this.ve=true,this.Ft=true,this.Gr=false,this.an()):(this.en="camera-permissions-denied",this.jr=true,this.Gr=false,this.Ft=!this.Nt.includes(U.PHOTO),this.we=!this.Nt.includes(U.VIDEO),this.We=true,this.qr="uc-shot-btn uc-camera-action",this.an());},300);this.Ch=()=>{if(!this.Ot)return false;let t=this.Ot?.getAudioTracks(),e=this.Ot?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.an=()=>{this.tn&&(this.W.value&&(this.W.value.volume=0),this.Kr?.getTracks?.()?.[0]?.stop(),this.sn(this.W.value),this.Di(null),this.Ch(),this.Rc(),this.tn=false);};this.Ye=async()=>{let t={video:{...cp},audio:this.cfg.enableAudioRecording?{}:false};this.zr&&(t.video={deviceId:{exact:this.zr}}),this.Br&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Br}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.Ot=await navigator.mediaDevices.getUserMedia(t),this.Ot.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.Ot),this.tn=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Dc=()=>{this.Ye();};this.Sh=async()=>{try{this.Wr();for(let t of up){let e=await navigator.permissions.query({name:t});this.th[t]=e,e.addEventListener("change",this.Dc),this.Hr.push(()=>{e.removeEventListener("change",this.Dc);});}this._r=()=>{this.Wr();};}catch(t){this.Wr(),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.Ye();}};this.Ah=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.ln(),navigator.mediaDevices.addEventListener("devicechange",this.ln);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.ln=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.je=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Ge=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Ac=this.je,this.ge=this.je.length<=1,this.zr=this.je[0]?.value??null,this.kc=this.Ge,this.ye=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.Br=this.Ge[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.kh=async()=>{await this.Sh(),await this.Ah(),await this.Ye(),this.Fc(this.Nt);};this.Mh=async()=>{this._r&&this._r(),window.chrome||this.Fi("denied"),this.an();};this.Fc=t=>{this.we=!t.includes(U.VIDEO),this.Ft=!t.includes(U.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.Pc(e);};}static{n(this,"CameraSource");}wh(t){this.sn(t),t.addEventListener("play",this.wc),t.addEventListener("pause",this.Tc);}sn(t){t?.removeEventListener("play",this.wc),t?.removeEventListener("pause",this.Tc);}Di(t){this.Kr!==t&&(this.Kr=t,this.nn());}nn(){let t=this.W.value;if(!t)return;let e=this.Kr??null;t.srcObject!==e&&(t.srcObject=e);}oh(){if(this.$i("shot"),this.Mt=document.createElement("canvas"),this.i=this.Mt.getContext("2d"),!this.i)throw new Error("Failed to get canvas context");let t=this.W.value;if(!t)throw new Error("Video element not found");this.Mt.height=t.videoHeight,this.Mt.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.Mt.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}xh(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 a=o.slice(1).join("/")?.split(";")[0];if(a&&e[a])return e[a]}}return "avi"}get Nt(){return J(this.cfg.cameraModes).filter(t=>t===U.PHOTO||t===U.VIDEO)}Wr(){if(this.Hr.length!==0){for(let t of this.Hr)t();this.Hr=[],this._r=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Sc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.be=!t,this.rn=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=Z(t);this.Fc(e.filter(o=>o===U.PHOTO||o===U.VIDEO));}),this.kh();}firstUpdated(t){super.firstUpdated(t),this.nn();}updated(t){super.updated(t),this.nn();}Ih(){this.Wr(),navigator.mediaDevices?.removeEventListener("devicechange",this.ln),this.sn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.Mh(),this.Ih();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ge}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Ac} ?hidden=${this.ge} @change=${this.nh} ></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=${Qt({transform:this.Sc})} ?hidden=${this.jr} ${L(this.W)} ></video><div class="uc-message-box" ?hidden=${this.Gr}><span>${this.l10n(this.en)}</span><button type="button" @click=${this.lh} ?hidden=${this.ih} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.qe}><button data-id="photo" type="button" class=${dt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===U.PHOTO})} @click=${this.Oc} ?hidden=${this.Ft} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${dt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===U.VIDEO})} @click=${this.Oc} ?hidden=${this.we} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.uh} ?hidden=${this.qe} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${L(this.Ui)}> 00:00 </span><span ${L(this.de)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.We} ><button type="button" class="uc-secondary-btn" @click=${this.fh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.gh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.ch} class=${this.qr} ?hidden=${this.ve} ><uc-icon name=${this.Ze}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ph} ?hidden=${this.be} data-testid="toggle-microphone" ><uc-icon name=${this.Mc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.kc} ?hidden=${this.ye} ?disabled=${this.rn} @change=${this.ah} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],j.prototype,"Sc",2),h([g()],j.prototype,"jr",2),h([g()],j.prototype,"Gr",2),h([g()],j.prototype,"ih",2),h([g()],j.prototype,"Ac",2),h([g()],j.prototype,"ge",2),h([g()],j.prototype,"en",2),h([g()],j.prototype,"qe",2),h([g()],j.prototype,"ve",2),h([g()],j.prototype,"We",2),h([g()],j.prototype,"kc",2),h([g()],j.prototype,"ye",2),h([g()],j.prototype,"rn",2),h([g()],j.prototype,"be",2),h([g()],j.prototype,"Ft",2),h([g()],j.prototype,"we",2),h([g()],j.prototype,"Ze",2),h([g()],j.prototype,"Ri",2),h([g()],j.prototype,"Mc",2),h([g()],j.prototype,"qr",2);var $l={id:"camera",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({CameraSource:j}),r.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:n(()=>{if(!sa.htmlMediaCapture)return ["camera"];let t=Z(r.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:n(()=>{i.setCurrentActivity(F.CAMERA),i.setModalState(true);},"onSelect")}),r.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),r.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),r.registry.registerActivity({id:F.CAMERA,render:n(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var Js={};rn(Js,{BtnUi:()=>kt,CloudImageEditor:()=>bo,CloudImageEditorBlock:()=>ot,Config:()=>oi,CropFrame:()=>_i,EditorAspectRatioButtonControl:()=>Hi,EditorCropButtonControl:()=>ji,EditorFilterControl:()=>te,EditorFreeformButtonControl:()=>yo,EditorImageCropper:()=>Bi,EditorImageFader:()=>fo,EditorOperationControl:()=>Ki,EditorScroller:()=>Gi,EditorSlider:()=>zi,EditorToolbar:()=>vt,Icon:()=>de,LineLoaderUi:()=>Ni,PresenceToggle:()=>ni,SliderUi:()=>_t,defineComponents:()=>bt});var dp="cloud-image-editor",pp="<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>",Dl={id:dp,setup:n(async({pluginApi:r,uploaderApi:i})=>(bt({...Js,...Qs}),r.registry.registerIcon({name:"edit-file",svg:pp}),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:n(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:n(e=>{i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),r.registry.registerActivity({id:F.CLOUD_IMG_EDIT,render:n(e=>{let o=document.createElement("uc-cloud-image-editor-activity");return e.append(o),()=>{e.replaceChildren();}},"render")}),i.on(k.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let o=r.config.get("cropPreset"),s=r.config.get("useCloudImageEditor"),a=r.config.get("cloudImageEditorAutoOpen"),l=i.f.size;s&&l===1&&(o||a)&&(i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var Fl={id:"external-sources",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({ExternalSource:yt}),r.registry.registerActivity({id:F.EXTERNAL,render:n(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(gt))r.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:n(()=>{i.setCurrentActivity(F.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var Eo=n(()=>{let r=[];return {stack:r,promiseReadJpegChunks:n(t=>new Promise((e,o)=>{let s=2,a=n((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{o(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=n(()=>a(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=n(()=>{let u=s;return a(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){o("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return a(t.slice(s,s+=m),f=>{if(f.byteLength!==m){o("Corrupted");return}r.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||o("Not Support"),a(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),hp=n(async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Nl=n(async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:a}=Eo();await s(r),a.forEach(u=>{if(u.marker===i)return e.push(u.startPos),o.push(u.length)});let l=[r.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(r.slice(c,e[u])),c=e[u]+o[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),mp=226,_l=n((r,i)=>Nl(r,mp,i.map(t=>t.buffer)),"replaceIccProfile"),fp=n(async r=>{try{return await _l(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),gp=n((r,i,t)=>new Promise((e,o)=>{let s=n(a=>{if(!a){o("Failed to convert canvas to blob");return}e(a);},"callback");r.toBlob(s,i,t),r.width=r.height=1;}),"canvasToBlob"),Wi=n(()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},"createCanvas"),vp=n(r=>{let{ctx:t,canvas:e}=Wi();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},"hasTransparency"),yp=n(async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),bp="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Co,wp=n(()=>new Promise(r=>{if(Co!==void 0)r(Co);else {let i=new Image;i.addEventListener("load",()=>{Co=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Co);}),i.src=bp;}}),"isBrowserApplyExifOrientation"),Tp=n((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 a=r.getUint16(o-2,e);for(t=0,s=a;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},"findExifOrientation"),Cp=n((r,i)=>{Tp(r,(t,e)=>r.setUint16(t,i,e));},"setExifOrientation"),Ep=n(async(r,i,t)=>(t&&Cp(i,1),Nl(r,225,[i.buffer])),"replaceExif"),xp=n((r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),Sp=n(r=>xp(new Image,r),"imageLoader"),Ap=[1,3],kp=[192,193,194,195,197,198,199,201,202,203,205,206,207],Vl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Mp=n(async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Eo();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&kp.indexOf(o)>=0){let a=s.getUint8(5);Ap.indexOf(a)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Bl=n((r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},"memoize"),zl=n((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],a=!!i[s];if(s>t&&a||s<t&&!a)return s}return t},"memoKeySerializer"),ge={R:55,G:110,B:165,A:255},Ip=`rgba(${ge.R}, ${ge.G}, ${ge.B}, ${ge.A/255})`,Hl=n((r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Wi();e.width=1,e.height=1;let{canvas:s,ctx:a}=Wi();s.width=r,s.height=i,a&&(a.fillStyle=Ip,a.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ge.R&&l[1]===ge.G&&l[2]===ge.B&&l[3]===ge.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}},"canvasTest");function jl(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}n(jl,"wrapAsync");var Op=jl(Bl(Hl,zl)),Lp=jl(Bl(Hl,zl)),Kl=n(async(r,i)=>{let t=Vl.squareSide.find(a=>a*a>=r*i),e=Vl.dimension.find(a=>a>=r&&a>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([Op(t,t),Lp(e,1)]);if(o&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Gl=n(async(r,i,t)=>{try{let{ctx:e,canvas:o}=Wi();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Pp=n(({img:r,targetW:i,targetH:t})=>Gl(r,i,t),"native"),Up=n(function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,a=t;do o.push([s,a]),s=Math.round(s/e),a=Math.round(a/e);while(s<r*e);return o.reverse()},"calcShrinkSteps"),Rp=n(({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Up({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((a,[l,c],u)=>a.then(p=>Kl(l,c).then(()=>Gl(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),$p=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Dp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),tn=.71,Fp=n((r,i)=>{if(r.width*tn*r.height*tn<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)),a=Math.floor(i.size/Math.sqrt(i.size*o));return Kl(s,a).then(()=>{let{ctx:l}=Wi();return "imageSmoothingQuality"in l&&!$p()&&!Dp?Pp({img:r,targetW:s,targetH:a}):Rp({img:r,sourceW:t,targetW:s,targetH:a,step:tn})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),ql=n(async(r,i)=>{try{if(await Mp(r))throw new Error("Should skipped");let e=await Promise.allSettled([yp(r),wp(),hp(r)]),s=!e.some(w=>w.status==="rejected"),[a,l,c]=e,u=await fp(r).catch(()=>r),p=await Sp(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Fp(p,i),m="image/jpeg",f=i?.quality||.8;!s&&vp(d)&&(m="image/png",f=void 0);let v=await gp(d,m,f);if(s&&a.status==="fulfilled"&&a.value){let w=a.value,T=l.status==="fulfilled"?l.value:!1;v=await Ep(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await _l(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var Vp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Wl=n(r=>{if(typeof r!="string")return false;let i=Vp.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Zl={id:"image-shrink",setup({pluginApi:r}){r.registry.registerFileHook({type:"beforeUpload",handler:n(async({file:i})=>{let t=r.config.get("imageShrink");if(!t)return {file:i};let e=Wl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await ql(i,e)}}catch{return {file:i}}},"handler")});}};var Yl={id:"instagram",setup({pluginApi:r}){r.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:n(()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),"expand"),onSelect:n(()=>{},"onSelect")});}};var Xl={id:R.LOCAL,setup:n(({pluginApi:r,uploaderApi:i})=>{r.registry.registerSource({id:R.LOCAL,label:"src-type-local",icon:"local",onSelect:n(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Ql={id:"url-source",setup:n(async({pluginApi:r,uploaderApi:i})=>{bt({UrlSource:ci}),r.registry.registerActivity({id:F.URL,render:n(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),r.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:n(()=>{i.setCurrentActivity(F.URL),i.setModalState(true);},"onSelect")});},"setup")};var ui=[{configDeps:["useCloudImageEditor"],isEnabled:n(r=>!!r("useCloudImageEditor"),"isEnabled"),load:n(()=>Dl,"load")},{configDeps:["imageShrink"],isEnabled:n(r=>!!r("imageShrink"),"isEnabled"),load:n(()=>Zl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.LOCAL),"isEnabled"),load:n(()=>Xl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.CAMERA),"isEnabled"),load:n(()=>$l,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes("instagram"),"isEnabled"),load:n(()=>Yl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Object.values(gt).some(i=>Z(r("sourceList")).includes(i)),"isEnabled"),load:n(()=>Fl,"load")},{configDeps:["sourceList"],isEnabled:n(r=>Z(r("sourceList")).includes(R.URL),"isEnabled"),load:n(()=>Ql,"load")}];var Zi=class extends Yt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{n(this,"FileUploaderRegular");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Oh(){return y`<uc-dynamic-btn></uc-dynamic-btn>`}Ph(){return y`<uc-simple-btn></uc-simple-btn>`}Lh(){return this.headless?null:this.dynamicButton?this.Oh():this.Ph()}render(){return y` ${super.render()} ${this.Lh()}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([b({type:Boolean})],Zi.prototype,"headless",2),h([b({attribute:"dynamic-button",type:Boolean})],Zi.prototype,"dynamicButton",2);var xo=class extends Yt{constructor(){super();this.Nc=false;this.$t=()=>{if(this.Vc){let t=this.$["*historyBack"];t?.();return}this._c&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderInline");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Vc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==D.activities.START_FROM}get _c(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}cn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});let t=this.cn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Nc=this.Vc||this._c;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t} ?hidden=${!this.Nc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};h([g()],xo.prototype,"Nc",2);var en="active",So="",ve=class extends Yt{constructor(){super();this.un=false;this.Zr=false;this.Yr=So;this.dn=So;this.mi="choose-file";this.ui=t=>{t.id===D.activities.CLOUD_IMG_EDIT&&(this.Yr=en),this.$["*currentActivity"]===D.activities.UPLOAD_LIST&&(this.Yr=en,this.Zr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.dn=en);};this.di=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.Zr=false),t.id===D.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderMinimal");}static{this.lazyPlugins=ui;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}cn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_.INIT_SOLUTION});let t=this.cn();this.sub("*currentActivity",e=>{e===D.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.dn=So):(this.Yr=So,this.Zr=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.un=!o):(this.style.removeProperty("--uc-grid-col"),this.un=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(tt.OPEN,this.ui),this.modalManager?.subscribe(tt.CLOSE,this.di);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(tt.OPEN,this.ui),this.modalManager?.unsubscribe(tt.CLOSE,this.di);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Zr} class=${this.dn}><uc-drop-area ?single=${this.un} initflow clickable tabindex="0" ><span>${this.l10n(this.mi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Yr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([g()],ve.prototype,"un",2),h([g()],ve.prototype,"Zr",2),h([g()],ve.prototype,"Yr",2),h([g()],ve.prototype,"dn",2),h([g()],ve.prototype,"mi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
8
8
  exports.ActivityBlock=D;exports.ActivityHeader=Fs;exports.BaseComponent=No;exports.Block=E;exports.BtnUi=kt;exports.CameraSource=j;exports.CloudImageEditor=bo;exports.CloudImageEditorActivity=qi;exports.CloudImageEditorBlock=ot;exports.Config=oi;exports.Copyright=Rs;exports.CropFrame=_i;exports.Data=G;exports.DropArea=Tt;exports.DropDown=mo;exports.DynamicBtn=Ut;exports.EditorAspectRatioButtonControl=Hi;exports.EditorCropButtonControl=ji;exports.EditorFilterControl=te;exports.EditorFreeformButtonControl=yo;exports.EditorImageCropper=Bi;exports.EditorImageFader=fo;exports.EditorOperationControl=Ki;exports.EditorScroller=Gi;exports.EditorSlider=zi;exports.EditorToolbar=vt;exports.ExternalSource=yt;exports.ExternalUploadSource=gt;exports.FileActionButton=Jt;exports.FileItem=_s;exports.FileUploaderInline=xo;exports.FileUploaderMinimal=ve;exports.FileUploaderRegular=Zi;exports.FormInput=lo;exports.Icon=de;exports.Img=Is;exports.LineLoaderUi=Ni;exports.Modal=Li;exports.ModalEvents=tt;exports.NoWrapModeDynamicBtn=Ys;exports.PACKAGE_NAME=$t;exports.PACKAGE_VERSION=Dt;exports.PluginActivityHost=Fi;exports.PluginActivityRenderer=si;exports.PresenceToggle=ni;exports.PrimaryAction=Zs;exports.ProgressBar=Je;exports.ProgressBarCommon=Pi;exports.Select=ti;exports.SimpleBtn=Di;exports.SliderUi=_t;exports.SolutionBlock=Yt;exports.SourceBtn=he;exports.SourceList=Ui;exports.Spinner=$s;exports.StartFrom=Vs;exports.Thumb=ri;exports.UID=nt;exports.UploadCtxProvider=Ns;exports.UploadList=Pt;exports.UploadSource=R;exports.UploaderBlock=I;exports.UrlSource=ci;exports.defineComponents=bt;exports.defineLocale=kn;exports.loadFileUploaderFrom=wc;exports.toKebabCase=wr;return exports;})({});