@uploadcare/file-uploader 1.25.0-alpha.6 → 1.25.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +2 -2
  4. package/dist/index.d.ts +3 -1
  5. package/dist/index.js +4 -4
  6. package/dist/index.layered.css +2 -2
  7. package/dist/index.ssr.js +19 -18
  8. package/dist/locales/file-uploader/ar.js +2 -2
  9. package/dist/locales/file-uploader/az.js +2 -2
  10. package/dist/locales/file-uploader/ca.js +2 -2
  11. package/dist/locales/file-uploader/cs.js +2 -2
  12. package/dist/locales/file-uploader/da.js +2 -2
  13. package/dist/locales/file-uploader/de.js +2 -2
  14. package/dist/locales/file-uploader/el.js +2 -2
  15. package/dist/locales/file-uploader/en.js +2 -2
  16. package/dist/locales/file-uploader/es.js +2 -2
  17. package/dist/locales/file-uploader/et.js +2 -2
  18. package/dist/locales/file-uploader/fi.js +2 -2
  19. package/dist/locales/file-uploader/fr.js +2 -2
  20. package/dist/locales/file-uploader/he.js +2 -2
  21. package/dist/locales/file-uploader/hy.js +2 -2
  22. package/dist/locales/file-uploader/is.js +2 -2
  23. package/dist/locales/file-uploader/it.js +2 -2
  24. package/dist/locales/file-uploader/ja.js +2 -2
  25. package/dist/locales/file-uploader/ka.js +2 -2
  26. package/dist/locales/file-uploader/kk.js +2 -2
  27. package/dist/locales/file-uploader/ko.js +2 -2
  28. package/dist/locales/file-uploader/lv.js +2 -2
  29. package/dist/locales/file-uploader/nb.js +2 -2
  30. package/dist/locales/file-uploader/nl.js +2 -2
  31. package/dist/locales/file-uploader/pl.js +2 -2
  32. package/dist/locales/file-uploader/pt.js +2 -2
  33. package/dist/locales/file-uploader/ro.js +2 -2
  34. package/dist/locales/file-uploader/ru.js +2 -2
  35. package/dist/locales/file-uploader/sk.js +2 -2
  36. package/dist/locales/file-uploader/sr.js +2 -2
  37. package/dist/locales/file-uploader/sv.js +2 -2
  38. package/dist/locales/file-uploader/tr.js +2 -2
  39. package/dist/locales/file-uploader/uk.js +2 -2
  40. package/dist/locales/file-uploader/vi.js +2 -2
  41. package/dist/locales/file-uploader/zh-TW.js +2 -2
  42. package/dist/locales/file-uploader/zh.js +2 -2
  43. package/package.json +1 -1
  44. package/web/file-uploader.iife.min.d.ts +3 -1
  45. package/web/file-uploader.iife.min.js +3 -3
  46. package/web/file-uploader.min.d.ts +3 -1
  47. package/web/file-uploader.min.js +3 -3
  48. package/web/uc-basic.layered.min.css +2 -2
  49. package/web/uc-basic.min.css +2 -2
  50. package/web/uc-cloud-image-editor.layered.min.css +2 -2
  51. package/web/uc-cloud-image-editor.min.css +2 -2
  52. package/web/uc-cloud-image-editor.min.d.ts +3 -1
  53. package/web/uc-cloud-image-editor.min.js +3 -3
  54. package/web/uc-file-uploader-inline.layered.min.css +2 -2
  55. package/web/uc-file-uploader-inline.min.css +2 -2
  56. package/web/uc-file-uploader-inline.min.d.ts +3 -1
  57. package/web/uc-file-uploader-inline.min.js +3 -3
  58. package/web/uc-file-uploader-minimal.layered.min.css +2 -2
  59. package/web/uc-file-uploader-minimal.min.css +2 -2
  60. package/web/uc-file-uploader-minimal.min.d.ts +3 -1
  61. package/web/uc-file-uploader-minimal.min.js +3 -3
  62. package/web/uc-file-uploader-regular.layered.min.css +2 -2
  63. package/web/uc-file-uploader-regular.min.css +2 -2
  64. package/web/uc-file-uploader-regular.min.d.ts +3 -1
  65. package/web/uc-file-uploader-regular.min.js +3 -3
  66. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  var UC=(function(exports){'use strict';/**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.25.0-alpha.6 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.25.0-alpha.7 (MIT)
4
4
  * License: https://github.com/uploadcare/file-uploader/blob/main/LICENSE
5
- * Built: 2025-12-12T00:37:35.185Z
5
+ * Built: 2025-12-12T00:55:50.094Z
6
6
  */
7
- var bs=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var a=(o,i)=>bs(o,"name",{value:i,configurable:true});var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?el(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&bs(i,t,r),r};var wt=[],Kt=0,wi=4,ws=a(o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Kt+wi;s<wt.length;)wt[s]===e?wt.splice(s,wi):s+=wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!wt.length;for(let n of i)wt.push(n,t.value,e,r);if(s){for(Kt=0;Kt<wt.length;Kt+=wi)wt[Kt](wt[Kt+1],wt[Kt+2],wt[Kt+3]);wt.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t},"atom");function Br(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}a(Br,"listenKeys");var Hr=a((o={})=>{let i=ws(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i},"map");var z=class o{static{a(this,"PubSub");}static{this.Le=new Map;}constructor(i,t){this.Z=t;}pub(i,t){i in this.Z.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.Z.setKey(i,t);}sub(i,t,e=true){return i in this.Z.get()||console.warn(`PubSub#sub: Key "${String(i)}" not found`),e&&t(this.Z.get()[i]),{remove:Br(this.Z,[i],s=>{t(s[i]);})}}read(i){return i in this.Z.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.Z.get()[i]}add(i,t,e=false){(!(i in this.Z.get())||e)&&this.Z.setKey(i,t);}has(i){return i in this.Z.get()}get store(){return this.Z.get()}static registerCtx(i,t){if(o.Le.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Hr(i);return o.Le.set(t,e),new o(t,e)}static deleteCtx(i){o.Le.delete(i);}static getCtx(i){let t=o.Le.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Le.has(i)}};var xi=globalThis,Ti=xi.ShadowRoot&&(xi.ShadyCSS===void 0||xi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Es=Symbol(),xs=new WeakMap,Ei=class{static{a(this,"n");}constructor(i,t,e){if(this.Pl=true,e!==Es)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(Ti&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=xs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&xs.set(t,i));}return i}toString(){return this.cssText}},Ts=a(o=>new Ei(typeof o=="string"?o:o+"",void 0,Es),"r");var Cs=a((o,i)=>{if(Ti)o.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(let t of i){let e=document.createElement("style"),r=xi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),jr=Ti?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Ts(t)})(o):o;var{is:rl,defineProperty:ol,getOwnPropertyDescriptor:sl,getOwnPropertyNames:nl,getOwnPropertySymbols:al,getPrototypeOf:ll}=Object,Ci=globalThis,As=Ci.trustedTypes,cl=As?As.emptyScript:"",ul=Ci.reactiveElementPolyfillSupport,Ge=a((o,i)=>o,"d"),qe={toAttribute(o,i){switch(i){case Boolean:o=o?cl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},Ai=a((o,i)=>!rl(o,i),"f"),Ss={attribute:true,type:String,converter:qe,reflect:false,useDefault:false,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),Ci.litPropertyMetadata??=new WeakMap;var $t=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.cr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.ai&&[...this.ai.keys()]}static createProperty(i,t=Ss){if(t.state&&(t.attribute=false),this.cr(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&ol(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=sl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let l=r?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Ss}static cr(){if(this.hasOwnProperty(Ge("elementProperties")))return;let i=ll(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ge("finalized")))return;if(this.finalized=true,this.cr(),this.hasOwnProperty(Ge("properties"))){let t=this.properties,e=[...nl(t),...al(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.ai=new Map;for(let[t,e]of this.elementProperties){let r=this.ur(t,e);r!==void 0&&this.ai.set(r,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let r of e)t.unshift(jr(r));}else i!==void 0&&t.push(jr(i));return t}static ur(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.li=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ne=null,this.$l();}$l(){this.dr=new Promise((i=>this.enableUpdating=i)),this.zt=new Map,this.Dl(),this.requestUpdate(),this.constructor.l?.forEach((i=>i(this)));}addController(i){(this.Ue??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Ue?.delete(i);}Dl(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.li=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Cs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Ue?.forEach((i=>i.hostConnected?.()));}enableUpdating(i){}disconnectedCallback(){this.Ue?.forEach((i=>i.hostDisconnected?.()));}attributeChangedCallback(i,t,e){this.pr(i,e);}Vl(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.ur(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:qe).toAttribute(t,e.type);this.ne=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.ne=null;}}pr(i,t){let e=this.constructor,r=e.ai.get(i);if(r!==void 0&&this.ne!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:qe;this.ne=r;let l=n.fromAttribute(t,s.type);this[r]=l??this.hr?.get(r)??l,this.ne=null;}}requestUpdate(i,t,e){if(i!==void 0){let r=this.constructor,s=this[i];if(e??=r.getPropertyOptions(i),!((e.hasChanged??Ai)(s,t)||e.useDefault&&e.reflect&&s===this.hr?.get(i)&&!this.hasAttribute(r.ur(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.dr=this.Fl());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.hr??=new Map).has(i)&&(this.hr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.zt.has(i)||(this.hasUpdated||e||(t=void 0),this.zt.set(i,t)),r===true&&this.ne!==i&&(this.us??=new Set).add(i));}async Fl(){this.isUpdatePending=true;try{await this.dr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.li){for(let[r,s]of this.li)this[r]=s;this.li=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,l=this[r];n!==true||this.zt.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.zt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Ue?.forEach((e=>e.hostUpdate?.())),this.update(t)):this.fr();}catch(e){throw i=false,this.fr(),e}i&&this._l(t);}willUpdate(i){}_l(i){this.Ue?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}fr(){this.zt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.dr}shouldUpdate(i){return true}update(i){this.us&&=this.us.forEach((t=>this.Vl(t,this[t]))),this.fr();}updated(i){}firstUpdated(i){}};$t.elementStyles=[],$t.shadowRootOptions={mode:"open"},$t[Ge("elementProperties")]=new Map,$t[Ge("finalized")]=new Map,ul?.({ReactiveElement:$t}),(Ci.reactiveElementVersions??=[]).push("2.1.1");var Gr=globalThis,Si=Gr.trustedTypes,ks=Si?Si.createPolicy("lit-html",{createHTML:a(o=>o,"createHTML")}):void 0,qr="$lit$",Dt=`lit$${Math.random().toFixed(9).slice(2)}$`,Wr="?"+Dt,dl=`<${Wr}>`,ce=document,Ze=a(()=>ce.createComment(""),"l"),Xe=a(o=>o===null||typeof o!="object"&&typeof o!="function","c"),Zr=Array.isArray,Rs=a(o=>Zr(o)||typeof o?.[Symbol.iterator]=="function","u"),Kr=`[ \f\r]`,We=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Os=/-->/g,Is=/>/g,ae=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ms=/'/g,Ls=/"/g,Ps=/^(?:script|style|textarea|title)$/i,Xr=a(o=>(i,...t)=>({Bt:o,strings:i,values:t}),"y"),y=Xr(1);Xr(2);Xr(3);var Y=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Us=new WeakMap,le=ce.createTreeWalker(ce,129);function $s(o,i){if(!Zr(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ks!==void 0?ks.createHTML(i):i}a($s,"P");var Ds=a((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=We;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===We?p[1]==="!--"?n=Os:p[1]!==void 0?n=Is:p[2]!==void 0?(Ps.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=ae):p[3]!==void 0&&(n=ae):n===ae?p[0]===">"?(n=r??We,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?ae:p[3]==='"'?Ls:Ms):n===Ls||n===Ms?n=ae:n===Os||n===Is?n=We:(n=ae,r=void 0);let m=n===ae&&o[l+1].startsWith("/>")?" ":"";s+=n===We?c+dl:d>=0?(e.push(u),c.slice(0,d)+qr+c.slice(d)+Dt+m):c+Dt+(d===-2?l:m);}return [$s(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"V"),Qe=class o{static{a(this,"N");}constructor({strings:i,Bt:t},e){let r;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=Ds(i,t);if(this.el=o.createElement(u,e),le.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=le.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(qr)){let f=p[n++],m=r.getAttribute(d).split(Dt),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:v[2],strings:m,ctor:v[1]==="."?Oi:v[1]==="?"?Ii:v[1]==="@"?Mi:de}),r.removeAttribute(d);}else d.startsWith(Dt)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(Ps.test(r.tagName)){let d=r.textContent.split(Dt),f=d.length-1;if(f>0){r.textContent=Si?Si.emptyScript:"";for(let m=0;m<f;m++)r.append(d[m],Ze()),le.nextNode(),c.push({type:2,index:++s});r.append(d[f],Ze());}}}else if(r.nodeType===8)if(r.data===Wr)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Dt,d+1))!==-1;)c.push({type:7,index:s}),d+=Dt.length-1;}s++;}}static createElement(i,t){let e=ce.createElement("template");return e.innerHTML=i,e}};function ue(o,i,t=o,e){if(i===Y)return i;let r=e!==void 0?t.Nl?.[e]:t.zl,s=Xe(i)?void 0:i.mr;return r?.constructor!==s&&(r?.ds?.(false),s===void 0?r=void 0:(r=new s(o),r.vr(o,t,e)),e!==void 0?(t.Nl??=[])[e]=r:t.zl=r),r!==void 0&&(i=ue(o,r.Bl(o,i.values),r,e)),i}a(ue,"S");var ki=class{static{a(this,"M");}constructor(i,t){this.ps=[],this.mt=void 0,this.hs=i,this.c=t;}get parentNode(){return this.c.parentNode}get X(){return this.c.X}u(i){let{el:{content:t},parts:e}=this.hs,r=(i?.creationScope??ce).importNode(t,true);le.currentNode=r;let s=le.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Ce(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Li(s,this,i)),this.ps.push(u),c=e[++l];}n!==c?.index&&(s=le.nextNode(),n++);}return le.currentNode=ce,r}p(i){let t=0;for(let e of this.ps)e!==void 0&&(e.strings!==void 0?(e.vt(i,e,t),t+=e.strings.length-2):e.vt(i[t])),t++;}},Ce=class o{static{a(this,"R");}get X(){return this.c?.X??this.fs}constructor(i,t,e,r){this.type=2,this.r=R,this.mt=void 0,this.Tt=i,this.ae=t,this.c=e,this.options=r,this.fs=r?.isConnected??true;}get parentNode(){let i=this.Tt.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Tt}get endNode(){return this.ae}vt(i,t=this){i=ue(this,i,t),Xe(i)?i===R||i==null||i===""?(this.r!==R&&this.le(),this.r=R):i!==this.r&&i!==Y&&this.ms(i):i.Bt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Rs(i)?this.k(i):this.ms(i);}O(i){return this.Tt.parentNode.insertBefore(i,this.ae)}T(i){this.r!==i&&(this.le(),this.r=this.O(i));}ms(i){this.r!==R&&Xe(this.r)?this.Tt.nextSibling.data=i:this.T(ce.createTextNode(i)),this.r=i;}$(i){let{values:t,Bt:e}=i,r=typeof e=="number"?this.Hl(i):(e.el===void 0&&(e.el=Qe.createElement($s(e.h,e.h[0]),this.options)),e);if(this.r?.hs===r)this.r.p(t);else {let s=new ki(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Hl(i){let t=Us.get(i.strings);return t===void 0&&Us.set(i.strings,t=new Qe(i)),t}k(i){Zr(this.r)||(this.r=[],this.le());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(Ze()),this.O(Ze()),this,this.options)):e=t[r],e.vt(s),r++;r<t.length&&(this.le(e&&e.ae.nextSibling,r),t.length=r);}le(i=this.Tt.nextSibling,t){for(this.ci?.(false,true,t);i!==this.ae;){let e=i.nextSibling;i.remove(),i=e;}}setConnected(i){this.c===void 0&&(this.fs=i,this.ci?.(i));}},de=class{static{a(this,"k");}get tagName(){return this.element.tagName}get X(){return this.c.X}constructor(i,t,e,r,s){this.type=1,this.r=R,this.mt=void 0,this.element=i,this.name=t,this.c=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=R;}vt(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=ue(this,i,t,0),n=!Xe(i)||i!==this.r&&i!==Y,n&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=ue(this,l[e+c],t,c),u===Y&&(u=this.r[c]),n||=!Xe(u)||u!==this.r[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.r[c]=u;}n&&!r&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Oi=class extends de{static{a(this,"H");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Ii=class extends de{static{a(this,"I");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Mi=class extends de{static{a(this,"L");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}vt(i,t=this){if((i=ue(this,i,t,0)??R)===Y)return;let e=this.r,r=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Li=class{static{a(this,"z");}constructor(i,t,e){this.element=i,this.type=6,this.mt=void 0,this.c=t,this.options=e;}get X(){return this.c.X}vt(i){ue(this,i);}},Vs={I:Ce},pl=Gr.litHtmlPolyfillSupport;pl?.(Qe,Ce),(Gr.litHtmlVersions??=[]).push("3.3.1");var Fs=a((o,i,t)=>{let e=t?.renderBefore??i,r=e.jl;if(r===void 0){let s=t?.renderBefore??null;e.jl=r=new Ce(i.insertBefore(Ze(),s),s,void 0,t??{});}return r.vt(o),r},"B");var Qr=globalThis,mt=class extends $t{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.gr=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.gr=Fs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.gr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.gr?.setConnected(false);}render(){return Y}};mt.Zd=true,mt.finalized=true,Qr.litElementHydrateSupport?.({LitElement:mt});var hl=Qr.litElementPolyfillSupport;hl?.({LitElement:mt});(Qr.litElementVersions??=[]).push("4.2.1");var fl=/\\([0-9a-fA-F]{1,6} ?)/g;function ml(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}a(ml,"hasLeadingTrailingQuotes");function vl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(vl,"trimQuotes");function gl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}a(gl,"escapeQuotes");function _s(o){let i=o;ml(o)&&(i=vl(i),i=i.replace(fl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=gl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(_s,"parseCssPropertyValue");function Ae(o){class i extends o{constructor(){super(...arguments);this.vs=null;this.yr=null;}static{a(this,"CssDataMixinClass");}getCssData(r,s=false){let n=this.vs??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.yr||(this.yr=window.getComputedStyle(this));let l=this.yr.getPropertyValue(r).trim();try{n[r]=_s(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),n[r]=null;}}return this.vs=n,n[r]}}return i}a(Ae,"CssDataMixin");function Ui(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Ht={};this.jt=null;this.ui=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.jt||(this.jt=Array.from(this.childNodes)),super.connectedCallback();}Kl(){if(this.ui)return;this.ui=true,this.Ht={};let r=Array.from(this.childNodes),s=r.length?r:this.jt??[];for(let n of s){let l=this.gs(n),c=this.Ht[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Ht[l]=c;}this.jt=null;}gs(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.gs(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Gl(r){return !r.textContent||!r.textContent.trim()}ql(r){let s=this.Ht[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Gl(n))}update(r){!this.hasUpdated&&this.willYield&&this.Kl(),super.update(r);}yield(r,s){if(r===""&&!this.Ht[r]&&!this.ui&&this.jt?.length){let l=[];for(let c of this.jt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Ht[r]=l,this.ui=true,this.jt=null;}let n=this.Ht[r];return y` ${n} ${this.ql(r)?s:void 0} `}}return i}a(Ui,"LightDomMixin");function Se(o){class i extends o{static{a(this,"RegisterableElementMixinClass");}static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}a(Se,"RegisterableElementMixin");var Gt=class extends Event{static{a(this,"s");}constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var ke=class{static{a(this,"s");}constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Gt(this.context,this.host,this.t,this.subscribe));}};var Ri=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Yr=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Oe=class extends Ri{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Gt(this.context,l,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Yr(this.context,this.host));}};var bl={attribute:true,type:String,converter:qe,reflect:false,hasChanged:Ai},wl=a((o=bl,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,o);},init(l){return l!==void 0&&this.C(n,void 0,o,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,o);}}throw Error("Unsupported decorator location: "+e)},"r");function x(o){return (i,t)=>typeof t=="object"?wl(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}a(x,"n");function g(o){return x({...o,state:true,attribute:false})}a(g,"r");function $(o,i){let t,e=a(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a($,"debounce");var Ns="ctx-name-context";function $i(){return function(o){class i extends o{constructor(...r){super(...r);this.tt=null;this.Re=false;this.br=false;this.wr=void 0;this.ce=new Map;this.Pe=new Set;this.init$={};this.ctxOwner=false;this.di=void 0;this.pi=false;this.ctxName=this.Mt;this.Lt=false;this.di=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Mt,this.Wl=new ke(this,{context:Ns,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.xs=s,this.bs();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}get ys(){return this.di}set ys(r){let s=r??void 0;this.di!==s&&(this.di=s,this.bs());}shouldUpdate(r){return this.Lt?super.shouldUpdate(r):false}get Mt(){return this.ys||this.xs||void 0}bs(){if(this.ctxName=this.Mt,!(!this.ctxName||this.Re)){if(this.isConnected){this.xr();return}this.pi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Mt,this.ctxName&&(this.wr?this.wr.setValue(this.ctxName):this.wr=new Oe(this,{context:Ns,initialValue:this.ctxName}));}Es(){if(!(!this.tt||this.ce.size===0)){for(let[r,{value:s,rewrite:n}]of this.ce)this.tt.add(r,s,n);this.ce.clear();}}Ts(){return !this.tt&&this.Mt&&this.Er(),this.tt&&this.Es(),this.tt}Tr(){let r=this.Ts();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Er(){let r=this.init$,s=this.Mt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.tt){this.tt=z.getCtx(s)??z.registerCtx(r,s);for(let[n,l]of Object.entries(this.init$))this.tt.add(n,l,this.ctxOwner);this.Es();}}get $(){return this.Mt&&this.Er(),new Proxy({},{get:a((r,s)=>{if(typeof s=="string")return this.tt?.read(s)},"get"),set:a((r,s,n)=>(typeof s!="string"||this.tt?.pub(s,n),true),"set")})}sub(r,s,n=true){let l=this.Tr().sub(r,s,n);if(!l||typeof l.remove!="function")return ()=>{};let c=l.remove.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Pe.delete(p));},"trackedRemove");return this.Pe.add(p),p}pub(r,s){this.Tr().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}has(r){return this.tt?.has(r)??false}add(r,s,n=false){let l=this.Ts();if(!l){if(!n&&this.ce.has(r))return;this.ce.set(r,{value:s,rewrite:n});return}this.ce.delete(r),l.add(r,s,n);}add$(r,s=false){for(let[n,l]of Object.entries(r))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Re?this.Lt&&this.br&&(this.br=false,this.initCallback()):this.ctxName?(this.pi=false,this.xr()):this.pi&&this.Mt&&(this.pi=false,this.xr());}xr(){if(this.Re)return;this.Re=true,this.Er();let r=this.init$;if(Object.keys(r).length>0){let s=this.Tr();for(let[n,l]of Object.entries(r))s.read(n)===void 0&&s.pub(n,l),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Lt=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.Zl(),super.disconnectedCallback(),this.Re&&(this.br=true);}Zl(){if(this.Pe.size!==0){for(let r of [...this.Pe])r();this.Pe.clear();}}initCallback(){}}return h([x({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"ys",1),h([g()],i.prototype,"xs",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Lt",2),i}}a($i,"SymbioteMixin");var Jr=class extends Se($i()(Ae(Ui(mt)))){static{a(this,"BaseComponent");}};var Vt=class{static{a(this,"UID");}static generate(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}};var xl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function to(o){for(let i in o){if(xl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}a(to,"defineComponents");var eo="UC";function El(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[eo]){t(window[eo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[eo];i&&to(s),t(s);},document.head.appendChild(r);})}a(El,"loadFileUploaderFrom");var Ye={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var io=new Map,zs=new Map,Bs=a((o,i)=>{io.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...Ye,...i};return io.set(o,t),t},"defineLocaleSync"),Tl=a((o,i)=>{zs.set(o,i);},"defineLocaleAsync"),Hs=a((o,i)=>{typeof i=="function"?Tl(o,i):Bs(o,i);},"defineLocale"),js=a(async o=>{let i=io.get(o);if(!i){let t=zs.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=Bs(o,e);}return i},"resolveLocaleDefinition");Hs("en",Ye);var K=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Di=class{constructor(i){this.Kt=new Map;this.gt=new Set;this.E=new Map;this.m=i;}static{a(this,"ModalManager");}v(...i){this.m.debugPrint("[modal-manager]",...i);}registerModal(i,t){this.Kt.set(i,t),this.q(K.ADD,{id:i,modal:t});}deleteModal(i){let t=this.Kt.get(i);return t?(this.Kt.delete(i),this.gt.delete(i),this.q(K.DELETE,{id:i,modal:t}),true):false}open(i){let t=this.Kt.get(i);return t?(this.gt.add(i),this.q(K.OPEN,{modal:t,id:i}),true):(this.v(`Modal with ID "${i}" not found`),false)}close(i){let t=this.Kt.get(i);return !t||!this.gt.has(i)?(this.v(`Modal with ID "${i}" not found or not active`),false):(this.gt.delete(i),this.q(K.CLOSE,{id:i,modal:t}),true)}toggle(i){return this.Kt.has(i)?this.gt.has(i)?this.close(i):this.open(i):(this.v(`Modal with ID "${i}" not found`),false)}get hasActiveModals(){return this.gt.size>0}back(){if(this.gt.size===0)return this.v("No active modals to go back from"),false;let i=Array.from(this.gt).pop();return i?this.close(i):false}closeAll(){let i=this.gt.size;return this.gt.clear(),this.q(K.CLOSE_ALL,{}),i}subscribe(i,t){return this.E.has(i)||this.E.set(i,new Set),this.E.get(i)?.add(t),()=>this.unsubscribe(i,t)}unsubscribe(i,t){this.E.has(i)&&this.E.get(i)?.delete(t);}q(i,t){if(this.E.has(i))for(let e of this.E.get(i)??new Set)try{e(t);}catch(r){this.m.telemetryManager.sendEventError(r,"modal subscriber"),this.v("Error in modal subscriber:",r);}}destroy(){this.closeAll(),this.Kt.clear(),this.E.clear(),this.q(K.DESTROY,{});}};var Je=a(o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function Ks(o){return Object.prototype.toString.call(o)==="[object Object]"}a(Ks,"isObject");var Cl=/\W|_/g;function Al(o){return o.split(Cl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(Al,"camelizeString");function Gs(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>_t(t,{ignoreKeys:i})):o}a(Gs,"camelizeArrayItems");function _t(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Gs(o,{ignoreKeys:i});if(!Ks(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Ks(r)?r=_t(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Gs(r,{ignoreKeys:i})),t[Al(e)]=r;}return t}a(_t,"camelizeKeys");var Sl=a(o=>new Promise(i=>setTimeout(i,o)),"delay");function co({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),l=[s,r].filter(Boolean).join("; ");return `${n} (${l})`}a(co,"getUserAgent$1");var kl={factor:2,time:100};function Ol(o,i=kl){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a(l=>Sl(l??s).then(()=>(t+=1,e(r))),"retry")})}return a(e,"runAttempt"),e(o)}a(Ol,"retrier");var pe=class extends Error{static{a(this,"UploadcareError");}},Ie=class o extends pe{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},Vi=a((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),qt=class o extends pe{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Il=500,Ws=a(({check:o,interval:i=Il,timeout:t,signal:e})=>new Promise((r,s)=>{let n,l;Vi(e,()=>{n&&clearTimeout(n),s(new qt("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new qt("Timed out"));},t));let c=a(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Fi="application/octet-stream",Zs="original",Zt=a(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[f,m]=d;typeof m<"u"&&!Array.isArray(m)&&c.setRequestHeader(f,m);}),c.responseType="text",Vi(r,()=>{p=true,c.abort(),l(new qt);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(E){let C=E.split(": "),A=C.shift(),L=C.join(": ");A&&typeof A<"u"&&(m[A]=L);});let v=c.response,w=c.status;n({request:d,data:v,headers:m,status:w});}},c.onerror=d=>{p||l(new Ie(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 Ml(o,...i){return o}a(Ml,"identity");var Ll=a(({name:o})=>o?[o]:[],"getFileOptions"),Ul=Ml,Rl=a(()=>new FormData,"getFormData"),Xs=a(o=>false,"isBuffer"),_i=a(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),Ni=a(o=>typeof File<"u"&&o instanceof File,"isFile"),zi=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),Me=a(o=>_i(o)||Ni(o)||Xs()||zi(o),"isFileData"),Pl=a(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),$l=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Dl=a(o=>!!o&&typeof o=="object"&&"data"in o&&Me(o.data),"isFileValue");function Qs(o,i,t){if(Array.isArray(t))for(let e of t)Qs(o,`${i}[]`,e);else if(Dl(t)){let{name:e,contentType:r}=t,s=Ul(t.data,e,r??Fi),n=Ll({name:e,contentType:r});o.push([i,s,...n]);}else if($l(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Pl(t)&&t&&o.push([i,t.toString()]);}a(Qs,"collectParams");function Vl(o){let i=[];for(let[t,e]of Object.entries(o))Qs(i,t,e);return i}a(Vl,"getFormDataParams");function Bi(o){let i=Rl(),t=Vl(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}a(Bi,"buildFormData");var J=class o extends pe{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Fl=a(o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Ft=a((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fl(t)),e.toString()},"getUrl"),_l="6.18.2",Nl="UploadcareUploadClient",zl=_l;function fe(o){return co({libraryName:Nl,libraryVersion:zl,...o})}a(fe,"getUserAgent");var Bl="RequestThrottledError",qs=15e3,Hl=1e3;function jl(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return qs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:qs}a(jl,"getTimeoutFromThrottledRequest");function Xt(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Ol(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Bl&&r<t)return s(jl(n));if(n instanceof Ie&&r<e)return s((r+1)*Hl);throw n}))}a(Xt,"retryIfFailed");var Ys=a(o=>{let i="";return (_i(o)||Ni(o)||zi(o))&&(i=o.type),i||Fi},"getContentType"),Js=a(o=>{let i="";return Ni(o)&&o.name?i=o.name:_i(o)||Xs()?i="":zi(o)&&o.name&&(i=o.name),i||Zs},"getFileName");function uo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}a(uo,"getStoreValue");function Kl(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=U.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",url:Ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},data:Bi({file:{data:o,name:t||Js(o),contentType:e||Ys(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:uo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Kl,"base");var so;(function(o){o.Token="token",o.FileInfo="file_info";})(so||(so={}));function Gl(o,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},url:Ft(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:uo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Gl,"fromUrl");var nt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(nt||(nt={}));var ql=a(o=>"status"in o&&o.status===nt.Error,"isErrorResponse");function Wl(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}={}){return Xt(()=>Zt({method:"GET",headers:i?{"X-UC-User-Agent":fe({publicKey:i,integration:r,userAgent:s})}:void 0,url:Ft(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=_t(JSON.parse(c));if("error"in d&&!ql(d))throw new J(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(Wl,"fromUrlStatus");function Zl(o,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"POST",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:c,userAgent:u})},url:Ft(t,"/group/",{jsonerrors:1}),data:Bi({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:n}).then(({data:f,headers:m,request:v})=>{let w=_t(JSON.parse(f));if("error"in w)throw new J(w.error.content,w.error.errorCode,v,w,m);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(Zl,"group");function tn(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"GET",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:s,userAgent:n})},url:Ft(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=_t(JSON.parse(u));if("error"in f)throw new J(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(tn,"info");function Xl(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",url:Ft(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},data:Bi({filename:e||Zs,size:o,content_type:t||Fi,part_size:r,UPLOADCARE_STORE:uo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L.parts=Object.keys(L.parts).map(ht=>L.parts[Number(ht)]),L}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})}a(Xl,"multipartStart");function Ql(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||Fi}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Ql,"multipartUpload");function Yl(o,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"POST",url:Ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:s,userAgent:n})},data:Bi({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=_t(JSON.parse(u));if("error"in f)throw new J(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Yl,"multipartComplete");function po(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Ws({check:a(p=>tn(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(po,"isReadyPoll");function Jl(o){return "defaultEffects"in o}a(Jl,"isGroupFileInfo");var he=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=Ft(t,`${r}/`),l=s?Ft(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,Jl(i)&&(this.defaultEffects=i.defaultEffects);}},tc=a((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:E})=>Kl(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:E}).then(({file:C})=>po(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new he(C,{baseCDN:w})),"uploadDirect"),ec=a((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>tn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new he(f,{baseCDN:d,fileName:t})).then(f=>(s&&s({isComputable:true,value:1}),f)),"uploadFromUploaded"),ic=a((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=a(n=>()=>{e=n,r.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return Vi(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),rc=window.WebSocket,no=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},oc=a((o,i)=>o==="success"?{status:nt.Success,...i}:o==="progress"?{status:nt.Progress,...i}:{status:nt.Error,...i},"response"),ao=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new no;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 rc(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,oc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},ro=null,ho=a(o=>{if(!ro){let i=typeof window>"u"?0:3e4;ro=new ao(o,i);}return ro},"getPusher"),sc=a(o=>{ho(o).connect();},"preconnect");function nc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return Ws({check:a(u=>Wl(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case nt.Error:return new J(p.error,p.errorCode);case nt.Waiting:return false;case nt.Unknown:return new J(`Token "${o}" was not found.`);case nt.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case nt.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(nc,"pollStrategy");var ac=a(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=ho(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(o);},"destroy");Vi(t,()=>{c(),s(new qt("pusher cancelled"));}),n.subscribe(o,u=>{switch(u.status){case nt.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case nt.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case nt.Error:c(),s(new J(u.msg,u.error_code));}});}),"pushStrategy"),lc=a((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:E=U.pusherKey,metadata:C})=>Promise.resolve(sc(E)).then(()=>Gl(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(A=>(ho(E)?.disconnect(),Promise.reject(A))).then(A=>A.type===so.FileInfo?A:ic([({signal:L})=>nc({token:A.token,publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:L}),({signal:L})=>ac({token:A.token,pusherKey:E,signal:L,onProgress:d})],{signal:p})).then(A=>{if(A instanceof J)throw A;return A}).then(A=>po(A.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(A=>new he(A,{baseCDN:r})),"uploadFromUrl"),oo=new WeakMap,cc=a(async o=>{if(oo.has(o))return oo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return oo.set(o,i),i},"getBlobFromReactNativeAsset"),en=a(async o=>{if(Ni(o)||_i(o))return o.size;if(zi(o))return (await cc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),uc=a((o,i=U.multipartMinFileSize)=>o>=i,"isMultipart"),rn=a(o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Me(o)&&t.test(o)},"isUuid"),fo=a(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Me(o)&&t.test(o)},"isUrl"),dc=a((o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,n-=1,n?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),pc=a((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),hc=a(async(o,i,t)=>e=>pc(o,e,i,t),"prepareChunks"),fc=a((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Ql(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),mc=a(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:E=U.multipartChunkSize,maxConcurrentRequests:C=U.maxConcurrentRequests,baseCDN:A,metadata:L})=>{let ht=e??await en(o),ft,ne=a((Z,st)=>{if(!u)return;ft||(ft=Array(Z).fill(0));let bt=a(At=>At.reduce((Pt,zr)=>Pt+zr,0),"sum");return At=>{At.isComputable&&(ft[st]=At.value,u({isComputable:true,value:bt(ft)/Z}));}},"createProgressHandler");return w||=Ys(o),Xl(ht,{publicKey:i,contentType:w,fileName:t||Js(o),baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:L,multipartChunkSize:E}).then(async({uuid:Z,parts:st})=>{let bt=await hc(o,ht,E);return Promise.all([Z,dc(C,st.map((At,Pt)=>()=>fc(bt(Pt),At,{publicKey:i,contentType:w,onProgress:ne(st.length,Pt),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})))])}).then(([Z])=>Yl(Z,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})).then(Z=>Z.isReady?Z:po(Z.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(Z=>new he(Z,{baseCDN:A}))},"uploadMultipart");async function mo(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartMinFileSize:w,multipartChunkSize:E,maxConcurrentRequests:C,baseCDN:A=U.baseCDN,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:ht,pusherKey:ft,metadata:ne}){if(Me(o)){let Z=await en(o);return uc(Z,w)?mc(o,{publicKey:i,contentType:v,multipartChunkSize:E,fileSize:Z,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:ne}):tc(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:ne})}if(fo(o))return lc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:ht,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:ft,metadata:ne});if(rn(o))return ec(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A});throw new TypeError(`File uploading from "${o}" is not supported`)}a(mo,"uploadFile");var lo=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new he(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},vc=a(o=>{for(let i of o)if(!Me(i))return false;return true},"isFileDataArray"),gc=a(o=>{for(let i of o)if(!rn(i))return false;return true},"isUuidArray"),yc=a(o=>{for(let i of o)if(!fo(i))return false;return true},"isUrlArray");function on(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w=U.multipartChunkSize,baseCDN:E=U.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:A,jsonpCallback:L}){if(!vc(o)&&!yc(o)&&!gc(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let ht,ft=true,ne=o.length,Z=a((st,bt)=>{if(!c)return;ht||(ht=Array(st).fill(0));let At=a(Pt=>Pt.reduce((zr,tl)=>zr+tl)/st,"normalize");return Pt=>{if(!Pt.isComputable||!ft){ft=false,c({isComputable:false});return}ht[bt]=Pt.value,c({isComputable:true,value:At(ht)});}},"createProgressHandler");return Promise.all(o.map((st,bt)=>Me(st)||fo(st)?mo(st,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:Z(ne,bt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w,baseCDN:E,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:A}).then(At=>At.uuid):st)).then(st=>Zl(st,{publicKey:i,baseURL:e,jsonpCallback:L,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(bt=>new lo(bt,{baseCDN:E})).then(bt=>(c&&c({isComputable:true,value:1}),bt)))}a(on,"uploadFileGroup");var Wt=class{static{a(this,"Queue");}hi=1;Cr=[];fi=0;Ar=new Map;Sr=new Map;constructor(i){this.hi=i;}run(){let i=this.hi-this.fi;for(let t=0;t<i;t++){let e=this.Cr.shift();if(!e)return;let r=this.Ar.get(e),s=this.Sr.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.fi+=1,e().finally(()=>{this.Ar.delete(e),this.Sr.delete(e),this.fi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.Ar.set(i,e),this.Sr.set(i,r),this.Cr.push(i),t&&this.run();})}get pending(){return this.Cr.length}get running(){return this.fi}set concurrency(i){this.hi=i,this.run();}get concurrency(){return this.hi}};var vo=a(()=>({}),"blockCtx"),go=a(o=>({...vo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),yo=a(o=>({...go(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Wt(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),sn=a(o=>({...yo(o),"*solution":null}),"solutionBlockCtx");var bc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ti(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}a(ti,"focus");function bo(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=bc[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}a(bo,"findGroupNodeByEventTarget");function wo(o,i){return i.role==="toolbar"?wc(i):i.querySelectorAll(`[role=${o.role}]`)}a(wo,"getItems");function wc(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(wc,"getToolbarItems");function xc(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(xc,"isHorizontalOrientation");function nn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function n(d){let f=bo(d.target);if(!f){l();return}let m=wo(d.target,f),v=Array.from(m).indexOf(d.target),w="ArrowDown",E="ArrowUp";if(xc(f)&&(i.document.dir==="rtl"?(w="ArrowLeft",E="ArrowRight"):(w="ArrowRight",E="ArrowLeft")),d.key===w)d.preventDefault(),ti(d.target,m[v+1]||m[0]);else if(d.key===E)d.preventDefault(),ti(d.target,m[v-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),ti(d.target,m[0]);else if(d.key==="End")d.preventDefault(),ti(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let C=Date.now();C-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=C;let A=Array.from(m).find(L=>L.textContent?.trim()?.toLowerCase()?.startsWith(s));A&&(d.preventDefault(),ti(d.target,A));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let f=bo(d.target);if(f){t||(t=true,i.addEventListener("keydown",n));let m=wo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let f=bo(d.target);if(f){let m=wo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(nn,"focusGroupKeyUX");function an(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}a(an,"hiddenKeyUX");function ln(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let r=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}a(ln,"jumpKeyUX");function cn(o){let i,t=o.split(" "),e;function r(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(r,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}a(cn,"pressKeyUX");function un(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}a(un,"startKeyUX");var xo=class{constructor(){this.$e=new Map;this.kr=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(r=>{let s=r.target;s instanceof Node&&this.kr.some(n=>n===s||n.contains(s))&&t(r);},"wrappedListener");this.$e.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.$e.get(t);e&&window.removeEventListener(i,e),this.$e.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.kr.push(i);}destroy(){this.kr=[];for(let i of this.$e.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.$e.clear();}},Hi=class{static{a(this,"A11y");}constructor(){this.mi=new xo,this.Cs=un(this.mi,[nn(),cn("is-pressed"),ln(),an()]);}registerBlock(i){this.mi.registerScope(i);}destroy(){this.Cs?.(),this.mi.destroy();}};var Qt=a(o=>`*l10n/${o}`,"localeStateKey"),Ec="en",ji=class{constructor(i){this.i=null;this.Or="";this.i=i;for(let[t,e]of Object.entries(Ye)){let r=this.i.has(Qt(t))?!this.i.$[Qt(t)]:true;this.i.add(Qt(t),e,r);}setTimeout(()=>{i.subConfigValue("localeName",async t=>{if(!this.i||!t)return;this.Or=t;let e=await js(t);if(t!==Ec&&this.Or!==t)return;let r=this.i.cfg.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let l=r?.[s];this.i.add(Qt(s),l??n,true);}}),i.subConfigValue("localeDefinitionOverride",t=>{if(!t)return;let e=t[this.Or];if(e)for(let[r,s]of Object.entries(e))this.i?.add(Qt(r),s,true);});});}static{a(this,"LocaleManager");}};function Tc(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(Tc,"i");function To(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?To(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Tc(i);return typeof t=="object"&&t!==null?[e,To(t)]:[e,t]}))}a(To,"c");function Cc(o){return {ok:true,value:o}}a(Cc,"u");function Eo(o){return {ok:false,error:o}}a(Eo,"a");var Ac="https://tlm.uploadcare.com/api/",Co=class{static{a(this,"y");}constructor(i=Ac){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Eo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Cc(s)}catch(s){return Eo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Eo(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(To(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Sc=a(async(o,i)=>({success:true,data:i}),"f"),Ki=class extends Co{static{a(this,"p");}constructor(){super();}async sendEvent(i,t){let e=await Sc(void 0,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 at=a(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Nt=a(o=>o.join(","),"serializeCsv");var dn=a(o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Gi=a((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>dn(i)).join("/-/"),"joinCdnOperations"),tt=a((...o)=>{let i=Gi(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function qi(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}a(qi,"extractFilename");function Wi(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}a(Wi,"extractUuid");function Ao(o){let i=pn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(Ao,"extractCdnUrlModifiers");function So(o){return Ao(o).split("/-/").filter(Boolean).map(t=>dn(t))}a(So,"extractOperations");function pn(o){let i=new URL(o),t=qi(o),e=hn(t)?fn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(pn,"trimFilename");function hn(o){return o.startsWith("http")}a(hn,"isFileUrl");function fn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(fn,"splitFileUrl");var G=a((o,i,t)=>{let e=new URL(pn(o)),r=t??qi(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&hn(r)){let n=fn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},"createCdnUrl"),Yt=a((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var q=a((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var ei=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),vn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function kc(o,i){if(typeof i=="number"){let t=i;return ei[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return ei[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return ei.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}a(kc,"transformationToStr");function Jt(o){return Gi(...vn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return kc(i,t)}).filter(i=>!!i))}a(Jt,"transformationsToOperations");var Zi=Gi("format/auto","progressive/yes"),zt=a(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),mn=a(()=>true,"asBoolean"),Oc=a(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),Ic=a(([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:q(o,"x").map(Number),coords:q(i).map(Number)}},"asCrop"),Mc=Object.freeze({enhance:zt,brightness:zt,exposure:zt,gamma:zt,contrast:zt,saturation:zt,vibrance:zt,warmth:zt,filter:Oc,mirror:mn,flip:mn,rotate:zt,crop:a(o=>{let[i,t]=o,{dimensions:e,coords:r}=Ic([i,t]);return {dimensions:e,coords:r}},"crop")});function ko(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!vn.includes(e))continue;let s=e,n=Mc[s];try{let l=n(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(ko,"operationsToTransformations");var F=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),et=Object.freeze([F.CROP,F.TUNING,F.FILTERS]),gn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),yn=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"]),bn=Object.freeze(["rotate","mirror","flip"]),Bt=ei,xt=Object.freeze({brightness:{zero:Bt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Bt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Bt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Bt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Bt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Bt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Bt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Bt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Bt.filter,range:[0,100],keypointsNumber:1}});var ii="https://ucarecdn.com",Lc="https://upload.uploadcare.com",Uc="https://social.uploadcare.com",Rc="https://ucarecd.net",Pc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:Nt(et),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:ii,cdnCnamePrefixed:Rc,baseUrl:Lc,socialBaseUrl:Uc,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true},lt=Object.freeze(Pc);var D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Xi=class{constructor(i){this.vi=new Map;this.Ir=new Set;this.v=null;this.v=i;}static{a(this,"EventEmitter");}bindTarget(i){return this.Ir.add(i),()=>{this.Ir.delete(i);}}As(i,t){for(let e of this.Ir)e.dispatchEvent(new CustomEvent(i,{detail:t}));this.v?.(()=>{let e=t&&typeof t=="object"?{...t}:t;return [`event "${i}"`,e]});}emit(i,t,e={}){let{debounce:r}=e;if(typeof r!="number"&&!r){this.As(i,typeof t=="function"?t():t);return}this.vi.has(i)&&window.clearTimeout(this.vi.get(i));let s=typeof r=="number"?r:20,n=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this.As(i,l),this.vi.delete(i);}catch(l){this.v?.(()=>`Error while getting payload for event "${i}"`,l);}},s);this.vi.set(i,n);}};var wn="1.25.0-alpha.6";var St="blocks",kt=wn;var Qi=class{constructor(i){this.Xl=crypto.randomUUID();this.ue=structuredClone(lt);this.Mr=false;this.Lr=null;this.Ut=true;this.m=i,this.Ss=new Ki,this.de=new Wt(10),this.m.subConfigValue("qualityInsights",t=>{this.Ut=!!t;});for(let t of Object.keys(this.ue))this.m.subConfigValue(t,e=>{this.Ut&&(this.Mr&&this.ue[t]!==e&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.Yl(t,e));});}static{a(this,"TelemetryManager");}Ql(i){i===D.INIT_SOLUTION&&!this.Mr&&(this.Mr=true);}Yl(i,t){this.ue[i]!==t&&(this.ue[i]=t);}Jl(i){let t=i.payload?{...i.payload}:{};t.activity&&(t.activity=void 0);let e={...i};return (i.eventType===D.INIT_SOLUTION||i.eventType===D.CHANGE_CONFIG)&&(e.config=this.ue),{...e,appVersion:kt,appName:St,sessionId:this.Xl,component:this.tc,activity:this.ec,projectPubkey:this.ue.pubkey,userAgent:navigator.userAgent,eventType:e.eventType??"",eventTimestamp:this.ic,payload:{location:this.rc,...t}}}oc(i){return !!(i&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(i))}sendEvent(i){if(!this.Ut)return;let t=this.Jl({eventType:i.eventType,payload:i.payload,config:i.config});this.Ql(i.eventType),!(this.oc(i.eventType)||this.Lr&&this.ks(this.Lr,t))&&this.de.add(async()=>{this.Lr=t,await this.Ss.sendEvent(t);});}sendEventError(i,t="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:i.message}}});}sendEventCloudImageEditor(i,t,e={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:t,node:i.currentTarget?.tagName,event:i.type,...e}}});}ks(i,t){if(JSON.stringify(i)===JSON.stringify(t))return true;if(typeof i!="object"||typeof t!="object"||i==null||t==null)return false;let e=Object.keys(i),r=Object.keys(t);if(e.length!==r.length)return false;for(let s of e)if(!Object.hasOwn(t,s)||!this.ks(i[s],t[s]))return false;return true}get ic(){return Date.now()}get tc(){if(!this.m.has("*solution"))return null;let i=this.m.$["*solution"];return i?i.toLowerCase():null}get ec(){return this.m.has("*currentActivity")?this.m.$["*currentActivity"]??null:null}get rc(){return location.origin}};var X=a(o=>`*cfg/${o}`,"sharedConfigKey");var xn=a(o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Yi=a((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var Dc=a(o=>o,"DEFAULT_TRANSFORMER"),Oo="{{",Tn="}}",En="plural:";function ri(o,i={},t={}){let{openToken:e=Oo,closeToken:r=Tn,transform:s=Dc}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+n+r,u);}return o}a(ri,"applyTemplateData");function Cn(o){let i=[],t=o.indexOf(Oo);for(;t!==-1;){let e=o.indexOf(Tn,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(En)){let s=o.substring(t+2,e).replace(En,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:l});}t=o.indexOf(Oo,e);}return i}a(Cn,"getPluralObjects");var An="--uploadcare-blocks-window-height",oi=class o{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=$(()=>{document.documentElement.style.setProperty(An,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(An);}};var Vc=a(o=>o.tagName?.includes("-")??false,"isCustomElement"),Ji=class{constructor(i){this.Gt=new Set;this.gi=new Map;this.Os=false;this.qt=i,this.qt.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.yi?.(),this.yi=void 0,this.Gt.clear(),this.gi.clear();}hostUpdated(){if(!this.yi&&this.qt.has(X("testMode"))){let i=this.qt.subConfigValue("testMode",t=>{this.Os=!!t,this.Is();});this.yi=i;}this.sc(),this.Is();}sc(){let i=this.qt,t=i.renderRoot??i;if(!t)return;let e=this.qt,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Vc(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.Gt.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.Gt.add(n),this.gi.set(n,l);}for(let n of Array.from(this.Gt))(!n.isConnected||r&&n.closest(r)!==e)&&(this.Gt.delete(n),this.gi.delete(n));}Is(){if(!this.Gt.size)return;let i=this.qt.testId||"";for(let t of this.Gt){let e=this.gi.get(t);e&&(this.Os?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Fc=Se($i()(Ae(Ui(mt)))),T=class extends Fc{constructor(){super();this.bi=new Map;this.activityType=null;this.init$=vo();new Ji(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}l10n(t,e={}){if(!t)return "";let r=this.$[Qt(t)]||t,s=Cn(r);for(let l of s)e[l.variable]=this.nc(l.pluralKey,Number(e[l.countVariable]));return ri(r,e)}nc(t,e){let r=this.l10n("locale-id")||"en",s=Yi(r,e);return this.l10n(`${t}__${s}`)}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),oi.registerClient(this);}initCallback(){this.addSharedContextInstance("*blocksRegistry",()=>new Set,{persist:true}),this.addSharedContextInstance("*eventEmitter",()=>new Xi(this.debugPrint.bind(this)),{persist:true}),this.addSharedContextInstance("*localeManager",()=>new ji(this)),this.addSharedContextInstance("*modalManager",()=>new Di(this)),this.addSharedContextInstance("*a11y",()=>new Hi,{persist:true}),this.addSharedContextInstance("*telemetryManager",()=>new Qi(this)),this.sub(Qt("locale-id"),t=>{let e=xn(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.getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this.getSharedContextInstance("*telemetryManager")}get localeManager(){return this.getSharedContextInstance("*localeManager")}get a11y(){return this.getSharedContextInstance("*a11y")}get blocksRegistry(){return this.getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this.getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),oi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),this.Ms(),t?.size===0&&setTimeout(()=>{!this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Ms(true),z.deleteCtx(this.ctxName);}addSharedContextInstance(t,e,{persist:r=false}={}){if(!this.bi.has(t)&&(!this.has(t)||!this.$[t])){let s=e();this.add(t,s,true),this.bi.set(t,{persist:r,instance:s});return}}Ms(t=false){for(let[e,r]of this.bi.entries()){let{persist:s,instance:n}=r;s&&!t||(n?.destroy?.(),this.pub(e,null),this.bi.delete(e));}}getSharedContextInstance(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:Wi(t),cdnUrlModifiers:Ao(t),fileName:qi(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?ri(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Ur){let t={};this.Ur=new Proxy(t,{set:a((e,r,s)=>{if(typeof r!="string"||!(r in lt))return false;let n=r,l=X(n);return this.has(l)||this.add(l,lt[n]),this.$[l]=s,true},"set"),get:a((e,r)=>{let s=X(r);return this.has(s)||this.add(s,lt[r]),this.$[s]},"get")});}return this.Ur}subConfigValue(t,e){let r=X(t);return this.has(r)||this.add(r,lt[t]),this.sub(r,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof t?.[0]=="function"){let r=t[0];e=r();}console.log(`[${this.ctxName}]`,...e);}};var si=class extends T{constructor(){super(...arguments);this.name="";this.Rr="";this.Ls=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.Ls=t,this.Us();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Us();}Us(){if(!this.name){this.Rr="";return}let t=`#uc-icon-${this.name}`,e=this.Ls?.(this.name);this.Rr=e??t;}render(){return y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Rr}></use></svg>`)} `}};h([x({type:String})],si.prototype,"name",2),h([g()],si.prototype,"Rr",2);var Sn=a(o=>[...new Set(o)],"uniqueArray");var me="--uc-img-",Io="unresolved";var Mo=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Lo=3e3,Uo=5e3,Ro=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var _c="https://ucarecdn.com",Le=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:_c},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var tr=class extends Ae(Se(mt)){constructor(){super();this.pe={};this.E=new Map;this.he=null;this.wi=null;for(let t in Le){let e=Le[t];this.pe[me+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.pe[me+t]}set$$(t){for(let e in t){let r=me+e,s=t[e];this.pe[r]=s,this.q(r,s);}}sub$$(t,e){let r=me+t;this.E.has(r)||this.E.set(r,new Set),this.E.get(r)?.add(e);let s=this.pe[r];s!==null&&s!==""&&e(s);}q(t,e){this.E.has(t)&&this.E.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${St}/${kt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Le[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.he=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.he?.unobserve(t));});},r),this.he.observe(t),this.wi||(this.wi=new Set),this.wi.add(t);}connectedCallback(){super.connectedCallback(),this.ac();}ac(){for(let t in Le){let e=me+t,r=this.getCssData(e,true);r!=null&&(this.pe[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.he&&(this.wi?.forEach(t=>{this.he?.unobserve(t);}),this.he=null),this.E.clear();}static get observedAttributes(){return Object.keys(Le)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=me+t;this.pe[s]=r,this.q(s,r);});}};var kn=a(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var rr=class extends tr{constructor(){super(...arguments);this.Ct=new Image;this.yt=new Image;}static{a(this,"ImgBase");}Rs(t){return !t.includes("//")&&!Mo&&(t=new URL(t,document.baseURI).href),t}xi(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>Uo&&this.Ps?Uo+s:Number(n)>Lo&&!this.Ps?Lo+s:t}cc(t,e){let r={format:this.Pr("format"),quality:this.Pr("quality"),resize:this.xi(t),blur:e,"cdn-operations":this.Pr("cdn-operations")??void 0,analytics:this.analyticsParams()};return tt(...kn(r))}Pr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}et(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(Mo&&r&&!r.includes("//"))return this.De(r);let s=this.cc(t,e),n=this.$$("cdn-cname"),l=n;if(r.startsWith(String(n)))return G(r,s);let c=this.$$("uuid");if(l&&c)return this.De(G(Yt(l,c),s));if(c)return this.De(G(Yt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.De(G(u,s,this.Rs(r)));let p=this.$$("pubkey");if(p)return this.De(G(`https://${p}.ucr.io/`,s,this.Rs(r)))}De(t){let e=this.$$("secure-delivery-proxy");return e?ri(e,{previewUrl:t},{transform:a(r=>window.encodeURIComponent(r),"transform")}):t}fe(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}uc(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.At||(this.$r({elNode:this.Ct}),this.appendChild(this.Ct)),this.Ct}get Ei(){return this.At?{type:Ro.PREVIEW,img:this.yt}:{type:Ro.MAIN,img:this.img}}get At(){return this.$$("is-preview-blur")}get $s(){return this.$$("is-background-for")}get Ds(){let t=this.$$("breakpoints");if(t){let e=q(t);return Sn(e.map(r=>parseInt(r,10)))}else return null}get Ps(){return this.$$("format").toLowerCase()==="jpeg"}Vs(t){let e=new Set;e.add(`url("${this.et(this.fe(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.et(this.fe(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.et(this.fe(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}Fs(){let t=new Set;return this.Ds?this.Ds.forEach(e=>{t.add(`${this.et(`${e}x`)} ${this.xi(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.et(`${e*2}x`)} ${this.xi(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.et(`${e*3}x`)} ${this.xi(`${e*3}w`)}`);}):(t.add(`${this.et(this.fe(this.Ei.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.et(this.fe(this.Ei.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.et(this.fe(this.Ei.img,3))} 3x`)),[...t].join()}_s(){return this.et()}get Ns(){return this.et("100x","100")}dc(){let t=this.$s;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Vs(e);}):this.Vs(e);});}pc({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}$r({elNode:t}){this.uc(t),this.initAttributes(t);}Dr({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.$r({elNode:r}),r.setAttribute(Io,""),r.addEventListener("load",()=>{r.removeAttribute(Io),s(r);}),r.addEventListener("error",()=>{n(false);}),this.pc({elNode:r,src:t,srcset:e});})}async hc(){if(this.$$("intersection")){this.At&&(this.$r({elNode:this.yt}),this.appendChild(this.yt)),this.initIntersection(this.Ei.img,async()=>{this.At&&(this.yt.src=this.Ns);try{await this.Dr({src:this._s(),srcset:this.Fs(),elNode:this.Ct}),this.At&&await this.yt.remove(),this.appendChild(this.Ct);}catch{this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}});return}try{this.At&&(await this.Dr({src:this.Ns,elNode:this.yt}),this.appendChild(this.yt)),await this.Dr({src:this._s(),srcset:this.Fs(),elNode:this.Ct}),this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}catch{this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}}init(){this.$s?this.dc():this.hc();}};var Po=class extends rr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Nc}=Vs;var In=a(o=>o.strings===void 0,"f"),On=a(()=>document.createComment(""),"r"),Ue=a((o,i,t)=>{let e=o.Tt.parentNode,r=i===void 0?o.ae:i.Tt;if(t===void 0){let s=e.insertBefore(On(),r),n=e.insertBefore(On(),r);t=new Nc(s,n,o,o.options);}else {let s=t.ae.nextSibling,n=t.c,l=n!==o;if(l){let c;t.fc?.(o),t.c=o,t.ci!==void 0&&(c=o.X)!==n.X&&t.ci(c);}if(s!==r||l){let c=t.Tt;for(;c!==s;){let u=c.nextSibling;e.insertBefore(c,r),c=u;}}}return t},"s"),te=a((o,i,t=o)=>(o.vt(i,t),o),"v"),zc={},Mn=a((o,i=zc)=>o.r=i,"m"),Ln=a(o=>o.r,"p"),or=a(o=>{o.le(),o.Tt.remove();},"M");var Ot={ATTRIBUTE:1,CHILD:2},ct=a(o=>(...i)=>({mr:o,values:i}),"e"),vt=class{static{a(this,"i");}constructor(i){}get X(){return this.c.X}vr(i,t,e){this.Ti=i,this.c=t,this.mc=e;}Bl(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var ni=a((o,i)=>{let t=o.mt;if(t===void 0)return false;for(let e of t)e.ds?.(i,false),ni(e,i);return true},"s"),sr=a(o=>{let i,t;do{if((i=o.c)===void 0)break;t=i.mt,t.delete(o),o=i;}while(t?.size===0)},"o"),Un=a(o=>{for(let i;i=o.c;o=i){let t=i.mt;if(t===void 0)i.mt=t=new Set;else if(t.has(o))break;t.add(o),jc(i);}},"r");function Bc(o){this.mt!==void 0?(sr(this),this.c=o,Un(this)):this.c=o;}a(Bc,"h");function Hc(o,i=false,t=0){let e=this.r,r=this.mt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)ni(e[s],false),sr(e[s]);else e!=null&&(ni(e,false),sr(e));else ni(this,o);}a(Hc,"n");var jc=a(o=>{o.type==Ot.CHILD&&(o.ci??=Hc,o.fc??=Bc);},"c"),nr=class extends vt{static{a(this,"f");}constructor(){super(...arguments),this.mt=void 0;}vr(i,t,e){super.vr(i,t,e),Un(this),this.isConnected=i.X;}ds(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(ni(this,i),sr(this));}setValue(i){if(In(this.Ti))this.Ti.vt(i,this);else {let t=[...this.Ti.r];t[this.mc]=i,this.Ti.vt(t,this,0);}}disconnected(){}reconnected(){}};var S=a(()=>new Do,"e"),Do=class{static{a(this,"h");}},$o=new WeakMap,M=ct(class extends nr{render(o){return R}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),R}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=$o.get(i);t===void 0&&(t=new WeakMap,$o.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?$o.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 Vo=null,Fo=class extends T{constructor(){super(...arguments);this.Wt=S();this.zs=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");};this.vc=()=>{this.zs();};this.gc=t=>{this.Vr=t.target;};this.yc=t=>{let e=t.target;e===this.Wt.value&&e===this.Vr&&this.zs();};this.Ve=({id:t})=>{t===this.id?(Vo=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.Fe=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Bs=t=>{this.hide(),Vo===this.id&&this.emit(I.MODAL_CLOSE,{modalId:Vo,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.Wt.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.Wt.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(K.OPEN,this.Ve),this.modalManager?.subscribe(K.CLOSE,this.Fe),this.modalManager?.subscribe(K.CLOSE_ALL,this.Bs);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Vr=void 0,this.modalManager?.unsubscribe(K.OPEN,this.Ve),this.modalManager?.unsubscribe(K.CLOSE,this.Fe),this.modalManager?.unsubscribe(K.CLOSE_ALL,this.Bs);}bc(t){this.Wt={value:t},this.Wt.value?.addEventListener("close",this.vc),this.Wt.value?.addEventListener("mousedown",this.gc),this.Wt.value?.addEventListener("mouseup",this.yc);}render(){return y`<dialog ${M(this.bc)}>${this.yield("")}</dialog>`}};var Rn=a(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),Pn=a((o,{threshold:i})=>{let{secureExpire:t}=o,e=Rn(Date.now()),r=Number(t),s=Rn(i);return e+s>=r},"isSecureTokenExpired");var ar=class{constructor(i){this.me=null;this.m=i;}static{a(this,"SecureUploadsManager");}v(...i){this.m.debugPrint("[secure-uploads]",...i);}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this.m.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this.me||Pn(this.me,{threshold:this.m.cfg.secureUploadsExpireThreshold})){this.me?this.v("Secure signature is expired. Resolving a new one..."):this.v("Secure signature is not set yet.");try{let r=await e();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this.v("Secure signature resolved:",r),this.v("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this.me=r):(this.v("Secure signature resolver returned nothing."),this.me=null);}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r),this.m.telemetryManager.sendEventError(r,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.me}return i&&t?(this.v("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};var _o=a((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var No=a((o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var Kc=a(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),Gc=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),qc=a(()=>({safariDesktop:Kc()}),"calcBrowserInfo"),Wc=a(()=>({htmlMediaCapture:Gc()}),"calcBrowserFeatures"),$n=qc(),ve=Wc();var ai="image/*",zo="video/*",Zc=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Xc=a(()=>$n.safariDesktop?[ai]:[ai,...Zc],"calcImageAcceptList"),li=Xc(),lr=a(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>q(i)):[],"mergeFileTypes"),Bo=a((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),Dn=a((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),Vn=a(o=>{let i=o?.type;return i?Bo(i,li):false},"fileIsImage");var Ho=a((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=lr([...t?li:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let l=Bo(s,r),c=Dn(n,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var jo=a((o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}},"validateIsImage");var It=1e3,ge=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),ci=a(o=>Math.ceil(o*100)/100,"round"),Fn=a((o,i=ge.AUTO)=>{let t=i===ge.AUTO;if(i===ge.BYTE||t&&o<It**1){let r=Yi("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===ge.KB||t&&o<It**2?`${ci(o/It**1)} KB`:i===ge.MB||t&&o<It**3?`${ci(o/It**2)} MB`:i===ge.GB||t&&o<It**4?`${ci(o/It**3)} GB`:i===ge.TB||t&&o<It**5?`${ci(o/It**4)} TB`:`${ci(o/It**5)} PB`},"prettyBytes");var Ko=a((o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Fn(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var Go=a((o,i)=>{let{internalId:t}=o,r=i.S.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof J)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ie)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}},"validateUploadError");var Re={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."},Qc=a(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),cr=class{constructor(i){this.wc=[jo,Ho,Ko,Go];this.xc=[No,_o];this.de=new Wt(20);this.Ec=$(()=>{this.i.isConnected&&this.de.run();},500);this.Ci=new Map;this.i=i,this.S=this.i.uploadCollection;let t=$(()=>{this.i.isConnected&&(this.runFileValidators("change"),this.runCollectionValidators());},0);this.i.subConfigValue("maxLocalFileSizeBytes",t),this.i.subConfigValue("multipleMin",t),this.i.subConfigValue("multipleMax",t),this.i.subConfigValue("multiple",t),this.i.subConfigValue("imgOnly",t),this.i.subConfigValue("accept",t),this.i.subConfigValue("validationConcurrency",e=>{this.de.concurrency=e;});}static{a(this,"ValidationManager");}runFileValidators(i,t){let e=t??this.S.items();for(let r of e){let s=this.S.read(r);s&&this.Tc(s,i);}}runCollectionValidators(){let i=this.i.api.getOutputCollectionState(),t=[];for(let e of [...this.xc,...this.i.cfg.collectionValidators])try{let r=e(i,this.i.api);if(!r)continue;r&&(t.push(this.Hs(r)),r.message||console.warn(Re.MISSING_ERROR_MESSAGE));}catch(r){console.warn(Re.COLLECTION_VALIDATION_FAILED,r);}this.i.$["*collectionErrors"]=t,t.length>0&&this.i.emit(I.COMMON_UPLOAD_FAILED,()=>this.i.api.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(i){let t=this.Ci.get(i.uid);t&&(t.abortController?.abort(),this.Ci.delete(i.uid));}async Tc(i,t){let e=this.js(i),r=e.promise??Promise.resolve(),s=(async()=>{if(await r,!this.i.isConnected)return;let n=this.Cc(i,t);if(n.length===0)return;i.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let l=this.i.api.getOutputItem(i.uid),c=new AbortController;e.abortController=c;let u=this.i.cfg.validationTimeout,p=this.Ks(),d=new Set(n.map(v=>v.validator)),f=[];for(let v of p)if(!d.has(v.validator)){let w=e.lastErrorThrownByValidator.get(v.validator);w&&f.push(w);}let m=n.map(v=>async()=>{if(!this.i.isConnected)return;let w=setTimeout(()=>{e.skippedValidators.add(v.validator),c.abort(),console.warn(Re.FILE_VALIDATION_TIMEOUT);},u);try{let E=await v.validator(l,this.i.api,{signal:c.signal});if(!E||c.signal.aborted){e.lastErrorThrownByValidator.set(v.validator,void 0);return}let C=this.Hs(E);e.lastErrorThrownByValidator.set(v.validator,C),f.push(C),E.message||console.warn(Re.MISSING_ERROR_MESSAGE);}catch(E){c.signal.aborted||(e.skippedValidators.add(v.validator),console.warn(Re.FILE_VALIDATION_FAILED,E),this.i.telemetryManager.sendEventError(E,`file validator. ${Re.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(w),v.runOn!=="change"&&e.skippedValidators.add(v.validator);}});if(this.Ec(),await this.de.add(async()=>{i.setValue("isQueuedForValidation",false),await Promise.all(m.map(v=>v())).catch(()=>{});},{autoRun:false}),c.signal.aborted){i.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}i.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:f});})();e.promise=s;try{await s;}finally{e.promise===s&&(e.promise=void 0);}}Hs(i){return {...i,type:i.type??"CUSTOM_ERROR"}}js(i){let t=this.Ci.get(i.uid);if(t)return t;let e={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Ci.set(i.uid,e),e}Ks(){return [...this.wc,...this.i.cfg.fileValidators].map(Qc)}Cc(i,t){let e=this.js(i);return this.Ks().filter(r=>!e.skippedValidators.has(r.validator)).filter(r=>r.runOn===t)}};var _n="[Typed State] Wrong property name: ",ur=class{static{a(this,"TypedData");}constructor(i){this.Rt=Vt.generate(),this.Y=z.registerCtx(i,this.Rt);}get uid(){return this.Rt}setValue(i,t){if(!this.Y.has(i)){console.warn(`${_n}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${_n}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}remove(){z.deleteCtx(this.Rt);}};var dr=class{constructor(i){this.Zt=Object.create(null);this.Ai=new Set;this.Si=new Set;this.Pt=new Set;this.Fr=new Set;this._r=new Set;this.Ws=i.initialValue,this.Rt=Vt.generate(),this.Y=z.registerCtx({},this.Rt),this.Gs=i.watchList||[];let t=Object.create(null);this.qs=(e,r)=>{this.Nr&&window.clearTimeout(this.Nr),t[e]||(t[e]=new Set),t[e].add(r),this.Nr=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Ai.forEach(s=>{s({...t});}),t=Object.create(null));});},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}q(){this.zr&&window.clearTimeout(this.zr),this.zr=window.setTimeout(()=>{let i=new Set(this._r),t=new Set(this.Fr);this._r.clear(),this.Fr.clear();for(let e of this.Si)e?.([...this.Pt],i,t);});}observeCollection(i){return this.Si.add(i),this.Pt.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Si.delete(i);}add(i){let t=new ur(this.Ws);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.Pt.add(t.uid),this.q(),this.Y.add(t.uid,t),this._r.add(t),this.Gs.forEach(e=>{this.Zt[t.uid]||(this.Zt[t.uid]=[]),this.Zt[t.uid]?.push(t.subscribe(e,()=>{this.qs(e,t.uid);}));}),t.uid}read(i){return this.Y.read(i)}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&this.Fr.add(t),this.Pt.delete(i),this.q(),this.Y.pub(i,void 0),delete this.Zt[i];}clearAll(){this.Pt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Ai.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Ai.delete(i);}findItems(i){let t=[];return this.Pt.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.Pt]}get size(){return this.Pt.size}destroy(){z.deleteCtx(this.Rt),this.Ai=new Set,this.Si=new Set;for(let i of Object.keys(this.Zt))this.Zt[i]?.forEach(t=>{t.remove();}),delete this.Zt[i];}};var k=Object.freeze({PHOTO:"photo",VIDEO:"video"}),gt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var qo=a(o=>({isVideoRecordingEnabled:at(o.cameraModes).includes(k.VIDEO),isPhotoEnabled:at(o.cameraModes).includes(k.PHOTO)}),"calcCameraModes");var Nn="active",Pe="___ACTIVITY_IS_ACTIVE___",zn,b=class o extends(zn=T,zn){constructor(){super(...arguments);this.historyTracked=false;this.init$=go(this);this.Ac=$(this.Sc.bind(this),10);}static{a(this,"LitActivityBlock");}Zs(){let t=o._e.get(this);this[Pe]=false,this.removeAttribute(Nn),t?.deactivateCallback?.();}kc(){let t=o._e.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Pe]=true,this.setAttribute(Nn,""),t?.activateCallback?.(),this.Ac(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Pe]?this.Zs():this.activityType===t&&!this[Pe]&&this.kc();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Sc(){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);}Oc(){return !!this.activityType&&o._e.has(this)}static{this._e=new Map;}get isActivityActive(){return !!this[Pe]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o._e.set(this,{activateCallback:r,deactivateCallback:s});}Ic(){this.isActivityActive&&this.Zs(),o._e.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Oc()&&this.Ic();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(r=>r instanceof o&&r.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});function pr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}a(pr,"applyStyles");var Yc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Jc=new RegExp(`^/?(${Yc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Bn=a(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(ii),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Jc.exec(r.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var Mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Wo=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),B=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Wo,...Mt});function Hn(o){let i=new Map;return a((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}a(Hn,"memoize");var jn=new Set;function hr(o){jn.has(o)||(jn.add(o),console.warn(o));}a(hr,"warnOnce");function tu(o){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...r)=>(i&&hr(o),e(...r))),"withAssert")}a(tu,"createAsyncAssertWrapper");function Kn(o){let i={},t={progress:a(()=>o.$["*commonProgress"],"progress"),errors:a(()=>o.$["*collectionErrors"],"errors"),group:a(()=>o.$["*groupInfo"],"group"),totalCount:a(()=>o.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(r=>r.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>o.getOutputData(),"allEntries"),successEntries:a(()=>i.allEntries.filter(r=>r.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(r=>r.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(r=>r.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(r=>r.status==="idle"),"idleEntries")},e=tu("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[r,s]of Object.entries(t)){let n=r,c=Hn(e(s));Object.defineProperty(i,n,{get:c,enumerable:true});}return i}a(Kn,"buildOutputCollectionState");var fr=class{constructor(i){this.addFileFromUrl=a((i,{silent:t,fileName:e,source:r}={})=>{let s=this.S.add({externalUrl:i,fileName:e??null,silent:t??false,source:r??B.API});return this.getOutputItem(s)},"addFileFromUrl");this.addFileFromUuid=a((i,{silent:t,fileName:e,source:r}={})=>{let s=this.S.add({uuid:i,fileName:e??null,silent:t??false,source:r??B.API});return this.getOutputItem(s)},"addFileFromUuid");this.addFileFromCdnUrl=a((i,{silent:t,fileName:e,source:r}={})=>{let s=Bn({url:i,cdnBase:this.cfg.cdnCname});if(!s)throw new Error("Invalid CDN URL");let n=this.S.add({uuid:s.uuid,cdnUrl:i,cdnUrlModifiers:s.cdnUrlModifiers,fileName:e??s.filename??null,silent:t??false,source:r??B.API});return this.getOutputItem(n)},"addFileFromCdnUrl");this.addFileFromObject=a((i,{silent:t,fileName:e,source:r,fullPath:s}={})=>{let n=this.S.add({file:i,isImage:Vn(i),mimeType:i.type,fileName:e??i.name,fileSize:i.size,silent:t??false,source:r??B.API,fullPath:s??null});return this.getOutputItem(n)},"addFileFromObject");this.removeFileByInternalId=a(i=>{if(!this.S.read(i))throw new Error(`File with internalId ${i} not found`);this.S.remove(i);},"removeFileByInternalId");this.uploadAll=a(()=>{let i=this.S.items().filter(t=>{let e=this.S.read(t);return e?!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")&&e.getValue("errors").length===0&&!e.getValue("isValidationPending")&&!e.getValue("isQueuedForValidation"):false});i.length!==0&&(this.e.$["*uploadTrigger"]=new Set(i),this.e.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((i={})=>{let t=Nt(lr([this.cfg.accept??"",...this.cfg.imgOnly?li:[]])),e="uploadcare-file-input",r=document.createElement("input");if(r.setAttribute(e,""),pr(r,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),r.type="file",r.multiple=this.cfg.multiple,i.captureCamera){r.capture=this.cfg.cameraCapture;let{isPhotoEnabled:s,isVideoRecordingEnabled:n}=qo(this.cfg);i.modeCamera===k.PHOTO&&s?r.accept=ai:i.modeCamera===k.VIDEO&&n?r.accept=zo:r.accept=[ai,n&&zo].filter(Boolean).join(",");}else r.accept=t;r.addEventListener("change",()=>{r.files&&([...r.files].forEach(s=>{this.addFileFromObject(s,{source:i.captureCamera?B.CAMERA:B.LOCAL});}),this.e.modalManager?.open(b.activities.UPLOAD_LIST),this.e.$["*currentActivity"]=b.activities.UPLOAD_LIST,r.remove());},{once:true}),document.querySelectorAll(`[${e}]`).forEach(s=>{s.remove();}),document.body.appendChild(r),r.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((i=false)=>{if(this.S.size>0&&!i)this.e.modalManager?.open(b.activities.UPLOAD_LIST),this.e.pub("*currentActivity",b.activities.UPLOAD_LIST);else if(this.Xs?.length===1){let t=this.Xs[0];if(t==="local"){this.e.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.openSystemDialog();return}if(t==="camera"&&ve.htmlMediaCapture){let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=qo(this.cfg);if(n&&l){this.e.pub("*currentActivity",b.activities.START_FROM);return}else if(n||l){this.openSystemDialog({captureCamera:true,modeCamera:n?k.PHOTO:k.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:k.PHOTO});}let e=this.e.blocksRegistry,r=a(n=>"type"in n&&n.type===t,"isSourceBtn");[...e].find(r)?.activate(),this.e.$["*currentActivity"]&&this.e.modalManager?.open(this.e.$["*currentActivity"]);}else this.e.modalManager?.open(b.activities.START_FROM),this.e.pub("*currentActivity",b.activities.START_FROM);},"initFlow");this.doneFlow=a(()=>{this.e.set$({"*currentActivity":this.e.doneActivity,"*history":this.e.doneActivity?[this.e.doneActivity]:[]}),this.e.$["*currentActivity"]||this.e.modalManager?.closeAll();},"doneFlow");this.setCurrentActivity=a((i,...t)=>{if(this.e.hasBlockInCtx(e=>e.activityType===i)){this.e.set$({"*currentActivityParams":t[0]??{},"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`);},"setCurrentActivity");this.getCurrentActivity=a(()=>this.e.$["*currentActivity"],"getCurrentActivity");this.setModalState=a(i=>{if(i&&!this.e.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}i?this.e.modalManager?.open(this.e.$["*currentActivity"]):(this.e.modalManager?.close(this.e.$["*currentActivity"]),this.e.$["*currentActivity"]=null);},"setModalState");this.e=i;}static{a(this,"UploaderPublicApi");}get S(){return this.e.uploadCollection}get cfg(){return this.e.cfg}get l10n(){return this.e.l10n.bind(this.e)}removeAllFiles(){this.S.clearAll();}getOutputItem(i){let t=z.getCtx(i);if(!t)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${i}" not found in the upload collection`);let e=t.store,r=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return {uuid:r?.uuid??e.uuid??null,internalId:i,name:r?.originalFilename??e.fileName,size:r?.size??e.fileSize,isImage:r?.isImage??e.isImage,mimeType:r?.mimeType??e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:e.cdnUrl??r?.cdnUrl??null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:r??null,metadata:e.metadata??r?.metadata??null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",isValidationPending:e.isValidationPending,errors:e.errors,status:s,source:e?.source}}getOutputCollectionState(){return Kn(this.e)}get Xs(){let i=[];return this.cfg.sourceList&&(i=q(this.cfg.sourceList)),i}};var Gn={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var ui=33.333333333333336,O=1,Zo=24,qn=6;function ee(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}a(ee,"setSvgNodeAttrs");function ut(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ee(t,i),t}a(ut,"createSvgNode");function Wn(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+l*s+1.5*u,r+c*n+1.5*p],m=[e+l*s-24*t*u+1.5*u,r+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,w=[f[0],f[1]];return {d:v,center:w}}a(Wn,"cornerPath");function Zn(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,f=i==="n"?-1:i==="s"?1:0,m,v;l?(m=[e+u*s-34*t/2,r+p*n+1.5*f],v=[e+u*s+34*t/2,r+p*n+1.5*f]):(m=[e+u*s+1.5*d,r+p*n-34*t/2],v=[e+u*s+1.5*d,r+p*n+34*t/2]);let w=`M ${m[0]} ${m[1]} L ${v[0]} ${v[1]}`,E=[(m[0]+v[0])/2,(m[1]+v[1])/2];return {d:w,center:E}}a(Zn,"sidePath");function Xn(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}a(Xn,"thumbCursor");function Qn({rect:o,delta:[i,t],imageBox:e}){return De({...o,x:o.x+i,y:o.y+t},e)}a(Qn,"moveRect");function De(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}a(De,"constraintRect");function eu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;s+=r,l-=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(n=l*t,c=o.x+o.width/2-n/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y+o.height-l),l<O&&(l=O,t&&(n=l*t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),n<O&&(n=O,t&&(l=n/t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),{x:c,y:s,width:n,height:l}}a(eu,"resizeNorth");function iu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;s+=r,n-=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(l=n/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x+o.width-n),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),{x:s,y:c,width:n,height:l}}a(iu,"resizeWest");function ru({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;l+=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=o.x+o.width/2-n/2),c<=e.x&&(c=e.x,s=o.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y),l<O&&(l=O,t&&(n=l*t),c=o.x+o.width/2-n/2),n<O&&(n=O,t&&(l=n/t),c=o.x+o.width/2-n/2),{x:c,y:s,width:n,height:l}}a(ru,"resizeSouth");function ou({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;n+=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:n,height:l}}a(ou,"resizeEast");function su({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+s<e.y&&(s=e.y-l),n+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c,l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c,l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(su,"resizeNorthWest");function nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x,l=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(nu,"resizeNorthEast");function au({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c),{x:n,y:l,width:c,height:u}}a(au,"resizeSouthWest");function lu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y)),u<O&&(u=O,t&&(c=u*t)),c<O&&(c=O,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(lu,"resizeSouthEast");function Yn({direction:o,...i}){switch(o){case "n":return eu(i);case "w":return iu(i);case "s":return ru(i);case "e":return ou(i);case "nw":return su(i);case "ne":return nu(i);case "sw":return au(i);case "se":return lu(i);default:return i.rect}}a(Yn,"resizeRect");function Jn(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}a(Jn,"rectContainsPoint");function ta(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}a(ta,"isRectInsideRect");function ea(o,i){return Math.abs(o.width/o.height-i)<.1}a(ea,"isRectMatchesAspectRatio");function Ve({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}a(Ve,"rotateSize");function ia(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),l=Math.round((i-s)/2);return n+r>o&&(r=o-n),l+s>i&&(s=i-l),{x:n,y:l,width:r,height:s}}a(ia,"calculateMaxCenteredCropFrame");function Fe(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}a(Fe,"roundRect");function ie(o,i,t){return Math.min(Math.max(o,i),t)}a(ie,"clamp");var di=["free"],vr=a(o=>{let i=q(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!di.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!di.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:Vt.generate(),type:"aspect-ratio",width:di.includes(r)?0:n,height:di.includes(r)?0:l,hasFreeform:di.includes(r)});}return t},"parseCropPreset"),ra=a((o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function oa(o){return co({...o,libraryName:St,libraryVersion:kt})}a(oa,"customUserAgent");var P=class o extends b{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.ki=false;this.init$=yo(this);this.jr=$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Pc(e);},300);this.Uc=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Js(),this.jr();}};this.Rc=t=>{if(!this.isConnected)return;this.jr();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!z.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Js();}if(t.isUploading)for(let s of t.isUploading){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=z.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.$c(),this.cfg.cloudImageEditorAutoOpen&&this.Dc();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=z.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Js=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get Mc(){return this.hasBlockInCtx(t=>t instanceof o?t.ki&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.addSharedContextInstance("*uploadCollection",()=>new dr({initialValue:Gn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]}),{persist:true}),this.addSharedContextInstance("*secureUploadsManager",()=>new ar(this)),this.addSharedContextInstance("*validationManager",()=>new cr(this)),this.addSharedContextInstance("*publicApi",()=>new fr(this)),!this.Mc&&this.couldBeCtxOwner&&this.Lc();}get validationManager(){return this.getSharedContextInstance("*validationManager")}get api(){return this.getSharedContextInstance("*publicApi")}getAPI(){return this.api}get uploadCollection(){return this.getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this.getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.ki&&this.Ys(),this.jr.cancel();}connectedCallback(){super.connectedCallback(),this.ki&&this.Qs();}Lc(){this.ki=true,this.Qs(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Qs(){this.Ys(),this.Br=this.uploadCollection.observeCollection(this.Uc),this.Hr=this.uploadCollection.observeProperties(this.Rc);}Ys(){this.Hr?.(),this.Br?.(),this.Hr=void 0,this.Br=void 0;}async Pc(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await on(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Dc(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager?.open(b.activities.CLOUD_IMG_EDIT));}$c(){let t=vr(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ia(l,c,u),d=tt(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:G(f,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager?.open(b.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:oa,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};P.extSrcList=Object.freeze({...Mt});P.sourceTypes=Object.freeze({...B});var Xo=class extends P{constructor(){super(...arguments);this.z=null;this.Oi=null;}static{a(this,"FormInput");}tn(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,pr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.tn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.Oi){let n=document.createElement("div");this.appendChild(n),this.Oi=n;}if(!this.z){let n=this.tn();this.appendChild(n),this.z=n;}if(this.Oi.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let l=document.createElement("input");l.type="hidden",l.name=`${this.ctxName}[]`,l.value=n,s.appendChild(l);}this.Oi.replaceChildren(s);},false);}};var Qo=class extends T{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var pi=class extends T{constructor(){super(...arguments);this.value=0;this.visible=true;this.ot=0;this.Ii=S();this.en=()=>{let t=this.Ii.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.ot>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.ot=this.Kr(this.value),this.Gr(),this.Ii.value?.addEventListener("animationiteration",this.en);}updated(t){if(super.updated(t),t.has("value")){let e=this.Kr(this.value);if(!this.visible)this.ot=e;else {let r=Math.max(this.ot,e);r!==this.ot&&(this.ot=r,this.Gr());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Gr():this.ot=this.Kr(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Ii.value?.removeEventListener("animationiteration",this.en);}Kr(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Gr(){this.visible&&this.style.setProperty("--l-progress-value",this.ot.toString());}render(){return y`<div ${M(this.Ii)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([x({type:Number})],pi.prototype,"value",2),h([x({type:Boolean,reflect:true})],pi.prototype,"visible",2);var hi=class extends P{constructor(){super();this.bt=false;this.ve=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.qr=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.bt=t;}),this.sub("*commonProgress",t=>{this.ve=t;});}updated(t){super.updated(t),t.has("visible")&&(this.bt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.qr?.(),this.qr=void 0;}render(){return y`<uc-progress-bar .value=${this.ve} .visible=${this.bt}></uc-progress-bar>`}};h([g()],hi.prototype,"bt",2),h([g()],hi.prototype,"ve",2);var _e=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Vc=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Vc} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([x({type:String,attribute:false})],_e.prototype,"value",2),h([x({type:Boolean,reflect:true})],_e.prototype,"disabled",2),h([x({type:Array,attribute:false})],_e.prototype,"options",2);var cu="src-type-",Ne=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Wr={};this.Zr="default";this.Xr="";}static{a(this,"SourceBtn");}Fc(){this.ge({type:B.LOCAL,activate:a(()=>(this.api.openSystemDialog(),false),"activate")}),this.ge({type:B.URL,activity:b.activities.URL,textKey:"from-url"}),this.ge({type:B.CAMERA,activity:b.activities.CAMERA,activate:a(()=>{let t=ve.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t},"activate")}),this.ge({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(Wo))this.ge({type:t,activity:b.activities.CAMERA,activate:a(()=>{let e=ve.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?k.PHOTO:k.VIDEO}),!e},"activate")});for(let t of Object.values(Mt))this.ge({type:t,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.Fc(),this.type&&this.rn(this.type);}ge(t){this.Wr[t.type]=t;}activate(){if(!this.type)return;let t=this.Wr[this.type];if(!t)return;let{activity:e,activate:r,activityParams:s={}}=t;(r?r():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}rn(t){let e=this.Wr[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:r=t,icon:s=t}=e;this.Xr=`${cu}${r}`,this.Zr=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.rn(this.type):(this.Xr="",this.Zr="default"));}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.Zr}></uc-icon><div class="uc-txt">${this.l10n(this.Xr)}</div></button>`}};h([x({type:String})],Ne.prototype,"type",2),h([g()],Ne.prototype,"Zr",2),h([g()],Ne.prototype,"Xr",2);var gr=class extends T{constructor(){super(...arguments);this.sn=[];this.W=[];this.an=[];}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.sn=q(t),this.nn();}),this.subConfigValue("cameraModes",t=>{this.W=at(t),this.nn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}nn(){let t=[];for(let e of this.sn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&ve.htmlMediaCapture){let r=this.W.length?this.W.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...r);continue}t.push(e);}this.an=t;}render(){return y`${this.an.map(t=>y`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};h([g()],gr.prototype,"an",2);var Yo=class extends T{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Ut="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ye(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=Ut);},"cancel")}}a(ye,"preloadImage");function fi(o){let i=[];for(let s of o){let n=ye(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(fi,"batchPreloadImages");function Jo(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}a(Jo,"generateThumb");var ze=class extends P{constructor(){super(...arguments);this.Mi=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let l=r.subscribe(s,c=>{this.isConnected&&n(c);});this.Mi.add(l);})(t,e);}reset(){for(let t of this.Mi)t.remove();this.Mi=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Mi=new Set;}};function uu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(uu,"createSvgBlobUrl");function yr(o="hsl(209, 21%, 65%)",i=32,t=32){return uu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(yr,"fileCssBg");var du=3e3,Be=class extends ze{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.$t="";this.ln=false;this.Li=null;this.cn=false;this._c=this.cfg.filesViewMode;this.un=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.Nc(e);if(r&&s&&n){let p=await this.proxyUrl(G(Yt(this.cfg.cdnCname,n),tt(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=ye(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let m=await Jo(f,c);t.setValue("thumbUrl",m);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",yr(m));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await Jo(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",yr(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",yr(p));}});this.Ui=$(this.un.bind(this),100);}static{a(this,"Thumb");}Nc(t=false){t&&(this.Li=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Li?.height||0),10),parseInt(String(this?.Li?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,du)}zc(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n.src="",e?.removeEventListener("abort",c);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),r();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}Qr(){this.Yr?.cancel(),this.Yr=void 0;}Bc(t){if(this.Qr(),!t){this.$t&&(this.$t="");return}if(t===this.$t)return;let e=new AbortController,r={controller:e,cancel:a(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Yr=r,this.zc(t,e.signal).catch(()=>{}).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.$t=t);}));});}Ri(t=false){if(this.entry){if(t){this.un(true);return}this.cn&&this.Ui();}}firstUpdated(t){super.firstUpdated(t),this.dn();}updated(t){super.updated(t),t.has("uid")&&this.dn();}Ne(t){let[e]=t;e&&(this.cn=e.isIntersecting,e.isIntersecting&&(this.Li=e.boundingClientRect,this.Ri(),this.s?.disconnect()),e.intersectionRatio===0&&this.Ui.cancel());}reset(){super.reset(),this.Ui.cancel(),this.Qr(),this.$t&&(this.$t="");}dn(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=a(()=>{this.Ri();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Bc(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.Ri(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ln&&(this._c==="list"&&this.Ri(true),this.ln=true);}),this.setAttribute("role","img");}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.Ne.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Ui.cancel(),this.Qr(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.$t||Ut} alt="" ?hidden=${!this.$t} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([x({type:String})],Be.prototype,"badgeIcon",2),h([x({type:String})],Be.prototype,"uid",2),h([g()],Be.prototype,"$t",2);var ts=class extends b{static{a(this,"ActivityHeader");}};var es=class extends b{constructor(){super(...arguments);this.historyTracked=true;this.activityType=b.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var is=class extends P{constructor(){super(...arguments);this.pn=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.pn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.pn?.();}};var He=a((o,i)=>{let t=false,e,r=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var sa=a((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),na=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let l of o)r[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Ln(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,f=r.length-1,m=0,v=s.length-1;for(;d<=f&&m<=v;)if(r[d]===null)d++;else if(r[f]===null)f--;else if(l[d]===n[m])c[m]=te(r[d],s[m]),d++,m++;else if(l[f]===n[v])c[v]=te(r[f],s[v]),f--,v--;else if(l[d]===n[v])c[v]=te(r[d],s[v]),Ue(o,c[v+1],r[d]),d++,v--;else if(l[f]===n[m])c[m]=te(r[f],s[m]),Ue(o,r[d],r[f]),f--,m++;else if(u===void 0&&(u=sa(n,m,v),p=sa(l,d,f)),u.has(l[d]))if(u.has(l[f])){let w=p.get(n[m]),E=w!==void 0?r[w]:null;if(E===null){let C=Ue(o,r[d]);te(C,s[m]),c[m]=C;}else c[m]=te(E,s[m]),Ue(o,r[d],E),r[w]=null;m++;}else or(r[f]),f--;else or(r[d]),d++;for(;m<=v;){let w=Ue(o,c[v+1]);te(w,s[m]),c[m++]=w;}for(;d<=f;){let w=r[d++];w!==null&&or(w);}return this.ut=n,Mn(o,c),Y}});var Et=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=b.activities.UPLOAD_LIST;this.hn=false;this.mn=false;this.vn=false;this.Jr=false;this.to=false;this.Pi=null;this.gn=false;this.eo=null;this.yn=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.io=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.St();};this.ro=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.kt=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.St=He(()=>{this.isConnected&&(this.Kc(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get Hc(){return this.eo?this.jc(this.eo):""}Kc(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(m=>m.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c)u=true;else {p=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&m;}this.hn=p,this.mn=d,this.vn=u,this.to=e.total===0||!s&&!n,this.Jr=!n||this.cfg.multiple,this.gn=e.total>0,this.eo=e;}jc(t){let e=a(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.St),this.subConfigValue("multipleMin",this.St),this.subConfigValue("multipleMax",this.St),this.sub("*groupInfo",t=>{t&&this.St();}),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.St),this.uploadCollection.observeCollection(this.St),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Pi=null;return}this.Pi=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.St),this.uploadCollection.unobserveCollection(this.St));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Hc}</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.gn}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${na(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.yn} ?disabled=${!this.to} ?hidden=${!this.Jr} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Pi} >${this.Pi??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.kt}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Jr} ?disabled=${!this.to} @click=${this.yn} ><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.vn} @click=${this.io} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.hn} ?disabled=${!this.mn} @click=${this.ro} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Et.prototype,"hn",2),h([g()],Et.prototype,"mn",2),h([g()],Et.prototype,"vn",2),h([g()],Et.prototype,"Jr",2),h([g()],Et.prototype,"to",2),h([g()],Et.prototype,"Pi",2),h([g()],Et.prototype,"gn",2),h([g()],Et.prototype,"eo",2);var br=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.URL;this.oo={importDisabled:true};this.Dt=S();this.so=t=>{let e=t.target?.value??"";this.oo={importDisabled:!e};};this.io=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.Dt.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:B.URL}),this.modalManager?.open(b.activities.UPLOAD_LIST),this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};}static{a(this,"UrlSource");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:a(()=>{let t=this.Dt.value;t&&(t.value="",t.focus()),this.oo={importDisabled:true};},"onActivate")});}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.io}><label><input ${M(this.Dt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.so} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.oo.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],br.prototype,"oo",2);var aa=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var la="important",pu=" !"+la,be=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce(((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`}),"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(pu);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?la:""):t[e]=r;}}return Y}});var hu={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},fu=["camera","microphone"];function wr(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}a(wr,"formatTime");var ca="image/jpeg",ua="video/webm",_=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.CAMERA;this.$i=null;this.ao=false;this.ze=[];this.wt=null;this.xt=null;this.Di=null;this.Vi=null;this.g=null;this.Be={};this.Et=null;this.e=null;this.ye=[];this.be=[];this.Gc={};this.Fi=[];this._i=null;this.bn=()=>{this.wn(),this.He="pause";};this.xn=()=>{this.He="play",this.qc();};this.je=S();this.Xt=S();this.K=S();this.En=S();this.Tn=0;this.Cn=0;this.An=null;this.Ni=true;this.zi=true;this.Wc=aa();this.Sn=[];this.Yt=true;this.lo="";this.we=true;this.Qt=true;this.xe=true;this.kn=[];this.Jt=true;this.co=true;this.te=true;this.Ot=true;this.ee=true;this.Ee="camera-full";this.He="play";this.On="microphone";this.Bi="uc-shot-btn uc-camera-action";this.Zc=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===k.PHOTO&&this.Xc(),this.g===k.VIDEO){if(this.wt?.state==="recording"){this.In();return}this.Yc();}};this.Qc=t=>{let e=t.target;e&&(this.Vi=e.value,this.Te());};this.Jc=t=>{let e=t.target;e&&(this.Di=e.value,this.Te());};this.tu=()=>{this.Te();};this.eu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.Zc();};this.iu=()=>{this.ru();};this.ou=()=>{this.su();};this.nu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.au();};this.lu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.cu();};this.Mn=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Ln(r);};this.Un=()=>{let t=Math.floor((performance.now()-this.Tn+this.Cn)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.je.value;s&&(s.textContent=wr(e)),this.In();return}let r=this.je.value;r&&(r.textContent=wr(e));}else {let e=this.je.value;e&&(e.textContent=wr(t));}this.Ce=requestAnimationFrame(this.Un);};this.uu=()=>{this.Tn=performance.now(),this.Cn=0,this.Un();};this.Rn=()=>{this.Ce&&cancelAnimationFrame(this.Ce);};this.wn=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Xt.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.je.value;n&&(n.textContent=wr(e)),this.Ce=requestAnimationFrame(this.wn);};this.qc=()=>{this.Ce&&cancelAnimationFrame(this.Ce);};this.Ce=null;this.Yc=()=>{try{this.ze=[],this.Be={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Be.mimeType=t:MediaRecorder.isTypeSupported(ua)?this.Be.mimeType=ua:this.Be.mimeType="video/mp4",this.xt&&(this.wt=new MediaRecorder(this.xt,this.Be),this.wt.start(),this.wt.addEventListener("dataavailable",e=>{this.ze.push(e.data);}),this.uu(),this.classList.add("uc-recording"),this.Ke(gt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.In=()=>{this.wt?.addEventListener("stop",()=>{this.du(),this.Rn(),this.Ke(gt.STOP);}),this.wt?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.ru=()=>{if(this.wt?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.su=()=>{this.xt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.On=t.enabled?"microphone":"microphone-mute",this.co=!t.enabled;});};this.du=()=>{try{let t=new Blob(this.ze,{type:this.wt?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Ge(null),r.src=e,this.pu(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.au=()=>{if(this.Ke(gt.RETAKE),this.g===k.VIDEO){this.Ge(this.xt);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.cu=()=>{if(this.Ke(gt.ACCEPT),this.g===k.PHOTO){this.Et?.toBlob(s=>{if(!s)return;let n=this.Pn("camera","jpeg",ca,s);this.$n(n);},ca);return}let t=new Blob(this.ze,{type:this.wt?.mimeType}),e=this.hu(this.wt?.mimeType),r=this.Pn("video",e,`video/${e}`,t);this.$n(r),this.ze=[];};this.fu=t=>{t===gt.SHOT&&(this.ee=true,this.Qt=true,this.Ot=true,this.xe=false,this.Yt=true),(t===gt.RETAKE||t===gt.ACCEPT)&&(this.ee=!this.W.includes(k.VIDEO),this.Ot=!this.W.includes(k.PHOTO),this.Qt=false,this.xe=true,this.Yt=this.ye.length<=1);};this.mu=t=>{t===gt.PLAY&&(this.we=false,this.Ot=true,this.Yt=true,this.Jt=true,this.He="pause",this.Ee="square",this.Bi="uc-shot-btn uc-camera-action uc-stop-record"),t===gt.STOP&&(this.we=false,this.Qt=true,this.te=true,this.xe=false),(t===gt.RETAKE||t===gt.ACCEPT)&&(this.we=true,this.ee=!this.W.includes(k.VIDEO),this.Ot=!this.W.includes(k.PHOTO),this.Qt=false,this.xe=true,this.te=!this.cfg.enableAudioRecording,this.Ee="video-camera-full",this.Bi="uc-shot-btn uc-camera-action",this.Jt=!this.cfg.enableAudioRecording||this.be.length<=1,this.Yt=this.ye.length<=1);};this.Ke=t=>{this.g===k.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.fu(t),this.g===k.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.mu(t);};this.Ln=t=>{this.En.value?.querySelectorAll("button").forEach(r=>{r.classList.toggle("uc-active",r.getAttribute("data-id")===t);}),t===k.PHOTO&&(this.Ee="camera-full",this.Jt=true,this.te=true),t===k.VIDEO&&(this.He="play",this.Ee="video-camera-full",this.Jt=!this.cfg.enableAudioRecording||this.be.length<=1,this.te=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.Pn=(t,e,r,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:r})};this.$n=t=>{this.api.addFileFromObject(t,{source:B.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.modalManager?.open(b.activities.UPLOAD_LIST);};this.qe=$(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===k.VIDEO&&this.cfg.enableAudioRecording,r=this.g===k.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Ni=false,this.Qt=false,this.Ot=!this.W.includes(k.PHOTO),this.ee=!this.W.includes(k.VIDEO),this.zi=true,this.we=true,this.Ee=r,this.te=!e,this.Jt=!e):t==="prompt"?(this.lo="camera-permissions-prompt",this.Ni=true,this.Qt=true,this.Ot=true,this.zi=false,this.ho()):(this.lo="camera-permissions-denied",this.Ni=true,this.zi=false,this.Ot=!this.W.includes(k.PHOTO),this.ee=!this.W.includes(k.VIDEO),this.xe=true,this.Bi="uc-shot-btn uc-camera-action",this.ho());},300);this.vu=()=>{if(!this.xt)return false;let t=this.xt?.getAudioTracks(),e=this.xt?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.ho=()=>{this.ao&&(this.K.value&&(this.K.value.volume=0),this._i?.getTracks?.()?.[0]?.stop(),this.uo(this.K.value),this.Ge(null),this.vu(),this.Rn(),this.ao=false);};this.Te=async()=>{let t={video:{...hu},audio:this.cfg.enableAudioRecording?{}:false};this.Vi&&(t.video={deviceId:{exact:this.Vi}}),this.Di&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Di}}),this.K.value&&(this.K.value.volume=0);try{this.qe("prompt"),this.xt=await navigator.mediaDevices.getUserMedia(t),this.xt.addEventListener("inactive",()=>{this.qe("denied");}),this.Ge(this.xt),this.ao=!0,this.qe("granted");}catch(e){this.qe("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Dn=()=>{this.Te();};this.gu=async()=>{try{this.Hi();for(let t of fu){let e=await navigator.permissions.query({name:t});this.Gc[t]=e,e.addEventListener("change",this.Dn),this.Fi.push(()=>{e.removeEventListener("change",this.Dn);});}this.$i=()=>{this.Hi();};}catch(t){this.Hi(),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.Te();}};this.yu=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.fo(),navigator.mediaDevices.addEventListener("devicechange",this.fo);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.fo=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.ye=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.be=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Sn=this.ye,this.Yt=this.ye.length<=1,this.Vi=this.ye[0]?.value??null,this.kn=this.be,this.Jt=!this.cfg.enableAudioRecording||this.be.length<=1,this.Di=this.be[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.bu=async()=>{await this.gu(),await this.yu(),await this.Te(),this.Vn(this.W);};this.wu=async()=>{this.$i&&this.$i(),window.chrome||this.qe("denied"),this.ho();};this.Vn=t=>{this.ee=!t.includes(k.VIDEO),this.Ot=!t.includes(k.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.Ln(e);};}static{a(this,"CameraSource");}pu(t){this.uo(t),t.addEventListener("play",this.bn),t.addEventListener("pause",this.xn);}uo(t){t?.removeEventListener("play",this.bn),t?.removeEventListener("pause",this.xn);}Ge(t){this._i!==t&&(this._i=t,this.po());}po(){let t=this.K.value;if(!t)return;let e=this._i??null;t.srcObject!==e&&(t.srcObject=e);}Xc(){if(this.Ke("shot"),this.Et=document.createElement("canvas"),this.e=this.Et.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.Et.height=t.videoHeight,this.Et.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.Et.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}hu(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get W(){return q(this.cfg.cameraModes).filter(t=>t===k.PHOTO||t===k.VIDEO)}Hi(){if(this.Fi.length!==0){for(let t of this.Fi)t();this.Fi=[],this.$i=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.bu,onDeactivate:this.wu}),this.subConfigValue("cameraMirror",t=>{this.An=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.te=!t,this.co=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=at(t);this.Vn(e.filter(r=>r===k.PHOTO||r===k.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.po();}updated(t){super.updated(t),this.po();}xu(){this.Hi(),navigator.mediaDevices?.removeEventListener("devicechange",this.fo),this.uo(this.K.value),this.Ge(null);}disconnectedCallback(){super.disconnectedCallback(),this.xu();}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.Yt}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Sn} ?hidden=${this.Yt} @change=${this.Qc} ></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=${be({transform:this.An})} ?hidden=${this.Ni} ${M(this.K)} ></video><div class="uc-message-box" ?hidden=${this.zi}><span>${this.l10n(this.lo)}</span><button type="button" @click=${this.tu} ?hidden=${this.Wc} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${M(this.En)} class="uc-switcher" ?hidden=${!this.we}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.Mn} ?hidden=${this.Ot} ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.Mn} ?hidden=${this.ee} ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.iu} ?hidden=${this.we} ><uc-icon name=${this.He}></uc-icon><span ${M(this.je)}> 00:00 </span><span ${M(this.Xt)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.xe} ><button type="button" class="uc-secondary-btn" @click=${this.nu}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.lu} data-testid="accept" > Accept </button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" @click=${this.eu} class=${this.Bi} ?hidden=${this.Qt} ><uc-icon name=${this.Ee}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ou} ?hidden=${this.te} ><uc-icon name=${this.On}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.kn} ?hidden=${this.Jt} ?disabled=${this.co} @change=${this.Jc} ></uc-select></div></div>`}};h([g()],_.prototype,"An",2),h([g()],_.prototype,"Ni",2),h([g()],_.prototype,"zi",2),h([g()],_.prototype,"Wc",2),h([g()],_.prototype,"Sn",2),h([g()],_.prototype,"Yt",2),h([g()],_.prototype,"lo",2),h([g()],_.prototype,"we",2),h([g()],_.prototype,"Qt",2),h([g()],_.prototype,"xe",2),h([g()],_.prototype,"kn",2),h([g()],_.prototype,"Jt",2),h([g()],_.prototype,"co",2),h([g()],_.prototype,"te",2),h([g()],_.prototype,"Ot",2),h([g()],_.prototype,"ee",2),h([g()],_.prototype,"Ee",2),h([g()],_.prototype,"He",2),h([g()],_.prototype,"On",2),h([g()],_.prototype,"Bi",2);var we=class extends vt{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==Ot.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.Fn=void 0,this.it=i;if(i===Y)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Fn;this.it=i;let t=[i];return t.raw=t,this.Fn={Bt:this.constructor.resultType,strings:t,values:[]}}};we.directiveName="unsafeHTML",we.resultType=1;ct(we);var mi=class extends we{static{a(this,"t");}};mi.directiveName="unsafeSVG",mi.resultType=2;var xr=ct(mi);function rs(o,i,t){return o?i(o):t?.(o)}a(rs,"n");function da(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(da,"normalize");function dt(...o){let i=da(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(dt,"classNames");function pa(o,...i){let t=da(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}a(pa,"applyClassNames");var mu=a(o=>et.includes(o),"isTabIdValue"),ha=a(o=>{if(!o)return et;let i=at(o).filter(mu);return i.length===0?et:i},"parseTabs");function fa(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":et,"*tabId":F.CROP,"*on.retryNetwork":a(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ut,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=tt(Jt(i),"preview"),r=G(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.apply"),"*on.cancel":a(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(fa,"initState");var ma="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var va=Nt([...et]),it=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.Eu="";this.ie=Ut;this.Tu="";this.We=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=va;this._n=false;this.Lt=false;this.mo=null;this.ji=$(t=>{this.We=t;},300);this.Ki=S();this.Nn=S();this.zn=S();this.Bn=S();this.Hn=()=>{this.ji(false),this.ie!==Ut&&(this.$["*networkProblems"]=false);};this.jn=()=>{this.ji(false),this.$["*networkProblems"]=true;};this.Cu=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...fa(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Au(){this.Lt||this.mo||(this.mo=this.updateComplete.then(()=>{this.mo=null,this.Lt=true;}));}initCallback(){super.initCallback(),this.Kn(),this.Gn();}Gi(){let t=this.zn.value;t&&(this.$["*faderEl"]=t);let e=this.Nn.value;e&&(this.$["*cropperEl"]=e);let r=this.Bn.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Ki.value;s&&(this.$["*imgEl"]=s);}Su(){let t=this.Ki.value;t&&(t.addEventListener("load",this.Hn),t.addEventListener("error",this.jn));}ku(){let t=this.Ki.value;t&&(t.removeEventListener("load",this.Hn),t.removeEventListener("error",this.jn));}get Ou(){let t=this.$["*tabId"];return dt("uc-image",{"uc-image_hidden_to_cropper":t===F.CROP,"uc-image_hidden_effects":t!==F.CROP})}qn(){return new Promise((e,r)=>{let s=window.setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(l=>{let[c]=l;c&&c.contentRect.width>0&&c.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.Gi(),this.Su(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.ku(),super.disconnectedCallback();}render(){let t=this.Tu??"",e=this.Eu??"",r=this.ie||Ut,s=this.We,n=this._n;return y` ${xr(ma)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Cu}></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" ${M(this.Bn)}><img src=${r} class=${this.Ou} ${M(this.Ki)} />${rs(this.Lt,()=>y`<uc-editor-image-cropper ${M(this.Nn)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${M(this.zn)}></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">${rs(this.Lt,()=>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.Kn(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Gn();}Kn(){let t=this.tabs||va;this.$["*tabList"]=ha(t);}Gn(){let t=vr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=So(this.cdnUrl),s=ko(r);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=ra(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.qn(),this.cdnUrl){let t=this.cdnUrl,e=Wi(t),r=Yt(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=So(t),n=ko(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Yt(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={};}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===F.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(G(t,tt("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===F.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.Au();}}async initEditor(){try{await this.qn();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this._n=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=tt(Jt(t),"preview"),s=G(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"Eu",2),h([g()],it.prototype,"ie",2),h([g()],it.prototype,"Tu",2),h([g()],it.prototype,"We",2),h([x({type:String,reflect:true})],it.prototype,"uuid",2),h([x({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([x({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([x({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"_n",2),h([g()],it.prototype,"Lt",2);var Er=class extends T{constructor(){super(...arguments);this.Wi=false;this.Qe=false;this.Xn=S();this.Je=false;this.ti=null;this.Qn=t=>{this.Jn(),this.ei&&(t.stopPropagation(),t.preventDefault(),this.ei=false);};this.ta=t=>{if(!this.ei||!this.qi||!this.go)return;t.stopPropagation(),t.preventDefault();let e=this.Vt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,l=t.y-s,c=n-this.qi[0],u=l-this.qi[1],{direction:p}=this.go,d=this.Vu(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.ea=t=>{if(!this.It)return;let e=Object.values(this.It).find(r=>{if(!r||this.bo(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return Jn(l,[t.x,t.y])});this.Wn=e,this.Jn();};}static{a(this,"CropFrame");}get Vt(){return this.Xn.value??null}get ei(){return this.Qe}set ei(t){this.Qe!==t&&(this.Qe=t,this.yo());}yo(){this.Xe&&this.Xe.setAttribute("class",dt({"uc-guides--hidden":this.Wi,"uc-guides--visible":!this.Wi&&this.Qe,"uc-guides--semi-hidden":!this.Wi&&!this.Qe}));}bo(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=O&&e.width<=O)return true;let r=e.height<=O&&(t.includes("n")||t.includes("s")),s=e.width<=O&&(t.includes("e")||t.includes("w"));return r||s}Iu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,l=this.Vt;if(!l)return;let c=ut("mask",{id:"backdrop-mask"}),u=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=ut("rect",{x:e,y:r,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});l.appendChild(d),l.appendChild(c),this.Ze=c,this.vo=p;}Mu(){this.Ze&&(this.Ze.style.display="none",window.requestAnimationFrame(()=>{this.Ze&&(this.Ze.style.display="block");}));}Lu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.vo&&ee(this.vo,{x:e,y:r,width:s,height:n});}Uu(){let t=this.$["*cropBox"];if(!(!t||!this.Xe||!this.It)){for(let e of Object.values(this.It)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:f,height:m}=t;if(c)ee(n,{x:p,y:d,width:f,height:m});else {let w=ie(Math.min(f,m)/82/2,0,1),E=u?Wn(t,r,w):Zn(t,r,w),C=E.center;if(!C)continue;let A=Math.max(Zo*ie(Math.min(f,m)/Zo/3,0,1),qn);ee(n,{x:C[0]-A,y:C[1]-A,width:A*2,height:A*2}),ee(s,{d:E.d});}let v=this.bo(r);l.setAttribute("class",dt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ee(this.Xe,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Yn(t,e){let r=ut("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=ut("rect",{fill:"transparent"}),n=ut("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.Ru.bind(this,e));}Pu(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.Yn(t,s);}return this.Yn(t,""),t}$u(){let t=ut("svg"),e=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=ut("line",{x1:`${ui*r}%`,y1:"0%",x2:`${ui*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=ut("line",{x1:"0%",y1:`${ui*r}%`,x2:"100%",y2:`${ui*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Du(){let t=this.Vt;if(!t)return;let e=document.createDocumentFragment(),r=this.$u();e.appendChild(r);let s=this.Pu();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.It=s,this.Xe=r,this.yo();}Ru(t,e){if(!this.It)return;let r=this.It[t];if(!r||this.bo(t))return;let s=this.$["*cropBox"],n=this.Vt;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.ei=true,this.go=r,this.qi=[u,p],this.Zn={...s};}Vu(t,e){let[r,s]=e,n=this.$["*imageBox"],l=this.Zn??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=Qn({rect:l,delta:[r,s],imageBox:n}):l=Yn({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return De(Fe(l),n)}Jn(){let t=this.Wn,e=this.Vt;e&&(e.style.cursor=t?Xn(t.direction):"initial");}ia(t){if(this.Ye){this.Ye.setAttribute("href",t);return}let e=this.Vt;if(!e){this.ti=t;return}this.ti=null;let r=document.createDocumentFragment(),s=ut("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.Ye=s;}Fu(){let t=this.$["*cropBox"];if(!t||!this.Ye)return;let{x:e,y:r,width:s,height:n}=t;ee(this.Ye,{x:e,y:r,height:n,width:s});}wo(){this.Je&&(this.Lu(),this.Uu(),this.Fu());}toggleThumbs(t){if(this.It)for(let e of Object.values(this.It)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",dt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Mu(),this.Je&&window.requestAnimationFrame(()=>{this.wo();});}),this.sub("*cropBox",t=>{t&&(this.Wi=t.height<=O||t.width<=O,this.yo(),this.Je&&window.requestAnimationFrame(()=>{this.wo();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.ia(t);}),document.addEventListener("pointermove",this.ta,true),document.addEventListener("pointerup",this.Qn,true);}firstUpdated(t){super.firstUpdated(t),this._u();}_u(){let t=this.Vt;if(!(!t||this.Je)){if(this.Iu(),this.Du(),this.Je=true,t.addEventListener("pointermove",this.ea,true),this.ti){let e=this.ti;this.ti=null,this.ia(e);}this.wo();}}disconnectedCallback(){super.disconnectedCallback(),this.Vt?.removeEventListener("pointermove",this.ea,true),document.removeEventListener("pointermove",this.ta,true),document.removeEventListener("pointerup",this.Qn,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${M(this.Xn)}></svg>`}};h([g()],Er.prototype,"Qe",2);var re=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter((i=>o[i])).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter((e=>e!==""))));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return Y}});var H=a(o=>o??R,"o");var rt=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}ra(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.ra();}updated(t){super.updated(t),t.has("active")&&this.ra();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],rt.prototype,"active",2),h([g()],rt.prototype,"title",2),h([g()],rt.prototype,"icon",2),h([g()],rt.prototype,"titleProp",2);var Tr=12,Cr=16,gu=a(o=>{let i=12,t=12;return o.width/o.height>=1?(i=Tr,t=Math.round(Tr*o.height/o.width)):(t=Tr,i=Math.round(Tr*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),os=class extends rt{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Nu(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Nu(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=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Ar=class extends rt{constructor(){super(...arguments);this.Q=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.Q}set aspectRatio(t){if(this.Q===t)return;let e=this.Q;this.Q=t,this.requestUpdate("aspectRatio",e),t?this.oa(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.Q&&this.oa(this.Q),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.Q?.id||t?.width===this.Q?.width&&t?.height===this.Q?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.Q?.id&&(this.$["*currentAspectRatio"]=this.Q);}oa(t){let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");r(),s(),e||this.requestUpdate();}zu(){let t=this.Q;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=gu(t),s=(Cr-e)/2,n=(Cr-r)/2;return y`<uc-icon><svg viewBox="0 0 ${Cr} ${Cr}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} >${this.zu()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([x({attribute:false})],Ar.prototype,"aspectRatio",1);function yu(o){let i=o+90;return i=i>=360?0:i,i}a(yu,"nextAngle");function bu(o,i){if(o==="rotate")return yu(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}a(bu,"nextValue");var Sr=class extends rt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=bu(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([x({type:String})],Sr.prototype,"operation",2);var Rt="original",kr=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.so=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.Bu();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===Rt?void 0:this.state.value,filter:this.state.filter===Rt?void 0:this.state.filter,fromViewer:false});}Bu(){let t=this.state.operation,{range:e,zero:r}=xt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:f,amount:m}=d;p=f===this.state.filter?m:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Rt?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(){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.so} ></uc-slider-ui>`}};h([g()],kr.prototype,"state",2);function je(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(je,"parseFilterValue");var oe=class extends rt{constructor(){super(...arguments);this.n="";this.f="";this.ii="";this.Zi=0;this.a=null;this.Se=false;this.isOriginal=false;this.sa=20;}static{a(this,"EditorFilterControl");}get filter(){return this.f}set filter(t){let e=t??"";if(this.f===e)return;let r=this.f;this.f=e,this.n="filter",this.isOriginal=e===Rt,this.icon=this.isOriginal?"original":"slider",this.sa=this.isOriginal?40:20,this.requestUpdate("filter",r),this.na(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.f),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.f),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.f;}Hu(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.sa||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.f!==Rt?{name:this.f,amount:l}:void 0,G(this.ii,tt(Zi,Jt(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${St}/${kt}/uc-cloud-image-editor/`))}async Ne(t,e){t[0]?.isIntersecting?await this.xo(e):this.b?.();}initCallback(){super.initCallback(),"IntersectionObserver"in window&&(this.s=new window.IntersectionObserver(this.Ne.bind(this),{threshold:[0,1]}));let t=this.$["*originalUrl"];this.ii=t??"",this.sub("*originalUrl",e=>{this.ii=e??"",!this.isOriginal&&this.ii&&this.isConnected&&!this.a&&(this.s?.observe(this),this.re());}),this.isOriginal||(this.s?.observe(this),this.re()),this.f&&this.na(this.f),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.f);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.xo():this.re());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.Xi();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.re()));}na(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async xo(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.ii){!this.Ae&&!this.Ft&&this.re();return}let e=++this.Zi,r="";try{r=await this.proxyUrl(this.Hu());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Se=false,this.b?.();let{promise:s,cancel:n}=ye(r);this.b=()=>{n(),this.Zi===e&&(this.b=void 0);};try{if(await s,this.Zi!==e||!this.isConnected)return;this.a=r,this.Se=!0,this.Xi(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.re();}finally{this.Zi===e&&(this.b=void 0);}}re(){if(!this.isConnected||this.a||this.Se||this.isOriginal||this.$["*networkProblems"]){this.Xi();return}this.Ft&&cancelAnimationFrame(this.Ft),this.Ft=requestAnimationFrame(()=>{if(this.Ft=void 0,!this.isConnected||this.a||this.Se||this.isOriginal){this.Xi();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.xo();return}this.Ae=window.setTimeout(()=>{this.Ae=void 0,this.re();},500);});}Xi(){this.Ft&&(cancelAnimationFrame(this.Ft),this.Ft=void 0),this.Ae&&(window.clearTimeout(this.Ae),this.Ae=void 0);}get aa(){return !!(this.Se&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.aa?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.aa?"0":"1"};return y`<button role="option" type="button" class=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} ><div class="uc-preview" ?loaded=${this.Se} style=${be(e)}></div><uc-icon class=${re({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${be(r)} ></uc-icon></button>`}};h([g()],oe.prototype,"a",2),h([g()],oe.prototype,"Se",2),h([g()],oe.prototype,"isOriginal",2),h([g()],oe.prototype,"sa",2),h([x({type:String})],oe.prototype,"filter",1);function ga(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}a(ga,"pick");function Ke(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return G(o,tt(Zi,Jt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${St}/${kt}/uc-cloud-image-editor/`))}a(Ke,"viewerImageSrc");function wu(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}a(wu,"validateCrop");var Or=class extends T{constructor(){super();this.ctxOwner=true;this.oe={width:0,height:0};this.e=null;this._=false;this.at=null;this.ca=S();this.To=S();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.la=$(this.ua.bind(this),300),this.Eo=He(()=>{!this.isConnected||!this._||(this.Co(),this.da(),this.pa(),this.Ao(),this.So());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.Co();}da(){let t=this.$["*editorTransformations"],e=ga(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Co(){let t=this.ca.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.Et=t,this.e=e;}pa(){if(!this._||!this.at)return;let t=this.at,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=Ve({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,m=0+e,v=e+(n.height-e*2)/2-f/2;c={x:m,y:v,width:d,height:f};}else {let d=n.height-e*2,f=d*u,m=e+(n.width-e*2)/2-f/2,v=0+e;c={x:m,y:v,width:f,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p};}this.$["*imageBox"]=Fe(c);}Ao(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[f,m],coords:[v,w]}=n,{width:E}=Ve(this.oe,s),C=l/E;t=De(Fe({x:c+v*C,y:u+w*C,width:f*C,height:m*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!ta(t,e)||d&&!ea(t,d)){let f=e.width/e.height,m=e.width,v=e.height;d&&(f>d?m=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-v/2,width:m,height:v};}this.$["*cropBox"]=De(Fe(t),e);}ju(){let t=this.e;if(!t)return;let e=this.at;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=Ve({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}So(){if(!this._||!this.at||!this.Et||!this.e)return;let t=this.Et;this.e.clearRect(0,0,t.width,t.height),this.ju();}Ku({fromViewer:t}){this.at&&(this.To.value?.toggleThumbs(true),this.Gu(),setTimeout(()=>{this.className=dt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}ha(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l}=e,{width:c,height:u}=Ve(this.oe,s),{width:p,height:d}=t,f=n/c,m=l/u;return [ie(Math.round(p/f),1,c),ie(Math.round(d/m),1,u)]}qu(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=Ve(this.oe,s),{x:f,y:m}=t,v=n/p,w=l/d,E=this.ha(),C={dimensions:E,coords:[ie(Math.round((f-c)/v),0,p-E[0]),ie(Math.round((m-u)/w),0,d-E[1])]};if(!wu(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(E[0]===p&&E[1]===d))return C}ua(){if(!this.isConnected||!this.oe)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.qu(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.pa(),this.Ao(),this.So());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Co(),this.oe=t,this.removeEventListener("transitionend",this.fa);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.at=await this.Wu(r,s),this.da(),this.Eo(),this.Ku({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.at&&this.Eo();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.ua(),this._=false,this.Zu(),this.className=dt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.To.value?.toggleThumbs(false),this.addEventListener("transitionend",this.fa,{once:true}),this.s?.disconnect());}Zu(){let t=this.ha(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}Gu(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}fa(){this._||(this.at=null);}async Wu(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Ke(t,r,e)),{promise:n,cancel:l,image:c}=ye(s),u=this.ke(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}ke(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.So();}),this.sub("*cropBox",()=>{this.at&&this.la();}),this.sub("*currentAspectRatio",()=>{this.Ao();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.oe&&this.activate(this.oe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.at&&(this.at=null);}render(){return y`<canvas class="uc-canvas" ${M(this.ca)}></canvas><uc-crop-frame ${M(this.To)}></uc-crop-frame>`}};h([g()],Or.prototype,"at",2);function ss(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}a(ss,"linspace");function xu(o){return typeof o=="string"&&o in xt}a(xu,"isOperationKey");function Eu(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}a(Eu,"splitBySections");function Tu(o,i,t){let e=Eu(o).find(([n,l])=>n<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(Tu,"calculateOpacities");function Cu(o,i){return o.map((t,e)=>t<i?o.length-e:e)}a(Cu,"calculateZIndices");function ya(o,i){let t=xt[o].keypointsNumber,{range:e,zero:r}=xt[o];return [...new Set([...ss(e[0],r,t+1),...ss(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}a(ya,"keypointsRange");var ns=class extends T{constructor(){super();this._=false;this.ko=true;this.n="initial";this.ma={};this._t=[];this.ga=0;this.ba=S();this.Yi=S();this.classList.add("uc-inactive_to_cropper"),this.ya=$(async(t,e,r)=>{let s=a(()=>!this.wa(t,e)||this.ve!==r||!!this._t.find(u=>u.value===r),"shouldSkip");if(s())return;let n=await this.xa(t,r),l=new Image;l.src=n.src;let c=this.ke(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this._t,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let f=u[p]?.image,m=this.Yi.value;!m||f&&!m.contains(f)||(u.splice(p,0,n),f?m.insertBefore(l,f):m.appendChild(l),this.Mo(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}ke(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}Ea(){window.cancelAnimationFrame(this.ga),this.ga=window.requestAnimationFrame(()=>{for(let t of this._t){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ie({url:t=this.va,filter:e=this.f??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.ma};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let l=this.offsetWidth;return this.proxyUrl(Ke(t,l,n))}async xa(t,e){return {src:await this.ie({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}wa(t,e){return this.n===t&&this.f===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!xu(this.n)||!Number.isFinite(e)||(this.Mo(this.n,e),this.ya(this.n,this.f,e));}Mo(t,e){this.n=t,this.ve=e;let{zero:r}=xt[t],s=this._t.map(c=>c.value),n=Tu(s,e,r),l=Cu(s,r);this._t.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.Ea();}Ta(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Xu(){this.a=this.a||this.Ta();let t=this.a;t&&this.Ca(t);let e=this._t.map(u=>u.src),{images:r,promise:s,cancel:n}=fi(e);r.forEach(u=>{let p=this.ke(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Oo=()=>{n(),this.Oo=void 0;};let l=this.n,c=this.f;if(await s,this._&&this.wa(l,c)){let u=this.Yi.value;if(!u)return;u.replaceChildren(),this._t.forEach((p,d)=>{let f=r[d];f&&(f.classList.add("uc-fader-image"),p.image=f,u.appendChild(f));}),this.Ea();}}async setTransformations(t){if(this.ma=t,this.a){let e=await this.ie(),r=this.ke(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.Io?.();let n=ya(r,s),l=await Promise.all(n.map(u=>this.ie({url:t,filter:e,operation:r,value:u}))),{cancel:c}=fi(l);this.Io=c;}Yu(t){let e=this.a||this.Ta();if(this.Ca(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=dt({"uc-active_from_viewer":this.ri,"uc-active_from_cropper":!this.ri,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.ke(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=dt({"uc-active_from_viewer":this.ri,"uc-active_from_cropper":!this.ri,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.ko=false,await this.updateComplete,this.va=t,this.n=e??"initial",this.ve=r,this.f=s,this.ri=n,typeof r!="number"&&!s){let c=await this.ie({operation:e,value:r});this.Yu(c),this.Lo();return}!e||typeof r!="number"||(this._t=await Promise.all(ya(e,r).map(c=>this.xa(e,c))),this.Mo(e,r),this.Xu());}deactivate({hide:t=true}={}){this._=false,this.Oo?.(),this.Io?.(),t&&!this.ko?(this.ko=true,this.a&&(this.a.style.transform="scale(1)"),this.className=dt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Lo();},{once:true})):this.Lo();}Ca(t){let e=this.ba.value;e&&(e.contains(t)||e.appendChild(t));}Lo(){this.Yi.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${M(this.ba)}></div><div class="uc-fader-layers-host" ${M(this.Yi)}></div>`}};var Ir=class extends rt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),e&&this.Aa(e);}Aa(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.Aa(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=xt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])});}};h([x({type:String})],Ir.prototype,"operation",1);var Au=1,ba=a(()=>{},"noopScrollListener"),as=class extends T{constructor(){super(...arguments);this.Sa=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Au){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Sa,{passive:false}),this.addEventListener("scroll",ba,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Sa),this.removeEventListener("scroll",ba),super.disconnectedCallback();}};var pt=class extends T{constructor(){super(...arguments);this.We=false;this.showMainToolbar=true;this.showSubToolbar=false;this.ka=true;this.tabList=[...et];this.activeTab=F.CROP;this.Qi=true;this.Uo=false;this.Oa=null;this.Ia=0;this.Ma=0;this.Ji=S();this.La=S();this.tabToggleRefs={[F.CROP]:S(),[F.TUNING]:S(),[F.FILTERS]:S()};this.Ua=()=>{this.se();};this.oi=[];this.ji=$(t=>{this.We=t;},500);this.tr=$(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===F.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Rt);else if(this.showSubToolbar&&this.$["*tabId"]===F.TUNING&&e){s=true;let n=t?.[e]||xt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Uo=s;},0);this.Qu={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ju={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.td={hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"};this.ed={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.rd={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Rt,"*currentOperation":null,"*operationTooltip":null};this.kt=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.Do=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.fd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:je(this.$["*operationTooltip"])}),this.Ji.value?.apply(),this.Ra();};this.md=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Ji.value?.cancel(),this.Ra();};this.vd=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Ro(r,{fromViewer:false}));};}static{a(this,"EditorToolbar");}Ra(){this.$["*showSlider"]=false,this.$["*tabId"]===F.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===F.TUNING&&(this.Uo=false);}Ro(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Pa(t,{fromViewer:e,force:r});}Pa(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.se();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===F.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of et){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.se();}}se(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.La.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Ia!==s||this.Ma!==n)&&(this.Ia=s,this.Ma=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Po(){return this.oi.length>=3}od(t){switch(t){case F.CROP:return this.sd();case F.FILTERS:return this.nd();case F.TUNING:return this.ad();default:return []}}sd(){let t=[];if(this.Po)t.push(()=>this.ld());else for(let e of this.oi)t.push(()=>this.$a(e));for(let e of bn)t.push(()=>this.cd(e));return this.$o(t)}nd(){let e=[Rt,...yn].map(r=>()=>this.ud(r));return this.$o(e)}ad(){let t=gn.map(e=>()=>this.dd(e));return this.$o(t)}$o(t){return t.length?t.map(r=>r()):[]}ld(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}$a(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}cd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}ud(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}dd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}pd(){return this.Po?this.oi.map(t=>this.$a(t)):[]}async hd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ke(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=fi([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.oi=[...t],this.sub("*cropPresetList",e=>{this.oi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Ro(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.tr();}),this.sub("*currentOperation",()=>{this.tr();}),this.sub("*tabId",e=>{this.Pa(e,{fromViewer:false,force:true}),this.tr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.hd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.ji(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Qi=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Qi=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.ka=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Ro(r,{fromViewer:false});return}this.se();}),this.sub("*operationTooltip",e=>{this.Oa=e;}),this.tr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ua);}firstUpdated(t){super.firstUpdated(t),this.Gi(),this.se();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.se()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Gi();}disconnectedCallback(){window.removeEventListener("resize",this.Ua),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Gi(){let t=this.Ji.value;t&&(this.$["*sliderEl"]=t);}gd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?be({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.ed}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${n} @click=${this.vd} ${M(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}yd(t){let e=this.activeTab===t,r=this.od(t);return y`<uc-presence-toggle id=${`tab_${t}`} class="uc-tab-content" .visible=${e} .styles=${this.td} ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${r.length?r:R}</div></div></uc-editor-scroller></uc-presence-toggle>`}render(){let t=["uc-info-tooltip",this.Uo?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Po;return y`<uc-line-loader-ui .active=${this.We}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Oa??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Qu} ><div class="uc-tab-content-row">${et.map(r=>this.yd(r))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.ka} .styles=${this.rd} @initial-render=${()=>this.se()} ><div class="uc-tab-toggles_indicator" ${M(this.La)} ></div>${et.map(r=>this.gd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.kt} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Do}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ju}><div class="uc-slider" ?hidden=${!this.Qi}><uc-editor-slider ${M(this.Ji)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Qi||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.pd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.md} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.fd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],pt.prototype,"We",2),h([g()],pt.prototype,"showMainToolbar",2),h([g()],pt.prototype,"showSubToolbar",2),h([g()],pt.prototype,"ka",2),h([g()],pt.prototype,"tabList",2),h([g()],pt.prototype,"activeTab",2),h([g()],pt.prototype,"Qi",2),h([g()],pt.prototype,"Uo",2),h([g()],pt.prototype,"Oa",2),h([g()],pt.prototype,"oi",2);var Tt=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.active=false;this.reverse=false;this.theme="default";this.ariaRole="";this.ariaControls="";this.titleProp="";}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.Da(),this.Va();}updated(t){super.updated(t),t.has("reverse")&&this.Da(),t.has("theme")&&this.Va();}Da(){this.style.flexDirection=this.reverse?"row-reverse":"";}Va(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get bd(){let t=this.Vo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.wd}}get Vo(){return !this.icon}get wd(){return !this.text&&!this.Vo}render(){return y`<button type="button" role=${H(this.ariaRole||void 0)} aria-controls=${H(this.ariaControls||void 0)} aria-label=${H(this.l10n(this.titleProp))} title=${H(this.l10n(this.titleProp))} ><uc-icon class=${re(this.bd)} name=${H(this.icon||void 0)} ?hidden=${this.Vo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([x({type:String})],Tt.prototype,"text",2),h([x({type:String})],Tt.prototype,"icon",2),h([x({type:Boolean,reflect:true})],Tt.prototype,"active",2),h([x({type:Boolean,reflect:true})],Tt.prototype,"reverse",2),h([x({type:String,reflect:true})],Tt.prototype,"theme",2),h([x({attribute:"aria-role"})],Tt.prototype,"ariaRole",2),h([x({attribute:"aria-controls"})],Tt.prototype,"ariaControls",2),h([x({attribute:"title-prop"})],Tt.prototype,"titleProp",2);var Mr=class extends T{constructor(){super(...arguments);this.active=false;this.Xt=S();this.Fo=false;this._o=()=>{let t=this.Xt.value;t&&(this.Fa(t),this.Fo&&this.active&&this.No());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.No();}updated(t){super.updated(t),t.has("active")&&(this.active?this.No():this.xd());}No(){let t=this.Xt.value;if(!t)return;this.Fo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this._o),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this._o,{once:true});}xd(){let t=this.Xt.value;t&&(this.Fo=false,t.removeEventListener("transitionend",this._o),this.Fa(t));}Fa(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" ${M(this.Xt)}></div></div>`}};h([x({type:Boolean,reflect:true})],Mr.prototype,"active",2);var Ee={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},vi=class extends T{constructor(){super(...arguments);this.bt=false;this._a=Ee;this.Na=Ee.visible;this.za=Ee.hidden;this.zo=false;this.Ba=false;}static{a(this,"PresenceToggle");}set visible(t){this.bt=t,this.Ha();}get visible(){return this.bt}set styles(t){this._a=t,this.zo=true,this.Na=t.visible??Ee.visible,this.za=t.hidden??Ee.hidden;}get styles(){return this._a}Ha(){this.style.visibility=this.bt?"inherit":"hidden",pa(this,{[Ee.transition]:!this.zo,[this.Na]:this.bt,[this.za]:!this.bt}),this.toggleAttribute("inert",!this.bt);}Ed(){this.Ba||(this.Ba=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.zo||this.classList.add(Ee.transition),this.Ha(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Ed();},0);}};h([x({type:Boolean})],vi.prototype,"visible",1),h([x({attribute:false})],vi.prototype,"styles",1);var Ht=class extends T{constructor(){super();this.Bo=0;this.Dt=S();this.Ka=S();this.Ga=S();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Nt=0;this.Td=t=>{t.stopPropagation();let e=this.Wa(t);e!==null&&(this.Ho(e),this.qa("slider-input",e));};this.Cd=t=>{t.stopPropagation();let e=this.Wa(t);e!==null&&(this.Ho(e),this.qa("slider-change",e));};this.Za=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Xa=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}qa(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Bo=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Ya(this.Nt),this.jo(),this.s=new ResizeObserver(()=>{this.jo(),this.er(this.Nt);}),this.s.observe(this);let e=this.Dt.value;e?.addEventListener("focus",this.Za),e?.addEventListener("blur",this.Xa),window.setTimeout(()=>{this.er(this.Nt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Nt&&this.Ho(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.jo(),this.er(this.Nt)),t.has("zero")&&this.hasUpdated&&this.Qa(this.Nt);}er(t){this.Qa(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.Bo)/100;window.requestAnimationFrame(()=>{let c=this.Ka.value;c&&(c.style.transform=`translateX(${l}px)`);});}Qa(t){if(!this.si)return;let e=this.max-this.min;if(e===0)return;this.si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.Bo)/100;window.requestAnimationFrame(()=>{this.si&&(this.si.style.transform=`translateX(${l}px)`);});}jo(){let e=this.Ga.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.ja===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.si=p,e.innerHTML="",e.appendChild(l),this.ja=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Dt.value;t?.removeEventListener("focus",this.Za),t?.removeEventListener("blur",this.Xa),this.s?.disconnect(),this.s=void 0;}Ho(t){Number.isFinite(t)&&(this.Nt=t,this.hasUpdated&&(this.Ya(t),this.er(t)));}Ya(t){let e=this.Dt.value;e&&(e.value=String(t));}Wa(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return y`<div class="uc-steps" ${M(this.Ga)}></div><div class="uc-thumb" ${M(this.Ka)}></div><input class="uc-input" type="range" ${M(this.Dt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Nt)} ?disabled=${this.disabled} @input=${this.Td} @change=${this.Cd} />`}};h([x({type:Boolean,reflect:true})],Ht.prototype,"disabled",2),h([x({type:Number})],Ht.prototype,"min",2),h([x({type:Number})],Ht.prototype,"max",2),h([x({type:Number,attribute:false})],Ht.prototype,"defaultValue",2),h([x({type:Number})],Ht.prototype,"zero",2),h([g()],Ht.prototype,"Nt",2);var Lr=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.CLOUD_IMG_EDIT;this.J=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>this.Ad(),"onActivate"),onDeactivate:a(()=>this.Sd(),"onDeactivate")}),this.subConfigValue("cropPreset",t=>{if(!this.J)return;let e=t||void 0;this.J.cropPreset!==e&&(this.J={...this.J,cropPreset:e});}),this.subConfigValue("cloudImageEditorTabs",t=>{if(!this.J)return;let e=t||void 0;this.J.tabs!==e&&(this.J={...this.J,tabs:e});});}Do(t){if(!this.ni)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.ni.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(b.activities.CLOUD_IMG_EDIT),this.historyBack();}kt(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(b.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Ad(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.ni=e;let r=this.ni.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.J=this.kd(r);}Sd(){this.ni=void 0,this.J=null;}render(){if(!this.J)return R;let{cdnUrl:t,cropPreset:e,tabs:r}=this.J;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${H(e)} tabs=${H(r)} @apply=${this.Do} @cancel=${this.kt} @change=${this.handleChange} ></uc-cloud-image-editor>`}kd(t){let e={cdnUrl:t},r=this.cfg.cropPreset;r&&(e.cropPreset=r);let s=this.cfg.cloudImageEditorTabs;return s&&(e.tabs=s),e}};h([g()],Lr.prototype,"J",2);var Su=[{test:a(o=>!!o.accept&&!!o.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],wa=$(o=>{for(let{test:i,message:t}of Su)i(o)&&hr(t);},0);var xa=a((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),ku="0123456789abcdefghijklmnopqrstuvwxyz",Ea=a(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=ku[Number(t)]+i,o=o/36n;}return i},"a"),ls=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var Ou=a(async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Iu=10,Mu=a(async o=>{let i=await Ou(o);return Ea(i).slice(0,Iu)},"d"),Ta=a(async(o,i)=>{let t=await Mu(o);return xa(t,i)},"f");var Ca=a(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var cs=a(o=>o,"defineComputedProperty"),Lu=[cs({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:o,enableVideoRecording:i})=>{if(i===null)return o;let t=at(o);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Nt(t)},"fn")}),cs({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:o,defaultCameraMode:i})=>{if(i===null)return o;let t=at(o);return t=t.sort((e,r)=>e===i?-1:r===i?1:0),Nt(t)},"fn")}),cs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>o&&(i===ii||ls(i,t))?Ta(o,t):i,"fn")})],Aa=a(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of Lu)if(r.deps.includes(o)){let s={[r.key]:t(r.key)};for(let c of r.deps)s[c]=t(c);let n=new AbortController;e.get(r.key)?.abort(),e.set(r.key,n);let l;try{l=r.fn(s,{signal:n.signal});}catch(c){e.get(r.key)===n&&e.delete(r.key),console.error(`Failed to compute value for "${r.key}"`,c);return}Ca(l)?l.then(c=>{n.signal.aborted||i(r.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.key)===n&&e.delete(r.key);}):i(r.key,l);}},"computeProperty");var V=a(o=>String(o),"asString"),Q=a(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),N=a(o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},"asBoolean"),Sa=a(o=>o==="auto"?o:N(o),"asStore"),ka=a(o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),Oa=a(o=>{let i=V(o);if(!Object.values(k).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),Ia=a(o=>{let i=V(o),t=at(i);if(t.some(e=>!Object.values(k).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),Ma=a(o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),us=a(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),Ur=a(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),ds=a(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),La=a(o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var Uu={pubkey:V,multiple:N,multipleMin:Q,multipleMax:Q,confirmUpload:N,imgOnly:N,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Sa,cameraMirror:N,cameraCapture:ka,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:Q,thumbSize:Q,showEmptyList:N,useLocalImageEditor:N,useCloudImageEditor:N,cloudImageEditorTabs:V,removeCopyright:N,cropPreset:V,imageShrink:V,modalScrollLock:N,modalBackdropStrokes:N,sourceListWrap:N,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:Q,retryNetworkErrorMaxTimes:Q,multipartMinFileSize:Q,multipartChunkSize:Q,maxConcurrentRequests:Q,multipartMaxConcurrentRequests:Q,multipartMaxAttempts:Q,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:N,groupOutput:N,userAgentIntegration:V,debug:N,localeName:V,metadata:Ma,secureUploadsExpireThreshold:Q,localeDefinitionOverride:a(o=>us(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(o=>Ur(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(o=>Ur(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(o=>Ur(o),"iconHrefResolver"),fileValidators:ds,collectionValidators:ds,validationTimeout:Q,validationConcurrency:Q,cameraModes:Ia,defaultCameraMode:Oa,enableAudioRecording:N,enableVideoRecording:N,mediaRecorderOptions:us,maxVideoRecordingDuration:Q,filesViewMode:La,gridShowFileNames:N,cloudImageEditorAutoOpen:N,cloudImageEditorMaskHref:V,testMode:N,qualityInsights:N},Ua=a((o,i)=>{if(!(typeof i>"u"||i===null))try{return Uu[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),lt[o]}},"normalizeConfigValue");var Rr=[...new Set(["debug",...Object.keys(lt)])],Ru=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],$a=a(o=>Ru.includes(o),"isComplexKey"),gi=Rr.filter(o=>!$a(o)),Ra={...Object.fromEntries(gi.map(o=>[Je(o),o])),...Object.fromEntries(gi.map(o=>[o.toLowerCase(),o]))},Pu={...Object.fromEntries(gi.map(o=>[Je(o),X(o)])),...Object.fromEntries(gi.map(o=>[o.toLowerCase(),X(o)]))},Pa=a(o=>`__${o}`,"getLocalPropName"),Pr=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(lt).map(([t,e])=>[X(t),e]))};this.Od=new Map;}static{a(this,"Config");}Id(t,e){if(!$a(t)){let r=[...new Set([Je(t),t.toLowerCase()])];for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Md(t,e){this.$[X(t)]!==e&&(typeof e>"u"||e===null?this.$[X(t)]=lt[t]:this.$[X(t)]=e);}ir(t,e){let r=this,s=Ua(t,e),n=Pa(t);r[n]!==s&&(this.Ld(t,r[n],s),r[n]=s,this.Id(t,s),this.Md(t,s),this.debugPrint(`[uc-config] "${t}"`,s),wa(this.cfg));}Ja(t){let e=this,r=Pa(t);return e[r]??this.$[X(t)]}Ld(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}initCallback(){super.initCallback();let t=this;for(let e of gi)this.sub(X(e),r=>{this.ir(e,r);},false);for(let e of Rr){let r=t[e]??this.$[X(e)];r!==lt[e]&&this.ir(e,r),Object.defineProperty(this,e,{set:a(s=>{this.ir(e,s);},"set"),get:a(()=>this.Ja(e),"get")});}for(let e of Rr)this.sub(X(e),()=>{Aa({key:e,setValue:this.ir.bind(this),getValue:this.Ja.bind(this),computationControllers:this.Od});});}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ra[t];n&&(s[n]=r),Pu[t]&&(this[t]=r);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(Ra)]}};for(let o of Rr)Pr.prototype[o]=void 0;function $u(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}a($u,"checkIsDirectory");function Du(o,i){return new Promise(t=>{let e=0,r=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}a(Du,"readEntryContentAsync");function Da(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(Du(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push($u(l).then(c=>{c||i.push({type:"file",file:l});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Da,"getDropItems");var ot=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Va=["focus"],Vu=100,ps=new Map;function Fu(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}a(Fu,"distance");function hs(o){let i=0,t=document.body,e=new Set,r=a(v=>{e.add(v);},"handleSwitch"),s=ot.INACTIVE,n=a(v=>{o.shouldIgnore()&&v!==ot.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=a(()=>{i=0,n(ot.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===ot.INACTIVE&&n(ot.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(ot.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(ot.INACTIVE);},"onDrop"),f=a(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],E=o.element.getBoundingClientRect(),C=Math.floor(Fu(w,E)),A=C<Vu,L=v.composedPath().includes(o.element);ps.set(o.element,C);let ft=Math.min(...ps.values())===C;L&&ft?(v.preventDefault(),n(ot.OVER)):n(A&&ft?ot.NEAR:ot.ACTIVE);},"onDragOver"),m=a(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let E=await Da(w);o.onItems(E),n(ot.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),o.element.addEventListener("drop",m),Va.forEach(v=>{window.addEventListener(v,c);}),()=>{ps.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",m),Va.forEach(v=>{window.removeEventListener(v,c);});}}a(hs,"addDropzone");var fs=new Set,Ct=class extends P{constructor(){super(...arguments);this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ut=true;this.tl=true;this.il=null;this.rl=null;this.ol=S();this.Oe=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.sl=true;this.Ie=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get Ud(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.Ut)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),fs.add(this),this.Ko(),this.Go(),this.nl(),this.al(ot.INACTIVE),this.il=hs({element:this,shouldIgnore:a(()=>this.ll(),"shouldIgnore"),onChange:a(e=>{this.al(e);},"onChange"),onItems:a(e=>{e.length&&(e.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:B.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:B.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(b.activities.UPLOAD_LIST),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})));},"onItems")});let t=this.ol.value;t&&(this.rl=hs({element:t,onChange:a(e=>{let r=Object.entries(ot).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.ll(),"shouldIgnore")})),this.subConfigValue("sourceList",e=>{let r=q(e);this.sl=r.includes(B.LOCAL),this.Ko(),this.Go();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Ko(),this.Go());}updated(t){super.updated(t),t.has("clickable")&&this.nl();}ll(){if(!this.Ut||!this.Rd())return true;if(!this.fullscreen)return false;let t=fs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}Rd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Ko(){let t=this.sl&&!this.disabled;this.Ut=t;}Go(){let t=this.Ut||!this.querySelector("[data-default-slot]");this.tl=t,this.hidden=!t;}al(t){let e=Object.entries(ot).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}nl(){this.clickable&&!this.Ie?(this.addEventListener("keydown",this.Oe),this.addEventListener("click",this.Oe),this.Ie=true):!this.clickable&&this.Ie&&(this.removeEventListener("keydown",this.Oe),this.removeEventListener("click",this.Oe),this.Ie=false);}disconnectedCallback(){super.disconnectedCallback(),fs.delete(this),this.il?.(),this.rl?.(),this.Ie&&(this.removeEventListener("keydown",this.Oe),this.removeEventListener("click",this.Oe),this.Ie=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${M(this.ol)} class="uc-content-wrapper" ?hidden=${!this.tl}><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.Ud}</span></div>`)} `}};h([x({type:Boolean,reflect:true})],Ct.prototype,"disabled",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"clickable",2),h([x({type:Boolean,attribute:"with-icon",reflect:true})],Ct.prototype,"withIcon",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"fullscreen",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"initflow",2),h([x({type:String})],Ct.prototype,"text",2),h([g()],Ct.prototype,"Ut",2),h([g()],Ct.prototype,"tl",2);var Fa=a(()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var _u=a(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),_a=a((o,i="i")=>{let t=o.split("*").map(_u);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Nu=["--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"],zu=a((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),Na=a(o=>{let i={};for(let t of Nu){let e=zu(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Bu=["selected-files-change","toolbar-state-change"],Hu=a(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Bu.includes(i))},"isWhitelistedMessage"),$r=class{constructor(i,t){this.rr=new Map;this.ul=i=>{if(i.source!==this.qo)return;let t=i.data;if(!Hu(t))return;let e=this.rr.get(t.type);if(e)for(let r of e)r(t);};this.qo=i,this.cl=t,window.addEventListener("message",this.ul);}static{a(this,"MessageBridge");}on(i,t){let e=this.rr.get(i)??new Set;this.rr.has(i)||this.rr.set(i,e),e.add(t);}send(i){let t=this.cl();this.qo.postMessage(i,t);}destroy(){window.removeEventListener("message",this.ul);}};function za(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(za,"queryString");var ju={[Mt.GDRIVE]:"ngdrive"},yt=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.EXTERNAL;this.Me=S();this.or=null;this.Wo=[];this.Zo=false;this.Xo=false;this.Yo=false;this.Qo=false;this.sr=false;this.Jo=false;this.ts="uc-hidden";this.dl=true;this.ro=()=>{for(let t of this.Wo){let e=this.$d(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.modalManager?.open(b.activities.UPLOAD_LIST);};this.kt=()=>{this.historyBack();};this.zd=()=>{this.pt?.send({type:"select-all"});};this.Bd=()=>{this.pt?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get Pd(){if(!this.or)return "";let{selectedCount:t,total:e}=this.or;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.pl();},"onActivate")}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.es(),this.pl());}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.es();}),this.subConfigValue("multiple",t=>{this.sr=t;}),this.subConfigValue("localeName",()=>{this.hl();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.fl(t);});}$d(t){if(t.alternatives){let e=q(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=_a(r);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}Dd(t){this.dl=t.isVisible;}async Vd(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Fd(t.selectedCount,t.total),this.ts=t.isReady?"":"uc-hidden",this.Zo=t.isReady,this.Xo=t.isReady&&t.selectedFiles.length>0,this.sr=t.isMultipleMode&&t.total>0,this.Yo=t.selectedCount<t.total,this.Qo=t.selectedCount===t.total,this.Wo=t.selectedFiles??[],this.Jo=t.total>0;}ml(){this.fl(this.cfg.externalSourcesEmbedCss),this._d(),this.hl();}_d(){this.pt?.send({type:"set-theme-definition",theme:Na(this)});}fl(t){this.pt?.send({type:"set-embed-css",css:t});}hl(){this.pt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Nd(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=ju[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Fa(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=za(u),p.toString()}Fd(t,e){this.or={selectedCount:t,total:e};}pl(){let t=document.createElement("iframe");t.src=this.Nd(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.ml.bind(this)),t.addEventListener("load",this.ml.bind(this)),this.Me.value&&(this.Me.value.innerHTML="",this.Me.value.appendChild(t)),t.contentWindow&&(this.pt?.destroy(),this.pt=new $r(t.contentWindow,()=>this.cfg.socialBaseUrl),this.pt.on("selected-files-change",this.Vd.bind(this)),this.pt.on("toolbar-state-change",this.Dd.bind(this)),this.vl());}es(){this.pt?.destroy(),this.pt=void 0,this.Me.value&&(this.Me.value.innerHTML=""),this.vl();}vl(){this.Wo=[],this.Zo=false,this.Xo=false,this.Yo=false,this.Qo=false,this.sr=false,this.Jo=false,this.ts="uc-hidden",this.or=null;}disconnectedCallback(){super.disconnectedCallback(),this.es();}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 ${M(this.Me)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.dl}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.kt}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.sr}><span>${this.Pd}</span><button type="button" @click=${this.zd} ?hidden=${!this.Yo}>${this.l10n("select-all")}</button><button type="button" @click=${this.Bd} ?hidden=${!this.Qo}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ro} ?disabled=${!this.Xo} ?hidden=${!this.Jo} ><uc-spinner ?hidden=${this.Zo}></uc-spinner><span class=${this.ts}>${this.l10n("done")}</span></button></div></div>`}};h([g()],yt.prototype,"Wo",2),h([g()],yt.prototype,"Zo",2),h([g()],yt.prototype,"Xo",2),h([g()],yt.prototype,"Yo",2),h([g()],yt.prototype,"Qo",2),h([g()],yt.prototype,"sr",2),h([g()],yt.prototype,"Jo",2),h([g()],yt.prototype,"ts",2),h([g()],yt.prototype,"dl",2);var Vr=a(()=>{let o=[];return {stack:o,promiseReadJpegChunks:a(t=>new Promise((e,r)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",f=>{r(`Reader error: ${f}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let f=p.getUint16(2)-2;return n(t.slice(s,s+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}o.push({startPos:u,length:f,marker:d,view:m}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Ku=a(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ha=a(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=Vr();await s(o),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Gu=226,ja=a((o,i)=>Ha(o,Gu,i.map(t=>t.buffer)),"replaceIccProfile"),qu=a(async o=>{try{return await ja(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Wu=a((o,i,t)=>new Promise((e,r)=>{let s=a(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),yi=a(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),Zu=a(o=>{let{ctx:t,canvas:e}=yi();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},"hasTransparency"),Xu=a(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Qu="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Dr,Yu=a(()=>new Promise(o=>{if(Dr!==void 0)o(Dr);else {let i=new Image;i.addEventListener("load",()=>{Dr=i.naturalWidth<i.naturalHeight,i.src="//:0",o(Dr);}),i.src=Qu;}}),"isBrowserApplyExifOrientation"),Ju=a((o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},"findExifOrientation"),td=a((o,i)=>{Ju(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),ed=a(async(o,i,t)=>(t&&td(i,1),Ha(o,225,[i.buffer])),"replaceExif"),id=a((o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),rd=a(o=>id(new Image,o),"imageLoader"),od=[1,3],sd=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ba={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},nd=a(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&sd.indexOf(r)>=0){let n=s.getUint8(5);od.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Ka=a((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),Ga=a((o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),se={R:55,G:110,B:165,A:255},ad=`rgba(${se.R}, ${se.G}, ${se.B}, ${se.A/255})`,qa=a((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=yi();e.width=1,e.height=1;let{canvas:s,ctx:n}=yi();s.width=o,s.height=i,n&&(n.fillStyle=ad,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===se.R&&l[1]===se.G&&l[2]===se.B&&l[3]===se.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function Wa(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}a(Wa,"wrapAsync");var ld=Wa(Ka(qa,Ga)),cd=Wa(Ka(qa,Ga)),Za=a(async(o,i)=>{let t=Ba.squareSide.find(n=>n*n>=o*i),e=Ba.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([ld(t,t),cd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Xa=a(async(o,i,t)=>{try{let{ctx:e,canvas:r}=yi();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),ud=a(({img:o,targetW:i,targetH:t})=>Xa(o,i,t),"native"),dd=a(function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},"calcShrinkSteps"),pd=a(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=dd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[l,c],u)=>n.then(p=>Za(l,c).then(()=>Xa(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),hd=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),fd=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),ms=.71,md=a((o,i)=>{if(o.width*ms*o.height*ms<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return Za(s,n).then(()=>{let{ctx:l}=yi();return "imageSmoothingQuality"in l&&!hd()&&!fd?ud({img:o,targetW:s,targetH:n}):pd({img:o,sourceW:t,targetW:s,targetH:n,step:ms})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Qa=a(async(o,i)=>{try{if(await nd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Xu(o),Yu(),Ku(o)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await qu(o).catch(()=>o),p=await rd(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await md(p,i),f="image/jpeg",m=i?.quality||.8;!s&&Zu(d)&&(f="image/png",m=void 0);let v=await Wu(d,f,m);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,E=l.status==="fulfilled"?l.value:!1;v=await ed(v,w,E);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await ja(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 vd=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ya=a(o=>{if(typeof o!="string")return false;let i=vd.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var W=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),j=class j extends ze{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.gl=true;this.uid="";this.rs="";this.os="";this.ss="";this.ot=0;this.yl=false;this.ns="";this.bl=false;this.wl=false;this.xl=false;this.El=false;this.Tl=false;this.nr=false;this.Cl="";this.Al=false;this.Hd=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(b.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT;});this.jd=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.remove(this.uid);};this.Kd=()=>{this.Sl();};this.w=$(()=>this.kl(),100);this.qd=this.withEntry(He((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===W.FINISHED,c=e===W.UPLOADING,u=e===W.QUEUED_UPLOADING,p=e===W.QUEUED_VALIDATION,d=e===W.VALIDATION,f=t.getValue("fileName"),m="";r?m="":!l&&n&&s&&Object.values(Mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.ss=m,this.os=r,this.yl=c||u||p||d,this.ot=p||d?0:t.getValue("uploadProgress"),this.Cl=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Sl=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.w();try{let r=new AbortController;t.setValue("abortController",r);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File&&this.cfg.imageShrink)try{let d=Ya(this.cfg.imageShrink);d?l=await Qa(l,d):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let f=d.value*100;t.setValue("uploadProgress",f);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),mo(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.w();}catch(r){this.telemetryManager.sendEventError(r,"file upload. Failed to upload file"),r instanceof qt&&r.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof pe?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.w();}}});}static{a(this,"FileItem");}kl(){let t=this.entry;if(!t)return;let e=W.IDLE;t.getValue("errors").length>0?e=W.FAILED:t.getValue("isQueuedForUploading")?e=W.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=W.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=W.VALIDATION:t.getValue("isUploading")?e=W.UPLOADING:t.getValue("fileInfo")&&(e=W.FINISHED),this.Gd(t,e);}Gd(t,e){e===W.FAILED?this.ns="badge-error":e===W.FINISHED&&(this.ns="badge-success"),e===W.UPLOADING&&(this.El=false,this.removeAttribute("focused")),this.wl=e===W.FAILED,this.xl=e===W.UPLOADING,this.bl=e===W.FINISHED,this.Tl=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.qd(e);}reset(){super.reset(),this.w.cancel();}Ne(t){let[e]=t;e&&e.isIntersecting&&!this.Al&&(this.gl=false,this.Al=true);}Ol(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.w();}),this.subEntry("isValidationPending",()=>{this.w();}),this.subEntry("uploadProgress",()=>{this.w();}),this.subEntry("isQueuedForUploading",()=>{this.w();}),this.subEntry("fileName",r=>{this.rs=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.w();}),this.subEntry("externalUrl",r=>{this.rs=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.w();}),this.subEntry("errors",()=>this.w()),this.subEntry("isUploading",()=>this.w()),this.subEntry("fileSize",()=>this.w()),this.subEntry("mimeType",()=>this.w()),this.subEntry("isImage",()=>this.w()),this.kl());}Il(t){if(this.cfg.filesViewMode==="list"){this.nr=true;return}this.nr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Ol(this.uid);}initCallback(){super.initCallback(),this.Ol(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.w()),this.subConfigValue("filesViewMode",t=>{this.Il(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.Il(t);}),this.onclick=()=>{j.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Sl());}),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.Ne.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.gl?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?finished=${this.bl} ?uploading=${this.xl} ?failed=${this.wl} ?focused=${this.El}><uc-thumb .uid=${this.uid} .badgeIcon=${this.ns}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Cl}><span class="uc-file-name" ?hidden=${!this.nr}>${this.rs}</span><span class="uc-file-error" ?hidden=${!this.os}>${this.os}</span><span class="uc-file-hint" ?hidden=${!this.ss}>${this.ss}</span></div><div class="uc-file-actions"><button type="button" @click=${this.Hd} ?hidden=${!this.Tl} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.jd} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Kd}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.ot} .visible=${this.yl} ?hasFileName=${this.nr}></uc-progress-bar></div>`}};h([g()],j.prototype,"gl",2),h([x({type:String,attribute:false})],j.prototype,"uid",2),h([g()],j.prototype,"rs",2),h([g()],j.prototype,"os",2),h([g()],j.prototype,"ss",2),h([g()],j.prototype,"ot",2),h([g()],j.prototype,"yl",2),h([g()],j.prototype,"ns",2),h([g()],j.prototype,"bl",2),h([g()],j.prototype,"wl",2),h([g()],j.prototype,"xl",2),h([g()],j.prototype,"El",2),h([g()],j.prototype,"Tl",2),h([g()],j.prototype,"nr",2),h([g()],j.prototype,"Cl",2);var vs=j;var bi=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Ml="upload-file";this.Wd=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.Ml=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.Wd}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.Ml)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([x({attribute:"dropzone",type:Boolean})],bi.prototype,"dropzone",2),h([g()],bi.prototype,"Ml",2);var Ja="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var jt=class extends T{constructor(){super(...arguments);this.init$=sn(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this);}render(){return y`${xr(Ja)}`}};var Fr=class extends jt{constructor(){super();this.headless=false;this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderRegular");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([x({type:Boolean})],Fr.prototype,"headless",2);var gs=class extends it{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var _r=class extends jt{constructor(){super();this.Ll=false;this.kt=()=>{if(this.Ul){let t=this.$["*historyBack"];t?.();return}this.Rl&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderInline");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Ul(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==b.activities.START_FROM}get Rl(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}as(){return this.getCssData("--cfg-init-activity")||b.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.as();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Ll=this.Ul||this.Rl;});}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.kt} ?hidden=${!this.Ll} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};h([g()],_r.prototype,"Ll",2);var ys="active",Nr="",Te=class extends jt{constructor(){super();this.ls=false;this.ar=false;this.lr=Nr;this.cs=Nr;this.Ve=t=>{t.id===b.activities.CLOUD_IMG_EDIT&&(this.lr=ys),this.$["*currentActivity"]===b.activities.UPLOAD_LIST&&(this.lr=ys,this.ar=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.cs=ys);};this.Fe=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.ar=false),t.id===b.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderMinimal");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}as(){return this.getCssData("--cfg-init-activity")||b.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.as();this.sub("*currentActivity",e=>{e===b.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.cs=Nr):(this.lr=Nr,this.ar=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.ls=!r):(this.style.removeProperty("--uc-grid-col"),this.ls=false);});}),this.modalManager?.subscribe(K.OPEN,this.Ve),this.modalManager?.subscribe(K.CLOSE,this.Fe);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(K.OPEN,this.Ve),this.modalManager?.unsubscribe(K.CLOSE,this.Fe);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.ar} class=${this.cs}><uc-drop-area ?single=${this.ls} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.lr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([g()],Te.prototype,"ls",2),h([g()],Te.prototype,"ar",2),h([g()],Te.prototype,"lr",2),h([g()],Te.prototype,"cs",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
7
+ var bs=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var a=(o,i)=>bs(o,"name",{value:i,configurable:true});var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?el(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&bs(i,t,r),r};var wt=[],Kt=0,wi=4,ws=a(o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Kt+wi;s<wt.length;)wt[s]===e?wt.splice(s,wi):s+=wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!wt.length;for(let n of i)wt.push(n,t.value,e,r);if(s){for(Kt=0;Kt<wt.length;Kt+=wi)wt[Kt](wt[Kt+1],wt[Kt+2],wt[Kt+3]);wt.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t},"atom");function Br(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}a(Br,"listenKeys");var Hr=a((o={})=>{let i=ws(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i},"map");var z=class o{static{a(this,"PubSub");}static{this.Me=new Map;}constructor(i,t){this.Z=t;}pub(i,t){i in this.Z.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.Z.setKey(i,t);}sub(i,t,e=true){return i in this.Z.get()||console.warn(`PubSub#sub: Key "${String(i)}" not found`),e&&t(this.Z.get()[i]),{remove:Br(this.Z,[i],s=>{t(s[i]);})}}read(i){return i in this.Z.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.Z.get()[i]}add(i,t,e=false){(!(i in this.Z.get())||e)&&this.Z.setKey(i,t);}has(i){return i in this.Z.get()}get store(){return this.Z.get()}static registerCtx(i,t){if(o.Me.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Hr(i);return o.Me.set(t,e),new o(t,e)}static deleteCtx(i){o.Me.delete(i);}static getCtx(i){let t=o.Me.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Me.has(i)}};var xi=globalThis,Ti=xi.ShadowRoot&&(xi.ShadyCSS===void 0||xi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Es=Symbol(),xs=new WeakMap,Ei=class{static{a(this,"n");}constructor(i,t,e){if(this.Rl=true,e!==Es)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(Ti&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=xs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&xs.set(t,i));}return i}toString(){return this.cssText}},Ts=a(o=>new Ei(typeof o=="string"?o:o+"",void 0,Es),"r");var Cs=a((o,i)=>{if(Ti)o.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(let t of i){let e=document.createElement("style"),r=xi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),jr=Ti?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Ts(t)})(o):o;var{is:rl,defineProperty:ol,getOwnPropertyDescriptor:sl,getOwnPropertyNames:nl,getOwnPropertySymbols:al,getPrototypeOf:ll}=Object,Ci=globalThis,As=Ci.trustedTypes,cl=As?As.emptyScript:"",ul=Ci.reactiveElementPolyfillSupport,Ge=a((o,i)=>o,"d"),qe={toAttribute(o,i){switch(i){case Boolean:o=o?cl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},Ai=a((o,i)=>!rl(o,i),"f"),Ss={attribute:true,type:String,converter:qe,reflect:false,useDefault:false,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),Ci.litPropertyMetadata??=new WeakMap;var $t=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.lr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.ni&&[...this.ni.keys()]}static createProperty(i,t=Ss){if(t.state&&(t.attribute=false),this.lr(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&ol(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=sl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let l=r?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Ss}static lr(){if(this.hasOwnProperty(Ge("elementProperties")))return;let i=ll(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ge("finalized")))return;if(this.finalized=true,this.lr(),this.hasOwnProperty(Ge("properties"))){let t=this.properties,e=[...nl(t),...al(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.ni=new Map;for(let[t,e]of this.elementProperties){let r=this.cr(t,e);r!==void 0&&this.ni.set(r,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let r of e)t.unshift(jr(r));}else i!==void 0&&t.push(jr(i));return t}static cr(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.ai=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.se=null,this.Pl();}Pl(){this.ur=new Promise((i=>this.enableUpdating=i)),this.zt=new Map,this.$l(),this.requestUpdate(),this.constructor.l?.forEach((i=>i(this)));}addController(i){(this.Le??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Le?.delete(i);}$l(){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.ai=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Cs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Le?.forEach((i=>i.hostConnected?.()));}enableUpdating(i){}disconnectedCallback(){this.Le?.forEach((i=>i.hostDisconnected?.()));}attributeChangedCallback(i,t,e){this.dr(i,e);}Dl(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.cr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:qe).toAttribute(t,e.type);this.se=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.se=null;}}dr(i,t){let e=this.constructor,r=e.ni.get(i);if(r!==void 0&&this.se!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:qe;this.se=r;let l=n.fromAttribute(t,s.type);this[r]=l??this.pr?.get(r)??l,this.se=null;}}requestUpdate(i,t,e){if(i!==void 0){let r=this.constructor,s=this[i];if(e??=r.getPropertyOptions(i),!((e.hasChanged??Ai)(s,t)||e.useDefault&&e.reflect&&s===this.pr?.get(i)&&!this.hasAttribute(r.cr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.ur=this.Vl());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.pr??=new Map).has(i)&&(this.pr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.zt.has(i)||(this.hasUpdated||e||(t=void 0),this.zt.set(i,t)),r===true&&this.se!==i&&(this.cs??=new Set).add(i));}async Vl(){this.isUpdatePending=true;try{await this.ur;}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.ai){for(let[r,s]of this.ai)this[r]=s;this.ai=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,l=this[r];n!==true||this.zt.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.zt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Le?.forEach((e=>e.hostUpdate?.())),this.update(t)):this.hr();}catch(e){throw i=false,this.hr(),e}i&&this.Fl(t);}willUpdate(i){}Fl(i){this.Le?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}hr(){this.zt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.ur}shouldUpdate(i){return true}update(i){this.cs&&=this.cs.forEach((t=>this.Dl(t,this[t]))),this.hr();}updated(i){}firstUpdated(i){}};$t.elementStyles=[],$t.shadowRootOptions={mode:"open"},$t[Ge("elementProperties")]=new Map,$t[Ge("finalized")]=new Map,ul?.({ReactiveElement:$t}),(Ci.reactiveElementVersions??=[]).push("2.1.1");var Gr=globalThis,Si=Gr.trustedTypes,ks=Si?Si.createPolicy("lit-html",{createHTML:a(o=>o,"createHTML")}):void 0,qr="$lit$",Dt=`lit$${Math.random().toFixed(9).slice(2)}$`,Wr="?"+Dt,dl=`<${Wr}>`,ce=document,Ze=a(()=>ce.createComment(""),"l"),Xe=a(o=>o===null||typeof o!="object"&&typeof o!="function","c"),Zr=Array.isArray,Rs=a(o=>Zr(o)||typeof o?.[Symbol.iterator]=="function","u"),Kr=`[ \f\r]`,We=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Os=/-->/g,Is=/>/g,ae=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ms=/'/g,Ls=/"/g,Ps=/^(?:script|style|textarea|title)$/i,Xr=a(o=>(i,...t)=>({Bt:o,strings:i,values:t}),"y"),y=Xr(1);Xr(2);Xr(3);var Y=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Us=new WeakMap,le=ce.createTreeWalker(ce,129);function $s(o,i){if(!Zr(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ks!==void 0?ks.createHTML(i):i}a($s,"P");var Ds=a((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=We;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===We?p[1]==="!--"?n=Os:p[1]!==void 0?n=Is:p[2]!==void 0?(Ps.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=ae):p[3]!==void 0&&(n=ae):n===ae?p[0]===">"?(n=r??We,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?ae:p[3]==='"'?Ls:Ms):n===Ls||n===Ms?n=ae:n===Os||n===Is?n=We:(n=ae,r=void 0);let m=n===ae&&o[l+1].startsWith("/>")?" ":"";s+=n===We?c+dl:d>=0?(e.push(u),c.slice(0,d)+qr+c.slice(d)+Dt+m):c+Dt+(d===-2?l:m);}return [$s(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"V"),Qe=class o{static{a(this,"N");}constructor({strings:i,Bt:t},e){let r;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=Ds(i,t);if(this.el=o.createElement(u,e),le.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=le.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(qr)){let f=p[n++],m=r.getAttribute(d).split(Dt),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:v[2],strings:m,ctor:v[1]==="."?Oi:v[1]==="?"?Ii:v[1]==="@"?Mi:de}),r.removeAttribute(d);}else d.startsWith(Dt)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(Ps.test(r.tagName)){let d=r.textContent.split(Dt),f=d.length-1;if(f>0){r.textContent=Si?Si.emptyScript:"";for(let m=0;m<f;m++)r.append(d[m],Ze()),le.nextNode(),c.push({type:2,index:++s});r.append(d[f],Ze());}}}else if(r.nodeType===8)if(r.data===Wr)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Dt,d+1))!==-1;)c.push({type:7,index:s}),d+=Dt.length-1;}s++;}}static createElement(i,t){let e=ce.createElement("template");return e.innerHTML=i,e}};function ue(o,i,t=o,e){if(i===Y)return i;let r=e!==void 0?t._l?.[e]:t.Nl,s=Xe(i)?void 0:i.fr;return r?.constructor!==s&&(r?.us?.(false),s===void 0?r=void 0:(r=new s(o),r.mr(o,t,e)),e!==void 0?(t._l??=[])[e]=r:t.Nl=r),r!==void 0&&(i=ue(o,r.zl(o,i.values),r,e)),i}a(ue,"S");var ki=class{static{a(this,"M");}constructor(i,t){this.ds=[],this.mt=void 0,this.ps=i,this.c=t;}get parentNode(){return this.c.parentNode}get X(){return this.c.X}u(i){let{el:{content:t},parts:e}=this.ps,r=(i?.creationScope??ce).importNode(t,true);le.currentNode=r;let s=le.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Ce(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Li(s,this,i)),this.ds.push(u),c=e[++l];}n!==c?.index&&(s=le.nextNode(),n++);}return le.currentNode=ce,r}p(i){let t=0;for(let e of this.ds)e!==void 0&&(e.strings!==void 0?(e.vt(i,e,t),t+=e.strings.length-2):e.vt(i[t])),t++;}},Ce=class o{static{a(this,"R");}get X(){return this.c?.X??this.hs}constructor(i,t,e,r){this.type=2,this.r=R,this.mt=void 0,this.Tt=i,this.ne=t,this.c=e,this.options=r,this.hs=r?.isConnected??true;}get parentNode(){let i=this.Tt.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Tt}get endNode(){return this.ne}vt(i,t=this){i=ue(this,i,t),Xe(i)?i===R||i==null||i===""?(this.r!==R&&this.ae(),this.r=R):i!==this.r&&i!==Y&&this.fs(i):i.Bt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Rs(i)?this.k(i):this.fs(i);}O(i){return this.Tt.parentNode.insertBefore(i,this.ne)}T(i){this.r!==i&&(this.ae(),this.r=this.O(i));}fs(i){this.r!==R&&Xe(this.r)?this.Tt.nextSibling.data=i:this.T(ce.createTextNode(i)),this.r=i;}$(i){let{values:t,Bt:e}=i,r=typeof e=="number"?this.Bl(i):(e.el===void 0&&(e.el=Qe.createElement($s(e.h,e.h[0]),this.options)),e);if(this.r?.ps===r)this.r.p(t);else {let s=new ki(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Bl(i){let t=Us.get(i.strings);return t===void 0&&Us.set(i.strings,t=new Qe(i)),t}k(i){Zr(this.r)||(this.r=[],this.ae());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(Ze()),this.O(Ze()),this,this.options)):e=t[r],e.vt(s),r++;r<t.length&&(this.ae(e&&e.ne.nextSibling,r),t.length=r);}ae(i=this.Tt.nextSibling,t){for(this.li?.(false,true,t);i!==this.ne;){let e=i.nextSibling;i.remove(),i=e;}}setConnected(i){this.c===void 0&&(this.hs=i,this.li?.(i));}},de=class{static{a(this,"k");}get tagName(){return this.element.tagName}get X(){return this.c.X}constructor(i,t,e,r,s){this.type=1,this.r=R,this.mt=void 0,this.element=i,this.name=t,this.c=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=R;}vt(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=ue(this,i,t,0),n=!Xe(i)||i!==this.r&&i!==Y,n&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=ue(this,l[e+c],t,c),u===Y&&(u=this.r[c]),n||=!Xe(u)||u!==this.r[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.r[c]=u;}n&&!r&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Oi=class extends de{static{a(this,"H");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Ii=class extends de{static{a(this,"I");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Mi=class extends de{static{a(this,"L");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}vt(i,t=this){if((i=ue(this,i,t,0)??R)===Y)return;let e=this.r,r=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Li=class{static{a(this,"z");}constructor(i,t,e){this.element=i,this.type=6,this.mt=void 0,this.c=t,this.options=e;}get X(){return this.c.X}vt(i){ue(this,i);}},Vs={I:Ce},pl=Gr.litHtmlPolyfillSupport;pl?.(Qe,Ce),(Gr.litHtmlVersions??=[]).push("3.3.1");var Fs=a((o,i,t)=>{let e=t?.renderBefore??i,r=e.Hl;if(r===void 0){let s=t?.renderBefore??null;e.Hl=r=new Ce(i.insertBefore(Ze(),s),s,void 0,t??{});}return r.vt(o),r},"B");var Qr=globalThis,mt=class extends $t{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.vr=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.vr=Fs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.vr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.vr?.setConnected(false);}render(){return Y}};mt.Wd=true,mt.finalized=true,Qr.litElementHydrateSupport?.({LitElement:mt});var hl=Qr.litElementPolyfillSupport;hl?.({LitElement:mt});(Qr.litElementVersions??=[]).push("4.2.1");var fl=/\\([0-9a-fA-F]{1,6} ?)/g;function ml(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}a(ml,"hasLeadingTrailingQuotes");function vl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(vl,"trimQuotes");function gl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}a(gl,"escapeQuotes");function _s(o){let i=o;ml(o)&&(i=vl(i),i=i.replace(fl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=gl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(_s,"parseCssPropertyValue");function Ae(o){class i extends o{constructor(){super(...arguments);this.ms=null;this.gr=null;}static{a(this,"CssDataMixinClass");}getCssData(r,s=false){let n=this.ms??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.gr||(this.gr=window.getComputedStyle(this));let l=this.gr.getPropertyValue(r).trim();try{n[r]=_s(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),n[r]=null;}}return this.ms=n,n[r]}}return i}a(Ae,"CssDataMixin");function Ui(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Ht={};this.jt=null;this.ci=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.jt||(this.jt=Array.from(this.childNodes)),super.connectedCallback();}jl(){if(this.ci)return;this.ci=true,this.Ht={};let r=Array.from(this.childNodes),s=r.length?r:this.jt??[];for(let n of s){let l=this.vs(n),c=this.Ht[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Ht[l]=c;}this.jt=null;}vs(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.vs(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Kl(r){return !r.textContent||!r.textContent.trim()}Gl(r){let s=this.Ht[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Kl(n))}update(r){!this.hasUpdated&&this.willYield&&this.jl(),super.update(r);}yield(r,s){if(r===""&&!this.Ht[r]&&!this.ci&&this.jt?.length){let l=[];for(let c of this.jt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Ht[r]=l,this.ci=true,this.jt=null;}let n=this.Ht[r];return y` ${n} ${this.Gl(r)?s:void 0} `}}return i}a(Ui,"LightDomMixin");function Se(o){class i extends o{static{a(this,"RegisterableElementMixinClass");}static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}a(Se,"RegisterableElementMixin");var Gt=class extends Event{static{a(this,"s");}constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var ke=class{static{a(this,"s");}constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Gt(this.context,this.host,this.t,this.subscribe));}};var Ri=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Yr=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Oe=class extends Ri{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Gt(this.context,l,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Yr(this.context,this.host));}};var bl={attribute:true,type:String,converter:qe,reflect:false,hasChanged:Ai},wl=a((o=bl,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,o);},init(l){return l!==void 0&&this.C(n,void 0,o,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,o);}}throw Error("Unsupported decorator location: "+e)},"r");function x(o){return (i,t)=>typeof t=="object"?wl(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}a(x,"n");function g(o){return x({...o,state:true,attribute:false})}a(g,"r");function $(o,i){let t,e=a(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a($,"debounce");var Ns="ctx-name-context";function $i(){return function(o){class i extends o{constructor(...r){super(...r);this.tt=null;this.Ue=false;this.yr=false;this.br=void 0;this.le=new Map;this.Re=new Set;this.init$={};this.ctxOwner=false;this.ui=void 0;this.di=false;this.ctxName=this.Mt;this.Lt=false;this.ui=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Mt,this.ql=new ke(this,{context:Ns,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.bs=s,this.ys();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}get gs(){return this.ui}set gs(r){let s=r??void 0;this.ui!==s&&(this.ui=s,this.ys());}shouldUpdate(r){return this.Lt?super.shouldUpdate(r):false}get Mt(){return this.gs||this.bs||void 0}ys(){if(this.ctxName=this.Mt,!(!this.ctxName||this.Ue)){if(this.isConnected){this.wr();return}this.di=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Mt,this.ctxName&&(this.br?this.br.setValue(this.ctxName):this.br=new Oe(this,{context:Ns,initialValue:this.ctxName}));}xs(){if(!(!this.tt||this.le.size===0)){for(let[r,{value:s,rewrite:n}]of this.le)this.tt.add(r,s,n);this.le.clear();}}Es(){return !this.tt&&this.Mt&&this.xr(),this.tt&&this.xs(),this.tt}Er(){let r=this.Es();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}xr(){let r=this.init$,s=this.Mt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.tt){this.tt=z.getCtx(s)??z.registerCtx(r,s);for(let[n,l]of Object.entries(this.init$))this.tt.add(n,l,this.ctxOwner);this.xs();}}get $(){return this.Mt&&this.xr(),new Proxy({},{get:a((r,s)=>{if(typeof s=="string")return this.tt?.read(s)},"get"),set:a((r,s,n)=>(typeof s!="string"||this.tt?.pub(s,n),true),"set")})}sub(r,s,n=true){let l=this.Er().sub(r,s,n);if(!l||typeof l.remove!="function")return ()=>{};let c=l.remove.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Re.delete(p));},"trackedRemove");return this.Re.add(p),p}pub(r,s){this.Er().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}has(r){return this.tt?.has(r)??false}add(r,s,n=false){let l=this.Es();if(!l){if(!n&&this.le.has(r))return;this.le.set(r,{value:s,rewrite:n});return}this.le.delete(r),l.add(r,s,n);}add$(r,s=false){for(let[n,l]of Object.entries(r))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Ue?this.Lt&&this.yr&&(this.yr=false,this.initCallback()):this.ctxName?(this.di=false,this.wr()):this.di&&this.Mt&&(this.di=false,this.wr());}wr(){if(this.Ue)return;this.Ue=true,this.xr();let r=this.init$;if(Object.keys(r).length>0){let s=this.Er();for(let[n,l]of Object.entries(r))s.read(n)===void 0&&s.pub(n,l),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Lt=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.Wl(),super.disconnectedCallback(),this.Ue&&(this.yr=true);}Wl(){if(this.Re.size!==0){for(let r of [...this.Re])r();this.Re.clear();}}initCallback(){}}return h([x({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"gs",1),h([g()],i.prototype,"bs",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Lt",2),i}}a($i,"SymbioteMixin");var Jr=class extends Se($i()(Ae(Ui(mt)))){static{a(this,"BaseComponent");}};var Vt=class{static{a(this,"UID");}static generate(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}};var xl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function to(o){for(let i in o){if(xl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}a(to,"defineComponents");var eo="UC";function El(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[eo]){t(window[eo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[eo];i&&to(s),t(s);},document.head.appendChild(r);})}a(El,"loadFileUploaderFrom");var Ye={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var io=new Map,zs=new Map,Bs=a((o,i)=>{io.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...Ye,...i};return io.set(o,t),t},"defineLocaleSync"),Tl=a((o,i)=>{zs.set(o,i);},"defineLocaleAsync"),Hs=a((o,i)=>{typeof i=="function"?Tl(o,i):Bs(o,i);},"defineLocale"),js=a(async o=>{let i=io.get(o);if(!i){let t=zs.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=Bs(o,e);}return i},"resolveLocaleDefinition");Hs("en",Ye);var K=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Di=class{constructor(i){this.Kt=new Map;this.gt=new Set;this.E=new Map;this.m=i;}static{a(this,"ModalManager");}v(...i){this.m.debugPrint("[modal-manager]",...i);}registerModal(i,t){this.Kt.set(i,t),this.q(K.ADD,{id:i,modal:t});}deleteModal(i){let t=this.Kt.get(i);return t?(this.Kt.delete(i),this.gt.delete(i),this.q(K.DELETE,{id:i,modal:t}),true):false}open(i){let t=this.Kt.get(i);return t?(this.gt.add(i),this.q(K.OPEN,{modal:t,id:i}),true):(this.v(`Modal with ID "${i}" not found`),false)}close(i){let t=this.Kt.get(i);return !t||!this.gt.has(i)?(this.v(`Modal with ID "${i}" not found or not active`),false):(this.gt.delete(i),this.q(K.CLOSE,{id:i,modal:t}),true)}toggle(i){return this.Kt.has(i)?this.gt.has(i)?this.close(i):this.open(i):(this.v(`Modal with ID "${i}" not found`),false)}get hasActiveModals(){return this.gt.size>0}back(){if(this.gt.size===0)return this.v("No active modals to go back from"),false;let i=Array.from(this.gt).pop();return i?this.close(i):false}closeAll(){let i=this.gt.size;return this.gt.clear(),this.q(K.CLOSE_ALL,{}),i}subscribe(i,t){return this.E.has(i)||this.E.set(i,new Set),this.E.get(i)?.add(t),()=>this.unsubscribe(i,t)}unsubscribe(i,t){this.E.has(i)&&this.E.get(i)?.delete(t);}q(i,t){if(this.E.has(i))for(let e of this.E.get(i)??new Set)try{e(t);}catch(r){this.m.telemetryManager.sendEventError(r,"modal subscriber"),this.v("Error in modal subscriber:",r);}}destroy(){this.closeAll(),this.Kt.clear(),this.E.clear(),this.q(K.DESTROY,{});}};var Je=a(o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function Ks(o){return Object.prototype.toString.call(o)==="[object Object]"}a(Ks,"isObject");var Cl=/\W|_/g;function Al(o){return o.split(Cl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(Al,"camelizeString");function Gs(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>_t(t,{ignoreKeys:i})):o}a(Gs,"camelizeArrayItems");function _t(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Gs(o,{ignoreKeys:i});if(!Ks(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Ks(r)?r=_t(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Gs(r,{ignoreKeys:i})),t[Al(e)]=r;}return t}a(_t,"camelizeKeys");var Sl=a(o=>new Promise(i=>setTimeout(i,o)),"delay");function co({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),l=[s,r].filter(Boolean).join("; ");return `${n} (${l})`}a(co,"getUserAgent$1");var kl={factor:2,time:100};function Ol(o,i=kl){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a(l=>Sl(l??s).then(()=>(t+=1,e(r))),"retry")})}return a(e,"runAttempt"),e(o)}a(Ol,"retrier");var pe=class extends Error{static{a(this,"UploadcareError");}},Ie=class o extends pe{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},Vi=a((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),qt=class o extends pe{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Il=500,Ws=a(({check:o,interval:i=Il,timeout:t,signal:e})=>new Promise((r,s)=>{let n,l;Vi(e,()=>{n&&clearTimeout(n),s(new qt("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new qt("Timed out"));},t));let c=a(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Fi="application/octet-stream",Zs="original",Zt=a(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[f,m]=d;typeof m<"u"&&!Array.isArray(m)&&c.setRequestHeader(f,m);}),c.responseType="text",Vi(r,()=>{p=true,c.abort(),l(new qt);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(E){let C=E.split(": "),A=C.shift(),L=C.join(": ");A&&typeof A<"u"&&(m[A]=L);});let v=c.response,w=c.status;n({request:d,data:v,headers:m,status:w});}},c.onerror=d=>{p||l(new Ie(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 Ml(o,...i){return o}a(Ml,"identity");var Ll=a(({name:o})=>o?[o]:[],"getFileOptions"),Ul=Ml,Rl=a(()=>new FormData,"getFormData"),Xs=a(o=>false,"isBuffer"),_i=a(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),Ni=a(o=>typeof File<"u"&&o instanceof File,"isFile"),zi=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),Me=a(o=>_i(o)||Ni(o)||Xs()||zi(o),"isFileData"),Pl=a(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),$l=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Dl=a(o=>!!o&&typeof o=="object"&&"data"in o&&Me(o.data),"isFileValue");function Qs(o,i,t){if(Array.isArray(t))for(let e of t)Qs(o,`${i}[]`,e);else if(Dl(t)){let{name:e,contentType:r}=t,s=Ul(t.data,e,r??Fi),n=Ll({name:e,contentType:r});o.push([i,s,...n]);}else if($l(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Pl(t)&&t&&o.push([i,t.toString()]);}a(Qs,"collectParams");function Vl(o){let i=[];for(let[t,e]of Object.entries(o))Qs(i,t,e);return i}a(Vl,"getFormDataParams");function Bi(o){let i=Rl(),t=Vl(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}a(Bi,"buildFormData");var J=class o extends pe{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Fl=a(o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Ft=a((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fl(t)),e.toString()},"getUrl"),_l="6.18.2",Nl="UploadcareUploadClient",zl=_l;function fe(o){return co({libraryName:Nl,libraryVersion:zl,...o})}a(fe,"getUserAgent");var Bl="RequestThrottledError",qs=15e3,Hl=1e3;function jl(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return qs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:qs}a(jl,"getTimeoutFromThrottledRequest");function Xt(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Ol(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Bl&&r<t)return s(jl(n));if(n instanceof Ie&&r<e)return s((r+1)*Hl);throw n}))}a(Xt,"retryIfFailed");var Ys=a(o=>{let i="";return (_i(o)||Ni(o)||zi(o))&&(i=o.type),i||Fi},"getContentType"),Js=a(o=>{let i="";return Ni(o)&&o.name?i=o.name:_i(o)||Xs()?i="":zi(o)&&o.name&&(i=o.name),i||Zs},"getFileName");function uo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}a(uo,"getStoreValue");function Kl(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=U.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",url:Ft(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},data:Bi({file:{data:o,name:t||Js(o),contentType:e||Ys(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:uo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Kl,"base");var so;(function(o){o.Token="token",o.FileInfo="file_info";})(so||(so={}));function Gl(o,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},url:Ft(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:uo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Gl,"fromUrl");var nt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(nt||(nt={}));var ql=a(o=>"status"in o&&o.status===nt.Error,"isErrorResponse");function Wl(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}={}){return Xt(()=>Zt({method:"GET",headers:i?{"X-UC-User-Agent":fe({publicKey:i,integration:r,userAgent:s})}:void 0,url:Ft(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=_t(JSON.parse(c));if("error"in d&&!ql(d))throw new J(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(Wl,"fromUrlStatus");function Zl(o,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"POST",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:c,userAgent:u})},url:Ft(t,"/group/",{jsonerrors:1}),data:Bi({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:n}).then(({data:f,headers:m,request:v})=>{let w=_t(JSON.parse(f));if("error"in w)throw new J(w.error.content,w.error.errorCode,v,w,m);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(Zl,"group");function tn(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"GET",headers:{"X-UC-User-Agent":fe({publicKey:i,integration:s,userAgent:n})},url:Ft(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=_t(JSON.parse(u));if("error"in f)throw new J(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(tn,"info");function Xl(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return Xt(()=>Zt({method:"POST",url:Ft(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:d,userAgent:f})},data:Bi({filename:e||Zs,size:o,content_type:t||Fi,part_size:r,UPLOADCARE_STORE:uo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:E,headers:C,request:A})=>{let L=_t(JSON.parse(E));if("error"in L)throw new J(L.error.content,L.error.errorCode,A,L,C);return L.parts=Object.keys(L.parts).map(ht=>L.parts[Number(ht)]),L}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})}a(Xl,"multipartStart");function Ql(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||Fi}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Ql,"multipartUpload");function Yl(o,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return Xt(()=>Zt({method:"POST",url:Ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":fe({publicKey:i,integration:s,userAgent:n})},data:Bi({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=_t(JSON.parse(u));if("error"in f)throw new J(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Yl,"multipartComplete");function po(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Ws({check:a(p=>tn(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(po,"isReadyPoll");function Jl(o){return "defaultEffects"in o}a(Jl,"isGroupFileInfo");var he=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=Ft(t,`${r}/`),l=s?Ft(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,Jl(i)&&(this.defaultEffects=i.defaultEffects);}},tc=a((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:E})=>Kl(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:E}).then(({file:C})=>po(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new he(C,{baseCDN:w})),"uploadDirect"),ec=a((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>tn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new he(f,{baseCDN:d,fileName:t})).then(f=>(s&&s({isComputable:true,value:1}),f)),"uploadFromUploaded"),ic=a((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=a(n=>()=>{e=n,r.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return Vi(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),rc=window.WebSocket,no=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},oc=a((o,i)=>o==="success"?{status:nt.Success,...i}:o==="progress"?{status:nt.Progress,...i}:{status:nt.Error,...i},"response"),ao=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new no;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 rc(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,oc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},ro=null,ho=a(o=>{if(!ro){let i=typeof window>"u"?0:3e4;ro=new ao(o,i);}return ro},"getPusher"),sc=a(o=>{ho(o).connect();},"preconnect");function nc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return Ws({check:a(u=>Wl(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case nt.Error:return new J(p.error,p.errorCode);case nt.Waiting:return false;case nt.Unknown:return new J(`Token "${o}" was not found.`);case nt.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case nt.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(nc,"pollStrategy");var ac=a(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=ho(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(o);},"destroy");Vi(t,()=>{c(),s(new qt("pusher cancelled"));}),n.subscribe(o,u=>{switch(u.status){case nt.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case nt.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case nt.Error:c(),s(new J(u.msg,u.error_code));}});}),"pushStrategy"),lc=a((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:E=U.pusherKey,metadata:C})=>Promise.resolve(sc(E)).then(()=>Gl(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(A=>(ho(E)?.disconnect(),Promise.reject(A))).then(A=>A.type===so.FileInfo?A:ic([({signal:L})=>nc({token:A.token,publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:L}),({signal:L})=>ac({token:A.token,pusherKey:E,signal:L,onProgress:d})],{signal:p})).then(A=>{if(A instanceof J)throw A;return A}).then(A=>po(A.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(A=>new he(A,{baseCDN:r})),"uploadFromUrl"),oo=new WeakMap,cc=a(async o=>{if(oo.has(o))return oo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return oo.set(o,i),i},"getBlobFromReactNativeAsset"),en=a(async o=>{if(Ni(o)||_i(o))return o.size;if(zi(o))return (await cc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),uc=a((o,i=U.multipartMinFileSize)=>o>=i,"isMultipart"),rn=a(o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Me(o)&&t.test(o)},"isUuid"),fo=a(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Me(o)&&t.test(o)},"isUrl"),dc=a((o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,n-=1,n?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),pc=a((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),hc=a(async(o,i,t)=>e=>pc(o,e,i,t),"prepareChunks"),fc=a((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Ql(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),mc=a(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:E=U.multipartChunkSize,maxConcurrentRequests:C=U.maxConcurrentRequests,baseCDN:A,metadata:L})=>{let ht=e??await en(o),ft,ne=a((Z,st)=>{if(!u)return;ft||(ft=Array(Z).fill(0));let bt=a(At=>At.reduce((Pt,zr)=>Pt+zr,0),"sum");return At=>{At.isComputable&&(ft[st]=At.value,u({isComputable:true,value:bt(ft)/Z}));}},"createProgressHandler");return w||=Ys(o),Xl(ht,{publicKey:i,contentType:w,fileName:t||Js(o),baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:L,multipartChunkSize:E}).then(async({uuid:Z,parts:st})=>{let bt=await hc(o,ht,E);return Promise.all([Z,dc(C,st.map((At,Pt)=>()=>fc(bt(Pt),At,{publicKey:i,contentType:w,onProgress:ne(st.length,Pt),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})))])}).then(([Z])=>Yl(Z,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})).then(Z=>Z.isReady?Z:po(Z.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(Z=>new he(Z,{baseCDN:A}))},"uploadMultipart");async function mo(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartMinFileSize:w,multipartChunkSize:E,maxConcurrentRequests:C,baseCDN:A=U.baseCDN,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:ht,pusherKey:ft,metadata:ne}){if(Me(o)){let Z=await en(o);return uc(Z,w)?mc(o,{publicKey:i,contentType:v,multipartChunkSize:E,fileSize:Z,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:ne}):tc(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A,metadata:ne})}if(fo(o))return lc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:ht,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:ft,metadata:ne});if(rn(o))return ec(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:A});throw new TypeError(`File uploading from "${o}" is not supported`)}a(mo,"uploadFile");var lo=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new he(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},vc=a(o=>{for(let i of o)if(!Me(i))return false;return true},"isFileDataArray"),gc=a(o=>{for(let i of o)if(!rn(i))return false;return true},"isUuidArray"),yc=a(o=>{for(let i of o)if(!fo(i))return false;return true},"isUrlArray");function on(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w=U.multipartChunkSize,baseCDN:E=U.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:A,jsonpCallback:L}){if(!vc(o)&&!yc(o)&&!gc(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let ht,ft=true,ne=o.length,Z=a((st,bt)=>{if(!c)return;ht||(ht=Array(st).fill(0));let At=a(Pt=>Pt.reduce((zr,tl)=>zr+tl)/st,"normalize");return Pt=>{if(!Pt.isComputable||!ft){ft=false,c({isComputable:false});return}ht[bt]=Pt.value,c({isComputable:true,value:At(ht)});}},"createProgressHandler");return Promise.all(o.map((st,bt)=>Me(st)||fo(st)?mo(st,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:Z(ne,bt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w,baseCDN:E,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:A}).then(At=>At.uuid):st)).then(st=>Zl(st,{publicKey:i,baseURL:e,jsonpCallback:L,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(bt=>new lo(bt,{baseCDN:E})).then(bt=>(c&&c({isComputable:true,value:1}),bt)))}a(on,"uploadFileGroup");var Wt=class{static{a(this,"Queue");}pi=1;Tr=[];hi=0;Cr=new Map;Ar=new Map;constructor(i){this.pi=i;}run(){let i=this.pi-this.hi;for(let t=0;t<i;t++){let e=this.Tr.shift();if(!e)return;let r=this.Cr.get(e),s=this.Ar.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.hi+=1,e().finally(()=>{this.Cr.delete(e),this.Ar.delete(e),this.hi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.Cr.set(i,e),this.Ar.set(i,r),this.Tr.push(i),t&&this.run();})}get pending(){return this.Tr.length}get running(){return this.hi}set concurrency(i){this.pi=i,this.run();}get concurrency(){return this.pi}};var vo=a(()=>({}),"blockCtx"),go=a(o=>({...vo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),yo=a(o=>({...go(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Wt(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),sn=a(o=>({...yo(o),"*solution":null}),"solutionBlockCtx");var bc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ti(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}a(ti,"focus");function bo(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=bc[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}a(bo,"findGroupNodeByEventTarget");function wo(o,i){return i.role==="toolbar"?wc(i):i.querySelectorAll(`[role=${o.role}]`)}a(wo,"getItems");function wc(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(wc,"getToolbarItems");function xc(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(xc,"isHorizontalOrientation");function nn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function n(d){let f=bo(d.target);if(!f){l();return}let m=wo(d.target,f),v=Array.from(m).indexOf(d.target),w="ArrowDown",E="ArrowUp";if(xc(f)&&(i.document.dir==="rtl"?(w="ArrowLeft",E="ArrowRight"):(w="ArrowRight",E="ArrowLeft")),d.key===w)d.preventDefault(),ti(d.target,m[v+1]||m[0]);else if(d.key===E)d.preventDefault(),ti(d.target,m[v-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),ti(d.target,m[0]);else if(d.key==="End")d.preventDefault(),ti(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let C=Date.now();C-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=C;let A=Array.from(m).find(L=>L.textContent?.trim()?.toLowerCase()?.startsWith(s));A&&(d.preventDefault(),ti(d.target,A));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let f=bo(d.target);if(f){t||(t=true,i.addEventListener("keydown",n));let m=wo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let f=bo(d.target);if(f){let m=wo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(nn,"focusGroupKeyUX");function an(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}a(an,"hiddenKeyUX");function ln(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let r=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}a(ln,"jumpKeyUX");function cn(o){let i,t=o.split(" "),e;function r(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(r,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}a(cn,"pressKeyUX");function un(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}a(un,"startKeyUX");var xo=class{constructor(){this.Pe=new Map;this.Sr=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(r=>{let s=r.target;s instanceof Node&&this.Sr.some(n=>n===s||n.contains(s))&&t(r);},"wrappedListener");this.Pe.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Pe.get(t);e&&window.removeEventListener(i,e),this.Pe.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Sr.push(i);}destroy(){this.Sr=[];for(let i of this.Pe.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Pe.clear();}},Hi=class{static{a(this,"A11y");}constructor(){this.fi=new xo,this.Ts=un(this.fi,[nn(),cn("is-pressed"),ln(),an()]);}registerBlock(i){this.fi.registerScope(i);}destroy(){this.Ts?.(),this.fi.destroy();}};var Qt=a(o=>`*l10n/${o}`,"localeStateKey"),Ec="en",ji=class{constructor(i){this.i=null;this.kr="";this.i=i;for(let[t,e]of Object.entries(Ye)){let r=this.i.has(Qt(t))?!this.i.$[Qt(t)]:true;this.i.add(Qt(t),e,r);}setTimeout(()=>{i.subConfigValue("localeName",async t=>{if(!this.i||!t)return;this.kr=t;let e=await js(t);if(t!==Ec&&this.kr!==t)return;let r=this.i.cfg.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let l=r?.[s];this.i.add(Qt(s),l??n,true);}}),i.subConfigValue("localeDefinitionOverride",t=>{if(!t)return;let e=t[this.kr];if(e)for(let[r,s]of Object.entries(e))this.i?.add(Qt(r),s,true);});});}static{a(this,"LocaleManager");}};function Tc(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(Tc,"i");function To(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?To(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Tc(i);return typeof t=="object"&&t!==null?[e,To(t)]:[e,t]}))}a(To,"c");function Cc(o){return {ok:true,value:o}}a(Cc,"u");function Eo(o){return {ok:false,error:o}}a(Eo,"a");var Ac="https://tlm.uploadcare.com/api/",Co=class{static{a(this,"y");}constructor(i=Ac){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Eo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Cc(s)}catch(s){return Eo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Eo(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(To(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Sc=a(async(o,i)=>({success:true,data:i}),"f"),Ki=class extends Co{static{a(this,"p");}constructor(){super();}async sendEvent(i,t){let e=await Sc(void 0,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 at=a(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Nt=a(o=>o.join(","),"serializeCsv");var dn=a(o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Gi=a((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>dn(i)).join("/-/"),"joinCdnOperations"),tt=a((...o)=>{let i=Gi(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function qi(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}a(qi,"extractFilename");function Wi(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}a(Wi,"extractUuid");function Ao(o){let i=pn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(Ao,"extractCdnUrlModifiers");function So(o){return Ao(o).split("/-/").filter(Boolean).map(t=>dn(t))}a(So,"extractOperations");function pn(o){let i=new URL(o),t=qi(o),e=hn(t)?fn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(pn,"trimFilename");function hn(o){return o.startsWith("http")}a(hn,"isFileUrl");function fn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(fn,"splitFileUrl");var G=a((o,i,t)=>{let e=new URL(pn(o)),r=t??qi(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&hn(r)){let n=fn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},"createCdnUrl"),Yt=a((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var q=a((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var ei=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),vn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function kc(o,i){if(typeof i=="number"){let t=i;return ei[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return ei[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return ei.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}a(kc,"transformationToStr");function Jt(o){return Gi(...vn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return kc(i,t)}).filter(i=>!!i))}a(Jt,"transformationsToOperations");var Zi=Gi("format/auto","progressive/yes"),zt=a(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),mn=a(()=>true,"asBoolean"),Oc=a(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),Ic=a(([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:q(o,"x").map(Number),coords:q(i).map(Number)}},"asCrop"),Mc=Object.freeze({enhance:zt,brightness:zt,exposure:zt,gamma:zt,contrast:zt,saturation:zt,vibrance:zt,warmth:zt,filter:Oc,mirror:mn,flip:mn,rotate:zt,crop:a(o=>{let[i,t]=o,{dimensions:e,coords:r}=Ic([i,t]);return {dimensions:e,coords:r}},"crop")});function ko(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!vn.includes(e))continue;let s=e,n=Mc[s];try{let l=n(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(ko,"operationsToTransformations");var F=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),et=Object.freeze([F.CROP,F.TUNING,F.FILTERS]),gn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),yn=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"]),bn=Object.freeze(["rotate","mirror","flip"]),Bt=ei,xt=Object.freeze({brightness:{zero:Bt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Bt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Bt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Bt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Bt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Bt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Bt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Bt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Bt.filter,range:[0,100],keypointsNumber:1}});var ii="https://ucarecdn.com",Lc="https://upload.uploadcare.com",Uc="https://social.uploadcare.com",Rc="https://ucarecd.net",Pc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:Nt(et),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:ii,cdnCnamePrefixed:Rc,baseUrl:Lc,socialBaseUrl:Uc,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true},lt=Object.freeze(Pc);var D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Xi=class{constructor(i){this.mi=new Map;this.Or=new Set;this.v=null;this.v=i;}static{a(this,"EventEmitter");}bindTarget(i){return this.Or.add(i),()=>{this.Or.delete(i);}}Cs(i,t){for(let e of this.Or)e.dispatchEvent(new CustomEvent(i,{detail:t}));this.v?.(()=>{let e=t&&typeof t=="object"?{...t}:t;return [`event "${i}"`,e]});}emit(i,t,e={}){let{debounce:r}=e;if(typeof r!="number"&&!r){this.Cs(i,typeof t=="function"?t():t);return}this.mi.has(i)&&window.clearTimeout(this.mi.get(i));let s=typeof r=="number"?r:20,n=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this.Cs(i,l),this.mi.delete(i);}catch(l){this.v?.(()=>`Error while getting payload for event "${i}"`,l);}},s);this.mi.set(i,n);}};var wn="1.25.0-alpha.7";var St="blocks",kt=wn;var Qi=class{constructor(i){this.Zl=crypto.randomUUID();this.ce=structuredClone(lt);this.Ir=false;this.Mr=null;this.Ut=true;this.m=i,this.As=new Ki,this.ue=new Wt(10),this.m.subConfigValue("qualityInsights",t=>{this.Ut=!!t;});for(let t of Object.keys(this.ce))this.m.subConfigValue(t,e=>{this.Ut&&(this.Ir&&this.ce[t]!==e&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.Xl(t,e));});}static{a(this,"TelemetryManager");}Yl(i){i===D.INIT_SOLUTION&&!this.Ir&&(this.Ir=true);}Xl(i,t){this.ce[i]!==t&&(this.ce[i]=t);}Ql(i){let t=i.payload?{...i.payload}:{};t.activity&&(t.activity=void 0);let e={...i};return (i.eventType===D.INIT_SOLUTION||i.eventType===D.CHANGE_CONFIG)&&(e.config=this.ce),{...e,appVersion:kt,appName:St,sessionId:this.Zl,component:this.Jl,activity:this.tc,projectPubkey:this.ce.pubkey,userAgent:navigator.userAgent,eventType:e.eventType??"",eventTimestamp:this.ec,payload:{location:this.ic,...t}}}rc(i){return !!(i&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(i))}sendEvent(i){if(!this.Ut)return;let t=this.Ql({eventType:i.eventType,payload:i.payload,config:i.config});this.Yl(i.eventType),!(this.rc(i.eventType)||this.Mr&&this.Ss(this.Mr,t))&&this.ue.add(async()=>{this.Mr=t,await this.As.sendEvent(t);});}sendEventError(i,t="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:i.message}}});}sendEventCloudImageEditor(i,t,e={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:t,node:i.currentTarget?.tagName,event:i.type,...e}}});}Ss(i,t){if(JSON.stringify(i)===JSON.stringify(t))return true;if(typeof i!="object"||typeof t!="object"||i==null||t==null)return false;let e=Object.keys(i),r=Object.keys(t);if(e.length!==r.length)return false;for(let s of e)if(!Object.hasOwn(t,s)||!this.Ss(i[s],t[s]))return false;return true}get ec(){return Date.now()}get Jl(){if(!this.m.has("*solution"))return null;let i=this.m.$["*solution"];return i?i.toLowerCase():null}get tc(){return this.m.has("*currentActivity")?this.m.$["*currentActivity"]??null:null}get ic(){return location.origin}};var X=a(o=>`*cfg/${o}`,"sharedConfigKey");var xn=a(o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Yi=a((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var Dc=a(o=>o,"DEFAULT_TRANSFORMER"),Oo="{{",Tn="}}",En="plural:";function ri(o,i={},t={}){let{openToken:e=Oo,closeToken:r=Tn,transform:s=Dc}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+n+r,u);}return o}a(ri,"applyTemplateData");function Cn(o){let i=[],t=o.indexOf(Oo);for(;t!==-1;){let e=o.indexOf(Tn,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(En)){let s=o.substring(t+2,e).replace(En,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:l});}t=o.indexOf(Oo,e);}return i}a(Cn,"getPluralObjects");var An="--uploadcare-blocks-window-height",oi=class o{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=$(()=>{document.documentElement.style.setProperty(An,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(An);}};var Vc=a(o=>o.tagName?.includes("-")??false,"isCustomElement"),Ji=class{constructor(i){this.Gt=new Set;this.vi=new Map;this.ks=false;this.qt=i,this.qt.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.gi?.(),this.gi=void 0,this.Gt.clear(),this.vi.clear();}hostUpdated(){if(!this.gi&&this.qt.has(X("testMode"))){let i=this.qt.subConfigValue("testMode",t=>{this.ks=!!t,this.Os();});this.gi=i;}this.oc(),this.Os();}oc(){let i=this.qt,t=i.renderRoot??i;if(!t)return;let e=this.qt,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Vc(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.Gt.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.Gt.add(n),this.vi.set(n,l);}for(let n of Array.from(this.Gt))(!n.isConnected||r&&n.closest(r)!==e)&&(this.Gt.delete(n),this.vi.delete(n));}Os(){if(!this.Gt.size)return;let i=this.qt.testId||"";for(let t of this.Gt){let e=this.vi.get(t);e&&(this.ks?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Fc=Se($i()(Ae(Ui(mt)))),T=class extends Fc{constructor(){super();this.yi=new Map;this.activityType=null;this.init$=vo();new Ji(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}l10n(t,e={}){if(!t)return "";let r=this.$[Qt(t)]||t,s=Cn(r);for(let l of s)e[l.variable]=this.sc(l.pluralKey,Number(e[l.countVariable]));return ri(r,e)}sc(t,e){let r=this.l10n("locale-id")||"en",s=Yi(r,e);return this.l10n(`${t}__${s}`)}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),oi.registerClient(this);}initCallback(){this.addSharedContextInstance("*blocksRegistry",()=>new Set,{persist:true}),this.addSharedContextInstance("*eventEmitter",()=>new Xi(this.debugPrint.bind(this)),{persist:true}),this.addSharedContextInstance("*localeManager",()=>new ji(this)),this.addSharedContextInstance("*modalManager",()=>new Di(this)),this.addSharedContextInstance("*a11y",()=>new Hi,{persist:true}),this.addSharedContextInstance("*telemetryManager",()=>new Qi(this)),this.sub(Qt("locale-id"),t=>{let e=xn(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.getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this.getSharedContextInstance("*telemetryManager")}get localeManager(){return this.getSharedContextInstance("*localeManager")}get a11y(){return this.getSharedContextInstance("*a11y")}get blocksRegistry(){return this.getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this.getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),oi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),this.Is(),t?.size===0&&setTimeout(()=>{!this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Is(true),z.deleteCtx(this.ctxName);}addSharedContextInstance(t,e,{persist:r=false}={}){if(!this.yi.has(t)&&(!this.has(t)||!this.$[t])){let s=e();this.add(t,s,true),this.yi.set(t,{persist:r,instance:s});return}}Is(t=false){for(let[e,r]of this.yi.entries()){let{persist:s,instance:n}=r;s&&!t||(n?.destroy?.(),this.pub(e,null),this.yi.delete(e));}}getSharedContextInstance(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:Wi(t),cdnUrlModifiers:Ao(t),fileName:qi(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?ri(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Lr){let t={};this.Lr=new Proxy(t,{set:a((e,r,s)=>{if(typeof r!="string"||!(r in lt))return false;let n=r,l=X(n);return this.has(l)||this.add(l,lt[n]),this.$[l]=s,true},"set"),get:a((e,r)=>{let s=X(r);return this.has(s)||this.add(s,lt[r]),this.$[s]},"get")});}return this.Lr}subConfigValue(t,e){let r=X(t);return this.has(r)||this.add(r,lt[t]),this.sub(r,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof t?.[0]=="function"){let r=t[0];e=r();}console.log(`[${this.ctxName}]`,...e);}};var si=class extends T{constructor(){super(...arguments);this.name="";this.Ur="";this.Ms=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.Ms=t,this.Ls();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ls();}Ls(){if(!this.name){this.Ur="";return}let t=`#uc-icon-${this.name}`,e=this.Ms?.(this.name);this.Ur=e??t;}render(){return y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Ur}></use></svg>`)} `}};h([x({type:String})],si.prototype,"name",2),h([g()],si.prototype,"Ur",2);var Sn=a(o=>[...new Set(o)],"uniqueArray");var me="--uc-img-",Io="unresolved";var Mo=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Lo=3e3,Uo=5e3,Ro=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var _c="https://ucarecdn.com",Le=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:_c},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var tr=class extends Ae(Se(mt)){constructor(){super();this.de={};this.E=new Map;this.pe=null;this.bi=null;for(let t in Le){let e=Le[t];this.de[me+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.de[me+t]}set$$(t){for(let e in t){let r=me+e,s=t[e];this.de[r]=s,this.q(r,s);}}sub$$(t,e){let r=me+t;this.E.has(r)||this.E.set(r,new Set),this.E.get(r)?.add(e);let s=this.de[r];s!==null&&s!==""&&e(s);}q(t,e){this.E.has(t)&&this.E.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${St}/${kt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Le[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.pe=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.pe?.unobserve(t));});},r),this.pe.observe(t),this.bi||(this.bi=new Set),this.bi.add(t);}connectedCallback(){super.connectedCallback(),this.nc();}nc(){for(let t in Le){let e=me+t,r=this.getCssData(e,true);r!=null&&(this.de[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.pe&&(this.bi?.forEach(t=>{this.pe?.unobserve(t);}),this.pe=null),this.E.clear();}static get observedAttributes(){return Object.keys(Le)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=me+t;this.de[s]=r,this.q(s,r);});}};var kn=a(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var rr=class extends tr{constructor(){super(...arguments);this.Ct=new Image;this.yt=new Image;}static{a(this,"ImgBase");}Us(t){return !t.includes("//")&&!Mo&&(t=new URL(t,document.baseURI).href),t}wi(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>Uo&&this.Rs?Uo+s:Number(n)>Lo&&!this.Rs?Lo+s:t}ac(t,e){let r={format:this.Rr("format"),quality:this.Rr("quality"),resize:this.wi(t),blur:e,"cdn-operations":this.Rr("cdn-operations")??void 0,analytics:this.analyticsParams()};return tt(...kn(r))}Rr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}et(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(Mo&&r&&!r.includes("//"))return this.$e(r);let s=this.ac(t,e),n=this.$$("cdn-cname"),l=n;if(r.startsWith(String(n)))return G(r,s);let c=this.$$("uuid");if(l&&c)return this.$e(G(Yt(l,c),s));if(c)return this.$e(G(Yt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.$e(G(u,s,this.Us(r)));let p=this.$$("pubkey");if(p)return this.$e(G(`https://${p}.ucr.io/`,s,this.Us(r)))}$e(t){let e=this.$$("secure-delivery-proxy");return e?ri(e,{previewUrl:t},{transform:a(r=>window.encodeURIComponent(r),"transform")}):t}he(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}cc(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.At||(this.Pr({elNode:this.Ct}),this.appendChild(this.Ct)),this.Ct}get xi(){return this.At?{type:Ro.PREVIEW,img:this.yt}:{type:Ro.MAIN,img:this.img}}get At(){return this.$$("is-preview-blur")}get Ps(){return this.$$("is-background-for")}get $s(){let t=this.$$("breakpoints");if(t){let e=q(t);return Sn(e.map(r=>parseInt(r,10)))}else return null}get Rs(){return this.$$("format").toLowerCase()==="jpeg"}Ds(t){let e=new Set;e.add(`url("${this.et(this.he(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.et(this.he(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.et(this.he(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}Vs(){let t=new Set;return this.$s?this.$s.forEach(e=>{t.add(`${this.et(`${e}x`)} ${this.wi(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.et(`${e*2}x`)} ${this.wi(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.et(`${e*3}x`)} ${this.wi(`${e*3}w`)}`);}):(t.add(`${this.et(this.he(this.xi.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.et(this.he(this.xi.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.et(this.he(this.xi.img,3))} 3x`)),[...t].join()}Fs(){return this.et()}get _s(){return this.et("100x","100")}uc(){let t=this.Ps;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Ds(e);}):this.Ds(e);});}dc({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Pr({elNode:t}){this.cc(t),this.initAttributes(t);}$r({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Pr({elNode:r}),r.setAttribute(Io,""),r.addEventListener("load",()=>{r.removeAttribute(Io),s(r);}),r.addEventListener("error",()=>{n(false);}),this.dc({elNode:r,src:t,srcset:e});})}async pc(){if(this.$$("intersection")){this.At&&(this.Pr({elNode:this.yt}),this.appendChild(this.yt)),this.initIntersection(this.xi.img,async()=>{this.At&&(this.yt.src=this._s);try{await this.$r({src:this.Fs(),srcset:this.Vs(),elNode:this.Ct}),this.At&&await this.yt.remove(),this.appendChild(this.Ct);}catch{this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}});return}try{this.At&&(await this.$r({src:this._s,elNode:this.yt}),this.appendChild(this.yt)),await this.$r({src:this.Fs(),srcset:this.Vs(),elNode:this.Ct}),this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}catch{this.At&&await this.yt?.remove(),this.appendChild(this.Ct);}}init(){this.Ps?this.uc():this.pc();}};var Po=class extends rr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Nc}=Vs;var In=a(o=>o.strings===void 0,"f"),On=a(()=>document.createComment(""),"r"),Ue=a((o,i,t)=>{let e=o.Tt.parentNode,r=i===void 0?o.ne:i.Tt;if(t===void 0){let s=e.insertBefore(On(),r),n=e.insertBefore(On(),r);t=new Nc(s,n,o,o.options);}else {let s=t.ne.nextSibling,n=t.c,l=n!==o;if(l){let c;t.hc?.(o),t.c=o,t.li!==void 0&&(c=o.X)!==n.X&&t.li(c);}if(s!==r||l){let c=t.Tt;for(;c!==s;){let u=c.nextSibling;e.insertBefore(c,r),c=u;}}}return t},"s"),te=a((o,i,t=o)=>(o.vt(i,t),o),"v"),zc={},Mn=a((o,i=zc)=>o.r=i,"m"),Ln=a(o=>o.r,"p"),or=a(o=>{o.ae(),o.Tt.remove();},"M");var Ot={ATTRIBUTE:1,CHILD:2},ct=a(o=>(...i)=>({fr:o,values:i}),"e"),vt=class{static{a(this,"i");}constructor(i){}get X(){return this.c.X}mr(i,t,e){this.Ei=i,this.c=t,this.fc=e;}zl(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var ni=a((o,i)=>{let t=o.mt;if(t===void 0)return false;for(let e of t)e.us?.(i,false),ni(e,i);return true},"s"),sr=a(o=>{let i,t;do{if((i=o.c)===void 0)break;t=i.mt,t.delete(o),o=i;}while(t?.size===0)},"o"),Un=a(o=>{for(let i;i=o.c;o=i){let t=i.mt;if(t===void 0)i.mt=t=new Set;else if(t.has(o))break;t.add(o),jc(i);}},"r");function Bc(o){this.mt!==void 0?(sr(this),this.c=o,Un(this)):this.c=o;}a(Bc,"h");function Hc(o,i=false,t=0){let e=this.r,r=this.mt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)ni(e[s],false),sr(e[s]);else e!=null&&(ni(e,false),sr(e));else ni(this,o);}a(Hc,"n");var jc=a(o=>{o.type==Ot.CHILD&&(o.li??=Hc,o.hc??=Bc);},"c"),nr=class extends vt{static{a(this,"f");}constructor(){super(...arguments),this.mt=void 0;}mr(i,t,e){super.mr(i,t,e),Un(this),this.isConnected=i.X;}us(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(ni(this,i),sr(this));}setValue(i){if(In(this.Ei))this.Ei.vt(i,this);else {let t=[...this.Ei.r];t[this.fc]=i,this.Ei.vt(t,this,0);}}disconnected(){}reconnected(){}};var S=a(()=>new Do,"e"),Do=class{static{a(this,"h");}},$o=new WeakMap,M=ct(class extends nr{render(o){return R}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),R}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=$o.get(i);t===void 0&&(t=new WeakMap,$o.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?$o.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 Vo=null,Fo=class extends T{constructor(){super(...arguments);this.dialogEl=S();this.Ns=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");};this.mc=()=>{this.Ns();};this.vc=t=>{this.Dr=t.target;};this.gc=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Dr&&this.Ns();};this.De=({id:t})=>{t===this.id?(Vo=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.Ve=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.zs=t=>{this.hide(),Vo===this.id&&this.emit(I.MODAL_CLOSE,{modalId:Vo,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(K.OPEN,this.De),this.modalManager?.subscribe(K.CLOSE,this.Ve),this.modalManager?.subscribe(K.CLOSE_ALL,this.zs);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Dr=void 0,this.modalManager?.unsubscribe(K.OPEN,this.De),this.modalManager?.unsubscribe(K.CLOSE,this.Ve),this.modalManager?.unsubscribe(K.CLOSE_ALL,this.zs);}yc(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.mc),this.dialogEl.value?.addEventListener("mousedown",this.vc),this.dialogEl.value?.addEventListener("mouseup",this.gc);}render(){return y`<dialog ${M(this.yc)}>${this.yield("")}</dialog>`}};var Rn=a(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),Pn=a((o,{threshold:i})=>{let{secureExpire:t}=o,e=Rn(Date.now()),r=Number(t),s=Rn(i);return e+s>=r},"isSecureTokenExpired");var ar=class{constructor(i){this.fe=null;this.m=i;}static{a(this,"SecureUploadsManager");}v(...i){this.m.debugPrint("[secure-uploads]",...i);}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this.m.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this.fe||Pn(this.fe,{threshold:this.m.cfg.secureUploadsExpireThreshold})){this.fe?this.v("Secure signature is expired. Resolving a new one..."):this.v("Secure signature is not set yet.");try{let r=await e();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this.v("Secure signature resolved:",r),this.v("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this.fe=r):(this.v("Secure signature resolver returned nothing."),this.fe=null);}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r),this.m.telemetryManager.sendEventError(r,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.fe}return i&&t?(this.v("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};var _o=a((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var No=a((o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var Kc=a(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),Gc=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),qc=a(()=>({safariDesktop:Kc()}),"calcBrowserInfo"),Wc=a(()=>({htmlMediaCapture:Gc()}),"calcBrowserFeatures"),$n=qc(),ve=Wc();var ai="image/*",zo="video/*",Zc=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Xc=a(()=>$n.safariDesktop?[ai]:[ai,...Zc],"calcImageAcceptList"),li=Xc(),lr=a(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>q(i)):[],"mergeFileTypes"),Bo=a((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),Dn=a((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),Vn=a(o=>{let i=o?.type;return i?Bo(i,li):false},"fileIsImage");var Ho=a((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=lr([...t?li:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let l=Bo(s,r),c=Dn(n,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var jo=a((o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}},"validateIsImage");var It=1e3,ge=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),ci=a(o=>Math.ceil(o*100)/100,"round"),Fn=a((o,i=ge.AUTO)=>{let t=i===ge.AUTO;if(i===ge.BYTE||t&&o<It**1){let r=Yi("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===ge.KB||t&&o<It**2?`${ci(o/It**1)} KB`:i===ge.MB||t&&o<It**3?`${ci(o/It**2)} MB`:i===ge.GB||t&&o<It**4?`${ci(o/It**3)} GB`:i===ge.TB||t&&o<It**5?`${ci(o/It**4)} TB`:`${ci(o/It**5)} PB`},"prettyBytes");var Ko=a((o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Fn(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var Go=a((o,i)=>{let{internalId:t}=o,r=i.S.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof J)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ie)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}},"validateUploadError");var Re={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."},Qc=a(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),cr=class{constructor(i){this.bc=[jo,Ho,Ko,Go];this.wc=[No,_o];this.ue=new Wt(20);this.xc=$(()=>{this.i.isConnected&&this.ue.run();},500);this.Ti=new Map;this.i=i,this.S=this.i.uploadCollection;let t=$(()=>{this.i.isConnected&&(this.runFileValidators("change"),this.runCollectionValidators());},0);this.i.subConfigValue("maxLocalFileSizeBytes",t),this.i.subConfigValue("multipleMin",t),this.i.subConfigValue("multipleMax",t),this.i.subConfigValue("multiple",t),this.i.subConfigValue("imgOnly",t),this.i.subConfigValue("accept",t),this.i.subConfigValue("validationConcurrency",e=>{this.ue.concurrency=e;});}static{a(this,"ValidationManager");}runFileValidators(i,t){let e=t??this.S.items();for(let r of e){let s=this.S.read(r);s&&this.Ec(s,i);}}runCollectionValidators(){let i=this.i.api.getOutputCollectionState(),t=[];for(let e of [...this.wc,...this.i.cfg.collectionValidators])try{let r=e(i,this.i.api);if(!r)continue;r&&(t.push(this.Bs(r)),r.message||console.warn(Re.MISSING_ERROR_MESSAGE));}catch(r){console.warn(Re.COLLECTION_VALIDATION_FAILED,r);}this.i.$["*collectionErrors"]=t,t.length>0&&this.i.emit(I.COMMON_UPLOAD_FAILED,()=>this.i.api.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(i){let t=this.Ti.get(i.uid);t&&(t.abortController?.abort(),this.Ti.delete(i.uid));}async Ec(i,t){let e=this.Hs(i),r=e.promise??Promise.resolve(),s=(async()=>{if(await r,!this.i.isConnected)return;let n=this.Tc(i,t);if(n.length===0)return;i.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let l=this.i.api.getOutputItem(i.uid),c=new AbortController;e.abortController=c;let u=this.i.cfg.validationTimeout,p=this.js(),d=new Set(n.map(v=>v.validator)),f=[];for(let v of p)if(!d.has(v.validator)){let w=e.lastErrorThrownByValidator.get(v.validator);w&&f.push(w);}let m=n.map(v=>async()=>{if(!this.i.isConnected)return;let w=setTimeout(()=>{e.skippedValidators.add(v.validator),c.abort(),console.warn(Re.FILE_VALIDATION_TIMEOUT);},u);try{let E=await v.validator(l,this.i.api,{signal:c.signal});if(!E||c.signal.aborted){e.lastErrorThrownByValidator.set(v.validator,void 0);return}let C=this.Bs(E);e.lastErrorThrownByValidator.set(v.validator,C),f.push(C),E.message||console.warn(Re.MISSING_ERROR_MESSAGE);}catch(E){c.signal.aborted||(e.skippedValidators.add(v.validator),console.warn(Re.FILE_VALIDATION_FAILED,E),this.i.telemetryManager.sendEventError(E,`file validator. ${Re.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(w),v.runOn!=="change"&&e.skippedValidators.add(v.validator);}});if(this.xc(),await this.ue.add(async()=>{i.setValue("isQueuedForValidation",false),await Promise.all(m.map(v=>v())).catch(()=>{});},{autoRun:false}),c.signal.aborted){i.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}i.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:f});})();e.promise=s;try{await s;}finally{e.promise===s&&(e.promise=void 0);}}Bs(i){return {...i,type:i.type??"CUSTOM_ERROR"}}Hs(i){let t=this.Ti.get(i.uid);if(t)return t;let e={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Ti.set(i.uid,e),e}js(){return [...this.bc,...this.i.cfg.fileValidators].map(Qc)}Tc(i,t){let e=this.Hs(i);return this.js().filter(r=>!e.skippedValidators.has(r.validator)).filter(r=>r.runOn===t)}};var _n="[Typed State] Wrong property name: ",ur=class{static{a(this,"TypedData");}constructor(i){this.Rt=Vt.generate(),this.Y=z.registerCtx(i,this.Rt);}get uid(){return this.Rt}setValue(i,t){if(!this.Y.has(i)){console.warn(`${_n}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${_n}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}remove(){z.deleteCtx(this.Rt);}};var dr=class{constructor(i){this.Wt=Object.create(null);this.Ci=new Set;this.Ai=new Set;this.Pt=new Set;this.Vr=new Set;this.Fr=new Set;this.qs=i.initialValue,this.Rt=Vt.generate(),this.Y=z.registerCtx({},this.Rt),this.Ks=i.watchList||[];let t=Object.create(null);this.Gs=(e,r)=>{this._r&&window.clearTimeout(this._r),t[e]||(t[e]=new Set),t[e].add(r),this._r=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Ci.forEach(s=>{s({...t});}),t=Object.create(null));});},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}q(){this.Nr&&window.clearTimeout(this.Nr),this.Nr=window.setTimeout(()=>{let i=new Set(this.Fr),t=new Set(this.Vr);this.Fr.clear(),this.Vr.clear();for(let e of this.Ai)e?.([...this.Pt],i,t);});}observeCollection(i){return this.Ai.add(i),this.Pt.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Ai.delete(i);}add(i){let t=new ur(this.qs);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.Pt.add(t.uid),this.q(),this.Y.add(t.uid,t),this.Fr.add(t),this.Ks.forEach(e=>{this.Wt[t.uid]||(this.Wt[t.uid]=[]),this.Wt[t.uid]?.push(t.subscribe(e,()=>{this.Gs(e,t.uid);}));}),t.uid}read(i){return this.Y.read(i)}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&this.Vr.add(t),this.Pt.delete(i),this.q(),this.Y.pub(i,void 0),delete this.Wt[i];}clearAll(){this.Pt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Ci.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Ci.delete(i);}findItems(i){let t=[];return this.Pt.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.Pt]}get size(){return this.Pt.size}destroy(){z.deleteCtx(this.Rt),this.Ci=new Set,this.Ai=new Set;for(let i of Object.keys(this.Wt))this.Wt[i]?.forEach(t=>{t.remove();}),delete this.Wt[i];}};var k=Object.freeze({PHOTO:"photo",VIDEO:"video"}),gt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var qo=a(o=>({isVideoRecordingEnabled:at(o.cameraModes).includes(k.VIDEO),isPhotoEnabled:at(o.cameraModes).includes(k.PHOTO)}),"calcCameraModes");var Nn="active",Pe="___ACTIVITY_IS_ACTIVE___",zn,b=class o extends(zn=T,zn){constructor(){super(...arguments);this.historyTracked=false;this.init$=go(this);this.Cc=$(this.Ac.bind(this),10);}static{a(this,"LitActivityBlock");}Ws(){let t=o.Fe.get(this);this[Pe]=false,this.removeAttribute(Nn),t?.deactivateCallback?.();}Sc(){let t=o.Fe.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Pe]=true,this.setAttribute(Nn,""),t?.activateCallback?.(),this.Cc(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Pe]?this.Ws():this.activityType===t&&!this[Pe]&&this.Sc();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Ac(){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);}kc(){return !!this.activityType&&o.Fe.has(this)}static{this.Fe=new Map;}get isActivityActive(){return !!this[Pe]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.Fe.set(this,{activateCallback:r,deactivateCallback:s});}Oc(){this.isActivityActive&&this.Ws(),o.Fe.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.kc()&&this.Oc();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(r=>r instanceof o&&r.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});function pr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}a(pr,"applyStyles");var Yc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Jc=new RegExp(`^/?(${Yc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Bn=a(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(ii),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Jc.exec(r.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var Mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Wo=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),B=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Wo,...Mt});function Hn(o){let i=new Map;return a((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}a(Hn,"memoize");var jn=new Set;function hr(o){jn.has(o)||(jn.add(o),console.warn(o));}a(hr,"warnOnce");function tu(o){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...r)=>(i&&hr(o),e(...r))),"withAssert")}a(tu,"createAsyncAssertWrapper");function Kn(o){let i={},t={progress:a(()=>o.$["*commonProgress"],"progress"),errors:a(()=>o.$["*collectionErrors"],"errors"),group:a(()=>o.$["*groupInfo"],"group"),totalCount:a(()=>o.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(r=>r.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>o.getOutputData(),"allEntries"),successEntries:a(()=>i.allEntries.filter(r=>r.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(r=>r.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(r=>r.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(r=>r.status==="idle"),"idleEntries")},e=tu("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[r,s]of Object.entries(t)){let n=r,c=Hn(e(s));Object.defineProperty(i,n,{get:c,enumerable:true});}return i}a(Kn,"buildOutputCollectionState");var fr=class{constructor(i){this.addFileFromUrl=a((i,{silent:t,fileName:e,source:r}={})=>{let s=this.S.add({externalUrl:i,fileName:e??null,silent:t??false,source:r??B.API});return this.getOutputItem(s)},"addFileFromUrl");this.addFileFromUuid=a((i,{silent:t,fileName:e,source:r}={})=>{let s=this.S.add({uuid:i,fileName:e??null,silent:t??false,source:r??B.API});return this.getOutputItem(s)},"addFileFromUuid");this.addFileFromCdnUrl=a((i,{silent:t,fileName:e,source:r}={})=>{let s=Bn({url:i,cdnBase:this.cfg.cdnCname});if(!s)throw new Error("Invalid CDN URL");let n=this.S.add({uuid:s.uuid,cdnUrl:i,cdnUrlModifiers:s.cdnUrlModifiers,fileName:e??s.filename??null,silent:t??false,source:r??B.API});return this.getOutputItem(n)},"addFileFromCdnUrl");this.addFileFromObject=a((i,{silent:t,fileName:e,source:r,fullPath:s}={})=>{let n=this.S.add({file:i,isImage:Vn(i),mimeType:i.type,fileName:e??i.name,fileSize:i.size,silent:t??false,source:r??B.API,fullPath:s??null});return this.getOutputItem(n)},"addFileFromObject");this.removeFileByInternalId=a(i=>{if(!this.S.read(i))throw new Error(`File with internalId ${i} not found`);this.S.remove(i);},"removeFileByInternalId");this.uploadAll=a(()=>{let i=this.S.items().filter(t=>{let e=this.S.read(t);return e?!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")&&e.getValue("errors").length===0&&!e.getValue("isValidationPending")&&!e.getValue("isQueuedForValidation"):false});i.length!==0&&(this.e.$["*uploadTrigger"]=new Set(i),this.e.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((i={})=>{let t=Nt(lr([this.cfg.accept??"",...this.cfg.imgOnly?li:[]])),e="uploadcare-file-input",r=document.createElement("input");if(r.setAttribute(e,""),pr(r,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),r.type="file",r.multiple=this.cfg.multiple,i.captureCamera){r.capture=this.cfg.cameraCapture;let{isPhotoEnabled:s,isVideoRecordingEnabled:n}=qo(this.cfg);i.modeCamera===k.PHOTO&&s?r.accept=ai:i.modeCamera===k.VIDEO&&n?r.accept=zo:r.accept=[ai,n&&zo].filter(Boolean).join(",");}else r.accept=t;r.addEventListener("change",()=>{r.files&&([...r.files].forEach(s=>{this.addFileFromObject(s,{source:i.captureCamera?B.CAMERA:B.LOCAL});}),this.e.modalManager?.open(b.activities.UPLOAD_LIST),this.e.$["*currentActivity"]=b.activities.UPLOAD_LIST,r.remove());},{once:true}),document.querySelectorAll(`[${e}]`).forEach(s=>{s.remove();}),document.body.appendChild(r),r.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((i=false)=>{if(this.S.size>0&&!i)this.e.modalManager?.open(b.activities.UPLOAD_LIST),this.e.pub("*currentActivity",b.activities.UPLOAD_LIST);else if(this.Zs?.length===1){let t=this.Zs[0];if(t==="local"){this.e.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.openSystemDialog();return}if(t==="camera"&&ve.htmlMediaCapture){let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=qo(this.cfg);if(n&&l){this.e.pub("*currentActivity",b.activities.START_FROM);return}else if(n||l){this.openSystemDialog({captureCamera:true,modeCamera:n?k.PHOTO:k.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:k.PHOTO});}let e=this.e.blocksRegistry,r=a(n=>"type"in n&&n.type===t,"isSourceBtn");[...e].find(r)?.activate(),this.e.$["*currentActivity"]&&this.e.modalManager?.open(this.e.$["*currentActivity"]);}else this.e.modalManager?.open(b.activities.START_FROM),this.e.pub("*currentActivity",b.activities.START_FROM);},"initFlow");this.doneFlow=a(()=>{this.e.set$({"*currentActivity":this.e.doneActivity,"*history":this.e.doneActivity?[this.e.doneActivity]:[]}),this.e.$["*currentActivity"]||this.e.modalManager?.closeAll();},"doneFlow");this.setCurrentActivity=a((i,...t)=>{if(this.e.hasBlockInCtx(e=>e.activityType===i)){this.e.set$({"*currentActivityParams":t[0]??{},"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`);},"setCurrentActivity");this.getCurrentActivity=a(()=>this.e.$["*currentActivity"],"getCurrentActivity");this.setModalState=a(i=>{if(i&&!this.e.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}i?this.e.modalManager?.open(this.e.$["*currentActivity"]):(this.e.modalManager?.close(this.e.$["*currentActivity"]),this.e.$["*currentActivity"]=null);},"setModalState");this.e=i;}static{a(this,"UploaderPublicApi");}get S(){return this.e.uploadCollection}get cfg(){return this.e.cfg}get l10n(){return this.e.l10n.bind(this.e)}removeAllFiles(){this.S.clearAll();}getOutputItem(i){let t=z.getCtx(i);if(!t)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${i}" not found in the upload collection`);let e=t.store,r=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return {uuid:r?.uuid??e.uuid??null,internalId:i,name:r?.originalFilename??e.fileName,size:r?.size??e.fileSize,isImage:r?.isImage??e.isImage,mimeType:r?.mimeType??e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:e.cdnUrl??r?.cdnUrl??null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:r??null,metadata:e.metadata??r?.metadata??null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",isValidationPending:e.isValidationPending,errors:e.errors,status:s,source:e?.source}}getOutputCollectionState(){return Kn(this.e)}get Zs(){let i=[];return this.cfg.sourceList&&(i=q(this.cfg.sourceList)),i}};var Gn={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var ui=33.333333333333336,O=1,Zo=24,qn=6;function ee(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}a(ee,"setSvgNodeAttrs");function ut(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ee(t,i),t}a(ut,"createSvgNode");function Wn(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+l*s+1.5*u,r+c*n+1.5*p],m=[e+l*s-24*t*u+1.5*u,r+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,w=[f[0],f[1]];return {d:v,center:w}}a(Wn,"cornerPath");function Zn(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,f=i==="n"?-1:i==="s"?1:0,m,v;l?(m=[e+u*s-34*t/2,r+p*n+1.5*f],v=[e+u*s+34*t/2,r+p*n+1.5*f]):(m=[e+u*s+1.5*d,r+p*n-34*t/2],v=[e+u*s+1.5*d,r+p*n+34*t/2]);let w=`M ${m[0]} ${m[1]} L ${v[0]} ${v[1]}`,E=[(m[0]+v[0])/2,(m[1]+v[1])/2];return {d:w,center:E}}a(Zn,"sidePath");function Xn(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}a(Xn,"thumbCursor");function Qn({rect:o,delta:[i,t],imageBox:e}){return De({...o,x:o.x+i,y:o.y+t},e)}a(Qn,"moveRect");function De(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}a(De,"constraintRect");function eu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;s+=r,l-=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(n=l*t,c=o.x+o.width/2-n/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y+o.height-l),l<O&&(l=O,t&&(n=l*t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),n<O&&(n=O,t&&(l=n/t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),{x:c,y:s,width:n,height:l}}a(eu,"resizeNorth");function iu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;s+=r,n-=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(l=n/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x+o.width-n),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),{x:s,y:c,width:n,height:l}}a(iu,"resizeWest");function ru({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;l+=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=o.x+o.width/2-n/2),c<=e.x&&(c=e.x,s=o.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y),l<O&&(l=O,t&&(n=l*t),c=o.x+o.width/2-n/2),n<O&&(n=O,t&&(l=n/t),c=o.x+o.width/2-n/2),{x:c,y:s,width:n,height:l}}a(ru,"resizeSouth");function ou({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;n+=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:n,height:l}}a(ou,"resizeEast");function su({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+s<e.y&&(s=e.y-l),n+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c,l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c,l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(su,"resizeNorthWest");function nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x,l=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(nu,"resizeNorthEast");function au({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c),{x:n,y:l,width:c,height:u}}a(au,"resizeSouthWest");function lu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y)),u<O&&(u=O,t&&(c=u*t)),c<O&&(c=O,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(lu,"resizeSouthEast");function Yn({direction:o,...i}){switch(o){case "n":return eu(i);case "w":return iu(i);case "s":return ru(i);case "e":return ou(i);case "nw":return su(i);case "ne":return nu(i);case "sw":return au(i);case "se":return lu(i);default:return i.rect}}a(Yn,"resizeRect");function Jn(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}a(Jn,"rectContainsPoint");function ta(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}a(ta,"isRectInsideRect");function ea(o,i){return Math.abs(o.width/o.height-i)<.1}a(ea,"isRectMatchesAspectRatio");function Ve({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}a(Ve,"rotateSize");function ia(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),l=Math.round((i-s)/2);return n+r>o&&(r=o-n),l+s>i&&(s=i-l),{x:n,y:l,width:r,height:s}}a(ia,"calculateMaxCenteredCropFrame");function Fe(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}a(Fe,"roundRect");function ie(o,i,t){return Math.min(Math.max(o,i),t)}a(ie,"clamp");var di=["free"],vr=a(o=>{let i=q(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!di.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!di.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:Vt.generate(),type:"aspect-ratio",width:di.includes(r)?0:n,height:di.includes(r)?0:l,hasFreeform:di.includes(r)});}return t},"parseCropPreset"),ra=a((o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function oa(o){return co({...o,libraryName:St,libraryVersion:kt})}a(oa,"customUserAgent");var P=class o extends b{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Si=false;this.init$=yo(this);this.Hr=$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Rc(e);},300);this.Lc=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Qs(),this.Hr();}};this.Uc=t=>{if(!this.isConnected)return;this.Hr();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!z.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Qs();}if(t.isUploading)for(let s of t.isUploading){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=z.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Pc(),this.cfg.cloudImageEditorAutoOpen&&this.$c();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=z.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Qs=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get Ic(){return this.hasBlockInCtx(t=>t instanceof o?t.Si&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.addSharedContextInstance("*uploadCollection",()=>new dr({initialValue:Gn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]}),{persist:true}),this.addSharedContextInstance("*secureUploadsManager",()=>new ar(this)),this.addSharedContextInstance("*validationManager",()=>new cr(this)),this.addSharedContextInstance("*publicApi",()=>new fr(this)),!this.Ic&&this.couldBeCtxOwner&&this.Mc();}get validationManager(){return this.getSharedContextInstance("*validationManager")}get api(){return this.getSharedContextInstance("*publicApi")}getAPI(){return this.api}get uploadCollection(){return this.getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this.getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Si&&this.Xs(),this.Hr.cancel();}connectedCallback(){super.connectedCallback(),this.Si&&this.Ys();}Mc(){this.Si=true,this.Ys(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ys(){this.Xs(),this.zr=this.uploadCollection.observeCollection(this.Lc),this.Br=this.uploadCollection.observeProperties(this.Uc);}Xs(){this.Br?.(),this.zr?.(),this.Br=void 0,this.zr=void 0;}async Rc(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await on(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}$c(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager?.open(b.activities.CLOUD_IMG_EDIT));}Pc(){let t=vr(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ia(l,c,u),d=tt(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:G(f,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager?.open(b.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:oa,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};P.extSrcList=Object.freeze({...Mt});P.sourceTypes=Object.freeze({...B});var Xo=class extends P{constructor(){super(...arguments);this.z=null;this.ki=null;}static{a(this,"FormInput");}Js(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,pr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.Js(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.ki){let n=document.createElement("div");this.appendChild(n),this.ki=n;}if(!this.z){let n=this.Js();this.appendChild(n),this.z=n;}if(this.ki.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let l=document.createElement("input");l.type="hidden",l.name=`${this.ctxName}[]`,l.value=n,s.appendChild(l);}this.ki.replaceChildren(s);},false);}};var Qo=class extends T{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var pi=class extends T{constructor(){super(...arguments);this.value=0;this.visible=true;this.ot=0;this.Oi=S();this.tn=()=>{let t=this.Oi.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.ot>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.ot=this.jr(this.value),this.Kr(),this.Oi.value?.addEventListener("animationiteration",this.tn);}updated(t){if(super.updated(t),t.has("value")){let e=this.jr(this.value);if(!this.visible)this.ot=e;else {let r=Math.max(this.ot,e);r!==this.ot&&(this.ot=r,this.Kr());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Kr():this.ot=this.jr(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Oi.value?.removeEventListener("animationiteration",this.tn);}jr(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Kr(){this.visible&&this.style.setProperty("--l-progress-value",this.ot.toString());}render(){return y`<div ${M(this.Oi)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([x({type:Number})],pi.prototype,"value",2),h([x({type:Boolean,reflect:true})],pi.prototype,"visible",2);var hi=class extends P{constructor(){super();this.bt=false;this.me=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Gr=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.bt=t;}),this.sub("*commonProgress",t=>{this.me=t;});}updated(t){super.updated(t),t.has("visible")&&(this.bt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Gr?.(),this.Gr=void 0;}render(){return y`<uc-progress-bar .value=${this.me} .visible=${this.bt}></uc-progress-bar>`}};h([g()],hi.prototype,"bt",2),h([g()],hi.prototype,"me",2);var _e=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Dc=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Dc} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([x({type:String,attribute:false})],_e.prototype,"value",2),h([x({type:Boolean,reflect:true})],_e.prototype,"disabled",2),h([x({type:Array,attribute:false})],_e.prototype,"options",2);var cu="src-type-",Ne=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.qr={};this.Wr="default";this.Zr="";}static{a(this,"SourceBtn");}Vc(){this.ve({type:B.LOCAL,activate:a(()=>(this.api.openSystemDialog(),false),"activate")}),this.ve({type:B.URL,activity:b.activities.URL,textKey:"from-url"}),this.ve({type:B.CAMERA,activity:b.activities.CAMERA,activate:a(()=>{let t=ve.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t},"activate")}),this.ve({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(Wo))this.ve({type:t,activity:b.activities.CAMERA,activate:a(()=>{let e=ve.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?k.PHOTO:k.VIDEO}),!e},"activate")});for(let t of Object.values(Mt))this.ve({type:t,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.Vc(),this.type&&this.en(this.type);}ve(t){this.qr[t.type]=t;}activate(){if(!this.type)return;let t=this.qr[this.type];if(!t)return;let{activity:e,activate:r,activityParams:s={}}=t;(r?r():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}en(t){let e=this.qr[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:r=t,icon:s=t}=e;this.Zr=`${cu}${r}`,this.Wr=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.en(this.type):(this.Zr="",this.Wr="default"));}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.Wr}></uc-icon><div class="uc-txt">${this.l10n(this.Zr)}</div></button>`}};h([x({type:String})],Ne.prototype,"type",2),h([g()],Ne.prototype,"Wr",2),h([g()],Ne.prototype,"Zr",2);var gr=class extends T{constructor(){super(...arguments);this.rn=[];this.W=[];this.nn=[];}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.rn=q(t),this.sn();}),this.subConfigValue("cameraModes",t=>{this.W=at(t),this.sn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}sn(){let t=[];for(let e of this.rn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&ve.htmlMediaCapture){let r=this.W.length?this.W.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...r);continue}t.push(e);}this.nn=t;}render(){return y`${this.nn.map(t=>y`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};h([g()],gr.prototype,"nn",2);var Yo=class extends T{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Ut="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ye(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=Ut);},"cancel")}}a(ye,"preloadImage");function fi(o){let i=[];for(let s of o){let n=ye(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(fi,"batchPreloadImages");function Jo(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}a(Jo,"generateThumb");var ze=class extends P{constructor(){super(...arguments);this.Ii=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let l=r.subscribe(s,c=>{this.isConnected&&n(c);});this.Ii.add(l);})(t,e);}reset(){for(let t of this.Ii)t.remove();this.Ii=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ii=new Set;}};function uu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(uu,"createSvgBlobUrl");function yr(o="hsl(209, 21%, 65%)",i=32,t=32){return uu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(yr,"fileCssBg");var du=3e3,Be=class extends ze{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.$t="";this.an=false;this.Mi=null;this.ln=false;this.Fc=this.cfg.filesViewMode;this.cn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this._c(e);if(r&&s&&n){let p=await this.proxyUrl(G(Yt(this.cfg.cdnCname,n),tt(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=ye(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let m=await Jo(f,c);t.setValue("thumbUrl",m);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",yr(m));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await Jo(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",yr(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",yr(p));}});this.Li=$(this.cn.bind(this),100);}static{a(this,"Thumb");}_c(t=false){t&&(this.Mi=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Mi?.height||0),10),parseInt(String(this?.Mi?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,du)}Nc(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n.src="",e?.removeEventListener("abort",c);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),r();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}Yr(){this.Xr?.cancel(),this.Xr=void 0;}zc(t){if(this.Yr(),!t){this.$t&&(this.$t="");return}if(t===this.$t)return;let e=new AbortController,r={controller:e,cancel:a(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Xr=r,this.Nc(t,e.signal).catch(()=>{}).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.$t=t);}));});}Ui(t=false){if(this.entry){if(t){this.cn(true);return}this.ln&&this.Li();}}firstUpdated(t){super.firstUpdated(t),this.un();}updated(t){super.updated(t),t.has("uid")&&this.un();}_e(t){let[e]=t;e&&(this.ln=e.isIntersecting,e.isIntersecting&&(this.Mi=e.boundingClientRect,this.Ui(),this.s?.disconnect()),e.intersectionRatio===0&&this.Li.cancel());}reset(){super.reset(),this.Li.cancel(),this.Yr(),this.$t&&(this.$t="");}un(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=a(()=>{this.Ui();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.zc(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.Ui(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.an&&(this.Fc==="list"&&this.Ui(true),this.an=true);}),this.setAttribute("role","img");}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this._e.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Li.cancel(),this.Yr(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.$t||Ut} alt="" ?hidden=${!this.$t} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([x({type:String})],Be.prototype,"badgeIcon",2),h([x({type:String})],Be.prototype,"uid",2),h([g()],Be.prototype,"$t",2);var ts=class extends b{static{a(this,"ActivityHeader");}};var es=class extends b{constructor(){super(...arguments);this.historyTracked=true;this.activityType=b.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var is=class extends P{constructor(){super(...arguments);this.dn=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.dn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.dn?.();}};var He=a((o,i)=>{let t=false,e,r=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var sa=a((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),na=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let l of o)r[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Ln(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,f=r.length-1,m=0,v=s.length-1;for(;d<=f&&m<=v;)if(r[d]===null)d++;else if(r[f]===null)f--;else if(l[d]===n[m])c[m]=te(r[d],s[m]),d++,m++;else if(l[f]===n[v])c[v]=te(r[f],s[v]),f--,v--;else if(l[d]===n[v])c[v]=te(r[d],s[v]),Ue(o,c[v+1],r[d]),d++,v--;else if(l[f]===n[m])c[m]=te(r[f],s[m]),Ue(o,r[d],r[f]),f--,m++;else if(u===void 0&&(u=sa(n,m,v),p=sa(l,d,f)),u.has(l[d]))if(u.has(l[f])){let w=p.get(n[m]),E=w!==void 0?r[w]:null;if(E===null){let C=Ue(o,r[d]);te(C,s[m]),c[m]=C;}else c[m]=te(E,s[m]),Ue(o,r[d],E),r[w]=null;m++;}else or(r[f]),f--;else or(r[d]),d++;for(;m<=v;){let w=Ue(o,c[v+1]);te(w,s[m]),c[m++]=w;}for(;d<=f;){let w=r[d++];w!==null&&or(w);}return this.ut=n,Mn(o,c),Y}});var Et=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=b.activities.UPLOAD_LIST;this.pn=false;this.hn=false;this.mn=false;this.Qr=false;this.Jr=false;this.Ri=null;this.vn=false;this.to=null;this.gn=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.eo=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.St();};this.io=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.kt=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.St=He(()=>{this.isConnected&&(this.jc(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get Bc(){return this.to?this.Hc(this.to):""}jc(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(m=>m.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c)u=true;else {p=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&m;}this.pn=p,this.hn=d,this.mn=u,this.Jr=e.total===0||!s&&!n,this.Qr=!n||this.cfg.multiple,this.vn=e.total>0,this.to=e;}Hc(t){let e=a(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.St),this.subConfigValue("multipleMin",this.St),this.subConfigValue("multipleMax",this.St),this.sub("*groupInfo",t=>{t&&this.St();}),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.St),this.uploadCollection.observeCollection(this.St),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Ri=null;return}this.Ri=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.St),this.uploadCollection.unobserveCollection(this.St));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Bc}</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.vn}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${na(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.gn} ?disabled=${!this.Jr} ?hidden=${!this.Qr} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Ri} >${this.Ri??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.kt}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Qr} ?disabled=${!this.Jr} @click=${this.gn} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.mn} @click=${this.eo} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.pn} ?disabled=${!this.hn} @click=${this.io} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Et.prototype,"pn",2),h([g()],Et.prototype,"hn",2),h([g()],Et.prototype,"mn",2),h([g()],Et.prototype,"Qr",2),h([g()],Et.prototype,"Jr",2),h([g()],Et.prototype,"Ri",2),h([g()],Et.prototype,"vn",2),h([g()],Et.prototype,"to",2);var br=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.URL;this.ro={importDisabled:true};this.Dt=S();this.oo=t=>{let e=t.target?.value??"";this.ro={importDisabled:!e};};this.eo=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.Dt.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:B.URL}),this.modalManager?.open(b.activities.UPLOAD_LIST),this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};}static{a(this,"UrlSource");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:a(()=>{let t=this.Dt.value;t&&(t.value="",t.focus()),this.ro={importDisabled:true};},"onActivate")});}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.eo}><label><input ${M(this.Dt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.oo} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.ro.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],br.prototype,"ro",2);var aa=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var la="important",pu=" !"+la,be=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce(((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`}),"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(pu);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?la:""):t[e]=r;}}return Y}});var hu={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},fu=["camera","microphone"];function wr(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}a(wr,"formatTime");var ca="image/jpeg",ua="video/webm",_=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.CAMERA;this.Pi=null;this.so=false;this.Ne=[];this.wt=null;this.xt=null;this.$i=null;this.Di=null;this.g=null;this.ze={};this.Et=null;this.e=null;this.ge=[];this.ye=[];this.Kc={};this.Vi=[];this.Fi=null;this.yn=()=>{this.bn(),this.Be="pause";};this.wn=()=>{this.Be="play",this.Gc();};this.He=S();this.Zt=S();this.K=S();this.xn=S();this.En=0;this.Tn=0;this.Cn=null;this._i=true;this.Ni=true;this.qc=aa();this.An=[];this.Xt=true;this.ao="";this.be=true;this.Yt=true;this.we=true;this.Sn=[];this.Qt=true;this.lo=true;this.Jt=true;this.Ot=true;this.te=true;this.xe="camera-full";this.Be="play";this.kn="microphone";this.zi="uc-shot-btn uc-camera-action";this.Wc=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===k.PHOTO&&this.Zc(),this.g===k.VIDEO){if(this.wt?.state==="recording"){this.On();return}this.Xc();}};this.Yc=t=>{let e=t.target;e&&(this.Di=e.value,this.Ee());};this.Qc=t=>{let e=t.target;e&&(this.$i=e.value,this.Ee());};this.Jc=()=>{this.Ee();};this.tu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.Wc();};this.eu=()=>{this.iu();};this.ru=()=>{this.ou();};this.su=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.nu();};this.au=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.lu();};this.In=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Mn(r);};this.Ln=()=>{let t=Math.floor((performance.now()-this.En+this.Tn)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.He.value;s&&(s.textContent=wr(e)),this.On();return}let r=this.He.value;r&&(r.textContent=wr(e));}else {let e=this.He.value;e&&(e.textContent=wr(t));}this.Te=requestAnimationFrame(this.Ln);};this.cu=()=>{this.En=performance.now(),this.Tn=0,this.Ln();};this.Un=()=>{this.Te&&cancelAnimationFrame(this.Te);};this.bn=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Zt.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.He.value;n&&(n.textContent=wr(e)),this.Te=requestAnimationFrame(this.bn);};this.Gc=()=>{this.Te&&cancelAnimationFrame(this.Te);};this.Te=null;this.Xc=()=>{try{this.Ne=[],this.ze={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.ze.mimeType=t:MediaRecorder.isTypeSupported(ua)?this.ze.mimeType=ua:this.ze.mimeType="video/mp4",this.xt&&(this.wt=new MediaRecorder(this.xt,this.ze),this.wt.start(),this.wt.addEventListener("dataavailable",e=>{this.Ne.push(e.data);}),this.cu(),this.classList.add("uc-recording"),this.je(gt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.On=()=>{this.wt?.addEventListener("stop",()=>{this.uu(),this.Un(),this.je(gt.STOP);}),this.wt?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.iu=()=>{if(this.wt?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.ou=()=>{this.xt?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.kn=t.enabled?"microphone":"microphone-mute",this.lo=!t.enabled;});};this.uu=()=>{try{let t=new Blob(this.Ne,{type:this.wt?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Ke(null),r.src=e,this.du(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.nu=()=>{if(this.je(gt.RETAKE),this.g===k.VIDEO){this.Ke(this.xt);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.lu=()=>{if(this.je(gt.ACCEPT),this.g===k.PHOTO){this.Et?.toBlob(s=>{if(!s)return;let n=this.Rn("camera","jpeg",ca,s);this.Pn(n);},ca);return}let t=new Blob(this.Ne,{type:this.wt?.mimeType}),e=this.pu(this.wt?.mimeType),r=this.Rn("video",e,`video/${e}`,t);this.Pn(r),this.Ne=[];};this.hu=t=>{t===gt.SHOT&&(this.te=true,this.Yt=true,this.Ot=true,this.we=false,this.Xt=true),(t===gt.RETAKE||t===gt.ACCEPT)&&(this.te=!this.W.includes(k.VIDEO),this.Ot=!this.W.includes(k.PHOTO),this.Yt=false,this.we=true,this.Xt=this.ge.length<=1);};this.fu=t=>{t===gt.PLAY&&(this.be=false,this.Ot=true,this.Xt=true,this.Qt=true,this.Be="pause",this.xe="square",this.zi="uc-shot-btn uc-camera-action uc-stop-record"),t===gt.STOP&&(this.be=false,this.Yt=true,this.Jt=true,this.we=false),(t===gt.RETAKE||t===gt.ACCEPT)&&(this.be=true,this.te=!this.W.includes(k.VIDEO),this.Ot=!this.W.includes(k.PHOTO),this.Yt=false,this.we=true,this.Jt=!this.cfg.enableAudioRecording,this.xe="video-camera-full",this.zi="uc-shot-btn uc-camera-action",this.Qt=!this.cfg.enableAudioRecording||this.ye.length<=1,this.Xt=this.ge.length<=1);};this.je=t=>{this.g===k.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.hu(t),this.g===k.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.fu(t);};this.Mn=t=>{this.xn.value?.querySelectorAll("button").forEach(r=>{r.classList.toggle("uc-active",r.getAttribute("data-id")===t);}),t===k.PHOTO&&(this.xe="camera-full",this.Qt=true,this.Jt=true),t===k.VIDEO&&(this.Be="play",this.xe="video-camera-full",this.Qt=!this.cfg.enableAudioRecording||this.ye.length<=1,this.Jt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.Rn=(t,e,r,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:r})};this.Pn=t=>{this.api.addFileFromObject(t,{source:B.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.modalManager?.open(b.activities.UPLOAD_LIST);};this.Ge=$(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===k.VIDEO&&this.cfg.enableAudioRecording,r=this.g===k.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this._i=false,this.Yt=false,this.Ot=!this.W.includes(k.PHOTO),this.te=!this.W.includes(k.VIDEO),this.Ni=true,this.be=true,this.xe=r,this.Jt=!e,this.Qt=!e):t==="prompt"?(this.ao="camera-permissions-prompt",this._i=true,this.Yt=true,this.Ot=true,this.Ni=false,this.po()):(this.ao="camera-permissions-denied",this._i=true,this.Ni=false,this.Ot=!this.W.includes(k.PHOTO),this.te=!this.W.includes(k.VIDEO),this.we=true,this.zi="uc-shot-btn uc-camera-action",this.po());},300);this.mu=()=>{if(!this.xt)return false;let t=this.xt?.getAudioTracks(),e=this.xt?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.po=()=>{this.so&&(this.K.value&&(this.K.value.volume=0),this.Fi?.getTracks?.()?.[0]?.stop(),this.co(this.K.value),this.Ke(null),this.mu(),this.Un(),this.so=false);};this.Ee=async()=>{let t={video:{...hu},audio:this.cfg.enableAudioRecording?{}:false};this.Di&&(t.video={deviceId:{exact:this.Di}}),this.$i&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.$i}}),this.K.value&&(this.K.value.volume=0);try{this.Ge("prompt"),this.xt=await navigator.mediaDevices.getUserMedia(t),this.xt.addEventListener("inactive",()=>{this.Ge("denied");}),this.Ke(this.xt),this.so=!0,this.Ge("granted");}catch(e){this.Ge("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.$n=()=>{this.Ee();};this.vu=async()=>{try{this.Bi();for(let t of fu){let e=await navigator.permissions.query({name:t});this.Kc[t]=e,e.addEventListener("change",this.$n),this.Vi.push(()=>{e.removeEventListener("change",this.$n);});}this.Pi=()=>{this.Bi();};}catch(t){this.Bi(),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.Ee();}};this.gu=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.ho(),navigator.mediaDevices.addEventListener("devicechange",this.ho);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.ho=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.ge=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.ye=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.An=this.ge,this.Xt=this.ge.length<=1,this.Di=this.ge[0]?.value??null,this.Sn=this.ye,this.Qt=!this.cfg.enableAudioRecording||this.ye.length<=1,this.$i=this.ye[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.yu=async()=>{await this.vu(),await this.gu(),await this.Ee(),this.Dn(this.W);};this.bu=async()=>{this.Pi&&this.Pi(),window.chrome||this.Ge("denied"),this.po();};this.Dn=t=>{this.te=!t.includes(k.VIDEO),this.Ot=!t.includes(k.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.Mn(e);};}static{a(this,"CameraSource");}du(t){this.co(t),t.addEventListener("play",this.yn),t.addEventListener("pause",this.wn);}co(t){t?.removeEventListener("play",this.yn),t?.removeEventListener("pause",this.wn);}Ke(t){this.Fi!==t&&(this.Fi=t,this.uo());}uo(){let t=this.K.value;if(!t)return;let e=this.Fi??null;t.srcObject!==e&&(t.srcObject=e);}Zc(){if(this.je("shot"),this.Et=document.createElement("canvas"),this.e=this.Et.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.Et.height=t.videoHeight,this.Et.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.Et.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}pu(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get W(){return q(this.cfg.cameraModes).filter(t=>t===k.PHOTO||t===k.VIDEO)}Bi(){if(this.Vi.length!==0){for(let t of this.Vi)t();this.Vi=[],this.Pi=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.yu,onDeactivate:this.bu}),this.subConfigValue("cameraMirror",t=>{this.Cn=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.Jt=!t,this.lo=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=at(t);this.Dn(e.filter(r=>r===k.PHOTO||r===k.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.uo();}updated(t){super.updated(t),this.uo();}wu(){this.Bi(),navigator.mediaDevices?.removeEventListener("devicechange",this.ho),this.co(this.K.value),this.Ke(null);}disconnectedCallback(){super.disconnectedCallback(),this.wu();}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.Xt}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.An} ?hidden=${this.Xt} @change=${this.Yc} ></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=${be({transform:this.Cn})} ?hidden=${this._i} ${M(this.K)} ></video><div class="uc-message-box" ?hidden=${this.Ni}><span>${this.l10n(this.ao)}</span><button type="button" @click=${this.Jc} ?hidden=${this.qc} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${M(this.xn)} class="uc-switcher" ?hidden=${!this.be}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.In} ?hidden=${this.Ot} ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.In} ?hidden=${this.te} ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.eu} ?hidden=${this.be} ><uc-icon name=${this.Be}></uc-icon><span ${M(this.He)}> 00:00 </span><span ${M(this.Zt)} 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.su}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.au} data-testid="accept" > Accept </button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" @click=${this.tu} class=${this.zi} ?hidden=${this.Yt} ><uc-icon name=${this.xe}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ru} ?hidden=${this.Jt} ><uc-icon name=${this.kn}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Sn} ?hidden=${this.Qt} ?disabled=${this.lo} @change=${this.Qc} ></uc-select></div></div>`}};h([g()],_.prototype,"Cn",2),h([g()],_.prototype,"_i",2),h([g()],_.prototype,"Ni",2),h([g()],_.prototype,"qc",2),h([g()],_.prototype,"An",2),h([g()],_.prototype,"Xt",2),h([g()],_.prototype,"ao",2),h([g()],_.prototype,"be",2),h([g()],_.prototype,"Yt",2),h([g()],_.prototype,"we",2),h([g()],_.prototype,"Sn",2),h([g()],_.prototype,"Qt",2),h([g()],_.prototype,"lo",2),h([g()],_.prototype,"Jt",2),h([g()],_.prototype,"Ot",2),h([g()],_.prototype,"te",2),h([g()],_.prototype,"xe",2),h([g()],_.prototype,"Be",2),h([g()],_.prototype,"kn",2),h([g()],_.prototype,"zi",2);var we=class extends vt{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==Ot.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.Vn=void 0,this.it=i;if(i===Y)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Vn;this.it=i;let t=[i];return t.raw=t,this.Vn={Bt:this.constructor.resultType,strings:t,values:[]}}};we.directiveName="unsafeHTML",we.resultType=1;ct(we);var mi=class extends we{static{a(this,"t");}};mi.directiveName="unsafeSVG",mi.resultType=2;var xr=ct(mi);function rs(o,i,t){return o?i(o):t?.(o)}a(rs,"n");function da(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(da,"normalize");function dt(...o){let i=da(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(dt,"classNames");function pa(o,...i){let t=da(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}a(pa,"applyClassNames");var mu=a(o=>et.includes(o),"isTabIdValue"),ha=a(o=>{if(!o)return et;let i=at(o).filter(mu);return i.length===0?et:i},"parseTabs");function fa(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":et,"*tabId":F.CROP,"*on.retryNetwork":a(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ut,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=tt(Jt(i),"preview"),r=G(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.apply"),"*on.cancel":a(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(fa,"initState");var ma="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var va=Nt([...et]),it=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.xu="";this.ee=Ut;this.Eu="";this.qe=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=va;this.Fn=false;this.Lt=false;this.fo=null;this.Hi=$(t=>{this.qe=t;},300);this.ji=S();this._n=S();this.Nn=S();this.zn=S();this.Bn=()=>{this.Hi(false),this.ee!==Ut&&(this.$["*networkProblems"]=false);};this.Hn=()=>{this.Hi(false),this.$["*networkProblems"]=true;};this.Tu=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...fa(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Cu(){this.Lt||this.fo||(this.fo=this.updateComplete.then(()=>{this.fo=null,this.Lt=true;}));}initCallback(){super.initCallback(),this.jn(),this.Kn();}Ki(){let t=this.Nn.value;t&&(this.$["*faderEl"]=t);let e=this._n.value;e&&(this.$["*cropperEl"]=e);let r=this.zn.value;r&&(this.$["*imgContainerEl"]=r);let s=this.ji.value;s&&(this.$["*imgEl"]=s);}Au(){let t=this.ji.value;t&&(t.addEventListener("load",this.Bn),t.addEventListener("error",this.Hn));}Su(){let t=this.ji.value;t&&(t.removeEventListener("load",this.Bn),t.removeEventListener("error",this.Hn));}get ku(){let t=this.$["*tabId"];return dt("uc-image",{"uc-image_hidden_to_cropper":t===F.CROP,"uc-image_hidden_effects":t!==F.CROP})}Gn(){return new Promise((e,r)=>{let s=window.setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(l=>{let[c]=l;c&&c.contentRect.width>0&&c.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.Ki(),this.Au(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Su(),super.disconnectedCallback();}render(){let t=this.Eu??"",e=this.xu??"",r=this.ee||Ut,s=this.qe,n=this.Fn;return y` ${xr(ma)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Tu}></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" ${M(this.zn)}><img src=${r} class=${this.ku} ${M(this.ji)} />${rs(this.Lt,()=>y`<uc-editor-image-cropper ${M(this._n)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${M(this.Nn)}></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">${rs(this.Lt,()=>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.jn(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Kn();}jn(){let t=this.tabs||va;this.$["*tabList"]=ha(t);}Kn(){let t=vr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=So(this.cdnUrl),s=ko(r);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=ra(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Gn(),this.cdnUrl){let t=this.cdnUrl,e=Wi(t),r=Yt(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=So(t),n=ko(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Yt(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={};}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===F.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(G(t,tt("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===F.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.Cu();}}async initEditor(){try{await this.Gn();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Fn=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=tt(Jt(t),"preview"),s=G(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"xu",2),h([g()],it.prototype,"ee",2),h([g()],it.prototype,"Eu",2),h([g()],it.prototype,"qe",2),h([x({type:String,reflect:true})],it.prototype,"uuid",2),h([x({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([x({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([x({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"Fn",2),h([g()],it.prototype,"Lt",2);var Er=class extends T{constructor(){super(...arguments);this.qi=false;this.Ye=false;this.Zn=S();this.Qe=false;this.Je=null;this.Yn=t=>{this.Qn(),this.ti&&(t.stopPropagation(),t.preventDefault(),this.ti=false);};this.Jn=t=>{if(!this.ti||!this.Gi||!this.vo)return;t.stopPropagation(),t.preventDefault();let e=this.Vt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,l=t.y-s,c=n-this.Gi[0],u=l-this.Gi[1],{direction:p}=this.vo,d=this.Du(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.ta=t=>{if(!this.It)return;let e=Object.values(this.It).find(r=>{if(!r||this.yo(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return Jn(l,[t.x,t.y])});this.qn=e,this.Qn();};}static{a(this,"CropFrame");}get Vt(){return this.Zn.value??null}get ti(){return this.Ye}set ti(t){this.Ye!==t&&(this.Ye=t,this.go());}go(){this.Ze&&this.Ze.setAttribute("class",dt({"uc-guides--hidden":this.qi,"uc-guides--visible":!this.qi&&this.Ye,"uc-guides--semi-hidden":!this.qi&&!this.Ye}));}yo(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=O&&e.width<=O)return true;let r=e.height<=O&&(t.includes("n")||t.includes("s")),s=e.width<=O&&(t.includes("e")||t.includes("w"));return r||s}Ou(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,l=this.Vt;if(!l)return;let c=ut("mask",{id:"backdrop-mask"}),u=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=ut("rect",{x:e,y:r,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});l.appendChild(d),l.appendChild(c),this.We=c,this.mo=p;}Iu(){this.We&&(this.We.style.display="none",window.requestAnimationFrame(()=>{this.We&&(this.We.style.display="block");}));}Mu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.mo&&ee(this.mo,{x:e,y:r,width:s,height:n});}Lu(){let t=this.$["*cropBox"];if(!(!t||!this.Ze||!this.It)){for(let e of Object.values(this.It)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:f,height:m}=t;if(c)ee(n,{x:p,y:d,width:f,height:m});else {let w=ie(Math.min(f,m)/82/2,0,1),E=u?Wn(t,r,w):Zn(t,r,w),C=E.center;if(!C)continue;let A=Math.max(Zo*ie(Math.min(f,m)/Zo/3,0,1),qn);ee(n,{x:C[0]-A,y:C[1]-A,width:A*2,height:A*2}),ee(s,{d:E.d});}let v=this.yo(r);l.setAttribute("class",dt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ee(this.Ze,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Xn(t,e){let r=ut("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=ut("rect",{fill:"transparent"}),n=ut("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.Uu.bind(this,e));}Ru(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.Xn(t,s);}return this.Xn(t,""),t}Pu(){let t=ut("svg"),e=ut("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=ut("line",{x1:`${ui*r}%`,y1:"0%",x2:`${ui*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=ut("line",{x1:"0%",y1:`${ui*r}%`,x2:"100%",y2:`${ui*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}$u(){let t=this.Vt;if(!t)return;let e=document.createDocumentFragment(),r=this.Pu();e.appendChild(r);let s=this.Ru();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.It=s,this.Ze=r,this.go();}Uu(t,e){if(!this.It)return;let r=this.It[t];if(!r||this.yo(t))return;let s=this.$["*cropBox"],n=this.Vt;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.ti=true,this.vo=r,this.Gi=[u,p],this.Wn={...s};}Du(t,e){let[r,s]=e,n=this.$["*imageBox"],l=this.Wn??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=Qn({rect:l,delta:[r,s],imageBox:n}):l=Yn({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return De(Fe(l),n)}Qn(){let t=this.qn,e=this.Vt;e&&(e.style.cursor=t?Xn(t.direction):"initial");}ea(t){if(this.Xe){this.Xe.setAttribute("href",t);return}let e=this.Vt;if(!e){this.Je=t;return}this.Je=null;let r=document.createDocumentFragment(),s=ut("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.Xe=s;}Vu(){let t=this.$["*cropBox"];if(!t||!this.Xe)return;let{x:e,y:r,width:s,height:n}=t;ee(this.Xe,{x:e,y:r,height:n,width:s});}bo(){this.Qe&&(this.Mu(),this.Lu(),this.Vu());}toggleThumbs(t){if(this.It)for(let e of Object.values(this.It)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",dt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Iu(),this.Qe&&window.requestAnimationFrame(()=>{this.bo();});}),this.sub("*cropBox",t=>{t&&(this.qi=t.height<=O||t.width<=O,this.go(),this.Qe&&window.requestAnimationFrame(()=>{this.bo();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.ea(t);}),document.addEventListener("pointermove",this.Jn,true),document.addEventListener("pointerup",this.Yn,true);}firstUpdated(t){super.firstUpdated(t),this.Fu();}Fu(){let t=this.Vt;if(!(!t||this.Qe)){if(this.Ou(),this.$u(),this.Qe=true,t.addEventListener("pointermove",this.ta,true),this.Je){let e=this.Je;this.Je=null,this.ea(e);}this.bo();}}disconnectedCallback(){super.disconnectedCallback(),this.Vt?.removeEventListener("pointermove",this.ta,true),document.removeEventListener("pointermove",this.Jn,true),document.removeEventListener("pointerup",this.Yn,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${M(this.Zn)}></svg>`}};h([g()],Er.prototype,"Ye",2);var re=ct(class extends vt{constructor(o){if(super(o),o.type!==Ot.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter((i=>o[i])).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter((e=>e!==""))));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return Y}});var H=a(o=>o??R,"o");var rt=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}ia(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.ia();}updated(t){super.updated(t),t.has("active")&&this.ia();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],rt.prototype,"active",2),h([g()],rt.prototype,"title",2),h([g()],rt.prototype,"icon",2),h([g()],rt.prototype,"titleProp",2);var Tr=12,Cr=16,gu=a(o=>{let i=12,t=12;return o.width/o.height>=1?(i=Tr,t=Math.round(Tr*o.height/o.width)):(t=Tr,i=Math.round(Tr*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),os=class extends rt{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this._u(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}_u(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=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Ar=class extends rt{constructor(){super(...arguments);this.Q=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.Q}set aspectRatio(t){if(this.Q===t)return;let e=this.Q;this.Q=t,this.requestUpdate("aspectRatio",e),t?this.ra(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.Q&&this.ra(this.Q),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.Q?.id||t?.width===this.Q?.width&&t?.height===this.Q?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.Q?.id&&(this.$["*currentAspectRatio"]=this.Q);}ra(t){let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");r(),s(),e||this.requestUpdate();}Nu(){let t=this.Q;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=gu(t),s=(Cr-e)/2,n=(Cr-r)/2;return y`<uc-icon><svg viewBox="0 0 ${Cr} ${Cr}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} >${this.Nu()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([x({attribute:false})],Ar.prototype,"aspectRatio",1);function yu(o){let i=o+90;return i=i>=360?0:i,i}a(yu,"nextAngle");function bu(o,i){if(o==="rotate")return yu(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}a(bu,"nextValue");var Sr=class extends rt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=bu(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([x({type:String})],Sr.prototype,"operation",2);var Rt="original",kr=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.oo=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.zu();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===Rt?void 0:this.state.value,filter:this.state.filter===Rt?void 0:this.state.filter,fromViewer:false});}zu(){let t=this.state.operation,{range:e,zero:r}=xt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:f,amount:m}=d;p=f===this.state.filter?m:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Rt?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(){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.oo} ></uc-slider-ui>`}};h([g()],kr.prototype,"state",2);function je(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(je,"parseFilterValue");var oe=class extends rt{constructor(){super(...arguments);this.n="";this.f="";this.ei="";this.Wi=0;this.a=null;this.Ae=false;this.isOriginal=false;this.oa=20;}static{a(this,"EditorFilterControl");}get filter(){return this.f}set filter(t){let e=t??"";if(this.f===e)return;let r=this.f;this.f=e,this.n="filter",this.isOriginal=e===Rt,this.icon=this.isOriginal?"original":"slider",this.oa=this.isOriginal?40:20,this.requestUpdate("filter",r),this.sa(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.f),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.f),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.f;}Bu(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.oa||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.f!==Rt?{name:this.f,amount:l}:void 0,G(this.ei,tt(Zi,Jt(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${St}/${kt}/uc-cloud-image-editor/`))}async _e(t,e){t[0]?.isIntersecting?await this.wo(e):this.b?.();}initCallback(){super.initCallback(),"IntersectionObserver"in window&&(this.s=new window.IntersectionObserver(this._e.bind(this),{threshold:[0,1]}));let t=this.$["*originalUrl"];this.ei=t??"",this.sub("*originalUrl",e=>{this.ei=e??"",!this.isOriginal&&this.ei&&this.isConnected&&!this.a&&(this.s?.observe(this),this.ie());}),this.isOriginal||(this.s?.observe(this),this.ie()),this.f&&this.sa(this.f),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.f);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.wo():this.ie());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.Zi();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.ie()));}sa(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async wo(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.ei){!this.Ce&&!this.Ft&&this.ie();return}let e=++this.Wi,r="";try{r=await this.proxyUrl(this.Bu());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Ae=false,this.b?.();let{promise:s,cancel:n}=ye(r);this.b=()=>{n(),this.Wi===e&&(this.b=void 0);};try{if(await s,this.Wi!==e||!this.isConnected)return;this.a=r,this.Ae=!0,this.Zi(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.ie();}finally{this.Wi===e&&(this.b=void 0);}}ie(){if(!this.isConnected||this.a||this.Ae||this.isOriginal||this.$["*networkProblems"]){this.Zi();return}this.Ft&&cancelAnimationFrame(this.Ft),this.Ft=requestAnimationFrame(()=>{if(this.Ft=void 0,!this.isConnected||this.a||this.Ae||this.isOriginal){this.Zi();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.wo();return}this.Ce=window.setTimeout(()=>{this.Ce=void 0,this.ie();},500);});}Zi(){this.Ft&&(cancelAnimationFrame(this.Ft),this.Ft=void 0),this.Ce&&(window.clearTimeout(this.Ce),this.Ce=void 0);}get na(){return !!(this.Ae&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.na?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.na?"0":"1"};return y`<button role="option" type="button" class=${re(this.buttonClasses)} aria-label=${H(this.titleProp)} title=${H(this.titleProp)} @click=${t} ><div class="uc-preview" ?loaded=${this.Ae} style=${be(e)}></div><uc-icon class=${re({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${be(r)} ></uc-icon></button>`}};h([g()],oe.prototype,"a",2),h([g()],oe.prototype,"Ae",2),h([g()],oe.prototype,"isOriginal",2),h([g()],oe.prototype,"oa",2),h([x({type:String})],oe.prototype,"filter",1);function ga(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}a(ga,"pick");function Ke(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return G(o,tt(Zi,Jt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${St}/${kt}/uc-cloud-image-editor/`))}a(Ke,"viewerImageSrc");function wu(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}a(wu,"validateCrop");var Or=class extends T{constructor(){super();this.ctxOwner=true;this.re={width:0,height:0};this.e=null;this._=false;this.at=null;this.la=S();this.Eo=S();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.aa=$(this.ca.bind(this),300),this.xo=He(()=>{!this.isConnected||!this._||(this.To(),this.ua(),this.da(),this.Co(),this.Ao());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.To();}ua(){let t=this.$["*editorTransformations"],e=ga(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}To(){let t=this.la.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.Et=t,this.e=e;}da(){if(!this._||!this.at)return;let t=this.at,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=Ve({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,m=0+e,v=e+(n.height-e*2)/2-f/2;c={x:m,y:v,width:d,height:f};}else {let d=n.height-e*2,f=d*u,m=e+(n.width-e*2)/2-f/2,v=0+e;c={x:m,y:v,width:f,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p};}this.$["*imageBox"]=Fe(c);}Co(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[f,m],coords:[v,w]}=n,{width:E}=Ve(this.re,s),C=l/E;t=De(Fe({x:c+v*C,y:u+w*C,width:f*C,height:m*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!ta(t,e)||d&&!ea(t,d)){let f=e.width/e.height,m=e.width,v=e.height;d&&(f>d?m=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-v/2,width:m,height:v};}this.$["*cropBox"]=De(Fe(t),e);}Hu(){let t=this.e;if(!t)return;let e=this.at;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=Ve({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}Ao(){if(!this._||!this.at||!this.Et||!this.e)return;let t=this.Et;this.e.clearRect(0,0,t.width,t.height),this.Hu();}ju({fromViewer:t}){this.at&&(this.Eo.value?.toggleThumbs(true),this.Ku(),setTimeout(()=>{this.className=dt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}pa(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l}=e,{width:c,height:u}=Ve(this.re,s),{width:p,height:d}=t,f=n/c,m=l/u;return [ie(Math.round(p/f),1,c),ie(Math.round(d/m),1,u)]}Gu(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=Ve(this.re,s),{x:f,y:m}=t,v=n/p,w=l/d,E=this.pa(),C={dimensions:E,coords:[ie(Math.round((f-c)/v),0,p-E[0]),ie(Math.round((m-u)/w),0,d-E[1])]};if(!wu(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(E[0]===p&&E[1]===d))return C}ca(){if(!this.isConnected||!this.re)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.Gu(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.da(),this.Co(),this.Ao());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.To(),this.re=t,this.removeEventListener("transitionend",this.ha);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.at=await this.qu(r,s),this.ua(),this.xo(),this.ju({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.at&&this.xo();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.ca(),this._=false,this.Wu(),this.className=dt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Eo.value?.toggleThumbs(false),this.addEventListener("transitionend",this.ha,{once:true}),this.s?.disconnect());}Wu(){let t=this.pa(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}Ku(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}ha(){this._||(this.at=null);}async qu(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Ke(t,r,e)),{promise:n,cancel:l,image:c}=ye(s),u=this.Se(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}Se(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ao();}),this.sub("*cropBox",()=>{this.at&&this.aa();}),this.sub("*currentAspectRatio",()=>{this.Co();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.re&&this.activate(this.re,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.at&&(this.at=null);}render(){return y`<canvas class="uc-canvas" ${M(this.la)}></canvas><uc-crop-frame ${M(this.Eo)}></uc-crop-frame>`}};h([g()],Or.prototype,"at",2);function ss(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}a(ss,"linspace");function xu(o){return typeof o=="string"&&o in xt}a(xu,"isOperationKey");function Eu(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}a(Eu,"splitBySections");function Tu(o,i,t){let e=Eu(o).find(([n,l])=>n<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(Tu,"calculateOpacities");function Cu(o,i){return o.map((t,e)=>t<i?o.length-e:e)}a(Cu,"calculateZIndices");function ya(o,i){let t=xt[o].keypointsNumber,{range:e,zero:r}=xt[o];return [...new Set([...ss(e[0],r,t+1),...ss(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}a(ya,"keypointsRange");var ns=class extends T{constructor(){super();this._=false;this.So=true;this.n="initial";this.fa={};this._t=[];this.va=0;this.ya=S();this.Xi=S();this.classList.add("uc-inactive_to_cropper"),this.ga=$(async(t,e,r)=>{let s=a(()=>!this.ba(t,e)||this.me!==r||!!this._t.find(u=>u.value===r),"shouldSkip");if(s())return;let n=await this.wa(t,r),l=new Image;l.src=n.src;let c=this.Se(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this._t,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let f=u[p]?.image,m=this.Xi.value;!m||f&&!m.contains(f)||(u.splice(p,0,n),f?m.insertBefore(l,f):m.appendChild(l),this.Io(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}Se(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}xa(){window.cancelAnimationFrame(this.va),this.va=window.requestAnimationFrame(()=>{for(let t of this._t){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ee({url:t=this.ma,filter:e=this.f??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.fa};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let l=this.offsetWidth;return this.proxyUrl(Ke(t,l,n))}async wa(t,e){return {src:await this.ee({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}ba(t,e){return this.n===t&&this.f===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!xu(this.n)||!Number.isFinite(e)||(this.Io(this.n,e),this.ga(this.n,this.f,e));}Io(t,e){this.n=t,this.me=e;let{zero:r}=xt[t],s=this._t.map(c=>c.value),n=Tu(s,e,r),l=Cu(s,r);this._t.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.xa();}Ea(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Zu(){this.a=this.a||this.Ea();let t=this.a;t&&this.Ta(t);let e=this._t.map(u=>u.src),{images:r,promise:s,cancel:n}=fi(e);r.forEach(u=>{let p=this.Se(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.ko=()=>{n(),this.ko=void 0;};let l=this.n,c=this.f;if(await s,this._&&this.ba(l,c)){let u=this.Xi.value;if(!u)return;u.replaceChildren(),this._t.forEach((p,d)=>{let f=r[d];f&&(f.classList.add("uc-fader-image"),p.image=f,u.appendChild(f));}),this.xa();}}async setTransformations(t){if(this.fa=t,this.a){let e=await this.ee(),r=this.Se(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.Oo?.();let n=ya(r,s),l=await Promise.all(n.map(u=>this.ee({url:t,filter:e,operation:r,value:u}))),{cancel:c}=fi(l);this.Oo=c;}Xu(t){let e=this.a||this.Ea();if(this.Ta(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=dt({"uc-active_from_viewer":this.ii,"uc-active_from_cropper":!this.ii,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.Se(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=dt({"uc-active_from_viewer":this.ii,"uc-active_from_cropper":!this.ii,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.So=false,await this.updateComplete,this.ma=t,this.n=e??"initial",this.me=r,this.f=s,this.ii=n,typeof r!="number"&&!s){let c=await this.ee({operation:e,value:r});this.Xu(c),this.Mo();return}!e||typeof r!="number"||(this._t=await Promise.all(ya(e,r).map(c=>this.wa(e,c))),this.Io(e,r),this.Zu());}deactivate({hide:t=true}={}){this._=false,this.ko?.(),this.Oo?.(),t&&!this.So?(this.So=true,this.a&&(this.a.style.transform="scale(1)"),this.className=dt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Mo();},{once:true})):this.Mo();}Ta(t){let e=this.ya.value;e&&(e.contains(t)||e.appendChild(t));}Mo(){this.Xi.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${M(this.ya)}></div><div class="uc-fader-layers-host" ${M(this.Xi)}></div>`}};var Ir=class extends rt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),e&&this.Ca(e);}Ca(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.Ca(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=xt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])});}};h([x({type:String})],Ir.prototype,"operation",1);var Au=1,ba=a(()=>{},"noopScrollListener"),as=class extends T{constructor(){super(...arguments);this.Aa=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Au){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Aa,{passive:false}),this.addEventListener("scroll",ba,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Aa),this.removeEventListener("scroll",ba),super.disconnectedCallback();}};var pt=class extends T{constructor(){super(...arguments);this.qe=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Sa=true;this.tabList=[...et];this.activeTab=F.CROP;this.Yi=true;this.Lo=false;this.ka=null;this.Oa=0;this.Ia=0;this.Qi=S();this.Ma=S();this.tabToggleRefs={[F.CROP]:S(),[F.TUNING]:S(),[F.FILTERS]:S()};this.La=()=>{this.oe();};this.ri=[];this.Hi=$(t=>{this.qe=t;},500);this.Ji=$(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===F.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Rt);else if(this.showSubToolbar&&this.$["*tabId"]===F.TUNING&&e){s=true;let n=t?.[e]||xt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Lo=s;},0);this.Yu={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Qu={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Ju={hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"};this.td={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.ed={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Rt,"*currentOperation":null,"*operationTooltip":null};this.kt=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.$o=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.hd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:je(this.$["*operationTooltip"])}),this.Qi.value?.apply(),this.Ua();};this.fd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Qi.value?.cancel(),this.Ua();};this.md=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Uo(r,{fromViewer:false}));};}static{a(this,"EditorToolbar");}Ua(){this.$["*showSlider"]=false,this.$["*tabId"]===F.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===F.TUNING&&(this.Lo=false);}Uo(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Ra(t,{fromViewer:e,force:r});}Ra(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.oe();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===F.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of et){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.oe();}}oe(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Ma.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Oa!==s||this.Ia!==n)&&(this.Oa=s,this.Ia=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Ro(){return this.ri.length>=3}rd(t){switch(t){case F.CROP:return this.od();case F.FILTERS:return this.sd();case F.TUNING:return this.nd();default:return []}}od(){let t=[];if(this.Ro)t.push(()=>this.ad());else for(let e of this.ri)t.push(()=>this.Pa(e));for(let e of bn)t.push(()=>this.ld(e));return this.Po(t)}sd(){let e=[Rt,...yn].map(r=>()=>this.cd(r));return this.Po(e)}nd(){let t=gn.map(e=>()=>this.ud(e));return this.Po(t)}Po(t){return t.length?t.map(r=>r()):[]}ad(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Pa(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}ld(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}cd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}ud(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}dd(){return this.Ro?this.ri.map(t=>this.Pa(t)):[]}async pd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ke(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=fi([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.ri=[...t],this.sub("*cropPresetList",e=>{this.ri=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Uo(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Ji();}),this.sub("*currentOperation",()=>{this.Ji();}),this.sub("*tabId",e=>{this.Ra(e,{fromViewer:false,force:true}),this.Ji();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.pd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Hi(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Yi=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Yi=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Sa=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Uo(r,{fromViewer:false});return}this.oe();}),this.sub("*operationTooltip",e=>{this.ka=e;}),this.Ji();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.La);}firstUpdated(t){super.firstUpdated(t),this.Ki(),this.oe();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.oe()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ki();}disconnectedCallback(){window.removeEventListener("resize",this.La),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ki(){let t=this.Qi.value;t&&(this.$["*sliderEl"]=t);}vd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?be({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.td}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${n} @click=${this.md} ${M(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}gd(t){let e=this.activeTab===t,r=this.rd(t);return y`<uc-presence-toggle id=${`tab_${t}`} class="uc-tab-content" .visible=${e} .styles=${this.Ju} ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${r.length?r:R}</div></div></uc-editor-scroller></uc-presence-toggle>`}render(){let t=["uc-info-tooltip",this.Lo?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Ro;return y`<uc-line-loader-ui .active=${this.qe}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.ka??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Yu} ><div class="uc-tab-content-row">${et.map(r=>this.gd(r))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Sa} .styles=${this.ed} @initial-render=${()=>this.oe()} ><div class="uc-tab-toggles_indicator" ${M(this.Ma)} ></div>${et.map(r=>this.vd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.kt} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.$o}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Qu}><div class="uc-slider" ?hidden=${!this.Yi}><uc-editor-slider ${M(this.Qi)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Yi||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.dd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.fd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.hd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],pt.prototype,"qe",2),h([g()],pt.prototype,"showMainToolbar",2),h([g()],pt.prototype,"showSubToolbar",2),h([g()],pt.prototype,"Sa",2),h([g()],pt.prototype,"tabList",2),h([g()],pt.prototype,"activeTab",2),h([g()],pt.prototype,"Yi",2),h([g()],pt.prototype,"Lo",2),h([g()],pt.prototype,"ka",2),h([g()],pt.prototype,"ri",2);var Tt=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.active=false;this.reverse=false;this.theme="default";this.ariaRole="";this.ariaControls="";this.titleProp="";}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.$a(),this.Da();}updated(t){super.updated(t),t.has("reverse")&&this.$a(),t.has("theme")&&this.Da();}$a(){this.style.flexDirection=this.reverse?"row-reverse":"";}Da(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get yd(){let t=this.Do;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.bd}}get Do(){return !this.icon}get bd(){return !this.text&&!this.Do}render(){return y`<button type="button" role=${H(this.ariaRole||void 0)} aria-controls=${H(this.ariaControls||void 0)} aria-label=${H(this.l10n(this.titleProp))} title=${H(this.l10n(this.titleProp))} ><uc-icon class=${re(this.yd)} name=${H(this.icon||void 0)} ?hidden=${this.Do} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([x({type:String})],Tt.prototype,"text",2),h([x({type:String})],Tt.prototype,"icon",2),h([x({type:Boolean,reflect:true})],Tt.prototype,"active",2),h([x({type:Boolean,reflect:true})],Tt.prototype,"reverse",2),h([x({type:String,reflect:true})],Tt.prototype,"theme",2),h([x({attribute:"aria-role"})],Tt.prototype,"ariaRole",2),h([x({attribute:"aria-controls"})],Tt.prototype,"ariaControls",2),h([x({attribute:"title-prop"})],Tt.prototype,"titleProp",2);var Mr=class extends T{constructor(){super(...arguments);this.active=false;this.Zt=S();this.Vo=false;this.Fo=()=>{let t=this.Zt.value;t&&(this.Va(t),this.Vo&&this.active&&this._o());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this._o();}updated(t){super.updated(t),t.has("active")&&(this.active?this._o():this.wd());}_o(){let t=this.Zt.value;if(!t)return;this.Vo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Fo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Fo,{once:true});}wd(){let t=this.Zt.value;t&&(this.Vo=false,t.removeEventListener("transitionend",this.Fo),this.Va(t));}Va(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${M(this.Zt)}></div></div>`}};h([x({type:Boolean,reflect:true})],Mr.prototype,"active",2);var Ee={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},vi=class extends T{constructor(){super(...arguments);this.bt=false;this.Fa=Ee;this._a=Ee.visible;this.Na=Ee.hidden;this.No=false;this.za=false;}static{a(this,"PresenceToggle");}set visible(t){this.bt=t,this.Ba();}get visible(){return this.bt}set styles(t){this.Fa=t,this.No=true,this._a=t.visible??Ee.visible,this.Na=t.hidden??Ee.hidden;}get styles(){return this.Fa}Ba(){this.style.visibility=this.bt?"inherit":"hidden",pa(this,{[Ee.transition]:!this.No,[this._a]:this.bt,[this.Na]:!this.bt}),this.toggleAttribute("inert",!this.bt);}xd(){this.za||(this.za=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.No||this.classList.add(Ee.transition),this.Ba(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.xd();},0);}};h([x({type:Boolean})],vi.prototype,"visible",1),h([x({attribute:false})],vi.prototype,"styles",1);var Ht=class extends T{constructor(){super();this.zo=0;this.Dt=S();this.ja=S();this.Ka=S();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Nt=0;this.Ed=t=>{t.stopPropagation();let e=this.qa(t);e!==null&&(this.Bo(e),this.Ga("slider-input",e));};this.Td=t=>{t.stopPropagation();let e=this.qa(t);e!==null&&(this.Bo(e),this.Ga("slider-change",e));};this.Wa=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Za=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}Ga(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.zo=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Xa(this.Nt),this.Ho(),this.s=new ResizeObserver(()=>{this.Ho(),this.tr(this.Nt);}),this.s.observe(this);let e=this.Dt.value;e?.addEventListener("focus",this.Wa),e?.addEventListener("blur",this.Za),window.setTimeout(()=>{this.tr(this.Nt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Nt&&this.Bo(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ho(),this.tr(this.Nt)),t.has("zero")&&this.hasUpdated&&this.Ya(this.Nt);}tr(t){this.Ya(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.zo)/100;window.requestAnimationFrame(()=>{let c=this.ja.value;c&&(c.style.transform=`translateX(${l}px)`);});}Ya(t){if(!this.oi)return;let e=this.max-this.min;if(e===0)return;this.oi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.zo)/100;window.requestAnimationFrame(()=>{this.oi&&(this.oi.style.transform=`translateX(${l}px)`);});}Ho(){let e=this.Ka.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.Ha===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.oi=p,e.innerHTML="",e.appendChild(l),this.Ha=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Dt.value;t?.removeEventListener("focus",this.Wa),t?.removeEventListener("blur",this.Za),this.s?.disconnect(),this.s=void 0;}Bo(t){Number.isFinite(t)&&(this.Nt=t,this.hasUpdated&&(this.Xa(t),this.tr(t)));}Xa(t){let e=this.Dt.value;e&&(e.value=String(t));}qa(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return y`<div class="uc-steps" ${M(this.Ka)}></div><div class="uc-thumb" ${M(this.ja)}></div><input class="uc-input" type="range" ${M(this.Dt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Nt)} ?disabled=${this.disabled} @input=${this.Ed} @change=${this.Td} />`}};h([x({type:Boolean,reflect:true})],Ht.prototype,"disabled",2),h([x({type:Number})],Ht.prototype,"min",2),h([x({type:Number})],Ht.prototype,"max",2),h([x({type:Number,attribute:false})],Ht.prototype,"defaultValue",2),h([x({type:Number})],Ht.prototype,"zero",2),h([g()],Ht.prototype,"Nt",2);var Lr=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.CLOUD_IMG_EDIT;this.J=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>this.Cd(),"onActivate"),onDeactivate:a(()=>this.Ad(),"onDeactivate")}),this.subConfigValue("cropPreset",t=>{if(!this.J)return;let e=t||void 0;this.J.cropPreset!==e&&(this.J={...this.J,cropPreset:e});}),this.subConfigValue("cloudImageEditorTabs",t=>{if(!this.J)return;let e=t||void 0;this.J.tabs!==e&&(this.J={...this.J,tabs:e});});}$o(t){if(!this.si)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.si.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(b.activities.CLOUD_IMG_EDIT),this.historyBack();}kt(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(b.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Cd(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.si=e;let r=this.si.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.J=this.Sd(r);}Ad(){this.si=void 0,this.J=null;}render(){if(!this.J)return R;let{cdnUrl:t,cropPreset:e,tabs:r}=this.J;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${H(e)} tabs=${H(r)} @apply=${this.$o} @cancel=${this.kt} @change=${this.handleChange} ></uc-cloud-image-editor>`}Sd(t){let e={cdnUrl:t},r=this.cfg.cropPreset;r&&(e.cropPreset=r);let s=this.cfg.cloudImageEditorTabs;return s&&(e.tabs=s),e}};h([g()],Lr.prototype,"J",2);var Su=[{test:a(o=>!!o.accept&&!!o.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],wa=$(o=>{for(let{test:i,message:t}of Su)i(o)&&hr(t);},0);var xa=a((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),ku="0123456789abcdefghijklmnopqrstuvwxyz",Ea=a(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=ku[Number(t)]+i,o=o/36n;}return i},"a"),ls=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var Ou=a(async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Iu=10,Mu=a(async o=>{let i=await Ou(o);return Ea(i).slice(0,Iu)},"d"),Ta=a(async(o,i)=>{let t=await Mu(o);return xa(t,i)},"f");var Ca=a(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var cs=a(o=>o,"defineComputedProperty"),Lu=[cs({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:o,enableVideoRecording:i})=>{if(i===null)return o;let t=at(o);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Nt(t)},"fn")}),cs({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:o,defaultCameraMode:i})=>{if(i===null)return o;let t=at(o);return t=t.sort((e,r)=>e===i?-1:r===i?1:0),Nt(t)},"fn")}),cs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>o&&(i===ii||ls(i,t))?Ta(o,t):i,"fn")})],Aa=a(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of Lu)if(r.deps.includes(o)){let s={[r.key]:t(r.key)};for(let c of r.deps)s[c]=t(c);let n=new AbortController;e.get(r.key)?.abort(),e.set(r.key,n);let l;try{l=r.fn(s,{signal:n.signal});}catch(c){e.get(r.key)===n&&e.delete(r.key),console.error(`Failed to compute value for "${r.key}"`,c);return}Ca(l)?l.then(c=>{n.signal.aborted||i(r.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.key)===n&&e.delete(r.key);}):i(r.key,l);}},"computeProperty");var V=a(o=>String(o),"asString"),Q=a(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),N=a(o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},"asBoolean"),Sa=a(o=>o==="auto"?o:N(o),"asStore"),ka=a(o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),Oa=a(o=>{let i=V(o);if(!Object.values(k).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),Ia=a(o=>{let i=V(o),t=at(i);if(t.some(e=>!Object.values(k).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),Ma=a(o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),us=a(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),Ur=a(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),ds=a(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),La=a(o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var Uu={pubkey:V,multiple:N,multipleMin:Q,multipleMax:Q,confirmUpload:N,imgOnly:N,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Sa,cameraMirror:N,cameraCapture:ka,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:Q,thumbSize:Q,showEmptyList:N,useLocalImageEditor:N,useCloudImageEditor:N,cloudImageEditorTabs:V,removeCopyright:N,cropPreset:V,imageShrink:V,modalScrollLock:N,modalBackdropStrokes:N,sourceListWrap:N,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:Q,retryNetworkErrorMaxTimes:Q,multipartMinFileSize:Q,multipartChunkSize:Q,maxConcurrentRequests:Q,multipartMaxConcurrentRequests:Q,multipartMaxAttempts:Q,checkForUrlDuplicates:N,saveUrlForRecurrentUploads:N,groupOutput:N,userAgentIntegration:V,debug:N,localeName:V,metadata:Ma,secureUploadsExpireThreshold:Q,localeDefinitionOverride:a(o=>us(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(o=>Ur(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(o=>Ur(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(o=>Ur(o),"iconHrefResolver"),fileValidators:ds,collectionValidators:ds,validationTimeout:Q,validationConcurrency:Q,cameraModes:Ia,defaultCameraMode:Oa,enableAudioRecording:N,enableVideoRecording:N,mediaRecorderOptions:us,maxVideoRecordingDuration:Q,filesViewMode:La,gridShowFileNames:N,cloudImageEditorAutoOpen:N,cloudImageEditorMaskHref:V,testMode:N,qualityInsights:N},Ua=a((o,i)=>{if(!(typeof i>"u"||i===null))try{return Uu[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),lt[o]}},"normalizeConfigValue");var Rr=[...new Set(["debug",...Object.keys(lt)])],Ru=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],$a=a(o=>Ru.includes(o),"isComplexKey"),gi=Rr.filter(o=>!$a(o)),Ra={...Object.fromEntries(gi.map(o=>[Je(o),o])),...Object.fromEntries(gi.map(o=>[o.toLowerCase(),o]))},Pu={...Object.fromEntries(gi.map(o=>[Je(o),X(o)])),...Object.fromEntries(gi.map(o=>[o.toLowerCase(),X(o)]))},Pa=a(o=>`__${o}`,"getLocalPropName"),Pr=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(lt).map(([t,e])=>[X(t),e]))};this.kd=new Map;}static{a(this,"Config");}Od(t,e){if(!$a(t)){let r=[...new Set([Je(t),t.toLowerCase()])];for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Id(t,e){this.$[X(t)]!==e&&(typeof e>"u"||e===null?this.$[X(t)]=lt[t]:this.$[X(t)]=e);}er(t,e){let r=this,s=Ua(t,e),n=Pa(t);r[n]!==s&&(this.Md(t,r[n],s),r[n]=s,this.Od(t,s),this.Id(t,s),this.debugPrint(`[uc-config] "${t}"`,s),wa(this.cfg));}Qa(t){let e=this,r=Pa(t);return e[r]??this.$[X(t)]}Md(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}initCallback(){super.initCallback();let t=this;for(let e of gi)this.sub(X(e),r=>{this.er(e,r);},false);for(let e of Rr){let r=t[e]??this.$[X(e)];r!==lt[e]&&this.er(e,r),Object.defineProperty(this,e,{set:a(s=>{this.er(e,s);},"set"),get:a(()=>this.Qa(e),"get")});}for(let e of Rr)this.sub(X(e),()=>{Aa({key:e,setValue:this.er.bind(this),getValue:this.Qa.bind(this),computationControllers:this.kd});});}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ra[t];n&&(s[n]=r),Pu[t]&&(this[t]=r);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(Ra)]}};for(let o of Rr)Pr.prototype[o]=void 0;function $u(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}a($u,"checkIsDirectory");function Du(o,i){return new Promise(t=>{let e=0,r=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}a(Du,"readEntryContentAsync");function Da(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(Du(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push($u(l).then(c=>{c||i.push({type:"file",file:l});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Da,"getDropItems");var ot=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Va=["focus"],Vu=100,ps=new Map;function Fu(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}a(Fu,"distance");function hs(o){let i=0,t=document.body,e=new Set,r=a(v=>{e.add(v);},"handleSwitch"),s=ot.INACTIVE,n=a(v=>{o.shouldIgnore()&&v!==ot.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=a(()=>{i=0,n(ot.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===ot.INACTIVE&&n(ot.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(ot.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(ot.INACTIVE);},"onDrop"),f=a(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],E=o.element.getBoundingClientRect(),C=Math.floor(Fu(w,E)),A=C<Vu,L=v.composedPath().includes(o.element);ps.set(o.element,C);let ft=Math.min(...ps.values())===C;L&&ft?(v.preventDefault(),n(ot.OVER)):n(A&&ft?ot.NEAR:ot.ACTIVE);},"onDragOver"),m=a(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let E=await Da(w);o.onItems(E),n(ot.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),o.element.addEventListener("drop",m),Va.forEach(v=>{window.addEventListener(v,c);}),()=>{ps.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",m),Va.forEach(v=>{window.removeEventListener(v,c);});}}a(hs,"addDropzone");var fs=new Set,Ct=class extends P{constructor(){super(...arguments);this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ut=true;this.Ja=true;this.tl=null;this.il=null;this.rl=S();this.ke=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.ol=true;this.Oe=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get Ld(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.Ut)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),fs.add(this),this.jo(),this.Ko(),this.sl(),this.nl(ot.INACTIVE),this.tl=hs({element:this,shouldIgnore:a(()=>this.al(),"shouldIgnore"),onChange:a(e=>{this.nl(e);},"onChange"),onItems:a(e=>{e.length&&(e.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:B.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:B.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(b.activities.UPLOAD_LIST),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})));},"onItems")});let t=this.rl.value;t&&(this.il=hs({element:t,onChange:a(e=>{let r=Object.entries(ot).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.al(),"shouldIgnore")})),this.subConfigValue("sourceList",e=>{let r=q(e);this.ol=r.includes(B.LOCAL),this.jo(),this.Ko();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.jo(),this.Ko());}updated(t){super.updated(t),t.has("clickable")&&this.sl();}al(){if(!this.Ut||!this.Ud())return true;if(!this.fullscreen)return false;let t=fs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}Ud(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}jo(){let t=this.ol&&!this.disabled;this.Ut=t;}Ko(){let t=this.Ut||!this.querySelector("[data-default-slot]");this.Ja=t,this.hidden=!t;}nl(t){let e=Object.entries(ot).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}sl(){this.clickable&&!this.Oe?(this.addEventListener("keydown",this.ke),this.addEventListener("click",this.ke),this.Oe=true):!this.clickable&&this.Oe&&(this.removeEventListener("keydown",this.ke),this.removeEventListener("click",this.ke),this.Oe=false);}disconnectedCallback(){super.disconnectedCallback(),fs.delete(this),this.tl?.(),this.il?.(),this.Oe&&(this.removeEventListener("keydown",this.ke),this.removeEventListener("click",this.ke),this.Oe=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${M(this.rl)} class="uc-content-wrapper" ?hidden=${!this.Ja}><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.Ld}</span></div>`)} `}};h([x({type:Boolean,reflect:true})],Ct.prototype,"disabled",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"clickable",2),h([x({type:Boolean,attribute:"with-icon",reflect:true})],Ct.prototype,"withIcon",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"fullscreen",2),h([x({type:Boolean,reflect:true})],Ct.prototype,"initflow",2),h([x({type:String})],Ct.prototype,"text",2),h([g()],Ct.prototype,"Ut",2),h([g()],Ct.prototype,"Ja",2);var Fa=a(()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var _u=a(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),_a=a((o,i="i")=>{let t=o.split("*").map(_u);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Nu=["--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"],zu=a((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),Na=a(o=>{let i={};for(let t of Nu){let e=zu(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Bu=["selected-files-change","toolbar-state-change"],Hu=a(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Bu.includes(i))},"isWhitelistedMessage"),$r=class{constructor(i,t){this.ir=new Map;this.cl=i=>{if(i.source!==this.Go)return;let t=i.data;if(!Hu(t))return;let e=this.ir.get(t.type);if(e)for(let r of e)r(t);};this.Go=i,this.ll=t,window.addEventListener("message",this.cl);}static{a(this,"MessageBridge");}on(i,t){let e=this.ir.get(i)??new Set;this.ir.has(i)||this.ir.set(i,e),e.add(t);}send(i){let t=this.ll();this.Go.postMessage(i,t);}destroy(){window.removeEventListener("message",this.cl);}};function za(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(za,"queryString");var ju={[Mt.GDRIVE]:"ngdrive"},yt=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=b.activities.EXTERNAL;this.Ie=S();this.rr=null;this.qo=[];this.Wo=false;this.Zo=false;this.Xo=false;this.Yo=false;this.or=false;this.Qo=false;this.Jo="uc-hidden";this.ul=true;this.io=()=>{for(let t of this.qo){let e=this.Pd(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.modalManager?.open(b.activities.UPLOAD_LIST);};this.kt=()=>{this.historyBack();};this.Nd=()=>{this.pt?.send({type:"select-all"});};this.zd=()=>{this.pt?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get Rd(){if(!this.rr)return "";let{selectedCount:t,total:e}=this.rr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.dl();},"onActivate")}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.ts(),this.dl());}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.ts();}),this.subConfigValue("multiple",t=>{this.or=t;}),this.subConfigValue("localeName",()=>{this.pl();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.hl(t);});}Pd(t){if(t.alternatives){let e=q(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=_a(r);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}$d(t){this.ul=t.isVisible;}async Dd(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Vd(t.selectedCount,t.total),this.Jo=t.isReady?"":"uc-hidden",this.Wo=t.isReady,this.Zo=t.isReady&&t.selectedFiles.length>0,this.or=t.isMultipleMode&&t.total>0,this.Xo=t.selectedCount<t.total,this.Yo=t.selectedCount===t.total,this.qo=t.selectedFiles??[],this.Qo=t.total>0;}fl(){this.hl(this.cfg.externalSourcesEmbedCss),this.Fd(),this.pl();}Fd(){this.pt?.send({type:"set-theme-definition",theme:Na(this)});}hl(t){this.pt?.send({type:"set-embed-css",css:t});}pl(){this.pt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}_d(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=ju[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Fa(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=za(u),p.toString()}Vd(t,e){this.rr={selectedCount:t,total:e};}dl(){let t=document.createElement("iframe");t.src=this._d(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.fl.bind(this)),t.addEventListener("load",this.fl.bind(this)),this.Ie.value&&(this.Ie.value.innerHTML="",this.Ie.value.appendChild(t)),t.contentWindow&&(this.pt?.destroy(),this.pt=new $r(t.contentWindow,()=>this.cfg.socialBaseUrl),this.pt.on("selected-files-change",this.Dd.bind(this)),this.pt.on("toolbar-state-change",this.$d.bind(this)),this.ml());}ts(){this.pt?.destroy(),this.pt=void 0,this.Ie.value&&(this.Ie.value.innerHTML=""),this.ml();}ml(){this.qo=[],this.Wo=false,this.Zo=false,this.Xo=false,this.Yo=false,this.or=false,this.Qo=false,this.Jo="uc-hidden",this.rr=null;}disconnectedCallback(){super.disconnectedCallback(),this.ts();}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 ${M(this.Ie)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.ul}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.kt}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.or}><span>${this.Rd}</span><button type="button" @click=${this.Nd} ?hidden=${!this.Xo}>${this.l10n("select-all")}</button><button type="button" @click=${this.zd} ?hidden=${!this.Yo}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.io} ?disabled=${!this.Zo} ?hidden=${!this.Qo} ><uc-spinner ?hidden=${this.Wo}></uc-spinner><span class=${this.Jo}>${this.l10n("done")}</span></button></div></div>`}};h([g()],yt.prototype,"qo",2),h([g()],yt.prototype,"Wo",2),h([g()],yt.prototype,"Zo",2),h([g()],yt.prototype,"Xo",2),h([g()],yt.prototype,"Yo",2),h([g()],yt.prototype,"or",2),h([g()],yt.prototype,"Qo",2),h([g()],yt.prototype,"Jo",2),h([g()],yt.prototype,"ul",2);var Vr=a(()=>{let o=[];return {stack:o,promiseReadJpegChunks:a(t=>new Promise((e,r)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",f=>{r(`Reader error: ${f}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let f=p.getUint16(2)-2;return n(t.slice(s,s+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}o.push({startPos:u,length:f,marker:d,view:m}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Ku=a(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ha=a(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=Vr();await s(o),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Gu=226,ja=a((o,i)=>Ha(o,Gu,i.map(t=>t.buffer)),"replaceIccProfile"),qu=a(async o=>{try{return await ja(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Wu=a((o,i,t)=>new Promise((e,r)=>{let s=a(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),yi=a(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),Zu=a(o=>{let{ctx:t,canvas:e}=yi();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},"hasTransparency"),Xu=a(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Qu="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Dr,Yu=a(()=>new Promise(o=>{if(Dr!==void 0)o(Dr);else {let i=new Image;i.addEventListener("load",()=>{Dr=i.naturalWidth<i.naturalHeight,i.src="//:0",o(Dr);}),i.src=Qu;}}),"isBrowserApplyExifOrientation"),Ju=a((o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},"findExifOrientation"),td=a((o,i)=>{Ju(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),ed=a(async(o,i,t)=>(t&&td(i,1),Ha(o,225,[i.buffer])),"replaceExif"),id=a((o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),rd=a(o=>id(new Image,o),"imageLoader"),od=[1,3],sd=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ba={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},nd=a(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Vr();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&sd.indexOf(r)>=0){let n=s.getUint8(5);od.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Ka=a((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),Ga=a((o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),se={R:55,G:110,B:165,A:255},ad=`rgba(${se.R}, ${se.G}, ${se.B}, ${se.A/255})`,qa=a((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=yi();e.width=1,e.height=1;let{canvas:s,ctx:n}=yi();s.width=o,s.height=i,n&&(n.fillStyle=ad,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===se.R&&l[1]===se.G&&l[2]===se.B&&l[3]===se.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function Wa(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}a(Wa,"wrapAsync");var ld=Wa(Ka(qa,Ga)),cd=Wa(Ka(qa,Ga)),Za=a(async(o,i)=>{let t=Ba.squareSide.find(n=>n*n>=o*i),e=Ba.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([ld(t,t),cd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Xa=a(async(o,i,t)=>{try{let{ctx:e,canvas:r}=yi();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),ud=a(({img:o,targetW:i,targetH:t})=>Xa(o,i,t),"native"),dd=a(function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},"calcShrinkSteps"),pd=a(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=dd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[l,c],u)=>n.then(p=>Za(l,c).then(()=>Xa(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),hd=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),fd=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),ms=.71,md=a((o,i)=>{if(o.width*ms*o.height*ms<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return Za(s,n).then(()=>{let{ctx:l}=yi();return "imageSmoothingQuality"in l&&!hd()&&!fd?ud({img:o,targetW:s,targetH:n}):pd({img:o,sourceW:t,targetW:s,targetH:n,step:ms})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Qa=a(async(o,i)=>{try{if(await nd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Xu(o),Yu(),Ku(o)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await qu(o).catch(()=>o),p=await rd(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await md(p,i),f="image/jpeg",m=i?.quality||.8;!s&&Zu(d)&&(f="image/png",m=void 0);let v=await Wu(d,f,m);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,E=l.status==="fulfilled"?l.value:!1;v=await ed(v,w,E);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await ja(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 vd=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ya=a(o=>{if(typeof o!="string")return false;let i=vd.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var W=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),j=class j extends ze{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.vl=true;this.uid="";this.es="";this.rs="";this.os="";this.ot=0;this.gl=false;this.ss="";this.yl=false;this.bl=false;this.wl=false;this.xl=false;this.El=false;this.sr=false;this.Tl="";this.Cl=false;this.Bd=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(b.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT;});this.Hd=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.remove(this.uid);};this.jd=()=>{this.Al();};this.w=$(()=>this.Sl(),100);this.Gd=this.withEntry(He((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===W.FINISHED,c=e===W.UPLOADING,u=e===W.QUEUED_UPLOADING,p=e===W.QUEUED_VALIDATION,d=e===W.VALIDATION,f=t.getValue("fileName"),m="";r?m="":!l&&n&&s&&Object.values(Mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.os=m,this.rs=r,this.gl=c||u||p||d,this.ot=p||d?0:t.getValue("uploadProgress"),this.Tl=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Al=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.w();try{let r=new AbortController;t.setValue("abortController",r);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File&&this.cfg.imageShrink)try{let d=Ya(this.cfg.imageShrink);d?l=await Qa(l,d):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let f=d.value*100;t.setValue("uploadProgress",f);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),mo(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.w();}catch(r){this.telemetryManager.sendEventError(r,"file upload. Failed to upload file"),r instanceof qt&&r.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof pe?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.w();}}});}static{a(this,"FileItem");}Sl(){let t=this.entry;if(!t)return;let e=W.IDLE;t.getValue("errors").length>0?e=W.FAILED:t.getValue("isQueuedForUploading")?e=W.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=W.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=W.VALIDATION:t.getValue("isUploading")?e=W.UPLOADING:t.getValue("fileInfo")&&(e=W.FINISHED),this.Kd(t,e);}Kd(t,e){e===W.FAILED?this.ss="badge-error":e===W.FINISHED&&(this.ss="badge-success"),e===W.UPLOADING&&(this.xl=false,this.removeAttribute("focused")),this.bl=e===W.FAILED,this.wl=e===W.UPLOADING,this.yl=e===W.FINISHED,this.El=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.Gd(e);}reset(){super.reset(),this.w.cancel();}_e(t){let[e]=t;e&&e.isIntersecting&&!this.Cl&&(this.vl=false,this.Cl=true);}kl(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.w();}),this.subEntry("isValidationPending",()=>{this.w();}),this.subEntry("uploadProgress",()=>{this.w();}),this.subEntry("isQueuedForUploading",()=>{this.w();}),this.subEntry("fileName",r=>{this.es=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.w();}),this.subEntry("externalUrl",r=>{this.es=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.w();}),this.subEntry("errors",()=>this.w()),this.subEntry("isUploading",()=>this.w()),this.subEntry("fileSize",()=>this.w()),this.subEntry("mimeType",()=>this.w()),this.subEntry("isImage",()=>this.w()),this.Sl());}Ol(t){if(this.cfg.filesViewMode==="list"){this.sr=true;return}this.sr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.kl(this.uid);}initCallback(){super.initCallback(),this.kl(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.w()),this.subConfigValue("filesViewMode",t=>{this.Ol(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.Ol(t);}),this.onclick=()=>{j.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Al());}),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this._e.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.vl?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?finished=${this.yl} ?uploading=${this.wl} ?failed=${this.bl} ?focused=${this.xl}><uc-thumb .uid=${this.uid} .badgeIcon=${this.ss}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Tl}><span class="uc-file-name" ?hidden=${!this.sr}>${this.es}</span><span class="uc-file-error" ?hidden=${!this.rs}>${this.rs}</span><span class="uc-file-hint" ?hidden=${!this.os}>${this.os}</span></div><div class="uc-file-actions"><button type="button" @click=${this.Bd} ?hidden=${!this.El} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.Hd} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.jd}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.ot} .visible=${this.gl} ?hasFileName=${this.sr}></uc-progress-bar></div>`}};h([g()],j.prototype,"vl",2),h([x({type:String,attribute:false})],j.prototype,"uid",2),h([g()],j.prototype,"es",2),h([g()],j.prototype,"rs",2),h([g()],j.prototype,"os",2),h([g()],j.prototype,"ot",2),h([g()],j.prototype,"gl",2),h([g()],j.prototype,"ss",2),h([g()],j.prototype,"yl",2),h([g()],j.prototype,"bl",2),h([g()],j.prototype,"wl",2),h([g()],j.prototype,"xl",2),h([g()],j.prototype,"El",2),h([g()],j.prototype,"sr",2),h([g()],j.prototype,"Tl",2);var vs=j;var bi=class extends P{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Il="upload-file";this.qd=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.Il=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.qd}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.Il)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([x({attribute:"dropzone",type:Boolean})],bi.prototype,"dropzone",2),h([g()],bi.prototype,"Il",2);var Ja="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var jt=class extends T{constructor(){super(...arguments);this.init$=sn(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this);}render(){return y`${xr(Ja)}`}};var Fr=class extends jt{constructor(){super();this.headless=false;this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderRegular");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([x({type:Boolean})],Fr.prototype,"headless",2);var gs=class extends it{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var _r=class extends jt{constructor(){super();this.Ml=false;this.kt=()=>{if(this.Ll){let t=this.$["*historyBack"];t?.();return}this.Ul&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderInline");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Ll(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==b.activities.START_FROM}get Ul(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}ns(){return this.getCssData("--cfg-init-activity")||b.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.ns();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Ml=this.Ll||this.Ul;});}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.kt} ?hidden=${!this.Ml} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};h([g()],_r.prototype,"Ml",2);var ys="active",Nr="",Te=class extends jt{constructor(){super();this.as=false;this.nr=false;this.ar=Nr;this.ls=Nr;this.De=t=>{t.id===b.activities.CLOUD_IMG_EDIT&&(this.ar=ys),this.$["*currentActivity"]===b.activities.UPLOAD_LIST&&(this.ar=ys,this.nr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.ls=ys);};this.Ve=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.nr=false),t.id===b.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{a(this,"FileUploaderMinimal");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}ns(){return this.getCssData("--cfg-init-activity")||b.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.ns();this.sub("*currentActivity",e=>{e===b.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.ls=Nr):(this.ar=Nr,this.nr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.as=!r):(this.style.removeProperty("--uc-grid-col"),this.as=false);});}),this.modalManager?.subscribe(K.OPEN,this.De),this.modalManager?.subscribe(K.CLOSE,this.Ve);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(K.OPEN,this.De),this.modalManager?.unsubscribe(K.CLOSE,this.Ve);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.nr} class=${this.ls}><uc-drop-area ?single=${this.as} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.ar}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([g()],Te.prototype,"as",2),h([g()],Te.prototype,"nr",2),h([g()],Te.prototype,"ar",2),h([g()],Te.prototype,"ls",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
8
8
  exports.ActivityBlock=b;exports.ActivityHeader=ts;exports.BaseComponent=Jr;exports.Block=T;exports.BtnUi=Tt;exports.CameraSource=_;exports.CloudImageEditor=gs;exports.CloudImageEditorActivity=Lr;exports.CloudImageEditorBlock=it;exports.Config=Pr;exports.Copyright=Qo;exports.CropFrame=Er;exports.Data=z;exports.DropArea=Ct;exports.EditorAspectRatioButtonControl=Ar;exports.EditorCropButtonControl=Sr;exports.EditorFilterControl=oe;exports.EditorFreeformButtonControl=os;exports.EditorImageCropper=Or;exports.EditorImageFader=ns;exports.EditorOperationControl=Ir;exports.EditorScroller=as;exports.EditorSlider=kr;exports.EditorToolbar=pt;exports.ExternalSource=yt;exports.ExternalUploadSource=Mt;exports.FileItem=vs;exports.FileUploaderInline=_r;exports.FileUploaderMinimal=Te;exports.FileUploaderRegular=Fr;exports.FormInput=Xo;exports.Icon=si;exports.Img=Po;exports.LineLoaderUi=Mr;exports.Modal=Fo;exports.ModalEvents=K;exports.PACKAGE_NAME=St;exports.PACKAGE_VERSION=kt;exports.PresenceToggle=vi;exports.ProgressBar=pi;exports.ProgressBarCommon=hi;exports.Select=_e;exports.SimpleBtn=bi;exports.SliderUi=Ht;exports.SolutionBlock=jt;exports.SourceBtn=Ne;exports.SourceList=gr;exports.Spinner=Yo;exports.StartFrom=es;exports.Thumb=Be;exports.UID=Vt;exports.UploadCtxProvider=is;exports.UploadList=Et;exports.UploadSource=B;exports.UploaderBlock=P;exports.UrlSource=br;exports.defineComponents=to;exports.defineLocale=Hs;exports.loadFileUploaderFrom=El;exports.toKebabCase=Je;return exports;})({});