@uploadcare/file-uploader 1.29.0-alpha.2 → 1.30.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +0 -2
  2. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  3. package/dist/env.js +3 -3
  4. package/dist/index.css +3 -3
  5. package/dist/index.d.ts +337 -691
  6. package/dist/index.js +5 -5
  7. package/dist/index.layered.css +3 -3
  8. package/dist/index.ssr.js +82 -115
  9. package/dist/locales/file-uploader/ar.d.ts +2 -0
  10. package/dist/locales/file-uploader/ar.js +3 -3
  11. package/dist/locales/file-uploader/az.d.ts +2 -0
  12. package/dist/locales/file-uploader/az.js +3 -3
  13. package/dist/locales/file-uploader/ca.d.ts +2 -0
  14. package/dist/locales/file-uploader/ca.js +3 -3
  15. package/dist/locales/file-uploader/cs.d.ts +2 -0
  16. package/dist/locales/file-uploader/cs.js +3 -3
  17. package/dist/locales/file-uploader/da.d.ts +2 -0
  18. package/dist/locales/file-uploader/da.js +3 -3
  19. package/dist/locales/file-uploader/de.d.ts +2 -0
  20. package/dist/locales/file-uploader/de.js +3 -3
  21. package/dist/locales/file-uploader/el.d.ts +2 -0
  22. package/dist/locales/file-uploader/el.js +3 -3
  23. package/dist/locales/file-uploader/en.d.ts +2 -0
  24. package/dist/locales/file-uploader/en.js +3 -3
  25. package/dist/locales/file-uploader/es.d.ts +2 -0
  26. package/dist/locales/file-uploader/es.js +3 -3
  27. package/dist/locales/file-uploader/et.d.ts +2 -0
  28. package/dist/locales/file-uploader/et.js +3 -3
  29. package/dist/locales/file-uploader/fi.d.ts +2 -0
  30. package/dist/locales/file-uploader/fi.js +3 -3
  31. package/dist/locales/file-uploader/fr.d.ts +2 -0
  32. package/dist/locales/file-uploader/fr.js +3 -3
  33. package/dist/locales/file-uploader/he.d.ts +2 -0
  34. package/dist/locales/file-uploader/he.js +3 -3
  35. package/dist/locales/file-uploader/hy.d.ts +2 -0
  36. package/dist/locales/file-uploader/hy.js +3 -3
  37. package/dist/locales/file-uploader/is.d.ts +2 -0
  38. package/dist/locales/file-uploader/is.js +3 -3
  39. package/dist/locales/file-uploader/it.d.ts +2 -0
  40. package/dist/locales/file-uploader/it.js +3 -3
  41. package/dist/locales/file-uploader/ja.d.ts +2 -0
  42. package/dist/locales/file-uploader/ja.js +3 -3
  43. package/dist/locales/file-uploader/ka.d.ts +2 -0
  44. package/dist/locales/file-uploader/ka.js +3 -3
  45. package/dist/locales/file-uploader/kk.d.ts +2 -0
  46. package/dist/locales/file-uploader/kk.js +3 -3
  47. package/dist/locales/file-uploader/ko.d.ts +2 -0
  48. package/dist/locales/file-uploader/ko.js +3 -3
  49. package/dist/locales/file-uploader/lv.d.ts +2 -0
  50. package/dist/locales/file-uploader/lv.js +3 -3
  51. package/dist/locales/file-uploader/nb.d.ts +2 -0
  52. package/dist/locales/file-uploader/nb.js +3 -3
  53. package/dist/locales/file-uploader/nl.d.ts +2 -0
  54. package/dist/locales/file-uploader/nl.js +3 -3
  55. package/dist/locales/file-uploader/pl.d.ts +2 -0
  56. package/dist/locales/file-uploader/pl.js +3 -3
  57. package/dist/locales/file-uploader/pt.d.ts +2 -0
  58. package/dist/locales/file-uploader/pt.js +3 -3
  59. package/dist/locales/file-uploader/ro.d.ts +2 -0
  60. package/dist/locales/file-uploader/ro.js +3 -3
  61. package/dist/locales/file-uploader/ru.d.ts +2 -0
  62. package/dist/locales/file-uploader/ru.js +3 -3
  63. package/dist/locales/file-uploader/sk.d.ts +2 -0
  64. package/dist/locales/file-uploader/sk.js +3 -3
  65. package/dist/locales/file-uploader/sr.d.ts +2 -0
  66. package/dist/locales/file-uploader/sr.js +3 -3
  67. package/dist/locales/file-uploader/sv.d.ts +2 -0
  68. package/dist/locales/file-uploader/sv.js +3 -3
  69. package/dist/locales/file-uploader/tr.d.ts +2 -0
  70. package/dist/locales/file-uploader/tr.js +3 -3
  71. package/dist/locales/file-uploader/uk.d.ts +2 -0
  72. package/dist/locales/file-uploader/uk.js +3 -3
  73. package/dist/locales/file-uploader/vi.d.ts +2 -0
  74. package/dist/locales/file-uploader/vi.js +3 -3
  75. package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
  76. package/dist/locales/file-uploader/zh-TW.js +3 -3
  77. package/dist/locales/file-uploader/zh.d.ts +2 -0
  78. package/dist/locales/file-uploader/zh.js +3 -3
  79. package/package.json +29 -29
  80. package/web/file-uploader.iife.min.d.ts +339 -691
  81. package/web/file-uploader.iife.min.js +4 -4
  82. package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
  83. package/web/file-uploader.min.d.ts +339 -691
  84. package/web/file-uploader.min.js +4 -4
  85. package/web/file-uploader.min.js.LEGAL.txt +1 -1
  86. package/web/uc-basic.layered.min.css +3 -3
  87. package/web/uc-basic.min.css +3 -3
  88. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  89. package/web/uc-cloud-image-editor.min.css +3 -3
  90. package/web/uc-cloud-image-editor.min.d.ts +291 -643
  91. package/web/uc-cloud-image-editor.min.js +4 -4
  92. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  93. package/web/uc-file-uploader-inline.min.css +3 -3
  94. package/web/uc-file-uploader-inline.min.d.ts +339 -691
  95. package/web/uc-file-uploader-inline.min.js +4 -4
  96. package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
  97. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  98. package/web/uc-file-uploader-minimal.min.css +3 -3
  99. package/web/uc-file-uploader-minimal.min.d.ts +339 -691
  100. package/web/uc-file-uploader-minimal.min.js +4 -4
  101. package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
  102. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  103. package/web/uc-file-uploader-regular.min.css +3 -3
  104. package/web/uc-file-uploader-regular.min.d.ts +339 -691
  105. package/web/uc-file-uploader-regular.min.js +4 -4
  106. package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
  107. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.29.0-alpha.2 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.30.0-alpha.1 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-04-07T10:27:49.020Z
5
+ * Built: 2026-04-08T03:39:52.937Z
6
6
  */
