@uploadcare/file-uploader 1.32.0-alpha.1 → 1.32.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.d.ts +17 -14
- package/dist/index.js +4 -4
- package/dist/index.layered.css +2 -2
- package/dist/index.ssr.js +1 -1
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +2 -2
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/package.json +1 -1
- package/web/file-uploader.iife.min.d.ts +17 -14
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +17 -14
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.layered.min.css +2 -2
- package/web/uc-basic.min.css +2 -2
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +17 -14
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +2 -2
- package/web/uc-file-uploader-inline.min.css +2 -2
- package/web/uc-file-uploader-inline.min.d.ts +17 -14
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.layered.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.d.ts +17 -14
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.layered.min.css +2 -2
- package/web/uc-file-uploader-regular.min.css +2 -2
- package/web/uc-file-uploader-regular.min.d.ts +17 -14
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.32.0-alpha.
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.32.0-alpha.2 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-06-
|
|
5
|
+
* Built: 2026-06-25T15:05:03.988Z
|
|
6
6
|
*/
|
|
7
|
-
var js=Object.defineProperty;var Hs=Object.getOwnPropertyDescriptor;var p=(s,i,e,t)=>{for(var r=t>1?void 0:t?Hs(i,e):i,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(t?n(i,e,r):n(r))||r);return t&&r&&js(i,e,r),r};var ut=globalThis,pt=ut.ShadowRoot&&(ut.ShadyCSS===void 0||ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wi=Symbol(),qi=new WeakMap,dt=class{constructor(i,e,t){if(this.Ys=true,t!==Wi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=e;}get styleSheet(){let i=this.o,e=this.t;if(pt&&i===void 0){let t=e!==void 0&&e.length===1;t&&(i=qi.get(e)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),t&&qi.set(e,i));}return i}toString(){return this.cssText}},Xi=s=>new dt(typeof s=="string"?s:s+"",void 0,Wi);var Yi=(s,i)=>{if(pt)s.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of i){let t=document.createElement("style"),r=ut.litNonce;r!==void 0&&t.setAttribute("nonce",r),t.textContent=e.cssText,s.appendChild(t);}},ui=pt?s=>s:s=>s instanceof CSSStyleSheet?(i=>{let e="";for(let t of i.cssRules)e+=t.cssText;return Xi(e)})(s):s;var{is:Bs,defineProperty:Gs,getOwnPropertyDescriptor:qs,getOwnPropertyNames:Ws,getOwnPropertySymbols:Xs,getPrototypeOf:Ys}=Object,ht=globalThis,Zi=ht.trustedTypes,Zs=Zi?Zi.emptyScript:"",Qs=ht.reactiveElementPolyfillSupport,He=(s,i)=>s,Be={toAttribute(s,i){switch(i){case Boolean:s=s?Zs:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s);}return s},fromAttribute(s,i){let e=s;switch(i){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s);}catch{e=null;}}return e}},ft=(s,i)=>!Bs(s,i),Qi={attribute:true,type:String,converter:Be,reflect:false,useDefault:false,hasChanged:ft};Symbol.metadata??=Symbol("metadata"),ht.litPropertyMetadata??=new WeakMap;var Q=class extends HTMLElement{static addInitializer(i){this.Yt(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.pt&&[...this.pt.keys()]}static createProperty(i,e=Qi){if(e.state&&(e.attribute=false),this.Yt(),this.prototype.hasOwnProperty(i)&&((e=Object.create(e)).wrapped=true),this.elementProperties.set(i,e),!e.noAccessor){let t=Symbol(),r=this.getPropertyDescriptor(i,t,e);r!==void 0&&Gs(this.prototype,i,r);}}static getPropertyDescriptor(i,e,t){let{get:r,set:o}=qs(this.prototype,i)??{get(){return this[e]},set(n){this[e]=n;}};return {get:r,set(n){let a=r?.call(this);o?.call(this,n),this.requestUpdate(i,a,t);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Qi}static Yt(){if(this.hasOwnProperty(He("elementProperties")))return;let i=Ys(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(He("finalized")))return;if(this.finalized=true,this.Yt(),this.hasOwnProperty(He("properties"))){let e=this.properties,t=[...Ws(e),...Xs(e)];for(let r of t)this.createProperty(r,e[r]);}let i=this[Symbol.metadata];if(i!==null){let e=litPropertyMetadata.get(i);if(e!==void 0)for(let[t,r]of e)this.elementProperties.set(t,r);}this.pt=new Map;for(let[e,t]of this.elementProperties){let r=this.Zt(e,t);r!==void 0&&this.pt.set(r,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let e=[];if(Array.isArray(i)){let t=new Set(i.flat(1/0).reverse());for(let r of t)e.unshift(ui(r));}else i!==void 0&&e.push(ui(i));return e}static Zt(i,e){let t=e.attribute;return t===false?void 0:typeof t=="string"?t:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.dt=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.Ce=null,this.Zs();}Zs(){this.Qt=new Promise(i=>this.enableUpdating=i),this.le=new Map,this.Qs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Ne??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Ne?.delete(i);}Qs(){let i=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(i.set(t,this[t]),delete this[t]);i.size>0&&(this.dt=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Yi(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Ne?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Ne?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,e,t){this.Jt(i,t);}Js(i,e){let t=this.constructor.elementProperties.get(i),r=this.constructor.Zt(i,t);if(r!==void 0&&t.reflect===true){let o=(t.converter?.toAttribute!==void 0?t.converter:Be).toAttribute(e,t.type);this.Ce=i,o==null?this.removeAttribute(r):this.setAttribute(r,o),this.Ce=null;}}Jt(i,e){let t=this.constructor,r=t.pt.get(i);if(r!==void 0&&this.Ce!==r){let o=t.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Be;this.Ce=r;let a=n.fromAttribute(e,o.type);this[r]=a??this.ei?.get(r)??a,this.Ce=null;}}requestUpdate(i,e,t,r=false,o){if(i!==void 0){let n=this.constructor;if(r===false&&(o=this[i]),t??=n.getPropertyOptions(i),!((t.hasChanged??ft)(o,e)||t.useDefault&&t.reflect&&o===this.ei?.get(i)&&!this.hasAttribute(n.Zt(i,t))))return;this.C(i,e,t);}this.isUpdatePending===false&&(this.Qt=this.eo());}C(i,e,{useDefault:t,reflect:r,wrapped:o},n){t&&!(this.ei??=new Map).has(i)&&(this.ei.set(i,n??e??this[i]),o!==true||n!==void 0)||(this.le.has(i)||(this.hasUpdated||t||(e=void 0),this.le.set(i,e)),r===true&&this.Ce!==i&&(this.rr??=new Set).add(i));}async eo(){this.isUpdatePending=true;try{await this.Qt;}catch(e){Promise.reject(e);}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.dt){for(let[r,o]of this.dt)this[r]=o;this.dt=void 0;}let t=this.constructor.elementProperties;if(t.size>0)for(let[r,o]of t){let{wrapped:n}=o,a=this[r];n!==true||this.le.has(r)||a===void 0||this.C(r,void 0,o,a);}}let i=false,e=this.le;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),this.Ne?.forEach(t=>t.hostUpdate?.()),this.update(e)):this.ti();}catch(t){throw i=false,this.ti(),t}i&&this.to(e);}willUpdate(i){}to(i){this.Ne?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}ti(){this.le=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Qt}shouldUpdate(i){return true}update(i){this.rr&&=this.rr.forEach(e=>this.Js(e,this[e])),this.ti();}updated(i){}firstUpdated(i){}};Q.elementStyles=[],Q.shadowRootOptions={mode:"open"},Q[He("elementProperties")]=new Map,Q[He("finalized")]=new Map,Qs?.({ReactiveElement:Q}),(ht.reactiveElementVersions??=[]).push("2.1.2");var pi=globalThis,Ji=s=>s,mt=pi.trustedTypes,er=mt?mt.createPolicy("lit-html",{createHTML:s=>s}):void 0,hi="$lit$",J=`lit$${Math.random().toFixed(9).slice(2)}$`,fi="?"+J,Js=`<${fi}>`,we=document,qe=()=>we.createComment(""),We=s=>s===null||typeof s!="object"&&typeof s!="function",mi=Array.isArray,nr=s=>mi(s)||typeof s?.[Symbol.iterator]=="function",di=`[ \f\r]`,Ge=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,tr=/-->/g,ir=/>/g,ve=RegExp(`>|${di}(?:([^\\s"'>=/]+)(${di}*=${di}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),rr=/'/g,sr=/"/g,ar=/^(?:script|style|textarea|title)$/i,gi=s=>(i,...e)=>({ce:s,strings:i,values:e}),g=gi(1),F=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),or=new WeakMap,Te=we.createTreeWalker(we,129);function lr(s,i){if(!mi(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return er!==void 0?er.createHTML(i):i}var cr=(s,i)=>{let e=s.length-1,t=[],r,o=i===2?"<svg>":i===3?"<math>":"",n=Ge;for(let a=0;a<e;a++){let l=s[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Ge?d[1]==="!--"?n=tr:d[1]!==void 0?n=ir:d[2]!==void 0?(ar.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=ve):d[3]!==void 0&&(n=ve):n===ve?d[0]===">"?(n=r??Ge,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?ve:d[3]==='"'?sr:rr):n===sr||n===rr?n=ve:n===tr||n===ir?n=Ge:(n=ve,r=void 0);let f=n===ve&&s[a+1].startsWith("/>")?" ":"";o+=n===Ge?l+Js:u>=0?(t.push(c),l.slice(0,u)+hi+l.slice(u)+J+f):l+J+(u===-2?a:f);}return [lr(s,o+(s[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),t]},Xe=class s{constructor({strings:i,ce:e},t){let r;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=cr(i,e);if(this.el=s.createElement(c,t),Te.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=Te.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(hi)){let h=d[n++],f=r.getAttribute(u).split(J),m=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:m[2],strings:f,ctor:m[1]==="."?yt:m[1]==="?"?bt:m[1]==="@"?vt:xe}),r.removeAttribute(u);}else u.startsWith(J)&&(l.push({type:6,index:o}),r.removeAttribute(u));if(ar.test(r.tagName)){let u=r.textContent.split(J),h=u.length-1;if(h>0){r.textContent=mt?mt.emptyScript:"";for(let f=0;f<h;f++)r.append(u[f],qe()),Te.nextNode(),l.push({type:2,index:++o});r.append(u[h],qe());}}}else if(r.nodeType===8)if(r.data===fi)l.push({type:2,index:o});else {let u=-1;for(;(u=r.data.indexOf(J,u+1))!==-1;)l.push({type:7,index:o}),u+=J.length-1;}o++;}}static createElement(i,e){let t=we.createElement("template");return t.innerHTML=i,t}};function Ce(s,i,e=s,t){if(i===F)return i;let r=t!==void 0?e.io?.[t]:e.ro,o=We(i)?void 0:i.ii;return r?.constructor!==o&&(r?.sr?.(false),o===void 0?r=void 0:(r=new o(s),r.ri(s,e,t)),t!==void 0?(e.io??=[])[t]=r:e.ro=r),r!==void 0&&(i=Ce(s,r.so(s,i.values),r,t)),i}var gt=class{constructor(i,e){this.or=[],this.K=void 0,this.nr=i,this.a=e;}get parentNode(){return this.a.parentNode}get b(){return this.a.b}u(i){let{el:{content:e},parts:t}=this.nr,r=(i?.creationScope??we).importNode(e,true);Te.currentNode=r;let o=Te.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Re(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Tt(o,this,i)),this.or.push(c),l=t[++a];}n!==l?.index&&(o=Te.nextNode(),n++);}return Te.currentNode=we,r}p(i){let e=0;for(let t of this.or)t!==void 0&&(t.strings!==void 0?(t.z(i,t,e),e+=t.strings.length-2):t.z(i[e])),e++;}},Re=class s{get b(){return this.a?.b??this.ar}constructor(i,e,t,r){this.type=2,this.e=w,this.K=void 0,this.X=i,this.xe=e,this.a=t,this.options=r,this.ar=r?.isConnected??true;}get parentNode(){let i=this.X.parentNode,e=this.a;return e!==void 0&&i?.nodeType===11&&(i=e.parentNode),i}get startNode(){return this.X}get endNode(){return this.xe}z(i,e=this){i=Ce(this,i,e),We(i)?i===w||i==null||i===""?(this.e!==w&&this.Ee(),this.e=w):i!==this.e&&i!==F&&this.lr(i):i.ce!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):nr(i)?this.k(i):this.lr(i);}O(i){return this.X.parentNode.insertBefore(i,this.xe)}T(i){this.e!==i&&(this.Ee(),this.e=this.O(i));}lr(i){this.e!==w&&We(this.e)?this.X.nextSibling.data=i:this.T(we.createTextNode(i)),this.e=i;}$(i){let{values:e,ce:t}=i,r=typeof t=="number"?this.oo(i):(t.el===void 0&&(t.el=Xe.createElement(lr(t.h,t.h[0]),this.options)),t);if(this.e?.nr===r)this.e.p(e);else {let o=new gt(r,this),n=o.u(this.options);o.p(e),this.T(n),this.e=o;}}oo(i){let e=or.get(i.strings);return e===void 0&&or.set(i.strings,e=new Xe(i)),e}k(i){mi(this.e)||(this.e=[],this.Ee());let e=this.e,t,r=0;for(let o of i)r===e.length?e.push(t=new s(this.O(qe()),this.O(qe()),this,this.options)):t=e[r],t.z(o),r++;r<e.length&&(this.Ee(t&&t.xe.nextSibling,r),e.length=r);}Ee(i=this.X.nextSibling,e){for(this.mt?.(false,true,e);i!==this.xe;){let t=Ji(i).nextSibling;Ji(i).remove(),i=t;}}setConnected(i){this.a===void 0&&(this.ar=i,this.mt?.(i));}},xe=class{get tagName(){return this.element.tagName}get b(){return this.a.b}constructor(i,e,t,r,o){this.type=1,this.e=w,this.K=void 0,this.element=i,this.name=e,this.a=r,this.options=o,t.length>2||t[0]!==""||t[1]!==""?(this.e=Array(t.length-1).fill(new String),this.strings=t):this.e=w;}z(i,e=this,t,r){let o=this.strings,n=false;if(o===void 0)i=Ce(this,i,e,0),n=!We(i)||i!==this.e&&i!==F,n&&(this.e=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=Ce(this,a[t+l],e,l),c===F&&(c=this.e[l]),n||=!We(c)||c!==this.e[l],c===w?i=w:i!==w&&(i+=(c??"")+o[l+1]),this.e[l]=c;}n&&!r&&this.j(i);}j(i){i===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},yt=class extends xe{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===w?void 0:i;}},bt=class extends xe{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==w);}},vt=class extends xe{constructor(i,e,t,r,o){super(i,e,t,r,o),this.type=5;}z(i,e=this){if((i=Ce(this,i,e,0)??w)===F)return;let t=this.e,r=i===w&&t!==w||i.capture!==t.capture||i.once!==t.once||i.passive!==t.passive,o=i!==w&&(t===w||r);r&&this.element.removeEventListener(this.name,this,t),o&&this.element.addEventListener(this.name,this,i),this.e=i;}handleEvent(i){typeof this.e=="function"?this.e.call(this.options?.host??this.element,i):this.e.handleEvent(i);}},Tt=class{constructor(i,e,t){this.element=i,this.type=6,this.K=void 0,this.a=e,this.options=t;}get b(){return this.a.b}z(i){Ce(this,i);}},eo=pi.litHtmlPolyfillSupport;eo?.(Xe,Re),(pi.litHtmlVersions??=[]).push("3.3.2");var dr=(s,i,e)=>{let t=e?.renderBefore??i,r=t.ao;if(r===void 0){let o=e?.renderBefore??null;t.ao=r=new Re(i.insertBefore(qe(),o),o,void 0,e??{});}return r.z(s),r};var yi=globalThis,le=class extends Q{constructor(){super(...arguments),this.renderOptions={host:this},this.si=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this.si=dr(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.si?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.si?.setConnected(false);}render(){return F}};le.ta=true,le.finalized=true,yi.litElementHydrateSupport?.({LitElement:le});var to=yi.litElementPolyfillSupport;to?.({LitElement:le});(yi.litElementVersions??=[]).push("4.2.2");var io={attribute:true,type:String,converter:Be,reflect:false,hasChanged:ft},ro=(s=io,i,e)=>{let{kind:t,metadata:r}=e,o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),t==="setter"&&((s=Object.create(s)).wrapped=true),o.set(e.name,s),t==="accessor"){let{name:n}=e;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,s,true,a);},init(a){return a!==void 0&&this.C(n,void 0,s,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,s,true,a);}}throw Error("Unsupported decorator location: "+t)};function b(s){return (i,e)=>typeof e=="object"?ro(s,i,e):((t,r,o)=>{let n=r.hasOwnProperty(o);return r.constructor.createProperty(o,t),n?Object.getOwnPropertyDescriptor(r,o):void 0})(s,i,e)}function y(s){return b({...s,state:true,attribute:false})}var pr=s=>s.strings===void 0;var ce={ATTRIBUTE:1,CHILD:2},B=s=>(...i)=>({ii:s,values:i}),X=class{constructor(i){}get b(){return this.a.b}ri(i,e,t){this.gt=i,this.a=e,this.co=t;}so(i,e){return this.update(i,e)}update(i,e){return this.render(...e)}};var Ye=(s,i)=>{let e=s.K;if(e===void 0)return false;for(let t of e)t.sr?.(i,false),Ye(t,i);return true},Ct=s=>{let i,e;do{if((i=s.a)===void 0)break;e=i.K,e.delete(s),s=i;}while(e?.size===0)},hr=s=>{for(let i;i=s.a;s=i){let e=i.K;if(e===void 0)i.K=e=new Set;else if(e.has(s))break;e.add(s),no(i);}};function so(s){this.K!==void 0?(Ct(this),this.a=s,hr(this)):this.a=s;}function oo(s,i=false,e=0){let t=this.e,r=this.K;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(t))for(let o=e;o<t.length;o++)Ye(t[o],false),Ct(t[o]);else t!=null&&(Ye(t,false),Ct(t));else Ye(this,s);}var no=s=>{s.type==ce.CHILD&&(s.mt??=oo,s.lo??=so);},xt=class extends X{constructor(){super(...arguments),this.K=void 0;}ri(i,e,t){super.ri(i,e,t),hr(this),this.isConnected=i.b;}sr(i,e=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),e&&(Ye(this,i),Ct(this));}setValue(i){if(pr(this.gt))this.gt.z(i,this);else {let e=[...this.gt.e];e[this.co]=i,this.gt.z(e,this,0);}}disconnected(){}reconnected(){}};var E=()=>new vi,vi=class{},bi=new WeakMap,k=B(class extends xt{render(s){return w}update(s,[i]){let e=i!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=i,this.ht=s.options?.host,this.rt(this.ct=s.element)),w}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let i=this.ht??globalThis,e=bi.get(i);e===void 0&&(e=new WeakMap,bi.set(i,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s);}else this.G.value=s;}get lt(){return typeof this.G=="function"?bi.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 Ee=class extends X{constructor(i){if(super(i),this.it=w,i.type!==ce.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===w||i==null)return this.cr=void 0,this.it=i;if(i===F)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.cr;this.it=i;let e=[i];return e.raw=e,this.cr={ce:this.constructor.resultType,strings:e,values:[]}}};Ee.directiveName="unsafeHTML",Ee.resultType=1;var Ze=class extends Ee{};Ze.directiveName="unsafeSVG",Ze.resultType=2;var Et=B(Ze);function Qe(s,i,e){return s?i(s):e?.(s)}var fr;(function(s){s.Token="token",s.FileInfo="file_info";})(fr||(fr={}));var mr;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success";})(mr||(mr={}));var St=class{yt=1;oi=[];bt=0;ni=new Map;ai=new Map;constructor(i){this.yt=i;}run(){let i=this.yt-this.bt;for(let e=0;e<i;e++){let t=this.oi.shift();if(!t)return;let r=this.ni.get(t),o=this.ai.get(t);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.bt+=1,t().finally(()=>{this.ni.delete(t),this.ai.delete(t),this.bt-=1,this.run();}).then(n=>r(n)).catch(n=>o(n));}}add(i,{autoRun:e}={autoRun:true}){return new Promise((t,r)=>{this.ni.set(i,t),this.ai.set(i,r),this.oi.push(i),e&&this.run();})}get pending(){return this.oi.length}get running(){return this.bt}set concurrency(i){this.yt=i,this.run();}get concurrency(){return this.yt}};var gr=()=>({});var Me=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var T=s=>`*cfg/${s}`;var Se=s=>s?s.split(",").map(i=>i.trim()).filter(Boolean):[],ke=s=>s.join(",");var yr=s=>{if(typeof s!="string"||!s)return "";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},kt=(...s)=>s.filter(i=>typeof i=="string"&&!!i).map(i=>yr(i)).join("/-/"),ee=(...s)=>{let i=kt(...s);return i?`-/${i}/`:""};function At(s){let i=new URL(s),e=i.pathname+i.search+i.hash,t=e.lastIndexOf("http"),r=e.lastIndexOf("/"),o="";return t>=0?o=e.slice(t):r>=0&&(o=e.slice(r+1)),o}function Ot(s){let i=new URL(s),{pathname:e}=i,t=e.indexOf("/"),r=e.indexOf("/",t+1);return e.substring(t+1,r)}function Ti(s){let i=br(s),e=new URL(i),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function wi(s){return Ti(s).split("/-/").filter(Boolean).map(e=>yr(e))}function br(s){let i=new URL(s),e=At(s),t=vr(e)?Tr(e).pathname:e;return i.pathname=i.pathname.replace(t,""),i.search="",i.hash="",i.toString()}function vr(s){return s.startsWith("http")}function Tr(s){let i=new URL(s);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var te=(s,i,e)=>{let t=new URL(br(s)),r=At(s),o=i??"";if(t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),r&&vr(r)){let n=Tr(r);t.pathname=`${t.pathname}${o}${n.pathname||""}`,t.search=n.search,t.hash=n.hash;}else t.pathname=`${t.pathname}${o}${r||""}`;return t.toString()},Ci=(s,i)=>{let e=new URL(s);return e.pathname=`${i}/`,e.toString()};var Je=(s,i=",")=>s.trim().split(i).map(e=>e.trim()).filter(e=>e.length>0);var et=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}),Cr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ao(s,i){if(typeof i=="number"){let e=i;return et[s]!==e?`${s}/${e}`:""}if(typeof i=="boolean"){let e=i;return et[s]!==e?`${s}`:""}if(s==="filter"&&i){let{name:e,amount:t}=i;return et.filter===t?"":`${s}/${e}/${t}`}if(s==="crop"&&i){let{dimensions:e,coords:t}=i;return `${s}/${e.join("x")}/${t.join(",")}`}return ""}function ue(s){return kt(...Cr.filter(i=>typeof s[i]<"u"&&s[i]!==null).map(i=>{let e=s[i];return ao(i,e)}).filter(i=>!!i))}var Pt=kt("format/auto","progressive/yes"),ie=([s])=>typeof s<"u"?Number(s):void 0,wr=()=>true,lo=([s,i])=>({name:s,amount:typeof i<"u"?Number(i):100}),co=([s,i])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Je(s,"x").map(Number),coords:Je(i).map(Number)}},uo=Object.freeze({enhance:ie,brightness:ie,exposure:ie,gamma:ie,contrast:ie,saturation:ie,vibrance:ie,warmth:ie,filter:lo,mirror:wr,flip:wr,rotate:ie,crop:s=>{let[i,e]=s,{dimensions:t,coords:r}=co([i,e]);return {dimensions:t,coords:r}}});function xi(s){let i={};for(let e of s){let[t,...r]=e.split("/");if(!t||!Cr.includes(t))continue;let o=t,n=uo[o];try{let a=n(r);i[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var A=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),N=Object.freeze([A.CROP,A.TUNING,A.FILTERS]),xr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Er=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"]),Sr=Object.freeze(["rotate","mirror","flip"]),re=et,G=Object.freeze({brightness:{zero:re.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:re.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:re.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:re.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:re.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:re.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:re.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:re.enhance,range:[0,100],keypointsNumber:1},filter:{zero:re.filter,range:[0,100],keypointsNumber:1}});var Ei="https://ucarecdn.com",po="https://upload.uploadcare.com",ho="https://social.uploadcare.com",fo="https://ucarecd.net",mo={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:Ei,cdnCnamePrefixed:fo,baseUrl:po,socialBaseUrl:ho,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:ke(N),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"auto",dynamicButtonShowFirstIcon:true},I=Object.freeze(mo);var Rt=(s,i)=>(...e)=>{let t=s();if(!t.read(T("debug")))return;let r=e;if(typeof e?.[0]=="function"){let n=e[0];r=n();}let o=[t.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...r);};var U=class{constructor(i){this.li=new Set;this.ue=null;this.Y=Rt(()=>this.s.ctx,this.constructor.name);this.s=i,this.i=i.ctx;}addSub(i){this.li.add(i);}get ur(){if(!this.ue){let i={};this.ue=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(e,t)=>{if(typeof t!="string")return;let r=T(t);return this.s.ctx.has(r)?this.s.ctx.read(r):I[t]}});}return this.ue}destroy(){for(let i of this.li)try{i();}catch{}this.li.clear();}},go={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},H=(s,i,e=true)=>{let t=s.has(i),r=t?s.read(i):null;if(t&&r||!e)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},kr=s=>({get ctx(){return s()},get modalManager(){return H(s(),"*modalManager",false)},get pluginManager(){return H(s(),"*pluginManager")},get telemetryManager(){return H(s(),"*telemetryManager")},get localeManager(){return H(s(),"*localeManager")},get a11y(){return H(s(),"*a11y")},get routerLayer(){return H(s(),"*routerLayer")},get blocksRegistry(){return H(s(),"*blocksRegistry")},get eventEmitter(){return H(s(),"*eventEmitter")},get uploadCollection(){return H(s(),"*uploadCollection")},get secureUploadsManager(){return H(s(),"*secureUploadsManager",false)},get api(){return H(s(),"*publicApi")},get validationManager(){return H(s(),"*validationManager")},when(i,e){let t=go[i],r=s(),o=r.has(t)?r.read(t):void 0;if(o)return e(o),()=>{};let n;return n=r.sub(t,a=>{a&&(e(a),n?.());}),n},wait(i){return new Promise(e=>{let t;t=this.when(i,r=>{e(r),t?.();});})}});var yo=new Set([Me.START_FROM,Me.UPLOAD_LIST]),Mt=class extends U{constructor(e){super(e);this.scopes=new Set;this.listener=this.uo.bind(this),window.addEventListener("paste",this.listener);}po(e){if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]");return !!(t&&t.getAttribute("contenteditable")?.toLowerCase()!=="false"||e.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}ho(e){return e.composedPath().some(t=>this.po(t))}fo(e){return typeof e=="string"&&yo.has(e)}mo(){return [...this.scopes].some(e=>e.isConnected)}go(){return [...this.scopes].some(e=>e.isConnected&&e instanceof Element&&e.localName==="uc-file-uploader-regular")}yo(e){return e?[...this.scopes].some(t=>t.isConnected&&t.contains(e)):false}bo(e){let t=e.trim();if(!t)return null;try{let r=new URL(t);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}openUploadList(){this.s.routerLayer.navigateAfterFileAdd();}async uo(e){if(!e.clipboardData||this.ho(e)||!this.mo())return;let t=this.s.ctx.read("*currentActivity"),r=t===null,o=this.fo(t);switch(this.ur.pasteScope){case "global":if(!o&&!(r&&this.go()))return;await this.handlePaste(e);return;case "local":{let n=e.target instanceof Node?e.target:null;if(!this.yo(n)||!o&&!r)return;await this.handlePaste(e);return}default:return}}async handlePaste(e){if(!e.clipboardData)return;let t=Array.from(e.clipboardData.items),r=t.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),o=t.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.bo(c));});})),n=false;if(r.length>0&&(r.forEach(a=>{this.s.api.addFileFromObject(a,{source:"clipboard"});}),n=true),o.length>0){let a=(await Promise.all(o)).filter(l=>l!==null);a.forEach(l=>{this.s.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&this.openUploadList();}registerBlock(e){return this.scopes.add(e),()=>{this.scopes.delete(e);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var Lt=class extends U{constructor(){super(...arguments);this.vt=[];}registerAfterFileAddHook(e){return this.vt.push(e),()=>{this.vt=this.vt.filter(t=>t!==e);}}navigateAfterFileAdd(){let t={historyLength:this.s.ctx.read("*history").length};this.vt.some(o=>o(t))||(this.s.ctx.pub("*currentActivity",Me.UPLOAD_LIST),this.s.modalManager?.open(Me.UPLOAD_LIST));}};var bo={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function tt(s,i){i.tabIndex=0,i.focus(),s.tabIndex=-1;}function Si(s){let i=s.role||s.type||s.tagName;if(!i)return null;let e=bo[i.toLowerCase()];if(!e)return null;for(let t of e){let r=s.closest(`[role=${t}]`);if(r)return r}}function ki(s,i){return i.role==="toolbar"?To(i):i.querySelectorAll(`[role=${s.role}]`)}function vo(s,i){return Array.from(s).filter(e=>{let t=e.parentElement;for(;t&&t!==i;){if(t.getAttribute("aria-hidden")==="true")return false;t=t.parentElement;}return true})}function To(s){return [...s.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function wo(s){let i=s.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let e=s.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function Ar(s){return i=>{let e=false,t=300,r=0,o="";function n(u){let h=Si(u.target);if(!h){a();return}let f=ki(u.target,h),m=vo(f,h),P=Array.from(m).indexOf(u.target),R="ArrowDown",O="ArrowUp";if(wo(h)&&(i.document.dir==="rtl"?(R="ArrowLeft",O="ArrowRight"):(R="ArrowRight",O="ArrowLeft")),u.key===R)u.preventDefault(),tt(u.target,m[P+1]||m[0]);else if(u.key===O)u.preventDefault(),tt(u.target,m[P-1]||m[m.length-1]);else if(u.key==="Home")u.preventDefault(),tt(u.target,m[0]);else if(u.key==="End")u.preventDefault(),tt(u.target,m[m.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=t?o+=u.key.toLowerCase():o=u.key.toLowerCase(),r=u.timeStamp;let j=Array.from(f).find(ci=>ci.textContent?.trim()?.toLowerCase()?.startsWith(o));j&&(u.preventDefault(),tt(u.target,j));}}function a(){e=false,i.removeEventListener("keydown",n);}function l(u){let h=Si(u.target);if(h){e||(e=true,i.addEventListener("keydown",n));let f=ki(u.target,h);for(let m of f)m!==u.target&&m.setAttribute("tabindex",-1);}else e&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=Si(u.target);if(h){let f=ki(u.target,h);for(let m of f)m!==u.target&&m.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function Or(){return s=>{let i,e;function t(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),e=i.hidden,e&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function r(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),e&&(i.hidden=true),i=null);}return s.addEventListener("keyuxJump",t),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",t),s.removeEventListener("focusout",r);}}}function Pr(){return s=>{let i=[];function e(l){let c=s.document.activeElement;c&&c!==s.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function t(){let l=i.pop();if(!l){s.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():t();}let r=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:true})),e(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&t();}return s.addEventListener("keydown",a),()=>{s.removeEventListener("keydown",a);}}}function Rr(s){let i,e=s.split(" "),t;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...e),i=a.target,t=a.target);}function o(){i&&(i.classList.remove(...e),i=0,setTimeout(()=>{t=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(o(),t!==a.target&&(a.target.classList.add(...e),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",o);})}function Mr(s,i){let e=i.map(t=>t(s));return ()=>{e.forEach(t=>t());}}var Ai=class{constructor(){this.E=new Map;this.ci=[];}addEventListener(i,e){let t=r=>{let o=r.target;o instanceof Node&&this.ci.some(n=>n===o||n.contains(o))&&e(r);};this.E.set(e,t),window.addEventListener(i,t);}removeEventListener(i,e){let t=this.E.get(e);t&&window.removeEventListener(i,t),this.E.delete(e);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.ci.push(i);}destroy(){this.ci=[];for(let i of this.E.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.E.clear();}},It=class{constructor(){this.Tt=new Ai,this.pr=Mr(this.Tt,[Ar(),Rr("is-pressed"),Pr(),Or()]);}registerBlock(i){this.Tt.registerScope(i);}destroy(){this.pr?.(),this.Tt.destroy();}};var it={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var Oi=new Map,Lr=new Map,Ir=(s,i)=>{Oi.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`);let e={...it,...i};return Oi.set(s,e),e},Co=(s,i)=>{Lr.set(s,i);},xo=(s,i)=>{typeof i=="function"?Co(s,i):Ir(s,i);},Ur=async s=>{let i=Oi.get(s);if(!i){let e=Lr.get(s);if(!e)throw new Error(`Locale ${s} is not defined`);let t=await e();i=Ir(s,t);}return i};xo("en",it);var se=s=>`*l10n/${s}`,Eo="en",Ut=class extends U{constructor(e){super(e);this.Se="";for(let[r,o]of Object.entries(it)){let n=this.i.has(se(r))?!this.i.read(se(r)):true;this.i.add(se(r),o,n);}let t=e.pluginManager;t?.onPluginsChange&&this.addSub(t.onPluginsChange(()=>{this.Se&&this.dr(this.Se);})),this.addSub(this.i.sub(T("localeName"),async r=>{if(!r)return;this.Se=r;let o=await Ur(r);r!==Eo&&this.Se!==r||(this.dr(r),this.hr(r,o));})),this.addSub(this.i.sub(T("localeDefinitionOverride"),r=>{if(!r)return;let o=r[this.Se];o&&this.hr(this.Se,o);}));}hr(e,t){let r=this.ur.localeDefinitionOverride?.[e];for(let[o,n]of Object.entries(t)){let a=r?.[o];this.i.add(se(o),a??n,true);}}dr(e){let t=this.s.pluginManager;if(!t)return;let r=t.snapshot();for(let o of r.l10n){let{pluginId:n,...a}=o,l=a[e];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.i.add(se(c),d,true);}}};var Le=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),$t=class extends U{constructor(){super(...arguments);this.pe=new Map;this.q=new Set;this.v=new Map;}registerModal(e,t){this.pe.set(e,t),this.Ae(Le.ADD,{id:e,modal:t});}deleteModal(e){let t=this.pe.get(e);return t?(this.pe.delete(e),this.q.delete(e),this.Ae(Le.DELETE,{id:e,modal:t}),true):false}open(e){let t=this.pe.get(e);return t?(this.q.add(e),this.Ae(Le.OPEN,{modal:t,id:e}),true):(this.Y(`Modal with ID "${e}" not found`),false)}close(e){let t=this.pe.get(e);return !t||!this.q.has(e)?(this.Y(`Modal with ID "${e}" not found or not active`),false):(this.q.delete(e),this.Ae(Le.CLOSE,{id:e,modal:t}),true)}toggle(e){return this.pe.has(e)?this.q.has(e)?this.close(e):this.open(e):(this.Y(`Modal with ID "${e}" not found`),false)}get hasActiveModals(){return this.q.size>0}back(){if(this.q.size===0)return this.Y("No active modals to go back from"),false;let e=Array.from(this.q).pop();return e?this.close(e):false}closeAll(){let e=this.q.size;return this.q.clear(),this.Ae(Le.CLOSE_ALL,{}),e}subscribe(e,t){return this.v.has(e)||this.v.set(e,new Set),this.v.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this.v.has(e)&&this.v.get(e)?.delete(t);}Ae(e,t){if(this.v.has(e))for(let r of this.v.get(e)??new Set)try{r(t);}catch(o){this.s.telemetryManager.sendEventError(o,"modal subscriber"),this.Y("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.pe.clear(),this.v.clear(),this.Ae(Le.DESTROY,{});}};var So=()=>{let s=navigator.userAgent;return /Macintosh|Windows/.test(s)&&/Version\/[\d.]+.*Safari/.test(s)&&!/Chrome|Chromium|Edg|OPR/.test(s)},ko=()=>"capture"in document.createElement("input"),Ao=()=>({safariDesktop:So()}),Oo=()=>({htmlMediaCapture:ko()}),$r=Ao();Oo();var Nr="image/*";var Po=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ro=()=>$r.safariDesktop?[Nr]:[Nr,...Po],Mo=Ro();var Lo=(s,i)=>i.some(e=>{if(e.endsWith("*")){let t=e.replace("*","");return s.startsWith(t)}return s===e});var Dr=s=>{let i=s?.type;return i?Lo(i,Mo):false};var Pi=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),Io=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),_r=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Io,...Pi});({[Pi.DROPBOX_CHOOSER]:Pi.DROPBOX});function Fr(s){return {fileInfo:s,uuid:s.uuid,cdnUrl:s.cdnUrl,fileName:s.originalFilename??null,fileSize:s.size,isImage:s.isImage??false,mimeType:s.contentInfo?.mime?.mime??s.mimeType??null,uploadProgress:100}}function Vr(s,i,e,t,r){return {registry:{registerSource:c=>s.addSource(t,c),registerActivity:c=>s.addActivity(t,c),registerFileAction:c=>s.addFileAction(t,c),registerFileHook:c=>s.addFileHook(t,c),registerIcon:c=>s.addIcon(t,c),registerL10n:c=>s.addL10n(t,c),registerConfig:c=>{s.addConfig(t,c);let d=T(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=T(c);return i.read(d)},subscribe:(c,d)=>{let u=T(c),h=i.sub(u,f=>{d(f);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=e.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));},replace:(c,d,{silent:u,fileName:h,source:f}={})=>{let m=c,P=e.uploadCollection,R=P.items().indexOf(m),O=P.read(m);if(R===-1||!O)throw new Error(`File with internalId ${c} not found`);let j={source:O.getValue("source"),metadata:O.getValue("metadata"),fullPath:O.getValue("fullPath"),silent:O.getValue("silent")};P.remove(m);let ci=P.add({...Fr(d),fileName:h??d.originalFilename??null,silent:u??j.silent,source:f??j.source??_r.API,metadata:j.metadata,fullPath:j.fullPath},{index:R});return e.api.getOutputItem(ci)}}}}var Uo=async({entries:s,signal:i})=>(await Promise.all(s.map(async t=>{if(t.isEnabled())try{let r=await t.load();return i.aborted||!t.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(t=>t!==void 0),Nt=class{constructor(i,e){this.i=i;this.To=e;this.$e=new Set;this.fr=this.i.sub("*lazyPlugins",t=>{this.vo(t??[]);});}vo(i){for(let r of this.$e)r();if(this.$e.clear(),i.length===0)return;let e=new Set([T("plugins")]);for(let r of i)for(let o of r.configDeps)e.add(T(o));let t=()=>this.mr(i);for(let r of e)this.$e.add(this.i.sub(r,t,false));this.mr(i);}mr(i){this.ui?.abort();let e=new AbortController;this.ui=e;let t=n=>this.i.read(T(n)),r=t("plugins"),o=Uo({entries:i.map(n=>({isEnabled:()=>n.isEnabled(t),load:n.load})),signal:e.signal}).then(n=>{if(!e.signal.aborted)return [...r,...n]});this.To(o);}destroy(){this.fr();for(let i of this.$e)i();this.$e.clear(),this.ui?.abort();}};function M(s,i){let e,t=((...r)=>{e&&clearTimeout(e),e=setTimeout(()=>s(...r),i);});return t.cancel=()=>{e&&clearTimeout(e);},t}var Dt=class{constructor(){this.de=new Map;}register(i,e){if(this.de.has(e.name)){console.warn(`[CustomConfig] Config option "${e.name}" is already registered`);return}let t={attribute:true,...e,pluginId:i};this.de.set(e.name,t);}unregister(i){this.de.delete(i);}unregisterByPlugin(i){for(let[e,t]of this.de)t.pluginId===i&&this.de.delete(e);}get(i){return this.de.get(i)}getAll(){return new Map(this.de)}};var _t=class{constructor(i=()=>{}){this.De=[];this._e=[];this.wt=[];this.Ct=[];this.xt=[];this.Et=[];this.config=new Dt;this.Z=M(i,0);}destroy(){this.Z.cancel();}ke(i,e){return {...e,pluginId:i}}addSource(i,e){let t=this.De.find(r=>r.id===e.id);if(t){console.warn(`[Plugin "${i}"] Source with id "${e.id}" is already registered by plugin "${t.pluginId}". Skipping.`);return}this.De.push(this.ke(i,e)),this.Z();}addActivity(i,e){let t=this._e.find(r=>r.id===e.id);if(t){console.warn(`[Plugin "${i}"] Activity with id "${e.id}" is already registered by plugin "${t.pluginId}". Skipping.`);return}this._e.push(this.ke(i,e)),this.Z();}addFileAction(i,e){this.wt.push(this.ke(i,e)),this.Z();}addFileHook(i,e){this.Ct.push(this.ke(i,{timeout:3e4,...e})),this.Z();}addIcon(i,e){this.xt.push(this.ke(i,e)),this.Z();}addL10n(i,e){this.Et.push(this.ke(i,e)),this.Z();}addConfig(i,e){this.config.register(i,e),this.Z();}purge(i){this.De=this.De.filter(e=>e.pluginId!==i),this._e=this._e.filter(e=>e.pluginId!==i),this.wt=this.wt.filter(e=>e.pluginId!==i),this.Ct=this.Ct.filter(e=>e.pluginId!==i),this.xt=this.xt.filter(e=>e.pluginId!==i),this.Et=this.Et.filter(e=>e.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.De],activities:[...this._e],fileActions:[...this.wt],fileHooks:[...this.Ct],icons:[...this.xt],l10n:[...this.Et]}}};var Ft=class extends U{constructor(e){super(e);this.he=new Map;this.v=new Set;this.pi=Promise.resolve();this.registry=new _t(()=>this.St());this.gr=new Nt(this.i,t=>{this.pi=this.pi.then(()=>t).then(r=>{if(r)return this.wo(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.pi}onPluginsChange(e){return this.v.add(e),()=>{this.v.delete(e);}}async wo(e){let t=new Set(this.he.keys()),r=new Set;for(let o of e){if(!o.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(o.id)){console.warn(`[PluginManager] Plugin "${o.id}" is already in the list, skipping duplicate`);continue}if(r.add(o.id),!this.he.has(o.id))try{await this.Co(o);}catch(n){this.registry.purge(o.id),this.St(),console.error(`[PluginManager] Plugin "${o.id}" setup() threw an error`,n);}t.delete(o.id);}for(let o of t)this.di(o);}async Co(e){this.he.has(e.id)&&this.di(e.id);let t=[],r=Vr(this.registry,this.i,this.s,e.id,t),o=this.s.api,n;try{n=await e.setup({pluginApi:r,uploaderApi:o})??void 0;}catch(a){for(let l of t)try{l();}catch(c){this.Y("Failed to unsubscribe config listener",c);}throw a}this.he.set(e.id,{plugin:e,dispose:n,configSubscriptions:t}),this.St();}di(e){let t=this.he.get(e);if(t){this.registry.purge(e);for(let r of t.configSubscriptions)try{r();}catch(o){this.Y("Failed to unsubscribe config listener",o);}t.dispose?.(),this.he.delete(e),this.St();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(e){let t=e.getValue("file");if(!t)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let o=t,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:o,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:o}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}o!==t&&(e.setValue("file",o),e.setValue("fileSize",o.size),e.setValue("mimeType",o.type||null),e.setValue("isImage",Dr(o)),o instanceof File&&e.setValue("fileName",o.name));}destroy(){for(let e of Array.from(this.he.keys()))this.di(e);this.registry.destroy(),this.gr.destroy(),super.destroy();}St(){for(let e of this.v)try{e();}catch{}}};function $o(s){return s.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Mi(s){return Array.isArray(s)?s.map(i=>typeof i=="object"&&i!==null?Mi(i):i):typeof s!="object"||s===null?s:Object.fromEntries(Object.entries(s).map(([i,e])=>{let t=$o(i);return typeof e=="object"&&e!==null?[t,Mi(e)]:[t,e]}))}function No(s){return {ok:true,value:s}}function Ri(s){return {ok:false,error:s}}var Do="https://tlm.uploadcare.com/api/",Li=class{constructor(i=Do){this.baseUrl=i;}async base(i,e={}){let t=`${this.baseUrl}${i}`;try{let r=await fetch(t,e);if(!r.ok)return Ri(new Error(`Got non-200 response from "${t}". Status: ${r.status.toString()}`));try{let o=await r.json();return No(o)}catch(o){return Ri(new Error(`Error parsing JSON from "${t}". Error: ${o}`))}}catch(r){return Ri(new Error(`Error fetching data from "${t}". Error: ${r}`))}}async post(i,e,t={}){return await this.base(i,{...t,method:"POST",body:JSON.stringify(Mi(e)),headers:{"Content-Type":"application/json",...t.headers||{}}})}async get(i,e={}){return await this.base(i,{method:"GET",...e})}},_o=async(s,i)=>({success:true,data:i}),Fo=async s=>_o(void 0,s),Vt=class extends Li{constructor(){super();}async sendEvent(i,e){let t=await Fo(i);if(!t.success)throw console.error("TelemetryAPIService: events: body is invalid",t.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,e)}};var Vo=20,oe=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ne=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"}),Kt=class extends U{constructor(){super(...arguments);this.Fe=new Map;this.At=new Set;this.E=new Map;}bindTarget(e){return this.At.add(e),()=>{this.At.delete(e);}}on(e,t){let r=this.E.get(e);return r||(r=new Set,this.E.set(e,r)),r.add(t),()=>this.E.get(e)?.delete(t)}yr(e,t){for(let o of this.At)o.dispatchEvent(new CustomEvent(e,{detail:t}));let r=this.E.get(e);if(r)for(let o of r)o(t);this.Y?.(()=>{let o=t&&typeof t=="object"?{...t}:t;return [`event "${e}"`,o]});}emit(e,t,r={}){let{debounce:o}=r;if(typeof o!="number"&&!o){this.yr(e,typeof t=="function"?t():t);return}this.Fe.has(e)&&window.clearTimeout(this.Fe.get(e));let n=typeof o=="number"?o:Vo,a=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this.yr(e,l),this.Fe.delete(e);}catch(l){this.Y?.(()=>`Error while getting payload for event "${e}"`,l);}},n);this.Fe.set(e,a);}destroy(){for(let e of this.Fe.values())window.clearTimeout(e);this.At.clear(),this.E.clear();}};var Kr="1.32.0-alpha.1";var Ie="blocks",Ue=Kr;var de=class s{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():s.generateFastUid()}};var zt=class extends U{constructor(e){super(e);this.xo=de.generateRandomUUID();this.Pe=structuredClone(I);this.hi=false;this.fi=null;this.mi=false;this.br=new Vt,this.vr=new St(10),this.addSub(this.i.sub(T("qualityInsights"),t=>{this.mi=!!t;}));for(let t of Object.keys(this.Pe))this.addSub(this.i.sub(T(t),r=>{this.mi&&(this.hi&&this.Pe[t]!==r&&this.sendEvent({eventType:oe.CHANGE_CONFIG}),this.Eo(t,r));}));}So(e){e===oe.INIT_SOLUTION&&!this.hi&&(this.hi=true);}Eo(e,t){this.Pe[e]!==t&&(this.Pe[e]=t);}Ao(e){let t=e.payload?{...e.payload}:{};t.activity&&(t.activity=void 0);let r={...e};return (e.eventType===oe.INIT_SOLUTION||e.eventType===oe.CHANGE_CONFIG)&&(r.config=this.Pe),{...r,appVersion:Ue,appName:Ie,sessionId:this.xo,component:this.ko,activity:this.Po,projectPubkey:this.Pe.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Oo,payload:{location:this.Ro,...t}}}Mo(e){return !!(e&&[ne.CHANGE,ne.COMMON_UPLOAD_PROGRESS,ne.FILE_ADDED,ne.FILE_REMOVED,ne.FILE_UPLOAD_START,ne.FILE_UPLOAD_PROGRESS,ne.FILE_UPLOAD_SUCCESS,ne.FILE_UPLOAD_FAILED].includes(e))}sendEvent(e){if(!this.mi)return;let t=this.Ao({eventType:e.eventType,payload:e.payload,config:e.config});this.So(e.eventType),!(this.Mo(e.eventType)||this.fi&&this.Tr(this.fi,t))&&this.vr.add(async()=>{this.fi=t,await this.br.sendEvent(t);});}sendEventError(e,t="unknown"){this.sendEvent({eventType:oe.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:e.message}}});}sendEventCloudImageEditor(e,t,r={}){this.sendEvent({eventType:oe.ACTION_EVENT,payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...r}}});}Tr(e,t){if(JSON.stringify(e)===JSON.stringify(t))return true;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return false;let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return false;for(let n of r)if(!Object.hasOwn(t,n)||!this.Tr(e[n],t[n]))return false;return true}get Oo(){return Date.now()}get ko(){if(!this.i.has("*solution"))return null;let e=this.i.read("*solution");return e?e.toLowerCase():null}get Po(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get Ro(){return location.origin}};var q=[],pe=0,jt=4,zr=s=>{let i=[],e={get(){return e.lc||e.listen(()=>{})(),e.value},lc:0,listen(t){return e.lc=i.push(t),()=>{for(let o=pe+jt;o<q.length;)q[o]===t?q.splice(o,jt):o+=jt;let r=i.indexOf(t);~r&&(i.splice(r,1),--e.lc||e.off());}},notify(t,r){let o=!q.length;for(let n of i)q.push(n,e.value,t,r);if(o){for(pe=0;pe<q.length;pe+=jt)q[pe](q[pe+1],q[pe+2],q[pe+3]);q.length=0;}},off(){},set(t){let r=e.value;r!==t&&(e.value=t,e.notify(r));},subscribe(t){let r=e.listen(t);return t(e.value),r},value:s};return e};function Ht(s,i,e){let t=new Set(i).add(void 0);return s.listen((r,o,n)=>{t.has(n)&&e(r,o,n);})}function Ii(s,i,e){let t=Ht(s,i,e);return e(s.value),t}var Ui=(s={})=>{let i=zr(s);return i.setKey=function(e,t){let r=i.value;typeof t>"u"&&e in i.value?(i.value={...i.value},delete i.value[e],i.notify(r,e)):i.value[e]!==t&&(i.value={...i.value,[e]:t},i.notify(r,e));},i};var Ae=class s{static{this.Ke=new Map;}constructor(i,e){this.wr=i,this.W=e;}get id(){return this.wr}pub(i,e){i in this.W.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.W.setKey(i,e);}sub(i,e,t=true){return (t?Ii:Ht)(this.W,[i],o=>{e(o[i]);})}read(i){return i in this.W.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.W.get()[i]}add(i,e,t=false){(!(i in this.W.get())||t)&&this.W.setKey(i,e);}has(i){return i in this.W.get()}get store(){return this.W.get()}static registerCtx(i,e){if(s.Ke.has(e))throw new Error(`PubSub: Context with id "${e}" already exists`);let t=Ui(i);return s.Ke.set(e,t),new s(e,t)}static deleteCtx(i){s.Ke.delete(i);}static getCtx(i){let e=s.Ke.get(i);return e?new s(i,e):null}static hasCtx(i){return s.Ke.has(i)}};var jr=s=>{let i=new Intl.Locale(s),e="ltr",t=i.getTextInfo?.().direction;return t?e=t:i.textInfo?.direction&&(e=i.textInfo.direction),e};var jo=s=>s;var Hr="plural:";function Bt(s,i={},e={}){let{openToken:t="{{",closeToken:r="}}",transform:o=jo}=e;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);s=s.replaceAll(t+n+r,c);}return s}function Br(s){let i=[],e=s.indexOf("{{");for(;e!==-1;){let t=s.indexOf("}}",e);if(t===-1)break;let r=s.substring(e+2,t);if(r.startsWith(Hr)){let o=s.substring(e+2,t).replace(Hr,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}e=s.indexOf("{{",t);}return i}var Gr="--uploadcare-blocks-window-height",rt=class s{static{this.clientsRegistry=new Set;}static{this.flush=M(()=>{document.documentElement.style.setProperty(Gr,`${window.innerHeight}px`);},100);}static registerClient(i){s.clientsRegistry.size===0&&s.attachTracker(),s.clientsRegistry.add(i);}static unregisterClient(i){s.clientsRegistry.delete(i),s.clientsRegistry.size===0&&s.detachTracker();}static attachTracker(){window.addEventListener("resize",s.flush,{passive:true,capture:true}),s.flush();}static detachTracker(){window.removeEventListener("resize",s.flush,{capture:true}),document.documentElement.style.removeProperty(Gr);}};var Ho=/\\([0-9a-fA-F]{1,6} ?)/g;function Bo(s){return s.length<2?false:(s[0]==='"'||s[0]==="'")&&(s[s.length-1]==='"'||s[s.length-1]==="'")}function Go(s){let i=s;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function qo(s){let i="",e="";for(let t=0;t<s.length;t++){let r=s[t+1];s[t]==="\\"&&r==='"'?(i+='\\"',t++):s[t]==='"'&&e!=="\\"?i+='\\"':i+=s[t],e=s[t]??"";}return i}function qr(s){let i=s;Bo(s)&&(i=Go(i),i=i.replace(Ho,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=qo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Wr(s){class i extends s{constructor(){super(...arguments);this.Cr=null;this.gi=null;}getCssData(r,o=false){let n=this.Cr??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.gi||(this.gi=window.getComputedStyle(this));let a=this.gi.getPropertyValue(r).trim();try{n[r]=qr(a);}catch(l){o||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.Cr=n,n[r]}}return i}function Xr(s){class i extends s{constructor(){super(...arguments);this.willYield=true;this.fe={};this.me=null;this.kt=false;}createRenderRoot(){return this}connectedCallback(){this.me||(this.me=Array.from(this.childNodes)),super.connectedCallback();}Lo(){if(this.kt)return;this.kt=true,this.fe={};let r=Array.from(this.childNodes),o=r.length?r:this.me??[];for(let n of o){let a=this.xr(n),l=this.fe[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.fe[a]=l;}this.me=null;}xr(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.xr(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Io(r){return !r.textContent||!r.textContent.trim()}Uo(r){let o=this.fe[r];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Io(n))}update(r){!this.hasUpdated&&this.willYield&&this.Lo(),super.update(r);}yield(r,o){if(r===""&&!this.fe[r]&&!this.kt&&this.me?.length){let a=[];for(let l of this.me)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.fe[r]=a,this.kt=true,this.me=null;}let n=this.fe[r];return g` ${n} ${this.Uo(r)?o:void 0} `}}return i}var Yr=(s,i)=>new Intl.PluralRules(s).select(i);var Wo=s=>(i,e)=>{let t=s(),r=t("locale-id")||"en",o=Yr(r,e);return t(`${i}__${o}`)},Zr=s=>{let i=Wo(()=>e),e=(t,r={})=>{if(!t)return "";let n=s().read(se(t))||t,a=Br(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return Bt(n,r)};return e};function Qr(s){class i extends s{static reg(t){let r=this,o=window.customElements.get(t);if(o){o!==r&&console.warn([`Element with tag name "${t}" 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(t,r);}}return i}var he=class extends Event{constructor(i,e,t,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=e,this.callback=t,this.subscribe=r??false;}};var $e=class{constructor(i,e,t,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(o,n)),this.unsubscribe=n;},this.host=i,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??false;}else this.context=e,this.callback=t,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 he(this.context,this.host,this.t,this.subscribe));}};var Gt=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,e=false){let t=e||!Object.is(i,this.o);this.o=i,t&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t);},i!==void 0&&(this.value=i);}addCallback(i,e,t){if(!t)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:e});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var $i=class extends Event{constructor(i,e){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=e;}},Ne=class extends Gt{constructor(i,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=r=>{if(r.context!==this.context)return;let o=r.contextTarget??r.composedPath()[0];o!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,o,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let o=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)o.has(n)||(o.add(n),a.dispatchEvent(new he(this.context,a,n,true)));r.stopPropagation();},this.host=i,e.context!==void 0?this.context=e.context:this.context=e,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 $i(this.context,this.host));}};var Jr="ctx-name-context";function es(){return function(s){class i extends s{constructor(...r){super(...r);this.S=null;this.Ve=false;this.yi=false;this.bi=void 0;this.Oe=new Map;this.ze=new Set;this.init$={};this.ctxOwner=false;this.Pt=void 0;this.Ot=false;this.ctxName=this.ee;this.te=false;this.Pt=this.getAttribute("ctx-name")||void 0,this.ctxName=this.ee,this.No=new $e(this,{context:Jr,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Ar=o,this.Sr();},subscribe:true});}static set template(r){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Er(){return this.Pt}set Er(r){let o=r??void 0;this.Pt!==o&&(this.Pt=o,this.Sr());}shouldUpdate(r){return this.te?super.shouldUpdate(r):false}get ee(){return this.Er||this.Ar||void 0}Sr(){if(this.ctxName=this.ee,!(!this.ctxName||this.Ve)){if(this.isConnected){this.vi();return}this.Ot=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.ee,this.ctxName&&(this.bi?this.bi.setValue(this.ctxName):this.bi=new Ne(this,{context:Jr,initialValue:this.ctxName}));}kr(){if(!(!this.S||this.Oe.size===0)){for(let[r,{value:o,rewrite:n}]of this.Oe)this.S.add(r,o,n);this.Oe.clear();}}Pr(){return !this.S&&this.ee&&this.Ti(),this.S&&this.kr(),this.S}Rt(){let r=this.Pr();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Ti(){let r=this.init$,o=this.ee;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.S){this.S=Ae.getCtx(o)??Ae.registerCtx(r,o);for(let[n,a]of Object.entries(this.init$))this.S.add(n,a,this.ctxOwner);this.kr();}}get $(){return this.ee&&this.Ti(),new Proxy({},{get:(r,o)=>{if(typeof o=="string")return this.S?.read(o)},set:(r,o,n)=>(typeof o!="string"||this.S?.pub(o,n),true)})}sub(r,o,n=true){let a=this.Rt().sub(r,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.ze.delete(d));};return this.ze.add(d),d}pub(r,o){this.Rt().pub(r,o);}set$(r){for(let[o,n]of Object.entries(r))this.pub(o,n);}get sharedCtx(){return this.Rt()}has(r){return this.S?.has(r)??false}add(r,o,n=false){let a=this.Pr();if(!a){if(!n&&this.Oe.has(r))return;this.Oe.set(r,{value:o,rewrite:n});return}this.Oe.delete(r),a.add(r,o,n);}add$(r,o=false){for(let[n,a]of Object.entries(r))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this.Ve?this.te&&this.yi&&(this.yi=false,this.initCallback()):this.ctxName?(this.Ot=false,this.vi()):this.Ot&&this.ee&&(this.Ot=false,this.vi());}vi(){if(this.Ve)return;this.Ve=true,this.Ti();let r=this.init$;if(Object.keys(r).length>0){let o=this.Rt();for(let[n,a]of Object.entries(r))o.read(n)===void 0&&o.pub(n,a),this.sub(n,M(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.te=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.$o(),super.disconnectedCallback(),this.Ve&&(this.yi=true);}$o(){if(this.ze.size!==0){for(let r of [...this.ze])r();this.ze.clear();}}initCallback(){}}return p([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Er",1),p([y()],i.prototype,"Ar",2),p([y()],i.prototype,"ctxName",2),p([y()],i.prototype,"te",2),i}}var Yo=s=>s.tagName?.includes("-")??false,qt=class{constructor(i){this.ge=new Set;this.Mt=new Map;this.Or=false;this.ye=i,this.ye.addController(this);}hostDisconnected(){this.Lt?.(),this.Lt=void 0,this.ge.clear(),this.Mt.clear();}hostUpdated(){if(!this.Lt&&this.ye.has(T("testMode"))){let i=this.ye.subConfigValue("testMode",e=>{this.Or=!!e,this.Rr();});this.Lt=i;}this.Do(),this.Rr();}Do(){let i=this.ye,e=i.renderRoot??i;if(!e)return;let t=this.ye,r=t.tagName?.toLowerCase(),o=Array.from(e.querySelectorAll("[data-testid]")).filter(n=>!Yo(n));for(let n of o)if(!(r&&n.closest(r)!==t)&&!this.ge.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.ge.add(n),this.Mt.set(n,a);}for(let n of Array.from(this.ge))(!n.isConnected||r&&n.closest(r)!==t)&&(this.ge.delete(n),this.Mt.delete(n));}Rr(){if(!this.ge.size)return;let i=this.ye.testId||"";for(let e of this.ge){let t=this.Mt.get(e);t&&(this.Or?e.setAttribute("data-testid",`${i}--${t}`):e.removeAttribute("data-testid"));}}};var Zo=Qr(es()(Wr(Xr(le)))),C=class extends Zo{constructor(){super();this.init$=gr();this.l10n=Zr(()=>this.sharedCtx);this.debugPrint=Rt(()=>this.sharedCtx,this.constructor.name);this.s=kr(()=>this.sharedCtx);new qt(this);}static{this.styleAttrs=[];}emit(e,t,r){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.emit(e,t,r);let n=typeof t=="function"?t():t;this.telemetryManager.sendEvent({eventType:e,payload:n??void 0});}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"");}),super.connectedCallback(),rt.registerClient(this);}initCallback(){this.Q("*blocksRegistry",()=>new Set),this.Q("*pluginManager",e=>new Ft(e)),this.Q("*eventEmitter",e=>new Kt(e)),this.Q("*localeManager",e=>new Ut(e)),this.Q("*modalManager",e=>new $t(e)),this.Q("*a11y",()=>new It),this.Q("*routerLayer",e=>new Lt(e)),this.Q("*clipboard",e=>new Mt(e)),this.Q("*telemetryManager",e=>new zt(e)),this.sub(se("locale-id"),e=>{let t=jr(e);this.style.direction=t==="ltr"?"":t,this.requestUpdate();}),this.subConfigValue("testMode",e=>{if(!e||!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.ie("*modalManager",false)}get telemetryManager(){return this.ie("*telemetryManager")}get localeManager(){return this.ie("*localeManager")}get a11y(){return this.ie("*a11y")}get clipboardLayer(){return this.ie("*clipboard")}get routerLayer(){return this.ie("*routerLayer")}get blocksRegistry(){return this.ie("*blocksRegistry")}get eventEmitter(){return this.ie("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),rt.unregisterClient(this);let e=this.blocksRegistry;e?.delete(this),e?.size===0&&setTimeout(()=>{this.isConnected||e?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this._o(),Ae.deleteCtx(this.ctxName);}Mr(){let e="*sharedContextInstances";if(!this.has(e)||!this.$[e]){let t=new Map;this.add(e,t,true);}return this.$[e]}Q(e,t){let r=this.Mr();if(!r.has(e)&&(!this.has(e)||!this.$[e])){let o=t(this.s);this.add(e,o,true),r.set(e,o);return}}_o(){let e=this.Mr();for(let[t,r]of e.entries())r?.destroy?.(),this.pub(t,null);e.clear();}ie(e,t=true){if(this.has(e)&&this.$[e])return this.$[e];if(!t)return this.$[e];throw new Error(`Unexpected error: context manager for key "${String(e)}" is not available`)}async proxyUrl(e){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(e,{uuid:Ot(e),cdnUrlModifiers:Ti(e),fileName:At(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),this.telemetryManager.sendEventError(t,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?Bt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this.ue){let e={};this.ue=new Proxy(e,{set:(t,r,o)=>{if(typeof r!="string"||!(r in I))return false;let n=r,a=T(n);return this.has(a)||this.add(a,I[n]),this.$[a]=o,true},get:(t,r)=>{let o=T(r);return this.has(o)||this.add(o,I[r]),this.$[o]}});}return this.ue}subConfigValue(e,t){let r=T(e);return this.has(r)||this.add(r,I[e]),this.sub(r,t)}};var fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ts(...s){return s.reduce((i,e)=>{if(typeof e=="string")return i[e]=true,i;for(let t of Object.keys(e))i[t]=e[t];return i},{})}function V(...s){let i=ts(...s);return Object.keys(i).reduce((e,t)=>(i[t]&&e.push(t),e),[]).join(" ")}function is(s,...i){let e=ts(...i);for(let t of Object.keys(e))s.classList.toggle(t,!!e[t]);}var st=["free"],rs=s=>{let i=Je(s);if(!i||i.length===0)return [];let e=[];for(let t of i){let r=t.trim();if(!r)continue;let o=r.indexOf(":");if(o===-1&&!st.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,o)),a=Number(r.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!st.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}e.push({id:de.generateFastUid(),type:"aspect-ratio",width:st.includes(r)?0:n,height:st.includes(r)?0:a,hasFreeform:st.includes(r)});}return e},ss=(s,i,e,t=.1)=>{let r=s/i,o=null,n=1/0;for(let a of e){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(r-c)/c>t)return null}return o};var Qo=s=>N.includes(s),os=s=>{if(!s)return N;let i=Se(s).filter(Qo);return i.length===0?N:i};function ns(s){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":N,"*tabId":A.CROP,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let e of i){let t=e.src;e.src=fe,e.src=t;}s.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let e=s.$["*originalUrl"];if(!e){console.warn("Original URL is null, cannot apply transformations");return}let t=ee(ue(i),"preview"),r=te(e,t),o={originalUrl:e,cdnUrlModifiers:t,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),s.remove();},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var as="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Oe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ot=class extends C{constructor(){super(...arguments);this.Re=false;this.Lr=Oe;this.Ir=Oe.visible;this.Ur=Oe.hidden;this.wi=false;this.Nr=false;}set visible(e){this.Re=e,this.$r();}get visible(){return this.Re}set styles(e){this.Lr=e,this.wi=true,this.Ir=e.visible??Oe.visible,this.Ur=e.hidden??Oe.hidden;}get styles(){return this.Lr}$r(){this.style.visibility=this.Re?"inherit":"hidden",is(this,{[Oe.transition]:!this.wi,[this.Ir]:this.Re,[this.Ur]:!this.Re}),this.toggleAttribute("inert",!this.Re);}Fo(){this.Nr||(this.Nr=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.wi||this.classList.add(Oe.transition),this.$r(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Fo();},0);}};p([b({type:Boolean})],ot.prototype,"visible",1),p([b({attribute:false})],ot.prototype,"styles",1);var Wt=class extends C{constructor(){super(...arguments);this.active=false;this.It=E();this.Ci=false;this.xi=()=>{let e=this.It.value;e&&(this.Dr(e),this.Ci&&this.active&&this.Ei());};}firstUpdated(e){super.firstUpdated(e),this.active&&this.Ei();}updated(e){super.updated(e),e.has("active")&&(this.active?this.Ei():this.Ko());}Ei(){let e=this.It.value;if(!e)return;this.Ci=true;let{width:t}=this.getBoundingClientRect();e.removeEventListener("transitionend",this.xi),e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this.xi,{once:true});}Ko(){let e=this.It.value;e&&(this.Ci=false,e.removeEventListener("transitionend",this.xi),this.Dr(e));}Dr(e){e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)";}render(){return g`<div class="uc-inner"><div class="uc-line" ${k(this.It)}></div></div>`}};p([b({type:Boolean,reflect:true})],Wt.prototype,"active",2);var me=B(class extends X{constructor(s){if(super(s),s.type!==ce.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return " "+Object.keys(s).filter(i=>s[i]).join(" ")+" "}update(s,[i]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(let t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}let e=s.element.classList;for(let t of this.st)t in i||(e.remove(t),this.st.delete(t));for(let t in i){let r=!!i[t];r===this.st.has(t)||this.nt?.has(t)||(r?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return F}});var L=s=>s??w;var De=class extends C{constructor(){super(...arguments);this.name="";this.Ut="";this.je=null;this._r=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this._r=t,this.Ai();});let e=this.s.pluginManager;e?.onPluginsChange&&(this.Si=e.onPluginsChange(()=>this.Ai()));}willUpdate(e){super.willUpdate(e),e.has("name")&&this.Ai();}Ai(){if(!this.name){this.Ut="",this.je=null;return}let t=this.s.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(t){this.je=t.svg,this.Ut="";return}this.je=null;let r=`#uc-icon-${this.name}`,o=this._r?.(this.name);this.Ut=o??r;}render(){return this.je?g`${this.yield("",g`${Et(this.je)}`)}`:g` ${this.yield("",g`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Ut}></use></svg>`)} `}disconnectedCallback(){this.Si?.(),this.Si=void 0,super.disconnectedCallback();}};p([b({type:String})],De.prototype,"name",2),p([y()],De.prototype,"Ut",2),p([y()],De.prototype,"je",2);var W=class extends C{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(e){super.firstUpdated(e),this.Fr(),this.Kr();}updated(e){super.updated(e),e.has("reverse")&&this.Fr(),e.has("theme")&&this.Kr();}Fr(){this.style.flexDirection=this.reverse?"row-reverse":"";}Kr(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Vo(){let e=this.ki;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":e,"uc-icon_single":this.zo}}get ki(){return !this.icon}get zo(){return !this.text&&!this.ki}render(){return g`<button type="button" role=${L(this.ariaRole||void 0)} aria-controls=${L(this.ariaControls||void 0)} aria-label=${L(this.l10n(this.titleProp))} title=${L(this.l10n(this.titleProp))} ><uc-icon class=${me(this.Vo)} name=${L(this.icon||void 0)} ?hidden=${this.ki} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([b({type:String})],W.prototype,"text",2),p([b({type:String})],W.prototype,"icon",2),p([b({type:Boolean,reflect:true})],W.prototype,"reverse",2),p([b({type:String,reflect:true})],W.prototype,"theme",2),p([b({attribute:"aria-role"})],W.prototype,"ariaRole",2),p([b({attribute:"aria-controls"})],W.prototype,"ariaControls",2),p([b({attribute:"title-prop"})],W.prototype,"titleProp",2),p([b({type:Boolean,noAccessor:true})],W.prototype,"active",2);function nt(s){let i=new Image;return {promise:new Promise((r,o)=>{i.src=s,i.onload=()=>r(),i.onerror=n=>o(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=fe);}}}function at(s){let i=[];for(let o of s){let n=nt(o);i.push(n);}let e=i.map(o=>o.image);return {promise:Promise.allSettled(i.map(o=>o.promise)),images:e,cancel:()=>{i.forEach(o=>{o.cancel();});}}}var ls=(s,i)=>{let e=false,t,r=0,o=((...n)=>{e?(t&&clearTimeout(t),t=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),e=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{t&&clearTimeout(t);}}),o};var lt=33.333333333333336,v=1,Ni=24,cs=6;function ge(s,i){for(let[e,t]of Object.entries(i))s.setAttributeNS(null,e,t.toString());}function K(s,i={}){let e=document.createElementNS("http://www.w3.org/2000/svg",s);return ge(e,i),e}function us(s,i,e){let{x:t,y:r,width:o,height:n}=s,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[t+a*o+1.5*c,r+l*n+1.5*d-24*e*d],h=[t+a*o+1.5*c,r+l*n+1.5*d],f=[t+a*o-24*e*c+1.5*c,r+l*n+1.5*d],m=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,P=[h[0],h[1]];return {d:m,center:P}}function ds(s,i,e){let{x:t,y:r,width:o,height:n}=s,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,m;a?(f=[t+c*o-34*e/2,r+d*n+1.5*h],m=[t+c*o+34*e/2,r+d*n+1.5*h]):(f=[t+c*o+1.5*u,r+d*n-34*e/2],m=[t+c*o+1.5*u,r+d*n+34*e/2]);let P=`M ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,R=[(f[0]+m[0])/2,(f[1]+m[1])/2];return {d:P,center:R}}function ps(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function hs({rect:s,delta:[i,e],imageBox:t}){return Fe({...s,x:s.x+i,y:s.y+e},t)}function Fe(s,i){let{x:e}=s,{y:t}=s;return s.x<i.x?e=i.x:s.x+s.width>i.x+i.width&&(e=i.x+i.width-s.width),s.y<i.y?t=i.y:s.y+s.height>i.y+i.height&&(t=i.y+i.height-s.height),{...s,x:e,y:t}}function Jo({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[,r]=i,{y:o,width:n,height:a}=s;o+=r,a-=r,e&&(n=a*e);let l=s.x+s.width/2-n/2;return o<=t.y&&(o=t.y,a=s.y+s.height-o,e&&(n=a*e,l=s.x+s.width/2-n/2)),l<=t.x&&(l=t.x,o=s.y+s.height-a),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=s.y+s.height-a),a<v&&(a=v,e&&(n=a*e,l=s.x+s.width/2-n/2),o=s.y+s.height-a),n<v&&(n=v,e&&(a=n/e,l=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:l,y:o,width:n,height:a}}function en({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r]=i,{x:o,width:n,height:a}=s;o+=r,n-=r,e&&(a=n/e);let l=s.y+s.height/2-a/2;return o<=t.x&&(o=t.x,n=s.x+s.width-o,e&&(a=n/e,l=s.y+s.height/2-a/2)),l<=t.y&&(l=t.y,o=s.x+s.width-n),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=s.x+s.width-n),a<v&&(a=v,e&&(n=a*e),l=s.y+s.height/2-a/2,o=s.x+s.width-n),n<v&&(n=v,e&&(a=n/e),l=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:l,width:n,height:a}}function tn({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[,r]=i,{y:o,width:n,height:a}=s;a+=r,e&&(n=a*e);let l=s.x+s.width/2-n/2;return o+a>=t.y+t.height&&(a=t.y+t.height-o,e&&(n=a*e),l=s.x+s.width/2-n/2),l<=t.x&&(l=t.x,o=s.y),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=s.y),a<v&&(a=v,e&&(n=a*e),l=s.x+s.width/2-n/2),n<v&&(n=v,e&&(a=n/e),l=s.x+s.width/2-n/2),{x:l,y:o,width:n,height:a}}function rn({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r]=i,{x:o,width:n,height:a}=s;n+=r,e&&(a=n/e);let l=s.y+s.height/2-a/2;return o+n>=t.x+t.width&&(n=t.x+t.width-o,e&&(a=n/e),l=s.y+s.height/2-a/2),l<=t.y&&(l=t.y,o=s.x),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=s.x),a<v&&(a=v,e&&(n=a*e),l=s.y+s.height/2-a/2),n<v&&(n=v,e&&(a=n/e),l=s.y+s.height/2-a/2),{x:o,y:l,width:n,height:a}}function sn({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+r<t.x&&(r=t.x-n),a+o<t.y&&(o=t.y-a),n+=r,l-=r,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=s.x+s.width-l,a=t.y)):e&&(r=c*e-l,l=l+r,n-=r,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=s.y+s.height-c)),c<v&&(c=v,e&&(l=c*e),n=s.x+s.width-l,a=s.y+s.height-c),l<v&&(l=v,e&&(c=l/e),n=s.x+s.width-l,a=s.y+s.height-c),{x:n,y:a,width:l,height:c}}function on({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+l+r>t.x+t.width&&(r=t.x+t.width-n-l),a+o<t.y&&(o=t.y-a),l+=r,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=s.x,a=t.y)):e&&(r=c*e-l,l+=r,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=s.y+s.height-c)),c<v&&(c=v,e&&(l=c*e),a=s.y+s.height-c),l<v&&(l=v,e&&(c=l/e),a=s.y+s.height-c),{x:n,y:a,width:l,height:c}}function nn({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+r<t.x&&(r=t.x-n),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),n+=r,l-=r,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=s.x+s.width-l,a=t.y+t.height-c)):e&&(r=c*e-l,l+=r,n-=r,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=s.y)),c<v&&(c=v,e&&(l=c*e),n=s.x+s.width-l),l<v&&(l=v,e&&(c=l/e),n=s.x+s.width-l),{x:n,y:a,width:l,height:c}}function an({rect:s,delta:i,aspectRatio:e,imageBox:t}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+l+r>t.x+t.width&&(r=t.x+t.width-n-l),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),l+=r,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=s.x,a=t.y+t.height-c)):e&&(r=c*e-l,l+=r,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=s.y)),c<v&&(c=v,e&&(l=c*e)),l<v&&(l=v,e&&(c=l/e)),{x:n,y:a,width:l,height:c}}function fs({direction:s,...i}){switch(s){case "n":return Jo(i);case "w":return en(i);case "s":return tn(i);case "e":return rn(i);case "nw":return sn(i);case "ne":return on(i);case "sw":return nn(i);case "se":return an(i);default:return i.rect}}function ms(s,[i,e]){return s.x<=i&&i<=s.x+s.width&&s.y<=e&&e<=s.y+s.height}function gs(s,i){return s.x>=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function ys(s,i){return Math.abs(s.width/s.height-i)<.1}function Ve({width:s,height:i},e){let t=e/90%2!==0;return {width:t?i:s,height:t?s:i}}function Ke(s){return {x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function ye(s,i,e){return Math.min(Math.max(s,i),e)}function bs(s,i){let e={};for(let t of i){let r=s[t];(Object.hasOwn(s,t)||r!==void 0)&&(e[t]=r);}return e}function ze(s,i,e){let r=window.devicePixelRatio,o=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return te(s,ee(Pt,ue(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Ie}/${Ue}/uc-cloud-image-editor/`))}var Yt=class extends C{constructor(){super(...arguments);this.Vr=`uc-backdrop-mask-${de.generateFastUid()}`;this.$t=false;this.qe=false;this.Hr=E();this.We=false;this.Xe=null;this.Gr=e=>{this.qr(),this.Ye&&(e.stopPropagation(),e.preventDefault(),this.Ye=false);};this.Wr=e=>{if(!this.Ye||!this.Nt||!this.Oi)return;e.stopPropagation(),e.preventDefault();let t=this.re;if(!t)return;let{x:r,y:o}=t.getBoundingClientRect(),n=e.x-r,a=e.y-o,l=n-this.Nt[0],c=a-this.Nt[1],{direction:d}=this.Oi,u=this.Zo(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.Xr=e=>{if(!this.J)return;let t=Object.values(this.J).find(r=>{if(!r||this.Mi(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return ms(a,[e.x,e.y])});this.zr=t,this.qr();};}get re(){return this.Hr.value??null}get Ye(){return this.qe}set Ye(e){this.qe!==e&&(this.qe=e,this.Ri());}Ri(){this.Be&&this.Be.setAttribute("class",V({"uc-guides--hidden":this.$t,"uc-guides--visible":!this.$t&&this.qe,"uc-guides--semi-hidden":!this.$t&&!this.qe}));}Mi(e){let t=this.$["*imageBox"];if(!t)return false;if(e===""&&t.height<=v&&t.width<=v)return true;let r=t.height<=v&&(e.includes("n")||e.includes("s")),o=t.width<=v&&(e.includes("e")||e.includes("w"));return r||o}jo(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:r,width:o,height:n}=e,a=this.re;if(!a)return;let l=K("mask",{id:this.Vr}),c=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=K("rect",{x:t,y:r,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Vr})`});a.appendChild(u),a.appendChild(l),this.He=l,this.Pi=d;}Ho(){this.He&&(this.He.style.display="none",window.requestAnimationFrame(()=>{this.He&&(this.He.style.display="block");}));}Bo(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:r,width:o,height:n}=e;this.Pi&&ge(this.Pi,{x:t,y:r,width:o,height:n});}Go(){let e=this.$["*cropBox"];if(!(!e||!this.Be||!this.J)){for(let t of Object.values(this.J)){if(!t)continue;let{direction:r,pathNode:o,interactionNode:n,groupNode:a}=t,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:f}=e;if(l)ge(n,{x:d,y:u,width:h,height:f});else {let P=ye(Math.min(h,f)/82/2,0,1),R=c?us(e,r,P):ds(e,r,P),O=R.center;if(!O)continue;let j=Math.max(Ni*ye(Math.min(h,f)/Ni/3,0,1),cs);ge(n,{x:O[0]-j,y:O[1]-j,width:j*2,height:j*2}),ge(o,{d:R.d});}let m=this.Mi(r);a.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}));}ge(this.Be,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1});}}Br(e,t){let r=K("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let o=K("rect",{fill:"transparent"}),n=K("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(o),e[t]={direction:t,pathNode:n,interactionNode:o,groupNode:r},t===""&&(r.style.cursor="move"),o.addEventListener("pointerdown",this.qo.bind(this,t));}Wo(){let e={};for(let t=0;t<3;t++)for(let r=0;r<3;r++){let o=`${["n","","s"][t]}${["w","","e"][r]}`;o!==""&&this.Br(e,o);}return this.Br(e,""),e}Xo(){let e=K("svg"),t=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let r=1;r<=2;r++){let o=K("line",{x1:`${lt*r}%`,y1:"0%",x2:`${lt*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}for(let r=1;r<=2;r++){let o=K("line",{x1:"0%",y1:`${lt*r}%`,x2:"100%",y2:`${lt*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}Yo(){let e=this.re;if(!e)return;let t=document.createDocumentFragment(),r=this.Xo();t.appendChild(r);let o=this.Wo();for(let{groupNode:n}of Object.values(o))t.appendChild(n);e.appendChild(t),this.J=o,this.Be=r,this.Ri();}qo(e,t){if(!this.J)return;let r=this.J[e];if(!r||this.Mi(e))return;let o=this.$["*cropBox"],n=this.re;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=t.x-a,d=t.y-l;this.Ye=true,this.Oi=r,this.Nt=[c,d],this.jr={...o};}Zo(e,t){let[r,o]=t,n=this.$["*imageBox"],a=this.jr??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(e===""?a=hs({rect:a,delta:[r,o],imageBox:n}):a=fs({rect:a,delta:[r,o],direction:e,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Fe(Ke(a),n)}qr(){let e=this.zr,t=this.re;t&&(t.style.cursor=e?ps(e.direction):"initial");}Yr(e){if(this.Ge){this.Ge.setAttribute("href",e);return}let t=this.re;if(!t){this.Xe=e;return}this.Xe=null;let r=document.createDocumentFragment(),o=K("image",{href:e});o.setAttribute("class","uc-cloud-mask"),r.appendChild(o),t.appendChild(r),this.Ge=o;}Qo(){let e=this.$["*cropBox"];if(!e||!this.Ge)return;let{x:t,y:r,width:o,height:n}=e;ge(this.Ge,{x:t,y:r,height:n,width:o});}Li(){this.We&&(this.Bo(),this.Go(),this.Qo());}toggleThumbs(e){if(this.J)for(let t of Object.values(this.J)){if(!t)continue;let{groupNode:r}=t;r.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ho(),this.We&&window.requestAnimationFrame(()=>{this.Li();});}),this.sub("*cropBox",e=>{e&&(this.$t=e.height<=v||e.width<=v,this.Ri(),this.We&&window.requestAnimationFrame(()=>{this.Li();}));}),this.subConfigValue("cloudImageEditorMaskHref",e=>{e&&this.Yr(e);}),document.addEventListener("pointermove",this.Wr,true),document.addEventListener("pointerup",this.Gr,true);}firstUpdated(e){super.firstUpdated(e),this.Jo();}Jo(){let e=this.re;if(!(!e||this.We)){if(this.jo(),this.Yo(),this.We=true,e.addEventListener("pointermove",this.Xr,true),this.Xe){let t=this.Xe;this.Xe=null,this.Yr(t);}this.Li();}}disconnectedCallback(){super.disconnectedCallback(),this.re?.removeEventListener("pointermove",this.Xr,true),document.removeEventListener("pointermove",this.Wr,true),document.removeEventListener("pointerup",this.Gr,true);}render(){return g`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${k(this.Hr)}></svg>`}};p([y()],Yt.prototype,"qe",2);function cn(s){return s?[({dimensions:e,coords:t})=>[...e,...t].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:e,coords:t})=>e.every(r=>r>0)&&t.every(r=>r>=0)].every(e=>e(s)):true}var Zt=class extends C{constructor(){super();this.ctxOwner=true;this.be={width:0,height:0};this.i=null;this.g=false;this._=null;this.Qr=E();this.Ni=E();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.Zr=M(this.Jr.bind(this),300),this.Ii=ls(()=>{!this.isConnected||!this.g||(this.$i(),this.es(),this.ts(),this.Di(),this._i());},100);}firstUpdated(e){super.firstUpdated(e),this.$i();}es(){let e=this.$["*editorTransformations"],t=bs(e,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...t};this.$["*operations"]=r;}$i(){let e=this.Qr.value;if(!e)return;let t=e.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${r}px`,e.style.height=`${o}px`,e.width=r*n,e.height=o*n,t?.scale(n,n),this.Ui=e,this.i=t;}ts(){if(!this.g||!this._)return;let e=this._,t=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Ve({width:e.naturalWidth,height:e.naturalHeight},o),l;if(a.width>n.width-t*2||a.height>n.height-t*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-t*2,h=u/c,f=0+t,m=t+(n.height-t*2)/2-h/2;l={x:f,y:m,width:u,height:h};}else {let u=n.height-t*2,h=u*c,f=t+(n.width-t*2)/2-h/2,m=0+t;l={x:f,y:m,width:h,height:u};}}else {let{width:c,height:d}=a,u=t+(n.width-t*2)/2-c/2,h=t+(n.height-t*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Ke(l);}Di(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=t;if(n){let{dimensions:[h,f],coords:[m,P]}=n,{width:R}=Ve(this.be,o),O=a/R;e=Fe(Ke({x:l+m*O,y:c+P*O,width:h*O,height:f*O}),t);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!gs(e,t)||u&&!ys(e,u)){let h=t.width/t.height,f=t.width,m=t.height;u&&(h>u?f=Math.min(t.height*u,t.width):m=Math.min(t.width/u,t.height)),e={x:t.x+t.width/2-f/2,y:t.y+t.height/2-m/2,width:f,height:m};}this.$["*cropBox"]=Fe(Ke(e),t);}en(){let e=this.i;if(!e)return;let t=this._;if(!t)return;let r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Ve({width:r.width,height:r.height},l);e.save(),e.translate(r.x+r.width/2,r.y+r.height/2),e.rotate(l*Math.PI*-1/180),e.scale(n?-1:1,a?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore();}_i(){if(!this.g||!this._||!this.Ui||!this.i)return;let e=this.Ui;this.i.clearRect(0,0,e.width,e.height),this.en();}tn({fromViewer:e}){this._&&(this.Ni.value?.toggleThumbs(true),this.rn(),setTimeout(()=>{this.className=V({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":false});}));}rs(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=t,{width:l,height:c}=Ve(this.be,o),{width:d,height:u}=e,h=n/l,f=a/c;return [ye(Math.round(d/h),1,l),ye(Math.round(u/f),1,c)]}sn(){let e=this.$["*cropBox"],t=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:l,y:c}=t,{width:d,height:u}=Ve(this.be,o),{x:h,y:f}=e,m=n/d,P=a/u,R=this.rs(),O={dimensions:R,coords:[ye(Math.round((h-l)/m),0,d-R[0]),ye(Math.round((f-c)/P),0,u-R[1])]};if(!cn(O)){console.error("Cropper is trying to create invalid crop object",{payload:O});return}if(!(R[0]===d&&R[1]===u))return O}Jr(){if(!this.isConnected||!this.be)return;let e=this.$["*operations"],{rotate:t,mirror:r,flip:o}=e,n=this.sn(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:r,flip:o};this.$["*editorTransformations"]=l;}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this.g&&(this.ts(),this.Di(),this._i());}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this.g){this.g=true,await this.updateComplete,this.$i(),this.be=e,this.removeEventListener("transitionend",this.ss);try{let r=this.$["*originalUrl"],o=this.$["*editorTransformations"];this._=await this.nn(r,o),this.es(),this.Ii(),this.tn({fromViewer:t});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.f=new ResizeObserver(r=>{let[o]=r;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this.g&&this._&&this.Ii();}),this.f.observe(this);}}deactivate({reset:e=false}={}){this.g&&(!e&&this.Jr(),this.g=false,this.an(),this.className=V({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ni.value?.toggleThumbs(false),this.addEventListener("transitionend",this.ss,{once:true}),this.f?.disconnect());}an(){let e=this.rs(),t=this.$["*cropBox"],r=Math.min(this.offsetWidth,e[0])/t.width,o=Math.min(this.offsetHeight,e[1])/t.height,n=Math.min(r,o),a=t.x+t.width/2,l=t.y+t.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}rn(){let e=this.$["*cropBox"],t=e.x+e.width/2,r=e.y+e.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${r}px`;}ss(){this.g||(this._=null);}async nn(e,t){let r=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(ze(e,r,t)),{promise:n,cancel:a,image:l}=nt(o),c=this.Me(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.m?.(),this.m=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Me(e){let t="crop",r=this.$["*loadingOperations"],o=r.get(t);return o||(o=new Map,r.set(t,o)),o.get(e)||(o.set(e,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._i();}),this.sub("*cropBox",()=>{this._&&this.Zr();}),this.sub("*currentAspectRatio",()=>{this.Di();}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this.g&&this.be&&this.activate(this.be,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this._&&(this._=null);}render(){return g`<canvas class="uc-canvas" ${k(this.Qr)}></canvas><uc-crop-frame ${k(this.Ni)}></uc-crop-frame>`}};p([y()],Zt.prototype,"_",2);function Di(s,i,e){let t=e,r=e-1,o=new Array(t);for(let n=r;n>=0;n-=1)o[n]=Math.ceil((n*i+(r-n)*s)/r);return o}function un(s){return typeof s=="string"&&s in G}function dn(s){let i=[];for(let e=0;e<s.length-1;e+=1){let t=s[e],r=s[e+1];typeof t=="number"&&typeof r=="number"&&i.push([t,r]);}return i}function pn(s,i,e){let t=dn(s).find(([n,a])=>n<=i&&i<=a);if(!t)return s.map(()=>0);let[r,o]=t;return s.map(n=>{let a=Math.abs(r-o)||1,l=Math.abs(i-r)/a;return r===n?i>e?1:1-l:o===n?i>=e?l:1:0})}function hn(s,i){return s.map((e,t)=>e<i?s.length-t:t)}function vs(s,i){let e=G[s].keypointsNumber,{range:t,zero:r}=G[s];return [...new Set([...Di(t[0],r,e+1),...Di(r,t[1],e+1),r,i])].sort((o,n)=>o-n)}var _i=class extends C{constructor(){super();this.g=false;this.Fi=true;this.r="initial";this.os={};this.se=[];this.as=0;this.cs=E();this.Dt=E();this.classList.add("uc-inactive_to_cropper"),this.ls=M(async(e,t,r)=>{let o=()=>!this.us(e,t)||this.Ki!==r||!!this.se.find(c=>c.value===r);if(o())return;let n=await this.ps(e,r),a=new Image;a.src=n.src;let l=this.Me(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this.se,d=c.findIndex(m=>m.value>r);d===-1&&(d=c.length);let h=c[d]?.image,f=this.Dt.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.ji(e,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Me(e){let t=this.r,r=this.$["*loadingOperations"];r.has(t)||r.set(t,new Map);let o=r.get(t);return o&&!o.get(e)&&(o.set(e,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=r);}}ds(){window.cancelAnimationFrame(this.as),this.as=window.requestAnimationFrame(()=>{for(let e of this.se){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString());}});}ve({url:e=this.ns,filter:t=this.c??void 0,operation:r,value:o}={}){if(!e)throw new Error("URL is not defined");let n={...this.os};r&&(r==="filter"?t&&typeof o=="number"&&(n.filter={name:t,amount:o}):typeof o=="number"&&(n[r]=o));let a=this.offsetWidth;return this.proxyUrl(ze(e,a,n))}async ps(e,t){return {src:await this.ve({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}us(e,t){return this.r===e&&this.c===t}set(e){let t=typeof e=="string"?parseInt(e,10):e;!un(this.r)||!Number.isFinite(t)||(this.ji(this.r,t),this.ls(this.r,this.c,t));}ji(e,t){this.r=e,this.Ki=t;let{zero:r}=G[e],o=this.se.map(l=>l.value),n=pn(o,t,r),a=hn(o,r);this.se.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.ds();}hs(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async ln(){this.n=this.n||this.hs();let e=this.n;e&&this.fs(e);let t=this.se.map(c=>c.src),{images:r,promise:o,cancel:n}=at(t);r.forEach(c=>{let d=this.Me(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Vi=()=>{n(),this.Vi=void 0;};let a=this.r,l=this.c;if(await o,this.g&&this.us(a,l)){let c=this.Dt.value;if(!c)return;c.replaceChildren(),this.se.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.ds();}}async setTransformations(e){if(this.os=e,this.n){let t=await this.ve(),r=this.Me(t);this.n.src=t,this.n.addEventListener("load",r,{once:true}),this.n.addEventListener("error",r,{once:true}),this.n.style.opacity="1",this.n.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:e,filter:t,operation:r,value:o}){if(!r||typeof o!="number")return;this.zi?.();let n=vs(r,o),a=await Promise.all(n.map(c=>this.ve({url:e,filter:t,operation:r,value:c}))),{cancel:l}=at(a);this.zi=l;}cn(e){let t=this.n||this.hs();if(this.fs(t),this.n=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this.Ze,"uc-active_from_cropper":!this.Ze,"uc-inactive_to_cropper":false});return}t.style.opacity="0";let r=this.Me(e);t.addEventListener("error",r,{once:true}),t.src=e,t.addEventListener("load",()=>{r(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this.Ze,"uc-active_from_cropper":!this.Ze,"uc-inactive_to_cropper":false}));},{once:true}),t.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:e,operation:t,value:r,filter:o,fromViewer:n}){if(this.g=true,this.Fi=false,await this.updateComplete,this.ns=e,this.r=t??"initial",this.Ki=r,this.c=o,this.Ze=n,typeof r!="number"&&!o){let l=await this.ve({operation:t,value:r});this.cn(l),this.Hi();return}!t||typeof r!="number"||(this.se=await Promise.all(vs(t,r).map(l=>this.ps(t,l))),this.ji(t,r),this.ln());}deactivate({hide:e=true}={}){this.g=false,this.Vi?.(),this.zi?.(),e&&!this.Fi?(this.Fi=true,this.n&&(this.n.style.transform="scale(1)"),this.className=V({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Hi();},{once:true})):this.Hi();}fs(e){let t=this.cs.value;t&&(t.contains(e)||t.appendChild(e));}Hi(){this.Dt.value?.replaceChildren();}render(){return g`<div class="uc-fader-preview-host" ${k(this.cs)}></div><div class="uc-fader-layers-host" ${k(this.Dt)}></div>`}};var Ts="important",fn=" !"+Ts,ct=B(class extends X{constructor(s){if(super(s),s.type!==ce.ATTRIBUTE||s.name!=="style"||s.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(s){return Object.keys(s).reduce((i,e)=>{let t=s[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(s,[i]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let r=i[t];if(r!=null){this.ft.add(t);let o=typeof r=="string"&&r.endsWith(fn);t.includes("-")||o?e.setProperty(t,o?r.slice(0,-11):r,o?Ts:""):e[t]=r;}}return F}});var ae=class extends C{constructor(){super();this.Bi=0;this._t=E();this.gs=E();this.ys=E();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.oe=0;this.pn=e=>{e.stopPropagation();let t=this.bs(e);t!==null&&(this.Gi(t),this.un("slider-input",t));};this.dn=e=>{e.stopPropagation();let t=this.bs(e);t!==null&&this.Gi(t);};this.vs=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Ts=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}un(e,t){this.dispatchEvent(new CustomEvent(e,{detail:{value:t},bubbles:true,composed:true}));}firstUpdated(e){super.firstUpdated(e),this.Bi=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Cs(this.oe),this.qi(),this.f=new ResizeObserver(()=>{this.qi(),this.Ft(this.oe);}),this.f.observe(this);let t=this._t.value;t?.addEventListener("focus",this.vs),t?.addEventListener("blur",this.Ts),window.setTimeout(()=>{this.Ft(this.oe);},0);}willUpdate(e){super.willUpdate(e),e.has("defaultValue")&&this.defaultValue!==this.oe&&this.Gi(this.defaultValue),(e.has("min")||e.has("max"))&&this.hasUpdated&&(this.qi(),this.Ft(this.oe)),e.has("zero")&&this.hasUpdated&&this.xs(this.oe);}Ft(e){this.xs(e);let t=this.max-this.min;if(t===0)return;let{width:r}=this.getBoundingClientRect(),a=100/t*(e-this.min)*(r-this.Bi)/100;window.requestAnimationFrame(()=>{let l=this.gs.value;l&&(l.style.transform=`translateX(${a}px)`);});}xs(e){if(!this.Qe)return;let t=this.max-this.min;if(t===0)return;this.Qe.style.opacity=e===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/t*(this.zero-this.min)*(r-this.Bi)/100;window.requestAnimationFrame(()=>{this.Qe&&(this.Qe.style.transform=`translateX(${a}px)`);});}qi(){let t=this.ys.value;if(!t)return;let{width:r}=t.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this.ms===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Qe=d,t.innerHTML="",t.appendChild(a),this.ms=n;}disconnectedCallback(){super.disconnectedCallback();let e=this._t.value;e?.removeEventListener("focus",this.vs),e?.removeEventListener("blur",this.Ts),this.f?.disconnect(),this.f=void 0;}Gi(e){Number.isFinite(e)&&(this.oe=e,this.hasUpdated&&(this.Cs(e),this.Ft(e)));}Cs(e){let t=this._t.value;t&&(t.value=String(e));}bs(e){let t=e.currentTarget;if(!t)return null;let r=Number.parseInt(t.value,10);return Number.isFinite(r)?r:null}render(){return g`<div class="uc-steps" ${k(this.ys)}></div><div class="uc-thumb" ${k(this.gs)}></div><input class="uc-input" type="range" ${k(this._t)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.oe)} ?disabled=${this.disabled} @input=${this.pn} @change=${this.dn} />`}};p([b({type:Boolean,reflect:true})],ae.prototype,"disabled",2),p([b({type:Number})],ae.prototype,"min",2),p([b({type:Number})],ae.prototype,"max",2),p([b({type:Number,attribute:false})],ae.prototype,"defaultValue",2),p([b({type:Number})],ae.prototype,"zero",2),p([y()],ae.prototype,"oe",2);var Z="original",Qt=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.hn=e=>{let{value:t}=e.detail;this.$["*faderEl"]?.set(t),this.state={...this.state,value:t};};}setOperation(e,t){this.state={...this.state,operation:e,filter:t},this.mn();let r=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];r&&o&&r.activate({url:o,operation:this.state.operation,value:this.state.filter===Z?void 0:this.state.value,filter:this.state.filter===Z?void 0:this.state.filter,fromViewer:false});}mn(){let e=this.state.operation,{range:t,zero:r}=G[e],[o,n]=t;this.state={...this.state,min:o,max:n,zero:r};let l=this.$["*editorTransformations"][e];if(e==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}apply(){let t={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Z?delete t.filter:t.filter={name:this.state.filter,amount:this.state.value}:t[this.state.operation]=this.state.value,this.$["*editorTransformations"]=t;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{e&&(this.state={...this.state,originalUrl:e});});}updated(e){if(super.updated(e),e.has("state")){let t=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=t;}}render(){return g`<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.hn} ></uc-slider-ui>`}};p([y()],Qt.prototype,"state",2);function je(s){if(!s)return null;let i=s.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,e,t]=i;return !e||typeof t>"u"?null:{filter:e,value:Number(t)}}var D=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let e=this.active;return {"uc-active":e,"uc-not_active":!e}}Es(){let e=this.buttonClasses;for(let[t,r]of Object.entries(e))this.classList.toggle(t,r);}onClick(e){}connectedCallback(){super.connectedCallback(),this.Es();}updated(e){super.updated(e),e.has("active")&&this.Es();}render(){let e=this.onClick,t=this.title;return g`<button role="option" type="button" aria-label=${L(this.titleProp)} title=${L(this.titleProp)} @click=${e} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};p([y()],D.prototype,"active",2),p([y()],D.prototype,"title",2),p([y()],D.prototype,"icon",2),p([y()],D.prototype,"titleProp",2);var Jt=12,ei=16,mn=s=>{let i=12,e=12;return s.width/s.height>=1?(i=Jt,e=Math.round(Jt*s.height/s.width)):(e=Jt,i=Math.round(Jt*s.width/s.height)),{width:i,height:e}},Fi=class extends D{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let e=this.gn(i);this.title=e,this.titleProp=e;});}onClick(){this.$["*showListAspectRatio"]=true;}gn(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,e=this.title;return g`<button role="option" type="button" class=${me(this.buttonClasses)} aria-label=${L(this.titleProp)} title=${L(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!e}>${e}</div><uc-icon name=${this.icon}></uc-icon></button>`}},ti=class extends D{constructor(){super(...arguments);this.w=null;}get aspectRatio(){return this.w}set aspectRatio(e){if(this.w===e)return;let t=this.w;this.w=e,this.requestUpdate("aspectRatio",t),e?this.Ss(e):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.w&&this.Ss(this.w),this.sub("*currentAspectRatio",e=>{this.active=e&&e.id===this.w?.id||e?.width===this.w?.width&&e?.height===this.w?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.w?.id&&(this.$["*currentAspectRatio"]=this.w);}Ss(e){if(!this.isConnected)return;let t=!!e.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",t);let r=()=>{let n=t?this.l10n("custom"):`${e.width}:${e.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:t?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),o(),t||this.requestUpdate();}yn(){let e=this.w;if(!e||e.hasFreeform)return g`<uc-icon name=${this.icon}></uc-icon>`;let{width:t,height:r}=mn(e),o=(ei-t)/2,n=(ei-r)/2;return g`<uc-icon><svg viewBox="0 0 ${ei} ${ei}" aria-hidden="true" focusable="false" ><rect x=${o} y=${n} width=${t} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let e=this.onClick,t=this.title;return g`<button role="option" type="button" class=${me(this.buttonClasses)} aria-label=${L(this.titleProp)} title=${L(this.titleProp)} @click=${e} >${this.yn()}<div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};p([b({attribute:false})],ti.prototype,"aspectRatio",1);function gn(s){let i=s+90;return i=i>=360?0:i,i}function yn(s,i){if(s==="rotate")return gn(typeof i=="number"?i:0);if(s==="mirror"||s==="flip")return !i;throw new Error(`Unsupported operation: ${s}`)}var ii=class extends D{constructor(){super(...arguments);this.operation=void 0;}willUpdate(e){super.willUpdate(e),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(e){if(!this.operation)return;let t=this.$["*cropperEl"],r=t.getValue(this.operation),o=yn(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this.operation,next:o,prev:r}),t.setValue(this.operation,o);}};p([b({type:String})],ii.prototype,"operation",2);var be=class extends D{constructor(){super(...arguments);this.r="";this.c="";this.Je="";this.Kt=0;this.n=null;this.Ie=false;this.isOriginal=false;this.As=20;}get filter(){return this.c}set filter(e){let t=e??"";if(this.c===t)return;let r=this.c;this.c=t,this.r="filter",this.isOriginal=t===Z,this.icon=this.isOriginal?"original":"slider",this.As=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.ks(t);}onClick(e){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.r,this.c),this.$["*showSlider"]=true);else {let t=this.$["*sliderEl"];t.setOperation(this.r,this.c),t.apply();}this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.c;}bn(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=Number.isFinite(e)&&e>0?e:this.As||32,r=window.devicePixelRatio,o=Math.ceil(r*t),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.r]=this.c!==Z?{name:this.c,amount:a}:void 0,te(this.Je,ee(Pt,ue(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${Ie}/${Ue}/uc-cloud-image-editor/`))}async vn(e,t){e[0]?.isIntersecting?await this.Wi(t):this.m?.();}initCallback(){super.initCallback(),this.f=new window.IntersectionObserver(this.vn.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this.Je=e??"",this.sub("*originalUrl",t=>{this.Je=t??"",!this.isOriginal&&this.Je&&this.isConnected&&!this.n&&(this.f?.observe(this),this.Te());}),this.isOriginal||(this.f?.observe(this),this.Te()),this.c&&this.ks(this.c),this.sub("*currentFilter",t=>{this.active=!!(t&&t===this.c);}),this.sub("*networkProblems",async t=>{t||(this.n?await this.Wi():this.Te());});}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this.m?.(),this.Vt();}updated(e){super.updated(e),e.has("isOriginal")&&(this.isOriginal?this.f?.unobserve(this):(this.f?.observe(this),this.Te()));}ks(e){if(!e){this.titleProp="";return}let t=this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()});this.titleProp=t;}async Wi(e){if(!this.isConnected){e?.unobserve(this),this.m?.(),this.m=void 0;return}if(!this.Je){!this.Le&&!this.ne&&this.Te();return}let t=++this.Kt,r="";try{r=await this.proxyUrl(this.bn());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ie=false,this.m?.();let{promise:o,cancel:n}=nt(r);this.m=()=>{n(),this.Kt===t&&(this.m=void 0);};try{if(await o,this.Kt!==t||!this.isConnected)return;this.n=r,this.Ie=!0,this.Vt(),(e??this.f)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.Te();}finally{this.Kt===t&&(this.m=void 0);}}Te(){if(!this.isConnected||this.n||this.Ie||this.isOriginal||this.$["*networkProblems"]){this.Vt();return}this.ne&&cancelAnimationFrame(this.ne),this.ne=requestAnimationFrame(()=>{if(this.ne=void 0,!this.isConnected||this.n||this.Ie||this.isOriginal){this.Vt();return}let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,r=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(t&&e.bottom>0&&e.right>0&&e.top<o&&e.left<r){this.Wi();return}this.Le=window.setTimeout(()=>{this.Le=void 0,this.Te();},500);});}Vt(){this.ne&&(cancelAnimationFrame(this.ne),this.ne=void 0),this.Le&&(window.clearTimeout(this.Le),this.Le=void 0);}get Tn(){return !!(this.Ie&&!this.active&&!this.isOriginal)}render(){let e=this.onClick,t={opacity:this.Tn?"1":"0"};this.n&&(t.backgroundImage=`url(${this.n})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return g`<button role="option" type="button" class=${me(this.buttonClasses)} aria-label=${L(this.titleProp)} title=${L(this.titleProp)} @click=${e} ><div class="uc-preview" ?data-loaded=${this.Ie} style=${ct(t)}></div><uc-icon class=${me({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ct(r)} ></uc-icon></button>`}};p([y()],be.prototype,"n",2),p([y()],be.prototype,"Ie",2),p([y()],be.prototype,"isOriginal",2),p([y()],be.prototype,"As",2),p([b({type:String})],be.prototype,"filter",1);var ri=class extends D{constructor(){super(...arguments);this.r="";}get operation(){return this.r}set operation(e){let t=e??"";if(this.r===t)return;let r=this.r;this.r=t,this.requestUpdate("operation",r),this.isConnected&&t&&this.Ps(t);}Ps(e){this.icon=e;let t=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()});return this.titleProp=o,o},r=()=>{let o=this.l10n(e);return this.title=o,o};t(),r();}initCallback(){super.initCallback(),this.r&&this.Ps(this.r),this.sub("*editorTransformations",e=>{if(!this.r)return;let{zero:t}=G[this.r],r=e[this.r],o=typeof r<"u"?r!==t:false;this.active=o;});}onClick(e){this.$["*sliderEl"]?.setOperation(this.r),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.r,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:je(this.$["*operationTooltip"])});}};p([b({type:String})],ri.prototype,"operation",1);var bn=1,ws=()=>{},si=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Os=e=>{e.preventDefault();let{deltaY:t,deltaX:r}=e;if(Math.abs(r)>bn){this.scrollLeft+=r;return}this.scrollLeft+=t;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Os,{passive:false}),this.addEventListener("scroll",ws,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Os),this.removeEventListener("scroll",ws),super.disconnectedCallback();}};p([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],si.prototype,"hiddenScrollbar",2);var z=class extends C{constructor(){super(...arguments);this.et=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Rs=true;this.tabList=[...N];this.activeTab=A.CROP;this.zt=true;this.Xi=false;this.Ms=null;this.Ls=0;this.Is=0;this.jt=E();this.Us=E();this.tabToggleRefs={[A.CROP]:E(),[A.TUNING]:E(),[A.FILTERS]:E()};this.Ns=()=>{this.we();};this.tt=[];this.Ht=M(e=>{this.et=e;},500);this.Bt=M(()=>{let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],r="",o=false;if(this.$["*tabId"]===A.FILTERS)if(o=true,this.$["*currentFilter"]&&e?.filter?.name===this.$["*currentFilter"]){let n=e?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Z);else if(this.showSubToolbar&&this.$["*tabId"]===A.TUNING&&t){o=true;let n=e?.[t]||G[t].zero;r=`${this.l10n(t)} ${n}`;}o&&(this.$["*operationTooltip"]=r),this.Xi=o;},0);this.wn={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Cn={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.xn={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.En={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Z,"*currentOperation":null,"*operationTooltip":null};this.Nn=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this.m?.();let t=this.$["*on.cancel"];t?.();};this.$n=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let t=this.$["*on.apply"];t?.(this.$["*editorTransformations"]);};this.Dn=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:je(this.$["*operationTooltip"])}),this.jt.value?.apply(),this.$s();};this._n=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this.jt.value?.cancel(),this.$s();};this.Fn=e=>{let r=e.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(e,r),this.Yi(r,{fromViewer:false}));};}$s(){this.$["*showSlider"]=false,this.$["*tabId"]===A.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===A.TUNING&&(this.Xi=false);}Yi(e,{fromViewer:t=false,force:r=false}={}){this.$["*tabId"]!==e&&(this.$["*tabId"]=e),this.Ds(e,{fromViewer:t,force:r});}Ds(e,{fromViewer:t,force:r=false}){if(!r&&this.activeTab===e){this.we();return}this.activeTab=e;let o=this.$["*faderEl"],n=this.$["*cropperEl"];e===A.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:t})):(o?.activate({url:this.$["*originalUrl"],fromViewer:t}),n?.deactivate());for(let a of N){let l=a===e,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.we();}}we(){let t=this.tabToggleRefs[this.activeTab]?.value,r=this.Us.value;if(!t||!r)return;let o=t.offsetLeft,n=t.offsetWidth||Number(getComputedStyle(t).width.replace("px",""));(this.Ls!==o||this.Is!==n)&&(this.Ls=o,this.Is=n,r.style.transform=`translateX(${o}px)`,r.style.width=`${n}px`);}get Zi(){return this.tt.length>=3}Sn(e){switch(e){case A.CROP:return this.An();case A.FILTERS:return this.kn();case A.TUNING:return this.Pn();default:return []}}An(){let e=[];if(this.Zi)e.push(()=>this.On());else for(let t of this.tt)e.push(()=>this._s(t));for(let t of Sr)e.push(()=>this.Rn(t));return this.Qi(e)}kn(){let t=[Z,...Er].map(r=>()=>this.Mn(r));return this.Qi(t)}Pn(){let e=xr.map(t=>()=>this.Ln(t));return this.Qi(e)}Qi(e){return e.length?e.map(r=>r()):[]}On(){return g`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_s(e){return g`<uc-editor-aspect-ratio-button-control .aspectRatio=${e}></uc-editor-aspect-ratio-button-control>`}Rn(e){return g`<uc-editor-crop-button-control .operation=${e}></uc-editor-crop-button-control>`}Mn(e){return g`<uc-editor-filter-control .filter=${e}></uc-editor-filter-control>`}Ln(e){return g`<uc-editor-operation-control .operation=${e}></uc-editor-operation-control>`}In(){return this.Zi?this.tt.map(e=>this._s(e)):[]}async Un(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,t=await this.proxyUrl(ze(this.$["*originalUrl"],e,this.$["*editorTransformations"]));this.m?.();let{cancel:r}=at([t]);this.m=()=>{r(),this.m=void 0;};}}initCallback(){super.initCallback();let e=this.$["*cropPresetList"]??[];this.tt=[...e],this.sub("*cropPresetList",t=>{this.tt=[...t??[]];}),this.sub("*imageSize",t=>{t&&setTimeout(()=>{this.Yi(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",t=>{let r=t?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Bt();}),this.sub("*currentOperation",()=>{this.Bt();}),this.sub("*tabId",t=>{this.Ds(t,{fromViewer:false,force:true}),this.Bt();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",t=>{this.Un(),this.$["*faderEl"]?.setTransformations(t);}),this.sub("*loadingOperations",t=>{let r=false;for(let[,o]of t.entries()){if(r)break;for(let[,n]of o.entries())if(n){r=true;break}}this.Ht(r);}),this.sub("*showSlider",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this.zt=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this.zt=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",t=>{if(this.tabList=t,this.Rs=t.length>1,!t.includes(this.$["*tabId"])&&t.length>0){let[r]=t;r&&this.Yi(r,{fromViewer:false});return}this.we();}),this.sub("*operationTooltip",t=>{this.Ms=t;}),this.Bt();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ns);}firstUpdated(e){super.firstUpdated(e),this.Gt(),this.we();}updated(e){super.updated(e),(e.has("activeTab")||e.has("tabList"))&&this.updateComplete.then(()=>this.we()),(e.has("showSubToolbar")||e.has("showMainToolbar"))&&this.Gt();}disconnectedCallback(){window.removeEventListener("resize",this.Ns),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Gt(){let e=this.jt.value;e&&(this.$["*sliderEl"]=e);}Kn(e){let t=this.tabList.includes(e),r=this.activeTab===e,o=this.tabList.indexOf(e),n=o>=0?ct({gridColumn:`${o+1}`}):w;return g`<uc-presence-toggle class="uc-tab-toggle" .visible=${t} .styles=${this.xn}><uc-btn-ui theme="tab" data-id=${e} icon=${e} role="tab" aria-controls=${`tab_${e}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${e}`} .active=${r} style=${n} @click=${this.Fn} ${k(this.tabToggleRefs[e])} ></uc-btn-ui></uc-presence-toggle>`}Vn(e){let t=this.Sn(e);return g`<div id=${`tab_${e}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${t.length?t:w}</div></div></uc-editor-scroller></div>`}render(){let e=["uc-info-tooltip",this.Xi?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),t=this.Zi;return g`<uc-line-loader-ui .active=${this.et}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${e}>${this.Ms??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.wn} ><div class="uc-tab-content-row">${N.map(r=>Qe(this.activeTab===r,()=>this.Vn(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Rs} .styles=${this.En} @initial-render=${()=>this.we()} ><div class="uc-tab-toggles_indicator" ${k(this.Us)} ></div>${N.map(r=>this.Kn(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Nn} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.$n}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Cn}><div class="uc-slider" ?hidden=${!this.zt}><uc-editor-slider ${k(this.jt)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.zt||!t}>${t?g`<div class="uc-list-aspect-ratio">${this.In()}</div>`:w}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this._n} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Dn} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([y()],z.prototype,"et",2),p([y()],z.prototype,"showMainToolbar",2),p([y()],z.prototype,"showSubToolbar",2),p([y()],z.prototype,"Rs",2),p([y()],z.prototype,"tabList",2),p([y()],z.prototype,"activeTab",2),p([y()],z.prototype,"zt",2),p([y()],z.prototype,"Xi",2),p([y()],z.prototype,"Ms",2),p([y()],z.prototype,"tt",2);var Cs=ke([...N]),_=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.zn="";this.ve=fe;this.jn="";this.et=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Cs;this.Fs=false;this.te=false;this.Ji=null;this.ot=null;this.Ht=M(e=>{this.et=e;},300);this.qt=E();this.Ks=E();this.Vs=E();this.zs=E();this.js=()=>{this.Ht(false),this.ve!==fe&&(this.$["*networkProblems"]=false);};this.Hs=()=>{this.Ht(false),this.$["*networkProblems"]=true;};this.Hn=()=>{let e=this.$["*on.retryNetwork"];e?.();};this.init$={...this.init$,...ns(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Bn(){this.te||this.Ji||(this.Ji=this.updateComplete.then(()=>{this.Ji=null,this.te=true;}));}initCallback(){super.initCallback(),this.Bs(),this.Gs();}Gt(){let e=this.Vs.value;e&&(this.$["*faderEl"]=e);let t=this.Ks.value;t&&(this.$["*cropperEl"]=t);let r=this.zs.value;r&&(this.$["*imgContainerEl"]=r);let o=this.qt.value;o&&(this.$["*imgEl"]=o);}Gn(){let e=this.qt.value;e&&(e.addEventListener("load",this.js),e.addEventListener("error",this.Hs));}qn(){let e=this.qt.value;e&&(e.removeEventListener("load",this.js),e.removeEventListener("error",this.Hs));}get Wn(){let e=this.$["*tabId"];return V("uc-image",{"uc-image_hidden_to_cropper":e===A.CROP,"uc-image_hidden_effects":e!==A.CROP})}qs(){if(this.ot)return this.ot;let e=3e3;return this.ot=new Promise((t,r)=>{let o=()=>{window.clearTimeout(d),c.disconnect(),this.ot=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{o(),window.setTimeout(()=>t(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");o(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},e);if(n()){a();return}c.observe(this);}),this.ot}firstUpdated(e){super.firstUpdated(e),this.Gt(),this.Gn(),this.initEditor();let t=!!(this.uuid||this.cdnUrl),r=e.has("uuid")||e.has("cdnUrl");t&&!r&&this.updateImage();}disconnectedCallback(){this.qn(),super.disconnectedCallback();}render(){let e=this.jn??"",t=this.zn??"",r=this.ve||fe,o=this.et,n=this.Fs;return g` ${Et(as)}<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.Hn}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${e}</div></div><div class="uc-image_container" ${k(this.zs)}><img src=${r} class=${this.Wn} ${k(this.qt)} />${Qe(this.te,()=>g`<uc-editor-image-cropper ${k(this.Ks)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${k(this.Vs)}></uc-editor-image-fader></div><div class="uc-info_pan">${t}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Qe(this.te,()=>g`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(e){super.updated(e),e.has("uuid")&&this.uuid&&this.updateImage(),e.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),e.has("tabs")&&this.Bs(),(e.has("cropPreset")||e.has("cdnUrl"))&&this.Gs();}Bs(){let e=this.tabs||Cs;this.$["*tabList"]=os(e);}Gs(){let e=rs(this.cropPreset??""),t=null;if(this.cdnUrl){let r=wi(this.cdnUrl),o=xi(r);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;t=ss(n,a,e,.1);}}this.$["*cropPresetList"]=e,this.$["*currentAspectRatio"]=t??e?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.qs();}catch{return}if(this.isConnected){if(this.cdnUrl){let e=this.cdnUrl,t=Ot(e),r=Ci(e,t);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let o=wi(e),n=xi(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let e=Ci(this.cfg.cdnCname,this.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===A.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let e=this.$["*originalUrl"],t=await this.proxyUrl(te(e,ee("json"))),r=await fetch(t).then(a=>a.json()),{width:o,height:n}=r;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===A.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:e});}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e));}this.Bn();}}}async initEditor(){try{await this.qs();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{let t=!!e;this.Fs=t;}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],r=ee(ue(e),"preview"),o=te(t,r),n={originalUrl:t,cdnUrlModifiers:r,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([y()],_.prototype,"zn",2),p([y()],_.prototype,"ve",2),p([y()],_.prototype,"jn",2),p([y()],_.prototype,"et",2),p([b({type:String,reflect:true})],_.prototype,"uuid",2),p([b({type:String,attribute:"cdn-url",reflect:true})],_.prototype,"cdnUrl",2),p([b({type:String,attribute:"crop-preset",reflect:true})],_.prototype,"cropPreset",2),p([b({type:String,reflect:true})],_.prototype,"tabs",2),p([y()],_.prototype,"Fs",2),p([y()],_.prototype,"te",2);var xs=class extends _{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:oe.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var vn=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Tn(s){for(let i in s){if(vn.includes(i))continue;let e=[...i].reduce((t,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),t+=r,t),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e=`uc-${e}`),s[i].reg&&s[i].reg(e);}}var Vi=s=>s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");var Es=new Set;function Ss(s){Es.has(s)||(Es.add(s),console.warn(s));}var wn=[{test:s=>!!s.accept&&!!s.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:s=>s.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:s=>s.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ks=M(s=>{for(let{test:i,message:e}of wn)i(s)&&Ss(e);},0);var As=(s,i)=>{let e=new URL(i);return e.hostname=`${s}.${e.hostname}`,e.toString().replace(/\/$/,"")},Cn="0123456789abcdefghijklmnopqrstuvwxyz",Os=s=>{if(s<=0n)return "0";let i="";for(;s>0n;){let e=s%36n;i=Cn[Number(e)]+i,s=s/36n;}return i},Ki=(s,i)=>{try{let e=new URL(s),t=new URL(i);return e.hostname.endsWith(t.hostname)}catch{return false}};var xn=async s=>{let i=new TextEncoder().encode(s),e=await window.crypto.subtle.digest("SHA-256",i),t=Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${t}`)},En=10,Sn=async s=>{let i=await xn(s);return Os(i).slice(0,En)},Ps=async(s,i)=>{let e=await Sn(s);return As(e,i)};var Rs=s=>s instanceof Promise||!!(s&&typeof s=="object"&&"then"in s&&typeof s.then=="function");var zi=s=>s,kn=[zi({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:s,enableVideoRecording:i})=>{let e=i();if(e===null)return s();let t=Se(s());return e&&!t.includes("video")?t=t.concat("video"):e||(t=t.filter(r=>r!=="video")),ke(t)}}),zi({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:s,defaultCameraMode:i})=>{let e=i();if(e===null)return s();let t=Se(s());return t=t.sort((r,o)=>r===e?-1:o===e?1:0),ke(t)}}),zi({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:s,cdnCname:i,cdnCnamePrefixed:e})=>{let t=s(),r=i(),o=e();return t&&(r===Ei||Ki(r,o))?Ps(t,o):r}})],Ms=({key:s,setValue:i,getValue:e,computationControllers:t})=>{for(let r of kn){if(!r.deps.includes(s))continue;let o={[r.key]:()=>e(r.key)};for(let l of r.deps)o[l]=()=>e(l);let n=new AbortController;t.get(r.fn)?.abort(),t.set(r.fn,n);let a;try{a=r.fn(o,{signal:n.signal});}catch(l){t.get(r.fn)===n&&t.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}Rs(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{t.get(r.fn)===n&&t.delete(r.fn);}):i(r.key,a);}};var ji=Object.freeze({PHOTO:"photo",VIDEO:"video"});var x=s=>String(s),$=s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},S=s=>{if(typeof s>"u"||s===null)return false;if(typeof s=="boolean")return s;if(s==="true"||s==="")return true;if(s==="false")return false;throw new Error(`Invalid boolean: "${s}"`)},Ls=s=>s==="auto"?s:S(s),Is=s=>{let i=x(s);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Us=s=>{let i=x(s);if(!Object.values(ji).includes(i))throw new Error(`Invalid value: "${i}"`);return i},$s=s=>{let i=x(s),e=Se(i);if(e.some(t=>!Object.values(ji).includes(t)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return i},Ns=s=>{let i=x(s);if(i==="local"||i==="global")return i;if(S(s)===false)return false;throw new Error(`Invalid value: "${i}"`)},Ds=s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},Hi=s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},oi=s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},ni=s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},_s=s=>{let i=x(s);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},Fs=s=>{let i=x(s);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var An={pubkey:x,multiple:S,multipleMin:$,multipleMax:$,confirmUpload:S,imgOnly:S,accept:x,externalSourcesPreferredTypes:x,externalSourcesEmbedCss:x,store:Ls,cameraMirror:S,cameraCapture:Is,sourceList:x,topLevelOrigin:x,maxLocalFileSizeBytes:$,thumbSize:$,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:x,removeCopyright:S,cropPreset:x,imageShrink:x,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:x,cdnCname:x,cdnCnamePrefixed:x,baseUrl:x,socialBaseUrl:x,secureSignature:x,secureExpire:x,secureDeliveryProxy:x,retryThrottledRequestMaxTimes:$,retryNetworkErrorMaxTimes:$,multipartMinFileSize:$,multipartChunkSize:$,maxConcurrentRequests:$,multipartMaxConcurrentRequests:$,multipartMaxAttempts:$,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:x,debug:S,localeName:x,metadata:Ds,secureUploadsExpireThreshold:$,localeDefinitionOverride:s=>Hi(s),secureUploadsSignatureResolver:s=>oi(s),secureDeliveryProxyUrlResolver:s=>oi(s),iconHrefResolver:s=>oi(s),plugins:s=>ni(s),fileValidators:ni,collectionValidators:ni,validationTimeout:$,validationConcurrency:$,cameraModes:$s,defaultCameraMode:Us,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:Hi,maxVideoRecordingDuration:$,filesViewMode:_s,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:x,testMode:S,qualityInsights:S,pasteScope:Ns,dynamicButtonShowFirstIcon:S,dynamicButtonViewMode:Fs},Vs=(s,i)=>{if(!(typeof i>"u"||i===null))try{return An[s](i)}catch(e){return console.error(`Invalid value for config key "${s}".`,e),I[s]}};var ai=[...new Set(["debug",...Object.keys(I)])],On=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],zs=s=>On.includes(s),Gi=ai.filter(s=>!zs(s)),Bi={...Object.fromEntries(Gi.map(s=>[Vi(s),s])),...Object.fromEntries(Gi.map(s=>[s.toLowerCase(),s]))},Ks=s=>`__${s}`,li=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(I).map(([e,t])=>[T(e),t]))};this.Xn=new Map;this.ut={};this.Ws=new Set;this.Ue=new Map;}er(e){return this.Ws.has(e)}tr(e){let t=this.s.pluginManager;if(t)return t.configRegistry.get(e)}ir(e){return [...new Set([Vi(e),e.toLowerCase()])]}Yn(e,t){if(zs(e)||this.er(e)&&this.tr(e)?.attribute===false)return;let r=this.ir(e);for(let o of r)typeof t>"u"||t===null?this.removeAttribute(o):this.getAttribute(o)!==t.toString()&&this.setAttribute(o,t.toString());}Zn(e,t){let r=T(e);if(this.$[r]!==t)if(typeof t>"u"||t===null){let o=I[e];this.$[r]=o!==void 0?o:t;}else this.$[r]=t;}ae(e,t){let r;if(this.er(e)){let a=this.tr(e);try{r=a?.normalize?.(t)??t;}catch(l){console.warn(`[uc-config] normalize() for "${e}" threw an error, keeping previous value`,l);return}}else r=Vs(e,t);let o=this,n=Ks(e);o[n]!==r&&(this.Qn(e,o[n],r),o[n]=r,this.Yn(e,r),this.Zn(e,r),this.debugPrint(`"${e}"`,r),this.er(e)||ks(this.cfg));}Xt(e){let t=this,r=Ks(e);return t[r]??this.$[T(e)]}Qn(e,t,r){this.cfg.debug&&r!==t&&typeof r=="object"&&typeof t=="object"&&JSON.stringify(r)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" 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] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,r));}Xs(e){let t=e.configRegistry.getAll();this.ut={},this.Ws=new Set(t.keys());for(let[r,o]of this.Ue)t.has(r)||(o(),this.Ue.delete(r));for(let[r,o]of t){let a=T(r);if(o.attribute){let f=this.ir(r);for(let m of f)this.ut[m]=r;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,r);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&o.attribute)for(let f of this.ir(r)){let m=this.getAttribute(f);if(m!=null){try{l=o.fromAttribute?o.fromAttribute(m):m;}catch(P){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,P),l=m;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,o.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:f=>{this.ae(r,f);},get:()=>this.Xt(r),enumerable:true,configurable:true}),!this.Ue.has(r)){let f=this.sub(a,m=>{this.ae(r,m);},false);this.Ue.set(r,f);}c&&this.ae(r,l);}}Jn(){this.s.when("pluginManager",e=>{this.Xs(e),this.Wt=e.onPluginsChange(()=>{this.Xs(e);});});}ea(){this.at=new MutationObserver(e=>{for(let t of e)if(t.type==="attributes"&&t.attributeName){let r=t.attributeName,o=t.oldValue,n=this.getAttribute(r);if(o===n||r in Bi)continue;if(r in this.ut){let l=this.ut[r],c=this.tr(l);this.attributeChangedCallback(r,o??"",n??c?.defaultValue??"");}}}),this.at.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let e=this;this.Jn(),this.ea();for(let r of Gi)this.sub(T(r),o=>{this.ae(r,o);},false);for(let r of ai){let o=e[r]??this.$[T(r)];o!==I[r]&&this.ae(r,o);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.ae(r,a);},get:()=>this.Xt(r)});}let t=r=>{Ms({key:r,setValue:this.ae.bind(this),getValue:this.Xt.bind(this),computationControllers:this.Xn});};for(let r of ai)this.sub(T(r),()=>t(r));}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),t===r)return;let o=this,n=Bi[e];n?o[n]=r:this.s.when("pluginManager",a=>{let l=this.getAttribute(e);if(l&&l!==r)return;let c=this.ut[e],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.Xt(c)===u)return;this.ae(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.Wt&&(this.Wt(),this.Wt=void 0),this.at&&(this.at.disconnect(),this.at=void 0);for(let e of this.Ue.values())e();this.Ue.clear();}static get observedAttributes(){let e=super.observedAttributes,t=Object.keys(Bi);return [...e,...t]}};for(let s of ai)li.prototype[s]=void 0;/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
|
|
8
|
-
export{
|
|
7
|
+
var Ks=Object.defineProperty;var Vs=Object.getOwnPropertyDescriptor;var p=(s,i,t,e)=>{for(var r=e>1?void 0:e?Vs(i,t):i,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&Ks(i,t,r),r};var ue=globalThis,pe=ue.ShadowRoot&&(ue.ShadyCSS===void 0||ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Gi=Symbol(),Bi=new WeakMap,de=class{constructor(i,t,e){if(this.Ys=true,e!==Gi)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(pe&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Bi.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Bi.set(t,i));}return i}toString(){return this.cssText}},qi=s=>new de(typeof s=="string"?s:s+"",void 0,Gi);var Wi=(s,i)=>{if(pe)s.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=ue.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,s.appendChild(e);}},ci=pe?s=>s:s=>s instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return qi(t)})(s):s;var{is:zs,defineProperty:js,getOwnPropertyDescriptor:Hs,getOwnPropertyNames:Bs,getOwnPropertySymbols:Gs,getPrototypeOf:qs}=Object,he=globalThis,Xi=he.trustedTypes,Ws=Xi?Xi.emptyScript:"",Xs=he.reactiveElementPolyfillSupport,Ht=(s,i)=>s,Bt={toAttribute(s,i){switch(i){case Boolean:s=s?Ws:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s);}return s},fromAttribute(s,i){let t=s;switch(i){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s);}catch{t=null;}}return t}},fe=(s,i)=>!zs(s,i),Yi={attribute:true,type:String,converter:Bt,reflect:false,useDefault:false,hasChanged:fe};Symbol.metadata??=Symbol("metadata"),he.litPropertyMetadata??=new WeakMap;var Z=class extends HTMLElement{static addInitializer(i){this.Ye(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.he&&[...this.he.keys()]}static createProperty(i,t=Yi){if(t.state&&(t.attribute=false),this.Ye(),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&&js(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:o}=Hs(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);o?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Yi}static Ye(){if(this.hasOwnProperty(Ht("elementProperties")))return;let i=qs(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=true,this.Ye(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,e=[...Bs(t),...Gs(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.he=new Map;for(let[t,e]of this.elementProperties){let r=this.Ze(t,e);r!==void 0&&this.he.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(ci(r));}else i!==void 0&&t.push(ci(i));return t}static Ze(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.fe=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.Rt=null,this.Zs();}Zs(){this.Qe=new Promise(i=>this.enableUpdating=i),this.gt=new Map,this.Qs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.jt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.jt?.delete(i);}Qs(){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.fe=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Wi(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.jt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.jt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Je(i,e);}Js(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Ze(i,e);if(r!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:Bt).toAttribute(t,e.type);this.Rt=i,o==null?this.removeAttribute(r):this.setAttribute(r,o),this.Rt=null;}}Je(i,t){let e=this.constructor,r=e.he.get(i);if(r!==void 0&&this.Rt!==r){let o=e.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Bt;this.Rt=r;let a=n.fromAttribute(t,o.type);this[r]=a??this.ti?.get(r)??a,this.Rt=null;}}requestUpdate(i,t,e,r=false,o){if(i!==void 0){let n=this.constructor;if(r===false&&(o=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??fe)(o,t)||e.useDefault&&e.reflect&&o===this.ti?.get(i)&&!this.hasAttribute(n.Ze(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Qe=this.to());}C(i,t,{useDefault:e,reflect:r,wrapped:o},n){e&&!(this.ti??=new Map).has(i)&&(this.ti.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.gt.has(i)||(this.hasUpdated||e||(t=void 0),this.gt.set(i,t)),r===true&&this.Rt!==i&&(this.rr??=new Set).add(i));}async to(){this.isUpdatePending=true;try{await this.Qe;}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.fe){for(let[r,o]of this.fe)this[r]=o;this.fe=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,o]of e){let{wrapped:n}=o,a=this[r];n!==true||this.gt.has(r)||a===void 0||this.C(r,void 0,o,a);}}let i=false,t=this.gt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.jt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.ei();}catch(e){throw i=false,this.ei(),e}i&&this.eo(t);}willUpdate(i){}eo(i){this.jt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}ei(){this.gt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Qe}shouldUpdate(i){return true}update(i){this.rr&&=this.rr.forEach(t=>this.Js(t,this[t])),this.ei();}updated(i){}firstUpdated(i){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[Ht("elementProperties")]=new Map,Z[Ht("finalized")]=new Map,Xs?.({ReactiveElement:Z}),(he.reactiveElementVersions??=[]).push("2.1.2");var di=globalThis,Zi=s=>s,me=di.trustedTypes,Qi=me?me.createPolicy("lit-html",{createHTML:s=>s}):void 0,pi="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,hi="?"+Q,Ys=`<${hi}>`,wt=document,qt=()=>wt.createComment(""),Wt=s=>s===null||typeof s!="object"&&typeof s!="function",fi=Array.isArray,sr=s=>fi(s)||typeof s?.[Symbol.iterator]=="function",ui=`[ \f\r]`,Gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ji=/-->/g,tr=/>/g,vt=RegExp(`>|${ui}(?:([^\\s"'>=/]+)(${ui}*=${ui}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),er=/'/g,ir=/"/g,or=/^(?:script|style|textarea|title)$/i,mi=s=>(i,...t)=>({yt:s,strings:i,values:t}),g=mi(1),F=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),rr=new WeakMap,Tt=wt.createTreeWalker(wt,129);function nr(s,i){if(!fi(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qi!==void 0?Qi.createHTML(i):i}var ar=(s,i)=>{let t=s.length-1,e=[],r,o=i===2?"<svg>":i===3?"<math>":"",n=Gt;for(let a=0;a<t;a++){let l=s[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Gt?d[1]==="!--"?n=Ji:d[1]!==void 0?n=tr:d[2]!==void 0?(or.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=vt):d[3]!==void 0&&(n=vt):n===vt?d[0]===">"?(n=r??Gt,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?vt:d[3]==='"'?ir:er):n===ir||n===er?n=vt:n===Ji||n===tr?n=Gt:(n=vt,r=void 0);let f=n===vt&&s[a+1].startsWith("/>")?" ":"";o+=n===Gt?l+Ys:u>=0?(e.push(c),l.slice(0,u)+pi+l.slice(u)+Q+f):l+Q+(u===-2?a:f);}return [nr(s,o+(s[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},Xt=class s{constructor({strings:i,yt:t},e){let r;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=ar(i,t);if(this.el=s.createElement(c,e),Tt.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=Tt.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(pi)){let h=d[n++],f=r.getAttribute(u).split(Q),m=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:m[2],strings:f,ctor:m[1]==="."?ye:m[1]==="?"?be:m[1]==="@"?ve:xt}),r.removeAttribute(u);}else u.startsWith(Q)&&(l.push({type:6,index:o}),r.removeAttribute(u));if(or.test(r.tagName)){let u=r.textContent.split(Q),h=u.length-1;if(h>0){r.textContent=me?me.emptyScript:"";for(let f=0;f<h;f++)r.append(u[f],qt()),Tt.nextNode(),l.push({type:2,index:++o});r.append(u[h],qt());}}}else if(r.nodeType===8)if(r.data===hi)l.push({type:2,index:o});else {let u=-1;for(;(u=r.data.indexOf(Q,u+1))!==-1;)l.push({type:7,index:o}),u+=Q.length-1;}o++;}}static createElement(i,t){let e=wt.createElement("template");return e.innerHTML=i,e}};function Ct(s,i,t=s,e){if(i===F)return i;let r=e!==void 0?t.io?.[e]:t.ro,o=Wt(i)?void 0:i.ii;return r?.constructor!==o&&(r?.sr?.(false),o===void 0?r=void 0:(r=new o(s),r.ri(s,t,e)),e!==void 0?(t.io??=[])[e]=r:t.ro=r),r!==void 0&&(i=Ct(s,r.so(s,i.values),r,e)),i}var ge=class{constructor(i,t){this.or=[],this.K=void 0,this.nr=i,this.a=t;}get parentNode(){return this.a.parentNode}get b(){return this.a.b}u(i){let{el:{content:t},parts:e}=this.nr,r=(i?.creationScope??wt).importNode(t,true);Tt.currentNode=r;let o=Tt.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Rt(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Te(o,this,i)),this.or.push(c),l=e[++a];}n!==l?.index&&(o=Tt.nextNode(),n++);}return Tt.currentNode=wt,r}p(i){let t=0;for(let e of this.or)e!==void 0&&(e.strings!==void 0?(e.z(i,e,t),t+=e.strings.length-2):e.z(i[t])),t++;}},Rt=class s{get b(){return this.a?.b??this.ar}constructor(i,t,e,r){this.type=2,this.e=w,this.K=void 0,this.X=i,this.Mt=t,this.a=e,this.options=r,this.ar=r?.isConnected??true;}get parentNode(){let i=this.X.parentNode,t=this.a;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.X}get endNode(){return this.Mt}z(i,t=this){i=Ct(this,i,t),Wt(i)?i===w||i==null||i===""?(this.e!==w&&this.Lt(),this.e=w):i!==this.e&&i!==F&&this.lr(i):i.yt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):sr(i)?this.k(i):this.lr(i);}O(i){return this.X.parentNode.insertBefore(i,this.Mt)}T(i){this.e!==i&&(this.Lt(),this.e=this.O(i));}lr(i){this.e!==w&&Wt(this.e)?this.X.nextSibling.data=i:this.T(wt.createTextNode(i)),this.e=i;}$(i){let{values:t,yt:e}=i,r=typeof e=="number"?this.oo(i):(e.el===void 0&&(e.el=Xt.createElement(nr(e.h,e.h[0]),this.options)),e);if(this.e?.nr===r)this.e.p(t);else {let o=new ge(r,this),n=o.u(this.options);o.p(t),this.T(n),this.e=o;}}oo(i){let t=rr.get(i.strings);return t===void 0&&rr.set(i.strings,t=new Xt(i)),t}k(i){fi(this.e)||(this.e=[],this.Lt());let t=this.e,e,r=0;for(let o of i)r===t.length?t.push(e=new s(this.O(qt()),this.O(qt()),this,this.options)):e=t[r],e.z(o),r++;r<t.length&&(this.Lt(e&&e.Mt.nextSibling,r),t.length=r);}Lt(i=this.X.nextSibling,t){for(this.me?.(false,true,t);i!==this.Mt;){let e=Zi(i).nextSibling;Zi(i).remove(),i=e;}}setConnected(i){this.a===void 0&&(this.ar=i,this.me?.(i));}},xt=class{get tagName(){return this.element.tagName}get b(){return this.a.b}constructor(i,t,e,r,o){this.type=1,this.e=w,this.K=void 0,this.element=i,this.name=t,this.a=r,this.options=o,e.length>2||e[0]!==""||e[1]!==""?(this.e=Array(e.length-1).fill(new String),this.strings=e):this.e=w;}z(i,t=this,e,r){let o=this.strings,n=false;if(o===void 0)i=Ct(this,i,t,0),n=!Wt(i)||i!==this.e&&i!==F,n&&(this.e=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=Ct(this,a[e+l],t,l),c===F&&(c=this.e[l]),n||=!Wt(c)||c!==this.e[l],c===w?i=w:i!==w&&(i+=(c??"")+o[l+1]),this.e[l]=c;}n&&!r&&this.j(i);}j(i){i===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},ye=class extends xt{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===w?void 0:i;}},be=class extends xt{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==w);}},ve=class extends xt{constructor(i,t,e,r,o){super(i,t,e,r,o),this.type=5;}z(i,t=this){if((i=Ct(this,i,t,0)??w)===F)return;let e=this.e,r=i===w&&e!==w||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==w&&(e===w||r);r&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this.e=i;}handleEvent(i){typeof this.e=="function"?this.e.call(this.options?.host??this.element,i):this.e.handleEvent(i);}},Te=class{constructor(i,t,e){this.element=i,this.type=6,this.K=void 0,this.a=t,this.options=e;}get b(){return this.a.b}z(i){Ct(this,i);}},Zs=di.litHtmlPolyfillSupport;Zs?.(Xt,Rt),(di.litHtmlVersions??=[]).push("3.3.2");var cr=(s,i,t)=>{let e=t?.renderBefore??i,r=e.ao;if(r===void 0){let o=t?.renderBefore??null;e.ao=r=new Rt(i.insertBefore(qt(),o),o,void 0,t??{});}return r.z(s),r};var gi=globalThis,at=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this.si=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.si=cr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.si?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.si?.setConnected(false);}render(){return F}};at.ea=true,at.finalized=true,gi.litElementHydrateSupport?.({LitElement:at});var Qs=gi.litElementPolyfillSupport;Qs?.({LitElement:at});(gi.litElementVersions??=[]).push("4.2.2");var Js={attribute:true,type:String,converter:Bt,reflect:false,hasChanged:fe},to=(s=Js,i,t)=>{let{kind:e,metadata:r}=t,o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),e==="setter"&&((s=Object.create(s)).wrapped=true),o.set(t.name,s),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,s,true,a);},init(a){return a!==void 0&&this.C(n,void 0,s,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,s,true,a);}}throw Error("Unsupported decorator location: "+e)};function b(s){return (i,t)=>typeof t=="object"?to(s,i,t):((e,r,o)=>{let n=r.hasOwnProperty(o);return r.constructor.createProperty(o,e),n?Object.getOwnPropertyDescriptor(r,o):void 0})(s,i,t)}function y(s){return b({...s,state:true,attribute:false})}var ur=s=>s.strings===void 0;var lt={ATTRIBUTE:1,CHILD:2},H=s=>(...i)=>({ii:s,values:i}),W=class{constructor(i){}get b(){return this.a.b}ri(i,t,e){this.ge=i,this.a=t,this.co=e;}so(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Yt=(s,i)=>{let t=s.K;if(t===void 0)return false;for(let e of t)e.sr?.(i,false),Yt(e,i);return true},Ce=s=>{let i,t;do{if((i=s.a)===void 0)break;t=i.K,t.delete(s),s=i;}while(t?.size===0)},dr=s=>{for(let i;i=s.a;s=i){let t=i.K;if(t===void 0)i.K=t=new Set;else if(t.has(s))break;t.add(s),ro(i);}};function eo(s){this.K!==void 0?(Ce(this),this.a=s,dr(this)):this.a=s;}function io(s,i=false,t=0){let e=this.e,r=this.K;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let o=t;o<e.length;o++)Yt(e[o],false),Ce(e[o]);else e!=null&&(Yt(e,false),Ce(e));else Yt(this,s);}var ro=s=>{s.type==lt.CHILD&&(s.me??=io,s.lo??=eo);},xe=class extends W{constructor(){super(...arguments),this.K=void 0;}ri(i,t,e){super.ri(i,t,e),dr(this),this.isConnected=i.b;}sr(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Yt(this,i),Ce(this));}setValue(i){if(ur(this.ge))this.ge.z(i,this);else {let t=[...this.ge.e];t[this.co]=i,this.ge.z(t,this,0);}}disconnected(){}reconnected(){}};var E=()=>new bi,bi=class{},yi=new WeakMap,k=H(class extends xe{render(s){return w}update(s,[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=s.options?.host,this.rt(this.ct=s.element)),w}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=yi.get(i);t===void 0&&(t=new WeakMap,yi.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ht,s);}else this.G.value=s;}get lt(){return typeof this.G=="function"?yi.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 Et=class extends W{constructor(i){if(super(i),this.it=w,i.type!==lt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===w||i==null)return this.cr=void 0,this.it=i;if(i===F)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.cr;this.it=i;let t=[i];return t.raw=t,this.cr={yt:this.constructor.resultType,strings:t,values:[]}}};Et.directiveName="unsafeHTML",Et.resultType=1;var Zt=class extends Et{};Zt.directiveName="unsafeSVG",Zt.resultType=2;var Ee=H(Zt);function Qt(s,i,t){return s?i(s):t?.(s)}var pr;(function(s){s.Token="token",s.FileInfo="file_info";})(pr||(pr={}));var hr;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success";})(hr||(hr={}));var Se=class{ye=1;oi=[];be=0;ni=new Map;ai=new Map;constructor(i){this.ye=i;}run(){let i=this.ye-this.be;for(let t=0;t<i;t++){let e=this.oi.shift();if(!e)return;let r=this.ni.get(e),o=this.ai.get(e);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.be+=1,e().finally(()=>{this.ni.delete(e),this.ai.delete(e),this.be-=1,this.run();}).then(n=>r(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.ni.set(i,e),this.ai.set(i,r),this.oi.push(i),t&&this.run();})}get pending(){return this.oi.length}get running(){return this.be}set concurrency(i){this.ye=i,this.run();}get concurrency(){return this.ye}};var fr=()=>({});var Mt=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var T=s=>`*cfg/${s}`;var St=s=>s?s.split(",").map(i=>i.trim()).filter(Boolean):[],kt=s=>s.join(",");var mr=s=>{if(typeof s!="string"||!s)return "";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},ke=(...s)=>s.filter(i=>typeof i=="string"&&!!i).map(i=>mr(i)).join("/-/"),J=(...s)=>{let i=ke(...s);return i?`-/${i}/`:""};function Ae(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):r>=0&&(o=t.slice(r+1)),o}function Oe(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function vi(s){let i=gr(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Ti(s){return vi(s).split("/-/").filter(Boolean).map(t=>mr(t))}function gr(s){let i=new URL(s),t=Ae(s),e=yr(t)?br(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function yr(s){return s.startsWith("http")}function br(s){let i=new URL(s);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var tt=(s,i,t)=>{let e=new URL(gr(s)),r=Ae(s),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&yr(r)){let n=br(r);e.pathname=`${e.pathname}${o}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${o}${r||""}`;return e.toString()},wi=(s,i)=>{let t=new URL(s);return t.pathname=`${i}/`,t.toString()};var Jt=(s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var te=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}),Tr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function so(s,i){if(typeof i=="number"){let t=i;return te[s]!==t?`${s}/${t}`:""}if(typeof i=="boolean"){let t=i;return te[s]!==t?`${s}`:""}if(s==="filter"&&i){let{name:t,amount:e}=i;return te.filter===e?"":`${s}/${t}/${e}`}if(s==="crop"&&i){let{dimensions:t,coords:e}=i;return `${s}/${t.join("x")}/${e.join(",")}`}return ""}function ct(s){return ke(...Tr.filter(i=>typeof s[i]<"u"&&s[i]!==null).map(i=>{let t=s[i];return so(i,t)}).filter(i=>!!i))}var Pe=ke("format/auto","progressive/yes"),et=([s])=>typeof s<"u"?Number(s):void 0,vr=()=>true,oo=([s,i])=>({name:s,amount:typeof i<"u"?Number(i):100}),no=([s,i])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Jt(s,"x").map(Number),coords:Jt(i).map(Number)}},ao=Object.freeze({enhance:et,brightness:et,exposure:et,gamma:et,contrast:et,saturation:et,vibrance:et,warmth:et,filter:oo,mirror:vr,flip:vr,rotate:et,crop:s=>{let[i,t]=s,{dimensions:e,coords:r}=no([i,t]);return {dimensions:e,coords:r}}});function Ci(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!e||!Tr.includes(e))continue;let o=e,n=ao[o];try{let a=n(r);i[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var A=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),N=Object.freeze([A.CROP,A.TUNING,A.FILTERS]),wr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Cr=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"]),xr=Object.freeze(["rotate","mirror","flip"]),it=te,B=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var xi="https://ucarecdn.com",lo="https://upload.uploadcare.com",co="https://social.uploadcare.com",uo="https://ucarecd.net",po={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:xi,cdnCnamePrefixed:uo,baseUrl:lo,socialBaseUrl:co,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:kt(N),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"auto",dynamicButtonShowFirstIcon:true},I=Object.freeze(po);var Re=(s,i)=>(...t)=>{let e=s();if(!e.read(T("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let o=[e.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...r);};var $=class{constructor(i){this.li=new Set;this.bt=null;this.Y=Re(()=>this.s.ctx,this.constructor.name);this.s=i,this.i=i.ctx;}addSub(i){this.li.add(i);}get ur(){if(!this.bt){let i={};this.bt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=T(e);return this.s.ctx.has(r)?this.s.ctx.read(r):I[e]}});}return this.bt}destroy(){for(let i of this.li)try{i();}catch{}this.li.clear();}},ho={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},j=(s,i,t=true)=>{let e=s.has(i),r=e?s.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},Er=s=>({get ctx(){return s()},get modalManager(){return j(s(),"*modalManager",false)},get pluginManager(){return j(s(),"*pluginManager")},get telemetryManager(){return j(s(),"*telemetryManager")},get localeManager(){return j(s(),"*localeManager")},get a11y(){return j(s(),"*a11y")},get routerLayer(){return j(s(),"*routerLayer")},get blocksRegistry(){return j(s(),"*blocksRegistry")},get eventEmitter(){return j(s(),"*eventEmitter")},get uploadCollection(){return j(s(),"*uploadCollection")},get secureUploadsManager(){return j(s(),"*secureUploadsManager",false)},get api(){return j(s(),"*publicApi")},get validationManager(){return j(s(),"*validationManager")},when(i,t){let e=ho[i],r=s(),o=r.has(e)?r.read(e):void 0;if(o)return t(o),()=>{};let n;return n=r.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}});var fo=new Set([Mt.START_FROM,Mt.UPLOAD_LIST]),Me=class extends ${constructor(t){super(t);this.scopes=new Set;this.listener=this.uo.bind(this),window.addEventListener("paste",this.listener);}po(t){if(!(t instanceof Element))return false;if(t.closest("input, textarea, select"))return true;let e=t.closest("[contenteditable]");return !!(e&&e.getAttribute("contenteditable")?.toLowerCase()!=="false"||t.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}ho(t){return t.composedPath().some(e=>this.po(e))}fo(t){return typeof t=="string"&&fo.has(t)}mo(){return [...this.scopes].some(t=>t.isConnected)}go(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}yo(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}bo(t){let e=t.trim();if(!e)return null;try{let r=new URL(e);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}openUploadList(){this.s.routerLayer.navigateAfterFileAdd();}async uo(t){if(!t.clipboardData||this.ho(t)||!this.mo())return;let e=this.s.ctx.read("*currentActivity"),r=e===null,o=this.fo(e);switch(this.ur.pasteScope){case "global":if(!o&&!(r&&this.go()))return;await this.handlePaste(t);return;case "local":{let n=t.target instanceof Node?t.target:null;if(!this.yo(n)||!o&&!r)return;await this.handlePaste(t);return}default:return}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),o=e.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.bo(c));});})),n=false;if(r.length>0&&(r.forEach(a=>{this.s.api.addFileFromObject(a,{source:"clipboard"});}),n=true),o.length>0){let a=(await Promise.all(o)).filter(l=>l!==null);a.forEach(l=>{this.s.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&this.openUploadList();}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var Le=class extends ${constructor(){super(...arguments);this.ve=[];}registerAfterFileAddHook(t){return this.ve.push(t),()=>{this.ve=this.ve.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.s.ctx.read("*history").length};this.ve.some(o=>o(e))||(this.s.ctx.pub("*currentActivity",Mt.UPLOAD_LIST),this.s.modalManager?.open(Mt.UPLOAD_LIST));}};var mo={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ee(s,i){i.tabIndex=0,i.focus(),s.tabIndex=-1;}function Ei(s){let i=s.role||s.type||s.tagName;if(!i)return null;let t=mo[i.toLowerCase()];if(!t)return null;for(let e of t){let r=s.closest(`[role=${e}]`);if(r)return r}}function Si(s,i){return i.role==="toolbar"?yo(i):i.querySelectorAll(`[role=${s.role}]`)}function go(s,i){return Array.from(s).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}function yo(s){return [...s.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function bo(s){let i=s.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=s.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function Sr(s){return i=>{let t=false,e=300,r=0,o="";function n(u){let h=Ei(u.target);if(!h){a();return}let f=Si(u.target,h),m=go(f,h),R=Array.from(m).indexOf(u.target),M="ArrowDown",L="ArrowUp";if(bo(h)&&(i.document.dir==="rtl"?(M="ArrowLeft",L="ArrowRight"):(M="ArrowRight",L="ArrowLeft")),u.key===M)u.preventDefault(),ee(u.target,m[R+1]||m[0]);else if(u.key===L)u.preventDefault(),ee(u.target,m[R-1]||m[m.length-1]);else if(u.key==="Home")u.preventDefault(),ee(u.target,m[0]);else if(u.key==="End")u.preventDefault(),ee(u.target,m[m.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=e?o+=u.key.toLowerCase():o=u.key.toLowerCase(),r=u.timeStamp;let bt=Array.from(f).find(Fs=>Fs.textContent?.trim()?.toLowerCase()?.startsWith(o));bt&&(u.preventDefault(),ee(u.target,bt));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=Ei(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=Si(u.target,h);for(let m of f)m!==u.target&&m.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=Ei(u.target);if(h){let f=Si(u.target,h);for(let m of f)m!==u.target&&m.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function kr(){return s=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function r(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return s.addEventListener("keyuxJump",e),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",e),s.removeEventListener("focusout",r);}}}function Ar(){return s=>{let i=[];function t(l){let c=s.document.activeElement;c&&c!==s.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){s.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return s.addEventListener("keydown",a),()=>{s.removeEventListener("keydown",a);}}}function Or(s){let i,t=s.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...t),i=a.target,e=a.target);}function o(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(o(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",o);})}function Pr(s,i){let t=i.map(e=>e(s));return ()=>{t.forEach(e=>e());}}var ki=class{constructor(){this.E=new Map;this.ci=[];}addEventListener(i,t){let e=r=>{let o=r.target;o instanceof Node&&this.ci.some(n=>n===o||n.contains(o))&&t(r);};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.ci.push(i);}destroy(){this.ci=[];for(let i of this.E.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.E.clear();}},Ie=class{constructor(){this.Te=new ki,this.pr=Pr(this.Te,[Sr(),Or("is-pressed"),Ar(),kr()]);}registerBlock(i){this.Te.registerScope(i);}destroy(){this.pr?.(),this.Te.destroy();}};var ie={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var Ai=new Map,Rr=new Map,Mr=(s,i)=>{Ai.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`);let t={...ie,...i};return Ai.set(s,t),t},vo=(s,i)=>{Rr.set(s,i);},To=(s,i)=>{typeof i=="function"?vo(s,i):Mr(s,i);},Lr=async s=>{let i=Ai.get(s);if(!i){let t=Rr.get(s);if(!t)throw new Error(`Locale ${s} is not defined`);let e=await t();i=Mr(s,e);}return i};To("en",ie);var rt=s=>`*l10n/${s}`,wo="en",$e=class extends ${constructor(t){super(t);this.It="";for(let[r,o]of Object.entries(ie)){let n=this.i.has(rt(r))?!this.i.read(rt(r)):true;this.i.add(rt(r),o,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.It&&this.dr(this.It);})),this.addSub(this.i.sub(T("localeName"),async r=>{if(!r)return;this.It=r;let o=await Lr(r);r!==wo&&this.It!==r||(this.dr(r),this.hr(r,o));})),this.addSub(this.i.sub(T("localeDefinitionOverride"),r=>{if(!r)return;let o=r[this.It];o&&this.hr(this.It,o);}));}hr(t,e){let r=this.ur.localeDefinitionOverride?.[t];for(let[o,n]of Object.entries(e)){let a=r?.[o];this.i.add(rt(o),a??n,true);}}dr(t){let e=this.s.pluginManager;if(!e)return;let r=e.snapshot();for(let o of r.l10n){let{pluginId:n,...a}=o,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.i.add(rt(c),d,true);}}};var Lt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Ue=class extends ${constructor(){super(...arguments);this.vt=new Map;this.q=new Set;this.v=new Map;}registerModal(t,e){this.vt.set(t,e),this.Ut(Lt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.vt.get(t);return e?(this.vt.delete(t),this.q.delete(t),this.Ut(Lt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.vt.get(t);return e?(this.q.add(t),this.Ut(Lt.OPEN,{modal:e,id:t}),true):(this.Y(`Modal with ID "${t}" not found`),false)}close(t){let e=this.vt.get(t);return !e||!this.q.has(t)?(this.Y(`Modal with ID "${t}" not found or not active`),false):(this.q.delete(t),this.Ut(Lt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.vt.has(t)?this.q.has(t)?this.close(t):this.open(t):(this.Y(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.q.size>0}back(){if(this.q.size===0)return this.Y("No active modals to go back from"),false;let t=Array.from(this.q).pop();return t?this.close(t):false}closeAll(){let t=this.q.size;return this.q.clear(),this.Ut(Lt.CLOSE_ALL,{}),t}subscribe(t,e){return this.v.has(t)||this.v.set(t,new Set),this.v.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.v.has(t)&&this.v.get(t)?.delete(e);}Ut(t,e){if(this.v.has(t))for(let r of this.v.get(t)??new Set)try{r(e);}catch(o){this.s.telemetryManager.sendEventError(o,"modal subscriber"),this.Y("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.vt.clear(),this.v.clear(),this.Ut(Lt.DESTROY,{});}};var Co=()=>{let s=navigator.userAgent;return /Macintosh|Windows/.test(s)&&/Version\/[\d.]+.*Safari/.test(s)&&!/Chrome|Chromium|Edg|OPR/.test(s)},xo=()=>"capture"in document.createElement("input"),Eo=()=>({safariDesktop:Co()}),So=()=>({htmlMediaCapture:xo()}),Ir=Eo();So();var $r="image/*";var ko=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ao=()=>Ir.safariDesktop?[$r]:[$r,...ko],Oo=Ao();var Po=(s,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return s.startsWith(e)}return s===t});var Ur=s=>{let i=s?.type;return i?Po(i,Oo):false};function Nr(s,i,t,e,r){return {registry:{registerSource:c=>s.addSource(e,c),registerActivity:c=>s.addActivity(e,c),registerFileAction:c=>s.addFileAction(e,c),registerFileHook:c=>s.addFileHook(e,c),registerIcon:c=>s.addIcon(e,c),registerL10n:c=>s.addL10n(e,c),registerConfig:c=>{s.addConfig(e,c);let d=T(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=T(c);return i.read(d)},subscribe:(c,d)=>{let u=T(c),h=i.sub(u,f=>{d(f);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var Ro=async({entries:s,signal:i})=>(await Promise.all(s.map(async e=>{if(e.isEnabled())try{let r=await e.load();return i.aborted||!e.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(e=>e!==void 0),Ne=class{constructor(i,t){this.i=i;this.To=t;this.Ht=new Set;this.fr=this.i.sub("*lazyPlugins",e=>{this.vo(e??[]);});}vo(i){for(let r of this.Ht)r();if(this.Ht.clear(),i.length===0)return;let t=new Set([T("plugins")]);for(let r of i)for(let o of r.configDeps)t.add(T(o));let e=()=>this.mr(i);for(let r of t)this.Ht.add(this.i.sub(r,e,false));this.mr(i);}mr(i){this.ui?.abort();let t=new AbortController;this.ui=t;let e=n=>this.i.read(T(n)),r=e("plugins"),o=Ro({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.To(o);}destroy(){this.fr();for(let i of this.Ht)i();this.Ht.clear(),this.ui?.abort();}};function O(s,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>s(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var _e=class{constructor(){this.Tt=new Map;}register(i,t){if(this.Tt.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.Tt.set(t.name,e);}unregister(i){this.Tt.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.Tt)e.pluginId===i&&this.Tt.delete(t);}get(i){return this.Tt.get(i)}getAll(){return new Map(this.Tt)}};var De=class{constructor(i=()=>{}){this.Bt=[];this.Gt=[];this.we=[];this.Ce=[];this.xe=[];this.Ee=[];this.config=new _e;this.Z=O(i,0);}destroy(){this.Z.cancel();}Nt(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.Bt.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Bt.push(this.Nt(i,t)),this.Z();}addActivity(i,t){let e=this.Gt.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Gt.push(this.Nt(i,t)),this.Z();}addFileAction(i,t){this.we.push(this.Nt(i,t)),this.Z();}addFileHook(i,t){this.Ce.push(this.Nt(i,{timeout:3e4,...t})),this.Z();}addIcon(i,t){this.xe.push(this.Nt(i,t)),this.Z();}addL10n(i,t){this.Ee.push(this.Nt(i,t)),this.Z();}addConfig(i,t){this.config.register(i,t),this.Z();}purge(i){this.Bt=this.Bt.filter(t=>t.pluginId!==i),this.Gt=this.Gt.filter(t=>t.pluginId!==i),this.we=this.we.filter(t=>t.pluginId!==i),this.Ce=this.Ce.filter(t=>t.pluginId!==i),this.xe=this.xe.filter(t=>t.pluginId!==i),this.Ee=this.Ee.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.Bt],activities:[...this.Gt],fileActions:[...this.we],fileHooks:[...this.Ce],icons:[...this.xe],l10n:[...this.Ee]}}};var Fe=class extends ${constructor(t){super(t);this.wt=new Map;this.v=new Set;this.pi=Promise.resolve();this.registry=new De(()=>this.Se());this.gr=new Ne(this.i,e=>{this.pi=this.pi.then(()=>e).then(r=>{if(r)return this.wo(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.pi}onPluginsChange(t){return this.v.add(t),()=>{this.v.delete(t);}}async wo(t){let e=new Set(this.wt.keys()),r=new Set;for(let o of t){if(!o.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(o.id)){console.warn(`[PluginManager] Plugin "${o.id}" is already in the list, skipping duplicate`);continue}if(r.add(o.id),!this.wt.has(o.id))try{await this.Co(o);}catch(n){this.registry.purge(o.id),this.Se(),console.error(`[PluginManager] Plugin "${o.id}" setup() threw an error`,n);}e.delete(o.id);}for(let o of e)this.di(o);}async Co(t){this.wt.has(t.id)&&this.di(t.id);let e=[],r=Nr(this.registry,this.i,this.s,t.id,e),o=this.s.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:o})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.Y("Failed to unsubscribe config listener",c);}throw a}this.wt.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.Se();}di(t){let e=this.wt.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(o){this.Y("Failed to unsubscribe config listener",o);}e.dispose?.(),this.wt.delete(t),this.Se();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let o=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:o,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:o}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}o!==e&&(t.setValue("file",o),t.setValue("fileSize",o.size),t.setValue("mimeType",o.type||null),t.setValue("isImage",Ur(o)),o instanceof File&&t.setValue("fileName",o.name));}destroy(){for(let t of Array.from(this.wt.keys()))this.di(t);this.registry.destroy(),this.gr.destroy(),super.destroy();}Se(){for(let t of this.v)try{t();}catch{}}};function Mo(s){return s.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Pi(s){return Array.isArray(s)?s.map(i=>typeof i=="object"&&i!==null?Pi(i):i):typeof s!="object"||s===null?s:Object.fromEntries(Object.entries(s).map(([i,t])=>{let e=Mo(i);return typeof t=="object"&&t!==null?[e,Pi(t)]:[e,t]}))}function Lo(s){return {ok:true,value:s}}function Oi(s){return {ok:false,error:s}}var Io="https://tlm.uploadcare.com/api/",Ri=class{constructor(i=Io){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Oi(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let o=await r.json();return Lo(o)}catch(o){return Oi(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(r){return Oi(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(Pi(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},$o=async(s,i)=>({success:true,data:i}),Uo=async s=>$o(void 0,s),Ke=class extends Ri{constructor(){super();}async sendEvent(i,t){let e=await Uo(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 No=20,st=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ot=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"}),Ve=class extends ${constructor(){super(...arguments);this.qt=new Map;this.ke=new Set;this.E=new Map;}bindTarget(t){return this.ke.add(t),()=>{this.ke.delete(t);}}on(t,e){let r=this.E.get(t);return r||(r=new Set,this.E.set(t,r)),r.add(e),()=>this.E.get(t)?.delete(e)}yr(t,e){for(let o of this.ke)o.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.E.get(t);if(r)for(let o of r)o(e);this.Y?.(()=>{let o=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,o]});}emit(t,e,r={}){let{debounce:o}=r;if(typeof o!="number"&&!o){this.yr(t,typeof e=="function"?e():e);return}this.qt.has(t)&&window.clearTimeout(this.qt.get(t));let n=typeof o=="number"?o:No,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.yr(t,l),this.qt.delete(t);}catch(l){this.Y?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.qt.set(t,a);}destroy(){for(let t of this.qt.values())window.clearTimeout(t);this.ke.clear(),this.E.clear();}};var _r="1.32.0-alpha.2";var It="blocks",$t=_r;var ut=class s{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():s.generateFastUid()}};var ze=class extends ${constructor(t){super(t);this.xo=ut.generateRandomUUID();this.$t=structuredClone(I);this.hi=false;this.fi=null;this.mi=false;this.br=new Ke,this.vr=new Se(10),this.addSub(this.i.sub(T("qualityInsights"),e=>{this.mi=!!e;}));for(let e of Object.keys(this.$t))this.addSub(this.i.sub(T(e),r=>{this.mi&&(this.hi&&this.$t[e]!==r&&this.sendEvent({eventType:st.CHANGE_CONFIG}),this.Eo(e,r));}));}So(t){t===st.INIT_SOLUTION&&!this.hi&&(this.hi=true);}Eo(t,e){this.$t[t]!==e&&(this.$t[t]=e);}ko(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===st.INIT_SOLUTION||t.eventType===st.CHANGE_CONFIG)&&(r.config=this.$t),{...r,appVersion:$t,appName:It,sessionId:this.xo,component:this.Ao,activity:this.Po,projectPubkey:this.$t.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Oo,payload:{location:this.Ro,...e}}}Mo(t){return !!(t&&[ot.CHANGE,ot.COMMON_UPLOAD_PROGRESS,ot.FILE_ADDED,ot.FILE_REMOVED,ot.FILE_UPLOAD_START,ot.FILE_UPLOAD_PROGRESS,ot.FILE_UPLOAD_SUCCESS,ot.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.mi)return;let e=this.ko({eventType:t.eventType,payload:t.payload,config:t.config});this.So(t.eventType),!(this.Mo(t.eventType)||this.fi&&this.Tr(this.fi,e))&&this.vr.add(async()=>{this.fi=e,await this.br.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:st.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:st.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Tr(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return false;for(let n of r)if(!Object.hasOwn(e,n)||!this.Tr(t[n],e[n]))return false;return true}get Oo(){return Date.now()}get Ao(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get Po(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get Ro(){return location.origin}};var G=[],dt=0,je=4,Dr=s=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let o=dt+je;o<G.length;)G[o]===e?G.splice(o,je):o+=je;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let o=!G.length;for(let n of i)G.push(n,t.value,e,r);if(o){for(dt=0;dt<G.length;dt+=je)G[dt](G[dt+1],G[dt+2],G[dt+3]);G.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:s};return t};function He(s,i,t){let e=new Set(i).add(void 0);return s.listen((r,o,n)=>{e.has(n)&&t(r,o,n);})}function Mi(s,i,t){let e=He(s,i,t);return t(s.value),e}var Li=(s={})=>{let i=Dr(s);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i};var At=class s{static{this.Wt=new Map;}constructor(i,t){this.wr=i,this.W=t;}get id(){return this.wr}pub(i,t){i in this.W.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.W.setKey(i,t);}sub(i,t,e=true){return (e?Mi:He)(this.W,[i],o=>{t(o[i]);})}read(i){return i in this.W.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.W.get()[i]}add(i,t,e=false){(!(i in this.W.get())||e)&&this.W.setKey(i,t);}has(i){return i in this.W.get()}get store(){return this.W.get()}static registerCtx(i,t){if(s.Wt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Li(i);return s.Wt.set(t,e),new s(t,e)}static deleteCtx(i){s.Wt.delete(i);}static getCtx(i){let t=s.Wt.get(i);return t?new s(i,t):null}static hasCtx(i){return s.Wt.has(i)}};var Fr=s=>{let i=new Intl.Locale(s),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var Fo=s=>s;var Kr="plural:";function Be(s,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:o=Fo}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);s=s.replaceAll(e+n+r,c);}return s}function Vr(s){let i=[],t=s.indexOf("{{");for(;t!==-1;){let e=s.indexOf("}}",t);if(e===-1)break;let r=s.substring(t+2,e);if(r.startsWith(Kr)){let o=s.substring(t+2,e).replace(Kr,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=s.indexOf("{{",e);}return i}var zr="--uploadcare-blocks-window-height",re=class s{static{this.clientsRegistry=new Set;}static{this.flush=O(()=>{document.documentElement.style.setProperty(zr,`${window.innerHeight}px`);},100);}static registerClient(i){s.clientsRegistry.size===0&&s.attachTracker(),s.clientsRegistry.add(i);}static unregisterClient(i){s.clientsRegistry.delete(i),s.clientsRegistry.size===0&&s.detachTracker();}static attachTracker(){window.addEventListener("resize",s.flush,{passive:true,capture:true}),s.flush();}static detachTracker(){window.removeEventListener("resize",s.flush,{capture:true}),document.documentElement.style.removeProperty(zr);}};var Ko=/\\([0-9a-fA-F]{1,6} ?)/g;function Vo(s){return s.length<2?false:(s[0]==='"'||s[0]==="'")&&(s[s.length-1]==='"'||s[s.length-1]==="'")}function zo(s){let i=s;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function jo(s){let i="",t="";for(let e=0;e<s.length;e++){let r=s[e+1];s[e]==="\\"&&r==='"'?(i+='\\"',e++):s[e]==='"'&&t!=="\\"?i+='\\"':i+=s[e],t=s[e]??"";}return i}function jr(s){let i=s;Vo(s)&&(i=zo(i),i=i.replace(Ko,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=jo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Hr(s){class i extends s{constructor(){super(...arguments);this.Cr=null;this.gi=null;}getCssData(r,o=false){let n=this.Cr??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.gi||(this.gi=window.getComputedStyle(this));let a=this.gi.getPropertyValue(r).trim();try{n[r]=jr(a);}catch(l){o||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.Cr=n,n[r]}}return i}function Br(s){class i extends s{constructor(){super(...arguments);this.willYield=true;this.Ct={};this.xt=null;this.Ae=false;}createRenderRoot(){return this}connectedCallback(){this.xt||(this.xt=Array.from(this.childNodes)),super.connectedCallback();}Lo(){if(this.Ae)return;this.Ae=true,this.Ct={};let r=Array.from(this.childNodes),o=r.length?r:this.xt??[];for(let n of o){let a=this.xr(n),l=this.Ct[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Ct[a]=l;}this.xt=null;}xr(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.xr(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Io(r){return !r.textContent||!r.textContent.trim()}Uo(r){let o=this.Ct[r];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Io(n))}update(r){!this.hasUpdated&&this.willYield&&this.Lo(),super.update(r);}yield(r,o){if(r===""&&!this.Ct[r]&&!this.Ae&&this.xt?.length){let a=[];for(let l of this.xt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Ct[r]=a,this.Ae=true,this.xt=null;}let n=this.Ct[r];return g` ${n} ${this.Uo(r)?o:void 0} `}}return i}var Gr=(s,i)=>new Intl.PluralRules(s).select(i);var Ho=s=>(i,t)=>{let e=s(),r=e("locale-id")||"en",o=Gr(r,t);return e(`${i}__${o}`)},qr=s=>{let i=Ho(()=>t),t=(e,r={})=>{if(!e)return "";let n=s().read(rt(e))||e,a=Vr(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return Be(n,r)};return t};function Wr(s){class i extends s{static reg(e){let r=this,o=window.customElements.get(e);if(o){o!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}var pt=class extends Event{constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var Ut=class{constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(o,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.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 pt(this.context,this.host,this.t,this.subscribe));}};var Ge=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Ii=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Nt=class extends Ge{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let o=r.contextTarget??r.composedPath()[0];o!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,o,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let o=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)o.has(n)||(o.add(n),a.dispatchEvent(new pt(this.context,a,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Ii(this.context,this.host));}};var Xr="ctx-name-context";function Yr(){return function(s){class i extends s{constructor(...r){super(...r);this.S=null;this.Xt=false;this.yi=false;this.bi=void 0;this._t=new Map;this.Yt=new Set;this.init$={};this.ctxOwner=false;this.Pe=void 0;this.Oe=false;this.ctxName=this.tt;this.et=false;this.Pe=this.getAttribute("ctx-name")||void 0,this.ctxName=this.tt,this.No=new Ut(this,{context:Xr,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.kr=o,this.Sr();},subscribe:true});}static set template(r){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Er(){return this.Pe}set Er(r){let o=r??void 0;this.Pe!==o&&(this.Pe=o,this.Sr());}shouldUpdate(r){return this.et?super.shouldUpdate(r):false}get tt(){return this.Er||this.kr||void 0}Sr(){if(this.ctxName=this.tt,!(!this.ctxName||this.Xt)){if(this.isConnected){this.vi();return}this.Oe=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.tt,this.ctxName&&(this.bi?this.bi.setValue(this.ctxName):this.bi=new Nt(this,{context:Xr,initialValue:this.ctxName}));}Ar(){if(!(!this.S||this._t.size===0)){for(let[r,{value:o,rewrite:n}]of this._t)this.S.add(r,o,n);this._t.clear();}}Pr(){return !this.S&&this.tt&&this.Ti(),this.S&&this.Ar(),this.S}Re(){let r=this.Pr();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Ti(){let r=this.init$,o=this.tt;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.S){this.S=At.getCtx(o)??At.registerCtx(r,o);for(let[n,a]of Object.entries(this.init$))this.S.add(n,a,this.ctxOwner);this.Ar();}}get $(){return this.tt&&this.Ti(),new Proxy({},{get:(r,o)=>{if(typeof o=="string")return this.S?.read(o)},set:(r,o,n)=>(typeof o!="string"||this.S?.pub(o,n),true)})}sub(r,o,n=true){let a=this.Re().sub(r,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Yt.delete(d));};return this.Yt.add(d),d}pub(r,o){this.Re().pub(r,o);}set$(r){for(let[o,n]of Object.entries(r))this.pub(o,n);}get sharedCtx(){return this.Re()}has(r){return this.S?.has(r)??false}add(r,o,n=false){let a=this.Pr();if(!a){if(!n&&this._t.has(r))return;this._t.set(r,{value:o,rewrite:n});return}this._t.delete(r),a.add(r,o,n);}add$(r,o=false){for(let[n,a]of Object.entries(r))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this.Xt?this.et&&this.yi&&(this.yi=false,this.initCallback()):this.ctxName?(this.Oe=false,this.vi()):this.Oe&&this.tt&&(this.Oe=false,this.vi());}vi(){if(this.Xt)return;this.Xt=true,this.Ti();let r=this.init$;if(Object.keys(r).length>0){let o=this.Re();for(let[n,a]of Object.entries(r))o.read(n)===void 0&&o.pub(n,a),this.sub(n,O(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.et=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.$o(),super.disconnectedCallback(),this.Xt&&(this.yi=true);}$o(){if(this.Yt.size!==0){for(let r of [...this.Yt])r();this.Yt.clear();}}initCallback(){}}return p([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Er",1),p([y()],i.prototype,"kr",2),p([y()],i.prototype,"ctxName",2),p([y()],i.prototype,"et",2),i}}var Go=s=>s.tagName?.includes("-")??false,qe=class{constructor(i){this.Et=new Set;this.Me=new Map;this.Or=false;this.St=i,this.St.addController(this);}hostDisconnected(){this.Le?.(),this.Le=void 0,this.Et.clear(),this.Me.clear();}hostUpdated(){if(!this.Le&&this.St.has(T("testMode"))){let i=this.St.subConfigValue("testMode",t=>{this.Or=!!t,this.Rr();});this.Le=i;}this._o(),this.Rr();}_o(){let i=this.St,t=i.renderRoot??i;if(!t)return;let e=this.St,r=e.tagName?.toLowerCase(),o=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Go(n));for(let n of o)if(!(r&&n.closest(r)!==e)&&!this.Et.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.Et.add(n),this.Me.set(n,a);}for(let n of Array.from(this.Et))(!n.isConnected||r&&n.closest(r)!==e)&&(this.Et.delete(n),this.Me.delete(n));}Rr(){if(!this.Et.size)return;let i=this.St.testId||"";for(let t of this.Et){let e=this.Me.get(t);e&&(this.Or?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var qo=Wr(Yr()(Hr(Br(at)))),C=class extends qo{constructor(){super();this.init$=fr();this.l10n=qr(()=>this.sharedCtx);this.debugPrint=Re(()=>this.sharedCtx,this.constructor.name);this.s=Er(()=>this.sharedCtx);new qe(this);}static{this.styleAttrs=[];}emit(t,e,r){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.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(),re.registerClient(this);}initCallback(){this.Q("*blocksRegistry",()=>new Set),this.Q("*pluginManager",t=>new Fe(t)),this.Q("*eventEmitter",t=>new Ve(t)),this.Q("*localeManager",t=>new $e(t)),this.Q("*modalManager",t=>new Ue(t)),this.Q("*a11y",()=>new Ie),this.Q("*routerLayer",t=>new Le(t)),this.Q("*clipboard",t=>new Me(t)),this.Q("*telemetryManager",t=>new ze(t)),this.sub(rt("locale-id"),t=>{let e=Fr(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.ot("*modalManager",false)}get telemetryManager(){return this.ot("*telemetryManager")}get localeManager(){return this.ot("*localeManager")}get a11y(){return this.ot("*a11y")}get clipboardLayer(){return this.ot("*clipboard")}get routerLayer(){return this.ot("*routerLayer")}get blocksRegistry(){return this.ot("*blocksRegistry")}get eventEmitter(){return this.ot("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),re.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Do(),At.deleteCtx(this.ctxName);}Mr(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Q(t,e){let r=this.Mr();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.s);this.add(t,o,true),r.set(t,o);return}}Do(){let t=this.Mr();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}ot(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:Oe(t),cdnUrlModifiers:vi(t),fileName:Ae(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?Be(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.bt){let t={};this.bt=new Proxy(t,{set:(e,r,o)=>{if(typeof r!="string"||!(r in I))return false;let n=r,a=T(n);return this.has(a)||this.add(a,I[n]),this.$[a]=o,true},get:(e,r)=>{let o=T(r);return this.has(o)||this.add(o,I[r]),this.$[o]}});}return this.bt}subConfigValue(t,e){let r=T(t);return this.has(r)||this.add(r,I[t]),this.sub(r,e)}};var ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Zr(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function K(...s){let i=Zr(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Qr(s,...i){let t=Zr(...i);for(let e of Object.keys(t))s.classList.toggle(e,!!t[e]);}var se=["free"],Jr=s=>{let i=Jt(s);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let o=r.indexOf(":");if(o===-1&&!se.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,o)),a=Number(r.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!se.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:ut.generateFastUid(),type:"aspect-ratio",width:se.includes(r)?0:n,height:se.includes(r)?0:a,hasFreeform:se.includes(r)});}return t},ts=(s,i,t,e=.1)=>{let r=s/i,o=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return o};var Wo=s=>N.includes(s),es=s=>{if(!s)return N;let i=St(s).filter(Wo);return i.length===0?N:i};function is(s){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":N,"*tabId":A.CROP,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=ht,t.src=e;}s.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=J(ct(i),"preview"),r=tt(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),s.remove();},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var rs="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Ot={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},oe=class extends C{constructor(){super(...arguments);this.Dt=false;this.Lr=Ot;this.Ir=Ot.visible;this.Ur=Ot.hidden;this.wi=false;this.Nr=false;}set visible(t){this.Dt=t,this.$r();}get visible(){return this.Dt}set styles(t){this.Lr=t,this.wi=true,this.Ir=t.visible??Ot.visible,this.Ur=t.hidden??Ot.hidden;}get styles(){return this.Lr}$r(){this.style.visibility=this.Dt?"inherit":"hidden",Qr(this,{[Ot.transition]:!this.wi,[this.Ir]:this.Dt,[this.Ur]:!this.Dt}),this.toggleAttribute("inert",!this.Dt);}Fo(){this.Nr||(this.Nr=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.wi||this.classList.add(Ot.transition),this.$r(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Fo();},0);}};p([b({type:Boolean})],oe.prototype,"visible",1),p([b({attribute:false})],oe.prototype,"styles",1);var We=class extends C{constructor(){super(...arguments);this.active=false;this.Ie=E();this.Ci=false;this.xi=()=>{let t=this.Ie.value;t&&(this._r(t),this.Ci&&this.active&&this.Ei());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Ei();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Ei():this.Ko());}Ei(){let t=this.Ie.value;if(!t)return;this.Ci=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.xi),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.xi,{once:true});}Ko(){let t=this.Ie.value;t&&(this.Ci=false,t.removeEventListener("transitionend",this.xi),this._r(t));}_r(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return g`<div class="uc-inner"><div class="uc-line" ${k(this.Ie)}></div></div>`}};p([b({type:Boolean,reflect:true})],We.prototype,"active",2);var ft=H(class extends W{constructor(s){if(super(s),s.type!==lt.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return " "+Object.keys(s).filter(i=>s[i]).join(" ")+" "}update(s,[i]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.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=s.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 F}});var P=s=>s??w;var _t=class extends C{constructor(){super(...arguments);this.name="";this.Ue="";this.Zt=null;this.Dr=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Dr=e,this.ki();});let t=this.s.pluginManager;t?.onPluginsChange&&(this.Si=t.onPluginsChange(()=>this.ki()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.ki();}ki(){if(!this.name){this.Ue="",this.Zt=null;return}let e=this.s.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.Zt=e.svg,this.Ue="";return}this.Zt=null;let r=`#uc-icon-${this.name}`,o=this.Dr?.(this.name);this.Ue=o??r;}render(){return this.Zt?g`${this.yield("",g`${Ee(this.Zt)}`)}`:g` ${this.yield("",g`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Ue}></use></svg>`)} `}disconnectedCallback(){this.Si?.(),this.Si=void 0,super.disconnectedCallback();}};p([b({type:String})],_t.prototype,"name",2),p([y()],_t.prototype,"Ue",2),p([y()],_t.prototype,"Zt",2);var q=class extends C{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.Fr(),this.Kr();}updated(t){super.updated(t),t.has("reverse")&&this.Fr(),t.has("theme")&&this.Kr();}Fr(){this.style.flexDirection=this.reverse?"row-reverse":"";}Kr(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Vo(){let t=this.Ai;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.zo}}get Ai(){return !this.icon}get zo(){return !this.text&&!this.Ai}render(){return g`<button type="button" role=${P(this.ariaRole||void 0)} aria-controls=${P(this.ariaControls||void 0)} aria-label=${P(this.l10n(this.titleProp))} title=${P(this.l10n(this.titleProp))} ><uc-icon class=${ft(this.Vo)} name=${P(this.icon||void 0)} ?hidden=${this.Ai} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([b({type:String})],q.prototype,"text",2),p([b({type:String})],q.prototype,"icon",2),p([b({type:Boolean,reflect:true})],q.prototype,"reverse",2),p([b({type:String,reflect:true})],q.prototype,"theme",2),p([b({attribute:"aria-role"})],q.prototype,"ariaRole",2),p([b({attribute:"aria-controls"})],q.prototype,"ariaControls",2),p([b({attribute:"title-prop"})],q.prototype,"titleProp",2),p([b({type:Boolean,noAccessor:true})],q.prototype,"active",2);function ne(s){let i=new Image;return {promise:new Promise((r,o)=>{i.src=s,i.onload=()=>r(),i.onerror=n=>o(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=ht);}}}function ae(s){let i=[];for(let o of s){let n=ne(o);i.push(n);}let t=i.map(o=>o.image);return {promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:()=>{i.forEach(o=>{o.cancel();});}}}var ss=(s,i)=>{let t=false,e,r=0,o=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),o};var le=33.333333333333336,v=1,$i=24,os=6;function mt(s,i){for(let[t,e]of Object.entries(i))s.setAttributeNS(null,t,e.toString());}function V(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return mt(t,i),t}function ns(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*o+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*o+1.5*c,r+l*n+1.5*d],f=[e+a*o-24*t*c+1.5*c,r+l*n+1.5*d],m=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,R=[h[0],h[1]];return {d:m,center:R}}function as(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,m;a?(f=[e+c*o-34*t/2,r+d*n+1.5*h],m=[e+c*o+34*t/2,r+d*n+1.5*h]):(f=[e+c*o+1.5*u,r+d*n-34*t/2],m=[e+c*o+1.5*u,r+d*n+34*t/2]);let R=`M ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,M=[(f[0]+m[0])/2,(f[1]+m[1])/2];return {d:R,center:M}}function ls(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}function cs({rect:s,delta:[i,t],imageBox:e}){return Ft({...s,x:s.x+i,y:s.y+t},e)}function Ft(s,i){let{x:t}=s,{y:e}=s;return s.x<i.x?t=i.x:s.x+s.width>i.x+i.width&&(t=i.x+i.width-s.width),s.y<i.y?e=i.y:s.y+s.height>i.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}function Xo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;o+=r,a-=r,t&&(n=a*t);let l=s.x+s.width/2-n/2;return o<=e.y&&(o=e.y,a=s.y+s.height-o,t&&(n=a*t,l=s.x+s.width/2-n/2)),l<=e.x&&(l=e.x,o=s.y+s.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=s.y+s.height-a),a<v&&(a=v,t&&(n=a*t,l=s.x+s.width/2-n/2),o=s.y+s.height-a),n<v&&(n=v,t&&(a=n/t,l=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:l,y:o,width:n,height:a}}function Yo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;o+=r,n-=r,t&&(a=n/t);let l=s.y+s.height/2-a/2;return o<=e.x&&(o=e.x,n=s.x+s.width-o,t&&(a=n/t,l=s.y+s.height/2-a/2)),l<=e.y&&(l=e.y,o=s.x+s.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=s.x+s.width-n),a<v&&(a=v,t&&(n=a*t),l=s.y+s.height/2-a/2,o=s.x+s.width-n),n<v&&(n=v,t&&(a=n/t),l=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:l,width:n,height:a}}function Zo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;a+=r,t&&(n=a*t);let l=s.x+s.width/2-n/2;return o+a>=e.y+e.height&&(a=e.y+e.height-o,t&&(n=a*t),l=s.x+s.width/2-n/2),l<=e.x&&(l=e.x,o=s.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=s.y),a<v&&(a=v,t&&(n=a*t),l=s.x+s.width/2-n/2),n<v&&(n=v,t&&(a=n/t),l=s.x+s.width/2-n/2),{x:l,y:o,width:n,height:a}}function Qo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;n+=r,t&&(a=n/t);let l=s.y+s.height/2-a/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(a=n/t),l=s.y+s.height/2-a/2),l<=e.y&&(l=e.y,o=s.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=s.x),a<v&&(a=v,t&&(n=a*t),l=s.y+s.height/2-a/2),n<v&&(n=v,t&&(a=n/t),l=s.y+s.height/2-a/2),{x:o,y:l,width:n,height:a}}function Jo({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+r<e.x&&(r=e.x-n),a+o<e.y&&(o=e.y-a),n+=r,l-=r,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=s.x+s.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=s.y+s.height-c)),c<v&&(c=v,t&&(l=c*t),n=s.x+s.width-l,a=s.y+s.height-c),l<v&&(l=v,t&&(c=l/t),n=s.x+s.width-l,a=s.y+s.height-c),{x:n,y:a,width:l,height:c}}function tn({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+o<e.y&&(o=e.y-a),l+=r,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=s.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=s.y+s.height-c)),c<v&&(c=v,t&&(l=c*t),a=s.y+s.height-c),l<v&&(l=v,t&&(c=l/t),a=s.y+s.height-c),{x:n,y:a,width:l,height:c}}function en({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+r<e.x&&(r=e.x-n),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),n+=r,l-=r,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=s.x+s.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=s.y)),c<v&&(c=v,t&&(l=c*t),n=s.x+s.width-l),l<v&&(l=v,t&&(c=l/t),n=s.x+s.width-l),{x:n,y:a,width:l,height:c}}function rn({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:l,height:c}=s;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),l+=r,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=s.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=s.y)),c<v&&(c=v,t&&(l=c*t)),l<v&&(l=v,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function us({direction:s,...i}){switch(s){case "n":return Xo(i);case "w":return Yo(i);case "s":return Zo(i);case "e":return Qo(i);case "nw":return Jo(i);case "ne":return tn(i);case "sw":return en(i);case "se":return rn(i);default:return i.rect}}function ds(s,[i,t]){return s.x<=i&&i<=s.x+s.width&&s.y<=t&&t<=s.y+s.height}function ps(s,i){return s.x>=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}function hs(s,i){return Math.abs(s.width/s.height-i)<.1}function Kt({width:s,height:i},t){let e=t/90%2!==0;return {width:e?i:s,height:e?s:i}}function Vt(s){return {x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}function gt(s,i,t){return Math.min(Math.max(s,i),t)}function fs(s,i){let t={};for(let e of i){let r=s[e];(Object.hasOwn(s,e)||r!==void 0)&&(t[e]=r);}return t}function zt(s,i,t){let r=window.devicePixelRatio,o=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return tt(s,J(Pe,ct(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${It}/${$t}/uc-cloud-image-editor/`))}var Ye=class extends C{constructor(){super(...arguments);this.Vr=`uc-backdrop-mask-${ut.generateFastUid()}`;this.$e=false;this.ee=false;this.Hr=E();this.ie=false;this.re=null;this.Gr=t=>{this.qr(),this.se&&(t.stopPropagation(),t.preventDefault(),this.se=false);};this.Wr=t=>{if(!this.se||!this.Ne||!this.Oi)return;t.stopPropagation(),t.preventDefault();let e=this.at;if(!e)return;let{x:r,y:o}=e.getBoundingClientRect(),n=t.x-r,a=t.y-o,l=n-this.Ne[0],c=a-this.Ne[1],{direction:d}=this.Oi,u=this.Zo(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.Xr=t=>{if(!this.J)return;let e=Object.values(this.J).find(r=>{if(!r||this.Mi(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return ds(a,[t.x,t.y])});this.zr=e,this.qr();};}get at(){return this.Hr.value??null}get se(){return this.ee}set se(t){this.ee!==t&&(this.ee=t,this.Ri());}Ri(){this.Jt&&this.Jt.setAttribute("class",K({"uc-guides--hidden":this.$e,"uc-guides--visible":!this.$e&&this.ee,"uc-guides--semi-hidden":!this.$e&&!this.ee}));}Mi(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=v&&e.width<=v)return true;let r=e.height<=v&&(t.includes("n")||t.includes("s")),o=e.width<=v&&(t.includes("e")||t.includes("w"));return r||o}jo(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:o,height:n}=t,a=this.at;if(!a)return;let l=V("mask",{id:this.Vr}),c=V("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=V("rect",{x:e,y:r,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=V("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Vr})`});a.appendChild(u),a.appendChild(l),this.Qt=l,this.Pi=d;}Ho(){this.Qt&&(this.Qt.style.display="none",window.requestAnimationFrame(()=>{this.Qt&&(this.Qt.style.display="block");}));}Bo(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:o,height:n}=t;this.Pi&&mt(this.Pi,{x:e,y:r,width:o,height:n});}Go(){let t=this.$["*cropBox"];if(!(!t||!this.Jt||!this.J)){for(let e of Object.values(this.J)){if(!e)continue;let{direction:r,pathNode:o,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:f}=t;if(l)mt(n,{x:d,y:u,width:h,height:f});else {let R=gt(Math.min(h,f)/82/2,0,1),M=c?ns(t,r,R):as(t,r,R),L=M.center;if(!L)continue;let bt=Math.max($i*gt(Math.min(h,f)/$i/3,0,1),os);mt(n,{x:L[0]-bt,y:L[1]-bt,width:bt*2,height:bt*2}),mt(o,{d:M.d});}let m=this.Mi(r);a.setAttribute("class",K("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}));}mt(this.Jt,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Br(t,e){let r=V("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let o=V("rect",{fill:"transparent"}),n=V("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(o),t[e]={direction:e,pathNode:n,interactionNode:o,groupNode:r},e===""&&(r.style.cursor="move"),o.addEventListener("pointerdown",this.qo.bind(this,e));}Wo(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let o=`${["n","","s"][e]}${["w","","e"][r]}`;o!==""&&this.Br(t,o);}return this.Br(t,""),t}Xo(){let t=V("svg"),e=V("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 o=V("line",{x1:`${le*r}%`,y1:"0%",x2:`${le*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}for(let r=1;r<=2;r++){let o=V("line",{x1:"0%",y1:`${le*r}%`,x2:"100%",y2:`${le*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Yo(){let t=this.at;if(!t)return;let e=document.createDocumentFragment(),r=this.Xo();e.appendChild(r);let o=this.Wo();for(let{groupNode:n}of Object.values(o))e.appendChild(n);t.appendChild(e),this.J=o,this.Jt=r,this.Ri();}qo(t,e){if(!this.J)return;let r=this.J[t];if(!r||this.Mi(t))return;let o=this.$["*cropBox"],n=this.at;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.se=true,this.Oi=r,this.Ne=[c,d],this.jr={...o};}Zo(t,e){let[r,o]=e,n=this.$["*imageBox"],a=this.jr??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=cs({rect:a,delta:[r,o],imageBox:n}):a=us({rect:a,delta:[r,o],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ft(Vt(a),n)}qr(){let t=this.zr,e=this.at;e&&(e.style.cursor=t?ls(t.direction):"initial");}Yr(t){if(this.te){this.te.setAttribute("href",t);return}let e=this.at;if(!e){this.re=t;return}this.re=null;let r=document.createDocumentFragment(),o=V("image",{href:t});o.setAttribute("class","uc-cloud-mask"),r.appendChild(o),e.appendChild(r),this.te=o;}Qo(){let t=this.$["*cropBox"];if(!t||!this.te)return;let{x:e,y:r,width:o,height:n}=t;mt(this.te,{x:e,y:r,height:n,width:o});}Li(){this.ie&&(this.Bo(),this.Go(),this.Qo());}toggleThumbs(t){if(this.J)for(let e of Object.values(this.J)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",K("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ho(),this.ie&&window.requestAnimationFrame(()=>{this.Li();});}),this.sub("*cropBox",t=>{t&&(this.$e=t.height<=v||t.width<=v,this.Ri(),this.ie&&window.requestAnimationFrame(()=>{this.Li();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Yr(t);}),document.addEventListener("pointermove",this.Wr,true),document.addEventListener("pointerup",this.Gr,true);}firstUpdated(t){super.firstUpdated(t),this.Jo();}Jo(){let t=this.at;if(!(!t||this.ie)){if(this.jo(),this.Yo(),this.ie=true,t.addEventListener("pointermove",this.Xr,true),this.re){let e=this.re;this.re=null,this.Yr(e);}this.Li();}}disconnectedCallback(){super.disconnectedCallback(),this.at?.removeEventListener("pointermove",this.Xr,true),document.removeEventListener("pointermove",this.Wr,true),document.removeEventListener("pointerup",this.Gr,true);}render(){return g`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${k(this.Hr)}></svg>`}};p([y()],Ye.prototype,"ee",2);function on(s){return s?[({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(s)):true}var Ze=class extends C{constructor(){super();this.ctxOwner=true;this.kt={width:0,height:0};this.i=null;this.g=false;this._=null;this.Qr=E();this.Ni=E();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.Zr=O(this.Jr.bind(this),300),this.Ii=ss(()=>{!this.isConnected||!this.g||(this.$i(),this.ts(),this.es(),this._i(),this.Di());},100);}firstUpdated(t){super.firstUpdated(t),this.$i();}ts(){let t=this.$["*editorTransformations"],e=fs(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}$i(){let t=this.Qr.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${o}px`,t.width=r*n,t.height=o*n,e?.scale(n,n),this.Ui=t,this.i=e;}es(){if(!this.g||!this._)return;let t=this._,e=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Kt({width:t.naturalWidth,height:t.naturalHeight},o),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,m=e+(n.height-e*2)/2-h/2;l={x:f,y:m,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,m=0+e;l={x:f,y:m,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Vt(l);}_i(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[m,R]}=n,{width:M}=Kt(this.kt,o),L=a/M;t=Ft(Vt({x:l+m*L,y:c+R*L,width:h*L,height:f*L}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!ps(t,e)||u&&!hs(t,u)){let h=e.width/e.height,f=e.width,m=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):m=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-m/2,width:f,height:m};}this.$["*cropBox"]=Ft(Vt(t),e);}tn(){let t=this.i;if(!t)return;let e=this._;if(!e)return;let r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Kt({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Di(){if(!this.g||!this._||!this.Ui||!this.i)return;let t=this.Ui;this.i.clearRect(0,0,t.width,t.height),this.tn();}en({fromViewer:t}){this._&&(this.Ni.value?.toggleThumbs(true),this.rn(),setTimeout(()=>{this.className=K({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}rs(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=e,{width:l,height:c}=Kt(this.kt,o),{width:d,height:u}=t,h=n/l,f=a/c;return [gt(Math.round(d/h),1,l),gt(Math.round(u/f),1,c)]}sn(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Kt(this.kt,o),{x:h,y:f}=t,m=n/d,R=a/u,M=this.rs(),L={dimensions:M,coords:[gt(Math.round((h-l)/m),0,d-M[0]),gt(Math.round((f-c)/R),0,u-M[1])]};if(!on(L)){console.error("Cropper is trying to create invalid crop object",{payload:L});return}if(!(M[0]===d&&M[1]===u))return L}Jr(){if(!this.isConnected||!this.kt)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:o}=t,n=this.sn(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:o};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.g&&(this.es(),this._i(),this.Di());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.g){this.g=true,await this.updateComplete,this.$i(),this.kt=t,this.removeEventListener("transitionend",this.ss);try{let r=this.$["*originalUrl"],o=this.$["*editorTransformations"];this._=await this.nn(r,o),this.ts(),this.Ii(),this.en({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.f=new ResizeObserver(r=>{let[o]=r;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this.g&&this._&&this.Ii();}),this.f.observe(this);}}deactivate({reset:t=false}={}){this.g&&(!t&&this.Jr(),this.g=false,this.an(),this.className=K({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ni.value?.toggleThumbs(false),this.addEventListener("transitionend",this.ss,{once:true}),this.f?.disconnect());}an(){let t=this.rs(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,o=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,o),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}rn(){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`;}ss(){this.g||(this._=null);}async nn(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(zt(t,r,e)),{promise:n,cancel:a,image:l}=ne(o),c=this.Ft(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.m?.(),this.m=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Ft(t){let e="crop",r=this.$["*loadingOperations"],o=r.get(e);return o||(o=new Map,r.set(e,o)),o.get(t)||(o.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.Di();}),this.sub("*cropBox",()=>{this._&&this.Zr();}),this.sub("*currentAspectRatio",()=>{this._i();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.g&&this.kt&&this.activate(this.kt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this._&&(this._=null);}render(){return g`<canvas class="uc-canvas" ${k(this.Qr)}></canvas><uc-crop-frame ${k(this.Ni)}></uc-crop-frame>`}};p([y()],Ze.prototype,"_",2);function Ui(s,i,t){let e=t,r=t-1,o=new Array(e);for(let n=r;n>=0;n-=1)o[n]=Math.ceil((n*i+(r-n)*s)/r);return o}function nn(s){return typeof s=="string"&&s in B}function an(s){let i=[];for(let t=0;t<s.length-1;t+=1){let e=s[t],r=s[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}function ln(s,i,t){let e=an(s).find(([n,a])=>n<=i&&i<=a);if(!e)return s.map(()=>0);let[r,o]=e;return s.map(n=>{let a=Math.abs(r-o)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:o===n?i>=t?l:1:0})}function cn(s,i){return s.map((t,e)=>t<i?s.length-e:e)}function ms(s,i){let t=B[s].keypointsNumber,{range:e,zero:r}=B[s];return [...new Set([...Ui(e[0],r,t+1),...Ui(r,e[1],t+1),r,i])].sort((o,n)=>o-n)}var Ni=class extends C{constructor(){super();this.g=false;this.Fi=true;this.r="initial";this.os={};this.ut=[];this.as=0;this.cs=E();this._e=E();this.classList.add("uc-inactive_to_cropper"),this.ls=O(async(t,e,r)=>{let o=()=>!this.us(t,e)||this.Ki!==r||!!this.ut.find(c=>c.value===r);if(o())return;let n=await this.ps(t,r),a=new Image;a.src=n.src;let l=this.Ft(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this.ut,d=c.findIndex(m=>m.value>r);d===-1&&(d=c.length);let h=c[d]?.image,f=this._e.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.ji(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Ft(t){let e=this.r,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let o=r.get(e);return o&&!o.get(t)&&(o.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}ds(){window.cancelAnimationFrame(this.as),this.as=window.requestAnimationFrame(()=>{for(let t of this.ut){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}At({url:t=this.ns,filter:e=this.c??void 0,operation:r,value:o}={}){if(!t)throw new Error("URL is not defined");let n={...this.os};r&&(r==="filter"?e&&typeof o=="number"&&(n.filter={name:e,amount:o}):typeof o=="number"&&(n[r]=o));let a=this.offsetWidth;return this.proxyUrl(zt(t,a,n))}async ps(t,e){return {src:await this.At({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}us(t,e){return this.r===t&&this.c===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!nn(this.r)||!Number.isFinite(e)||(this.ji(this.r,e),this.ls(this.r,this.c,e));}ji(t,e){this.r=t,this.Ki=e;let{zero:r}=B[t],o=this.ut.map(l=>l.value),n=ln(o,e,r),a=cn(o,r);this.ut.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.ds();}hs(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async ln(){this.n=this.n||this.hs();let t=this.n;t&&this.fs(t);let e=this.ut.map(c=>c.src),{images:r,promise:o,cancel:n}=ae(e);r.forEach(c=>{let d=this.Ft(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Vi=()=>{n(),this.Vi=void 0;};let a=this.r,l=this.c;if(await o,this.g&&this.us(a,l)){let c=this._e.value;if(!c)return;c.replaceChildren(),this.ut.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.ds();}}async setTransformations(t){if(this.os=t,this.n){let e=await this.At(),r=this.Ft(e);this.n.src=e,this.n.addEventListener("load",r,{once:true}),this.n.addEventListener("error",r,{once:true}),this.n.style.opacity="1",this.n.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:o}){if(!r||typeof o!="number")return;this.zi?.();let n=ms(r,o),a=await Promise.all(n.map(c=>this.At({url:t,filter:e,operation:r,value:c}))),{cancel:l}=ae(a);this.zi=l;}cn(t){let e=this.n||this.hs();if(this.fs(e),this.n=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=K({"uc-active_from_viewer":this.oe,"uc-active_from_cropper":!this.oe,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.Ft(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=K({"uc-active_from_viewer":this.oe,"uc-active_from_cropper":!this.oe,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:o,fromViewer:n}){if(this.g=true,this.Fi=false,await this.updateComplete,this.ns=t,this.r=e??"initial",this.Ki=r,this.c=o,this.oe=n,typeof r!="number"&&!o){let l=await this.At({operation:e,value:r});this.cn(l),this.Hi();return}!e||typeof r!="number"||(this.ut=await Promise.all(ms(e,r).map(l=>this.ps(e,l))),this.ji(e,r),this.ln());}deactivate({hide:t=true}={}){this.g=false,this.Vi?.(),this.zi?.(),t&&!this.Fi?(this.Fi=true,this.n&&(this.n.style.transform="scale(1)"),this.className=K({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Hi();},{once:true})):this.Hi();}fs(t){let e=this.cs.value;e&&(e.contains(t)||e.appendChild(t));}Hi(){this._e.value?.replaceChildren();}render(){return g`<div class="uc-fader-preview-host" ${k(this.cs)}></div><div class="uc-fader-layers-host" ${k(this._e)}></div>`}};var gs="important",un=" !"+gs,ce=H(class extends W{constructor(s){if(super(s),s.type!==lt.ATTRIBUTE||s.name!=="style"||s.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(s){return Object.keys(s).reduce((i,t)=>{let e=s[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(s,[i]){let{style:t}=s.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 o=typeof r=="string"&&r.endsWith(un);e.includes("-")||o?t.setProperty(e,o?r.slice(0,-11):r,o?gs:""):t[e]=r;}}return F}});var nt=class extends C{constructor(){super();this.Bi=0;this.De=E();this.gs=E();this.ys=E();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.pt=0;this.pn=t=>{t.stopPropagation();let e=this.bs(t);e!==null&&(this.Gi(e),this.un("slider-input",e));};this.dn=t=>{t.stopPropagation();let e=this.bs(t);e!==null&&this.Gi(e);};this.vs=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Ts=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}un(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Bi=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Cs(this.pt),this.qi(),this.f=new ResizeObserver(()=>{this.qi(),this.Fe(this.pt);}),this.f.observe(this);let e=this.De.value;e?.addEventListener("focus",this.vs),e?.addEventListener("blur",this.Ts),window.setTimeout(()=>{this.Fe(this.pt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.pt&&this.Gi(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.qi(),this.Fe(this.pt)),t.has("zero")&&this.hasUpdated&&this.xs(this.pt);}Fe(t){this.xs(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.Bi)/100;window.requestAnimationFrame(()=>{let l=this.gs.value;l&&(l.style.transform=`translateX(${a}px)`);});}xs(t){if(!this.ne)return;let e=this.max-this.min;if(e===0)return;this.ne.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.Bi)/100;window.requestAnimationFrame(()=>{this.ne&&(this.ne.style.transform=`translateX(${a}px)`);});}qi(){let e=this.ys.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this.ms===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.ne=d,e.innerHTML="",e.appendChild(a),this.ms=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.De.value;t?.removeEventListener("focus",this.vs),t?.removeEventListener("blur",this.Ts),this.f?.disconnect(),this.f=void 0;}Gi(t){Number.isFinite(t)&&(this.pt=t,this.hasUpdated&&(this.Cs(t),this.Fe(t)));}Cs(t){let e=this.De.value;e&&(e.value=String(t));}bs(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return g`<div class="uc-steps" ${k(this.ys)}></div><div class="uc-thumb" ${k(this.gs)}></div><input class="uc-input" type="range" ${k(this.De)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.pt)} ?disabled=${this.disabled} @input=${this.pn} @change=${this.dn} />`}};p([b({type:Boolean,reflect:true})],nt.prototype,"disabled",2),p([b({type:Number})],nt.prototype,"min",2),p([b({type:Number})],nt.prototype,"max",2),p([b({type:Number,attribute:false})],nt.prototype,"defaultValue",2),p([b({type:Number})],nt.prototype,"zero",2),p([y()],nt.prototype,"pt",2);var Y="original",Qe=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.hn=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.mn();let r=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];r&&o&&r.activate({url:o,operation:this.state.operation,value:this.state.filter===Y?void 0:this.state.value,filter:this.state.filter===Y?void 0:this.state.filter,fromViewer:false});}mn(){let t=this.state.operation,{range:e,zero:r}=B[t],[o,n]=e;this.state={...this.state,min:o,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Y?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return g`<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.hn} ></uc-slider-ui>`}};p([y()],Qe.prototype,"state",2);function jt(s){if(!s)return null;let i=s.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var _=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Es(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Es();}updated(t){super.updated(t),t.has("active")&&this.Es();}render(){let t=this.onClick,e=this.title;return g`<button role="option" type="button" aria-label=${P(this.titleProp)} title=${P(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y()],_.prototype,"active",2),p([y()],_.prototype,"title",2),p([y()],_.prototype,"icon",2),p([y()],_.prototype,"titleProp",2);var Je=12,ti=16,dn=s=>{let i=12,t=12;return s.width/s.height>=1?(i=Je,t=Math.round(Je*s.height/s.width)):(t=Je,i=Math.round(Je*s.width/s.height)),{width:i,height:t}},_i=class extends _{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.gn(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}gn(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 g`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${P(this.titleProp)} title=${P(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},ei=class extends _{constructor(){super(...arguments);this.w=null;}get aspectRatio(){return this.w}set aspectRatio(t){if(this.w===t)return;let e=this.w;this.w=t,this.requestUpdate("aspectRatio",e),t?this.Ss(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.w&&this.Ss(this.w),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.w?.id||t?.width===this.w?.width&&t?.height===this.w?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.w?.id&&(this.$["*currentAspectRatio"]=this.w);}Ss(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),o(),e||this.requestUpdate();}yn(){let t=this.w;if(!t||t.hasFreeform)return g`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=dn(t),o=(ti-e)/2,n=(ti-r)/2;return g`<uc-icon><svg viewBox="0 0 ${ti} ${ti}" aria-hidden="true" focusable="false" ><rect x=${o} 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 g`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${P(this.titleProp)} title=${P(this.titleProp)} @click=${t} >${this.yn()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([b({attribute:false})],ei.prototype,"aspectRatio",1);function pn(s){let i=s+90;return i=i>=360?0:i,i}function hn(s,i){if(s==="rotate")return pn(typeof i=="number"?i:0);if(s==="mirror"||s==="flip")return !i;throw new Error(`Unsupported operation: ${s}`)}var ii=class extends _{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),o=hn(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:o,prev:r}),e.setValue(this.operation,o);}};p([b({type:String})],ii.prototype,"operation",2);var yt=class extends _{constructor(){super(...arguments);this.r="";this.c="";this.ae="";this.Ke=0;this.n=null;this.Vt=false;this.isOriginal=false;this.ks=20;}get filter(){return this.c}set filter(t){let e=t??"";if(this.c===e)return;let r=this.c;this.c=e,this.r="filter",this.isOriginal=e===Y,this.icon=this.isOriginal?"original":"slider",this.ks=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.As(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.r,this.c),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.r,this.c),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:jt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.c;}bn(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.ks||32,r=window.devicePixelRatio,o=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.r]=this.c!==Y?{name:this.c,amount:a}:void 0,tt(this.ae,J(Pe,ct(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${It}/${$t}/uc-cloud-image-editor/`))}async vn(t,e){t[0]?.isIntersecting?await this.Wi(e):this.m?.();}initCallback(){super.initCallback(),this.f=new window.IntersectionObserver(this.vn.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.ae=t??"",this.sub("*originalUrl",e=>{this.ae=e??"",!this.isOriginal&&this.ae&&this.isConnected&&!this.n&&(this.f?.observe(this),this.Pt());}),this.isOriginal||(this.f?.observe(this),this.Pt()),this.c&&this.As(this.c),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.c);}),this.sub("*networkProblems",async e=>{e||(this.n?await this.Wi():this.Pt());});}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this.m?.(),this.Ve();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.f?.unobserve(this):(this.f?.observe(this),this.Pt()));}As(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Wi(t){if(!this.isConnected){t?.unobserve(this),this.m?.(),this.m=void 0;return}if(!this.ae){!this.Kt&&!this.dt&&this.Pt();return}let e=++this.Ke,r="";try{r=await this.proxyUrl(this.bn());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Vt=false,this.m?.();let{promise:o,cancel:n}=ne(r);this.m=()=>{n(),this.Ke===e&&(this.m=void 0);};try{if(await o,this.Ke!==e||!this.isConnected)return;this.n=r,this.Vt=!0,this.Ve(),(t??this.f)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.Pt();}finally{this.Ke===e&&(this.m=void 0);}}Pt(){if(!this.isConnected||this.n||this.Vt||this.isOriginal||this.$["*networkProblems"]){this.Ve();return}this.dt&&cancelAnimationFrame(this.dt),this.dt=requestAnimationFrame(()=>{if(this.dt=void 0,!this.isConnected||this.n||this.Vt||this.isOriginal){this.Ve();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<o&&t.left<r){this.Wi();return}this.Kt=window.setTimeout(()=>{this.Kt=void 0,this.Pt();},500);});}Ve(){this.dt&&(cancelAnimationFrame(this.dt),this.dt=void 0),this.Kt&&(window.clearTimeout(this.Kt),this.Kt=void 0);}get Tn(){return !!(this.Vt&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Tn?"1":"0"};this.n&&(e.backgroundImage=`url(${this.n})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return g`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${P(this.titleProp)} title=${P(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Vt} style=${ce(e)}></div><uc-icon class=${ft({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ce(r)} ></uc-icon></button>`}};p([y()],yt.prototype,"n",2),p([y()],yt.prototype,"Vt",2),p([y()],yt.prototype,"isOriginal",2),p([y()],yt.prototype,"ks",2),p([b({type:String})],yt.prototype,"filter",1);var ri=class extends _{constructor(){super(...arguments);this.r="";}get operation(){return this.r}set operation(t){let e=t??"";if(this.r===e)return;let r=this.r;this.r=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.Ps(e);}Ps(t){this.icon=t;let e=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=o,o},r=()=>{let o=this.l10n(t);return this.title=o,o};e(),r();}initCallback(){super.initCallback(),this.r&&this.Ps(this.r),this.sub("*editorTransformations",t=>{if(!this.r)return;let{zero:e}=B[this.r],r=t[this.r],o=typeof r<"u"?r!==e:false;this.active=o;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.r),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.r,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:jt(this.$["*operationTooltip"])});}};p([b({type:String})],ri.prototype,"operation",1);var fn=1,ys=()=>{},si=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Os=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>fn){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Os,{passive:false}),this.addEventListener("scroll",ys,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Os),this.removeEventListener("scroll",ys),super.disconnectedCallback();}};p([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],si.prototype,"hiddenScrollbar",2);var z=class extends C{constructor(){super(...arguments);this.le=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Rs=true;this.tabList=[...N];this.activeTab=A.CROP;this.ze=true;this.Xi=false;this.Ms=null;this.Ls=0;this.Is=0;this.je=E();this.Us=E();this.tabToggleRefs={[A.CROP]:E(),[A.TUNING]:E(),[A.FILTERS]:E()};this.Ns=()=>{this.Ot();};this.ce=[];this.He=O(t=>{this.le=t;},500);this.Be=O(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",o=false;if(this.$["*tabId"]===A.FILTERS)if(o=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Y);else if(this.showSubToolbar&&this.$["*tabId"]===A.TUNING&&e){o=true;let n=t?.[e]||B[e].zero;r=`${this.l10n(e)} ${n}`;}o&&(this.$["*operationTooltip"]=r),this.Xi=o;},0);this.wn={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Cn={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.xn={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.En={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Y,"*currentOperation":null,"*operationTooltip":null};this.Nn=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.m?.();let e=this.$["*on.cancel"];e?.();};this.$n=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this._n=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:jt(this.$["*operationTooltip"])}),this.je.value?.apply(),this.$s();};this.Dn=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.je.value?.cancel(),this.$s();};this.Fn=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Yi(r,{fromViewer:false}));};}$s(){this.$["*showSlider"]=false,this.$["*tabId"]===A.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===A.TUNING&&(this.Xi=false);}Yi(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this._s(t,{fromViewer:e,force:r});}_s(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.Ot();return}this.activeTab=t;let o=this.$["*faderEl"],n=this.$["*cropperEl"];t===A.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(o?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of N){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.Ot();}}Ot(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Us.value;if(!e||!r)return;let o=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Ls!==o||this.Is!==n)&&(this.Ls=o,this.Is=n,r.style.transform=`translateX(${o}px)`,r.style.width=`${n}px`);}get Zi(){return this.ce.length>=3}Sn(t){switch(t){case A.CROP:return this.kn();case A.FILTERS:return this.An();case A.TUNING:return this.Pn();default:return []}}kn(){let t=[];if(this.Zi)t.push(()=>this.On());else for(let e of this.ce)t.push(()=>this.Ds(e));for(let e of xr)t.push(()=>this.Rn(e));return this.Qi(t)}An(){let e=[Y,...Cr].map(r=>()=>this.Mn(r));return this.Qi(e)}Pn(){let t=wr.map(e=>()=>this.Ln(e));return this.Qi(t)}Qi(t){return t.length?t.map(r=>r()):[]}On(){return g`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ds(t){return g`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Rn(t){return g`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Mn(t){return g`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Ln(t){return g`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}In(){return this.Zi?this.ce.map(t=>this.Ds(t)):[]}async Un(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(zt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.m?.();let{cancel:r}=ae([e]);this.m=()=>{r(),this.m=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.ce=[...t],this.sub("*cropPresetList",e=>{this.ce=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Yi(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Be();}),this.sub("*currentOperation",()=>{this.Be();}),this.sub("*tabId",e=>{this._s(e,{fromViewer:false,force:true}),this.Be();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Un(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,o]of e.entries()){if(r)break;for(let[,n]of o.entries())if(n){r=true;break}}this.He(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.ze=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.ze=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Rs=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Yi(r,{fromViewer:false});return}this.Ot();}),this.sub("*operationTooltip",e=>{this.Ms=e;}),this.Be();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ns);}firstUpdated(t){super.firstUpdated(t),this.Ge(),this.Ot();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.Ot()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ge();}disconnectedCallback(){window.removeEventListener("resize",this.Ns),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ge(){let t=this.je.value;t&&(this.$["*sliderEl"]=t);}Kn(t){let e=this.tabList.includes(t),r=this.activeTab===t,o=this.tabList.indexOf(t),n=o>=0?ce({gridColumn:`${o+1}`}):w;return g`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.xn}><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.Fn} ${k(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Vn(t){let e=this.Sn(t);return g`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:w}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Xi?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Zi;return g`<uc-line-loader-ui .active=${this.le}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Ms??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.wn} ><div class="uc-tab-content-row">${N.map(r=>Qt(this.activeTab===r,()=>this.Vn(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Rs} .styles=${this.En} @initial-render=${()=>this.Ot()} ><div class="uc-tab-toggles_indicator" ${k(this.Us)} ></div>${N.map(r=>this.Kn(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Nn} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.$n}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Cn}><div class="uc-slider" ?hidden=${!this.ze}><uc-editor-slider ${k(this.je)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.ze||!e}>${e?g`<div class="uc-list-aspect-ratio">${this.In()}</div>`:w}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Dn} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this._n} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([y()],z.prototype,"le",2),p([y()],z.prototype,"showMainToolbar",2),p([y()],z.prototype,"showSubToolbar",2),p([y()],z.prototype,"Rs",2),p([y()],z.prototype,"tabList",2),p([y()],z.prototype,"activeTab",2),p([y()],z.prototype,"ze",2),p([y()],z.prototype,"Xi",2),p([y()],z.prototype,"Ms",2),p([y()],z.prototype,"ce",2);var bs=kt([...N]),D=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.zn="";this.At=ht;this.jn="";this.le=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=bs;this.Fs=false;this.et=false;this.Ji=null;this.ue=null;this.He=O(t=>{this.le=t;},300);this.qe=E();this.Ks=E();this.Vs=E();this.zs=E();this.js=()=>{this.He(false),this.At!==ht&&(this.$["*networkProblems"]=false);};this.Hs=()=>{this.He(false),this.$["*networkProblems"]=true;};this.Hn=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...is(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Bn(){this.et||this.Ji||(this.Ji=this.updateComplete.then(()=>{this.Ji=null,this.et=true;}));}initCallback(){super.initCallback(),this.Bs(),this.Gs();}Ge(){let t=this.Vs.value;t&&(this.$["*faderEl"]=t);let e=this.Ks.value;e&&(this.$["*cropperEl"]=e);let r=this.zs.value;r&&(this.$["*imgContainerEl"]=r);let o=this.qe.value;o&&(this.$["*imgEl"]=o);}Gn(){let t=this.qe.value;t&&(t.addEventListener("load",this.js),t.addEventListener("error",this.Hs));}qn(){let t=this.qe.value;t&&(t.removeEventListener("load",this.js),t.removeEventListener("error",this.Hs));}get Wn(){let t=this.$["*tabId"];return K("uc-image",{"uc-image_hidden_to_cropper":t===A.CROP,"uc-image_hidden_effects":t!==A.CROP})}qs(){if(this.ue)return this.ue;let t=3e3;return this.ue=new Promise((e,r)=>{let o=()=>{window.clearTimeout(d),c.disconnect(),this.ue=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{o(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");o(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.ue}firstUpdated(t){super.firstUpdated(t),this.Ge(),this.Gn(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.qn(),super.disconnectedCallback();}render(){let t=this.jn??"",e=this.zn??"",r=this.At||ht,o=this.le,n=this.Fs;return g` ${Ee(rs)}<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.Hn}></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" ${k(this.zs)}><img src=${r} class=${this.Wn} ${k(this.qe)} />${Qt(this.et,()=>g`<uc-editor-image-cropper ${k(this.Ks)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${k(this.Vs)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Qt(this.et,()=>g`<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.Bs(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Gs();}Bs(){let t=this.tabs||bs;this.$["*tabList"]=es(t);}Gs(){let t=Jr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Ti(this.cdnUrl),o=Ci(r);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;e=ts(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.qs();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=Oe(t),r=wi(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let o=Ti(t),n=Ci(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=wi(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===A.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(tt(t,J("json"))),r=await fetch(e).then(a=>a.json()),{width:o,height:n}=r;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===A.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.Bn();}}}async initEditor(){try{await this.qs();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Fs=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=J(ct(t),"preview"),o=tt(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([y()],D.prototype,"zn",2),p([y()],D.prototype,"At",2),p([y()],D.prototype,"jn",2),p([y()],D.prototype,"le",2),p([b({type:String,reflect:true})],D.prototype,"uuid",2),p([b({type:String,attribute:"cdn-url",reflect:true})],D.prototype,"cdnUrl",2),p([b({type:String,attribute:"crop-preset",reflect:true})],D.prototype,"cropPreset",2),p([b({type:String,reflect:true})],D.prototype,"tabs",2),p([y()],D.prototype,"Fs",2),p([y()],D.prototype,"et",2);var vs=class extends D{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:st.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var mn=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function gn(s){for(let i in s){if(mn.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}`),s[i].reg&&s[i].reg(t);}}var Di=s=>s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");var Ts=new Set;function ws(s){Ts.has(s)||(Ts.add(s),console.warn(s));}var yn=[{test:s=>!!s.accept&&!!s.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:s=>s.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:s=>s.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Cs=O(s=>{for(let{test:i,message:t}of yn)i(s)&&ws(t);},0);var xs=(s,i)=>{let t=new URL(i);return t.hostname=`${s}.${t.hostname}`,t.toString().replace(/\/$/,"")},bn="0123456789abcdefghijklmnopqrstuvwxyz",Es=s=>{if(s<=0n)return "0";let i="";for(;s>0n;){let t=s%36n;i=bn[Number(t)]+i,s=s/36n;}return i},Fi=(s,i)=>{try{let t=new URL(s),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var vn=async s=>{let i=new TextEncoder().encode(s),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}`)},Tn=10,wn=async s=>{let i=await vn(s);return Es(i).slice(0,Tn)},Ss=async(s,i)=>{let t=await wn(s);return xs(t,i)};var ks=s=>s instanceof Promise||!!(s&&typeof s=="object"&&"then"in s&&typeof s.then=="function");var Ki=s=>s,Cn=[Ki({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:s,enableVideoRecording:i})=>{let t=i();if(t===null)return s();let e=St(s());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),kt(e)}}),Ki({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:s,defaultCameraMode:i})=>{let t=i();if(t===null)return s();let e=St(s());return e=e.sort((r,o)=>r===t?-1:o===t?1:0),kt(e)}}),Ki({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:s,cdnCname:i,cdnCnamePrefixed:t})=>{let e=s(),r=i(),o=t();return e&&(r===xi||Fi(r,o))?Ss(e,o):r}})],As=({key:s,setValue:i,getValue:t,computationControllers:e})=>{for(let r of Cn){if(!r.deps.includes(s))continue;let o={[r.key]:()=>t(r.key)};for(let l of r.deps)o[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(o,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}ks(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var Vi=Object.freeze({PHOTO:"photo",VIDEO:"video"});var x=s=>String(s),U=s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},S=s=>{if(typeof s>"u"||s===null)return false;if(typeof s=="boolean")return s;if(s==="true"||s==="")return true;if(s==="false")return false;throw new Error(`Invalid boolean: "${s}"`)},Os=s=>s==="auto"?s:S(s),Ps=s=>{let i=x(s);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Rs=s=>{let i=x(s);if(!Object.values(Vi).includes(i))throw new Error(`Invalid value: "${i}"`);return i},Ms=s=>{let i=x(s),t=St(i);if(t.some(e=>!Object.values(Vi).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Ls=s=>{let i=x(s);if(i==="local"||i==="global")return i;if(S(s)===false)return false;throw new Error(`Invalid value: "${i}"`)},Is=s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},zi=s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},oi=s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},ni=s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},$s=s=>{let i=x(s);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},Us=s=>{let i=x(s);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var xn={pubkey:x,multiple:S,multipleMin:U,multipleMax:U,confirmUpload:S,imgOnly:S,accept:x,externalSourcesPreferredTypes:x,externalSourcesEmbedCss:x,store:Os,cameraMirror:S,cameraCapture:Ps,sourceList:x,topLevelOrigin:x,maxLocalFileSizeBytes:U,thumbSize:U,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:x,removeCopyright:S,cropPreset:x,imageShrink:x,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:x,cdnCname:x,cdnCnamePrefixed:x,baseUrl:x,socialBaseUrl:x,secureSignature:x,secureExpire:x,secureDeliveryProxy:x,retryThrottledRequestMaxTimes:U,retryNetworkErrorMaxTimes:U,multipartMinFileSize:U,multipartChunkSize:U,maxConcurrentRequests:U,multipartMaxConcurrentRequests:U,multipartMaxAttempts:U,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:x,debug:S,localeName:x,metadata:Is,secureUploadsExpireThreshold:U,localeDefinitionOverride:s=>zi(s),secureUploadsSignatureResolver:s=>oi(s),secureDeliveryProxyUrlResolver:s=>oi(s),iconHrefResolver:s=>oi(s),plugins:s=>ni(s),fileValidators:ni,collectionValidators:ni,validationTimeout:U,validationConcurrency:U,cameraModes:Ms,defaultCameraMode:Rs,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:zi,maxVideoRecordingDuration:U,filesViewMode:$s,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:x,testMode:S,qualityInsights:S,pasteScope:Ls,dynamicButtonShowFirstIcon:S,dynamicButtonViewMode:Us},Ns=(s,i)=>{if(!(typeof i>"u"||i===null))try{return xn[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),I[s]}};var ai=[...new Set(["debug",...Object.keys(I)])],En=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ds=s=>En.includes(s),Hi=ai.filter(s=>!Ds(s)),ji={...Object.fromEntries(Hi.map(s=>[Di(s),s])),...Object.fromEntries(Hi.map(s=>[s.toLowerCase(),s]))},_s=s=>`__${s}`,li=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(I).map(([t,e])=>[T(t),e]))};this.Xn=new Map;this.de={};this.Ws=new Set;this.zt=new Map;}tr(t){return this.Ws.has(t)}er(t){let e=this.s.pluginManager;if(e)return e.configRegistry.get(t)}ir(t){return [...new Set([Di(t),t.toLowerCase()])]}Yn(t,e){if(Ds(t)||this.tr(t)&&this.er(t)?.attribute===false)return;let r=this.ir(t);for(let o of r)typeof e>"u"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString());}Zn(t,e){let r=T(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let o=I[t];this.$[r]=o!==void 0?o:e;}else this.$[r]=e;}mt(t,e){let r;if(this.tr(t)){let a=this.er(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=Ns(t,e);let o=this,n=_s(t);o[n]!==r&&(this.Qn(t,o[n],r),o[n]=r,this.Yn(t,r),this.Zn(t,r),this.debugPrint(`"${t}"`,r),this.tr(t)||Cs(this.cfg));}Xe(t){let e=this,r=_s(t);return e[r]??this.$[T(t)]}Qn(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));}Xs(t){let e=t.configRegistry.getAll();this.de={},this.Ws=new Set(e.keys());for(let[r,o]of this.zt)e.has(r)||(o(),this.zt.delete(r));for(let[r,o]of e){let a=T(r);if(o.attribute){let f=this.ir(r);for(let m of f)this.de[m]=r;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,r);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&o.attribute)for(let f of this.ir(r)){let m=this.getAttribute(f);if(m!=null){try{l=o.fromAttribute?o.fromAttribute(m):m;}catch(R){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,R),l=m;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,o.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:f=>{this.mt(r,f);},get:()=>this.Xe(r),enumerable:true,configurable:true}),!this.zt.has(r)){let f=this.sub(a,m=>{this.mt(r,m);},false);this.zt.set(r,f);}c&&this.mt(r,l);}}Jn(){this.s.when("pluginManager",t=>{this.Xs(t),this.We=t.onPluginsChange(()=>{this.Xs(t);});});}ta(){this.pe=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,o=e.oldValue,n=this.getAttribute(r);if(o===n||r in ji)continue;if(r in this.de){let l=this.de[r],c=this.er(l);this.attributeChangedCallback(r,o??"",n??c?.defaultValue??"");}}}),this.pe.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Jn(),this.ta();for(let r of Hi)this.sub(T(r),o=>{this.mt(r,o);},false);for(let r of ai){let o=t[r]??this.$[T(r)];o!==I[r]&&this.mt(r,o);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.mt(r,a);},get:()=>this.Xe(r)});}let e=r=>{As({key:r,setValue:this.mt.bind(this),getValue:this.Xe.bind(this),computationControllers:this.Xn});};for(let r of ai)this.sub(T(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let o=this,n=ji[t];n?o[n]=r:this.s.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.de[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.Xe(c)===u)return;this.mt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.We&&(this.We(),this.We=void 0),this.pe&&(this.pe.disconnect(),this.pe=void 0);for(let t of this.zt.values())t();this.zt.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(ji);return [...t,...e]}};for(let s of ai)li.prototype[s]=void 0;/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
|
|
8
|
+
export{q as BtnUi,vs as CloudImageEditor,D as CloudImageEditorBlock,li as Config,Ye as CropFrame,ei as EditorAspectRatioButtonControl,ii as EditorCropButtonControl,yt as EditorFilterControl,_i as EditorFreeformButtonControl,Ze as EditorImageCropper,Ni as EditorImageFader,ri as EditorOperationControl,si as EditorScroller,Qe as EditorSlider,z as EditorToolbar,_t as Icon,We as LineLoaderUi,oe as PresenceToggle,nt as SliderUi,gn as defineComponents};
|