7
- var $s=Object.defineProperty;var Ol=Object.getOwnPropertyDescriptor;var Ds=(o,i)=>{for(var t in i)$s(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?Ol(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&$s(i,t,r),r};var At=[],Xt=0,_i=4,Fs=o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Xt+_i;s<At.length;)At[s]===e?At.splice(s,_i):s+=_i;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!At.length;for(let n of i)At.push(n,t.value,e,r);if(s){for(Xt=0;Xt<At.length;Xt+=_i)At[Xt](At[Xt+1],At[Xt+2],At[Xt+3]);At.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t};function zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function po(o,i,t){let e=zi(o,i,t);return t(o.value),e}var ho=(o={})=>{let i=Fs(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i};var H=class o{static{this.Gt=new Map;}constructor(i,t){this.J=i,this.ae=t;}get id(){return this.J}pub(i,t){i in this.ae.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.ae.setKey(i,t);}sub(i,t,e=true){return (e?po:zi)(this.ae,[i],s=>{t(s[i]);})}read(i){return i in this.ae.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.ae.get()[i]}add(i,t,e=false){(!(i in this.ae.get())||e)&&this.ae.setKey(i,t);}has(i){return i in this.ae.get()}get store(){return this.ae.get()}static registerCtx(i,t){if(o.Gt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=ho(i);return o.Gt.set(t,e),new o(t,e)}static deleteCtx(i){o.Gt.delete(i);}static getCtx(i){let t=o.Gt.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Gt.has(i)}};var Bi=globalThis,Ki=Bi.ShadowRoot&&(Bi.ShadyCSS===void 0||Bi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ns=Symbol(),Vs=new WeakMap,Hi=class{constructor(i,t,e){if(this.Sc=true,e!==Ns)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(Ki&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Vs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Vs.set(t,i));}return i}toString(){return this.cssText}},_s=o=>new Hi(typeof o=="string"?o:o+"",void 0,Ns);var zs=(o,i)=>{if(Ki)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Bi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},fo=Ki?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return _s(t)})(o):o;var{is:Ll,defineProperty:Ul,getOwnPropertyDescriptor:Rl,getOwnPropertyNames:$l,getOwnPropertySymbols:Dl,getPrototypeOf:Fl}=Object,ji=globalThis,Bs=ji.trustedTypes,Vl=Bs?Bs.emptyScript:"",Nl=ji.reactiveElementPolyfillSupport,oi=(o,i)=>o,si={toAttribute(o,i){switch(i){case Boolean:o=o?Vl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},Gi=(o,i)=>!Ll(o,i),Hs={attribute:true,type:String,converter:si,reflect:false,useDefault:false,hasChanged:Gi};Symbol.metadata??=Symbol("metadata"),ji.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(i){this._r(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Pi&&[...this.Pi.keys()]}static createProperty(i,t=Hs){if(t.state&&(t.attribute=false),this._r(),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&&Ul(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Rl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Hs}static _r(){if(this.hasOwnProperty(oi("elementProperties")))return;let i=Fl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(oi("finalized")))return;if(this.finalized=true,this._r(),this.hasOwnProperty(oi("properties"))){let t=this.properties,e=[...$l(t),...Dl(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.Pi=new Map;for(let[t,e]of this.elementProperties){let r=this.Br(t,e);r!==void 0&&this.Pi.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(fo(r));}else i!==void 0&&t.push(fo(i));return t}static Br(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Li=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.yt=null,this.Ac();}Ac(){this.zr=new Promise(i=>this.enableUpdating=i),this.Ne=new Map,this.kc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.qt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.qt?.delete(i);}kc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Li=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return zs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.qt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.qt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Hr(i,e);}Mc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Br(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:si).toAttribute(t,e.type);this.yt=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.yt=null;}}Hr(i,t){let e=this.constructor,r=e.Pi.get(i);if(r!==void 0&&this.yt!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:si;this.yt=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.Kr?.get(r)??a,this.yt=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Gi)(s,t)||e.useDefault&&e.reflect&&s===this.Kr?.get(i)&&!this.hasAttribute(n.Br(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.zr=this.Ic());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.Kr??=new Map).has(i)&&(this.Kr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Ne.has(i)||(this.hasUpdated||e||(t=void 0),this.Ne.set(i,t)),r===true&&this.yt!==i&&(this.js??=new Set).add(i));}async Ic(){this.isUpdatePending=true;try{await this.zr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Li){for(let[r,s]of this.Li)this[r]=s;this.Li=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,a=this[r];n!==true||this.Ne.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this.Ne;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.qt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.jr();}catch(e){throw i=false,this.jr(),e}i&&this.Oc(t);}willUpdate(i){}Oc(i){this.qt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}jr(){this.Ne=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.zr}shouldUpdate(i){return true}update(i){this.js&&=this.js.forEach(t=>this.Mc(t,this[t])),this.jr();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[oi("elementProperties")]=new Map,zt[oi("finalized")]=new Map,Nl?.({ReactiveElement:zt}),(ji.reactiveElementVersions??=[]).push("2.1.2");var go=globalThis,Ks=o=>o,qi=go.trustedTypes,js=qi?qi.createPolicy("lit-html",{createHTML:o=>o}):void 0,vo="$lit$",Bt=`lit$${Math.random().toFixed(9).slice(2)}$`,yo="?"+Bt,_l=`<${yo}>`,fe=document,ai=()=>fe.createComment(""),li=o=>o===null||typeof o!="object"&&typeof o!="function",bo=Array.isArray,Xs=o=>bo(o)||typeof o?.[Symbol.iterator]=="function",mo=`[ \f\r]`,ni=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gs=/-->/g,qs=/>/g,pe=RegExp(`>|${mo}(?:([^\\s"'>=/]+)(${mo}*=${mo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ws=/'/g,Zs=/"/g,Qs=/^(?:script|style|textarea|title)$/i,wo=o=>(i,...t)=>({Ve:o,strings:i,values:t}),v=wo(1),it=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),Ys=new WeakMap,he=fe.createTreeWalker(fe,129);function Js(o,i){if(!bo(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return js!==void 0?js.createHTML(i):i}var tn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=ni;for(let a=0;a<t;a++){let l=o[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===ni?d[1]==="!--"?n=Gs:d[1]!==void 0?n=qs:d[2]!==void 0?(Qs.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=pe):d[3]!==void 0&&(n=pe):n===pe?d[0]===">"?(n=r??ni,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?pe:d[3]==='"'?Zs:Ws):n===Zs||n===Ws?n=pe:n===Gs||n===qs?n=ni:(n=pe,r=void 0);let f=n===pe&&o[a+1].startsWith("/>")?" ":"";s+=n===ni?l+_l:u>=0?(e.push(c),l.slice(0,u)+vo+l.slice(u)+Bt+f):l+Bt+(u===-2?a:f);}return [Js(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},ci=class o{constructor({strings:i,Ve:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=tn(i,t);if(this.el=o.createElement(c,e),he.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=he.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(vo)){let h=d[n++],f=r.getAttribute(u).split(Bt),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?Zi:g[1]==="?"?Yi:g[1]==="@"?Xi:ge}),r.removeAttribute(u);}else u.startsWith(Bt)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(Qs.test(r.tagName)){let u=r.textContent.split(Bt),h=u.length-1;if(h>0){r.textContent=qi?qi.emptyScript:"";for(let f=0;f<h;f++)r.append(u[f],ai()),he.nextNode(),l.push({type:2,index:++s});r.append(u[h],ai());}}}else if(r.nodeType===8)if(r.data===yo)l.push({type:2,index:s});else {let u=-1;for(;(u=r.data.indexOf(Bt,u+1))!==-1;)l.push({type:7,index:s}),u+=Bt.length-1;}s++;}}static createElement(i,t){let e=fe.createElement("template");return e.innerHTML=i,e}};function me(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.Pc?.[e]:t.Lc,s=li(i)?void 0:i.Gr;return r?.constructor!==s&&(r?.Gs?.(false),s===void 0?r=void 0:(r=new s(o),r.qr(o,t,e)),e!==void 0?(t.Pc??=[])[e]=r:t.Lc=r),r!==void 0&&(i=me(o,r.Rc(o,i.values),r,e)),i}var Wi=class{constructor(i,t){this.qs=[],this.le=void 0,this.Ws=i,this.f=t;}get parentNode(){return this.f.parentNode}get W(){return this.f.W}u(i){let{el:{content:t},parts:e}=this.Ws,r=(i?.creationScope??fe).importNode(t,true);he.currentNode=r;let s=he.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new ke(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new Qi(s,this,i)),this.qs.push(c),l=e[++a];}n!==l?.index&&(s=he.nextNode(),n++);}return he.currentNode=fe,r}p(i){let t=0;for(let e of this.qs)e!==void 0&&(e.strings!==void 0?(e.ce(i,e,t),t+=e.strings.length-2):e.ce(i[t])),t++;}},ke=class o{get W(){return this.f?.W??this.Zs}constructor(i,t,e,r){this.type=2,this.r=U,this.le=void 0,this.ve=i,this.bt=t,this.f=e,this.options=r,this.Zs=r?.isConnected??true;}get parentNode(){let i=this.ve.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ve}get endNode(){return this.bt}ce(i,t=this){i=me(this,i,t),li(i)?i===U||i==null||i===""?(this.r!==U&&this.wt(),this.r=U):i!==this.r&&i!==it&&this.Ys(i):i.Ve!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Xs(i)?this.k(i):this.Ys(i);}O(i){return this.ve.parentNode.insertBefore(i,this.bt)}T(i){this.r!==i&&(this.wt(),this.r=this.O(i));}Ys(i){this.r!==U&&li(this.r)?this.ve.nextSibling.data=i:this.T(fe.createTextNode(i)),this.r=i;}$(i){let{values:t,Ve:e}=i,r=typeof e=="number"?this.Uc(i):(e.el===void 0&&(e.el=ci.createElement(Js(e.h,e.h[0]),this.options)),e);if(this.r?.Ws===r)this.r.p(t);else {let s=new Wi(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Uc(i){let t=Ys.get(i.strings);return t===void 0&&Ys.set(i.strings,t=new ci(i)),t}k(i){bo(this.r)||(this.r=[],this.wt());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(ai()),this.O(ai()),this,this.options)):e=t[r],e.ce(s),r++;r<t.length&&(this.wt(e&&e.bt.nextSibling,r),t.length=r);}wt(i=this.ve.nextSibling,t){for(this.Ri?.(false,true,t);i!==this.bt;){let e=Ks(i).nextSibling;Ks(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.Zs=i,this.Ri?.(i));}},ge=class{get tagName(){return this.element.tagName}get W(){return this.f.W}constructor(i,t,e,r,s){this.type=1,this.r=U,this.le=void 0,this.element=i,this.name=t,this.f=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=U;}ce(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=me(this,i,t,0),n=!li(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=me(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!li(c)||c!==this.r[l],c===U?i=U:i!==U&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Zi=class extends ge{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},Yi=class extends ge{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},Xi=class extends ge{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}ce(i,t=this){if((i=me(this,i,t,0)??U)===it)return;let e=this.r,r=i===U&&e!==U||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==U&&(e===U||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Qi=class{constructor(i,t,e){this.element=i,this.type=6,this.le=void 0,this.f=t,this.options=e;}get W(){return this.f.W}ce(i){me(this,i);}},en={I:ke},zl=go.litHtmlPolyfillSupport;zl?.(ci,ke),(go.litHtmlVersions??=[]).push("3.3.2");var rn=(o,i,t)=>{let e=t?.renderBefore??i,r=e.$c;if(r===void 0){let s=t?.renderBefore??null;e.$c=r=new ke(i.insertBefore(ai(),s),s,void 0,t??{});}return r.ce(o),r};var To=globalThis,Tt=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this.Wr=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.Wr=rn(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Wr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Wr?.setConnected(false);}render(){return it}};Tt.qp=true,Tt.finalized=true,To.litElementHydrateSupport?.({LitElement:Tt});var Bl=To.litElementPolyfillSupport;Bl?.({LitElement:Tt});(To.litElementVersions??=[]).push("4.2.2");var Hl=/\\([0-9a-fA-F]{1,6} ?)/g;function Kl(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function jl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function Gl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}function on(o){let i=o;Kl(o)&&(i=jl(i),i=i.replace(Hl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Gl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Me(o){class i extends o{constructor(){super(...arguments);this.Xs=null;this.Zr=null;}getCssData(r,s=false){let n=this.Xs??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.Zr||(this.Zr=window.getComputedStyle(this));let a=this.Zr.getPropertyValue(r).trim();try{n[r]=on(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.Xs=n,n[r]}}return i}function Ji(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this._e={};this.Be=null;this.Ui=false;}createRenderRoot(){return this}connectedCallback(){this.Be||(this.Be=Array.from(this.childNodes)),super.connectedCallback();}Dc(){if(this.Ui)return;this.Ui=true,this._e={};let r=Array.from(this.childNodes),s=r.length?r:this.Be??[];for(let n of s){let a=this.Qs(n),l=this._e[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this._e[a]=l;}this.Be=null;}Qs(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.Qs(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Fc(r){return !r.textContent||!r.textContent.trim()}Nc(r){let s=this._e[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Fc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Dc(),super.update(r);}yield(r,s){if(r===""&&!this._e[r]&&!this.Ui&&this.Be?.length){let a=[];for(let l of this.Be)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this._e[r]=a,this.Ui=true,this.Be=null;}let n=this._e[r];return v` ${n} ${this.Nc(r)?s:void 0} `}}return i}function Ie(o){class i extends o{static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}var Qt=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 Oe=class{constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Qt(this.context,this.host,this.t,this.subscribe));}};var tr=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 Eo=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Pe=class extends tr{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Qt(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 Eo(this.context,this.host));}};var Wl={attribute:true,type:String,converter:si,reflect:false,hasChanged:Gi},Zl=(o=Wl,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?Zl(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}function m(o){return y({...o,state:true,attribute:false})}function $(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var sn="ctx-name-context";function ir(){return function(o){class i extends o{constructor(...r){super(...r);this.ee=null;this.Wt=false;this.Yr=false;this.Xr=void 0;this.Tt=new Map;this.Zt=new Set;this.init$={};this.ctxOwner=false;this.$i=void 0;this.Di=false;this.ctxName=this.Ae;this.ke=false;this.$i=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ae,this.Vc=new Oe(this,{context:sn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.tn=s,this.en();},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 Js(){return this.$i}set Js(r){let s=r??void 0;this.$i!==s&&(this.$i=s,this.en());}shouldUpdate(r){return this.ke?super.shouldUpdate(r):false}get Ae(){return this.Js||this.tn||void 0}en(){if(this.ctxName=this.Ae,!(!this.ctxName||this.Wt)){if(this.isConnected){this.Qr();return}this.Di=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Ae,this.ctxName&&(this.Xr?this.Xr.setValue(this.ctxName):this.Xr=new Pe(this,{context:sn,initialValue:this.ctxName}));}rn(){if(!(!this.ee||this.Tt.size===0)){for(let[r,{value:s,rewrite:n}]of this.Tt)this.ee.add(r,s,n);this.Tt.clear();}}sn(){return !this.ee&&this.Ae&&this.Jr(),this.ee&&this.rn(),this.ee}Fi(){let r=this.sn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Jr(){let r=this.init$,s=this.Ae;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.ee){this.ee=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.ee.add(n,a,this.ctxOwner);this.rn();}}get $(){return this.Ae&&this.Jr(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.ee?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.ee?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Fi().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Zt.delete(d));};return this.Zt.add(d),d}pub(r,s){this.Fi().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Fi()}has(r){return this.ee?.has(r)??false}add(r,s,n=false){let a=this.sn();if(!a){if(!n&&this.Tt.has(r))return;this.Tt.set(r,{value:s,rewrite:n});return}this.Tt.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Wt?this.ke&&this.Yr&&(this.Yr=false,this.initCallback()):this.ctxName?(this.Di=false,this.Qr()):this.Di&&this.Ae&&(this.Di=false,this.Qr());}Qr(){if(this.Wt)return;this.Wt=true,this.Jr();let r=this.init$;if(Object.keys(r).length>0){let s=this.Fi();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.ke=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this._c(),super.disconnectedCallback(),this.Wt&&(this.Yr=true);}_c(){if(this.Zt.size!==0){for(let r of [...this.Zt])r();this.Zt.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Js",1),p([m()],i.prototype,"tn",2),p([m()],i.prototype,"ctxName",2),p([m()],i.prototype,"ke",2),i}}var Co=class extends Ie(ir()(Me(Ji(Tt)))){};var ft=class o{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():o.generateFastUid()}};var Yl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function mt(o){for(let i in o){if(Yl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}var xo="UC";function Xl(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[xo]){t(window[xo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[xo];i&&mt(s),t(s);},document.head.appendChild(r);})}var ui={"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"};var So=new Map,nn=new Map,an=(o,i)=>{So.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...ui,...i};return So.set(o,t),t},Ql=(o,i)=>{nn.set(o,i);},ln=(o,i)=>{typeof i=="function"?Ql(o,i):an(o,i);},cn=async o=>{let i=So.get(o);if(!i){let t=nn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=an(o,e);}return i};ln("en",ui);var k=o=>`*cfg/${o}`;var K=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Ht=o=>o.join(",");var un=o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},rr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>un(i)).join("/-/"),rt=(...o)=>{let i=rr(...o);return i?`-/${i}/`:""};function or(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}function sr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Ao(o){let i=dn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function ko(o){return Ao(o).split("/-/").filter(Boolean).map(t=>un(t))}function dn(o){let i=new URL(o),t=or(o),e=pn(t)?hn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function pn(o){return o.startsWith("http")}function hn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var W=(o,i,t)=>{let e=new URL(dn(o)),r=t??or(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&pn(r)){let n=hn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},Jt=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Z=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var di=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}),mn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Jl(o,i){if(typeof i=="number"){let t=i;return di[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return di[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return di.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function te(o){return rr(...mn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return Jl(i,t)}).filter(i=>!!i))}var nr=rr("format/auto","progressive/yes"),Kt=([o])=>typeof o<"u"?Number(o):void 0,fn=()=>true,tc=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),ec=([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Z(o,"x").map(Number),coords:Z(i).map(Number)}},ic=Object.freeze({enhance:Kt,brightness:Kt,exposure:Kt,gamma:Kt,contrast:Kt,saturation:Kt,vibrance:Kt,warmth:Kt,filter:tc,mirror:fn,flip:fn,rotate:Kt,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=ec([i,t]);return {dimensions:e,coords:r}}});function Mo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!mn.includes(e))continue;let s=e,n=ic[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var B=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),ot=Object.freeze([B.CROP,B.TUNING,B.FILTERS]),gn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),vn=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"]),yn=Object.freeze(["rotate","mirror","flip"]),jt=di,kt=Object.freeze({brightness:{zero:jt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:jt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:jt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:jt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:jt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:jt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:jt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:jt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:jt.filter,range:[0,100],keypointsNumber:1}});var pi="https://ucarecdn.com",rc="https://upload.uploadcare.com",oc="https://social.uploadcare.com",sc="https://ucarecd.net",nc={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:pi,cdnCnamePrefixed:sc,baseUrl:rc,socialBaseUrl:oc,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:Ht(ot),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},J=Object.freeze(nc);var ar=(o,i)=>(...t)=>{let e=o();if(!e.read(k("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);};var j=class{constructor(i){this.eo=new Set;this.ze=null;this.w=ar(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}addSub(i){this.eo.add(i);}get He(){if(!this.ze){let i={};this.ze=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=k(e);return this.i.ctx.has(r)?this.i.ctx.read(r):J[e]}});}return this.ze}destroy(){for(let i of this.eo)try{i();}catch{}this.eo.clear();}},ac={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},Mt=(o,i,t=true)=>{let e=o.has(i),r=e?o.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},bn=o=>({get ctx(){return o()},get modalManager(){return Mt(o(),"*modalManager",false)},get pluginManager(){return Mt(o(),"*pluginManager")},get telemetryManager(){return Mt(o(),"*telemetryManager")},get localeManager(){return Mt(o(),"*localeManager")},get a11y(){return Mt(o(),"*a11y")},get blocksRegistry(){return Mt(o(),"*blocksRegistry")},get eventEmitter(){return Mt(o(),"*eventEmitter")},get uploadCollection(){return Mt(o(),"*uploadCollection")},get secureUploadsManager(){return Mt(o(),"*secureUploadsManager",false)},get api(){return Mt(o(),"*publicApi")},get validationManager(){return Mt(o(),"*validationManager")},when(i,t){let e=ac[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n=r.sub(e,a=>{a&&(t(a),n());});return n},wait(i){return new Promise(t=>{let e=this.when(i,r=>{t(r),e();});})}});var Y=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),lr=class extends j{constructor(){super(...arguments);this.Ke=new Map;this.ue=new Set;this.c=new Map;}registerModal(t,e){this.Ke.set(t,e),this.q(Y.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Ke.get(t);return e?(this.Ke.delete(t),this.ue.delete(t),this.q(Y.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Ke.get(t);return e?(this.ue.add(t),this.q(Y.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Ke.get(t);return !e||!this.ue.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.ue.delete(t),this.q(Y.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Ke.has(t)?this.ue.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.ue.size>0}back(){if(this.ue.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.ue).pop();return t?this.close(t):false}closeAll(){let t=this.ue.size;return this.ue.clear(),this.q(Y.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}q(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.i.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Ke.clear(),this.c.clear(),this.q(Y.DESTROY,{});}};var cr=o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");function wn(o){return Object.prototype.toString.call(o)==="[object Object]"}var lc=/\W|_/g;function cc(o){return o.split(lc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Tn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>qt(t,{ignoreKeys:i})):o}function qt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Tn(o,{ignoreKeys:i});if(!wn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}wn(r)?r=qt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Tn(r,{ignoreKeys:i})),t[cc(e)]=r;}return t}var uc=o=>new Promise(i=>setTimeout(i,o));function $o({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var dc={factor:2,time:100};function pc(o,i=dc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>uc(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var ve=class extends Error{},Le=class o extends ve{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},ur=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},ee=class o extends ve{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},hc=500,Cn=({check:o,interval:i=hc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;ur(e,()=>{n&&clearTimeout(n),s(new ee("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new ee("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),L={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},dr="application/octet-stream",xn="original",re=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,f]=u;typeof f<"u"&&!Array.isArray(f)&&l.setRequestHeader(h,f);}),l.responseType="text",ur(r,()=>{d=true,l.abort(),a(new ee);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(w){let E=w.split(": "),T=E.shift(),A=E.join(": ");T&&typeof T<"u"&&(f[T]=A);});let g=l.response,b=l.status;n({request:u,data:g,headers:f,status:b});}},l.onerror=u=>{d||a(new Le(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function fc(o,...i){return o}var mc=({name:o})=>o?[o]:[],gc=fc,vc=()=>new FormData,Sn=o=>false,pr=o=>typeof Blob<"u"&&o instanceof Blob,hr=o=>typeof File<"u"&&o instanceof File,fr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",Ue=o=>pr(o)||hr(o)||Sn()||fr(o),yc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",bc=o=>!!o&&typeof o=="object"&&!Array.isArray(o),wc=o=>!!o&&typeof o=="object"&&"data"in o&&Ue(o.data);function An(o,i,t){if(Array.isArray(t))for(let e of t)An(o,`${i}[]`,e);else if(wc(t)){let{name:e,contentType:r}=t,s=gc(t.data,e,r??dr),n=mc({name:e});o.push([i,s,...n]);}else if(bc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else yc(t)&&t&&o.push([i,t.toString()]);}function Tc(o){let i=[];for(let[t,e]of Object.entries(o))An(i,t,e);return i}function mr(o){let i=vc(),t=Tc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var st=class o extends ve{code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Ec=o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},Gt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Ec(t)),e.toString()},Cc="6.18.4",xc="UploadcareUploadClient",Sc=Cc;function be(o){return $o({libraryName:xc,libraryVersion:Sc,...o})}var Ac="RequestThrottledError",En=15e3,kc=1e3;function Mc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return En;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:En}function oe(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return pc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Ac&&r<t)return s(Mc(n));if(n instanceof Le&&r<e)return s((r+1)*kc);throw n}))}var kn=o=>{let i="";return (pr(o)||hr(o)||fr(o))&&(i=o.type),i||dr},Mn=o=>{let i="";return hr(o)&&o.name?i=o.name:pr(o)||Sn()?i="":fr(o)&&o.name&&(i=o.name),i||xn};function Do(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function Ic(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=L.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=L.retryNetworkErrorMaxTimes,metadata:b}){return oe(()=>re({method:"POST",url:Gt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},data:mr({file:{data:o,name:t||Mn(o),contentType:e||kn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Do(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:E,request:T})=>{let A=qt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}var Po;(function(o){o.Token="token",o.FileInfo="file_info";})(Po||(Po={}));function Oc(o,{publicKey:i,baseURL:t=L.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=L.retryNetworkErrorMaxTimes,metadata:b}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},url:Gt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Do(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:E,request:T})=>{let A=qt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}var ct;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ct||(ct={}));var Pc=o=>"status"in o&&o.status===ct.Error;function Lc(o,{publicKey:i,baseURL:t=L.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=L.retryNetworkErrorMaxTimes}={}){return oe(()=>re({method:"GET",headers:i?{"X-UC-User-Agent":be({publicKey:i,integration:r,userAgent:s})}:void 0,url:Gt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=qt(JSON.parse(l));if("error"in u&&!Pc(u))throw new st(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Uc(o,{publicKey:i,baseURL:t=L.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=L.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:l,userAgent:c})},url:Gt(t,"/group/",{jsonerrors:1}),data:mr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:f,request:g})=>{let b=qt(JSON.parse(h));if("error"in b)throw new st(b.error.content,b.error.errorCode,g,b,f);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function In(o,{publicKey:i,baseURL:t=L.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=L.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"GET",headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},url:Gt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=qt(JSON.parse(c));if("error"in h)throw new st(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Rc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=L.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=L.retryNetworkErrorMaxTimes,metadata:b}){return oe(()=>re({method:"POST",url:Gt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},data:mr({filename:e,size:o,content_type:t||dr,part_size:r,UPLOADCARE_STORE:Do(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:E,request:T})=>{let A=qt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A.parts=Object.keys(A.parts).map(bt=>A.parts[Number(bt)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})}function $c(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=L.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||dr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Dc(o,{publicKey:i,baseURL:t=L.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=L.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=L.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",url:Gt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},data:mr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:d,request:u})=>{let h=qt(JSON.parse(c));if("error"in h)throw new st(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Fo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return Cn({check:d=>In(o,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Fc(o){return "defaultEffects"in o}var ye=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=L.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=Gt(t,`${r}/`),a=s?Gt(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=a,Fc(i)&&(this.defaultEffects=i.defaultEffects);}},Vc=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>Ic(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:E})=>Fo(E,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(E=>new ye(E,{baseCDN:b})),Nc=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>In(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new ye(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),_c=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return ur(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},zc=window.WebSocket,Lo=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Bc=(o,i)=>o==="success"?{status:ct.Success,...i}:o==="progress"?{status:ct.Progress,...i}:{status:ct.Error,...i},Uo=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Lo;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new zc(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,Bc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Io=null,Vo=o=>{if(!Io){let i=typeof window>"u"?0:3e4;Io=new Uo(o,i);}return Io},Hc=o=>{Vo(o).connect();};function Kc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return Cn({check:c=>Lc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case ct.Error:return new st(d.error,d.errorCode);case ct.Waiting:return false;case ct.Unknown:return new st(`Token "${o}" was not found.`);case ct.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case ct.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var jc=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Vo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};ur(t,()=>{l(),s(new ee("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case ct.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case ct.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case ct.Error:l(),s(new st(c.msg,c.error_code));}});}),Gc=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=L.pusherKey,metadata:E})=>Promise.resolve(Hc(w)).then(()=>Oc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:E})).catch(T=>(Vo(w)?.disconnect(),Promise.reject(T))).then(T=>T.type===Po.FileInfo?T:_c([({signal:A})=>Kc({token:T.token,publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:A}),({signal:A})=>jc({token:T.token,pusherKey:w,signal:A,onProgress:u})],{signal:d})).then(T=>{if(T instanceof st)throw T;return T}).then(T=>Fo(T.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(T=>new ye(T,{baseCDN:r})),Oo=new WeakMap,qc=async o=>{if(Oo.has(o))return Oo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return Oo.set(o,i),i},On=async o=>{if(hr(o)||pr(o))return o.size;if(fr(o))return (await qc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},Wc=(o,i=L.multipartMinFileSize)=>o>=i,Pn=o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Ue(o)&&t.test(o)},No=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Ue(o)&&t.test(o)},Zc=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(r[c]=u,n-=1,n?l():t(r));}).catch(u=>{s=true,e(u);});};for(let c=0;c<o;c++)l();}),Yc=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},Xc=async(o,i,t)=>e=>Yc(o,e,i,t),Qc=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>$c(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),Jc=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=L.multipartChunkSize,maxConcurrentRequests:E=L.maxConcurrentRequests,baseCDN:T,metadata:A})=>{let bt=e??await On(o),wt,de=(Q,lt)=>{if(!c)return;wt||(wt=Array(Q).fill(0));let St=Lt=>Lt.reduce((_t,uo)=>_t+uo,0);return Lt=>{Lt.isComputable&&(wt[lt]=Lt.value,c({isComputable:true,value:St(wt)/Q}));}};return b||=kn(o),Rc(bt,{publicKey:i,contentType:b,fileName:t||Mn(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:A,multipartChunkSize:w}).then(async({uuid:Q,parts:lt})=>{let St=await Xc(o,bt,w);return Promise.all([Q,Zc(E,lt.map((Lt,_t)=>()=>Qc(St(_t),Lt,{publicKey:i,contentType:b,onProgress:de(lt.length,_t),signal:l,integration:u,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>Dc(Q,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:Fo(Q.uuid,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new ye(Q,{baseCDN:T}))};async function _o(o,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:E,baseCDN:T=L.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:bt,pusherKey:wt,metadata:de}){if(Ue(o)){let Q=await On(o);return Wc(Q,b)?Jc(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T,metadata:de}):Vc(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T,metadata:de})}if(No(o))return Gc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:bt,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:wt,metadata:de});if(Pn(o))return Nc(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T});throw new TypeError(`File uploading from "${o}" is not supported`)}var tu=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return o}},Ro=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=L.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=tu(i.cdnUrl,t),this.files=e.map(r=>new ye(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},eu=o=>{for(let i of o)if(!Ue(i))return false;return true},iu=o=>{for(let i of o)if(!Pn(i))return false;return true},ru=o=>{for(let i of o)if(!No(i))return false;return true};function Ln(o,{publicKey:i,fileName:t,baseURL:e=L.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b=L.multipartChunkSize,baseCDN:w=L.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:T,jsonpCallback:A}){if(!eu(o)&&!ru(o)&&!iu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let bt,wt=true,de=o.length,Q=(lt,St)=>{if(!l)return;bt||(bt=Array(lt).fill(0));let Lt=_t=>_t.reduce((uo,Il)=>uo+Il)/lt;return _t=>{if(!_t.isComputable||!wt){wt=false,l({isComputable:false});return}bt[St]=_t.value,l({isComputable:true,value:Lt(bt)});}};return Promise.all(o.map((lt,St)=>Ue(lt)||No(lt)?_o(lt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(de,St),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:T}).then(Lt=>Lt.uuid):lt)).then(lt=>Uc(lt,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:r,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f}).then(St=>new Ro(St,{baseCDN:w})).then(St=>(l&&l({isComputable:true,value:1}),St)))}var ie=class{Ni=1;to=[];Vi=0;io=new Map;ro=new Map;constructor(i){this.Ni=i;}run(){let i=this.Ni-this.Vi;for(let t=0;t<i;t++){let e=this.to.shift();if(!e)return;let r=this.io.get(e),s=this.ro.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Vi+=1,e().finally(()=>{this.io.delete(e),this.ro.delete(e),this.Vi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.io.set(i,e),this.ro.set(i,r),this.to.push(i),t&&this.run();})}get pending(){return this.to.length}get running(){return this.Vi}set concurrency(i){this.Ni=i,this.run();}get concurrency(){return this.Ni}};var zo=()=>({}),Bo=o=>({...zo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Ho=o=>({...Bo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ie(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Un=o=>({...Ho(o),"*solution":null,"*lazyPlugins":null});var F=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var gr=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.Bc.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.i.api.setCurrentActivity(F.UPLOAD_LIST),this.i.api.setModalState(true);}async Bc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.He.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));r.length>0&&(r.forEach(n=>{this.i.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this.i.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var ou={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function hi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function Ko(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=ou[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function jo(o,i){return i.role==="toolbar"?nu(i):i.querySelectorAll(`[role=${o.role}]`)}function su(o,i){return Array.from(o).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}function nu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function au(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function Rn(o){return i=>{let t=false,e=300,r=0,s="";function n(u){let h=Ko(u.target);if(!h){a();return}let f=jo(u.target,h),g=su(f,h),b=Array.from(g).indexOf(u.target),w="ArrowDown",E="ArrowUp";if(au(h)&&(i.document.dir==="rtl"?(w="ArrowLeft",E="ArrowRight"):(w="ArrowRight",E="ArrowLeft")),u.key===w)u.preventDefault(),hi(u.target,g[b+1]||g[0]);else if(u.key===E)u.preventDefault(),hi(u.target,g[b-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),hi(u.target,g[0]);else if(u.key==="End")u.preventDefault(),hi(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),r=u.timeStamp;let T=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));T&&(u.preventDefault(),hi(u.target,T));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=Ko(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=jo(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=Ko(u.target);if(h){let f=jo(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function $n(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Dn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let d=o.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new o.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 o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Fn(o){let i,t=o.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Vn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var Go=class{constructor(){this.te=new Map;this.oo=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.oo.some(n=>n===s||n.contains(s))&&t(r);};this.te.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.te.get(t);e&&window.removeEventListener(i,e),this.te.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.oo.push(i);}destroy(){this.oo=[];for(let i of this.te.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.te.clear();}},vr=class{constructor(){this._i=new Go,this.nn=Vn(this._i,[Rn(),Fn("is-pressed"),Dn(),$n()]);}registerBlock(i){this._i.registerScope(i);}destroy(){this.nn?.(),this._i.destroy();}};var Wt=o=>`*l10n/${o}`,lu="en",yr=class extends j{constructor(t){super(t);this.Et="";for(let[r,s]of Object.entries(ui)){let n=this.e.has(Wt(r))?!this.e.read(Wt(r)):true;this.e.add(Wt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Et&&this.an(this.Et);})),this.addSub(this.e.sub(k("localeName"),async r=>{if(!r)return;this.Et=r;let s=await cn(r);r!==lu&&this.Et!==r||(this.an(r),this.ln(r,s));})),this.addSub(this.e.sub(k("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Et];s&&this.ln(this.Et,s);}));}ln(t,e){let r=this.He.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.e.add(Wt(s),a??n,true);}}an(t){let e=this.i.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.i18n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.e.add(Wt(c),d,true);}}};var cu=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},uu=()=>"capture"in document.createElement("input"),du=()=>({safariDesktop:cu()}),pu=()=>({htmlMediaCapture:uu()}),Nn=du(),_n=pu();var fi="image/*",qo="video/*",hu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],fu=()=>Nn.safariDesktop?[fi]:[fi,...hu],mi=fu(),br=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Z(i)):[],Wo=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),zn=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),Re=o=>{let i=o?.type;return i?Wo(i,mi):false};function Bn(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerI18n:c=>o.addI18n(e,c),registerConfig:c=>{o.addConfig(e,c);let d=k(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=k(c);return i.read(d)},subscribe:(c,d)=>{let u=k(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 mu=async({entries:o,signal:i})=>(await Promise.all(o.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),wr=class{constructor(i,t){this.e=i;this.Hc=t;this.Yt=new Set;this.cn=this.e.sub("*lazyPlugins",e=>{this.zc(e??[]);});}zc(i){for(let r of this.Yt)r();if(this.Yt.clear(),i.length===0)return;let t=new Set([k("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(k(s));let e=()=>this.un(i);for(let r of t)this.Yt.add(this.e.sub(r,e,false));this.un(i);}un(i){this.so?.abort();let t=new AbortController;this.so=t;let e=n=>this.e.read(k(n)),r=e("plugins"),s=mu({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.Hc(s);}destroy(){this.cn();for(let i of this.Yt)i();this.Yt.clear(),this.so?.abort();}};var Tr=class{constructor(){this.je=new Map;}register(i,t){if(this.je.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.je.set(t.name,e);}unregister(i){this.je.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.je)e.pluginId===i&&this.je.delete(t);}get(i){return this.je.get(i)}getAll(){return new Map(this.je)}};var Er=class{constructor(){this.Me=[];this.de=[];this.Bi=[];this.zi=[];this.Hi=[];this.Ki=[];this.config=new Tr;}xt(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.Me.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.Me.push(this.xt(i,t));}addActivity(i,t){let e=this.de.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.de.push(this.xt(i,t));}addFileAction(i,t){this.Bi.push(this.xt(i,t));}addFileHook(i,t){this.zi.push(this.xt(i,{timeout:3e4,...t}));}addIcon(i,t){this.Hi.push(this.xt(i,t));}addI18n(i,t){this.Ki.push(this.xt(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.Me=this.Me.filter(t=>t.pluginId!==i),this.de=this.de.filter(t=>t.pluginId!==i),this.Bi=this.Bi.filter(t=>t.pluginId!==i),this.zi=this.zi.filter(t=>t.pluginId!==i),this.Hi=this.Hi.filter(t=>t.pluginId!==i),this.Ki=this.Ki.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.Me],activities:[...this.de],fileActions:[...this.Bi],fileHooks:[...this.zi],icons:[...this.Hi],i18n:[...this.Ki]}}};var Cr=class extends j{constructor(t){super(t);this.Ge=new Map;this.c=new Set;this.ao=Promise.resolve();this.registry=new Er;this.dn=new wr(this.e,e=>{this.ao=this.ao.then(()=>e).then(r=>{if(r)return this.Kc(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.ao}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async Kc(t){let e=new Set(this.Ge.keys()),r=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(r.add(s.id),!this.Ge.has(s.id))try{await this.jc(s);}catch(n){this.registry.purge(s.id),this.lo(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.co(s);}async jc(t){this.Ge.has(t.id)&&this.co(t.id);let e=[],r=Bn(this.registry,this.e,this.i,t.id,e),s=this.i.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.w("Failed to unsubscribe config listener",c);}throw a}this.Ge.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.lo();}co(t){let e=this.Ge.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.w("Failed to unsubscribe config listener",s);}e.dispose?.(),this.Ge.delete(t),this.lo();}}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 s=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",Re(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.Ge.keys()))this.co(t);this.dn.destroy(),super.destroy();}lo(){for(let t of this.c)try{t();}catch{}}};function gu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Yo(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?Yo(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=gu(i);return typeof t=="object"&&t!==null?[e,Yo(t)]:[e,t]}))}function vu(o){return {ok:true,value:o}}function Zo(o){return {ok:false,error:o}}var yu="https://tlm.uploadcare.com/api/",Xo=class{constructor(i=yu){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Zo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return vu(s)}catch(s){return Zo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Zo(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(Yo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},bu=async(o,i)=>({success:true,data:i}),wu=async o=>bu(void 0,o),xr=class extends Xo{constructor(){super();}async sendEvent(i,t){let e=await wu(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 Tu=20,D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),M=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Sr=class extends j{constructor(){super(...arguments);this.Xt=new Map;this.ji=new Set;this.te=new Map;}bindTarget(t){return this.ji.add(t),()=>{this.ji.delete(t);}}on(t,e){let r=this.te.get(t);return r||(r=new Set,this.te.set(t,r)),r.add(e),()=>this.te.get(t)?.delete(e)}pn(t,e){for(let s of this.ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.te.get(t);if(r)for(let s of r)s(e);this.w?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,r={}){let{debounce:s}=r;if(typeof s!="number"&&!s){this.pn(t,typeof e=="function"?e():e);return}this.Xt.has(t)&&window.clearTimeout(this.Xt.get(t));let n=typeof s=="number"?s:Tu,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.pn(t,l),this.Xt.delete(t);}catch(l){this.w?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Xt.set(t,a);}destroy(){for(let t of this.Xt.values())window.clearTimeout(t);this.ji.clear(),this.te.clear();}};var Hn="1.29.0-alpha.2";var Ut="blocks",Rt=Hn;var Ar=class extends j{constructor(t){super(t);this.Gc=ft.generateRandomUUID();this.Ct=structuredClone(J);this.uo=false;this.po=null;this.Ie=false;this.hn=new xr,this.St=new ie(10),this.addSub(this.e.sub(k("qualityInsights"),e=>{this.Ie=!!e;}));for(let e of Object.keys(this.Ct))this.addSub(this.e.sub(k(e),r=>{this.Ie&&(this.uo&&this.Ct[e]!==r&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.qc(e,r));}));}Wc(t){t===D.INIT_SOLUTION&&!this.uo&&(this.uo=true);}qc(t,e){this.Ct[t]!==e&&(this.Ct[t]=e);}Zc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===D.INIT_SOLUTION||t.eventType===D.CHANGE_CONFIG)&&(r.config=this.Ct),{...r,appVersion:Rt,appName:Ut,sessionId:this.Gc,component:this.Yc,activity:this.Xc,projectPubkey:this.Ct.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Qc,payload:{location:this.Jc,...e}}}eu(t){return !!(t&&[M.CHANGE,M.COMMON_UPLOAD_PROGRESS,M.FILE_ADDED,M.FILE_REMOVED,M.FILE_UPLOAD_START,M.FILE_UPLOAD_PROGRESS,M.FILE_UPLOAD_SUCCESS,M.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Ie)return;let e=this.Zc({eventType:t.eventType,payload:t.payload,config:t.config});this.Wc(t.eventType),!(this.eu(t.eventType)||this.po&&this.mn(this.po,e))&&this.St.add(async()=>{this.po=e,await this.hn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}mn(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),s=Object.keys(e);if(r.length!==s.length)return false;for(let n of r)if(!Object.hasOwn(e,n)||!this.mn(t[n],e[n]))return false;return true}get Qc(){return Date.now()}get Yc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get Xc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get Jc(){return location.origin}};var Kn=o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var Cu=o=>o;var jn="plural:";function $e(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=Cu}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function Gn(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(jn)){let s=o.substring(t+2,e).replace(jn,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var qn="--uploadcare-blocks-window-height",gi=class o{static{this.clientsRegistry=new Set;}static{this.flush=$(()=>{document.documentElement.style.setProperty(qn,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(qn);}};var kr=(o,i)=>new Intl.PluralRules(o).select(i);var xu=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=kr(r,t);return e(`${i}__${s}`)},Mr=o=>{let i=xu(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(Wt(e))||e,a=Gn(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return $e(n,r)};return t};var Su=o=>o.tagName?.includes("-")??false,Ir=class{constructor(i){this.qe=new Set;this.Gi=new Map;this.gn=false;this.We=i,this.We.addController(this);}hostDisconnected(){this.qi?.(),this.qi=void 0,this.qe.clear(),this.Gi.clear();}hostUpdated(){if(!this.qi&&this.We.has(k("testMode"))){let i=this.We.subConfigValue("testMode",t=>{this.gn=!!t,this.vn();});this.qi=i;}this.tu(),this.vn();}tu(){let i=this.We,t=i.renderRoot??i;if(!t)return;let e=this.We,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Su(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.qe.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.qe.add(n),this.Gi.set(n,a);}for(let n of Array.from(this.qe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.qe.delete(n),this.Gi.delete(n));}vn(){if(!this.qe.size)return;let i=this.We.testId||"";for(let t of this.qe){let e=this.Gi.get(t);e&&(this.gn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Au=Ie(ir()(Me(Ji(Tt)))),C=class extends Au{constructor(){super();this.init$=zo();this.l10n=Mr(()=>this.sharedCtx);this.debugPrint=ar(()=>this.sharedCtx,this.constructor.name);this.i=bn(()=>this.sharedCtx);new Ir(this);}static{this.styleAttrs=[];}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),gi.registerClient(this);}initCallback(){this.Z("*blocksRegistry",()=>new Set),this.Z("*pluginManager",t=>new Cr(t)),this.Z("*eventEmitter",t=>new Sr(t)),this.Z("*localeManager",t=>new yr(t)),this.Z("*modalManager",t=>new lr(t)),this.Z("*a11y",()=>new vr),this.Z("*clipboard",t=>new gr(t)),this.Z("*telemetryManager",t=>new Ar(t)),this.sub(Wt("locale-id"),t=>{let e=Kn(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.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 blocksRegistry(){return this.ie("*blocksRegistry")}get eventEmitter(){return this.ie("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),gi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.iu(),H.deleteCtx(this.ctxName);}yn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Z(t,e){let r=this.yn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.i);this.add(t,s,true),r.set(t,s);return}}iu(){let t=this.yn();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}ie(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:sr(t),cdnUrlModifiers:Ao(t),fileName:or(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?$e(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.ze){let t={};this.ze=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=k(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=k(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.ze}subConfigValue(t,e){let r=k(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},gt=o=>(...i)=>({Gr:o,values:i}),Et=class{constructor(i){}get W(){return this.f.W}qr(i,t,e){this.Wi=i,this.f=t,this.ru=e;}Rc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var we=class extends Et{constructor(i){if(super(i),this.it=U,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.bn=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.bn;this.it=i;let t=[i];return t.raw=t,this.bn={Ve:this.constructor.resultType,strings:t,values:[]}}};we.directiveName="unsafeHTML",we.resultType=1;var vi=class extends we{};vi.directiveName="unsafeSVG",vi.resultType=2;var De=gt(vi);var Wn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Zt=class extends C{constructor(){super(...arguments);this.init$=Un(this);}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return v`${De(Wn)}`}};var Zn=o=>typeof o!="number"?0:Math.floor(o/1e3),Yn=(o,{threshold:i})=>{let{secureExpire:t}=o,e=Zn(Date.now()),r=Number(t),s=Zn(i);return e+s>=r};var Or=class extends j{constructor(){super(...arguments);this.Ze=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.He;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.Ze||Yn(this.Ze,{threshold:s})){this.Ze?this.w("Secure signature is expired. Resolving a new one..."):this.w("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.w("Secure signature resolved:",n),this.w("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Ze=n):(this.w("Secure signature resolver returned nothing."),this.Ze=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.i.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Ze}return t&&e?(this.w("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Ze=null;}};var Qo=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Jo=(o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}};var ts=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=br([...t?mi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=Wo(s,r),l=zn(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var es=(o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}};var Dt=1e3,Te=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),yi=o=>Math.ceil(o*100)/100,Xn=(o,i=Te.AUTO)=>{let t=i===Te.AUTO;if(i===Te.BYTE||t&&o<Dt**1){let r=kr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Te.KB||t&&o<Dt**2?`${yi(o/Dt**1)} KB`:i===Te.MB||t&&o<Dt**3?`${yi(o/Dt**2)} MB`:i===Te.GB||t&&o<Dt**4?`${yi(o/Dt**3)} GB`:i===Te.TB||t&&o<Dt**5?`${yi(o/Dt**4)} TB`:`${yi(o/Dt**5)} PB`};var is=(o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Xn(t)}),payload:{entry:o}}};var rs=(o,i)=>{let{internalId:t}=o;if(!i.v.hasItem(t))return;let r=i.v.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof st)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Le)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}};var Fe={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},ku=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Pr=class extends j{constructor(t){super(t);this.ou=[es,ts,is,rs];this.su=[Jo,Qo];this.St=new ie(20);this.wn=$(()=>{this.St.run();},500);this.Oe=false;this.At=new Map;let e=$(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(k("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(k("multipleMin"),e)),this.addSub(this.e.sub(k("multipleMax"),e)),this.addSub(this.e.sub(k("multiple"),e)),this.addSub(this.e.sub(k("imgOnly"),e)),this.addSub(this.e.sub(k("accept"),e)),this.addSub(this.e.sub(k("validationConcurrency"),r=>{this.St.concurrency=r;}));}get v(){return this.i.uploadCollection}runFileValidators(t,e){if(this.Oe)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.nu(n,t);}}runCollectionValidators(){if(this.Oe)return;let t=this.i.api,e=t.getOutputCollectionState(),r=[],s=this.He.collectionValidators;for(let n of [...this.su,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.Tn(a)),a.message||console.warn(Fe.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Fe.COLLECTION_VALIDATION_FAILED,a);}this.e.pub("*collectionErrors",r),r.length>0&&this.i.eventEmitter.emit(M.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.At.get(t.uid);e&&(e.abortController?.abort(),this.At.delete(t.uid));}async nu(t,e){if(this.Oe)return;let r=this.i.api,s=this.En(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Oe||(await n,this.Oe))return;let l=this.au(t,e);if(l.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.He.validationTimeout,h=this.xn(),f=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!f.has(w.validator)){let E=s.lastErrorThrownByValidator.get(w.validator);E&&g.push(E);}let b=l.map(w=>async()=>{if(this.Oe)return;let E=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(Fe.FILE_VALIDATION_TIMEOUT);},u);try{let T=await w.validator(c,r,{signal:d.signal});if(!T||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let A=this.Tn(T);s.lastErrorThrownByValidator.set(w.validator,A),g.push(A),T.message||console.warn(Fe.MISSING_ERROR_MESSAGE);}catch(T){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(Fe.FILE_VALIDATION_FAILED,T),this.i.telemetryManager.sendEventError(T,`file validator. ${Fe.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(E),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.wn(),await this.St.add(async()=>{this.Oe||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Tn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}En(t){let e=this.At.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.At.set(t.uid,r),r}xn(){let t=this.He.fileValidators;return [...this.ou,...t].map(ku)}au(t,e){let r=this.En(t);return this.xn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Oe=true,this.wn.cancel();for(let t of this.At.values())t.abortController?.abort(),t.promise=void 0;this.At.clear();}};var Qn="[Typed State] Wrong property name: ",Lr=class{constructor(i){this.J=ft.generateFastUid(),this.Y=H.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Y.has(i)){console.warn(`${Qn}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${Qn}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}destroy(){H.deleteCtx(this.J);}};var Ur=class o{constructor(i){this.Pe=Object.create(null);this.Zi=new Set;this.Yi=new Set;this.ye=new Set;this.ho=new Set;this.fo=new Set;this.kt=new Set;this.An=i.initialValue,this.J=ft.generateFastUid(),this.Y=H.registerCtx({},this.J),this.Cn=i.watchList||[];let t=Object.create(null);this.Sn=(e,r)=>{this.Qt&&window.clearTimeout(this.Qt),t[e]||(t[e]=new Set),t[e].add(r),this.Qt=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Zi.forEach(s=>{s({...t});}),t=Object.create(null));}),this.kn();},i.handler&&this.observeCollection(i.handler);}static{this.lu=1e4;}q(){this.Jt&&window.clearTimeout(this.Jt),this.Jt=window.setTimeout(()=>{let i=new Set(this.fo),t=new Set(this.ho);this.fo.clear(),this.ho.clear();for(let e of this.Yi)e?.([...this.ye],i,t);this.kn();});}kn(){this.kt.size!==0&&(this.ei&&window.clearTimeout(this.ei),this.ei=window.setTimeout(()=>{let i=[...this.kt];this.kt.clear();for(let t of i)t.destroy();},o.lu));}observeCollection(i){return this.Yi.add(i),this.ye.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Yi.delete(i);}add(i){let t=new Lr(this.An);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.ye.add(t.uid),this.q(),this.Y.add(t.uid,t),this.fo.add(t),this.Cn.forEach(e=>{this.Pe[t.uid]||(this.Pe[t.uid]=[]),this.Pe[t.uid]?.push(t.subscribe(e,()=>{this.Sn(e,t.uid);}));}),t.uid}hasItem(i){return this.ye.has(i)}read(i){return this.Y.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.ho.add(t),this.kt.add(t)),this.ye.delete(i),this.q(),this.Y.pub(i,void 0),this.Pe[i]?.forEach(e=>{e();}),delete this.Pe[i];}clearAll(){this.ye.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Zi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Zi.delete(i);}findItems(i){let t=[];return this.ye.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.ye]}get size(){return this.ye.size}destroy(){this.Qt&&window.clearTimeout(this.Qt),this.Jt&&window.clearTimeout(this.Jt),this.ei&&window.clearTimeout(this.ei);for(let i of this.kt)i.destroy();this.kt.clear(),H.deleteCtx(this.J),this.Zi=new Set,this.Yi=new Set;for(let i of Object.keys(this.Pe))this.Pe[i]?.forEach(t=>{t();}),delete this.Pe[i];}};var P=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Ct=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Jn=o=>({isVideoRecordingEnabled:K(o.cameraModes).includes(P.VIDEO),isPhotoEnabled:K(o.cameraModes).includes(P.PHOTO)});var ta=(o,i)=>{for(let t of o)if(i(t))return t};var os=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Rr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var Mu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Iu=new RegExp(`^/?(${Mu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ea=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(pi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Iu.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var ut=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Ou=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),N=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Ou,...ut}),Pu={[ut.DROPBOX_CHOOSER]:ut.DROPBOX},ia=o=>Pu[o]??o;var $r=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function ra(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var oa=new Set;function Dr(o){oa.has(o)||(oa.add(o),console.warn(o));}function Lu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Dr(o),e(...r)))}function sa(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>$r(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=Lu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=ra(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var Fr=class extends j{constructor(){super(...arguments);this.cu=Mr(()=>this.e);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??N.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??N.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ea({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??N.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.v.add({file:t,isImage:Re(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??N.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);};this.uploadAll=()=>{let t=this.v.items().filter(e=>{let r=this.v.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.i.eventEmitter.emit(M.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Ht(br([this.cfg.accept??"",...this.cfg.imgOnly?mi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Rr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Jn(this.cfg);t.modeCamera===P.PHOTO&&n?s.accept=fi:t.modeCamera===P.VIDEO&&a?s.accept=qo:s.accept=[fi,a&&qo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?N.CAMERA:N.LOCAL});}),this.e.pub("*currentActivity",F.UPLOAD_LIST),this.i.modalManager?.open(F.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.v.size>0&&!t)this.e.pub("*currentActivity",F.UPLOAD_LIST),this.i.modalManager?.open(F.UPLOAD_LIST);else if(this.Mn?.length===1){let e=this.Mn[0];this.mo().then(()=>{let r=this.i.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.e.pub("*currentActivity",F.START_FROM),this.i.modalManager?.open(F.START_FROM));return}this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));});}else this.e.pub("*currentActivity",F.START_FROM),this.i.modalManager?.open(F.START_FROM);};this.doneFlow=()=>{let t=ta(this.i.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.i.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.mo().then(()=>{this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t),os(this.i.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.i.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.e.read("*currentActivity");this.historyBack=()=>{this.e.read("*historyBack")?.();};this.setModalState=t=>{this.mo().then(()=>{if(!t){this.i.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null);return}let e=this.e.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return os(this.i.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.i.modalManager?.open(e);})});};}get v(){return this.i.uploadCollection}get cfg(){return this.He}get l10n(){return this.cu}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=H.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,s=r.fileInfo,n=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:s?.uuid??r.uuid??null,internalId:t,name:s?.originalFilename??r.fileName,size:s?.size??r.fileSize,isImage:s?.isImage??r.isImage,mimeType:s?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??s?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:s??null,metadata:r.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return sa(this.i)}async mo(){return (await this.i.wait("pluginManager")).pluginsReady()}get Mn(){let t=[];return this.cfg.sourceList&&(t=Z(this.cfg.sourceList)),t}};var na={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var bi=33.333333333333336,I=1,ss=24,aa=6;function se(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function vt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return se(t,i),t}function la(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,r+l*n+1.5*d],f=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function ca(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,g;a?(f=[e+c*s-34*t/2,r+d*n+1.5*h],g=[e+c*s+34*t/2,r+d*n+1.5*h]):(f=[e+c*s+1.5*u,r+d*n-34*t/2],g=[e+c*s+1.5*u,r+d*n+34*t/2]);let b=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,w=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:b,center:w}}function ua(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function da({rect:o,delta:[i,t],imageBox:e}){return Ne({...o,x:o.x+i,y:o.y+t},e)}function Ne(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}function Uu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<I&&(a=I,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<I&&(n=I,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Ru({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<I&&(a=I,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<I&&(n=I,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function $u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<I&&(a=I,t&&(n=a*t),l=o.x+o.width/2-n/2),n<I&&(n=I,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Du({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<I&&(a=I,t&&(n=a*t),l=o.y+o.height/2-a/2),n<I&&(n=I,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Fu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.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=o.y+o.height-c)),c<I&&(c=I,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<I&&(l=I,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Vu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.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=o.y+o.height-c)),c<I&&(c=I,t&&(l=c*t),a=o.y+o.height-c),l<I&&(l=I,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.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=o.y)),c<I&&(c=I,t&&(l=c*t),n=o.x+o.width-l),l<I&&(l=I,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function _u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.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=o.y)),c<I&&(c=I,t&&(l=c*t)),l<I&&(l=I,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function pa({direction:o,...i}){switch(o){case "n":return Uu(i);case "w":return Ru(i);case "s":return $u(i);case "e":return Du(i);case "nw":return Fu(i);case "ne":return Vu(i);case "sw":return Nu(i);case "se":return _u(i);default:return i.rect}}function ha(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function fa(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}function ma(o,i){return Math.abs(o.width/o.height-i)<.1}function _e({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function ga(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function ze(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function ne(o,i,t){return Math.min(Math.max(o,i),t)}var wi=["free"],Nr=o=>{let i=Z(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!wi.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!wi.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:ft.generateFastUid(),type:"aspect-ratio",width:wi.includes(r)?0:n,height:wi.includes(r)?0:a,hasFreeform:wi.includes(r)});}return t},va=(o,i,t,e=.1)=>{let r=o/i,s=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,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function ya(o){return $o({...o,libraryName:Ut,libraryVersion:Rt})}var ba="active",Be="___ACTIVITY_IS_ACTIVE___",wa,x=class o extends(wa=C,wa){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Bo(this);this.uu=$(this.du.bind(this),10);}In(){let t=o.ti.get(this);this[Be]=false,this.removeAttribute(ba),t?.deactivateCallback?.();}pu(){let t=o.ti.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Be]=true,this.setAttribute(ba,""),t?.activateCallback?.(),this.uu(),this.emit(M.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Be]?this.In():this.activityType===t&&!this[Be]&&this.pu();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}du(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}On(){return !!this.activityType&&o.ti.has(this)}static{this.ti=new Map;}get isActivityActive(){return !!this[Be]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ti.set(this,{activateCallback:r,deactivateCallback:s});}hu(){this.isActivityActive&&this.In(),o.ti.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.On()&&this.hu();}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};x.activities=F;var R=class o extends x{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Xi=false;this.init$=Ho(this);this.yo=$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.yu(e);},300);this.gu=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(M.FILE_ADDED,this.api.getOutputItem(s.uid)),this.i.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(M.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Rn(),this.yo();}};this.vu=t=>{if(!this.isConnected)return;this.yo();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!H.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Rn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.bu();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(M.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(M.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(M.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(M.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Rn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(M.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get fu(){return this.hasBlockInCtx(t=>t instanceof o?t.Xi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Z("*uploadCollection",()=>new Ur({initialValue:na,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Z("*secureUploadsManager",t=>new Or(t)),this.Z("*validationManager",t=>new Pr(t)),this.Z("*publicApi",t=>new Fr(t)),!this.fu&&this.couldBeCtxOwner&&this.mu();}getAPI(){return this.api}get validationManager(){return this.ie("*validationManager")}get api(){return this.ie("*publicApi")}get uploadCollection(){return this.ie("*uploadCollection")}get secureUploadsManager(){return this.ie("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Xi&&this.Pn(),this.yo.cancel();}connectedCallback(){super.connectedCallback(),this.Xi&&this.Ln();}mu(){this.Xi=true,this.Ln(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ln(){this.Pn(),this.go=this.uploadCollection.observeCollection(this.gu),this.vo=this.uploadCollection.observeProperties(this.vu);}Pn(){this.vo?.(),this.go?.(),this.vo=void 0,this.go=void 0;}async yu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await Ln(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(M.GROUP_CREATED,a),this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}bu(){let t=Nr(this.cfg.cropPreset);if(!t)return;let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=ga(a,l,c),u=rt(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:W(h,u)});}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:ya,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return $r(this.i)}};R.extSrcList=Object.freeze({...ut});R.sourceTypes=Object.freeze({...N});var ae=class extends C{constructor(){super(...arguments);this.name="";this.Qi="";this.ii=null;this.Un=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Un=e,this.bo();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.bo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.bo();}bo(){if(!this.name){this.Qi="",this.ii=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ii=e.svg,this.Qi="";return}this.ii=null;let r=`#uc-icon-${this.name}`,s=this.Un?.(this.name);this.Qi=s??r;}render(){return this.ii?v`${this.yield("",v`${De(this.ii)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Qi}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([y({type:String})],ae.prototype,"name",2),p([m()],ae.prototype,"Qi",2),p([m()],ae.prototype,"ii",2);var Ta=o=>[...new Set(o)];var Ee="--uc-img-",ns="unresolved";var as=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ls=3e3,cs=5e3,us=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var zu="https://ucarecdn.com",He=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:zu},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var _r=class extends Me(Ie(Tt)){constructor(){super();this.Mt={};this.c=new Map;this.It=null;this.Ji=null;for(let t in He){let e=He[t];this.Mt[Ee+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Mt[Ee+t]}set$$(t){for(let e in t){let r=Ee+e,s=t[e];this.Mt[r]=s,this.q(r,s);}}sub$$(t,e){let r=Ee+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Mt[r];s!==null&&s!==""&&e(s);}q(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Ut}/${Rt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;He[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.It=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.It?.unobserve(t));});},r),this.It.observe(t),this.Ji||(this.Ji=new Set),this.Ji.add(t);}connectedCallback(){super.connectedCallback(),this.wu();}wu(){for(let t in He){let e=Ee+t,r=this.getCssData(e,true);r!=null&&(this.Mt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.It&&(this.Ji?.forEach(t=>{this.It?.unobserve(t);}),this.It=null),this.c.clear();}static get observedAttributes(){return Object.keys(He)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ee+t;this.Mt[s]=r,this.q(s,r);});}};var Ea=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Hr=class extends _r{constructor(){super(...arguments);this.be=new Image;this.pe=new Image;}$n(t){return !t.includes("//")&&!as&&(t=new URL(t,document.baseURI).href),t}er(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>cs&&this.Dn?cs+s:Number(n)>ls&&!this.Dn?ls+s:t}Tu(t,e){let r={format:this.wo("format"),quality:this.wo("quality"),resize:this.er(t),blur:e,"cdn-operations":this.wo("cdn-operations")??void 0,analytics:this.analyticsParams()};return rt(...Ea(r))}wo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}re(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(as&&r&&!r.includes("//"))return this.ri(r);let s=this.Tu(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return W(r,s);let l=this.$$("uuid");if(a&&l)return this.ri(W(Jt(a,l),s));if(l)return this.ri(W(Jt(a,l),s));let c=this.$$("proxy-cname");if(c)return this.ri(W(c,s,this.$n(r)));let d=this.$$("pubkey");if(d)return this.ri(W(`https://${d}.ucr.io/`,s,this.$n(r)))}ri(t){let e=this.$$("secure-delivery-proxy");return e?$e(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Ot(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Eu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.we||(this.To({elNode:this.be}),this.appendChild(this.be)),this.be}get tr(){return this.we?{type:us.PREVIEW,img:this.pe}:{type:us.MAIN,img:this.img}}get we(){return this.$$("is-preview-blur")}get Fn(){return this.$$("is-background-for")}get Nn(){let t=this.$$("breakpoints");if(t){let e=Z(t);return Ta(e.map(r=>parseInt(r,10)))}else return null}get Dn(){return this.$$("format").toLowerCase()==="jpeg"}Vn(t){let e=new Set;e.add(`url("${this.re(this.Ot(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.re(this.Ot(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.re(this.Ot(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}_n(){let t=new Set;return this.Nn?this.Nn.forEach(e=>{t.add(`${this.re(`${e}x`)} ${this.er(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.re(`${e*2}x`)} ${this.er(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.re(`${e*3}x`)} ${this.er(`${e*3}w`)}`);}):(t.add(`${this.re(this.Ot(this.tr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,3))} 3x`)),[...t].join()}Bn(){return this.re()}get zn(){return this.re("100x","100")}xu(){let t=this.Fn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Vn(e);}):this.Vn(e);});}Cu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}To({elNode:t}){this.Eu(t),this.initAttributes(t);}Eo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.To({elNode:r}),r.setAttribute(ns,""),r.addEventListener("load",()=>{r.removeAttribute(ns),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Cu({elNode:r,src:t,srcset:e});})}async Su(){if(this.$$("intersection")){this.we&&(this.To({elNode:this.pe}),this.appendChild(this.pe)),this.initIntersection(this.tr.img,async()=>{this.we&&(this.pe.src=this.zn);try{await this.Eo({src:this.Bn(),srcset:this._n(),elNode:this.be}),this.we&&await this.pe.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}});return}try{this.we&&(await this.Eo({src:this.zn,elNode:this.pe}),this.appendChild(this.pe)),await this.Eo({src:this.Bn(),srcset:this._n(),elNode:this.be}),this.we&&await this.pe?.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}}init(){this.Fn?this.xu():this.Su();}};var ds=class extends Hr{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Bu}=en,Ca=o=>o;var Sa=o=>o.strings===void 0,xa=()=>document.createComment(""),Ke=(o,i,t)=>{let e=o.ve.parentNode,r=i===void 0?o.bt:i.ve;if(t===void 0){let s=e.insertBefore(xa(),r),n=e.insertBefore(xa(),r);t=new Bu(s,n,o,o.options);}else {let s=t.bt.nextSibling,n=t.f,a=n!==o;if(a){let l;t.Au?.(o),t.f=o,t.Ri!==void 0&&(l=o.W)!==n.W&&t.Ri(l);}if(s!==r||a){let l=t.ve;for(;l!==s;){let c=Ca(l).nextSibling;Ca(e).insertBefore(l,r),l=c;}}}return t},le=(o,i,t=o)=>(o.ce(i,t),o),Hu={},Aa=(o,i=Hu)=>o.r=i,ka=o=>o.r,Kr=o=>{o.wt(),o.ve.remove();};var Ti=(o,i)=>{let t=o.le;if(t===void 0)return false;for(let e of t)e.Gs?.(i,false),Ti(e,i);return true},jr=o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.le,t.delete(o),o=i;}while(t?.size===0)},Ma=o=>{for(let i;i=o.f;o=i){let t=i.le;if(t===void 0)i.le=t=new Set;else if(t.has(o))break;t.add(o),Gu(i);}};function Ku(o){this.le!==void 0?(jr(this),this.f=o,Ma(this)):this.f=o;}function ju(o,i=false,t=0){let e=this.r,r=this.le;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ti(e[s],false),jr(e[s]);else e!=null&&(Ti(e,false),jr(e));else Ti(this,o);}var Gu=o=>{o.type==$t.CHILD&&(o.Ri??=ju,o.Au??=Ku);},Gr=class extends Et{constructor(){super(...arguments),this.le=void 0;}qr(i,t,e){super.qr(i,t,e),Ma(this),this.isConnected=i.W;}Gs(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ti(this,i),jr(this));}setValue(i){if(Sa(this.Wi))this.Wi.ce(i,this);else {let t=[...this.Wi.r];t[this.ru]=i,this.Wi.ce(t,this,0);}}disconnected(){}reconnected(){}};var S=()=>new hs,hs=class{},ps=new WeakMap,O=gt(class extends Gr{render(o){return U}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),U}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ps.get(i);t===void 0&&(t=new WeakMap,ps.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?ps.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 fs=null,Ei=class extends C{constructor(){super(...arguments);this.dialogEl=S();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.ku=()=>{this.closeDialog();};this.Mu=t=>{this.xo=t.target;};this.Iu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.xo&&this.closeDialog();};this.oi=({id:t})=>{t===this.id?(fs=t,this.show(),this.emit(M.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.si=({id:t})=>{t===this.id&&(this.hide(),this.emit(M.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Hn=t=>{this.hide(),fs===this.id&&this.emit(M.MODAL_CLOSE,{modalId:fs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(Y.OPEN,this.oi),this.modalManager?.subscribe(Y.CLOSE,this.si),this.modalManager?.subscribe(Y.CLOSE_ALL,this.Hn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.xo=void 0,this.modalManager?.unsubscribe(Y.OPEN,this.oi),this.modalManager?.unsubscribe(Y.CLOSE,this.si),this.modalManager?.unsubscribe(Y.CLOSE_ALL,this.Hn);}Ou(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.ku),this.dialogEl.value?.addEventListener("mousedown",this.Mu),this.dialogEl.value?.addEventListener("mouseup",this.Iu);}render(){return v`<dialog ${O(this.Ou)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ei.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ei.prototype,"blockBodyScrolling",2);var qr=class extends R{constructor(){super(...arguments);this.z=null;this.ir=null;}get Kn(){return this.nameAttrValue??this.ctxName}jn(){let t=document.createElement("input");return t.type="text",t.name=this.Kn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Rr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.jn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.ir){let n=document.createElement("div");this.appendChild(n),this.ir=n;}if(!this.z){let n=this.jn();this.appendChild(n),this.z=n;}if(this.ir.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.Kn}[]`,a.value=n,s.appendChild(a);}this.ir.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],qr.prototype,"nameAttrValue",2);var ms=class extends C{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var je=class extends C{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.oe=0;this.rr=S();this.Gn=()=>{let t=this.rr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.oe>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.oe=this.Co(this.value),this.So(),this.rr.value?.addEventListener("animationiteration",this.Gn);}updated(t){if(super.updated(t),t.has("value")){let e=this.Co(this.value);if(!this.visible)this.oe=e;else {let r=Math.max(this.oe,e);r!==this.oe&&(this.oe=r,this.So());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.So():this.oe=this.Co(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.rr.value?.removeEventListener("animationiteration",this.Gn);}Co(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}So(){this.visible&&this.style.setProperty("--l-progress-value",this.oe.toString());}render(){return v`<div ${O(this.rr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],je.prototype,"hasFileName",2),p([y({type:Number})],je.prototype,"value",2),p([y({type:Boolean,reflect:true})],je.prototype,"visible",2);var Ci=class extends R{constructor(){super();this.he=false;this.Pt=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Ao=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.he=t;}),this.sub("*commonProgress",t=>{this.Pt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.he?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Ao?.(),this.Ao=void 0;}render(){return v`<uc-progress-bar .value=${this.Pt} .visible=${this.he}></uc-progress-bar>`}};p([m()],Ci.prototype,"he",2),p([m()],Ci.prototype,"Pt",2);var Ge=class extends C{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Pu=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return v`<select @change=${this.Pu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Ge.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ge.prototype,"disabled",2),p([y({type:Array,attribute:false})],Ge.prototype,"options",2);var qe=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ko="default";this.Mo="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Lu(this.source);}Lu(t){if(!t){this.Mo="",this.ko="default";return}let{label:e,icon:r,id:s}=t;this.Mo=e,this.ko=r??s??"default";}activate(){this.source&&this.source.onClick();}render(){return v`<button type="button" @click=${this.activate}><uc-icon name=${this.ko}></uc-icon><div class="uc-txt">${this.l10n(this.Mo)}</div></button>`}};p([y({attribute:false})],qe.prototype,"source",2),p([m()],qe.prototype,"ko",2),p([m()],qe.prototype,"Mo",2);var xi=class extends R{constructor(){super(...arguments);this.qn=[];this.Me=[];this.wrap=false;}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{this.qn=Z(e),this.Wn();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Wn()));}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Wn(){let e=this.i.pluginManager?.snapshot().sources??[],r=new Map(e.map(n=>[n.id,n])),s=[];this.qn.forEach(n=>{let a=this.Ru(n,r);if(a.length!==1||a[0]!==n){for(let d of a){let u=r.get(d);u&&s.push(this.Zn(u));}return}let c=r.get(n);c&&s.push(this.Zn(c));}),this.Me=s;}Ru(t,e){let r=e.get(t);return r?.expand?r.expand():[t]}Zn(t){return {id:t.id,label:t.label,icon:t.icon,onClick:()=>t.onSelect()}}render(){return v`${this.Me.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([m()],xi.prototype,"Me",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],xi.prototype,"wrap",2);var gs=class extends C{render(){return v`<div class="uc-spinner"></div>`}};var It="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ce(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=It);}}}function Si(o){let i=[];for(let s of o){let n=Ce(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function vs(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var We=class extends R{constructor(){super(...arguments);this.or=new Set;this.entry=null;}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.or.add(a);})(t,e);}reset(){for(let t of this.or)t();this.or=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.or=new Set;}};function qu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function Wr(o="hsl(209, 21%, 65%)",i=32,t=32){return qu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}var Wu=3e3,Ze=class extends We{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Le="";this.Yn=false;this.sr=null;this.Xn=false;this.Uu=this.cfg.filesViewMode;this.Qn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.$u(e);if(r&&s&&n){let d=await this.proxyUrl(W(Jt(this.cfg.cdnCname,n),rt(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Ce(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let f=await vs(h,l);t.setValue("thumbUrl",f);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(f));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await vs(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(d));}});this.nr=$(this.Qn.bind(this),100);}$u(t=false){t&&(this.sr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.sr?.height||0),10),parseInt(String(this?.sr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Wu)}Du(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=It,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Oo(){this.Io?.cancel(),this.Io=void 0;}Fu(t){if(this.Oo(),!t){this.Le&&(this.Le="");return}if(t===this.Le)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this.Io=r,this.Du(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Le=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}ar(t=false){if(this.entry){if(t){this.Qn(true);return}this.Xn&&this.nr();}}firstUpdated(t){super.firstUpdated(t),this.Jn();}updated(t){super.updated(t),t.has("uid")&&this.Jn();}ni(t){let[e]=t;e&&(this.Xn=e.isIntersecting,e.isIntersecting&&(this.sr=e.boundingClientRect,this.ar(),this.s?.disconnect()),e.intersectionRatio===0&&this.nr.cancel());}reset(){super.reset(),this.nr.cancel(),this.Oo(),this.Le&&(this.Le="");}Jn(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=()=>{this.ar();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Fu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.ar(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.Yn&&(this.Uu==="list"&&this.ar(true),this.Yn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.nr.cancel(),this.Oo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Le||It} role="img" alt="Preview of uploaded image" ?hidden=${!this.Le} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],Ze.prototype,"badgeIcon",2),p([y({attribute:false})],Ze.prototype,"uid",2),p([m()],Ze.prototype,"Le",2);var ys=class extends x{};var bs=class extends x{constructor(){super(...arguments);this.historyTracked=true;this.activityType=x.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var ws=class extends R{constructor(){super(...arguments);this.ea=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=M;}initCallback(){super.initCallback(),this.ea=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ea?.();}};var Ye=(o,i)=>{let t=false,e,r=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var Ia=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ai=gt(class extends Et{constructor(o){if(super(o),o.type!==$t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=ka(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=r.length-1,f=0,g=s.length-1;for(;u<=h&&f<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===n[f])l[f]=le(r[u],s[f]),u++,f++;else if(a[h]===n[g])l[g]=le(r[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=le(r[u],s[g]),Ke(o,l[g+1],r[u]),u++,g--;else if(a[h]===n[f])l[f]=le(r[h],s[f]),Ke(o,r[u],r[h]),h--,f++;else if(c===void 0&&(c=Ia(n,f,g),d=Ia(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[f]),w=b!==void 0?r[b]:null;if(w===null){let E=Ke(o,r[u]);le(E,s[f]),l[f]=E;}else l[f]=le(w,s[f]),Ke(o,r[u],w),r[b]=null;f++;}else Kr(r[h]),h--;else Kr(r[u]),u++;for(;f<=g;){let b=Ke(o,l[g+1]);le(b,s[f]),l[f++]=b;}for(;u<=h;){let b=r[u++];b!==null&&Kr(b);}return this.ut=n,Aa(o,l),it}});var X=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),G=class G extends We{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ta=true;this.uid="";this.Po="";this.Lo="";this.Ro="";this.oe=0;this.ia=false;this.Uo="";this.ra=false;this.oa=false;this.sa=false;this.na=false;this.lr=false;this.aa="";this.cr=[];this.la=false;this.Nu=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Vu=()=>{this.ca();};this.S=$(()=>this.ua(),100);this.Bu=this.withEntry(Ye((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===X.FINISHED,l=e===X.UPLOADING,c=e===X.QUEUED_UPLOADING,d=e===X.QUEUED_VALIDATION,u=e===X.VALIDATION,h=t.getValue("fileName"),f="";r?f="":!a&&n&&s&&Object.values(ut).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${ia(s)}`)})),this.Ro=f,this.Lo=r,this.ia=l||c||d||u,this.oe=d||u?0:t.getValue("uploadProgress"),this.aa=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.ca=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.S();try{let r=new AbortController;t.setValue("abortController",r);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.i.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of h)try{let g=f.handler({file:a,signal:r.signal}),b=new Promise((E,T)=>setTimeout(()=>T(new Error("beforeUpload hook timed out")),f.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",Re(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),_o(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.S();}catch(r){let s=r instanceof ee&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof ve?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.S(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}ua(){let t=this.entry;if(!t)return;let e=X.IDLE;t.getValue("errors").length>0?e=X.FAILED:t.getValue("isQueuedForUploading")?e=X.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=X.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=X.VALIDATION:t.getValue("isUploading")?e=X.UPLOADING:t.getValue("fileInfo")&&(e=X.FINISHED),this._u(t,e);}_u(t,e){e===X.FAILED?this.Uo="badge-error":e===X.FINISHED&&(this.Uo="badge-success"),e===X.UPLOADING&&(this.na=false,this.removeAttribute("focused")),this.oa=e===X.FAILED,this.sa=e===X.UPLOADING,this.ra=e===X.FINISHED,this.Bu(e);}reset(){super.reset(),this.S.cancel();}ni(t){let[e]=t;e&&e.isIntersecting&&!this.la&&(this.ta=false,this.la=true);}da(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.Ye();return}this.subEntry("isQueuedForValidation",()=>{this.S();}),this.subEntry("isValidationPending",()=>{this.S();}),this.subEntry("uploadProgress",()=>{this.S();}),this.subEntry("isQueuedForUploading",()=>{this.S();}),this.subEntry("fileName",r=>{this.Po=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.Po=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.S();}),this.subEntry("errors",()=>this.S()),this.subEntry("isUploading",()=>this.S()),this.subEntry("fileSize",()=>this.S()),this.subEntry("mimeType",()=>this.S()),this.subEntry("isImage",()=>this.S()),this.subEntry("fileInfo",()=>this.Ye()),this.subEntry("isUploading",()=>this.Ye()),this.subEntry("errors",()=>this.Ye()),this.ua(),this.Ye();}pa(t){if(this.cfg.filesViewMode==="list"){this.lr=true;return}this.lr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.da(this.uid);}Ye(){let t=this.i.pluginManager;if(!t||!this.uid){this.cr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.cr=[];return}this.cr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}zu(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e)try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}initCallback(){super.initCallback(),this.da(this.uid),this.subConfigValue("filesViewMode",e=>{this.pa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.pa(e);}),this.onclick=()=>{G.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.ca());});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ye())),this.Ye(),G.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),G.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ta?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.ra} ?data-uploading=${this.sa} ?data-failed=${this.oa} ?data-focused=${this.na} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Uo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.aa}><span class="uc-file-name" ?hidden=${!this.lr}>${this.Po}</span><span class="uc-file-error" ?hidden=${!this.Lo}>${this.Lo}</span><span class="uc-file-hint" ?hidden=${!this.Ro}>${this.Ro}</span></div><div class="uc-file-actions">${this.cr.map(t=>v`<button type="button" @click=${()=>this.zu(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<button type="button" @click=${this.Nu} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Vu}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.oe} .visible=${this.ia} ?hasFileName=${this.lr}></uc-progress-bar></div>`}};p([m()],G.prototype,"ta",2),p([y({attribute:false})],G.prototype,"uid",2),p([m()],G.prototype,"Po",2),p([m()],G.prototype,"Lo",2),p([m()],G.prototype,"Ro",2),p([m()],G.prototype,"oe",2),p([m()],G.prototype,"ia",2),p([m()],G.prototype,"Uo",2),p([m()],G.prototype,"ra",2),p([m()],G.prototype,"oa",2),p([m()],G.prototype,"sa",2),p([m()],G.prototype,"na",2),p([m()],G.prototype,"lr",2),p([m()],G.prototype,"aa",2),p([m()],G.prototype,"cr",2);var Ts=G;function Zu(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function Yu(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Oa(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(Yu(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(Zu(a).then(l=>{l||i.push({type:"file",file:a});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}var nt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Pa=["focus"],Xu=100,Es=new Map;function Qu(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}function Cs(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=nt.INACTIVE,n=g=>{o.shouldIgnore()&&g!==nt.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(nt.INACTIVE);},c=()=>{i+=1,s===nt.INACTIVE&&n(nt.ACTIVE);},d=()=>{i-=1,a()||n(nt.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(nt.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),E=Math.floor(Qu(b,w)),T=E<Xu,A=g.composedPath().includes(o.element);Es.set(o.element,E);let wt=Math.min(...Es.values())===E;A&&wt?(g.preventDefault(),n(nt.OVER)):n(T&&wt?nt.NEAR:nt.ACTIVE);},f=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Oa(b);o.onItems(w),n(nt.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",f),Pa.forEach(g=>{window.addEventListener(g,l);}),()=>{Es.delete(o.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",f),Pa.forEach(g=>{window.removeEventListener(g,l);});}}var xs=new Set,dt=class extends R{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ie=true;this.ha=true;this.$o="drop-files-here";this.fa=false;this.ga=null;this.Do=null;this.va=S();this.Lt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.ya=true;this.Rt=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.$o=this.l10n(t)||t;return}this.$o=this.fa?this.l10n("drop-files-here"):this.l10n("drop-file-here");}isActive(){if(!this.Ie)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),xs.add(this),this.Fo(),this.No(),this.ba(),this.wa(nt.INACTIVE),this.ga=Cs({element:this,shouldIgnore:()=>this.Ta(),onChange:t=>{this.wa(t);},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:N.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:N.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this.modalManager?.open(x.activities.UPLOAD_LIST)));}}),this.updateComplete.then(()=>this.Hu()),this.subConfigValue("sourceList",t=>{let e=Z(t);this.ya=e.includes(N.LOCAL),this.Fo(),this.No();}),this.subConfigValue("multiple",t=>{this.fa=!!t,this.ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Fo(),this.No()),(t.has("text")||t.has("localeId"))&&this.ma();}updated(t){super.updated(t),t.has("clickable")&&this.ba();}Ta(){if(!this.Ie||!this.Ku())return true;if(!this.fullscreen)return false;let t=xs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}Ku(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Fo(){let t=this.ya&&!this.disabled;this.Ie=t;}No(){let t=this.Ie||!this.querySelector("[data-default-slot]");this.ha=t,this.hidden=!t;}wa(t){let e=Object.entries(nt).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}Hu(){if(this.Do)return;let t=this.va.value;t&&(this.Do=Cs({element:t,onChange:e=>{let r=Object.entries(nt).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.Ta()}));}ba(){this.clickable&&!this.Rt?(this.addEventListener("keydown",this.Lt),this.addEventListener("click",this.Lt),this.Rt=true):!this.clickable&&this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}disconnectedCallback(){super.disconnectedCallback(),xs.delete(this),this.ga?.(),this.Do?.(),this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.va)} class="uc-content-wrapper" ?hidden=${!this.ha}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.$o}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],dt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],dt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],dt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],dt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],dt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],dt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],dt.prototype,"initflow",2),p([y({type:String})],dt.prototype,"text",2),p([m()],dt.prototype,"Ie",2),p([m()],dt.prototype,"ha",2),p([m()],dt.prototype,"$o",2);var Ot=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=x.activities.UPLOAD_LIST;this.Ea=false;this.xa=false;this.Ca=false;this.Vo=false;this._o=false;this.ur=null;this.Sa=false;this.Bo=null;this.Aa=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.zo=()=>{this.emit(M.UPLOAD_CLICK),this.api.uploadAll(),this.Te();};this.Ho=()=>{this.emit(M.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ee=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Te=Ye(()=>{this.isConnected&&(this.qu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get ju(){return this.Bo?this.Gu(this.Bo):""}qu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(f=>f.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {d=true;let f=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&r&&l&&f;}this.Ea=d,this.xa=u,this.Ca=c,this._o=e.total===0||!s&&!n,this.Vo=!n||this.cfg.multiple,this.Sa=e.total>0,this.Bo=e;}Gu(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Te),this.subConfigValue("multipleMin",this.Te),this.subConfigValue("multipleMax",this.Te),this.sub("*groupInfo",t=>{t&&this.Te();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.Te),this.uploadCollection.observeCollection(this.Te),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.ur=null;return}this.ur=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Te),this.uploadCollection.unobserveCollection(this.Te));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.ju}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Sa}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ai(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Aa} ?disabled=${!this._o} ?hidden=${!this.Vo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.ur} >${this.ur??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Vo} ?disabled=${!this._o} @click=${this.Aa} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Ca} @click=${this.zo} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Ea} ?disabled=${!this.xa} @click=${this.Ho} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([m()],Ot.prototype,"Ea",2),p([m()],Ot.prototype,"xa",2),p([m()],Ot.prototype,"Ca",2),p([m()],Ot.prototype,"Vo",2),p([m()],Ot.prototype,"_o",2),p([m()],Ot.prototype,"ur",2),p([m()],Ot.prototype,"Sa",2),p([m()],Ot.prototype,"Bo",2);var Ju=[{test:o=>!!o.accept&&!!o.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:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],La=$(o=>{for(let{test:i,message:t}of Ju)i(o)&&Dr(t);},0);var Ua=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},td="0123456789abcdefghijklmnopqrstuvwxyz",Ra=o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=td[Number(t)]+i,o=o/36n;}return i},Ss=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var ed=async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},id=10,rd=async o=>{let i=await ed(o);return Ra(i).slice(0,id)},$a=async(o,i)=>{let t=await rd(o);return Ua(t,i)};var Da=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var As=o=>o,od=[As({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=K(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),Ht(e)}}),As({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=K(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),Ht(e)}}),As({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===pi||Ss(r,s))?$a(e,s):r}})],Fa=({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of od){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{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}Da(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 V=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},z=o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},Va=o=>o==="auto"?o:z(o),Na=o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},_a=o=>{let i=V(o);if(!Object.values(P).includes(i))throw new Error(`Invalid value: "${i}"`);return i},za=o=>{let i=V(o),t=K(i);if(t.some(e=>!Object.values(P).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Ba=o=>{let i=V(o);if(i==="local"||i==="global")return i;if(z(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},Ha=o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},ks=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},Zr=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},Yr=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},Ka=o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var sd={pubkey:V,multiple:z,multipleMin:tt,multipleMax:tt,confirmUpload:z,imgOnly:z,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Va,cameraMirror:z,cameraCapture:Na,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:z,useLocalImageEditor:z,useCloudImageEditor:z,cloudImageEditorTabs:V,removeCopyright:z,cropPreset:V,imageShrink:V,modalScrollLock:z,modalBackdropStrokes:z,sourceListWrap:z,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:z,saveUrlForRecurrentUploads:z,groupOutput:z,userAgentIntegration:V,debug:z,localeName:V,metadata:Ha,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>ks(o),secureUploadsSignatureResolver:o=>Zr(o),secureDeliveryProxyUrlResolver:o=>Zr(o),iconHrefResolver:o=>Zr(o),plugins:o=>Yr(o),fileValidators:Yr,collectionValidators:Yr,validationTimeout:tt,validationConcurrency:tt,cameraModes:za,defaultCameraMode:_a,enableAudioRecording:z,enableVideoRecording:z,mediaRecorderOptions:ks,maxVideoRecordingDuration:tt,filesViewMode:Ka,gridShowFileNames:z,cloudImageEditorAutoOpen:z,cloudImageEditorMaskHref:V,testMode:z,qualityInsights:z,pasteScope:Ba},ja=(o,i)=>{if(!(typeof i>"u"||i===null))try{return sd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var Xr=[...new Set(["debug",...Object.keys(J)])],nd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],qa=o=>nd.includes(o),Is=Xr.filter(o=>!qa(o)),Ms={...Object.fromEntries(Is.map(o=>[cr(o),o])),...Object.fromEntries(Is.map(o=>[o.toLowerCase(),o]))},Ga=o=>`__${o}`,Xe=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[k(t),e]))};this.Wu=new Map;this.li={};this.ka=new Set;this.Ut=new Map;}Ko(t){return this.ka.has(t)}jo(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ma(t){return [...new Set([cr(t),t.toLowerCase()])]}Zu(t,e){if(qa(t)||this.Ko(t)&&this.jo(t)?.attribute===false)return;let r=this.Ma(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}Yu(t,e){let r=k(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Xe(t,e){let r;if(this.Ko(t)){let a=this.jo(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=ja(t,e);let s=this,n=Ga(t);s[n]!==r&&(this.Xu(t,s[n],r),s[n]=r,this.Zu(t,r),this.Yu(t,r),this.debugPrint(`"${t}"`,r),this.Ko(t)||La(this.cfg));}pr(t){let e=this,r=Ga(t);return e[r]??this.$[k(t)]}Xu(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));}Ia(t){let e=t.configRegistry.getAll();this.li={},this.ka=new Set(e.keys());for(let[r,s]of this.Ut)e.has(r)||(s(),this.Ut.delete(r));for(let[r,s]of e){let a=k(r);if(s.attribute){let c=this.Ma(r);for(let d of c)this.li[d]=r;}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let l=Object.getOwnPropertyDescriptor(this,r);if((!l||!l.set||!l.get)&&Object.defineProperty(this,r,{set:c=>{this.Xe(r,c);},get:()=>this.pr(r),enumerable:true,configurable:true}),!this.Ut.has(r)){let c=this.sub(a,d=>{this.Xe(r,d);},false);this.Ut.set(r,c);}}}Qu(){this.i.when("pluginManager",t=>{this.Ia(t),this.dr=t.onPluginsChange(()=>{this.Ia(t);});});}Ju(){this.ai=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in Ms)continue;if(r in this.li){let l=this.li[r],c=this.jo(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.ai.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Qu(),this.Ju();for(let r of Is)this.sub(k(r),s=>{this.Xe(r,s);},false);for(let r of Xr){let s=t[r]??this.$[k(r)];s!==J[r]&&this.Xe(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.Xe(r,a);},get:()=>this.pr(r)});}let e=r=>{Fa({key:r,setValue:this.Xe.bind(this),getValue:this.pr.bind(this),computationControllers:this.Wu});};for(let r of Xr)this.sub(k(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ms[t];n?s[n]=r:this.i.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.li[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.pr(c)===u)return;this.Xe(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.dr&&(this.dr(),this.dr=void 0),this.ai&&(this.ai.disconnect(),this.ai=void 0);for(let t of this.Ut.values())t();this.Ut.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ms);return [...t,...e]}};for(let o of Xr)Xe.prototype[o]=void 0;var ki=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.ci="upload-file";this.ed=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.ci=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ed}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.ci)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],ki.prototype,"dropzone",2),p([m()],ki.prototype,"ci",2);var Mi=class extends x{constructor(){super(...arguments);this.qo=S();}initCallback(){this.activityType=this.registration?.id??null,this.Oa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Oa(),this.isActivityActive&&(this.hr(),this.Pa()));}Oa(){this.registration&&(this.On()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Pa(),onDeactivate:()=>this.hr()}));}async Pa(){await this.updateComplete;let t=this.qo.value;if(!t||!this.registration)return;this.hr();let e=this.$["*currentActivityParams"];try{this.Go=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}hr(){let t=this.qo.value;if(t){try{this.Go?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.Go=void 0,t.replaceChildren();}}disconnectedCallback(){this.hr(),super.disconnectedCallback();}render(){return v`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${O(this.qo)} ></div>`}};p([y({attribute:false})],Mi.prototype,"registration",2);var Qe=class extends C{constructor(){super(...arguments);this.mode="modal";this.de=[];}initCallback(){super.initCallback();let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.La())),this.La();}La(){let t=this.i.pluginManager;if(!t){this.de=[];return}this.de=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ai(this.de,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ai(this.de,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],Qe.prototype,"mode",2),p([m()],Qe.prototype,"de",2);function Ii(o,i,t){return o?i(o):t?.(o)}function Wa(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function yt(...o){let i=Wa(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Za(o,...i){let t=Wa(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var ad=o=>ot.includes(o),Ya=o=>{if(!o)return ot;let i=K(o).filter(ad);return i.length===0?ot:i};function Xa(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":ot,"*tabId":B.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=It,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=rt(te(i),"preview"),r=W(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Qa="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var xe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Je=class extends C{constructor(){super(...arguments);this.he=false;this.Ra=xe;this.Ua=xe.visible;this.$a=xe.hidden;this.Wo=false;this.Da=false;}set visible(t){this.he=t,this.Fa();}get visible(){return this.he}set styles(t){this.Ra=t,this.Wo=true,this.Ua=t.visible??xe.visible,this.$a=t.hidden??xe.hidden;}get styles(){return this.Ra}Fa(){this.style.visibility=this.he?"inherit":"hidden",Za(this,{[xe.transition]:!this.Wo,[this.Ua]:this.he,[this.$a]:!this.he}),this.toggleAttribute("inert",!this.he);}td(){this.Da||(this.Da=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Wo||this.classList.add(xe.transition),this.Fa(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.td();},0);}};p([y({type:Boolean})],Je.prototype,"visible",1),p([y({attribute:false})],Je.prototype,"styles",1);var Oi=class extends C{constructor(){super(...arguments);this.active=false;this.Qe=S();this.Zo=false;this.Yo=()=>{let t=this.Qe.value;t&&(this.Na(t),this.Zo&&this.active&&this.Xo());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Xo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Xo():this.rd());}Xo(){let t=this.Qe.value;if(!t)return;this.Zo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Yo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Yo,{once:true});}rd(){let t=this.Qe.value;t&&(this.Zo=false,t.removeEventListener("transitionend",this.Yo),this.Na(t));}Na(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.Qe)}></div></div>`}};p([y({type:Boolean,reflect:true})],Oi.prototype,"active",2);var Pt=gt(class extends Et{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return it}});var q=o=>o??U;var xt=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.Va(),this._a();}updated(t){super.updated(t),t.has("reverse")&&this.Va(),t.has("theme")&&this._a();}Va(){this.style.flexDirection=this.reverse?"row-reverse":"";}_a(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get od(){let t=this.Qo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.sd}}get Qo(){return !this.icon}get sd(){return !this.text&&!this.Qo}render(){return v`<button type="button" role=${q(this.ariaRole||void 0)} aria-controls=${q(this.ariaControls||void 0)} aria-label=${q(this.l10n(this.titleProp))} title=${q(this.l10n(this.titleProp))} ><uc-icon class=${Pt(this.od)} name=${q(this.icon||void 0)} ?hidden=${this.Qo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],xt.prototype,"text",2),p([y({type:String})],xt.prototype,"icon",2),p([y({type:Boolean,reflect:true})],xt.prototype,"reverse",2),p([y({type:String,reflect:true})],xt.prototype,"theme",2),p([y({attribute:"aria-role"})],xt.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],xt.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],xt.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],xt.prototype,"active",2);function Ja(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}function ti(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return W(o,rt(nr,te(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}var Pi=class extends C{constructor(){super(...arguments);this.Ba=`uc-backdrop-mask-${ft.generateFastUid()}`;this.mr=false;this.hi=false;this.Ka=S();this.fi=false;this.mi=null;this.Ga=t=>{this.qa(),this.gi&&(t.stopPropagation(),t.preventDefault(),this.gi=false);};this.Wa=t=>{if(!this.gi||!this.fr||!this.es)return;t.stopPropagation(),t.preventDefault();let e=this.Re;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.fr[0],c=a-this.fr[1],{direction:d}=this.es,u=this.fd(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.Za=t=>{if(!this.xe)return;let e=Object.values(this.xe).find(r=>{if(!r||this.rs(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return ha(a,[t.x,t.y])});this.za=e,this.qa();};}get Re(){return this.Ka.value??null}get gi(){return this.hi}set gi(t){this.hi!==t&&(this.hi=t,this.ts());}ts(){this.di&&this.di.setAttribute("class",yt({"uc-guides--hidden":this.mr,"uc-guides--visible":!this.mr&&this.hi,"uc-guides--semi-hidden":!this.mr&&!this.hi}));}rs(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=I&&e.width<=I)return true;let r=e.height<=I&&(t.includes("n")||t.includes("s")),s=e.width<=I&&(t.includes("e")||t.includes("w"));return r||s}nd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.Re;if(!a)return;let l=vt("mask",{id:this.Ba}),c=vt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=vt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=vt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Ba})`});a.appendChild(u),a.appendChild(l),this.ui=l,this.Jo=d;}ad(){this.ui&&(this.ui.style.display="none",window.requestAnimationFrame(()=>{this.ui&&(this.ui.style.display="block");}));}ld(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.Jo&&se(this.Jo,{x:e,y:r,width:s,height:n});}cd(){let t=this.$["*cropBox"];if(!(!t||!this.di||!this.xe)){for(let e of Object.values(this.xe)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:f}=t;if(l)se(n,{x:d,y:u,width:h,height:f});else {let b=ne(Math.min(h,f)/82/2,0,1),w=c?la(t,r,b):ca(t,r,b),E=w.center;if(!E)continue;let T=Math.max(ss*ne(Math.min(h,f)/ss/3,0,1),aa);se(n,{x:E[0]-T,y:E[1]-T,width:T*2,height:T*2}),se(s,{d:w.d});}let g=this.rs(r);a.setAttribute("class",yt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}se(this.di,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ja(t,e){let r=vt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=vt("rect",{fill:"transparent"}),n=vt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.ud.bind(this,e));}dd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.ja(t,s);}return this.ja(t,""),t}pd(){let t=vt("svg"),e=vt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=vt("line",{x1:`${bi*r}%`,y1:"0%",x2:`${bi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=vt("line",{x1:"0%",y1:`${bi*r}%`,x2:"100%",y2:`${bi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}hd(){let t=this.Re;if(!t)return;let e=document.createDocumentFragment(),r=this.pd();e.appendChild(r);let s=this.dd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.xe=s,this.di=r,this.ts();}ud(t,e){if(!this.xe)return;let r=this.xe[t];if(!r||this.rs(t))return;let s=this.$["*cropBox"],n=this.Re;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.gi=true,this.es=r,this.fr=[c,d],this.Ha={...s};}fd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this.Ha??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=da({rect:a,delta:[r,s],imageBox:n}):a=pa({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ne(ze(a),n)}qa(){let t=this.za,e=this.Re;e&&(e.style.cursor=t?ua(t.direction):"initial");}Ya(t){if(this.pi){this.pi.setAttribute("href",t);return}let e=this.Re;if(!e){this.mi=t;return}this.mi=null;let r=document.createDocumentFragment(),s=vt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.pi=s;}md(){let t=this.$["*cropBox"];if(!t||!this.pi)return;let{x:e,y:r,width:s,height:n}=t;se(this.pi,{x:e,y:r,height:n,width:s});}os(){this.fi&&(this.ld(),this.cd(),this.md());}toggleThumbs(t){if(this.xe)for(let e of Object.values(this.xe)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",yt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.ad(),this.fi&&window.requestAnimationFrame(()=>{this.os();});}),this.sub("*cropBox",t=>{t&&(this.mr=t.height<=I||t.width<=I,this.ts(),this.fi&&window.requestAnimationFrame(()=>{this.os();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Ya(t);}),document.addEventListener("pointermove",this.Wa,true),document.addEventListener("pointerup",this.Ga,true);}firstUpdated(t){super.firstUpdated(t),this.gd();}gd(){let t=this.Re;if(!(!t||this.fi)){if(this.nd(),this.hd(),this.fi=true,t.addEventListener("pointermove",this.Za,true),this.mi){let e=this.mi;this.mi=null,this.Ya(e);}this.os();}}disconnectedCallback(){super.disconnectedCallback(),this.Re?.removeEventListener("pointermove",this.Za,true),document.removeEventListener("pointermove",this.Wa,true),document.removeEventListener("pointerup",this.Ga,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.Ka)}></svg>`}};p([m()],Pi.prototype,"hi",2);function cd(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}var Li=class extends C{constructor(){super();this.ctxOwner=true;this.Je={width:0,height:0};this.e=null;this._=false;this.se=null;this.Qa=S();this.ns=S();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Xa=$(this.Ja.bind(this),300),this.ss=Ye(()=>{!this.isConnected||!this._||(this.as(),this.tl(),this.il(),this.ls(),this.cs());},100);}firstUpdated(t){super.firstUpdated(t),this.as();}tl(){let t=this.$["*editorTransformations"],e=Ja(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}as(){let t=this.Qa.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.fe=t,this.e=e;}il(){if(!this._||!this.se)return;let t=this.se,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=_e({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,g=e+(n.height-e*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,g=0+e;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=ze(l);}ls(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[g,b]}=n,{width:w}=_e(this.Je,s),E=a/w;t=Ne(ze({x:l+g*E,y:c+b*E,width:h*E,height:f*E}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!fa(t,e)||u&&!ma(t,u)){let h=e.width/e.height,f=e.width,g=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=Ne(ze(t),e);}vd(){let t=this.e;if(!t)return;let e=this.se;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=_e({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();}cs(){if(!this._||!this.se||!this.fe||!this.e)return;let t=this.fe;this.e.clearRect(0,0,t.width,t.height),this.vd();}yd({fromViewer:t}){this.se&&(this.ns.value?.toggleThumbs(true),this.bd(),setTimeout(()=>{this.className=yt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}rl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=_e(this.Je,s),{width:d,height:u}=t,h=n/l,f=a/c;return [ne(Math.round(d/h),1,l),ne(Math.round(u/f),1,c)]}wd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=_e(this.Je,s),{x:h,y:f}=t,g=n/d,b=a/u,w=this.rl(),E={dimensions:w,coords:[ne(Math.round((h-l)/g),0,d-w[0]),ne(Math.round((f-c)/b),0,u-w[1])]};if(!cd(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(w[0]===d&&w[1]===u))return E}Ja(){if(!this.isConnected||!this.Je)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.wd(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.il(),this.ls(),this.cs());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.as(),this.Je=t,this.removeEventListener("transitionend",this.ol);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.se=await this.Td(r,s),this.tl(),this.ss(),this.yd({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.se&&this.ss();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.Ja(),this._=false,this.Ed(),this.className=yt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.ns.value?.toggleThumbs(false),this.addEventListener("transitionend",this.ol,{once:true}),this.s?.disconnect());}Ed(){let t=this.rl(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),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`;}bd(){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`;}ol(){this._||(this.se=null);}async Td(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(ti(t,r,e)),{promise:n,cancel:a,image:l}=Ce(s),c=this.$t(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.b?.(),this.b=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}$t(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.cs();}),this.sub("*cropBox",()=>{this.se&&this.Xa();}),this.sub("*currentAspectRatio",()=>{this.ls();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.Je&&this.activate(this.Je,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.se&&(this.se=null);}render(){return v`<canvas class="uc-canvas" ${O(this.Qa)}></canvas><uc-crop-frame ${O(this.ns)}></uc-crop-frame>`}};p([m()],Li.prototype,"se",2);function Os(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}function ud(o){return typeof o=="string"&&o in kt}function dd(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}function pd(o,i,t){let e=dd(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function hd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function tl(o,i){let t=kt[o].keypointsNumber,{range:e,zero:r}=kt[o];return [...new Set([...Os(e[0],r,t+1),...Os(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var Qr=class extends C{constructor(){super();this._=false;this.us=true;this.n="initial";this.sl={};this.Ue=[];this.al=0;this.cl=S();this.gr=S();this.classList.add("uc-inactive_to_cropper"),this.ll=$(async(t,e,r)=>{let s=()=>!this.ul(t,e)||this.Pt!==r||!!this.Ue.find(c=>c.value===r);if(s())return;let n=await this.dl(t,r),a=new Image;a.src=n.src;let l=this.$t(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Ue,d=c.findIndex(g=>g.value>r);d===-1&&(d=c.length);let h=c[d]?.image,f=this.gr.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.hs(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}$t(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}pl(){window.cancelAnimationFrame(this.al),this.al=window.requestAnimationFrame(()=>{for(let t of this.Ue){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}et({url:t=this.nl,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.sl};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(ti(t,a,n))}async dl(t,e){return {src:await this.et({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}ul(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!ud(this.n)||!Number.isFinite(e)||(this.hs(this.n,e),this.ll(this.n,this.m,e));}hs(t,e){this.n=t,this.Pt=e;let{zero:r}=kt[t],s=this.Ue.map(l=>l.value),n=pd(s,e,r),a=hd(s,r);this.Ue.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.pl();}hl(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async xd(){this.a=this.a||this.hl();let t=this.a;t&&this.fl(t);let e=this.Ue.map(c=>c.src),{images:r,promise:s,cancel:n}=Si(e);r.forEach(c=>{let d=this.$t(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.ds=()=>{n(),this.ds=void 0;};let a=this.n,l=this.m;if(await s,this._&&this.ul(a,l)){let c=this.gr.value;if(!c)return;c.replaceChildren(),this.Ue.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.pl();}}async setTransformations(t){if(this.sl=t,this.a){let e=await this.et(),r=this.$t(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.ps?.();let n=tl(r,s),a=await Promise.all(n.map(c=>this.et({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Si(a);this.ps=l;}Cd(t){let e=this.a||this.hl();if(this.fl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=yt({"uc-active_from_viewer":this.vi,"uc-active_from_cropper":!this.vi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.$t(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=yt({"uc-active_from_viewer":this.vi,"uc-active_from_cropper":!this.vi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.us=false,await this.updateComplete,this.nl=t,this.n=e??"initial",this.Pt=r,this.m=s,this.vi=n,typeof r!="number"&&!s){let l=await this.et({operation:e,value:r});this.Cd(l),this.fs();return}!e||typeof r!="number"||(this.Ue=await Promise.all(tl(e,r).map(l=>this.dl(e,l))),this.hs(e,r),this.xd());}deactivate({hide:t=true}={}){this._=false,this.ds?.(),this.ps?.(),t&&!this.us?(this.us=true,this.a&&(this.a.style.transform="scale(1)"),this.className=yt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.fs();},{once:true})):this.fs();}fl(t){let e=this.cl.value;e&&(e.contains(t)||e.appendChild(t));}fs(){this.gr.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.cl)}></div><div class="uc-fader-layers-host" ${O(this.gr)}></div>`}};var el="important",fd=" !"+el,Ae=gt(class extends Et{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(fd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?el:""):t[e]=r;}}return it}});var Vt=class extends C{constructor(){super();this.ms=0;this.$e=S();this.gl=S();this.vl=S();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.De=0;this.Ad=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&(this.gs(e),this.Sd("slider-input",e));};this.kd=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&this.gs(e);};this.bl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.wl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Sd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.ms=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Tl(this.De),this.vs(),this.s=new ResizeObserver(()=>{this.vs(),this.vr(this.De);}),this.s.observe(this);let e=this.$e.value;e?.addEventListener("focus",this.bl),e?.addEventListener("blur",this.wl),window.setTimeout(()=>{this.vr(this.De);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.De&&this.gs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.vs(),this.vr(this.De)),t.has("zero")&&this.hasUpdated&&this.El(this.De);}vr(t){this.El(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.ms)/100;window.requestAnimationFrame(()=>{let l=this.gl.value;l&&(l.style.transform=`translateX(${a}px)`);});}El(t){if(!this.yi)return;let e=this.max-this.min;if(e===0)return;this.yi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.ms)/100;window.requestAnimationFrame(()=>{this.yi&&(this.yi.style.transform=`translateX(${a}px)`);});}vs(){let e=this.vl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.ml===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.yi=d,e.innerHTML="",e.appendChild(a),this.ml=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.$e.value;t?.removeEventListener("focus",this.bl),t?.removeEventListener("blur",this.wl),this.s?.disconnect(),this.s=void 0;}gs(t){Number.isFinite(t)&&(this.De=t,this.hasUpdated&&(this.Tl(t),this.vr(t)));}Tl(t){let e=this.$e.value;e&&(e.value=String(t));}yl(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.vl)}></div><div class="uc-thumb" ${O(this.gl)}></div><input class="uc-input" type="range" ${O(this.$e)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.De)} ?disabled=${this.disabled} @input=${this.Ad} @change=${this.kd} />`}};p([y({type:Boolean,reflect:true})],Vt.prototype,"disabled",2),p([y({type:Number})],Vt.prototype,"min",2),p([y({type:Number})],Vt.prototype,"max",2),p([y({type:Number,attribute:false})],Vt.prototype,"defaultValue",2),p([y({type:Number})],Vt.prototype,"zero",2),p([m()],Vt.prototype,"De",2);var Nt="original",Ui=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.ys=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.Md();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===Nt?void 0:this.state.value,filter:this.state.filter===Nt?void 0:this.state.filter,fromViewer:false});}Md(){let t=this.state.operation,{range:e,zero:r}=kt[t],[s,n]=e;this.state={...this.state,min:s,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===Nt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.ys} ></uc-slider-ui>`}};p([m()],Ui.prototype,"state",2);function ei(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var at=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}}xl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.xl();}updated(t){super.updated(t),t.has("active")&&this.xl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([m()],at.prototype,"active",2),p([m()],at.prototype,"title",2),p([m()],at.prototype,"icon",2),p([m()],at.prototype,"titleProp",2);var Jr=12,to=16,md=o=>{let i=12,t=12;return o.width/o.height>=1?(i=Jr,t=Math.round(Jr*o.height/o.width)):(t=Jr,i=Math.round(Jr*o.width/o.height)),{width:i,height:t}},eo=class extends at{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Id(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Id(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return v`<button role="option" type="button" class=${Pt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Ri=class extends at{constructor(){super(...arguments);this.X=null;}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.Cl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.Cl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}Cl(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},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),s(),e||this.requestUpdate();}Od(){let t=this.X;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=md(t),s=(to-e)/2,n=(to-r)/2;return v`<uc-icon><svg viewBox="0 0 ${to} ${to}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" class=${Pt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} >${this.Od()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Ri.prototype,"aspectRatio",1);function gd(o){let i=o+90;return i=i>=360?0:i,i}function vd(o,i){if(o==="rotate")return gd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var $i=class extends at{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),s=vd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],$i.prototype,"operation",2);var Yt=class extends at{constructor(){super(...arguments);this.n="";this.m="";this.bi="";this.yr=0;this.a=null;this.Ft=false;this.isOriginal=false;this.Sl=20;}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let r=this.m;this.m=e,this.n="filter",this.isOriginal=e===Nt,this.icon=this.isOriginal?"original":"slider",this.Sl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Al(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ei(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Pd(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Sl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.m!==Nt?{name:this.m,amount:a}:void 0,W(this.bi,rt(nr,te(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}async ni(t,e){t[0]?.isIntersecting?await this.bs(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.bi=t??"",this.sub("*originalUrl",e=>{this.bi=e??"",!this.isOriginal&&this.bi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.tt());}),this.isOriginal||(this.s?.observe(this),this.tt()),this.m&&this.Al(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.bs():this.tt());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.br();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.tt()));}Al(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async bs(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.bi){!this.Dt&&!this.Fe&&this.tt();return}let e=++this.yr,r="";try{r=await this.proxyUrl(this.Pd());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ft=false,this.b?.();let{promise:s,cancel:n}=Ce(r);this.b=()=>{n(),this.yr===e&&(this.b=void 0);};try{if(await s,this.yr!==e||!this.isConnected)return;this.a=r,this.Ft=!0,this.br(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.tt();}finally{this.yr===e&&(this.b=void 0);}}tt(){if(!this.isConnected||this.a||this.Ft||this.isOriginal||this.$["*networkProblems"]){this.br();return}this.Fe&&cancelAnimationFrame(this.Fe),this.Fe=requestAnimationFrame(()=>{if(this.Fe=void 0,!this.isConnected||this.a||this.Ft||this.isOriginal){this.br();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.bs();return}this.Dt=window.setTimeout(()=>{this.Dt=void 0,this.tt();},500);});}br(){this.Fe&&(cancelAnimationFrame(this.Fe),this.Fe=void 0),this.Dt&&(window.clearTimeout(this.Dt),this.Dt=void 0);}get Ld(){return !!(this.Ft&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ld?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${Pt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Ft} style=${Ae(e)}></div><uc-icon class=${Pt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Ae(r)} ></uc-icon></button>`}};p([m()],Yt.prototype,"a",2),p([m()],Yt.prototype,"Ft",2),p([m()],Yt.prototype,"isOriginal",2),p([m()],Yt.prototype,"Sl",2),p([y({type:String})],Yt.prototype,"filter",1);var Di=class extends at{constructor(){super(...arguments);this.n="";}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.kl(e);}kl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.kl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=kt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ei(this.$["*operationTooltip"])});}};p([y({type:String})],Di.prototype,"operation",1);var yd=1,il=()=>{},Fi=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Ml=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>yd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Ml,{passive:false}),this.addEventListener("scroll",il,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Ml),this.removeEventListener("scroll",il),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Fi.prototype,"hiddenScrollbar",2);var pt=class extends C{constructor(){super(...arguments);this.wi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Il=true;this.tabList=[...ot];this.activeTab=B.CROP;this.wr=true;this.Ts=false;this.Ol=null;this.Pl=0;this.Ll=0;this.Tr=S();this.Rl=S();this.tabToggleRefs={[B.CROP]:S(),[B.TUNING]:S(),[B.FILTERS]:S()};this.Ul=()=>{this.ot();};this.Ti=[];this.Er=$(t=>{this.wi=t;},500);this.xr=$(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===B.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Nt);else if(this.showSubToolbar&&this.$["*tabId"]===B.TUNING&&e){s=true;let n=t?.[e]||kt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Ts=s;},0);this.Rd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ud={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.$d={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Dd={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Nt,"*currentOperation":null,"*operationTooltip":null};this.Ee=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.Ss=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.qd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ei(this.$["*operationTooltip"])}),this.Tr.value?.apply(),this.$l();};this.Wd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Tr.value?.cancel(),this.$l();};this.Zd=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Es(r,{fromViewer:false}));};}$l(){this.$["*showSlider"]=false,this.$["*tabId"]===B.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===B.TUNING&&(this.Ts=false);}Es(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Dl(t,{fromViewer:e,force:r});}Dl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.ot();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===B.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of ot){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.Rl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Pl!==s||this.Ll!==n)&&(this.Pl=s,this.Ll=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get xs(){return this.Ti.length>=3}Fd(t){switch(t){case B.CROP:return this.Nd();case B.FILTERS:return this.Vd();case B.TUNING:return this._d();default:return []}}Nd(){let t=[];if(this.xs)t.push(()=>this.Bd());else for(let e of this.Ti)t.push(()=>this.Fl(e));for(let e of yn)t.push(()=>this.zd(e));return this.Cs(t)}Vd(){let e=[Nt,...vn].map(r=>()=>this.Hd(r));return this.Cs(e)}_d(){let t=gn.map(e=>()=>this.Kd(e));return this.Cs(t)}Cs(t){return t.length?t.map(r=>r()):[]}Bd(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Fl(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}zd(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Hd(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Kd(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}jd(){return this.xs?this.Ti.map(t=>this.Fl(t)):[]}async Gd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ti(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Si([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Ti=[...t],this.sub("*cropPresetList",e=>{this.Ti=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Es(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.xr();}),this.sub("*currentOperation",()=>{this.xr();}),this.sub("*tabId",e=>{this.Dl(e,{fromViewer:false,force:true}),this.xr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Gd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Er(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.wr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.wr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Il=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Es(r,{fromViewer:false});return}this.ot();}),this.sub("*operationTooltip",e=>{this.Ol=e;}),this.xr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ul);}firstUpdated(t){super.firstUpdated(t),this.Cr(),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.Cr();}disconnectedCallback(){window.removeEventListener("resize",this.Ul),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Cr(){let t=this.Tr.value;t&&(this.$["*sliderEl"]=t);}Yd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Ae({gridColumn:`${s+1}`}):U;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.$d}><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.Zd} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Xd(t){let e=this.Fd(t);return v`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:U}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Ts?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.xs;return v`<uc-line-loader-ui .active=${this.wi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Ol??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Rd} ><div class="uc-tab-content-row">${ot.map(r=>Ii(this.activeTab===r,()=>this.Xd(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Il} .styles=${this.Dd} @initial-render=${()=>this.ot()} ><div class="uc-tab-toggles_indicator" ${O(this.Rl)} ></div>${ot.map(r=>this.Yd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ee} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ss}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ud}><div class="uc-slider" ?hidden=${!this.wr}><uc-editor-slider ${O(this.Tr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.wr||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.jd()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Wd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.qd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([m()],pt.prototype,"wi",2),p([m()],pt.prototype,"showMainToolbar",2),p([m()],pt.prototype,"showSubToolbar",2),p([m()],pt.prototype,"Il",2),p([m()],pt.prototype,"tabList",2),p([m()],pt.prototype,"activeTab",2),p([m()],pt.prototype,"wr",2),p([m()],pt.prototype,"Ts",2),p([m()],pt.prototype,"Ol",2),p([m()],pt.prototype,"Ti",2);var rl=Ht([...ot]),et=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.Qd="";this.et=It;this.Jd="";this.wi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=rl;this.Nl=false;this.ke=false;this.As=null;this.Ei=null;this.Er=$(t=>{this.wi=t;},300);this.Sr=S();this.Vl=S();this._l=S();this.Bl=S();this.zl=()=>{this.Er(false),this.et!==It&&(this.$["*networkProblems"]=false);};this.Hl=()=>{this.Er(false),this.$["*networkProblems"]=true;};this.ep=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Xa(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}tp(){this.ke||this.As||(this.As=this.updateComplete.then(()=>{this.As=null,this.ke=true;}));}initCallback(){super.initCallback(),this.Kl(),this.jl();}Cr(){let t=this._l.value;t&&(this.$["*faderEl"]=t);let e=this.Vl.value;e&&(this.$["*cropperEl"]=e);let r=this.Bl.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Sr.value;s&&(this.$["*imgEl"]=s);}ip(){let t=this.Sr.value;t&&(t.addEventListener("load",this.zl),t.addEventListener("error",this.Hl));}rp(){let t=this.Sr.value;t&&(t.removeEventListener("load",this.zl),t.removeEventListener("error",this.Hl));}get op(){let t=this.$["*tabId"];return yt("uc-image",{"uc-image_hidden_to_cropper":t===B.CROP,"uc-image_hidden_effects":t!==B.CROP})}Gl(){if(this.Ei)return this.Ei;let t=3e3;return this.Ei=new Promise((e,r)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Ei=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),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.Ei}firstUpdated(t){super.firstUpdated(t),this.Cr(),this.ip(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.rp(),super.disconnectedCallback();}render(){let t=this.Jd??"",e=this.Qd??"",r=this.et||It,s=this.wi,n=this.Nl;return v` ${De(Qa)}<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.ep}></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" ${O(this.Bl)}><img src=${r} class=${this.op} ${O(this.Sr)} />${Ii(this.ke,()=>v`<uc-editor-image-cropper ${O(this.Vl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this._l)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Ii(this.ke,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Kl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.jl();}Kl(){let t=this.tabs||rl;this.$["*tabList"]=Ya(t);}jl(){let t=Nr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=ko(this.cdnUrl),s=Mo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=va(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.Gl();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=sr(t),r=Jt(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=ko(t),n=Mo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Jt(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"]===B.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(W(t,rt("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===B.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.tp();}}}async initEditor(){try{await this.Gl();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Nl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=rt(te(t),"preview"),s=W(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([m()],et.prototype,"Qd",2),p([m()],et.prototype,"et",2),p([m()],et.prototype,"Jd",2),p([m()],et.prototype,"wi",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([m()],et.prototype,"Nl",2),p([m()],et.prototype,"ke",2);var Ps={};Ds(Ps,{CloudImageEditorActivity:()=>Vi});var io=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Vi=class extends R{constructor(){super(...arguments);this.Q=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.Q&&this.Q.cropPreset!==t&&(this.Q={...this.Q,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Q&&this.Q.tabs!==t&&(this.Q={...this.Q,tabs:t});}),this.sp();}disconnectedCallback(){super.disconnectedCallback(),this.np();}Ss(t){if(!this.xi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.xi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(x.activities.CLOUD_IMG_EDIT),this.historyBack();}Ee(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(x.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}sp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.xi=e;let r=this.xi.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.ap(r);}np(){this.xi=void 0,this.Q=null;}render(){if(!this.Q)return U;let{cdnUrl:t,cropPreset:e,tabs:r}=this.Q;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${q(e)} tabs=${q(r)} @apply=${this.Ss} @cancel=${this.Ee} @change=${this.handleChange} ></uc-cloud-image-editor>`}ap(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([m()],Vi.prototype,"Q",2);var ii=class extends R{constructor(){super(...arguments);this.ql={importDisabled:true};this.$e=S();this.ys=t=>{let e=t.target?.value??"";this.ql={importDisabled:!e};};this.zo=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.$e.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:N.URL}),this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.modalManager?.open(x.activities.UPLOAD_LIST));};}firstUpdated(){let t=this.$e.value;t&&(t.value="",t.focus());}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.zo}><label><input ${O(this.$e)} placeholder="https://" class="uc-url-input" type="text" @input=${this.ys} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.ql.importDisabled} >${this.l10n("upload-url")}</button></form>`}};p([m()],ii.prototype,"ql",2);var ol=()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}};var bd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),sl=(o,i="i")=>{let t=o.split("*").map(bd);return new RegExp(`^${t.join(".+")}$`,i)};var wd=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],Td=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),nl=o=>{let i={};for(let t of wd){let e=Td(o,t);e&&(i[t]=e);}return i};var Ed=["selected-files-change","toolbar-state-change"],Cd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Ed.includes(i))},ro=class{constructor(i,t){this.Ar=new Map;this.Zl=i=>{if(i.source!==this.ks)return;let t=i.data;if(!Cd(t))return;let e=this.Ar.get(t.type);if(e)for(let r of e)r(t);};this.ks=i,this.Wl=t,window.addEventListener("message",this.Zl);}on(i,t){let e=this.Ar.get(i)??new Set;this.Ar.has(i)||this.Ar.set(i,e),e.add(t);}send(i){let t=this.Wl();this.ks.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Zl);}};function al(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var xd={[ut.GDRIVE]:"ngdrive"},ht=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Nt=S();this.kr=null;this.Ms=[];this.Is=false;this.Os=false;this.Ps=false;this.Ls=false;this.Mr=false;this.Rs=false;this.Us="uc-hidden";this.Yl=true;this.Ho=()=>{for(let t of this.Ms){let e=this.cp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.modalManager?.open(x.activities.UPLOAD_LIST);};this.Ee=()=>{this.historyBack();};this.mp=()=>{this.ne?.send({type:"select-all"});};this.gp=()=>{this.ne?.send({type:"deselect-all"});};}get lp(){if(!this.kr)return "";let{selectedCount:t,total:e}=this.kr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.Xl():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.Ql(),this.Xl());});}),this.subConfigValue("multiple",e=>{this.Mr=e;}),this.subConfigValue("localeName",()=>{this.Jl();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.ec(e);});}cp(t){if(t.alternatives){let e=Z(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=sl(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}up(t){this.Yl=t.isVisible;}async dp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.pp(t.selectedCount,t.total),this.Us=t.isReady?"":"uc-hidden",this.Is=t.isReady,this.Os=t.isReady&&t.selectedFiles.length>0,this.Mr=t.isMultipleMode&&t.total>0,this.Ps=t.selectedCount<t.total,this.Ls=t.selectedCount===t.total,this.Ms=t.selectedFiles??[],this.Rs=t.total>0;}tc(){this.ec(this.cfg.externalSourcesEmbedCss),this.hp(),this.Jl();}hp(){this.ne?.send({type:"set-theme-definition",theme:nl(this)});}ec(t){this.ne?.send({type:"set-embed-css",css:t});}Jl(){this.ne?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}fp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=xd[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ol(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,r);return d.search=al(c),d.toString()}pp(t,e){this.kr={selectedCount:t,total:e};}Xl(){let t=document.createElement("iframe");t.src=this.fp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.tc.bind(this)),t.addEventListener("load",this.tc.bind(this)),this.Nt.value&&(this.Nt.value.innerHTML="",this.Nt.value.appendChild(t)),t.contentWindow&&(this.ne?.destroy(),this.ne=new ro(t.contentWindow,()=>this.cfg.socialBaseUrl),this.ne.on("selected-files-change",this.dp.bind(this)),this.ne.on("toolbar-state-change",this.up.bind(this)),this.ic());}Ql(){this.ne?.destroy(),this.ne=void 0,this.Nt.value&&(this.Nt.value.innerHTML=""),this.ic();}ic(){this.Ms=[],this.Is=false,this.Os=false,this.Ps=false,this.Ls=false,this.Mr=false,this.Rs=false,this.Us="uc-hidden",this.kr=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ql();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${O(this.Nt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Yl}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Mr}><span>${this.lp}</span><button type="button" @click=${this.mp} ?hidden=${!this.Ps}>${this.l10n("select-all")}</button><button type="button" @click=${this.gp} ?hidden=${!this.Ls}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Ho} ?disabled=${!this.Os} ?hidden=${!this.Rs} ><uc-spinner ?hidden=${this.Is}></uc-spinner><span class=${this.Us}>${this.l10n("done")}</span></button></div></div>`}};p([m()],ht.prototype,"Ms",2),p([m()],ht.prototype,"Is",2),p([m()],ht.prototype,"Os",2),p([m()],ht.prototype,"Ps",2),p([m()],ht.prototype,"Ls",2),p([m()],ht.prototype,"Mr",2),p([m()],ht.prototype,"Rs",2),p([m()],ht.prototype,"Us",2),p([m()],ht.prototype,"Yl",2);var ll=()=>typeof navigator.permissions<"u";var Sd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Ad=["camera","microphone"];function oo(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var cl="image/jpeg",ul="video/webm",_=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ir=null;this.$s=false;this.Ci=[];this.me=null;this.ge=null;this.Or=null;this.Pr=null;this.g=null;this.Si={};this.fe=null;this.e=null;this.Vt=[];this._t=[];this.vp={};this.Lr=[];this.Rr=null;this.rc=()=>{this.oc(),this.Ai="pause";};this.sc=()=>{this.Ai="play",this.yp();};this.ki=S();this.Qe=S();this.K=S();this.nc=0;this.ac=0;this.cc=null;this.Ur=true;this.$r=true;this.bp=ll();this.uc=[];this.at=true;this.Ds="";this.Bt=true;this.pt=true;this.zt=true;this.dc=[];this.mt=true;this.Fs=true;this.gt=true;this.Ce=true;this.vt=true;this.Ht="camera-full";this.Ai="play";this.pc="microphone";this.Dr="uc-shot-btn uc-camera-action";this.wp=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===P.PHOTO&&this.Tp(),this.g===P.VIDEO){if(this.me?.state==="recording"){this.hc();return}this.Ep();}};this.xp=t=>{let e=t.target;e&&(this.Pr=e.value,this.Kt());};this.Cp=t=>{let e=t.target;e&&(this.Or=e.value,this.Kt());};this.Sp=()=>{this.Kt();};this.Ap=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.wp();};this.kp=()=>{this.Mp();};this.Ip=()=>{this.Op();};this.Pp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.Lp();};this.Rp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.Up();};this.fc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.mc(r);};this.gc=()=>{let t=Math.floor((performance.now()-this.nc+this.ac)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.ki.value;s&&(s.textContent=oo(e)),this.hc();return}let r=this.ki.value;r&&(r.textContent=oo(e));}else {let e=this.ki.value;e&&(e.textContent=oo(t));}this.jt=requestAnimationFrame(this.gc);};this.$p=()=>{this.nc=performance.now(),this.ac=0,this.gc();};this.vc=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.oc=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Qe.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.ki.value;n&&(n.textContent=oo(e)),this.jt=requestAnimationFrame(this.oc);};this.yp=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.jt=null;this.Ep=()=>{try{this.Ci=[],this.Si={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Si.mimeType=t:MediaRecorder.isTypeSupported(ul)?this.Si.mimeType=ul:this.Si.mimeType="video/mp4",this.ge&&(this.me=new MediaRecorder(this.ge,this.Si),this.me.start(),this.me.addEventListener("dataavailable",e=>{this.Ci.push(e.data);}),this.$p(),this.classList.add("uc-recording"),this.Mi(Ct.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.hc=()=>{this.me?.addEventListener("stop",()=>{this.Dp(),this.vc(),this.Mi(Ct.STOP);}),this.me?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.Mp=()=>{if(this.me?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Op=()=>{this.ge?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.pc=t.enabled?"microphone":"microphone-mute",this.Fs=!t.enabled;});};this.Dp=()=>{try{let t=new Blob(this.Ci,{type:this.me?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Ii(null),r.src=e,this.Fp(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Lp=()=>{if(this.Mi(Ct.RETAKE),this.g===P.VIDEO){this.Ii(this.ge);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.Up=()=>{if(this.Mi(Ct.ACCEPT),this.g===P.PHOTO){this.fe?.toBlob(s=>{if(!s)return;let n=this.yc("camera","jpeg",cl,s);this.bc(n);},cl);return}let t=new Blob(this.Ci,{type:this.me?.mimeType}),e=this.Np(this.me?.mimeType),r=this.yc("video",e,`video/${e}`,t);this.bc(r),this.Ci=[];};this.Vp=t=>{t===Ct.SHOT&&(this.vt=true,this.pt=true,this.Ce=true,this.zt=false,this.at=true),(t===Ct.RETAKE||t===Ct.ACCEPT)&&(this.vt=!this.Se.includes(P.VIDEO),this.Ce=!this.Se.includes(P.PHOTO),this.pt=false,this.zt=true,this.at=this.Vt.length<=1);};this._p=t=>{t===Ct.PLAY&&(this.Bt=false,this.Ce=true,this.at=true,this.mt=true,this.Ai="pause",this.Ht="square",this.Dr="uc-shot-btn uc-camera-action uc-stop-record"),t===Ct.STOP&&(this.Bt=false,this.pt=true,this.gt=true,this.zt=false),(t===Ct.RETAKE||t===Ct.ACCEPT)&&(this.Bt=true,this.vt=!this.Se.includes(P.VIDEO),this.Ce=!this.Se.includes(P.PHOTO),this.pt=false,this.zt=true,this.gt=!this.cfg.enableAudioRecording,this.Ht="video-camera-full",this.Dr="uc-shot-btn uc-camera-action",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.at=this.Vt.length<=1);};this.Mi=t=>{this.g===P.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Vp(t),this.g===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this._p(t);};this.mc=t=>{t===P.PHOTO&&(this.Ht="camera-full",this.mt=true,this.gt=true),t===P.VIDEO&&(this.Ai="play",this.Ht="video-camera-full",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.gt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.yc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.bc=t=>{this.api.addFileFromObject(t,{source:N.CAMERA}),this.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this.modalManager?.open(x.activities.UPLOAD_LIST);};this.Oi=$(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===P.VIDEO&&this.cfg.enableAudioRecording,r=this.g===P.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Ur=false,this.pt=false,this.Ce=!this.Se.includes(P.PHOTO),this.vt=!this.Se.includes(P.VIDEO),this.$r=true,this.Bt=true,this.Ht=r,this.gt=!e,this.mt=!e):t==="prompt"?(this.Ds="camera-permissions-prompt",this.Ur=true,this.pt=true,this.Ce=true,this.$r=false,this._s()):(this.Ds="camera-permissions-denied",this.Ur=true,this.$r=false,this.Ce=!this.Se.includes(P.PHOTO),this.vt=!this.Se.includes(P.VIDEO),this.zt=true,this.Dr="uc-shot-btn uc-camera-action",this._s());},300);this.Bp=()=>{if(!this.ge)return false;let t=this.ge?.getAudioTracks(),e=this.ge?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this._s=()=>{this.$s&&(this.K.value&&(this.K.value.volume=0),this.Rr?.getTracks?.()?.[0]?.stop(),this.Ns(this.K.value),this.Ii(null),this.Bp(),this.vc(),this.$s=false);};this.Kt=async()=>{let t={video:{...Sd},audio:this.cfg.enableAudioRecording?{}:false};this.Pr&&(t.video={deviceId:{exact:this.Pr}}),this.Or&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Or}}),this.K.value&&(this.K.value.volume=0);try{this.Oi("prompt"),this.ge=await navigator.mediaDevices.getUserMedia(t),this.ge.addEventListener("inactive",()=>{this.Oi("denied");}),this.Ii(this.ge),this.$s=!0,this.Oi("granted");}catch(e){this.Oi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.wc=()=>{this.Kt();};this.zp=async()=>{try{this.Fr();for(let t of Ad){let e=await navigator.permissions.query({name:t});this.vp[t]=e,e.addEventListener("change",this.wc),this.Lr.push(()=>{e.removeEventListener("change",this.wc);});}this.Ir=()=>{this.Fr();};}catch(t){this.Fr(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Kt();}};this.Hp=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Bs(),navigator.mediaDevices.addEventListener("devicechange",this.Bs);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Bs=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Vt=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this._t=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.uc=this.Vt,this.at=this.Vt.length<=1,this.Pr=this.Vt[0]?.value??null,this.dc=this._t,this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.Or=this._t[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Kp=async()=>{await this.zp(),await this.Hp(),await this.Kt(),this.Tc(this.Se);};this.jp=async()=>{this.Ir&&this.Ir(),window.chrome||this.Oi("denied"),this._s();};this.Tc=t=>{this.vt=!t.includes(P.VIDEO),this.Ce=!t.includes(P.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.mc(e);};}Fp(t){this.Ns(t),t.addEventListener("play",this.rc),t.addEventListener("pause",this.sc);}Ns(t){t?.removeEventListener("play",this.rc),t?.removeEventListener("pause",this.sc);}Ii(t){this.Rr!==t&&(this.Rr=t,this.Vs());}Vs(){let t=this.K.value;if(!t)return;let e=this.Rr??null;t.srcObject!==e&&(t.srcObject=e);}Tp(){if(this.Mi("shot"),this.fe=document.createElement("canvas"),this.e=this.fe.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.fe.height=t.videoHeight,this.fe.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.fe.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Np(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get Se(){return Z(this.cfg.cameraModes).filter(t=>t===P.PHOTO||t===P.VIDEO)}Fr(){if(this.Lr.length!==0){for(let t of this.Lr)t();this.Lr=[],this.Ir=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.gt=!t,this.Fs=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=K(t);this.Tc(e.filter(r=>r===P.PHOTO||r===P.VIDEO));}),this.Kp();}firstUpdated(t){super.firstUpdated(t),this.Vs();}updated(t){super.updated(t),this.Vs();}Gp(){this.Fr(),navigator.mediaDevices?.removeEventListener("devicechange",this.Bs),this.Ns(this.K.value),this.Ii(null);}disconnectedCallback(){super.disconnectedCallback(),this.jp(),this.Gp();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.at}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.uc} ?hidden=${this.at} @change=${this.xp} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${Ae({transform:this.cc})} ?hidden=${this.Ur} ${O(this.K)} ></video><div class="uc-message-box" ?hidden=${this.$r}><span>${this.l10n(this.Ds)}</span><button type="button" @click=${this.Sp} ?hidden=${this.bp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Bt}><button data-id="photo" type="button" class=${Pt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===P.PHOTO})} @click=${this.fc} ?hidden=${this.Ce} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${Pt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===P.VIDEO})} @click=${this.fc} ?hidden=${this.vt} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.kp} ?hidden=${this.Bt} data-testid="recording-timer" ><uc-icon name=${this.Ai}></uc-icon><span ${O(this.ki)}> 00:00 </span><span ${O(this.Qe)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.zt} ><button type="button" class="uc-secondary-btn" @click=${this.Pp}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Rp} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Ap} class=${this.Dr} ?hidden=${this.pt} ><uc-icon name=${this.Ht}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.Ip} ?hidden=${this.gt} data-testid="toggle-microphone" ><uc-icon name=${this.pc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.dc} ?hidden=${this.mt} ?disabled=${this.Fs} @change=${this.Cp} data-testid="audio-select" ></uc-select></div></div>`}};p([m()],_.prototype,"cc",2),p([m()],_.prototype,"Ur",2),p([m()],_.prototype,"$r",2),p([m()],_.prototype,"bp",2),p([m()],_.prototype,"uc",2),p([m()],_.prototype,"at",2),p([m()],_.prototype,"Ds",2),p([m()],_.prototype,"Bt",2),p([m()],_.prototype,"pt",2),p([m()],_.prototype,"zt",2),p([m()],_.prototype,"dc",2),p([m()],_.prototype,"mt",2),p([m()],_.prototype,"Fs",2),p([m()],_.prototype,"gt",2),p([m()],_.prototype,"Ce",2),p([m()],_.prototype,"vt",2),p([m()],_.prototype,"Ht",2),p([m()],_.prototype,"Ai",2),p([m()],_.prototype,"pc",2),p([m()],_.prototype,"Dr",2);var dl={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{mt({CameraSource:_}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!_n.htmlMediaCapture)return ["camera"];let t=K(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(F.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:F.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var Ls={};Ds(Ls,{BtnUi:()=>xt,CloudImageEditor:()=>io,CloudImageEditorBlock:()=>et,Config:()=>Xe,CropFrame:()=>Pi,EditorAspectRatioButtonControl:()=>Ri,EditorCropButtonControl:()=>$i,EditorFilterControl:()=>Yt,EditorFreeformButtonControl:()=>eo,EditorImageCropper:()=>Li,EditorImageFader:()=>Qr,EditorOperationControl:()=>Di,EditorScroller:()=>Fi,EditorSlider:()=>Ui,EditorToolbar:()=>pt,Icon:()=>ae,LineLoaderUi:()=>Oi,PresenceToggle:()=>Je,SliderUi:()=>Vt,defineComponents:()=>mt});var kd="cloud-image-editor",Md="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",pl={id:kd,setup:async({pluginApi:o,uploaderApi:i})=>(mt({...Ls,...Ps}),o.registry.registerIcon({name:"edit-file",svg:Md}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:F.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(M.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.v.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var hl={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{mt({ExternalSource:ht}),o.registry.registerActivity({id:F.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(ut))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(F.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var no=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{r(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){r("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),f=>{if(f.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:u,view:f}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},Id=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=no();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},ml=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=no();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var gl=(o,i)=>ml(o,226,i.map(t=>t.buffer)),Od=async o=>{try{return await gl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Pd=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Ni=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Ld=o=>{let{ctx:t,canvas:e}=Ni();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},Ud=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=no();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},Rd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",so,$d=()=>new Promise(o=>{if(so!==void 0)o(so);else {let i=new Image;i.addEventListener("load",()=>{so=i.naturalWidth<i.naturalHeight,i.src="//:0",o(so);}),i.src=Rd;}}),Dd=(o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},Fd=(o,i)=>{Dd(o,(t,e)=>o.setUint16(t,i,e));},Vd=async(o,i,t)=>(t&&Fd(i,1),ml(o,225,[i.buffer])),Nd=(o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),_d=o=>Nd(new Image,o),zd=[1,3],Bd=[192,193,194,195,197,198,199,201,202,203,205,206,207],fl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hd=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=no();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&Bd.indexOf(r)>=0){let n=s.getUint8(5);zd.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},vl=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},yl=(o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},ce={R:55,G:110,B:165,A:255},Kd=`rgba(${ce.R}, ${ce.G}, ${ce.B}, ${ce.A/255})`,bl=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Ni();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ni();s.width=o,s.height=i,n&&(n.fillStyle=Kd,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===ce.R&&a[1]===ce.G&&a[2]===ce.B&&a[3]===ce.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function wl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var jd=wl(vl(bl,yl)),Gd=wl(vl(bl,yl)),Tl=async(o,i)=>{let t=fl.squareSide.find(n=>n*n>=o*i),e=fl.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([jd(t,t),Gd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},El=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Ni();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},qd=({img:o,targetW:i,targetH:t})=>El(o,i,t),Wd=function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},Zd=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=Wd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(d=>Tl(a,l).then(()=>El(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(o))},Yd=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Xd=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Us=.71,Qd=(o,i)=>{if(o.width*Us*o.height*Us<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return Tl(s,n).then(()=>{let{ctx:a}=Ni();return "imageSmoothingQuality"in a&&!Yd()&&!Xd?qd({img:o,targetW:s,targetH:n}):Zd({img:o,sourceW:t,targetW:s,targetH:n,step:Us})}).catch(()=>Promise.reject("Not supported"))},Cl=async(o,i)=>{try{if(await Hd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Ud(o),$d(),Id(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Od(o).catch(()=>o),d=await _d(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await Qd(d,i),h="image/jpeg",f=i?.quality||.8;!s&&Ld(u)&&(h="image/png",f=void 0);let g=await Pd(u,h,f);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await Vd(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await gl(g,l.value)),g}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};var Jd=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,xl=o=>{if(typeof o!="string")return false;let i=Jd.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}};var Sl={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=xl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Cl(i,e)}}catch{return {file:i}}}});}};var Al={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var kl={id:N.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:N.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var Ml={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{mt({UrlSource:ii}),o.registry.registerActivity({id:F.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(F.URL),i.setModalState(true);}});}};var ri=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>pl},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>Sl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.LOCAL),load:()=>kl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.CAMERA),load:()=>dl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes("instagram"),load:()=>Al},{configDeps:["sourceList"],isEnabled:o=>Object.values(ut).some(i=>K(o("sourceList")).includes(i)),load:()=>hl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.URL),load:()=>Ml}];var ao=class extends Zt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}render(){return v` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([y({type:Boolean})],ao.prototype,"headless",2);var lo=class extends Zt{constructor(){super();this.Ec=false;this.Ee=()=>{if(this.xc){let t=this.$["*historyBack"];t?.();return}this.Cc&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get xc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==x.activities.START_FROM}get Cc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}zs(){return this.getCssData("--cfg-init-activity")||x.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.zs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Ec=this.xc||this.Cc;});}render(){return v` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee} ?hidden=${!this.Ec} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};p([m()],lo.prototype,"Ec",2);var Rs="active",co="",ue=class extends Zt{constructor(){super();this.Hs=false;this.Nr=false;this.Vr=co;this.Ks=co;this.ci="choose-file";this.oi=t=>{t.id===x.activities.CLOUD_IMG_EDIT&&(this.Vr=Rs),this.$["*currentActivity"]===x.activities.UPLOAD_LIST&&(this.Vr=Rs,this.Nr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.Ks=Rs);};this.si=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.Nr=false),t.id===x.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}zs(){return this.getCssData("--cfg-init-activity")||x.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.zs();this.sub("*currentActivity",e=>{e===x.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.Ks=co):(this.Vr=co,this.Nr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Hs=!r):(this.style.removeProperty("--uc-grid-col"),this.Hs=false);});}),this.subConfigValue("multiple",e=>{this.ci=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(Y.OPEN,this.oi),this.modalManager?.subscribe(Y.CLOSE,this.si);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(Y.OPEN,this.oi),this.modalManager?.unsubscribe(Y.CLOSE,this.si);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Nr} class=${this.Ks}><uc-drop-area ?single=${this.Hs} initflow clickable tabindex="0" ><span>${this.l10n(this.ci)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Vr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};p([m()],ue.prototype,"Hs",2),p([m()],ue.prototype,"Nr",2),p([m()],ue.prototype,"Vr",2),p([m()],ue.prototype,"Ks",2),p([m()],ue.prototype,"ci",2);/*! For license information please see uc-file-uploader-inline.min.js.LEGAL.txt */
8
- export{x as ActivityBlock,ys as ActivityHeader,Co as BaseComponent,C as Block,xt as BtnUi,_ as CameraSource,io as CloudImageEditor,Vi as CloudImageEditorActivity,et as CloudImageEditorBlock,Xe as Config,ms as Copyright,Pi as CropFrame,H as Data,dt as DropArea,Ri as EditorAspectRatioButtonControl,$i as EditorCropButtonControl,Yt as EditorFilterControl,eo as EditorFreeformButtonControl,Li as EditorImageCropper,Qr as EditorImageFader,Di as EditorOperationControl,Fi as EditorScroller,Ui as EditorSlider,pt as EditorToolbar,ht as ExternalSource,ut as ExternalUploadSource,Ts as FileItem,lo as FileUploaderInline,ue as FileUploaderMinimal,ao as FileUploaderRegular,qr as FormInput,ae as Icon,ds as Img,Oi as LineLoaderUi,Ei as Modal,Y as ModalEvents,Ut as PACKAGE_NAME,Rt as PACKAGE_VERSION,Mi as PluginActivityHost,Qe as PluginActivityRenderer,Je as PresenceToggle,je as ProgressBar,Ci as ProgressBarCommon,Ge as Select,ki as SimpleBtn,Vt as SliderUi,Zt as SolutionBlock,qe as SourceBtn,xi as SourceList,gs as Spinner,bs as StartFrom,Ze as Thumb,ft as UID,ws as UploadCtxProvider,Ot as UploadList,N as UploadSource,R as UploaderBlock,ii as UrlSource,mt as defineComponents,ln as defineLocale,Xl as loadFileUploaderFrom,cr as toKebabCase};
7
+ var hl=Object.defineProperty;var ml=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var o=e>1?void 0:e?ml(i,t):i,s=r.length-1,n;s>=0;s--)(n=r[s])&&(o=(e?n(i,t,o):n(o))||o);return e&&o&&hl(i,t,o),o};var xt=[],Xt=0,ki=4,Os=r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Xt+ki;s<xt.length;)xt[s]===e?xt.splice(s,ki):s+=ki;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!xt.length;for(let n of i)xt.push(n,t.value,e,o);if(s){for(Xt=0;Xt<xt.length;Xt+=ki)xt[Xt](xt[Xt+1],xt[Xt+2],xt[Xt+3]);xt.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t};function Oi(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}function io(r,i,t){let e=Oi(r,i,t);return t(r.value),e}var ro=(r={})=>{let i=Os(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i};var B=class r{static{this.Ve=new Map;}constructor(i,t){this.J=i,this.yt=t;}get id(){return this.J}pub(i,t){i in this.yt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.yt.setKey(i,t);}sub(i,t,e=true){return (e?io:Oi)(this.yt,[i],s=>{t(s[i]);})}read(i){return i in this.yt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.yt.get()[i]}add(i,t,e=false){(!(i in this.yt.get())||e)&&this.yt.setKey(i,t);}has(i){return i in this.yt.get()}get store(){return this.yt.get()}static registerCtx(i,t){if(r.Ve.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=ro(i);return r.Ve.set(t,e),new r(t,e)}static deleteCtx(i){r.Ve.delete(i);}static getCtx(i){let t=r.Ve.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Ve.has(i)}};var Mi=globalThis,Li=Mi.ShadowRoot&&(Mi.ShadyCSS===void 0||Mi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Is=Symbol(),Ms=new WeakMap,Ii=class{constructor(i,t,e){if(this.Wl=true,e!==Is)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(Li&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Ms.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Ms.set(t,i));}return i}toString(){return this.cssText}},Ls=r=>new Ii(typeof r=="string"?r:r+"",void 0,Is);var Us=(r,i)=>{if(Li)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Mi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},oo=Li?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Ls(t)})(r):r;var{is:gl,defineProperty:vl,getOwnPropertyDescriptor:yl,getOwnPropertyNames:bl,getOwnPropertySymbols:wl,getPrototypeOf:Tl}=Object,Ui=globalThis,Ps=Ui.trustedTypes,El=Ps?Ps.emptyScript:"",xl=Ui.reactiveElementPolyfillSupport,Ye=(r,i)=>r,Qe={toAttribute(r,i){switch(i){case Boolean:r=r?El:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},Pi=(r,i)=>!gl(r,i),Rs={attribute:true,type:String,converter:Qe,reflect:false,useDefault:false,hasChanged:Pi};Symbol.metadata??=Symbol("metadata"),Ui.litPropertyMetadata??=new WeakMap;var Nt=class extends HTMLElement{static addInitializer(i){this.Er(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.bi&&[...this.bi.keys()]}static createProperty(i,t=Rs){if(t.state&&(t.attribute=false),this.Er(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),o=this.getPropertyDescriptor(i,e,t);o!==void 0&&vl(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=yl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let a=o?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Rs}static Er(){if(this.hasOwnProperty(Ye("elementProperties")))return;let i=Tl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Ye("finalized")))return;if(this.finalized=true,this.Er(),this.hasOwnProperty(Ye("properties"))){let t=this.properties,e=[...bl(t),...wl(t)];for(let o of e)this.createProperty(o,t[o]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,o]of t)this.elementProperties.set(e,o);}this.bi=new Map;for(let[t,e]of this.elementProperties){let o=this.xr(t,e);o!==void 0&&this.bi.set(o,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let o of e)t.unshift(oo(o));}else i!==void 0&&t.push(oo(i));return t}static xr(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.wi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.he=null,this.Zl();}Zl(){this.Cr=new Promise(i=>this.enableUpdating=i),this.qt=new Map,this.Xl(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this._e??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this._e?.delete(i);}Xl(){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.wi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Us(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._e?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this._e?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Sr(i,e);}Yl(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.xr(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:Qe).toAttribute(t,e.type);this.he=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.he=null;}}Sr(i,t){let e=this.constructor,o=e.bi.get(i);if(o!==void 0&&this.he!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Qe;this.he=o;let a=n.fromAttribute(t,s.type);this[o]=a??this.Ar?.get(o)??a,this.he=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let n=this.constructor;if(o===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Pi)(s,t)||e.useDefault&&e.reflect&&s===this.Ar?.get(i)&&!this.hasAttribute(n.xr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Cr=this.Ql());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.Ar??=new Map).has(i)&&(this.Ar.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.qt.has(i)||(this.hasUpdated||e||(t=void 0),this.qt.set(i,t)),o===true&&this.he!==i&&(this.Cs??=new Set).add(i));}async Ql(){this.isUpdatePending=true;try{await this.Cr;}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.wi){for(let[o,s]of this.wi)this[o]=s;this.wi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,a=this[o];n!==true||this.qt.has(o)||a===void 0||this.C(o,void 0,s,a);}}let i=false,t=this.qt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this._e?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.kr();}catch(e){throw i=false,this.kr(),e}i&&this.Jl(t);}willUpdate(i){}Jl(i){this._e?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}kr(){this.qt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Cr}shouldUpdate(i){return true}update(i){this.Cs&&=this.Cs.forEach(t=>this.Yl(t,this[t])),this.kr();}updated(i){}firstUpdated(i){}};Nt.elementStyles=[],Nt.shadowRootOptions={mode:"open"},Nt[Ye("elementProperties")]=new Map,Nt[Ye("finalized")]=new Map,xl?.({ReactiveElement:Nt}),(Ui.reactiveElementVersions??=[]).push("2.1.2");var no=globalThis,$s=r=>r,Ri=no.trustedTypes,Ds=Ri?Ri.createPolicy("lit-html",{createHTML:r=>r}):void 0,ao="$lit$",Bt=`lit$${Math.random().toFixed(9).slice(2)}$`,lo="?"+Bt,Cl=`<${lo}>`,me=document,ti=()=>me.createComment(""),ei=r=>r===null||typeof r!="object"&&typeof r!="function",co=Array.isArray,zs=r=>co(r)||typeof r?.[Symbol.iterator]=="function",so=`[ \f\r]`,Je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fs=/-->/g,Vs=/>/g,pe=RegExp(`>|${so}(?:([^\\s"'>=/]+)(${so}*=${so}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),_s=/'/g,Ns=/"/g,Hs=/^(?:script|style|textarea|title)$/i,uo=r=>(i,...t)=>({Wt:r,strings:i,values:t}),v=uo(1),J=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Bs=new WeakMap,he=me.createTreeWalker(me,129);function js(r,i){if(!co(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ds!==void 0?Ds.createHTML(i):i}var Ks=(r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=Je;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Je?d[1]==="!--"?n=Fs:d[1]!==void 0?n=Vs:d[2]!==void 0?(Hs.test(d[2])&&(o=RegExp("</"+d[2],"g")),n=pe):d[3]!==void 0&&(n=pe):n===pe?d[0]===">"?(n=o??Je,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?pe:d[3]==='"'?Ns:_s):n===Ns||n===_s?n=pe:n===Fs||n===Vs?n=Je:(n=pe,o=void 0);let m=n===pe&&r[a+1].startsWith("/>")?" ":"";s+=n===Je?l+Cl:u>=0?(e.push(c),l.slice(0,u)+ao+l.slice(u)+Bt+m):l+Bt+(u===-2?a:m);}return [js(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},ii=class r{constructor({strings:i,Wt:t},e){let o;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ks(i,t);if(this.el=r.createElement(c,e),he.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(o=he.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(ao)){let h=d[n++],m=o.getAttribute(u).split(Bt),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?Di:g[1]==="?"?Fi:g[1]==="@"?Vi:ge}),o.removeAttribute(u);}else u.startsWith(Bt)&&(l.push({type:6,index:s}),o.removeAttribute(u));if(Hs.test(o.tagName)){let u=o.textContent.split(Bt),h=u.length-1;if(h>0){o.textContent=Ri?Ri.emptyScript:"";for(let m=0;m<h;m++)o.append(u[m],ti()),he.nextNode(),l.push({type:2,index:++s});o.append(u[h],ti());}}}else if(o.nodeType===8)if(o.data===lo)l.push({type:2,index:s});else {let u=-1;for(;(u=o.data.indexOf(Bt,u+1))!==-1;)l.push({type:7,index:s}),u+=Bt.length-1;}s++;}}static createElement(i,t){let e=me.createElement("template");return e.innerHTML=i,e}};function fe(r,i,t=r,e){if(i===J)return i;let o=e!==void 0?t.tc?.[e]:t.ec,s=ei(i)?void 0:i.Or;return o?.constructor!==s&&(o?.Ss?.(false),s===void 0?o=void 0:(o=new s(r),o.Mr(r,t,e)),e!==void 0?(t.tc??=[])[e]=o:t.ec=o),o!==void 0&&(i=fe(r,o.ic(r,i.values),o,e)),i}var $i=class{constructor(i,t){this.As=[],this.bt=void 0,this.ks=i,this.c=t;}get parentNode(){return this.c.parentNode}get W(){return this.c.W}u(i){let{el:{content:t},parts:e}=this.ks,o=(i?.creationScope??me).importNode(t,true);he.currentNode=o;let s=he.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Me(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new _i(s,this,i)),this.As.push(c),l=e[++a];}n!==l?.index&&(s=he.nextNode(),n++);}return he.currentNode=me,o}p(i){let t=0;for(let e of this.As)e!==void 0&&(e.strings!==void 0?(e.wt(i,e,t),t+=e.strings.length-2):e.wt(i[t])),t++;}},Me=class r{get W(){return this.c?.W??this.Os}constructor(i,t,e,o){this.type=2,this.i=P,this.bt=void 0,this.Ot=i,this.me=t,this.c=e,this.options=o,this.Os=o?.isConnected??true;}get parentNode(){let i=this.Ot.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Ot}get endNode(){return this.me}wt(i,t=this){i=fe(this,i,t),ei(i)?i===P||i==null||i===""?(this.i!==P&&this.fe(),this.i=P):i!==this.i&&i!==J&&this.Ms(i):i.Wt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):zs(i)?this.k(i):this.Ms(i);}O(i){return this.Ot.parentNode.insertBefore(i,this.me)}T(i){this.i!==i&&(this.fe(),this.i=this.O(i));}Ms(i){this.i!==P&&ei(this.i)?this.Ot.nextSibling.data=i:this.T(me.createTextNode(i)),this.i=i;}$(i){let{values:t,Wt:e}=i,o=typeof e=="number"?this.rc(i):(e.el===void 0&&(e.el=ii.createElement(js(e.h,e.h[0]),this.options)),e);if(this.i?.ks===o)this.i.p(t);else {let s=new $i(o,this),n=s.u(this.options);s.p(t),this.T(n),this.i=s;}}rc(i){let t=Bs.get(i.strings);return t===void 0&&Bs.set(i.strings,t=new ii(i)),t}k(i){co(this.i)||(this.i=[],this.fe());let t=this.i,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(ti()),this.O(ti()),this,this.options)):e=t[o],e.wt(s),o++;o<t.length&&(this.fe(e&&e.me.nextSibling,o),t.length=o);}fe(i=this.Ot.nextSibling,t){for(this.Ti?.(false,true,t);i!==this.me;){let e=$s(i).nextSibling;$s(i).remove(),i=e;}}setConnected(i){this.c===void 0&&(this.Os=i,this.Ti?.(i));}},ge=class{get tagName(){return this.element.tagName}get W(){return this.c.W}constructor(i,t,e,o,s){this.type=1,this.i=P,this.bt=void 0,this.element=i,this.name=t,this.c=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.i=Array(e.length-1).fill(new String),this.strings=e):this.i=P;}wt(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=fe(this,i,t,0),n=!ei(i)||i!==this.i&&i!==J,n&&(this.i=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=fe(this,a[e+l],t,l),c===J&&(c=this.i[l]),n||=!ei(c)||c!==this.i[l],c===P?i=P:i!==P&&(i+=(c??"")+s[l+1]),this.i[l]=c;}n&&!o&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Di=class extends ge{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},Fi=class extends ge{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},Vi=class extends ge{constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}wt(i,t=this){if((i=fe(this,i,t,0)??P)===J)return;let e=this.i,o=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.i=i;}handleEvent(i){typeof this.i=="function"?this.i.call(this.options?.host??this.element,i):this.i.handleEvent(i);}},_i=class{constructor(i,t,e){this.element=i,this.type=6,this.bt=void 0,this.c=t,this.options=e;}get W(){return this.c.W}wt(i){fe(this,i);}},Gs={I:Me},Sl=no.litHtmlPolyfillSupport;Sl?.(ii,Me),(no.litHtmlVersions??=[]).push("3.3.2");var qs=(r,i,t)=>{let e=t?.renderBefore??i,o=e.oc;if(o===void 0){let s=t?.renderBefore??null;e.oc=o=new Me(i.insertBefore(ti(),s),s,void 0,t??{});}return o.wt(r),o};var po=globalThis,yt=class extends Nt{constructor(){super(...arguments),this.renderOptions={host:this},this.Ir=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.Ir=qs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Ir?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Ir?.setConnected(false);}render(){return J}};yt.fp=true,yt.finalized=true,po.litElementHydrateSupport?.({LitElement:yt});var Al=po.litElementPolyfillSupport;Al?.({LitElement:yt});(po.litElementVersions??=[]).push("4.2.2");var kl=/\\([0-9a-fA-F]{1,6} ?)/g;function Ol(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Ml(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function Il(r){let i="",t="";for(let e=0;e<r.length;e++){let o=r[e+1];r[e]==="\\"&&o==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}function Ws(r){let i=r;Ol(r)&&(i=Ml(i),i=i.replace(kl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Il(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ie(r){class i extends r{constructor(){super(...arguments);this.Is=null;this.Lr=null;}getCssData(o,s=false){let n=this.Is??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.Lr||(this.Lr=window.getComputedStyle(this));let a=this.Lr.getPropertyValue(o).trim();try{n[o]=Ws(a);}catch(l){s||console.warn(`CSS Data error: ${o}`,l),n[o]=null;}}return this.Is=n,n[o]}}return i}function Ni(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Zt={};this.Xt=null;this.Ei=false;}createRenderRoot(){return this}connectedCallback(){this.Xt||(this.Xt=Array.from(this.childNodes)),super.connectedCallback();}sc(){if(this.Ei)return;this.Ei=true,this.Zt={};let o=Array.from(this.childNodes),s=o.length?o:this.Xt??[];for(let n of s){let a=this.Ls(n),l=this.Zt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Zt[a]=l;}this.Xt=null;}Ls(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Ls(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}nc(o){return !o.textContent||!o.textContent.trim()}ac(o){let s=this.Zt[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.nc(n))}update(o){!this.hasUpdated&&this.willYield&&this.sc(),super.update(o);}yield(o,s){if(o===""&&!this.Zt[o]&&!this.Ei&&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.Zt[o]=a,this.Ei=true,this.Xt=null;}let n=this.Zt[o];return v` ${n} ${this.ac(o)?s:void 0} `}}return i}function Le(r){class i extends r{static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,o);}}return i}var Yt=class extends Event{constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Ue=class{constructor(i,t,e,o){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=o??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Yt(this.context,this.host,this.t,this.subscribe));}};var Bi=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var ho=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Pe=class extends Bi{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Yt(this.context,a,n,true)));o.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new ho(this.context,this.host));}};var Ul={attribute:true,type:String,converter:Qe,reflect:false,hasChanged:Pi},Pl=(r=Ul,i,t)=>{let{kind:e,metadata:o}=t,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),s.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(r){return (i,t)=>typeof t=="object"?Pl(r,i,t):((e,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}function f(r){return y({...r,state:true,attribute:false})}function $(r,i){let t,e=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Zs="ctx-name-context";function Hi(){return function(r){class i extends r{constructor(...o){super(...o);this.tt=null;this.Be=false;this.Ur=false;this.Pr=void 0;this.ge=new Map;this.ze=new Set;this.init$={};this.ctxOwner=false;this.xi=void 0;this.Ci=false;this.ctxName=this.$t;this.Dt=false;this.xi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.$t,this.cc=new Ue(this,{context:Zs,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Rs=s,this.Ps();},subscribe:true});}static set template(o){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Us(){return this.xi}set Us(o){let s=o??void 0;this.xi!==s&&(this.xi=s,this.Ps());}shouldUpdate(o){return this.Dt?super.shouldUpdate(o):false}get $t(){return this.Us||this.Rs||void 0}Ps(){if(this.ctxName=this.$t,!(!this.ctxName||this.Be)){if(this.isConnected){this.Rr();return}this.Ci=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.$t,this.ctxName&&(this.Pr?this.Pr.setValue(this.ctxName):this.Pr=new Pe(this,{context:Zs,initialValue:this.ctxName}));}$s(){if(!(!this.tt||this.ge.size===0)){for(let[o,{value:s,rewrite:n}]of this.ge)this.tt.add(o,s,n);this.ge.clear();}}Ds(){return !this.tt&&this.$t&&this.$r(),this.tt&&this.$s(),this.tt}Si(){let o=this.Ds();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}$r(){let o=this.init$,s=this.$t;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.tt){this.tt=B.getCtx(s)??B.registerCtx(o,s);for(let[n,a]of Object.entries(this.init$))this.tt.add(n,a,this.ctxOwner);this.$s();}}get $(){return this.$t&&this.$r(),new Proxy({},{get:(o,s)=>{if(typeof s=="string")return this.tt?.read(s)},set:(o,s,n)=>(typeof s!="string"||this.tt?.pub(s,n),true)})}sub(o,s,n=true){let a=this.Si().sub(o,s,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(o,s){this.Si().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.Si()}has(o){return this.tt?.has(o)??false}add(o,s,n=false){let a=this.Ds();if(!a){if(!n&&this.ge.has(o))return;this.ge.set(o,{value:s,rewrite:n});return}this.ge.delete(o),a.add(o,s,n);}add$(o,s=false){for(let[n,a]of Object.entries(o))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Be?this.Dt&&this.Ur&&(this.Ur=false,this.initCallback()):this.ctxName?(this.Ci=false,this.Rr()):this.Ci&&this.$t&&(this.Ci=false,this.Rr());}Rr(){if(this.Be)return;this.Be=true,this.$r();let o=this.init$;if(Object.keys(o).length>0){let s=this.Si();for(let[n,a]of Object.entries(o))s.read(n)===void 0&&s.pub(n,a),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Dt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.uc(),super.disconnectedCallback(),this.Be&&(this.Ur=true);}uc(){if(this.ze.size!==0){for(let o of [...this.ze])o();this.ze.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Us",1),p([f()],i.prototype,"Rs",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"Dt",2),i}}var mo=class extends Le(Hi()(Ie(Ni(yt)))){};var tt=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var Rl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function fo(r){for(let i in r){if(Rl.includes(i))continue;let t=[...i].reduce((e,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),e+=o,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}var go="UC";function $l(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[go]){t(window[go]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[go];i&&fo(s),t(s);},document.head.appendChild(o);})}var ri={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","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-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var vo=new Map,Xs=new Map,Ys=(r,i)=>{vo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...ri,...i};return vo.set(r,t),t},Dl=(r,i)=>{Xs.set(r,i);},Qs=(r,i)=>{typeof i=="function"?Dl(r,i):Ys(r,i);},Js=async r=>{let i=vo.get(r);if(!i){let t=Xs.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Ys(r,e);}return i};Qs("en",ri);var L=r=>`*cfg/${r}`;var lt=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],zt=r=>r.join(",");var tn=r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},ji=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>tn(i)).join("/-/"),et=(...r)=>{let i=ji(...r);return i?`-/${i}/`:""};function Ki(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),o=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):o>=0&&(s=t.slice(o+1)),s}function Gi(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}function yo(r){let i=en(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function bo(r){return yo(r).split("/-/").filter(Boolean).map(t=>tn(t))}function en(r){let i=new URL(r),t=Ki(r),e=rn(t)?on(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function rn(r){return r.startsWith("http")}function on(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var G=(r,i,t)=>{let e=new URL(en(r)),o=t??Ki(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&rn(o)){let n=on(o);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},Qt=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var H=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var oi=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),nn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Fl(r,i){if(typeof i=="number"){let t=i;return oi[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return oi[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return oi.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function Jt(r){return ji(...nn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Fl(i,t)}).filter(i=>!!i))}var qi=ji("format/auto","progressive/yes"),Ht=([r])=>typeof r<"u"?Number(r):void 0,sn=()=>true,Vl=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),_l=([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:H(r,"x").map(Number),coords:H(i).map(Number)}},Nl=Object.freeze({enhance:Ht,brightness:Ht,exposure:Ht,gamma:Ht,contrast:Ht,saturation:Ht,vibrance:Ht,warmth:Ht,filter:Vl,mirror:sn,flip:sn,rotate:Ht,crop:r=>{let[i,t]=r,{dimensions:e,coords:o}=_l([i,t]);return {dimensions:e,coords:o}}});function wo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!nn.includes(e))continue;let s=e,n=Nl[s];try{let a=n(o);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var _=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),it=Object.freeze([_.CROP,_.TUNING,_.FILTERS]),an=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),ln=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),cn=Object.freeze(["rotate","mirror","flip"]),jt=oi,Ct=Object.freeze({brightness:{zero:jt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:jt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:jt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:jt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:jt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:jt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:jt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:jt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:jt.filter,range:[0,100],keypointsNumber:1}});var si="https://ucarecdn.com",Bl="https://upload.uploadcare.com",zl="https://social.uploadcare.com",Hl="https://ucarecd.net",jl={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:zt(it),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:si,cdnCnamePrefixed:Hl,baseUrl:Bl,socialBaseUrl:zl,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",smartBtn:{sourceList:"local, url, camera, dropbox, gdrive",mode:"auto"}},Y=Object.freeze(jl);var Wi=(r,i)=>(...t)=>{let e=r();if(!e.read(L("debug")))return;let o=t;if(typeof t?.[0]=="function"){let n=t[0];o=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);};var W=class{constructor(i){this.Dr=new Set;this.Yt=null;this.z=Wi(()=>this.r.ctx,this.constructor.name);this.r=i,this.e=i.ctx;}addSub(i){this.Dr.add(i);}get Qt(){if(!this.Yt){let i={};this.Yt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let o=L(e);return this.r.ctx.has(o)?this.r.ctx.read(o):Y[e]}});}return this.Yt}destroy(){for(let i of this.Dr)try{i();}catch{}this.Dr.clear();}},Mt=(r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},un=r=>({get ctx(){return r()},get modalManager(){return Mt(r(),"*modalManager",false)},get telemetryManager(){return Mt(r(),"*telemetryManager")},get localeManager(){return Mt(r(),"*localeManager")},get a11y(){return Mt(r(),"*a11y")},get blocksRegistry(){return Mt(r(),"*blocksRegistry")},get eventEmitter(){return Mt(r(),"*eventEmitter")},get uploadCollection(){return Mt(r(),"*uploadCollection")},get secureUploadsManager(){return Mt(r(),"*secureUploadsManager",false)},get api(){return Mt(r(),"*publicApi")},get validationManager(){return Mt(r(),"*validationManager")}});var q=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Zi=class extends W{constructor(){super(...arguments);this.Jt=new Map;this.Tt=new Set;this.w=new Map;}registerModal(t,e){this.Jt.set(t,e),this.K(q.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Jt.get(t);return e?(this.Jt.delete(t),this.Tt.delete(t),this.K(q.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Jt.get(t);return e?(this.Tt.add(t),this.K(q.OPEN,{modal:e,id:t}),true):(this.z(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Jt.get(t);return !e||!this.Tt.has(t)?(this.z(`Modal with ID "${t}" not found or not active`),false):(this.Tt.delete(t),this.K(q.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Jt.has(t)?this.Tt.has(t)?this.close(t):this.open(t):(this.z(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Tt.size>0}back(){if(this.Tt.size===0)return this.z("No active modals to go back from"),false;let t=Array.from(this.Tt).pop();return t?this.close(t):false}closeAll(){let t=this.Tt.size;return this.Tt.clear(),this.K(q.CLOSE_ALL,{}),t}subscribe(t,e){return this.w.has(t)||this.w.set(t,new Set),this.w.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.w.has(t)&&this.w.get(t)?.delete(e);}K(t,e){if(this.w.has(t))for(let o of this.w.get(t)??new Set)try{o(e);}catch(s){this.r.telemetryManager.sendEventError(s,"modal subscriber"),this.z("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Jt.clear(),this.w.clear(),this.K(q.DESTROY,{});}};var ni=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");function dn(r){return Object.prototype.toString.call(r)==="[object Object]"}var Kl=/\W|_/g;function Gl(r){return r.split(Kl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function pn(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Gt(t,{ignoreKeys:i})):r}function Gt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return pn(r,{ignoreKeys:i});if(!dn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}dn(o)?o=Gt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=pn(o,{ignoreKeys:i})),t[Gl(e)]=o;}return t}var ql=r=>new Promise(i=>setTimeout(i,r));function ko({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:o=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:s,integration:o});let n=[r,i,e].filter(Boolean).join("/"),a=[s,o].filter(Boolean).join("; ");return `${n} (${a})`}var Wl={factor:2,time:100};function Zl(r,i=Wl){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a=>ql(a??s).then(()=>(t+=1,e(o)))})}return e(r)}var ve=class extends Error{},Re=class r extends ve{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Xi=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},te=class r extends ve{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Xl=500,mn=({check:r,interval:i=Xl,timeout:t,signal:e})=>new Promise((o,s)=>{let n,a;Xi(e,()=>{n&&clearTimeout(n),s(new te("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new te("Timed out"));},t));let l=()=>{try{Promise.resolve(r(e)).then(c=>{c?(a&&clearTimeout(a),o(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Yi="application/octet-stream",fn="original",ie=({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,m]=u;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",Xi(o,()=>{d=true,l.abort(),a(new te);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let C=w.split(": "),E=C.shift(),S=C.join(": ");E&&typeof E<"u"&&(m[E]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:m,status:b});}},l.onerror=u=>{d||a(new Re(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Yl(r,...i){return r}var Ql=({name:r})=>r?[r]:[],Jl=Yl,tc=()=>new FormData,gn=r=>false,Qi=r=>typeof Blob<"u"&&r instanceof Blob,Ji=r=>typeof File<"u"&&r instanceof File,tr=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",$e=r=>Qi(r)||Ji(r)||gn()||tr(r),ec=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",ic=r=>!!r&&typeof r=="object"&&!Array.isArray(r),rc=r=>!!r&&typeof r=="object"&&"data"in r&&$e(r.data);function vn(r,i,t){if(Array.isArray(t))for(let e of t)vn(r,`${i}[]`,e);else if(rc(t)){let{name:e,contentType:o}=t,s=Jl(t.data,e,o??Yi),n=Ql({name:e});r.push([i,s,...n]);}else if(ic(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else ec(t)&&t&&r.push([i,t.toString()]);}function oc(r){let i=[];for(let[t,e]of Object.entries(r))vn(i,t,e);return i}function er(r){let i=tc(),t=oc(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}var rt=class r extends ve{code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},sc=r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},Kt=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=sc(t)),e.toString()},nc="6.18.4",ac="UploadcareUploadClient",lc=nc;function be(r){return ko({libraryName:ac,libraryVersion:lc,...r})}var cc="RequestThrottledError",hn=15e3,uc=1e3;function dc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return hn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:hn}function re(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Zl(({attempt:o,retry:s})=>r().catch(n=>{if("response"in n&&n?.code===cc&&o<t)return s(dc(n));if(n instanceof Re&&o<e)return s((o+1)*uc);throw n}))}var yn=r=>{let i="";return (Qi(r)||Ji(r)||tr(r))&&(i=r.type),i||Yi},bn=r=>{let i="";return Ji(r)&&r.name?i=r.name:Qi(r)||gn()?i="":tr(r)&&r.name&&(i=r.name),i||fn};function Oo(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function pc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=U.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",url:Kt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},data:er({file:{data:r,name:t||bn(r),contentType:e||yn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Oo(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:C,request:E})=>{let S=Gt(JSON.parse(w));if("error"in S)throw new rt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var xo;(function(r){r.Token="token",r.FileInfo="file_info";})(xo||(xo={}));function hc(r,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},url:Kt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Oo(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:C,request:E})=>{let S=Gt(JSON.parse(w));if("error"in S)throw new rt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var ct;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ct||(ct={}));var mc=r=>"status"in r&&r.status===ct.Error;function fc(r,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=U.retryNetworkErrorMaxTimes}={}){return re(()=>ie({method:"GET",headers:i?{"X-UC-User-Agent":be({publicKey:i,integration:o,userAgent:s})}:void 0,url:Kt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=Gt(JSON.parse(l));if("error"in u&&!mc(u))throw new rt(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function gc(r,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=U.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:l,userAgent:c})},url:Kt(t,"/group/",{jsonerrors:1}),data:er({files:r,callback:e,pub_key:i,signature:o,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=Gt(JSON.parse(h));if("error"in b)throw new rt(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function wn(r,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"GET",headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},url:Kt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=Gt(JSON.parse(c));if("error"in h)throw new rt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function vc(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",url:Kt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:u,userAgent:h})},data:er({filename:e,size:r,content_type:t||Yi,part_size:o,UPLOADCARE_STORE:Oo(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:C,request:E})=>{let S=Gt(JSON.parse(w));if("error"in S)throw new rt(S.error.content,S.error.errorCode,E,S,C);return S.parts=Object.keys(S.parts).map(gt=>S.parts[Number(gt)]),S}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}function yc(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Yi}}).then(a=>(o&&o({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function bc(r,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"POST",url:Kt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},data:er({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:c,headers:d,request:u})=>{let h=Gt(JSON.parse(c));if("error"in h)throw new rt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Mo(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return mn({check:d=>wn(r,{publicKey:i,baseURL:t,signal:d,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function wc(r){return "defaultEffects"in r}var ye=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=Kt(t,`${o}/`),a=s?Kt(`https://${s}.s3.amazonaws.com/`,`${o}/${i.filename}`):null;this.uuid=o,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=a,wc(i)&&(this.defaultEffects=i.defaultEffects);}},Tc=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>pc(r,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:C})=>Mo(C,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(C=>new ye(C,{baseCDN:b})),Ec=(r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>wn(r,{publicKey:i,baseURL:e,signal:o,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new ye(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),xc=(r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=n=>()=>{e=n,o.forEach((a,l)=>l!==n&&a.abort());};return Xi(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:o[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},Cc=window.WebSocket,Co=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Sc=(r,i)=>r==="success"?{status:ct.Success,...i}:r==="progress"?{status:ct.Progress,...i}:{status:ct.Error,...i},So=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Co;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Cc(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,Sc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},To=null,Io=r=>{if(!To){let i=typeof window>"u"?0:3e4;To=new So(r,i);}return To},Ac=r=>{Io(r).connect();};function kc({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return mn({check:c=>fc(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case ct.Error:return new rt(d.error,d.errorCode);case ct.Waiting:return false;case ct.Unknown:return new rt(`Token "${r}" was not found.`);case ct.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case ct.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var Oc=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=Io(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(r);};Xi(t,()=>{l(),s(new te("pusher cancelled"));}),n.subscribe(r,c=>{switch(c.status){case ct.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case ct.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),o(c);break}case ct.Error:l(),s(new rt(c.msg,c.error_code));}});}),Mc=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=U.pusherKey,metadata:C})=>Promise.resolve(Ac(w)).then(()=>hc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:C})).catch(E=>(Io(w)?.disconnect(),Promise.reject(E))).then(E=>E.type===xo.FileInfo?E:xc([({signal:S})=>kc({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:S}),({signal:S})=>Oc({token:E.token,pusherKey:w,signal:S,onProgress:u})],{signal:d})).then(E=>{if(E instanceof rt)throw E;return E}).then(E=>Mo(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(E=>new ye(E,{baseCDN:o})),Eo=new WeakMap,Ic=async r=>{if(Eo.has(r))return Eo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Eo.set(r,i),i},Tn=async r=>{if(Ji(r)||Qi(r))return r.size;if(tr(r))return (await Ic(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},Lc=(r,i=U.multipartMinFileSize)=>r>=i,En=r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !$e(r)&&t.test(r)},Lo=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !$e(r)&&t.test(r)},Uc=(r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(o[c]=u,n-=1,n?l():t(o));}).catch(u=>{s=true,e(u);});};for(let c=0;c<r;c++)l();}),Pc=(r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},Rc=async(r,i,t)=>e=>Pc(r,e,i,t),$c=(r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>yc(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),Dc=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=U.multipartChunkSize,maxConcurrentRequests:C=U.maxConcurrentRequests,baseCDN:E,metadata:S})=>{let gt=e??await Tn(r),vt,de=(X,at)=>{if(!c)return;vt||(vt=Array(X).fill(0));let Et=Ot=>Ot.reduce((_t,eo)=>_t+eo,0);return Ot=>{Ot.isComputable&&(vt[at]=Ot.value,c({isComputable:true,value:Et(vt)/X}));}};return b||=yn(r),vc(gt,{publicKey:i,contentType:b,fileName:t||bn(r),baseURL:o,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:w}).then(async({uuid:X,parts:at})=>{let Et=await Rc(r,gt,w);return Promise.all([X,Uc(C,at.map((Ot,_t)=>()=>$c(Et(_t),Ot,{publicKey:i,contentType:b,onProgress:de(at.length,_t),signal:l,integration:u,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([X])=>bc(X,{publicKey:i,baseURL:o,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(X=>X.isReady?X:Mo(X.uuid,{publicKey:i,baseURL:o,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(X=>new ye(X,{baseCDN:E}))};async function Uo(r,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:E=U.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:gt,pusherKey:vt,metadata:de}){if($e(r)){let X=await Tn(r);return Lc(X,b)?Dc(r,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:X,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:de}):Tc(r,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:de})}if(Lo(r))return Mc(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:gt,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:vt,metadata:de});if(En(r))return Ec(r,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${r}" is not supported`)}var Fc=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},Ao=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Fc(i.cdnUrl,t),this.files=e.map(o=>new ye(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},Vc=r=>{for(let i of r)if(!$e(i))return false;return true},_c=r=>{for(let i of r)if(!En(i))return false;return true},Nc=r=>{for(let i of r)if(!Lo(i))return false;return true};function xn(r,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=U.multipartChunkSize,baseCDN:w=U.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:S}){if(!Vc(r)&&!Nc(r)&&!_c(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let gt,vt=true,de=r.length,X=(at,Et)=>{if(!l)return;gt||(gt=Array(at).fill(0));let Ot=_t=>_t.reduce((eo,pl)=>eo+pl)/at;return _t=>{if(!_t.isComputable||!vt){vt=false,l({isComputable:false});return}gt[Et]=_t.value,l({isComputable:true,value:Ot(gt)});}};return Promise.all(r.map((at,Et)=>$e(at)||Lo(at)?Uo(at,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:a,onProgress:X(de,Et),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Ot=>Ot.uuid):at)).then(at=>gc(at,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:o,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m}).then(Et=>new Ao(Et,{baseCDN:w})).then(Et=>(l&&l({isComputable:true,value:1}),Et)))}var ee=class{Ai=1;Fr=[];ki=0;Nr=new Map;Vr=new Map;constructor(i){this.Ai=i;}run(){let i=this.Ai-this.ki;for(let t=0;t<i;t++){let e=this.Fr.shift();if(!e)return;let o=this.Nr.get(e),s=this.Vr.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.ki+=1,e().finally(()=>{this.Nr.delete(e),this.Vr.delete(e),this.ki-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.Nr.set(i,e),this.Vr.set(i,o),this.Fr.push(i),t&&this.run();})}get pending(){return this.Fr.length}get running(){return this.ki}set concurrency(i){this.Ai=i,this.run();}get concurrency(){return this.Ai}};var Po=()=>({}),Ro=r=>({...Po(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),$o=r=>({...Ro(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ee(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Cn=r=>({...$o(r),"*solution":null});var dt=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var ir=class extends W{constructor(t){super(t);this.scopes=new Set;this.listener=this.dc.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.r.api.setCurrentActivity(dt.UPLOAD_LIST),this.r.api.setModalState(true);}async dc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.Qt.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){let e=Array.from(t.clipboardData.items),o=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));o.length>0&&(o.forEach(n=>{this.r.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this.r.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var Bc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ai(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function Do(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Bc[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}function Fo(r,i){return i.role==="toolbar"?zc(i):i.querySelectorAll(`[role=${r.role}]`)}function zc(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Hc(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function Sn(r){return i=>{let t=false,e=300,o=0,s="";function n(u){let h=Do(u.target);if(!h){a();return}let m=Fo(u.target,h),g=Array.from(m).indexOf(u.target),b="ArrowDown",w="ArrowUp";if(Hc(h)&&(i.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),u.key===b)u.preventDefault(),ai(u.target,m[g+1]||m[0]);else if(u.key===w)u.preventDefault(),ai(u.target,m[g-1]||m[m.length-1]);else if(u.key==="Home")u.preventDefault(),ai(u.target,m[0]);else if(u.key==="End")u.preventDefault(),ai(u.target,m[m.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let C=Date.now();C-o<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),o=C;let E=Array.from(m).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(u.preventDefault(),ai(u.target,E));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=Do(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let m=Fo(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=Do(u.target);if(h){let m=Fo(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function An(){return r=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}function kn(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let o=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function On(r){let i,t=r.split(" "),e;function o(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&i.classList.remove(...t),e=null;}function n(a){a.clientX===0&&a.clientY===0&&e!==a.target&&(s(),a.target.classList.add(...t),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",o),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",o),a.removeEventListener("keyup",s);})}function Mn(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var Vo=class{constructor(){this.He=new Map;this._r=[];}addEventListener(i,t){let e=o=>{let s=o.target;s instanceof Node&&this._r.some(n=>n===s||n.contains(s))&&t(o);};this.He.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.He.get(t);e&&window.removeEventListener(i,e),this.He.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._r.push(i);}destroy(){this._r=[];for(let i of this.He.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.He.clear();}},rr=class{constructor(){this.Oi=new Vo,this.Fs=Mn(this.Oi,[Sn(),On("is-pressed"),kn(),An()]);}registerBlock(i){this.Oi.registerScope(i);}destroy(){this.Fs?.(),this.Oi.destroy();}};var qt=r=>`*l10n/${r}`,jc="en",or=class extends W{constructor(t){super(t);this.Br="";for(let[e,o]of Object.entries(ri)){let s=this.e.has(qt(e))?!this.e.read(qt(e)):true;this.e.add(qt(e),o,s);}this.addSub(this.e.sub(L("localeName"),async e=>{if(!e)return;this.Br=e;let o=await Js(e);if(e!==jc&&this.Br!==e)return;let s=this.Qt.localeDefinitionOverride?.[e];for(let[n,a]of Object.entries(o)){let l=s?.[n];this.e.add(qt(n),l??a,true);}})),this.addSub(this.e.sub(L("localeDefinitionOverride"),e=>{if(!e)return;let o=e[this.Br];if(o)for(let[s,n]of Object.entries(o))this.e.add(qt(s),n,true);}));}};function Kc(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function No(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?No(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=Kc(i);return typeof t=="object"&&t!==null?[e,No(t)]:[e,t]}))}function Gc(r){return {ok:true,value:r}}function _o(r){return {ok:false,error:r}}var qc="https://tlm.uploadcare.com/api/",Bo=class{constructor(i=qc){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return _o(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return Gc(s)}catch(s){return _o(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return _o(new Error(`Error fetching data from "${e}". Error: ${o}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(No(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Wc=async(r,i)=>({success:true,data:i}),Zc=async r=>Wc(void 0,r),sr=class extends Bo{constructor(){super();}async sendEvent(i,t){let e=await Zc(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 Xc=20,D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),M=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"}),nr=class extends W{constructor(){super(...arguments);this.Ke=new Map;this.Mi=new Set;}bindTarget(t){return this.Mi.add(t),()=>{this.Mi.delete(t);}}Ns(t,e){for(let o of this.Mi)o.dispatchEvent(new CustomEvent(t,{detail:e}));this.z?.(()=>{let o=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,o]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Ns(t,typeof e=="function"?e():e);return}this.Ke.has(t)&&window.clearTimeout(this.Ke.get(t));let n=typeof s=="number"?s:Xc,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Ns(t,l),this.Ke.delete(t);}catch(l){this.z?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Ke.set(t,a);}destroy(){for(let t of this.Ke.values())window.clearTimeout(t);this.Mi.clear();}};var In="1.30.0-alpha.1";var It="blocks",Lt=In;var ar=class extends W{constructor(t){super(t);this.pc=tt.generateRandomUUID();this.ve=structuredClone(Y);this.zr=false;this.Hr=null;this.Ft=false;this.Vs=new sr,this.ye=new ee(10),this.addSub(this.e.sub(L("qualityInsights"),e=>{this.Ft=!!e;}));for(let e of Object.keys(this.ve))this.addSub(this.e.sub(L(e),o=>{this.Ft&&(this.zr&&this.ve[e]!==o&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.hc(e,o));}));}mc(t){t===D.INIT_SOLUTION&&!this.zr&&(this.zr=true);}hc(t,e){this.ve[t]!==e&&(this.ve[t]=e);}fc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===D.INIT_SOLUTION||t.eventType===D.CHANGE_CONFIG)&&(o.config=this.ve),{...o,appVersion:Lt,appName:It,sessionId:this.pc,component:this.gc,activity:this.vc,projectPubkey:this.ve.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.yc,payload:{location:this.bc,...e}}}wc(t){return !!(t&&[M.CHANGE,M.COMMON_UPLOAD_PROGRESS,M.FILE_ADDED,M.FILE_REMOVED,M.FILE_UPLOAD_START,M.FILE_UPLOAD_PROGRESS,M.FILE_UPLOAD_SUCCESS,M.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Ft)return;let e=this.fc({eventType:t.eventType,payload:t.payload,config:t.config});this.mc(t.eventType),!(this.wc(t.eventType)||this.Hr&&this._s(this.Hr,e))&&this.ye.add(async()=>{this.Hr=e,await this.Vs.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}_s(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let o=Object.keys(t),s=Object.keys(e);if(o.length!==s.length)return false;for(let n of o)if(!Object.hasOwn(e,n)||!this._s(t[n],e[n]))return false;return true}get yc(){return Date.now()}get gc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get vc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get bc(){return location.origin}};var Ln=r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var Qc=r=>r;var Un="plural:";function De(r,i={},t={}){let{openToken:e="{{",closeToken:o="}}",transform:s=Qc}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);r=r.replaceAll(e+n+o,c);}return r}function Pn(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith(Un)){let s=r.substring(t+2,e).replace(Un,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}var Rn="--uploadcare-blocks-window-height",li=class r{static{this.clientsRegistry=new Set;}static{this.flush=$(()=>{document.documentElement.style.setProperty(Rn,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Rn);}};var lr=(r,i)=>new Intl.PluralRules(r).select(i);var Jc=r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=lr(o,t);return e(`${i}__${s}`)},cr=r=>{let i=Jc(()=>t),t=(e,o={})=>{if(!e)return "";let n=r().read(qt(e))||e,a=Pn(n);for(let c of a)o[c.variable]=i(c.pluralKey,Number(o[c.countVariable]));return De(n,o)};return t};var tu=r=>r.tagName?.includes("-")??false,ur=class{constructor(i){this.te=new Set;this.Ii=new Map;this.Bs=false;this.ee=i,this.ee.addController(this);}hostDisconnected(){this.Li?.(),this.Li=void 0,this.te.clear(),this.Ii.clear();}hostUpdated(){if(!this.Li&&this.ee.has(L("testMode"))){let i=this.ee.subConfigValue("testMode",t=>{this.Bs=!!t,this.zs();});this.Li=i;}this.Tc(),this.zs();}Tc(){let i=this.ee,t=i.renderRoot??i;if(!t)return;let e=this.ee,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!tu(n));for(let n of s)if(!(o&&n.closest(o)!==e)&&!this.te.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.te.add(n),this.Ii.set(n,a);}for(let n of Array.from(this.te))(!n.isConnected||o&&n.closest(o)!==e)&&(this.te.delete(n),this.Ii.delete(n));}zs(){if(!this.te.size)return;let i=this.ee.testId||"";for(let t of this.te){let e=this.Ii.get(t);e&&(this.Bs?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var eu=Le(Hi()(Ie(Ni(yt)))),x=class extends eu{constructor(){super();this.Ui=new Map;this.activityType=null;this.init$=Po();this.l10n=cr(()=>this.sharedCtx);this.debugPrint=Wi(()=>this.sharedCtx,this.constructor.name);this.r=un(()=>this.sharedCtx);new ur(this);}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),li.registerClient(this);}initCallback(){this.et("*blocksRegistry",()=>new Set),this.et("*eventEmitter",t=>new nr(t)),this.et("*localeManager",t=>new or(t)),this.et("*modalManager",t=>new Zi(t)),this.et("*a11y",()=>new rr),this.et("*clipboard",t=>new ir(t)),this.et("*telemetryManager",t=>new ar(t)),this.sub(qt("locale-id"),t=>{let e=Ln(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.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 blocksRegistry(){return this.ot("*blocksRegistry")}get eventEmitter(){return this.ot("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),li.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Ec(),B.deleteCtx(this.ctxName);}et(t,e){if(!this.Ui.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.r);this.add(t,o,true),this.Ui.set(t,o);return}}Ec(){for(let[t,e]of this.Ui.entries())e?.destroy?.(),this.pub(t,null),this.Ui.delete(t);}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:Gi(t),cdnUrlModifiers:yo(t),fileName:Ki(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?De(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.Yt){let t={};this.Yt=new Proxy(t,{set:(e,o,s)=>{if(typeof o!="string"||!(o in Y))return false;let n=o,a=L(n);return this.has(a)||this.add(a,Y[n]),this.$[a]=s,true},get:(e,o)=>{let s=L(o);return this.has(s)||this.add(s,Y[o]),this.$[s]}});}return this.Yt}subConfigValue(t,e){let o=L(t);return this.has(o)||this.add(o,Y[t]),this.sub(o,e)}};var Ut={ATTRIBUTE:1,CHILD:2},pt=r=>(...i)=>({Or:r,values:i}),bt=class{constructor(i){}get W(){return this.c.W}Mr(i,t,e){this.Pi=i,this.c=t,this.xc=e;}ic(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var we=class extends bt{constructor(i){if(super(i),this.it=P,i.type!==Ut.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===P||i==null)return this.Hs=void 0,this.it=i;if(i===J)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Hs;this.it=i;let t=[i];return t.raw=t,this.Hs={Wt:this.constructor.resultType,strings:t,values:[]}}};we.directiveName="unsafeHTML",we.resultType=1;var ci=class extends we{};ci.directiveName="unsafeSVG",ci.resultType=2;var dr=pt(ci);var $n="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Wt=class extends x{constructor(){super(...arguments);this.init$=Cn(this);}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);}render(){return v`${dr($n)}`}};var Dn=r=>typeof r!="number"?0:Math.floor(r/1e3),Fn=(r,{threshold:i})=>{let{secureExpire:t}=r,e=Dn(Date.now()),o=Number(t),s=Dn(i);return e+s>=o};var pr=class extends W{constructor(){super(...arguments);this.ie=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.Qt;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.ie||Fn(this.ie,{threshold:s})){this.ie?this.z("Secure signature is expired. Resolving a new one..."):this.z("Secure signature is not set yet.");try{let n=await o();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.z("Secure signature resolved:",n),this.z("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.ie=n):(this.z("Secure signature resolver returned nothing."),this.ie=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.r.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ie}return t&&e?(this.z("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ie=null;}};var zo=(r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Ho=(r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}};var iu=()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},ru=()=>"capture"in document.createElement("input"),ou=()=>({safariDesktop:iu()}),su=()=>({htmlMediaCapture:ru()}),Vn=ou(),Te=su();var ui="image/*",jo="video/*",nu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],au=()=>Vn.safariDesktop?[ui]:[ui,...nu],di=au(),hr=r=>r?r.filter(i=>typeof i=="string").flatMap(i=>H(i)):[],Ko=(r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),_n=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),Nn=r=>{let i=r?.type;return i?Ko(i,di):false};var Go=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=hr([...t?di:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let a=Ko(s,o),l=_n(n,o);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};var qo=(r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}};var Pt=1e3,Ee=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),pi=r=>Math.ceil(r*100)/100,Bn=(r,i=Ee.AUTO)=>{let t=i===Ee.AUTO;if(i===Ee.BYTE||t&&r<Pt**1){let o=lr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===Ee.KB||t&&r<Pt**2?`${pi(r/Pt**1)} KB`:i===Ee.MB||t&&r<Pt**3?`${pi(r/Pt**2)} MB`:i===Ee.GB||t&&r<Pt**4?`${pi(r/Pt**3)} GB`:i===Ee.TB||t&&r<Pt**5?`${pi(r/Pt**4)} TB`:`${pi(r/Pt**5)} PB`};var Wo=(r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Bn(t)}),payload:{entry:r}}};var Zo=(r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof rt)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof Re)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}};var Fe={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},lu=r=>typeof r=="function"?{runOn:"change",validator:r}:r,mr=class extends W{constructor(t){super(t);this.Cc=[qo,Go,Wo,Zo];this.Sc=[Ho,zo];this.ye=new ee(20);this.Ks=$(()=>{this.ye.run();},500);this.Nt=false;this.be=new Map;let e=$(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(L("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(L("multipleMin"),e)),this.addSub(this.e.sub(L("multipleMax"),e)),this.addSub(this.e.sub(L("multiple"),e)),this.addSub(this.e.sub(L("imgOnly"),e)),this.addSub(this.e.sub(L("accept"),e)),this.addSub(this.e.sub(L("validationConcurrency"),o=>{this.ye.concurrency=o;}));}get f(){return this.r.uploadCollection}runFileValidators(t,e){if(this.Nt)return;let o=e??this.f.items();for(let s of o){let n=this.f.read(s);n&&this.Ac(n,t);}}runCollectionValidators(){if(this.Nt)return;let t=this.r.api,e=t.getOutputCollectionState(),o=[],s=this.Qt.collectionValidators;for(let n of [...this.Sc,...s])try{let a=n(e,t);if(!a)continue;a&&(o.push(this.js(a)),a.message||console.warn(Fe.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Fe.COLLECTION_VALIDATION_FAILED,a);}this.e.pub("*collectionErrors",o),o.length>0&&this.r.eventEmitter.emit(M.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.be.get(t.uid);e&&(e.abortController?.abort(),this.be.delete(t.uid));}async Ac(t,e){if(this.Nt)return;let o=this.r.api,s=this.Gs(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Nt||(await n,this.Nt))return;let l=this.kc(t,e);if(l.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=o.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.Qt.validationTimeout,h=this.qs(),m=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!m.has(w.validator)){let C=s.lastErrorThrownByValidator.get(w.validator);C&&g.push(C);}let b=l.map(w=>async()=>{if(this.Nt)return;let C=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(Fe.FILE_VALIDATION_TIMEOUT);},u);try{let E=await w.validator(c,o,{signal:d.signal});if(!E||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let S=this.js(E);s.lastErrorThrownByValidator.set(w.validator,S),g.push(S),E.message||console.warn(Fe.MISSING_ERROR_MESSAGE);}catch(E){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(Fe.FILE_VALIDATION_FAILED,E),this.r.telemetryManager.sendEventError(E,`file validator. ${Fe.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.Ks(),await this.ye.add(async()=>{this.Nt||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}js(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Gs(t){let e=this.be.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.be.set(t.uid,o),o}qs(){let t=this.Qt.fileValidators;return [...this.Cc,...t].map(lu)}kc(t,e){let o=this.Gs(t);return this.qs().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Nt=true,this.Ks.cancel();for(let t of this.be.values())t.abortController?.abort(),t.promise=void 0;this.be.clear();}};var zn="[Typed State] Wrong property name: ",fr=class{constructor(i){this.J=tt.generateFastUid(),this.Z=B.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Z.has(i)){console.warn(`${zn}${String(i)}`);return}this.Z.read(i)!==t&&this.Z.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Z.has(i)||console.warn(`${zn}${String(i)}`),this.Z.read(i)}subscribe(i,t){return this.Z.sub(i,t)}destroy(){B.deleteCtx(this.J);}};var gr=class r{constructor(i){this.Vt=Object.create(null);this.Ri=new Set;this.$i=new Set;this.Mt=new Set;this.Kr=new Set;this.jr=new Set;this.we=new Set;this.Xs=i.initialValue,this.J=tt.generateFastUid(),this.Z=B.registerCtx({},this.J),this.Ws=i.watchList||[];let t=Object.create(null);this.Zs=(e,o)=>{this.je&&window.clearTimeout(this.je),t[e]||(t[e]=new Set),t[e].add(o),this.je=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Ri.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Ys();},i.handler&&this.observeCollection(i.handler);}static{this.Oc=1e4;}K(){this.Ge&&window.clearTimeout(this.Ge),this.Ge=window.setTimeout(()=>{let i=new Set(this.jr),t=new Set(this.Kr);this.jr.clear(),this.Kr.clear();for(let e of this.$i)e?.([...this.Mt],i,t);this.Ys();});}Ys(){this.we.size!==0&&(this.qe&&window.clearTimeout(this.qe),this.qe=window.setTimeout(()=>{let i=[...this.we];this.we.clear();for(let t of i)t.destroy();},r.Oc));}observeCollection(i){return this.$i.add(i),this.Mt.size>0&&this.K(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.$i.delete(i);}add(i){let t=new fr(this.Xs);for(let[e,o]of Object.entries(i))t.setValue(e,o);return this.Mt.add(t.uid),this.K(),this.Z.add(t.uid,t),this.jr.add(t),this.Ws.forEach(e=>{this.Vt[t.uid]||(this.Vt[t.uid]=[]),this.Vt[t.uid]?.push(t.subscribe(e,()=>{this.Zs(e,t.uid);}));}),t.uid}hasItem(i){return this.Mt.has(i)}read(i){return this.Z.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let o=this.read(i);if(!o)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);o.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.Kr.add(t),this.we.add(t)),this.Mt.delete(i),this.K(),this.Z.pub(i,void 0),this.Vt[i]?.forEach(e=>{e();}),delete this.Vt[i];}clearAll(){this.Mt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Ri.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Ri.delete(i);}findItems(i){let t=[];return this.Mt.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.Mt]}get size(){return this.Mt.size}destroy(){this.je&&window.clearTimeout(this.je),this.Ge&&window.clearTimeout(this.Ge),this.qe&&window.clearTimeout(this.qe);for(let i of this.we)i.destroy();this.we.clear(),B.deleteCtx(this.J),this.Ri=new Set,this.$i=new Set;for(let i of Object.keys(this.Vt))this.Vt[i]?.forEach(t=>{t();}),delete this.Vt[i];}};var A=Object.freeze({PHOTO:"photo",VIDEO:"video"}),wt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Xo=r=>({isVideoRecordingEnabled:lt(r.cameraModes).includes(A.VIDEO),isPhotoEnabled:lt(r.cameraModes).includes(A.PHOTO)});var Yo=(r,i)=>{for(let t of r)if(i(t))return t};var Hn=(r,i)=>{for(let t of r)if(i(t))return true;return false};function vr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}var cu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,uu=new RegExp(`^/?(${cu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),jn=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(si),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=uu.exec(o.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var Rt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Qo=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),z=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Qo,...Rt});var yr=r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e));function Kn(r){let i=new Map;return (...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s}}var Gn=new Set;function br(r){Gn.has(r)||(Gn.add(r),console.warn(r));}function du(r){let i=false;return setTimeout(()=>{i=true;},0),e=>((...o)=>(i&&br(r),e(...o)))}function qn(r){let i={},t=r.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>r.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>yr(r),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},o=du("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=Kn(o(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var wr=class extends W{constructor(){super(...arguments);this.Mc=cr(()=>this.e);this.addFileFromUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??z.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??z.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:o,source:s}={})=>{let n=jn({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.f.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??z.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let a=this.f.add({file:t,isImage:Nn(t),mimeType:t.type,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??z.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);};this.uploadAll=()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.r.eventEmitter.emit(M.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=zt(hr([this.cfg.accept??"",...this.cfg.imgOnly?di:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),vr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Xo(this.cfg);t.modeCamera===A.PHOTO&&n?s.accept=ui:t.modeCamera===A.VIDEO&&a?s.accept=jo:s.accept=[ui,a&&jo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?z.CAMERA:z.LOCAL});}),this.r.modalManager?.open(dt.UPLOAD_LIST),this.e.pub("*currentActivity",dt.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.f.size>0&&!t)this.r.modalManager?.open(dt.UPLOAD_LIST),this.e.pub("*currentActivity",dt.UPLOAD_LIST);else if(this._t?.length===1){let e=this._t[0];if(e==="local"){this.e.pub("*currentActivity",dt.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&Te.htmlMediaCapture){let{isPhotoEnabled:o,isVideoRecordingEnabled:s}=Xo(this.cfg);if(o&&s){this.e.pub("*currentActivity",dt.START_FROM);return}else if(o||s){this.openSystemDialog({captureCamera:true,modeCamera:o?A.PHOTO:A.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:A.PHOTO});}setTimeout(()=>{if(e!==this._t[0])return;let o=this.r.blocksRegistry;Yo(o,a=>"type"in a&&a.type===e)?.activate();},0),this.e.read("*currentActivity")&&this.r.modalManager?.open(this.e.read("*currentActivity"));}else this.r.modalManager?.open(dt.START_FROM),this.e.pub("*currentActivity",dt.START_FROM);};this.doneFlow=()=>{let t=Yo(this.r.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.r.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{if(Hn(this.r.blocksRegistry,o=>o.activityType===t)){this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);};this.getCurrentActivity=()=>this.e.read("*currentActivity");this.setModalState=t=>{if(t&&!this.e.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this.r.modalManager?.open(this.e.read("*currentActivity")):(this.r.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null));};}get f(){return this.r.uploadCollection}get cfg(){return this.Qt}get l10n(){return this.Mc}removeAllFiles(){this.f.clearAll();}getOutputItem(t){let e=B.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let o=e.store,s=o.fileInfo,n=o.isRemoved?"removed":o.errors.length>0?"failed":o.fileInfo?"success":o.isUploading?"uploading":"idle";return {uuid:s?.uuid??o.uuid??null,internalId:t,name:s?.originalFilename??o.fileName,size:s?.size??o.fileSize,isImage:s?.isImage??o.isImage,mimeType:s?.mimeType??o.mimeType,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl??s?.cdnUrl??null,fullPath:o.fullPath,uploadProgress:o.uploadProgress,fileInfo:s??null,metadata:o.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:n,source:o?.source}}getOutputCollectionState(){return qn(this.r)}get _t(){let t=[];return this.cfg.sourceList&&(t=H(this.cfg.sourceList)),t}};var Wn={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var hi=33.333333333333336,k=1,Jo=24,Zn=6;function oe(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function ht(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return oe(t,i),t}function Xn(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,o+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,o+l*n+1.5*d],m=[e+a*s-24*t*c+1.5*c,o+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Yn(r,i,t){let{x:e,y:o,width:s,height:n}=r,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,m,g;a?(m=[e+c*s-34*t/2,o+d*n+1.5*h],g=[e+c*s+34*t/2,o+d*n+1.5*h]):(m=[e+c*s+1.5*u,o+d*n-34*t/2],g=[e+c*s+1.5*u,o+d*n+34*t/2]);let b=`M ${m[0]} ${m[1]} L ${g[0]} ${g[1]}`,w=[(m[0]+g[0])/2,(m[1]+g[1])/2];return {d:b,center:w}}function Qn(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function Jn({rect:r,delta:[i,t],imageBox:e}){return _e({...r,x:r.x+i,y:r.y+t},e)}function _e(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}function pu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;s+=o,a-=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,a=r.y+r.height-s,t&&(n=a*t,l=r.x+r.width/2-n/2)),l<=e.x&&(l=e.x,s=r.y+r.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y+r.height-a),a<k&&(a=k,t&&(n=a*t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),n<k&&(n=k,t&&(a=n/t,l=r.x+r.width/2-n/2),s=r.y+r.height-a),{x:l,y:s,width:n,height:a}}function hu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;s+=o,n-=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(a=n/t,l=r.y+r.height/2-a/2)),l<=e.y&&(l=e.y,s=r.x+r.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x+r.width-n),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2,s=r.x+r.width-n),{x:s,y:l,width:n,height:a}}function mu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:a}=r;a+=o,t&&(n=a*t);let l=r.x+r.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=r.x+r.width/2-n/2),l<=e.x&&(l=e.x,s=r.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=r.y),a<k&&(a=k,t&&(n=a*t),l=r.x+r.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:s,width:n,height:a}}function fu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:a}=r;n+=o,t&&(a=n/t);let l=r.y+r.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=r.y+r.height/2-a/2),l<=e.y&&(l=e.y,s=r.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=r.x),a<k&&(a=k,t&&(n=a*t),l=r.y+r.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:s,y:l,width:n,height:a}}function gu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+s<e.y&&(s=e.y-a),n+=o,l-=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x+r.width-l,a=e.y)):t&&(o=c*t-l,l=l+o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function vu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=o,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x,a=e.y)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y+r.height-c)),c<k&&(c=k,t&&(l=c*t),a=r.y+r.height-c),l<k&&(l=k,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function yu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+o<e.x&&(o=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=o,l-=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x+r.width-l,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n-=o,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y)),c<k&&(c=k,t&&(l=c*t),n=r.x+r.width-l),l<k&&(l=k,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function bu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:a,width:l,height:c}=r;return n+l+o>e.x+e.width&&(o=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=o,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x,a=e.y+e.height-c)):t&&(o=c*t-l,l+=o,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function ta({direction:r,...i}){switch(r){case "n":return pu(i);case "w":return hu(i);case "s":return mu(i);case "e":return fu(i);case "nw":return gu(i);case "ne":return vu(i);case "sw":return yu(i);case "se":return bu(i);default:return i.rect}}function ea(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function ia(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}function ra(r,i){return Math.abs(r.width/r.height-i)<.1}function Ne({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function oa(r,i,t){let e=r/i,o,s;e>t?(o=Math.round(i*t),s=i):(o=r,s=Math.round(r/t));let n=Math.round((r-o)/2),a=Math.round((i-s)/2);return n+o>r&&(o=r-n),a+s>i&&(s=i-a),{x:n,y:a,width:o,height:s}}function Be(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function se(r,i,t){return Math.min(Math.max(r,i),t)}var mi=["free"],Er=r=>{let i=H(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let o=e.trim();if(!o)continue;let s=o.indexOf(":");if(s===-1&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),a=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!mi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:tt.generateFastUid(),type:"aspect-ratio",width:mi.includes(o)?0:n,height:mi.includes(o)?0:a,hasFreeform:mi.includes(o)});}return t},sa=(r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(o-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(o-c)/c>e)return null}return s};function na(r){return ko({...r,libraryName:It,libraryVersion:Lt})}var aa="active",ze="___ACTIVITY_IS_ACTIVE___",la,T=class r extends(la=x,la){constructor(){super(...arguments);this.historyTracked=false;this.init$=Ro(this);this.Ic=$(this.Lc.bind(this),10);}Qs(){let t=r.We.get(this);this[ze]=false,this.removeAttribute(aa),t?.deactivateCallback?.();}Uc(){let t=r.We.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[ze]=true,this.setAttribute(aa,""),t?.activateCallback?.(),this.Ic(),this.emit(M.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[ze]?this.Qs():this.activityType===t&&!this[ze]&&this.Uc();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Lc(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}Pc(){return !!this.activityType&&r.We.has(this)}static{this.We=new Map;}get isActivityActive(){return !!this[ze]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.We.set(this,{activateCallback:o,deactivateCallback:s});}Rc(){this.isActivityActive&&this.Qs(),r.We.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Pc()&&this.Rc();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(o=>o instanceof r&&o.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let o=!!e;e&&(o=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=o?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};T.activities=dt;var R=class r extends T{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Di=false;this.init$=$o(this);this.Wr=$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Vc(e);},300);this.Fc=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(M.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of o){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(M.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.en(),this.Wr();}};this.Nc=t=>{if(!this.isConnected)return;this.Wr();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(o.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=o.filter(n=>t.fileInfo?.has(n)&&!!B.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let n=B.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.en();}if(t.isUploading)for(let s of t.isUploading){let n=B.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=B.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this._c(),this.cfg.cloudImageEditorAutoOpen&&this.Bc();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=B.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(M.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(M.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(M.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(M.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.en=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(M.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get $c(){return this.hasBlockInCtx(t=>t instanceof r?t.Di&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.et("*uploadCollection",()=>new gr({initialValue:Wn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.et("*secureUploadsManager",t=>new pr(t)),this.et("*validationManager",t=>new mr(t)),this.et("*publicApi",t=>new wr(t)),!this.$c&&this.couldBeCtxOwner&&this.Dc();}getAPI(){return this.api}get validationManager(){return this.ot("*validationManager")}get api(){return this.ot("*publicApi")}get uploadCollection(){return this.ot("*uploadCollection")}get secureUploadsManager(){return this.ot("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Di&&this.Js(),this.Wr.cancel();}connectedCallback(){super.connectedCallback(),this.Di&&this.tn();}Dc(){this.Di=true,this.tn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}tn(){this.Js(),this.Gr=this.uploadCollection.observeCollection(this.Fc),this.qr=this.uploadCollection.observeProperties(this.Nc);}Js(){this.qr?.(),this.Gr?.(),this.qr=void 0,this.Gr=void 0;}async Vc(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await xn(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(M.GROUP_CREATED,a),this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}Bc(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===T.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=T.activities.CLOUD_IMG_EDIT,this.modalManager?.open(T.activities.CLOUD_IMG_EDIT));}_c(){let t=Er(this.cfg.cropPreset);if(t){let[e]=t,o=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of o){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=oa(a,l,c),u=et(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:G(h,u)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===T.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=T.activities.CLOUD_IMG_EDIT,this.modalManager?.open(T.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:na,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return yr(this.r)}};R.extSrcList=Object.freeze({...Rt});R.sourceTypes=Object.freeze({...z});var fi=class extends x{constructor(){super(...arguments);this.name="";this.Zr="";this.rn=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.rn=t,this.sn();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.sn();}sn(){if(!this.name){this.Zr="";return}let t=`#uc-icon-${this.name}`,e=this.rn?.(this.name);this.Zr=e??t;}render(){return v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Zr}></use></svg>`)} `}};p([y({type:String})],fi.prototype,"name",2),p([f()],fi.prototype,"Zr",2);var ca=r=>[...new Set(r)];var xe="--uc-img-",ts="unresolved";var es=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),is=3e3,rs=5e3,os=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var wu="https://ucarecdn.com",He=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:wu},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var xr=class extends Ie(Le(yt)){constructor(){super();this.Te={};this.w=new Map;this.Ee=null;this.Fi=null;for(let t in He){let e=He[t];this.Te[xe+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Te[xe+t]}set$$(t){for(let e in t){let o=xe+e,s=t[e];this.Te[o]=s,this.K(o,s);}}sub$$(t,e){let o=xe+t;this.w.has(o)||this.w.set(o,new Set),this.w.get(o)?.add(e);let s=this.Te[o];s!==null&&s!==""&&e(s);}K(t,e){this.w.has(t)&&this.w.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${It}/${Lt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;He[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.Ee=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Ee?.unobserve(t));});},o),this.Ee.observe(t),this.Fi||(this.Fi=new Set),this.Fi.add(t);}connectedCallback(){super.connectedCallback(),this.zc();}zc(){for(let t in He){let e=xe+t,o=this.getCssData(e,true);o!=null&&(this.Te[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.Ee&&(this.Fi?.forEach(t=>{this.Ee?.unobserve(t);}),this.Ee=null),this.w.clear();}static get observedAttributes(){return Object.keys(He)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=xe+t;this.Te[s]=o,this.K(s,o);});}};var ua=r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Ar=class extends xr{constructor(){super(...arguments);this.It=new Image;this.Et=new Image;}nn(t){return !t.includes("//")&&!es&&(t=new URL(t,document.baseURI).href),t}Ni(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let n=parseInt(o,10);return Number(n)>rs&&this.an?rs+s:Number(n)>is&&!this.an?is+s:t}Hc(t,e){let o={format:this.Xr("format"),quality:this.Xr("quality"),resize:this.Ni(t),blur:e,"cdn-operations":this.Xr("cdn-operations")??void 0,analytics:this.analyticsParams()};return et(...ua(o))}Xr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}at(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(es&&o&&!o.includes("//"))return this.Ze(o);let s=this.Hc(t,e),n=this.$$("cdn-cname"),a=n;if(o.startsWith(String(n)))return G(o,s);let l=this.$$("uuid");if(a&&l)return this.Ze(G(Qt(a,l),s));if(l)return this.Ze(G(Qt(a,l),s));let c=this.$$("proxy-cname");if(c)return this.Ze(G(c,s,this.nn(o)));let d=this.$$("pubkey");if(d)return this.Ze(G(`https://${d}.ucr.io/`,s,this.nn(o)))}Ze(t){let e=this.$$("secure-delivery-proxy");return e?De(e,{previewUrl:t},{transform:o=>window.encodeURIComponent(o)}):t}xe(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=o?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Kc(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Lt||(this.Yr({elNode:this.It}),this.appendChild(this.It)),this.It}get Vi(){return this.Lt?{type:os.PREVIEW,img:this.Et}:{type:os.MAIN,img:this.img}}get Lt(){return this.$$("is-preview-blur")}get ln(){return this.$$("is-background-for")}get cn(){let t=this.$$("breakpoints");if(t){let e=H(t);return ca(e.map(o=>parseInt(o,10)))}else return null}get an(){return this.$$("format").toLowerCase()==="jpeg"}un(t){let e=new Set;e.add(`url("${this.at(this.xe(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.at(this.xe(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.at(this.xe(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}dn(){let t=new Set;return this.cn?this.cn.forEach(e=>{t.add(`${this.at(`${e}x`)} ${this.Ni(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.at(`${e*2}x`)} ${this.Ni(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.at(`${e*3}x`)} ${this.Ni(`${e*3}w`)}`);}):(t.add(`${this.at(this.xe(this.Vi.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.at(this.xe(this.Vi.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.at(this.xe(this.Vi.img,3))} 3x`)),[...t].join()}pn(){return this.at()}get hn(){return this.at("100x","100")}jc(){let t=this.ln;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.un(e);}):this.un(e);});}Gc({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}Yr({elNode:t}){this.Kc(t),this.initAttributes(t);}Qr({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.Yr({elNode:o}),o.setAttribute(ts,""),o.addEventListener("load",()=>{o.removeAttribute(ts),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Gc({elNode:o,src:t,srcset:e});})}async qc(){if(this.$$("intersection")){this.Lt&&(this.Yr({elNode:this.Et}),this.appendChild(this.Et)),this.initIntersection(this.Vi.img,async()=>{this.Lt&&(this.Et.src=this.hn);try{await this.Qr({src:this.pn(),srcset:this.dn(),elNode:this.It}),this.Lt&&await this.Et.remove(),this.appendChild(this.It);}catch{this.Lt&&await this.Et?.remove(),this.appendChild(this.It);}});return}try{this.Lt&&(await this.Qr({src:this.hn,elNode:this.Et}),this.appendChild(this.Et)),await this.Qr({src:this.pn(),srcset:this.dn(),elNode:this.It}),this.Lt&&await this.Et?.remove(),this.appendChild(this.It);}catch{this.Lt&&await this.Et?.remove(),this.appendChild(this.It);}}init(){this.ln?this.jc():this.qc();}};var ss=class extends Ar{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Tu}=Gs,da=r=>r;var ha=r=>r.strings===void 0,pa=()=>document.createComment(""),je=(r,i,t)=>{let e=r.Ot.parentNode,o=i===void 0?r.me:i.Ot;if(t===void 0){let s=e.insertBefore(pa(),o),n=e.insertBefore(pa(),o);t=new Tu(s,n,r,r.options);}else {let s=t.me.nextSibling,n=t.c,a=n!==r;if(a){let l;t.Wc?.(r),t.c=r,t.Ti!==void 0&&(l=r.W)!==n.W&&t.Ti(l);}if(s!==o||a){let l=t.Ot;for(;l!==s;){let c=da(l).nextSibling;da(e).insertBefore(l,o),l=c;}}}return t},ne=(r,i,t=r)=>(r.wt(i,t),r),Eu={},ma=(r,i=Eu)=>r.i=i,fa=r=>r.i,kr=r=>{r.fe(),r.Ot.remove();};var gi=(r,i)=>{let t=r.bt;if(t===void 0)return false;for(let e of t)e.Ss?.(i,false),gi(e,i);return true},Or=r=>{let i,t;do{if((i=r.c)===void 0)break;t=i.bt,t.delete(r),r=i;}while(t?.size===0)},ga=r=>{for(let i;i=r.c;r=i){let t=i.bt;if(t===void 0)i.bt=t=new Set;else if(t.has(r))break;t.add(r),Su(i);}};function xu(r){this.bt!==void 0?(Or(this),this.c=r,ga(this)):this.c=r;}function Cu(r,i=false,t=0){let e=this.i,o=this.bt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)gi(e[s],false),Or(e[s]);else e!=null&&(gi(e,false),Or(e));else gi(this,r);}var Su=r=>{r.type==Ut.CHILD&&(r.Ti??=Cu,r.Wc??=xu);},Mr=class extends bt{constructor(){super(...arguments),this.bt=void 0;}Mr(i,t,e){super.Mr(i,t,e),ga(this),this.isConnected=i.W;}Ss(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(gi(this,i),Or(this));}setValue(i){if(ha(this.Pi))this.Pi.wt(i,this);else {let t=[...this.Pi.i];t[this.xc]=i,this.Pi.wt(t,this,0);}}disconnected(){}reconnected(){}};var O=()=>new as,as=class{},ns=new WeakMap,I=pt(class extends Mr{render(r){return P}update(r,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=r.options?.host,this.rt(this.ct=r.element)),P}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ns.get(i);t===void 0&&(t=new WeakMap,ns.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?ns.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 ls=null,vi=class extends x{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");};this.Zc=()=>{this.closeDialog();};this.Xc=t=>{this.Jr=t.target;};this.Yc=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Jr&&this.closeDialog();};this.Xe=({id:t})=>{t===this.id?(ls=t,this.show(),this.emit(M.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.Ye=({id:t})=>{t===this.id&&(this.hide(),this.emit(M.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.mn=t=>{this.hide(),ls===this.id&&this.emit(M.MODAL_CLOSE,{modalId:ls,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(q.OPEN,this.Xe),this.modalManager?.subscribe(q.CLOSE,this.Ye),this.modalManager?.subscribe(q.CLOSE_ALL,this.mn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Jr=void 0,this.modalManager?.unsubscribe(q.OPEN,this.Xe),this.modalManager?.unsubscribe(q.CLOSE,this.Ye),this.modalManager?.unsubscribe(q.CLOSE_ALL,this.mn);}Qc(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Zc),this.dialogEl.value?.addEventListener("mousedown",this.Xc),this.dialogEl.value?.addEventListener("mouseup",this.Yc);}render(){return v`<dialog ${I(this.Qc)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],vi.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],vi.prototype,"blockBodyScrolling",2);var Ir=class extends R{constructor(){super(...arguments);this.S=null;this._i=null;}get gn(){return this.nameAttrValue??this.ctxName}vn(){let t=document.createElement("input");return t.type="text",t.name=this.gn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,vr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.S=this.vn(),this.appendChild(this.S),this.sub("*collectionState",t=>{if(!t)return;if(!this._i){let n=document.createElement("div");this.appendChild(n),this._i=n;}if(!this.S){let n=this.vn();this.appendChild(n),this.S=n;}if(this._i.innerHTML="",t.status==="uploading"||t.status==="idle"){this.S.value="",this.S.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.S.value="",this.S.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.S.value=e.cdnUrl??"",this.S.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.S.value=o[0],this.S.setCustomValidity("");return}this.S.remove(),this.S=null;let s=new DocumentFragment;for(let n of o){let a=document.createElement("input");a.type="hidden",a.name=`${this.gn}[]`,a.value=n,s.appendChild(a);}this._i.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],Ir.prototype,"nameAttrValue",2);var cs=class extends x{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ke=class extends x{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.pt=0;this.Bi=O();this.yn=()=>{let t=this.Bi.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.pt>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.pt=this.to(this.value),this.eo(),this.Bi.value?.addEventListener("animationiteration",this.yn);}updated(t){if(super.updated(t),t.has("value")){let e=this.to(this.value);if(!this.visible)this.pt=e;else {let o=Math.max(this.pt,e);o!==this.pt&&(this.pt=o,this.eo());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.eo():this.pt=this.to(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Bi.value?.removeEventListener("animationiteration",this.yn);}to(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}eo(){this.visible&&this.style.setProperty("--l-progress-value",this.pt.toString());}render(){return v`<div ${I(this.Bi)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],Ke.prototype,"hasFileName",2),p([y({type:Number})],Ke.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ke.prototype,"visible",2);var yi=class extends R{constructor(){super();this.xt=false;this.Ce=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.io=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.xt=t;}),this.sub("*commonProgress",t=>{this.Ce=t;});}updated(t){super.updated(t),t.has("visible")&&(this.xt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.io?.(),this.io=void 0;}render(){return v`<uc-progress-bar .value=${this.Ce} .visible=${this.xt}></uc-progress-bar>`}};p([f()],yi.prototype,"xt",2),p([f()],yi.prototype,"Ce",2);var Ge=class extends x{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Jc=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return v`<select @change=${this.Jc} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Ge.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ge.prototype,"disabled",2),p([y({type:Array,attribute:false})],Ge.prototype,"options",2);var Au="src-type-",Ce=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ro={};this.onlyIcon=false;this.oo="default";this.so="";}tu(){this.Se({type:z.LOCAL,activate:()=>(this.api.openSystemDialog(),false)}),this.Se({type:z.URL,activity:T.activities.URL,textKey:"from-url"}),this.Se({type:z.CAMERA,activity:T.activities.CAMERA,activate:()=>{let t=Te.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t}}),this.Se({type:"draw",activity:T.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(Qo))this.Se({type:t,activity:T.activities.CAMERA,activate:()=>{let e=Te.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?A.PHOTO:A.VIDEO}),!e}});for(let t of Object.values(Rt))this.Se({type:t,activity:T.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.tu(),this.type&&this.bn(this.type);}Se(t){this.ro[t.type]=t;}activate(){if(!this.type)return;let t=this.ro[this.type];if(!t)return;let{activity:e,activate:o,activityParams:s={}}=t;(o?o():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}bn(t){let e=this.ro[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:o=t,icon:s=t}=e;this.so=`${Au}${o}`,this.oo=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.bn(this.type):(this.so="",this.oo="default"));}render(){return v`<button type="button" @click=${this.activate}><uc-icon name=${this.oo}></uc-icon>${this.onlyIcon?"":v`<div class="uc-txt">${this.l10n(this.so)}</div>`}</button>`}};p([y({type:String})],Ce.prototype,"type",2),p([y({type:Boolean})],Ce.prototype,"onlyIcon",2),p([f()],Ce.prototype,"oo",2),p([f()],Ce.prototype,"so",2);var bi=class extends x{constructor(){super(...arguments);this.wn=[];this.q=[];this.wrap=false;this.En=[];}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.wn=H(t),this.Tn();}),this.subConfigValue("cameraModes",t=>{this.q=lt(t),this.Tn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Tn(){let t=[];for(let e of this.wn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&Te.htmlMediaCapture){let o=this.q.length?this.q.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...o);continue}t.push(e);}this.En=t;}render(){return v`${this.En.map(t=>v`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};p([y({type:Boolean,attribute:"wrap",noAccessor:true})],bi.prototype,"wrap",2),p([f()],bi.prototype,"En",2);var us=class extends x{render(){return v`<div class="uc-spinner"></div>`}};var St="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Se(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=n=>s(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=St);}}}function wi(r){let i=[];for(let s of r){let n=Se(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function ds(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let o=new Image,s=new Promise((n,a)=>{o.onload=()=>{let l=o.height/o.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},o.onerror=l=>{a(l);};});return o.src=URL.createObjectURL(r),s}var qe=class extends R{constructor(){super(...arguments);this.zi=new Set;this.entry=null;}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,n)=>{let a=o.subscribe(s,l=>{this.isConnected&&n(l);});this.zi.add(a);})(t,e);}reset(){for(let t of this.zi)t();this.zi=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.zi=new Set;}};function ku(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}function Lr(r="hsl(209, 21%, 65%)",i=32,t=32){return ku(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}var Ou=3e3,We=class extends qe{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Bt="";this.xn=false;this.Hi=null;this.Cn=false;this.eu=this.cfg.filesViewMode;this.Sn=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.iu(e);if(o&&s&&n){let d=await this.proxyUrl(G(Qt(this.cfg.cdnCname,n),et(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Se(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let m=await ds(h,l);t.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Lr(m));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await ds(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Lr(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Lr(d));}});this.Ki=$(this.Sn.bind(this),100);}iu(t=false){t&&(this.Hi=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Hi?.height||0),10),parseInt(String(this?.Hi?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Ou)}ru(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=St,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),o();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}lo(){this.ao?.cancel(),this.ao=void 0;}ou(t){if(this.lo(),!t){this.Bt&&(this.Bt="");return}if(t===this.Bt)return;let e=new AbortController,o={controller:e,cancel:()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);}};this.ao=o,this.ru(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Bt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}ji(t=false){if(this.entry){if(t){this.Sn(true);return}this.Cn&&this.Ki();}}firstUpdated(t){super.firstUpdated(t),this.An();}updated(t){super.updated(t),t.has("uid")&&this.An();}Qe(t){let[e]=t;e&&(this.Cn=e.isIntersecting,e.isIntersecting&&(this.Hi=e.boundingClientRect,this.ji(),this.s?.disconnect()),e.intersectionRatio===0&&this.Ki.cancel());}reset(){super.reset(),this.Ki.cancel(),this.lo(),this.Bt&&(this.Bt="");}An(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let o=()=>{this.ji();};this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.ou(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.ji(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.xn&&(this.eu==="list"&&this.ji(true),this.xn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Ki.cancel(),this.lo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Bt||St} role="img" alt="Preview of uploaded image" ?hidden=${!this.Bt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],We.prototype,"badgeIcon",2),p([y({attribute:false})],We.prototype,"uid",2),p([f()],We.prototype,"Bt",2);var ps=class extends T{};var hs=class extends T{constructor(){super(...arguments);this.historyTracked=true;this.activityType=T.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var ms=class extends R{constructor(){super(...arguments);this.kn=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=M;}initCallback(){super.initCallback(),this.kn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.kn?.();}};var ae=(r,i)=>{let t=false,e,o=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...n),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...n),o=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var va=(r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},ya=pt(class extends bt{constructor(r){if(super(r),r.type!==Ut.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let o=[],s=[],n=0;for(let a of r)o[n]=e?e(a,n):n,s[n]=t(a,n),n++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=fa(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=o.length-1,m=0,g=s.length-1;for(;u<=h&&m<=g;)if(o[u]===null)u++;else if(o[h]===null)h--;else if(a[u]===n[m])l[m]=ne(o[u],s[m]),u++,m++;else if(a[h]===n[g])l[g]=ne(o[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=ne(o[u],s[g]),je(r,l[g+1],o[u]),u++,g--;else if(a[h]===n[m])l[m]=ne(o[h],s[m]),je(r,o[u],o[h]),h--,m++;else if(c===void 0&&(c=va(n,m,g),d=va(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[m]),w=b!==void 0?o[b]:null;if(w===null){let C=je(r,o[u]);ne(C,s[m]),l[m]=C;}else l[m]=ne(w,s[m]),je(r,o[u],w),o[b]=null;m++;}else kr(o[h]),h--;else kr(o[u]),u++;for(;m<=g;){let b=je(r,l[g+1]);ne(b,s[m]),l[m++]=b;}for(;u<=h;){let b=o[u++];b!==null&&kr(b);}return this.ut=n,ma(r,l),J}});var Pr=()=>{let r=[];return {stack:r,promiseReadJpegChunks:t=>new Promise((e,o)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{o(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){o("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),m=>{if(m.byteLength!==h){o("Corrupted");return}r.push({startPos:c,length:h,marker:u,view:m}),a();})})};FileReader&&DataView||o("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&o("Not jpeg"),a();});})}},Mu=async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Pr();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},wa=async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Pr();await s(r),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),o.push(c.length)});let a=[r.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(r.slice(l,e[c])),l=e[c]+o[c]+4;return a.push(r.slice(l,r.size)),new Blob(a,{type:r.type})}};var Ta=(r,i)=>wa(r,226,i.map(t=>t.buffer)),Iu=async r=>{try{return await Ta(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Lu=(r,i,t)=>new Promise((e,o)=>{let s=n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);};r.toBlob(s,i,t),r.width=r.height=1;}),Ti=()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},Uu=r=>{let{ctx:t,canvas:e}=Ti();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},Pu=async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Pr();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},Ru="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Ur,$u=()=>new Promise(r=>{if(Ur!==void 0)r(Ur);else {let i=new Image;i.addEventListener("load",()=>{Ur=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Ur);}),i.src=Ru;}}),Du=(r,i)=>{let t,e,o,s;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=true;else if(r.getUint16(6)===19789)e=false;else return;if(r.getUint16(8,e)!==42)return;o=8+r.getUint32(10,e);let n=r.getUint16(o-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},Fu=(r,i)=>{Du(r,(t,e)=>r.setUint16(t,i,e));},Vu=async(r,i,t)=>(t&&Fu(i,1),wa(r,225,[i.buffer])),_u=(r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),Nu=r=>_u(new Image,r),Bu=[1,3],zu=[192,193,194,195,197,198,199,201,202,203,205,206,207],ba={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hu=async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Pr();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&zu.indexOf(o)>=0){let n=s.getUint8(5);Bu.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},Ea=(r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},xa=(r,i)=>{let[t]=r,e=Object.keys(i).map(o=>parseInt(o,10)).sort((o,s)=>o-s);for(let o=0;o<e.length;o++){let s=e[o],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},le={R:55,G:110,B:165,A:255},ju=`rgba(${le.R}, ${le.G}, ${le.B}, ${le.A/255})`,Ca=(r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Ti();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ti();s.width=r,s.height=i,n&&(n.fillStyle=ju,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let a=o&&o.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===le.R&&a[1]===le.G&&a[2]===le.B&&a[3]===le.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}};function Sa(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}var Ku=Sa(Ea(Ca,xa)),Gu=Sa(Ea(Ca,xa)),Aa=async(r,i)=>{let t=ba.squareSide.find(n=>n*n>=r*i),e=ba.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([Ku(t,t),Gu(e,1)]);if(o&&s)return true;throw new Error("Not supported")},ka=async(r,i,t)=>{try{let{ctx:e,canvas:o}=Ti();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},qu=({img:r,targetW:i,targetH:t})=>ka(r,i,t),Wu=function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,n=t;do o.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<r*e);return o.reverse()},Zu=({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Wu({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[a,l],c)=>n.then(d=>Aa(a,l).then(()=>ka(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(r))},Xu=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Yu=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),fs=.71,Qu=(r,i)=>{if(r.width*fs*r.height*fs<i.size)throw new Error("Not required");let t=r.width,e=r.height,o=t/e,s=Math.floor(Math.sqrt(i.size*o)),n=Math.floor(i.size/Math.sqrt(i.size*o));return Aa(s,n).then(()=>{let{ctx:a}=Ti();return "imageSmoothingQuality"in a&&!Xu()&&!Yu?qu({img:r,targetW:s,targetH:n}):Zu({img:r,sourceW:t,targetW:s,targetH:n,step:fs})}).catch(()=>Promise.reject("Not supported"))},Oa=async(r,i)=>{try{if(await Hu(r))throw new Error("Should skipped");let e=await Promise.allSettled([Pu(r),$u(),Mu(r)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Iu(r).catch(()=>r),d=await Nu(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await Qu(d,i),h="image/jpeg",m=i?.quality||.8;!s&&Uu(u)&&(h="image/png",m=void 0);let g=await Lu(u,h,m);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await Vu(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await Ta(g,l.value)),g}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};var Ju=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ma=r=>{if(typeof r!="string")return false;let i=Ju.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}};var Z=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),j=class j extends qe{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.On=true;this.uid="";this.co="";this.uo="";this.po="";this.pt=0;this.Mn=false;this.ho="";this.In=false;this.Ln=false;this.Un=false;this.Pn=false;this.Rn=false;this.Gi=false;this.$n="";this.Dn=false;this.su=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(T.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=T.activities.CLOUD_IMG_EDIT;});this.nu=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.au=()=>{this.Fn();};this.g=$(()=>this.Nn(),100);this.cu=this.withEntry(ae((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===Z.FINISHED,l=e===Z.UPLOADING,c=e===Z.QUEUED_UPLOADING,d=e===Z.QUEUED_VALIDATION,u=e===Z.VALIDATION,h=t.getValue("fileName"),m="";o?m="":!a&&n&&s&&Object.values(Rt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.po=m,this.uo=o,this.Mn=l||c||d||u,this.pt=d||u?0:t.getValue("uploadProgress"),this.$n=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Fn=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.g();try{let o=new AbortController;t.setValue("abortController",o);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File&&this.cfg.imageShrink)try{let u=Ma(this.cfg.imageShrink);u?a=await Oa(a,u):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:o.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),Uo(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.g();}catch(o){this.telemetryManager.sendEventError(o,"file upload. Failed to upload file"),o instanceof te&&o.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof ve?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:o}):(console.error("Unknown upload error",o),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:o})})),t===this.entry&&this.g();}}});}Nn(){let t=this.entry;if(!t)return;let e=Z.IDLE;t.getValue("errors").length>0?e=Z.FAILED:t.getValue("isQueuedForUploading")?e=Z.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Z.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Z.VALIDATION:t.getValue("isUploading")?e=Z.UPLOADING:t.getValue("fileInfo")&&(e=Z.FINISHED),this.lu(t,e);}lu(t,e){e===Z.FAILED?this.ho="badge-error":e===Z.FINISHED&&(this.ho="badge-success"),e===Z.UPLOADING&&(this.Pn=false,this.removeAttribute("focused")),this.Ln=e===Z.FAILED,this.Un=e===Z.UPLOADING,this.In=e===Z.FINISHED,this.Rn=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.cu(e);}reset(){super.reset(),this.g.cancel();}Qe(t){let[e]=t;e&&e.isIntersecting&&!this.Dn&&(this.On=false,this.Dn=true);}Vn(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.g();}),this.subEntry("isValidationPending",()=>{this.g();}),this.subEntry("uploadProgress",()=>{this.g();}),this.subEntry("isQueuedForUploading",()=>{this.g();}),this.subEntry("fileName",o=>{this.co=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.g();}),this.subEntry("externalUrl",o=>{this.co=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.g();}),this.subEntry("errors",()=>this.g()),this.subEntry("isUploading",()=>this.g()),this.subEntry("fileSize",()=>this.g()),this.subEntry("mimeType",()=>this.g()),this.subEntry("isImage",()=>this.g()),this.Nn());}_n(t){if(this.cfg.filesViewMode==="list"){this.Gi=true;return}this.Gi=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Vn(this.uid);}initCallback(){super.initCallback(),this.Vn(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.g()),this.subConfigValue("filesViewMode",t=>{this._n(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this._n(t);}),this.onclick=()=>{j.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Fn());}),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.On?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.In} ?data-uploading=${this.Un} ?data-failed=${this.Ln} ?data-focused=${this.Pn} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.ho}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.$n}><span class="uc-file-name" ?hidden=${!this.Gi}>${this.co}</span><span class="uc-file-error" ?hidden=${!this.uo}>${this.uo}</span><span class="uc-file-hint" ?hidden=${!this.po}>${this.po}</span></div><div class="uc-file-actions"><button type="button" @click=${this.su} ?hidden=${!this.Rn} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" data-testid="edit" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.nu} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.au}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.pt} .visible=${this.Mn} ?hasFileName=${this.Gi}></uc-progress-bar></div>`}};p([f()],j.prototype,"On",2),p([y({attribute:false})],j.prototype,"uid",2),p([f()],j.prototype,"co",2),p([f()],j.prototype,"uo",2),p([f()],j.prototype,"po",2),p([f()],j.prototype,"pt",2),p([f()],j.prototype,"Mn",2),p([f()],j.prototype,"ho",2),p([f()],j.prototype,"In",2),p([f()],j.prototype,"Ln",2),p([f()],j.prototype,"Un",2),p([f()],j.prototype,"Pn",2),p([f()],j.prototype,"Rn",2),p([f()],j.prototype,"Gi",2),p([f()],j.prototype,"$n",2);var gs=j;function td(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=o=>{o.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}function ed(r,i){return new Promise(t=>{let e=0,o=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});o.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(o);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(o);});};s(r);})}function Ia(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let o=r.items[e];if(o)if(o.kind==="file"){let s=o.type,n=o;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(ed(l,s).then(c=>{c&&i.push(...c);}));continue}let a=o.getAsFile();a&&t.push(td(a).then(l=>{l||i.push({type:"file",file:a});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}var ot=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),La=["focus"],id=100,vs=new Map;function rd(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}function ys(r){let i=0,t=document.body,e=new Set,o=g=>{e.add(g);},s=ot.INACTIVE,n=g=>{r.shouldIgnore()&&g!==ot.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;o(g=>r.onChange(g));let l=()=>{i=0,n(ot.INACTIVE);},c=()=>{i+=1,s===ot.INACTIVE&&n(ot.ACTIVE);},d=()=>{i-=1,a()||n(ot.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(ot.INACTIVE);},h=g=>{if(r.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=r.element.getBoundingClientRect(),C=Math.floor(rd(b,w)),E=C<id,S=g.composedPath().includes(r.element);vs.set(r.element,C);let vt=Math.min(...vs.values())===C;S&&vt?(g.preventDefault(),n(ot.OVER)):n(E&&vt?ot.NEAR:ot.ACTIVE);},m=async g=>{if(r.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ia(b);r.onItems(w),n(ot.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),r.element.addEventListener("drop",m),La.forEach(g=>{window.addEventListener(g,l);}),()=>{vs.delete(r.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),r.element.removeEventListener("drop",m),La.forEach(g=>{window.removeEventListener(g,l);});}}var bs=new Set,ut=class extends R{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ft=true;this.Bn=true;this.mo="drop-files-here";this.zn=false;this.Kn=null;this.fo=null;this.jn=O();this.Ae=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.Gn=true;this.ke=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Hn(){let t=this.text;if(typeof t=="string"&&t.length>0){this.mo=this.l10n(t)||t;return}this.mo=this.zn?this.l10n("drop-files-here"):this.l10n("drop-file-here");}isActive(){if(!this.Ft)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&o}initCallback(){super.initCallback(),bs.add(this),this.go(),this.vo(),this.qn(),this.Wn(ot.INACTIVE),this.Kn=ys({element:this,shouldIgnore:()=>this.Zn(),onChange:t=>{this.Wn(t);},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:z.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:z.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(T.activities.UPLOAD_LIST),this.set$({"*currentActivity":T.activities.UPLOAD_LIST})));}}),this.updateComplete.then(()=>this.uu()),this.subConfigValue("sourceList",t=>{let e=H(t);this.Gn=e.includes(z.LOCAL),this.go(),this.vo();}),this.subConfigValue("multiple",t=>{this.zn=!!t,this.Hn();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.go(),this.vo()),(t.has("text")||t.has("localeId"))&&this.Hn();}updated(t){super.updated(t),t.has("clickable")&&this.qn();}Zn(){if(!this.Ft||!this.du())return true;if(!this.fullscreen)return false;let t=bs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}du(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}go(){let t=this.Gn&&!this.disabled;this.Ft=t;}vo(){let t=this.Ft||!this.querySelector("[data-default-slot]");this.Bn=t,this.hidden=!t;}Wn(t){let e=Object.entries(ot).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}uu(){if(this.fo)return;let t=this.jn.value;t&&(this.fo=ys({element:t,onChange:e=>{let o=Object.entries(ot).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},onItems:()=>{},shouldIgnore:()=>this.Zn()}));}qn(){this.clickable&&!this.ke?(this.addEventListener("keydown",this.Ae),this.addEventListener("click",this.Ae),this.ke=true):!this.clickable&&this.ke&&(this.removeEventListener("keydown",this.Ae),this.removeEventListener("click",this.Ae),this.ke=false);}disconnectedCallback(){super.disconnectedCallback(),bs.delete(this),this.Kn?.(),this.fo?.(),this.ke&&(this.removeEventListener("keydown",this.Ae),this.removeEventListener("click",this.Ae),this.ke=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${I(this.jn)} class="uc-content-wrapper" ?hidden=${!this.Bn}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.mo}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],ut.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],ut.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],ut.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],ut.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],ut.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],ut.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],ut.prototype,"initflow",2),p([y({type:String})],ut.prototype,"text",2),p([f()],ut.prototype,"Ft",2),p([f()],ut.prototype,"Bn",2),p([f()],ut.prototype,"mo",2);var At=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=T.activities.UPLOAD_LIST;this.Xn=false;this.Yn=false;this.Qn=false;this.yo=false;this.bo=false;this.qi=null;this.Jn=false;this.wo=null;this.ta=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.To=()=>{this.emit(M.UPLOAD_CLICK),this.api.uploadAll(),this.X();};this.Eo=()=>{this.emit(M.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ut=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.X=ae(()=>{this.isConnected&&(this.mu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get pu(){return this.wo?this.hu(this.wo):""}mu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},o=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(m=>m.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&l&&this.cfg.confirmUpload)c=true;else {d=true;let m=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&o&&l&&m;}this.Xn=d,this.Yn=u,this.Qn=c,this.bo=e.total===0||!s&&!n,this.yo=!n||this.cfg.multiple,this.Jn=e.total>0,this.wo=e;}hu(t){let e=o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.X),this.subConfigValue("multipleMin",this.X),this.subConfigValue("multipleMax",this.X),this.sub("*groupInfo",t=>{t&&this.X();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.X),this.uploadCollection.observeCollection(this.X),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.qi=null;return}this.qi=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.X),this.uploadCollection.unobserveCollection(this.X));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.pu}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Jn}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${ya(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.ta} ?disabled=${!this.bo} ?hidden=${!this.yo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.qi} >${this.qi??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.yo} ?disabled=${!this.bo} @click=${this.ta} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Qn} @click=${this.To} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Xn} ?disabled=${!this.Yn} @click=${this.Eo} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([f()],At.prototype,"Xn",2),p([f()],At.prototype,"Yn",2),p([f()],At.prototype,"Qn",2),p([f()],At.prototype,"yo",2),p([f()],At.prototype,"bo",2),p([f()],At.prototype,"qi",2),p([f()],At.prototype,"Jn",2),p([f()],At.prototype,"wo",2);var Rr=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=T.activities.URL;this.xo={importDisabled:true};this.zt=O();this.Co=t=>{let e=t.target?.value??"";this.xo={importDisabled:!e};};this.To=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let o=this.zt.value?.value?.trim();o&&(this.api.addFileFromUrl(o,{source:z.URL}),this.modalManager?.open(T.activities.UPLOAD_LIST),this.$["*currentActivity"]=T.activities.UPLOAD_LIST);};}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:()=>{let t=this.zt.value;t&&(t.value="",t.focus()),this.xo={importDisabled:true};}});}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.To}><label><input ${I(this.zt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.Co} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.xo.importDisabled} >${this.l10n("upload-url")}</button></form>`}};p([f()],Rr.prototype,"xo",2);var Ua=()=>typeof navigator.permissions<"u";var Pa="important",od=" !"+Pa,Ae=pt(class extends bt{constructor(r){if(super(r),r.type!==Ut.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(od);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?Pa:""):t[e]=o;}}return J}});var sd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},nd=["camera","microphone"];function $r(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}var Ra="image/jpeg",$a="video/webm",N=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=T.activities.CAMERA;this.Wi=null;this.So=false;this.Je=[];this.Ct=null;this.St=null;this.Zi=null;this.Xi=null;this.v=null;this.ti={};this.At=null;this.e=null;this.Oe=[];this.Me=[];this.fu={};this.Yi=[];this.Qi=null;this.ea=()=>{this.ia(),this.ei="pause";};this.ra=()=>{this.ei="play",this.gu();};this.ii=O();this.re=O();this._=O();this.oa=O();this.sa=0;this.na=0;this.aa=null;this.Ji=true;this.tr=true;this.vu=Ua();this.la=[];this.oe=true;this.Ao="";this.Ie=true;this.se=true;this.Le=true;this.ca=[];this.ne=true;this.ko=true;this.ae=true;this.Pt=true;this.le=true;this.Ue="camera-full";this.ei="play";this.ua="microphone";this.er="uc-shot-btn uc-camera-action";this.yu=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===A.PHOTO&&this.bu(),this.v===A.VIDEO){if(this.Ct?.state==="recording"){this.da();return}this.wu();}};this.Tu=t=>{let e=t.target;e&&(this.Xi=e.value,this.Pe());};this.Eu=t=>{let e=t.target;e&&(this.Zi=e.value,this.Pe());};this.xu=()=>{this.Pe();};this.Cu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.yu();};this.Su=()=>{this.Au();};this.ku=()=>{this.Ou();};this.Mu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.Iu();};this.Lu=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.Uu();};this.pa=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.ha(o);};this.ma=()=>{let t=Math.floor((performance.now()-this.sa+this.na)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.ii.value;s&&(s.textContent=$r(e)),this.da();return}let o=this.ii.value;o&&(o.textContent=$r(e));}else {let e=this.ii.value;e&&(e.textContent=$r(t));}this.Re=requestAnimationFrame(this.ma);};this.Pu=()=>{this.sa=performance.now(),this.na=0,this.ma();};this.fa=()=>{this.Re&&cancelAnimationFrame(this.Re);};this.ia=()=>{let t=this._.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.re.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.ii.value;n&&(n.textContent=$r(e)),this.Re=requestAnimationFrame(this.ia);};this.gu=()=>{this.Re&&cancelAnimationFrame(this.Re);};this.Re=null;this.wu=()=>{try{this.Je=[],this.ti={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.ti.mimeType=t:MediaRecorder.isTypeSupported($a)?this.ti.mimeType=$a:this.ti.mimeType="video/mp4",this.St&&(this.Ct=new MediaRecorder(this.St,this.ti),this.Ct.start(),this.Ct.addEventListener("dataavailable",e=>{this.Je.push(e.data);}),this.Pu(),this.classList.add("uc-recording"),this.ri(wt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.da=()=>{this.Ct?.addEventListener("stop",()=>{this.Ru(),this.fa(),this.ri(wt.STOP);}),this.Ct?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.Au=()=>{if(this.Ct?.state==="recording")return;let t=this._.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Ou=()=>{this.St?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.ua=t.enabled?"microphone":"microphone-mute",this.ko=!t.enabled;});};this.Ru=()=>{try{let t=new Blob(this.Je,{type:this.Ct?.mimeType}),e=URL.createObjectURL(t),o=this._.value;if(!o)return;o.muted=!1,o.volume=1,this.oi(null),o.src=e,this.$u(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Iu=()=>{if(this.ri(wt.RETAKE),this.v===A.VIDEO){this.oi(this.St);let t=this._.value;t&&(t.muted=true);}this._.value?.play?.();};this.Uu=()=>{if(this.ri(wt.ACCEPT),this.v===A.PHOTO){this.At?.toBlob(s=>{if(!s)return;let n=this.ga("camera","jpeg",Ra,s);this.va(n);},Ra);return}let t=new Blob(this.Je,{type:this.Ct?.mimeType}),e=this.Du(this.Ct?.mimeType),o=this.ga("video",e,`video/${e}`,t);this.va(o),this.Je=[];};this.Fu=t=>{t===wt.SHOT&&(this.le=true,this.se=true,this.Pt=true,this.Le=false,this.oe=true),(t===wt.RETAKE||t===wt.ACCEPT)&&(this.le=!this.q.includes(A.VIDEO),this.Pt=!this.q.includes(A.PHOTO),this.se=false,this.Le=true,this.oe=this.Oe.length<=1);};this.Nu=t=>{t===wt.PLAY&&(this.Ie=false,this.Pt=true,this.oe=true,this.ne=true,this.ei="pause",this.Ue="square",this.er="uc-shot-btn uc-camera-action uc-stop-record"),t===wt.STOP&&(this.Ie=false,this.se=true,this.ae=true,this.Le=false),(t===wt.RETAKE||t===wt.ACCEPT)&&(this.Ie=true,this.le=!this.q.includes(A.VIDEO),this.Pt=!this.q.includes(A.PHOTO),this.se=false,this.Le=true,this.ae=!this.cfg.enableAudioRecording,this.Ue="video-camera-full",this.er="uc-shot-btn uc-camera-action",this.ne=!this.cfg.enableAudioRecording||this.Me.length<=1,this.oe=this.Oe.length<=1);};this.ri=t=>{this.v===A.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Fu(t),this.v===A.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Nu(t);};this.ha=t=>{this.oa.value?.querySelectorAll("button").forEach(o=>{o.classList.toggle("uc-active",o.getAttribute("data-id")===t);}),t===A.PHOTO&&(this.Ue="camera-full",this.ne=true,this.ae=true),t===A.VIDEO&&(this.ei="play",this.Ue="video-camera-full",this.ne=!this.cfg.enableAudioRecording||this.Me.length<=1,this.ae=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.ga=(t,e,o,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:o})};this.va=t=>{this.api.addFileFromObject(t,{source:z.CAMERA}),this.set$({"*currentActivity":T.activities.UPLOAD_LIST}),this.modalManager?.open(T.activities.UPLOAD_LIST);};this.si=$(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===A.VIDEO&&this.cfg.enableAudioRecording,o=this.v===A.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Ji=false,this.se=false,this.Pt=!this.q.includes(A.PHOTO),this.le=!this.q.includes(A.VIDEO),this.tr=true,this.Ie=true,this.Ue=o,this.ae=!e,this.ne=!e):t==="prompt"?(this.Ao="camera-permissions-prompt",this.Ji=true,this.se=true,this.Pt=true,this.tr=false,this.Io()):(this.Ao="camera-permissions-denied",this.Ji=true,this.tr=false,this.Pt=!this.q.includes(A.PHOTO),this.le=!this.q.includes(A.VIDEO),this.Le=true,this.er="uc-shot-btn uc-camera-action",this.Io());},300);this.Vu=()=>{if(!this.St)return false;let t=this.St?.getAudioTracks(),e=this.St?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.Io=()=>{this.So&&(this._.value&&(this._.value.volume=0),this.Qi?.getTracks?.()?.[0]?.stop(),this.Oo(this._.value),this.oi(null),this.Vu(),this.fa(),this.So=false);};this.Pe=async()=>{let t={video:{...sd},audio:this.cfg.enableAudioRecording?{}:false};this.Xi&&(t.video={deviceId:{exact:this.Xi}}),this.Zi&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Zi}}),this._.value&&(this._.value.volume=0);try{this.si("prompt"),this.St=await navigator.mediaDevices.getUserMedia(t),this.St.addEventListener("inactive",()=>{this.si("denied");}),this.oi(this.St),this.So=!0,this.si("granted");}catch(e){this.si("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.ya=()=>{this.Pe();};this._u=async()=>{try{this.ir();for(let t of nd){let e=await navigator.permissions.query({name:t});this.fu[t]=e,e.addEventListener("change",this.ya),this.Yi.push(()=>{e.removeEventListener("change",this.ya);});}this.Wi=()=>{this.ir();};}catch(t){this.ir(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Pe();}};this.Bu=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Lo(),navigator.mediaDevices.addEventListener("devicechange",this.Lo);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Lo=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Oe=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Me=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.la=this.Oe,this.oe=this.Oe.length<=1,this.Xi=this.Oe[0]?.value??null,this.ca=this.Me,this.ne=!this.cfg.enableAudioRecording||this.Me.length<=1,this.Zi=this.Me[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.zu=async()=>{await this._u(),await this.Bu(),await this.Pe(),this.ba(this.q);};this.Hu=async()=>{this.Wi&&this.Wi(),window.chrome||this.si("denied"),this.Io();};this.ba=t=>{this.le=!t.includes(A.VIDEO),this.Pt=!t.includes(A.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.ha(e);};}$u(t){this.Oo(t),t.addEventListener("play",this.ea),t.addEventListener("pause",this.ra);}Oo(t){t?.removeEventListener("play",this.ea),t?.removeEventListener("pause",this.ra);}oi(t){this.Qi!==t&&(this.Qi=t,this.Mo());}Mo(){let t=this._.value;if(!t)return;let e=this.Qi??null;t.srcObject!==e&&(t.srcObject=e);}bu(){if(this.ri("shot"),this.At=document.createElement("canvas"),this.e=this.At.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this._.value;if(!t)throw new Error("Video element not found");this.At.height=t.videoHeight,this.At.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.At.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Du(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let o=t.split("/");if(o?.[0]==="video"){let n=o.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get q(){return H(this.cfg.cameraModes).filter(t=>t===A.PHOTO||t===A.VIDEO)}ir(){if(this.Yi.length!==0){for(let t of this.Yi)t();this.Yi=[],this.Wi=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.zu,onDeactivate:this.Hu}),this.subConfigValue("cameraMirror",t=>{this.aa=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ae=!t,this.ko=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=lt(t);this.ba(e.filter(o=>o===A.PHOTO||o===A.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.Mo();}updated(t){super.updated(t),this.Mo();}Ku(){this.ir(),navigator.mediaDevices?.removeEventListener("devicechange",this.Lo),this.Oo(this._.value),this.oi(null);}disconnectedCallback(){super.disconnectedCallback(),this.Ku();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.oe}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.la} ?hidden=${this.oe} @change=${this.Tu} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${Ae({transform:this.aa})} ?hidden=${this.Ji} ${I(this._)} ></video><div class="uc-message-box" ?hidden=${this.tr}><span>${this.l10n(this.Ao)}</span><button type="button" @click=${this.xu} ?hidden=${this.vu} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${I(this.oa)} class="uc-switcher" ?hidden=${!this.Ie}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.pa} ?hidden=${this.Pt} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.pa} ?hidden=${this.le} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.Su} ?hidden=${this.Ie} data-testid="recording-timer" ><uc-icon name=${this.ei}></uc-icon><span ${I(this.ii)}> 00:00 </span><span ${I(this.re)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Le} ><button type="button" class="uc-secondary-btn" @click=${this.Mu}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Lu} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Cu} class=${this.er} ?hidden=${this.se} ><uc-icon name=${this.Ue}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ku} ?hidden=${this.ae} data-testid="toggle-microphone" ><uc-icon name=${this.ua}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.ca} ?hidden=${this.ne} ?disabled=${this.ko} @change=${this.Eu} data-testid="audio-select" ></uc-select></div></div>`}};p([f()],N.prototype,"aa",2),p([f()],N.prototype,"Ji",2),p([f()],N.prototype,"tr",2),p([f()],N.prototype,"vu",2),p([f()],N.prototype,"la",2),p([f()],N.prototype,"oe",2),p([f()],N.prototype,"Ao",2),p([f()],N.prototype,"Ie",2),p([f()],N.prototype,"se",2),p([f()],N.prototype,"Le",2),p([f()],N.prototype,"ca",2),p([f()],N.prototype,"ne",2),p([f()],N.prototype,"ko",2),p([f()],N.prototype,"ae",2),p([f()],N.prototype,"Pt",2),p([f()],N.prototype,"le",2),p([f()],N.prototype,"Ue",2),p([f()],N.prototype,"ei",2),p([f()],N.prototype,"ua",2),p([f()],N.prototype,"er",2);function Ei(r,i,t){return r?i(r):t?.(r)}function Da(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function mt(...r){let i=Da(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Fa(r,...i){let t=Da(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var ad=r=>it.includes(r),Va=r=>{if(!r)return it;let i=lt(r).filter(ad);return i.length===0?it:i};function _a(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":it,"*tabId":_.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=St,t.src=e;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=et(Jt(i),"preview"),o=G(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:o,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Na="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var ke={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},xi=class extends x{constructor(){super(...arguments);this.xt=false;this.wa=ke;this.Ta=ke.visible;this.Ea=ke.hidden;this.Uo=false;this.xa=false;}set visible(t){this.xt=t,this.Ca();}get visible(){return this.xt}set styles(t){this.wa=t,this.Uo=true,this.Ta=t.visible??ke.visible,this.Ea=t.hidden??ke.hidden;}get styles(){return this.wa}Ca(){this.style.visibility=this.xt?"inherit":"hidden",Fa(this,{[ke.transition]:!this.Uo,[this.Ta]:this.xt,[this.Ea]:!this.xt}),this.toggleAttribute("inert",!this.xt);}ju(){this.xa||(this.xa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Uo||this.classList.add(ke.transition),this.Ca(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.ju();},0);}};p([y({type:Boolean})],xi.prototype,"visible",1),p([y({attribute:false})],xi.prototype,"styles",1);var Dr=class extends x{constructor(){super(...arguments);this.active=false;this.re=O();this.Po=false;this.Ro=()=>{let t=this.re.value;t&&(this.Sa(t),this.Po&&this.active&&this.$o());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.$o();}updated(t){super.updated(t),t.has("active")&&(this.active?this.$o():this.Gu());}$o(){let t=this.re.value;if(!t)return;this.Po=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Ro),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Ro,{once:true});}Gu(){let t=this.re.value;t&&(this.Po=false,t.removeEventListener("transitionend",this.Ro),this.Sa(t));}Sa(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${I(this.re)}></div></div>`}};p([y({type:Boolean,reflect:true})],Dr.prototype,"active",2);var Dt=pt(class extends bt{constructor(r){if(super(r),r.type!==Ut.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=r.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let o=!!i[e];o===this.st.has(e)||this.nt?.has(e)||(o?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return J}});var K=r=>r??P;var kt=class extends x{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.Aa(),this.ka();}updated(t){super.updated(t),t.has("reverse")&&this.Aa(),t.has("theme")&&this.ka();}Aa(){this.style.flexDirection=this.reverse?"row-reverse":"";}ka(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get qu(){let t=this.Do;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Wu}}get Do(){return !this.icon}get Wu(){return !this.text&&!this.Do}render(){return v`<button type="button" role=${K(this.ariaRole||void 0)} aria-controls=${K(this.ariaControls||void 0)} aria-label=${K(this.l10n(this.titleProp))} title=${K(this.l10n(this.titleProp))} ><uc-icon class=${Dt(this.qu)} name=${K(this.icon||void 0)} ?hidden=${this.Do} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],kt.prototype,"text",2),p([y({type:String})],kt.prototype,"icon",2),p([y({type:Boolean,reflect:true})],kt.prototype,"reverse",2),p([y({type:String,reflect:true})],kt.prototype,"theme",2),p([y({attribute:"aria-role"})],kt.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],kt.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],kt.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],kt.prototype,"active",2);function Ba(r,i){let t={};for(let e of i){let o=r[e];(Object.hasOwn(r,e)||o!==void 0)&&(t[e]=o);}return t}function Ze(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return G(r,et(qi,Jt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${It}/${Lt}/uc-cloud-image-editor/`))}var Fr=class extends x{constructor(){super(...arguments);this.Oa=`uc-backdrop-mask-${tt.generateFastUid()}`;this.or=false;this.ci=false;this.La=O();this.ui=false;this.di=null;this.Pa=t=>{this.Ra(),this.pi&&(t.stopPropagation(),t.preventDefault(),this.pi=false);};this.$a=t=>{if(!this.pi||!this.rr||!this.No)return;t.stopPropagation(),t.preventDefault();let e=this.Ht;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,a=t.y-s,l=n-this.rr[0],c=a-this.rr[1],{direction:d}=this.No,u=this.od(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.Da=t=>{if(!this.Rt)return;let e=Object.values(this.Rt).find(o=>{if(!o||this._o(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return ea(a,[t.x,t.y])});this.Ma=e,this.Ra();};}get Ht(){return this.La.value??null}get pi(){return this.ci}set pi(t){this.ci!==t&&(this.ci=t,this.Vo());}Vo(){this.ai&&this.ai.setAttribute("class",mt({"uc-guides--hidden":this.or,"uc-guides--visible":!this.or&&this.ci,"uc-guides--semi-hidden":!this.or&&!this.ci}));}_o(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let o=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return o||s}Zu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,a=this.Ht;if(!a)return;let l=ht("mask",{id:this.Oa}),c=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=ht("rect",{x:e,y:o,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Oa})`});a.appendChild(u),a.appendChild(l),this.ni=l,this.Fo=d;}Xu(){this.ni&&(this.ni.style.display="none",window.requestAnimationFrame(()=>{this.ni&&(this.ni.style.display="block");}));}Yu(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this.Fo&&oe(this.Fo,{x:e,y:o,width:s,height:n});}Qu(){let t=this.$["*cropBox"];if(!(!t||!this.ai||!this.Rt)){for(let e of Object.values(this.Rt)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:a}=e,l=o==="",c=o.length===2,{x:d,y:u,width:h,height:m}=t;if(l)oe(n,{x:d,y:u,width:h,height:m});else {let b=se(Math.min(h,m)/82/2,0,1),w=c?Xn(t,o,b):Yn(t,o,b),C=w.center;if(!C)continue;let E=Math.max(Jo*se(Math.min(h,m)/Jo/3,0,1),Zn);oe(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),oe(s,{d:w.d});}let g=this._o(o);a.setAttribute("class",mt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}oe(this.ai,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Ua(t,e){let o=ht("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=ht("rect",{fill:"transparent"}),n=ht("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(n),o.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.Ju.bind(this,e));}td(){let t={};for(let e=0;e<3;e++)for(let o=0;o<3;o++){let s=`${["n","","s"][e]}${["w","","e"][o]}`;s!==""&&this.Ua(t,s);}return this.Ua(t,""),t}ed(){let t=ht("svg"),e=ht("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let o=1;o<=2;o++){let s=ht("line",{x1:`${hi*o}%`,y1:"0%",x2:`${hi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=ht("line",{x1:"0%",y1:`${hi*o}%`,x2:"100%",y2:`${hi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}rd(){let t=this.Ht;if(!t)return;let e=document.createDocumentFragment(),o=this.ed();e.appendChild(o);let s=this.td();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Rt=s,this.ai=o,this.Vo();}Ju(t,e){if(!this.Rt)return;let o=this.Rt[t];if(!o||this._o(t))return;let s=this.$["*cropBox"],n=this.Ht;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.pi=true,this.No=o,this.rr=[c,d],this.Ia={...s};}od(t,e){let[o,s]=e,n=this.$["*imageBox"],a=this.Ia??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Jn({rect:a,delta:[o,s],imageBox:n}):a=ta({rect:a,delta:[o,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return _e(Be(a),n)}Ra(){let t=this.Ma,e=this.Ht;e&&(e.style.cursor=t?Qn(t.direction):"initial");}Fa(t){if(this.li){this.li.setAttribute("href",t);return}let e=this.Ht;if(!e){this.di=t;return}this.di=null;let o=document.createDocumentFragment(),s=ht("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.li=s;}sd(){let t=this.$["*cropBox"];if(!t||!this.li)return;let{x:e,y:o,width:s,height:n}=t;oe(this.li,{x:e,y:o,height:n,width:s});}Bo(){this.ui&&(this.Yu(),this.Qu(),this.sd());}toggleThumbs(t){if(this.Rt)for(let e of Object.values(this.Rt)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",mt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Xu(),this.ui&&window.requestAnimationFrame(()=>{this.Bo();});}),this.sub("*cropBox",t=>{t&&(this.or=t.height<=k||t.width<=k,this.Vo(),this.ui&&window.requestAnimationFrame(()=>{this.Bo();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Fa(t);}),document.addEventListener("pointermove",this.$a,true),document.addEventListener("pointerup",this.Pa,true);}firstUpdated(t){super.firstUpdated(t),this.nd();}nd(){let t=this.Ht;if(!(!t||this.ui)){if(this.Zu(),this.rd(),this.ui=true,t.addEventListener("pointermove",this.Da,true),this.di){let e=this.di;this.di=null,this.Fa(e);}this.Bo();}}disconnectedCallback(){super.disconnectedCallback(),this.Ht?.removeEventListener("pointermove",this.Da,true),document.removeEventListener("pointermove",this.$a,true),document.removeEventListener("pointerup",this.Pa,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${I(this.La)}></svg>`}};p([f()],Fr.prototype,"ci",2);function cd(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(o=>Number.isInteger(o)&&Number.isFinite(o)),({dimensions:t,coords:e})=>t.every(o=>o>0)&&e.every(o=>o>=0)].every(t=>t(r)):true}var Vr=class extends x{constructor(){super();this.ctxOwner=true;this.ce={width:0,height:0};this.e=null;this.E=false;this.mt=null;this.Va=O();this.Ho=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Na=$(this._a.bind(this),300),this.zo=ae(()=>{!this.isConnected||!this.E||(this.Ko(),this.Ba(),this.za(),this.jo(),this.Go());},100);}firstUpdated(t){super.firstUpdated(t),this.Ko();}Ba(){let t=this.$["*editorTransformations"],e=Ba(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}Ko(){let t=this.Va.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*n,t.height=s*n,e?.scale(n,n),this.At=t,this.e=e;}za(){if(!this.E||!this.mt)return;let t=this.mt,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},a=Ne({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,m=0+e,g=e+(n.height-e*2)/2-h/2;l={x:m,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,m=e+(n.width-e*2)/2-h/2,g=0+e;l={x:m,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Be(l);}jo(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,m],coords:[g,b]}=n,{width:w}=Ne(this.ce,s),C=a/w;t=_e(Be({x:l+g*C,y:c+b*C,width:h*C,height:m*C}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!ia(t,e)||u&&!ra(t,u)){let h=e.width/e.height,m=e.width,g=e.height;u&&(h>u?m=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-g/2,width:m,height:g};}this.$["*cropBox"]=_e(Be(t),e);}ad(){let t=this.e;if(!t)return;let e=this.mt;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Ne({width:o.width,height:o.height},l);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Go(){if(!this.E||!this.mt||!this.At||!this.e)return;let t=this.At;this.e.clearRect(0,0,t.width,t.height),this.ad();}ld({fromViewer:t}){this.mt&&(this.Ho.value?.toggleThumbs(true),this.cd(),setTimeout(()=>{this.className=mt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Ha(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a}=e,{width:l,height:c}=Ne(this.ce,s),{width:d,height:u}=t,h=n/l,m=a/c;return [se(Math.round(d/h),1,l),se(Math.round(u/m),1,c)]}ud(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Ne(this.ce,s),{x:h,y:m}=t,g=n/d,b=a/u,w=this.Ha(),C={dimensions:w,coords:[se(Math.round((h-l)/g),0,d-w[0]),se(Math.round((m-c)/b),0,u-w[1])]};if(!cd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===d&&w[1]===u))return C}_a(){if(!this.isConnected||!this.ce)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.ud(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.E&&(this.za(),this.jo(),this.Go());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.E){this.E=true,await this.updateComplete,this.Ko(),this.ce=t,this.removeEventListener("transitionend",this.Ka);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.mt=await this.dd(o,s),this.Ba(),this.zo(),this.ld({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.E&&this.mt&&this.zo();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.E&&(!t&&this._a(),this.E=false,this.pd(),this.className=mt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ho.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Ka,{once:true}),this.s?.disconnect());}pd(){let t=this.Ha(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(o,s),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}cd(){let t=this.$["*cropBox"],e=t.x+t.width/2,o=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${o}px`;}Ka(){this.E||(this.mt=null);}async dd(t,e){let o=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Ze(t,o,e)),{promise:n,cancel:a,image:l}=Se(s),c=this.$e(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.b?.(),this.b=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}$e(t){let e="crop",o=this.$["*loadingOperations"],s=o.get(e);return s||(s=new Map,o.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Go();}),this.sub("*cropBox",()=>{this.mt&&this.Na();}),this.sub("*currentAspectRatio",()=>{this.jo();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.E&&this.ce&&this.activate(this.ce,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.mt&&(this.mt=null);}render(){return v`<canvas class="uc-canvas" ${I(this.Va)}></canvas><uc-crop-frame ${I(this.Ho)}></uc-crop-frame>`}};p([f()],Vr.prototype,"mt",2);function ws(r,i,t){let e=t,o=t-1,s=new Array(e);for(let n=o;n>=0;n-=1)s[n]=Math.ceil((n*i+(o-n)*r)/o);return s}function ud(r){return typeof r=="string"&&r in Ct}function dd(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],o=r[t+1];typeof e=="number"&&typeof o=="number"&&i.push([e,o]);}return i}function pd(r,i,t){let e=dd(r).find(([n,a])=>n<=i&&i<=a);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let a=Math.abs(o-s)||1,l=Math.abs(i-o)/a;return o===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function hd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function za(r,i){let t=Ct[r].keypointsNumber,{range:e,zero:o}=Ct[r];return [...new Set([...ws(e[0],o,t+1),...ws(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}var Ts=class extends x{constructor(){super();this.E=false;this.qo=true;this.n="initial";this.ja={};this.Kt=[];this.qa=0;this.Za=O();this.sr=O();this.classList.add("uc-inactive_to_cropper"),this.Wa=$(async(t,e,o)=>{let s=()=>!this.Xa(t,e)||this.Ce!==o||!!this.Kt.find(c=>c.value===o);if(s())return;let n=await this.Ya(t,o),a=new Image;a.src=n.src;let l=this.$e(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Kt,d=c.findIndex(g=>g.value>o);d===-1&&(d=c.length);let h=c[d]?.image,m=this.sr.value;!m||h&&!m.contains(h)||(c.splice(d,0,n),h?m.insertBefore(a,h):m.appendChild(a),this.Xo(t,o));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}$e(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}Qa(){window.cancelAnimationFrame(this.qa),this.qa=window.requestAnimationFrame(()=>{for(let t of this.Kt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ue({url:t=this.Ga,filter:e=this.m??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.ja};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let a=this.offsetWidth;return this.proxyUrl(Ze(t,a,n))}async Ya(t,e){return {src:await this.ue({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Xa(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!ud(this.n)||!Number.isFinite(e)||(this.Xo(this.n,e),this.Wa(this.n,this.m,e));}Xo(t,e){this.n=t,this.Ce=e;let{zero:o}=Ct[t],s=this.Kt.map(l=>l.value),n=pd(s,e,o),a=hd(s,o);this.Kt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Qa();}Ja(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async hd(){this.a=this.a||this.Ja();let t=this.a;t&&this.tl(t);let e=this.Kt.map(c=>c.src),{images:o,promise:s,cancel:n}=wi(e);o.forEach(c=>{let d=this.$e(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Wo=()=>{n(),this.Wo=void 0;};let a=this.n,l=this.m;if(await s,this.E&&this.Xa(a,l)){let c=this.sr.value;if(!c)return;c.replaceChildren(),this.Kt.forEach((d,u)=>{let h=o[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Qa();}}async setTransformations(t){if(this.ja=t,this.a){let e=await this.ue(),o=this.$e(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Zo?.();let n=za(o,s),a=await Promise.all(n.map(c=>this.ue({url:t,filter:e,operation:o,value:c}))),{cancel:l}=wi(a);this.Zo=l;}md(t){let e=this.a||this.Ja();if(this.tl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=mt({"uc-active_from_viewer":this.hi,"uc-active_from_cropper":!this.hi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.$e(t);e.addEventListener("error",o,{once:true}),e.src=t,e.addEventListener("load",()=>{o(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=mt({"uc-active_from_viewer":this.hi,"uc-active_from_cropper":!this.hi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:n}){if(this.E=true,this.qo=false,await this.updateComplete,this.Ga=t,this.n=e??"initial",this.Ce=o,this.m=s,this.hi=n,typeof o!="number"&&!s){let l=await this.ue({operation:e,value:o});this.md(l),this.Yo();return}!e||typeof o!="number"||(this.Kt=await Promise.all(za(e,o).map(l=>this.Ya(e,l))),this.Xo(e,o),this.hd());}deactivate({hide:t=true}={}){this.E=false,this.Wo?.(),this.Zo?.(),t&&!this.qo?(this.qo=true,this.a&&(this.a.style.transform="scale(1)"),this.className=mt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Yo();},{once:true})):this.Yo();}tl(t){let e=this.Za.value;e&&(e.contains(t)||e.appendChild(t));}Yo(){this.sr.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${I(this.Za)}></div><div class="uc-fader-layers-host" ${I(this.sr)}></div>`}};var Zt=class extends x{constructor(){super();this.Qo=0;this.zt=O();this.rl=O();this.ol=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.jt=0;this.gd=t=>{t.stopPropagation();let e=this.sl(t);e!==null&&(this.Jo(e),this.fd("slider-input",e));};this.vd=t=>{t.stopPropagation();let e=this.sl(t);e!==null&&this.Jo(e);};this.nl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.al=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}fd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Qo=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.ll(this.jt),this.ts(),this.s=new ResizeObserver(()=>{this.ts(),this.nr(this.jt);}),this.s.observe(this);let e=this.zt.value;e?.addEventListener("focus",this.nl),e?.addEventListener("blur",this.al),window.setTimeout(()=>{this.nr(this.jt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.jt&&this.Jo(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.ts(),this.nr(this.jt)),t.has("zero")&&this.hasUpdated&&this.cl(this.jt);}nr(t){this.cl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(o-this.Qo)/100;window.requestAnimationFrame(()=>{let l=this.rl.value;l&&(l.style.transform=`translateX(${a}px)`);});}cl(t){if(!this.mi)return;let e=this.max-this.min;if(e===0)return;this.mi.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(o-this.Qo)/100;window.requestAnimationFrame(()=>{this.mi&&(this.mi.style.transform=`translateX(${a}px)`);});}ts(){let e=this.ol.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.il===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.mi=d,e.innerHTML="",e.appendChild(a),this.il=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.zt.value;t?.removeEventListener("focus",this.nl),t?.removeEventListener("blur",this.al),this.s?.disconnect(),this.s=void 0;}Jo(t){Number.isFinite(t)&&(this.jt=t,this.hasUpdated&&(this.ll(t),this.nr(t)));}ll(t){let e=this.zt.value;e&&(e.value=String(t));}sl(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return v`<div class="uc-steps" ${I(this.ol)}></div><div class="uc-thumb" ${I(this.rl)}></div><input class="uc-input" type="range" ${I(this.zt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.jt)} ?disabled=${this.disabled} @input=${this.gd} @change=${this.vd} />`}};p([y({type:Boolean,reflect:true})],Zt.prototype,"disabled",2),p([y({type:Number})],Zt.prototype,"min",2),p([y({type:Number})],Zt.prototype,"max",2),p([y({type:Number,attribute:false})],Zt.prototype,"defaultValue",2),p([y({type:Number})],Zt.prototype,"zero",2),p([f()],Zt.prototype,"jt",2);var Ft="original",_r=class extends x{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Co=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.yd();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===Ft?void 0:this.state.value,filter:this.state.filter===Ft?void 0:this.state.filter,fromViewer:false});}yd(){let t=this.state.operation,{range:e,zero:o}=Ct[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:m}=u;d=h===this.state.filter?m:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:o;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Ft?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.Co} ></uc-slider-ui>`}};p([f()],_r.prototype,"state",2);function Xe(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var st=class extends x{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}}ul(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.ul();}updated(t){super.updated(t),t.has("active")&&this.ul();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([f()],st.prototype,"active",2),p([f()],st.prototype,"title",2),p([f()],st.prototype,"icon",2),p([f()],st.prototype,"titleProp",2);var Nr=12,Br=16,md=r=>{let i=12,t=12;return r.width/r.height>=1?(i=Nr,t=Math.round(Nr*r.height/r.width)):(t=Nr,i=Math.round(Nr*r.width/r.height)),{width:i,height:t}},Es=class extends st{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.bd(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}bd(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return v`<button role="option" type="button" class=${Dt(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},zr=class extends st{constructor(){super(...arguments);this.Y=null;}get aspectRatio(){return this.Y}set aspectRatio(t){if(this.Y===t)return;let e=this.Y;this.Y=t,this.requestUpdate("aspectRatio",e),t?this.dl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.Y&&this.dl(this.Y),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.Y?.id||t?.width===this.Y?.width&&t?.height===this.Y?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.Y?.id&&(this.$["*currentAspectRatio"]=this.Y);}dl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};o(),s(),e||this.requestUpdate();}wd(){let t=this.Y;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=md(t),s=(Br-e)/2,n=(Br-o)/2;return v`<uc-icon><svg viewBox="0 0 ${Br} ${Br}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${o} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" class=${Dt(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} >${this.wd()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],zr.prototype,"aspectRatio",1);function fd(r){let i=r+90;return i=i>=360?0:i,i}function gd(r,i){if(r==="rotate")return fd(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var Hr=class extends st{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],o=e.getValue(this.operation),s=gd(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};p([y({type:String})],Hr.prototype,"operation",2);var ce=class extends st{constructor(){super(...arguments);this.n="";this.m="";this.fi="";this.ar=0;this.a=null;this.Fe=false;this.isOriginal=false;this.pl=20;}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let o=this.m;this.m=e,this.n="filter",this.isOriginal=e===Ft,this.icon=this.isOriginal?"original":"slider",this.pl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.hl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Xe(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Td(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.pl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.m!==Ft?{name:this.m,amount:a}:void 0,G(this.fi,et(qi,Jt(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${It}/${Lt}/uc-cloud-image-editor/`))}async Qe(t,e){t[0]?.isIntersecting?await this.es(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.fi=t??"",this.sub("*originalUrl",e=>{this.fi=e??"",!this.isOriginal&&this.fi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.de());}),this.isOriginal||(this.s?.observe(this),this.de()),this.m&&this.hl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.es():this.de());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.lr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.de()));}hl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async es(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.fi){!this.De&&!this.Gt&&this.de();return}let e=++this.ar,o="";try{o=await this.proxyUrl(this.Td());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Fe=false,this.b?.();let{promise:s,cancel:n}=Se(o);this.b=()=>{n(),this.ar===e&&(this.b=void 0);};try{if(await s,this.ar!==e||!this.isConnected)return;this.a=o,this.Fe=!0,this.lr(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.de();}finally{this.ar===e&&(this.b=void 0);}}de(){if(!this.isConnected||this.a||this.Fe||this.isOriginal||this.$["*networkProblems"]){this.lr();return}this.Gt&&cancelAnimationFrame(this.Gt),this.Gt=requestAnimationFrame(()=>{if(this.Gt=void 0,!this.isConnected||this.a||this.Fe||this.isOriginal){this.lr();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<o){this.es();return}this.De=window.setTimeout(()=>{this.De=void 0,this.de();},500);});}lr(){this.Gt&&(cancelAnimationFrame(this.Gt),this.Gt=void 0),this.De&&(window.clearTimeout(this.De),this.De=void 0);}get Ed(){return !!(this.Fe&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ed?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${Dt(this.buttonClasses)} aria-label=${K(this.titleProp)} title=${K(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Fe} style=${Ae(e)}></div><uc-icon class=${Dt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Ae(o)} ></uc-icon></button>`}};p([f()],ce.prototype,"a",2),p([f()],ce.prototype,"Fe",2),p([f()],ce.prototype,"isOriginal",2),p([f()],ce.prototype,"pl",2),p([y({type:String})],ce.prototype,"filter",1);var jr=class extends st{constructor(){super(...arguments);this.n="";}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.ml(e);}ml(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},o=()=>{let s=this.l10n(t);return this.title=s,s};e(),o();}initCallback(){super.initCallback(),this.n&&this.ml(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Ct[this.n],o=t[this.n],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Xe(this.$["*operationTooltip"])});}};p([y({type:String})],jr.prototype,"operation",1);var vd=1,Ha=()=>{},Kr=class extends x{constructor(){super(...arguments);this.hiddenScrollbar=false;this.fl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>vd){this.scrollLeft+=o;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.fl,{passive:false}),this.addEventListener("scroll",Ha,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.fl),this.removeEventListener("scroll",Ha),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Kr.prototype,"hiddenScrollbar",2);var ft=class extends x{constructor(){super(...arguments);this.gi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.gl=true;this.tabList=[...it];this.activeTab=_.CROP;this.cr=true;this.rs=false;this.vl=null;this.yl=0;this.bl=0;this.ur=O();this.wl=O();this.tabToggleRefs={[_.CROP]:O(),[_.TUNING]:O(),[_.FILTERS]:O()};this.Tl=()=>{this.pe();};this.vi=[];this.dr=$(t=>{this.gi=t;},500);this.pr=$(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===_.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${n}`;}else o=this.l10n(Ft);else if(this.showSubToolbar&&this.$["*tabId"]===_.TUNING&&e){s=true;let n=t?.[e]||Ct[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.rs=s;},0);this.xd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Cd={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Sd={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Ad={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Ft,"*currentOperation":null,"*operationTooltip":null};this.Ut=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.as=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Fd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Xe(this.$["*operationTooltip"])}),this.ur.value?.apply(),this.El();};this.Nd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.ur.value?.cancel(),this.El();};this.Vd=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.os(o,{fromViewer:false}));};}El(){this.$["*showSlider"]=false,this.$["*tabId"]===_.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===_.TUNING&&(this.rs=false);}os(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.xl(t,{fromViewer:e,force:o});}xl(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.pe();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===_.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of it){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.pe();}}pe(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.wl.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.yl!==s||this.bl!==n)&&(this.yl=s,this.bl=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get ss(){return this.vi.length>=3}kd(t){switch(t){case _.CROP:return this.Od();case _.FILTERS:return this.Md();case _.TUNING:return this.Id();default:return []}}Od(){let t=[];if(this.ss)t.push(()=>this.Ld());else for(let e of this.vi)t.push(()=>this.Cl(e));for(let e of cn)t.push(()=>this.Ud(e));return this.ns(t)}Md(){let e=[Ft,...ln].map(o=>()=>this.Pd(o));return this.ns(e)}Id(){let t=an.map(e=>()=>this.Rd(e));return this.ns(t)}ns(t){return t.length?t.map(o=>o()):[]}Ld(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Cl(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Ud(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Pd(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Rd(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}$d(){return this.ss?this.vi.map(t=>this.Cl(t)):[]}async Dd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ze(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:o}=wi([e]);this.b=()=>{o(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.vi=[...t],this.sub("*cropPresetList",e=>{this.vi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.os(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.pr();}),this.sub("*currentOperation",()=>{this.pr();}),this.sub("*tabId",e=>{this.xl(e,{fromViewer:false,force:true}),this.pr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Dd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,n]of s.entries())if(n){o=true;break}}this.dr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.cr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.cr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.gl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.os(o,{fromViewer:false});return}this.pe();}),this.sub("*operationTooltip",e=>{this.vl=e;}),this.pr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Tl);}firstUpdated(t){super.firstUpdated(t),this.hr(),this.pe();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.pe()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.hr();}disconnectedCallback(){window.removeEventListener("resize",this.Tl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}hr(){let t=this.ur.value;t&&(this.$["*sliderEl"]=t);}_d(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Ae({gridColumn:`${s+1}`}):P;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Sd}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${o?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${o} style=${n} @click=${this.Vd} ${I(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Bd(t){let e=this.kd(t);return v`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:P}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.rs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.ss;return v`<uc-line-loader-ui .active=${this.gi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.vl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.xd} ><div class="uc-tab-content-row">${it.map(o=>Ei(this.activeTab===o,()=>this.Bd(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.gl} .styles=${this.Ad} @initial-render=${()=>this.pe()} ><div class="uc-tab-toggles_indicator" ${I(this.wl)} ></div>${it.map(o=>this._d(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ut} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.as}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Cd}><div class="uc-slider" ?hidden=${!this.cr}><uc-editor-slider ${I(this.ur)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.cr||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.$d()}</div>`:P}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Nd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Fd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([f()],ft.prototype,"gi",2),p([f()],ft.prototype,"showMainToolbar",2),p([f()],ft.prototype,"showSubToolbar",2),p([f()],ft.prototype,"gl",2),p([f()],ft.prototype,"tabList",2),p([f()],ft.prototype,"activeTab",2),p([f()],ft.prototype,"cr",2),p([f()],ft.prototype,"rs",2),p([f()],ft.prototype,"vl",2),p([f()],ft.prototype,"vi",2);var ja=zt([...it]),nt=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.zd="";this.ue=St;this.Hd="";this.gi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=ja;this.Sl=false;this.Dt=false;this.ls=null;this.dr=$(t=>{this.gi=t;},300);this.mr=O();this.Al=O();this.kl=O();this.Ol=O();this.Ml=()=>{this.dr(false),this.ue!==St&&(this.$["*networkProblems"]=false);};this.Il=()=>{this.dr(false),this.$["*networkProblems"]=true;};this.Kd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,..._a(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}jd(){this.Dt||this.ls||(this.ls=this.updateComplete.then(()=>{this.ls=null,this.Dt=true;}));}initCallback(){super.initCallback(),this.Ll(),this.Ul();}hr(){let t=this.kl.value;t&&(this.$["*faderEl"]=t);let e=this.Al.value;e&&(this.$["*cropperEl"]=e);let o=this.Ol.value;o&&(this.$["*imgContainerEl"]=o);let s=this.mr.value;s&&(this.$["*imgEl"]=s);}Gd(){let t=this.mr.value;t&&(t.addEventListener("load",this.Ml),t.addEventListener("error",this.Il));}qd(){let t=this.mr.value;t&&(t.removeEventListener("load",this.Ml),t.removeEventListener("error",this.Il));}get Wd(){let t=this.$["*tabId"];return mt("uc-image",{"uc-image_hidden_to_cropper":t===_.CROP,"uc-image_hidden_effects":t!==_.CROP})}Pl(){return new Promise((e,o)=>{let s=window.setTimeout(()=>{o(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.hr(),this.Gd(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.qd(),super.disconnectedCallback();}render(){let t=this.Hd??"",e=this.zd??"",o=this.ue||St,s=this.gi,n=this.Sl;return v` ${dr(Na)}<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.Kd}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${I(this.Ol)}><img src=${o} class=${this.Wd} ${I(this.mr)} />${Ei(this.Dt,()=>v`<uc-editor-image-cropper ${I(this.Al)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${I(this.kl)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Ei(this.Dt,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Ll(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Ul();}Ll(){let t=this.tabs||ja;this.$["*tabList"]=Va(t);}Ul(){let t=Er(this.cropPreset??""),e=null;if(this.cdnUrl){let o=bo(this.cdnUrl),s=wo(o);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=sa(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Pl(),this.cdnUrl){let t=this.cdnUrl,e=Gi(t),o=Qt(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=bo(t),n=wo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Qt(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===_.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(G(t,et("json"))),o=await fetch(e).then(a=>a.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===_.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.jd();}}async initEditor(){try{await this.Pl();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Sl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=et(Jt(t),"preview"),s=G(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([f()],nt.prototype,"zd",2),p([f()],nt.prototype,"ue",2),p([f()],nt.prototype,"Hd",2),p([f()],nt.prototype,"gi",2),p([y({type:String,reflect:true})],nt.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],nt.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],nt.prototype,"cropPreset",2),p([y({type:String,reflect:true})],nt.prototype,"tabs",2),p([f()],nt.prototype,"Sl",2),p([f()],nt.prototype,"Dt",2);var xs=class extends nt{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Gr=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=T.activities.CLOUD_IMG_EDIT;this.Q=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.Zd(),onDeactivate:()=>this.Xd()}),this.subConfigValue("cropPreset",t=>{this.Q&&this.Q.cropPreset!==t&&(this.Q={...this.Q,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Q&&this.Q.tabs!==t&&(this.Q={...this.Q,tabs:t});});}as(t){if(!this.kt)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.kt.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(T.activities.CLOUD_IMG_EDIT),this.historyBack();}Ut(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(T.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Zd(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.kt=e;let o=this.kt.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.Yd(o);}Xd(){this.kt=void 0,this.Q=null;}render(){if(!this.Q)return P;let{cdnUrl:t,cropPreset:e,tabs:o}=this.Q;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${K(e)} tabs=${K(o)} @apply=${this.as} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}Yd(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([f()],Gr.prototype,"Q",2);var yd=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ka=$(r=>{for(let{test:i,message:t}of yd)i(r)&&br(t);},0);var Ga=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},bd="0123456789abcdefghijklmnopqrstuvwxyz",qa=r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=bd[Number(t)]+i,r=r/36n;}return i},Cs=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var wd=async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},Td=10,Ed=async r=>{let i=await wd(r);return qa(i).slice(0,Td)},Wa=async(r,i)=>{let t=await Ed(r);return Ga(t,i)};var Za=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var Ss=r=>r,xd=[Ss({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=lt(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),zt(t)}}),Ss({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=lt(r);return t=t.sort((e,o)=>e===i?-1:o===i?1:0),zt(t)}}),Ss({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===si||Cs(i,t))?Wa(r,t):i})],Xa=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of xd)if(o.deps.includes(r)){let s={[o.key]:t(o.key)};for(let l of o.deps)s[l]=t(l);let n=new AbortController;e.get(o.key)?.abort(),e.set(o.key,n);let a;try{a=o.fn(s,{signal:n.signal});}catch(l){e.get(o.key)===n&&e.delete(o.key),console.error(`Failed to compute value for "${o.key}"`,l);return}Za(a)?a.then(l=>{n.signal.aborted||i(o.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,l);}).finally(()=>{e.get(o.key)===n&&e.delete(o.key);}):i(o.key,a);}};var F=r=>String(r),Q=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},V=r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},Ya=r=>r==="auto"?r:V(r),Qa=r=>{let i=F(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ja=r=>{let i=F(r);if(!Object.values(A).includes(i))throw new Error(`Invalid value: "${i}"`);return i},tl=r=>{let i=F(r),t=lt(i);if(t.some(e=>!Object.values(A).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},el=r=>{let i=F(r);if(i==="local"||i==="global")return i;if(V(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},il=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},qr=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Wr=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},As=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},rl=r=>{let i=F(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var Cd={pubkey:F,multiple:V,multipleMin:Q,multipleMax:Q,confirmUpload:V,imgOnly:V,accept:F,externalSourcesPreferredTypes:F,externalSourcesEmbedCss:F,store:Ya,cameraMirror:V,cameraCapture:Qa,sourceList:F,topLevelOrigin:F,maxLocalFileSizeBytes:Q,thumbSize:Q,showEmptyList:V,useLocalImageEditor:V,useCloudImageEditor:V,cloudImageEditorTabs:F,removeCopyright:V,cropPreset:F,imageShrink:F,modalScrollLock:V,modalBackdropStrokes:V,sourceListWrap:V,remoteTabSessionKey:F,cdnCname:F,cdnCnamePrefixed:F,baseUrl:F,socialBaseUrl:F,secureSignature:F,secureExpire:F,secureDeliveryProxy:F,retryThrottledRequestMaxTimes:Q,retryNetworkErrorMaxTimes:Q,multipartMinFileSize:Q,multipartChunkSize:Q,maxConcurrentRequests:Q,multipartMaxConcurrentRequests:Q,multipartMaxAttempts:Q,checkForUrlDuplicates:V,saveUrlForRecurrentUploads:V,groupOutput:V,userAgentIntegration:F,debug:V,localeName:F,metadata:il,secureUploadsExpireThreshold:Q,localeDefinitionOverride:r=>qr(r),secureUploadsSignatureResolver:r=>Wr(r),secureDeliveryProxyUrlResolver:r=>Wr(r),iconHrefResolver:r=>Wr(r),fileValidators:As,collectionValidators:As,validationTimeout:Q,validationConcurrency:Q,cameraModes:tl,defaultCameraMode:Ja,enableAudioRecording:V,enableVideoRecording:V,mediaRecorderOptions:qr,maxVideoRecordingDuration:Q,filesViewMode:rl,gridShowFileNames:V,cloudImageEditorAutoOpen:V,cloudImageEditorMaskHref:F,testMode:V,qualityInsights:V,pasteScope:el,smartBtn:qr},ol=(r,i)=>{if(!(typeof i>"u"||i===null))try{return Cd[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),Y[r]}};var Zr=[...new Set(["debug",...Object.keys(Y)])],Sd=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions","smartBtn"],al=r=>Sd.includes(r),Ci=Zr.filter(r=>!al(r)),sl={...Object.fromEntries(Ci.map(r=>[ni(r),r])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),r]))},Ad={...Object.fromEntries(Ci.map(r=>[ni(r),L(r)])),...Object.fromEntries(Ci.map(r=>[r.toLowerCase(),L(r)]))},nl=r=>`__${r}`,Xr=class extends x{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(Y).map(([t,e])=>[L(t),e]))};this.Qd=new Map;}Jd(t,e){if(!al(t)){let o=[...new Set([ni(t),t.toLowerCase()])];for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}tp(t,e){this.$[L(t)]!==e&&(typeof e>"u"||e===null?this.$[L(t)]=Y[t]:this.$[L(t)]=e);}fr(t,e){let o=this,s=ol(t,e),n=nl(t);o[n]!==s&&(this.ep(t,o[n],s),o[n]=s,this.Jd(t,s),this.tp(t,s),this.debugPrint(`"${t}"`,s),Ka(this.cfg));}Rl(t){let e=this,o=nl(t);return e[o]??this.$[L(t)]}ep(t,e,o){this.cfg.debug&&o!==e&&typeof o=="object"&&typeof e=="object"&&JSON.stringify(o)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,o));}initCallback(){super.initCallback();let t=this;for(let e of Ci)this.sub(L(e),o=>{this.fr(e,o);},false);for(let e of Zr){let o=t[e]??this.$[L(e)];o!==Y[e]&&this.fr(e,o);let s=Object.getOwnPropertyDescriptor(this,e);(!s||!s.set||!s.get)&&Object.defineProperty(this,e,{set:n=>{this.fr(e,n);},get:()=>this.Rl(e)});}for(let e of Zr)this.sub(L(e),()=>{Xa({key:e,setValue:this.fr.bind(this),getValue:this.Rl.bind(this),computationControllers:this.Qd});});}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=sl[t];n&&(s[n]=o),Ad[t]&&(this[t]=o);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(sl)]}};for(let r of Zr)Xr.prototype[r]=void 0;var ll=()=>{let r=globalThis.top??globalThis.parent??globalThis.self;try{return r.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}};var kd=r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),cl=(r,i="i")=>{let t=r.split("*").map(kd);return new RegExp(`^${t.join(".+")}$`,i)};var Od=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],Md=(r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),ul=r=>{let i={};for(let t of Od){let e=Md(r,t);e&&(i[t]=e);}return i};var Id=["selected-files-change","toolbar-state-change"],Ld=r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Id.includes(i))},Yr=class{constructor(i,t){this.gr=new Map;this.Dl=i=>{if(i.source!==this.cs)return;let t=i.data;if(!Ld(t))return;let e=this.gr.get(t.type);if(e)for(let o of e)o(t);};this.cs=i,this.$l=t,window.addEventListener("message",this.Dl);}on(i,t){let e=this.gr.get(i)??new Set;this.gr.has(i)||this.gr.set(i,e),e.add(t);}send(i){let t=this.$l();this.cs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Dl);}};function dl(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var Ud={[Rt.GDRIVE]:"ngdrive"},Tt=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=T.activities.EXTERNAL;this.Ne=O();this.vr=null;this.us=[];this.ds=false;this.ps=false;this.hs=false;this.ms=false;this.yr=false;this.fs=false;this.gs="uc-hidden";this.Fl=true;this.Eo=()=>{for(let t of this.us){let e=this.rp(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.$["*currentActivity"]=T.activities.UPLOAD_LIST,this.modalManager?.open(T.activities.UPLOAD_LIST);};this.Ut=()=>{this.historyBack();};this.cp=()=>{this.gt?.send({type:"select-all"});};this.up=()=>{this.gt?.send({type:"deselect-all"});};}get ip(){if(!this.vr)return "";let{selectedCount:t,total:e}=this.vr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Nl();}}),this.sub("*currentActivityParams",()=>{setTimeout(()=>{!this.isActivityActive||!this.isConnected||(this.vs(),this.Nl());});}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.vs();}),this.subConfigValue("multiple",t=>{this.yr=t;}),this.subConfigValue("localeName",()=>{this.Vl();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this._l(t);});}rp(t){if(t.alternatives){let e=H(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=cl(o);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}op(t){this.Fl=t.isVisible;}async sp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.np(t.selectedCount,t.total),this.gs=t.isReady?"":"uc-hidden",this.ds=t.isReady,this.ps=t.isReady&&t.selectedFiles.length>0,this.yr=t.isMultipleMode&&t.total>0,this.hs=t.selectedCount<t.total,this.ms=t.selectedCount===t.total,this.us=t.selectedFiles??[],this.fs=t.total>0;}Bl(){this._l(this.cfg.externalSourcesEmbedCss),this.ap(),this.Vl();}ap(){this.gt?.send({type:"set-theme-definition",theme:ul(this)});}_l(t){this.gt?.send({type:"set-embed-css",css:t});}Vl(){this.gt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}lp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=Ud[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ll(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,o);return d.search=dl(c),d.toString()}np(t,e){this.vr={selectedCount:t,total:e};}Nl(){let t=document.createElement("iframe");t.src=this.lp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Bl.bind(this)),t.addEventListener("load",this.Bl.bind(this)),this.Ne.value&&(this.Ne.value.innerHTML="",this.Ne.value.appendChild(t)),t.contentWindow&&(this.gt?.destroy(),this.gt=new Yr(t.contentWindow,()=>this.cfg.socialBaseUrl),this.gt.on("selected-files-change",this.sp.bind(this)),this.gt.on("toolbar-state-change",this.op.bind(this)),this.zl());}vs(){this.gt?.destroy(),this.gt=void 0,this.Ne.value&&(this.Ne.value.innerHTML=""),this.zl();}zl(){this.us=[],this.ds=false,this.ps=false,this.hs=false,this.ms=false,this.yr=false,this.fs=false,this.gs="uc-hidden",this.vr=null;}disconnectedCallback(){super.disconnectedCallback(),this.vs();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${I(this.Ne)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Fl}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.yr}><span>${this.ip}</span><button type="button" @click=${this.cp} ?hidden=${!this.hs}>${this.l10n("select-all")}</button><button type="button" @click=${this.up} ?hidden=${!this.ms}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Eo} ?disabled=${!this.ps} ?hidden=${!this.fs} ><uc-spinner ?hidden=${this.ds}></uc-spinner><span class=${this.gs}>${this.l10n("done")}</span></button></div></div>`}};p([f()],Tt.prototype,"us",2),p([f()],Tt.prototype,"ds",2),p([f()],Tt.prototype,"ps",2),p([f()],Tt.prototype,"hs",2),p([f()],Tt.prototype,"ms",2),p([f()],Tt.prototype,"yr",2),p([f()],Tt.prototype,"fs",2),p([f()],Tt.prototype,"gs",2),p([f()],Tt.prototype,"Fl",2);var Si=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.yi="upload-file";this.ys=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.yi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ys}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.yi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Si.prototype,"dropzone",2),p([f()],Si.prototype,"yi",2);var Qr=class extends x{constructor(){super(...arguments);this.Hl=tt.generateFastUid();this.dp=t=>{t.currentTarget.hidePopover();};}render(){return v`<button class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Hl} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Hl} class="uc-dropdown-content" popover="auto" @click=${this.dp}>${this.yield("dd-content")}</div>`}};p([f()],Qr.prototype,"Hl",2);var Pd="local",Rd=3,$d=(r,i)=>r==="allwrap"||r==="auto"&&i>Rd,Dd=r=>({"uc-idle":r==="idle","uc-progress":r==="progress","uc-success":r==="success","uc-failed":r==="failed"}),Vt=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this._t=[];this.vt="idle";this.Kl=false;this.kt=null;this.br={success:0,failed:0,progress:0};this.bs=true;this.X=ae(()=>{this.isConnected&&this.pp();},300);this.mp=t=>{if(t.stopPropagation(),this.vt==="progress"){this.uploadCollection.clearAll();return}let{failedEntries:e,successEntries:o}=this.api.getOutputCollectionState();this.hp(this.vt==="failed"?e:o);};this.ys=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-smart-btn"];}get isIdle(){return this.vt==="idle"}get buttonText(){return this.vt==="progress"?this.l10n("header-uploading",{count:this.br.progress}):this.vt==="failed"?this.l10n("header-failed",{count:this.br.failed}):this.vt==="success"?this.l10n("header-succeed",{count:this.br.success}):this.l10n(this.Kl?"upload-files":"upload-file")}pp(){let t=this.api.getOutputCollectionState(),e={totalCount:t.totalCount,failed:t.failedCount,progress:t.uploadingCount,success:t.successCount};this.kt=e.totalCount===1&&e.failed===0&&e.success===1?t.successEntries[0]:null,e.failed>0?this.vt="failed":e.success>0?this.vt="success":e.progress>0?this.vt="progress":this.vt="idle",this.br=e;}hp(t){for(let e of t)e.internalId&&this.uploadCollection.hasItem(e.internalId)&&this.uploadCollection.remove(e.internalId);}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.Kl=t;}),this.subConfigValue("smartBtn",t=>{t?.sourceList&&(this._t=H(t.sourceList).filter(e=>e!==Pd)),t?.mode&&(this.bs=$d(t.mode,this._t.length));}),this.uploadCollection.observeProperties(this.X),this.uploadCollection.observeCollection(this.X);}render(){return v`<uc-drop-area class=${Dt(Dd(this.vt))} .disabled=${!this.dropzone}><div class="uc-drop-area-inner"><button class="uc-start-btn" type="button" @click=${this.ys}>${this.kt?v`<uc-thumb .uid=${this.kt.internalId}></uc-thumb><span>${this.kt.fileInfo.name}</span>`:v`<span>${this.buttonText}</span>`} ${this.yield("")}<uc-icon class="uc-visual-drop-area" name="arrow-down"></uc-icon></button><button ?hidden=${this.isIdle} class="uc-mini-btn uc-close-btn uc-abort-btn" type="button" @click=${this.mp}><uc-icon name="close"></uc-icon></button><uc-dropdown ?hidden=${!this.isIdle||!this.bs}><uc-icon content-for="dd-header-button" name="arrow-dropdown"></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this._t.map(t=>v`<div role="menuitem"><uc-source-btn type=${t}></uc-source-btn></div>`)}</div></uc-dropdown><div ?hidden=${!this.isIdle||this.bs} class="uc-source-list">${this._t.map(t=>v`<uc-source-btn onlyIcon type=${t}></uc-source-btn>`)}</div></div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Vt.prototype,"dropzone",2),p([f()],Vt.prototype,"_t",2),p([f()],Vt.prototype,"vt",2),p([f()],Vt.prototype,"Kl",2),p([f()],Vt.prototype,"kt",2),p([f()],Vt.prototype,"br",2),p([f()],Vt.prototype,"bs",2);var Ai=class extends Wt{constructor(){super();this.headless=false;this.smart=false;this.init$={...this.init$};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}render(){return v` ${super.render()} ${this.smart?v`<uc-smart-btn></uc-smart-btn>`:v`<uc-simple-btn ?hidden=${this.headless||this.smart}></uc-simple-btn>`}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};p([y({type:Boolean})],Ai.prototype,"headless",2),p([y({type:Boolean})],Ai.prototype,"smart",2);var Jr=class extends Wt{constructor(){super();this.jl=false;this.Ut=()=>{if(this.Gl){let t=this.$["*historyBack"];t?.();return}this.ql&&(this.$["*currentActivity"]=T.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Gl(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==T.activities.START_FROM}get ql(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Ts(){return this.getCssData("--cfg-init-activity")||T.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.Ts();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=T.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.jl=this.Gl||this.ql;});}render(){return v` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut} ?hidden=${!this.jl} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};p([f()],Jr.prototype,"jl",2);var ks="active",to="",ue=class extends Wt{constructor(){super();this.Es=false;this.wr=false;this.Tr=to;this.xs=to;this.yi="choose-file";this.Xe=t=>{t.id===T.activities.CLOUD_IMG_EDIT&&(this.Tr=ks),this.$["*currentActivity"]===T.activities.UPLOAD_LIST&&(this.Tr=ks,this.wr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.xs=ks);};this.Ye=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=T.activities.UPLOAD_LIST,this.wr=false),t.id===T.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=T.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Ts(){return this.getCssData("--cfg-init-activity")||T.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.Ts();this.sub("*currentActivity",e=>{e===T.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=T.activities.UPLOAD_LIST,this.xs=to):(this.Tr=to,this.wr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",o=>{e==="grid"?(o?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Es=!o):(this.style.removeProperty("--uc-grid-col"),this.Es=false);});}),this.subConfigValue("multiple",e=>{this.yi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(q.OPEN,this.Xe),this.modalManager?.subscribe(q.CLOSE,this.Ye);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(q.OPEN,this.Xe),this.modalManager?.unsubscribe(q.CLOSE,this.Ye);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.wr} class=${this.xs}><uc-drop-area ?single=${this.Es} initflow clickable tabindex="0" ><span>${this.l10n(this.yi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Tr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};p([f()],ue.prototype,"Es",2),p([f()],ue.prototype,"wr",2),p([f()],ue.prototype,"Tr",2),p([f()],ue.prototype,"xs",2),p([f()],ue.prototype,"yi",2);/*! For license information please see uc-file-uploader-inline.min.js.LEGAL.txt */
8
+ export{T as ActivityBlock,ps as ActivityHeader,mo as BaseComponent,x as Block,kt as BtnUi,N as CameraSource,xs as CloudImageEditor,Gr as CloudImageEditorActivity,nt as CloudImageEditorBlock,Xr as Config,cs as Copyright,Fr as CropFrame,B as Data,ut as DropArea,Qr as Dropdown,zr as EditorAspectRatioButtonControl,Hr as EditorCropButtonControl,ce as EditorFilterControl,Es as EditorFreeformButtonControl,Vr as EditorImageCropper,Ts as EditorImageFader,jr as EditorOperationControl,Kr as EditorScroller,_r as EditorSlider,ft as EditorToolbar,Tt as ExternalSource,Rt as ExternalUploadSource,gs as FileItem,Jr as FileUploaderInline,ue as FileUploaderMinimal,Ai as FileUploaderRegular,Ir as FormInput,fi as Icon,ss as Img,Dr as LineLoaderUi,vi as Modal,q as ModalEvents,It as PACKAGE_NAME,Lt as PACKAGE_VERSION,xi as PresenceToggle,Ke as ProgressBar,yi as ProgressBarCommon,Ge as Select,Si as SimpleBtn,Zt as SliderUi,Vt as SmartBtn,Wt as SolutionBlock,Ce as SourceBtn,bi as SourceList,us as Spinner,hs as StartFrom,We as Thumb,tt as UID,ms as UploadCtxProvider,At as UploadList,z as UploadSource,R as UploaderBlock,Rr as UrlSource,fo as defineComponents,Qs as defineLocale,$l as loadFileUploaderFrom,ni as toKebabCase};