@uploadcare/file-uploader 1.3.0-alpha.3 → 1.3.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/Block.d.ts +0 -3
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +8 -32
- package/package.json +2 -4
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.min.js +4 -4
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
"use strict";var UC=(()=>{var Pe=Object.defineProperty;var Ll=Object.getOwnPropertyDescriptor;var Ml=Object.getOwnPropertyNames;var Ul=Object.getPrototypeOf,Pl=Object.prototype.hasOwnProperty;var Rl=Reflect.get;var Dl=(s,i,t)=>i in s?Pe(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var l=(s,i)=>Pe(s,"name",{value:i,configurable:!0});var Fl=(s,i)=>{for(var t in i)Pe(s,t,{get:i[t],enumerable:!0})},Nl=(s,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Ml(i))!Pl.call(s,r)&&r!==t&&Pe(s,r,{get:()=>i[r],enumerable:!(e=Ll(i,r))||e.enumerable});return s};var Bl=s=>Nl(Pe({},"__esModule",{value:!0}),s);var h=(s,i,t)=>(Dl(s,typeof i!="symbol"?i+"":i,t),t),Lr=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var v=(s,i,t)=>(Lr(s,i,"read from private field"),t?t.call(s):i.get(s)),L=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},F=(s,i,t,e)=>(Lr(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var R=(s,i,t)=>(Lr(s,i,"access private method"),t),Z=(s,i,t)=>Rl(Ul(s),t,i);var vu={};Fl(vu,{ActivityBlock:()=>w,ActivityHeader:()=>Tr,BaseComponent:()=>Pt,Block:()=>x,BtnUi:()=>$e,CameraSource:()=>li,CloudImageEditor:()=>$r,CloudImageEditorActivity:()=>Ar,CloudImageEditorBlock:()=>vt,Config:()=>Zn,Copyright:()=>Sr,CropFrame:()=>ui,Data:()=>I,DropArea:()=>Ce,EditorCropButtonControl:()=>Te,EditorFilterControl:()=>ee,EditorImageCropper:()=>mi,EditorImageFader:()=>Cr,EditorOperationControl:()=>Se,EditorScroller:()=>gi,EditorSlider:()=>di,EditorToolbar:()=>bi,ExternalSource:()=>wi,FileItem:()=>Ee,FileUploaderInline:()=>Ai,FileUploaderMinimal:()=>xi,FileUploaderRegular:()=>Oe,FormInput:()=>Er,Icon:()=>ge,Img:()=>mr,LineLoaderUi:()=>yi,Modal:()=>si,PACKAGE_NAME:()=>Zt,PACKAGE_VERSION:()=>Yt,PresenceToggle:()=>_i,ProgressBar:()=>ci,ProgressBarCommon:()=>ai,PubSub:()=>I,Select:()=>Ci,SimpleBtn:()=>_e,SliderUi:()=>vi,SolutionBlock:()=>mt,SourceBtn:()=>xe,SourceList:()=>gr,StartFrom:()=>ii,Symbiote:()=>Pt,UID:()=>lt,UploadCtxProvider:()=>gl,UploadList:()=>oi,UploaderBlock:()=>k,UrlSource:()=>ni,defineComponents:()=>Ir,defineLocale:()=>us,html:()=>y,loadFileUploaderFrom:()=>Il,toKebabCase:()=>fe});var b=Object.freeze({BIND_ATTR:"bind",ATTR_BIND_PX:"@",SHARED_CTX_PX:"*",PARENT_CTX_PX:"^",NAMED_CTX_SPLTR:"/",COMPUTED_PX:"+",CSS_DATA_PX:"--",CTX_NAME_ATTR:"ctx",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx",EL_REF_ATTR:"ref",AUTO_TAG_PX:"sym",LIST_ATTR:"itemize",LIST_ITEM_TAG_ATTR:"item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL_ATTR:"use-template",DEFAULT_SLOT_KEY:"__default__",TEXT_NODE_SKIP_ATTR:"skip-text-nodes",TEXT_NODE_OPEN_TOKEN:"{{",TEXT_NODE_CLOSE_TOKEN:"}}"});function zl(s){let i=l(t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}},"clone");return i(s)}l(zl,"cloneObj");var re,se,Ot,Lt,ie,Ei,Eo,H=class H{constructor(i){L(this,re,void 0);L(this,se,void 0);L(this,Ot,void 0);i.constructor===Object?this.store=zl(i):(F(this,Ot,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var t,e;if(!v(this,Ot)&&!this.store.hasOwnProperty(i))return R(t=H,Lt,ie).call(t,"read",i),null;if(typeof i=="string"&&i.startsWith(b.COMPUTED_PX)){let r=this.store[i];if((r==null?void 0:r.constructor)!==Function){R(e=H,Lt,ie).call(e,"compute",i);return}this.__computedMap||(this.__computedMap={});let o=r();return Object.keys(this.__computedMap).includes(i)||(this.__computedMap[i]=o,this.notify(i)),o}else return this.store[i]}has(i){return v(this,Ot)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,t,e=!1){!e&&Object.keys(this.store).includes(i)||(this.store[i]=t,this.notify(i))}pub(i,t){var e,r;if(!v(this,Ot)&&!this.store.hasOwnProperty(i)){R(e=H,Lt,ie).call(e,"publish",i);return}if(i!=null&&i.startsWith(b.COMPUTED_PX)&&t.constructor!==Function){R(r=H,Lt,ie).call(r,"publish computed",i);return}!(this.store[i]===null||t===null)&&typeof this.store[i]!=typeof t&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof t}]`),this.store[i]=t,this.notify(i)}get proxy(){if(!v(this,se)){let i=Object.create(null);F(this,se,new Proxy(i,{set:(t,e,r)=>(this.pub(e,r),!0),get:(t,e)=>{this.read(e)}}))}return v(this,se)}multiPub(i){for(let t in i)this.pub(t,i[t])}notify(i){var e;let t=i==null?void 0:i.startsWith(b.COMPUTED_PX);if(this.callbackMap[i]){let r=this.read(i);this.callbackMap[i].forEach(o=>{o(r)}),t&&(this.__computedMap[i]=r)}!t&&R(e=H,Ei,Eo).call(e,this,i)}sub(i,t,e=!0){var r;return!v(this,Ot)&&!this.store.hasOwnProperty(i)?(R(r=H,Lt,ie).call(r,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(t),e&&t(this.read(i)),{remove:()=>{this.callbackMap[i].delete(t),this.callbackMap[i].size||delete this.callbackMap[i]},callback:t})}set uid(i){!v(this,re)&&F(this,re,i)}get uid(){return v(this,re)}static registerCtx(i,t=Symbol()){let e=H.globalStore.get(t);return e?console.warn('PubSub: context UID "'+t+'" is already in use'):(e=new H(i),e.uid=t,H.globalStore.set(t,e)),e}static deleteCtx(i){H.globalStore.delete(i)}static getCtx(i,t=!0){return H.globalStore.get(i)||(t&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};re=new WeakMap,se=new WeakMap,Ot=new WeakMap,Lt=new WeakSet,ie=l(function(i,t){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+t)},"#warn"),Ei=new WeakSet,Eo=l(function(i,t){this.globalStore.forEach(e=>{e.__computedMap&&Object.keys(e.__computedMap).forEach(r=>{if(e===i&&t===r)return;let o=`__${r}_timeout`;e[o]&&window.clearTimeout(e[o]),e[o]=window.setTimeout(()=>{let n=e.read(r);n!==e.__computedMap[r]&&(e.__computedMap[r]=n,e.notify(r))})})})},"#processComputed"),L(H,Lt),L(H,Ei),l(H,"PubSub");var I=H;I.globalStore=new Map;var xt=I;var To="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Vl=To.length-1,Mr=class Mr{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:To.charAt(Math.random()*Vl);return t}};l(Mr,"UID");var lt=Mr;function Re(s,i,t){let e=!0,r,o=i.split(".");return o.forEach((n,a)=>{a<o.length-1?s=s[n]:r=n}),s?s[r]=t:e=!1,e}l(Re,"setNestedProp");function Ur(s){let i;return s.constructor===CSSStyleSheet?i=s:s.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(s)),i}l(Ur,"prepareStyleSheet");function So(s,i){[...s.querySelectorAll(`[${b.LIST_ATTR}]`)].filter(t=>!t.matches(`[${b.LIST_ATTR}] [${b.LIST_ATTR}]`)).forEach(t=>{var n,a;let e=t.getAttribute(b.LIST_ITEM_TAG_ATTR),r;for(e&&(r=window.customElements.get(e)),r||(r=(n=class extends i.Symbiote{constructor(){super(),e||(this.style.display="contents")}},l(n,"itemClass"),n),r.template=((a=t.querySelector("template"))==null?void 0:a.innerHTML)||t.innerHTML,r.reg(e));t.firstChild;)t.firstChild.remove();let o=t.getAttribute(b.LIST_ATTR);i.sub(o,c=>{if(!c){for(;t.firstChild;)t.firstChild.remove();return}let u=[...t.children],p,d=l(f=>{f.forEach((m,_)=>{if(u[_])if(u[_].set$)u[_].set$(m);else for(let C in m)u[_][C]=m[C];else{p||(p=new DocumentFragment);let C=new r;Object.assign((C==null?void 0:C.init$)||C,m),p.appendChild(C)}}),p&&t.appendChild(p);let g=u.slice(f.length,u.length);for(let m of g)m.remove()},"fillItems");if(c.constructor===Array)d(c);else if(c.constructor===Object){let f=[];for(let g in c){let m=c[g];Object.defineProperty(m,"_KEY_",{value:g,enumerable:!0}),f.push(m)}d(f)}else console.warn("Symbiote list data type error:"),console.log(c)}),t.removeAttribute(b.LIST_ATTR),t.removeAttribute(b.LIST_ITEM_TAG_ATTR)})}l(So,"itemizeProcessor");function jl(s,i){[...s.querySelectorAll(`[${b.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(b.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(b.EL_REF_ATTR)})}l(jl,"refProcessor");function Hl(s,i){[...s.querySelectorAll(`[${b.BIND_ATTR}]`)].forEach(t=>{t.getAttribute(b.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(p=>p.trim()),a=n[0],c;a.indexOf(b.ATTR_BIND_PX)===0&&(c=!0,a=a.replace(b.ATTR_BIND_PX,""));let u=n[1].split(",").map(p=>p.trim());for(let p of u){let d;p.startsWith("!!")?(d="double",p=p.replace("!!","")):p.startsWith("!")&&(d="single",p=p.replace("!","")),!i.has(p)&&i.allowTemplateInits&&(p.startsWith(b.ATTR_BIND_PX)?i.add(p,i.getAttribute(p.replace(b.ATTR_BIND_PX,""))):i.add(p,null)),i.sub(p,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):Re(t,a,f)||(t[b.SET_LATER_KEY]||(t[b.SET_LATER_KEY]=Object.create(null)),t[b.SET_LATER_KEY][a]=f)},!(i.ssrMode&&(a==="textContent"||c)))}}),t.removeAttribute(b.BIND_ATTR)})}l(Hl,"domBindProcessor");function Gl(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var o;return!((o=r.parentElement)!=null&&o.hasAttribute(b.TEXT_NODE_SKIP_ATTR))&&r.textContent.includes(b.TEXT_NODE_OPEN_TOKEN)&&r.textContent.includes(b.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=e.nextNode();)t.push(i);return t}l(Gl,"getTextNodesWithTokens");var Xl=l(function(s,i){Gl(s).forEach(e=>{let r=[],o;for(;e.textContent.includes(b.TEXT_NODE_CLOSE_TOKEN);)e.textContent.startsWith(b.TEXT_NODE_OPEN_TOKEN)?(o=e.textContent.indexOf(b.TEXT_NODE_CLOSE_TOKEN)+b.TEXT_NODE_CLOSE_TOKEN.length,e.splitText(o),r.push(e)):(o=e.textContent.indexOf(b.TEXT_NODE_OPEN_TOKEN),e.splitText(o)),e=e.nextSibling;r.forEach(n=>{let a=n.textContent.replace(b.TEXT_NODE_OPEN_TOKEN,"").replace(b.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(a)&&i.allowTemplateInits&&(a.startsWith(b.ATTR_BIND_PX)?(i.add(a,i.getAttribute(a.replace(b.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(a,null)),i.sub(a,c=>{n.textContent=c})})})},"txtNodesProcessor"),ko=[So,jl,Hl,Xl];var Ti="'",oe='"',Wl=/\\([0-9a-fA-F]{1,6} ?)/g;function Kl(s){return(s[0]===oe||s[0]===Ti)&&(s[s.length-1]===oe||s[s.length-1]===Ti)}l(Kl,"hasLeadingTrailingQuotes");function ql(s){return(s[0]===oe||s[0]===Ti)&&(s=s.slice(1)),(s[s.length-1]===oe||s[s.length-1]===Ti)&&(s=s.slice(0,-1)),s}l(ql,"trimQuotes");function Zl(s){let i="",t="";for(var e=0;e<s.length;e++){let r=s[e+1];s[e]==="\\"&&r==='"'?(i+='\\"',e++):s[e]==='"'&&t!=="\\"?i+='\\"':i+=s[e],t=s[e]}return i}l(Zl,"escapeQuotes");function $o(s){let i=s;Kl(s)&&(i=ql(i),i=i.replace(Wl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
|
|
27
|
-
`,"\\n"),i=Zl(i),i=oe+i+oe);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}l(
|
|
28
|
-
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,r){var n;if(e===r)return;let o=(n=v(this,N).__attrDesc)==null?void 0:n[t];o?v(this,Ne)?this.$[o]=r:this.init$[o]=r:this[t]=r}getCssData(t,e=!1){if(v(this,pt)||F(this,pt,Object.create(null)),!Object.keys(v(this,pt)).includes(t)){v(this,Xt)||F(this,Xt,window.getComputedStyle(this));let r=v(this,Xt).getPropertyValue(t).trim();try{v(this,pt)[t]
|
|
29
|
-
`))}}return i}l(jo,"operationsToTransformations");var U=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Y=[U.CROP,U.TUNING,U.FILTERS],Ho=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Go=["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"],Xo=["rotate","mirror","flip"],ft=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var Wo=l(s=>s?s.split(",").map(i=>i.trim()):[],"deserealizeCsv"),le=l(s=>s?s.join(","):"","serializeCsv");var ia="https://ucarecdn.com",ra="https://upload.uploadcare.com",sa="https://social.uploadcare.com",ct={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:le(Y),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:ia,baseUrl:ra,socialBaseUrl:sa,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var O=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"}),Br=class Br{constructor(i){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,t){var e;for(let r of this._targets)r.dispatchEvent(new CustomEvent(i,{detail:t}));(e=this._debugPrint)==null||e.call(this,()=>{let r=t&&typeof t=="object"?{...t}:t;return[`event "${i}"`,r]})}emit(i,t,{debounce:e}={}){if(typeof e!="number"&&!e){this._dispatch(i,typeof t=="function"?t():t);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let r=typeof e=="number"?e:20,o=window.setTimeout(()=>{this._dispatch(i,typeof t=="function"?t():t),this._timeoutStore.delete(i)},r);this._timeoutStore.set(i,o)}};l(Br,"EventEmitter");var Ri=Br;function P(s,i){let t,e=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)},"debounced");return e.cancel=()=>{clearTimeout(t)},e}l(P,"debounce");var Ko="--uploadcare-blocks-window-height",je=class je{static registerClient(i){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(i)}static unregisterClient(i){this.clientsRegistry.delete(i),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Ko)}};l(je,"WindowHeightTracker"),h(je,"clientsRegistry",new Set),h(je,"flush",P(()=>{document.documentElement.style.setProperty(Ko,`${window.innerHeight}px`)},100));var He=je;var qo=l(s=>{var e;let i=new Intl.Locale(s),t="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?t=i.getTextInfo().direction:"textInfo"in i&&((e=i.textInfo)!=null&&e.direction)&&(t=i.textInfo.direction),t},"getLocaleDirection");var Di=l((s,i)=>new Intl.PluralRules(s).select(i),"getPluralForm");var oa=l(s=>s,"DEFAULT_TRANSFORMER"),zr="{{",Yo="}}",Zo="plural:";function Ge(s,i,t={}){var n;let{openToken:e=zr,closeToken:r=Yo,transform:o=oa}=t;for(let a in i){let c=(n=i[a])==null?void 0:n.toString();s=s.replaceAll(e+a+r,typeof c=="string"?o(c):c)}return s}l(Ge,"applyTemplateData");function Jo(s){let i=[],t=s.indexOf(zr);for(;t!==-1;){let e=s.indexOf(Yo,t),r=s.substring(t+2,e);if(r.startsWith(Zo)){let o=s.substring(t+2,e).replace(Zo,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a})}t=s.indexOf(zr,e)}return i}l(Jo,"getPluralObjects");function Fi(){let s,i,t=new Promise((e,r)=>{s=e,i=r});return{resolve:s,reject:i,promise:t}}l(Fi,"withResolvers");var Vr=l(async({element:s,attribute:i,timeout:t=300})=>{let{promise:e,resolve:r}=Fi(),o=s.getAttribute(i);if(o!==null)return r({success:!0,value:o,attribute:i}),e;let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[i]});let a=setTimeout(()=>{n.disconnect(),r({success:!1,attribute:i})},t),c=l(u=>{let p=s.getAttribute(i);u.type==="attributes"&&u.attributeName===i&&p!==null&&(clearTimeout(a),n.disconnect(),r({success:!0,value:p,attribute:i}))},"handleMutation");return e},"waitForAttribute");function Qo(s){return Object.prototype.toString.call(s)==="[object Object]"}l(Qo,"isObject");var na=/\W|_/g;function la(s){return s.split(na).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}l(la,"camelizeString");function tn(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>kt(t,{ignoreKeys:i})):s}l(tn,"camelizeArrayItems");function kt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return tn(s,{ignoreKeys:i});if(!Qo(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}Qo(r)?r=kt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=tn(r,{ignoreKeys:i})),t[la(e)]=r}return t}l(kt,"camelizeKeys");var aa=l(s=>new Promise(i=>setTimeout(i,s)),"delay");function qr({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:o,integration:r});let n=[s,i,e].filter(Boolean).join("/"),a=[o,r].filter(Boolean).join("; ");return`${n} (${a})`}l(qr,"getUserAgent$1");var ca={factor:2,time:100};function ua(s,i=ca){let t=0;function e(r){let o=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l(a=>aa(a!=null?a:o).then(()=>(t+=1,e(r))),"retry")})}return l(e,"runAttempt"),e(s)}l(ua,"retrier");var es=class es extends Error{};l(es,"UploadcareError");var Xe=es,Bi=class Bi extends Xe{constructor(t){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,Bi.prototype),this.originalProgressEvent=t}};l(Bi,"NetworkError");var ae=Bi,ji=l((s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},"onCancel"),zi=class zi extends Xe{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,zi.prototype)}};l(zi,"CancelError");var Ft=zi,ha=500,rn=l(({check:s,interval:i=ha,timeout:t,signal:e})=>new Promise((r,o)=>{let n,a;ji(e,()=>{n&&clearTimeout(n),o(new Ft("Poll cancelled"))}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new Ft("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(e)).then(u=>{u?(a&&clearTimeout(a),r(u)):n=setTimeout(c,i)}).catch(u=>{a&&clearTimeout(a),o(u)})}catch(u){a&&clearTimeout(a),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),$={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},Hi="application/octet-stream",sn="original",Nt=l(({method:s,url:i,data:t,headers:e={},signal:r,onProgress:o})=>new Promise((n,a)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,i,!0),e&&Object.entries(e).forEach(d=>{let[f,g]=d;typeof g!="undefined"&&!Array.isArray(g)&&c.setRequestHeader(f,g)}),c.responseType="text",ji(r,()=>{p=!0,c.abort(),a(new Ft)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function(C){let E=C.split(": "),A=E.shift(),T=E.join(": ");A&&typeof A!="undefined"&&(g[A]=T)});let m=c.response,_=c.status;n({request:d,data:m,headers:g,status:_})}},c.onerror=d=>{p||a(new ae(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),t?c.send(t):c.send()}),"request");function da(s,...i){return s}l(da,"identity");var pa=l(({name:s})=>s?[s]:[],"getFileOptions"),fa=da,ma=l(()=>new FormData,"getFormData"),on=l(s=>!1,"isBuffer"),Gi=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),Xi=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),Wi=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),ce=l(s=>Gi(s)||Xi(s)||on()||Wi(s),"isFileData"),ga=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),ba=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),ya=l(s=>!!s&&typeof s=="object"&&"data"in s&&ce(s.data),"isFileValue");function nn(s,i,t){if(Array.isArray(t))for(let e of t)nn(s,`${i}[]`,e);else if(ya(t)){let{name:e,contentType:r}=t,o=fa(t.data,e,r!=null?r:Hi),n=pa({name:e,contentType:r});s.push([i,o,...n])}else if(ba(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else ga(t)&&t&&s.push([i,t.toString()])}l(nn,"collectParams");function _a(s){let i=[];for(let[t,e]of Object.entries(s))nn(i,t,e);return i}l(_a,"getFormDataParams");function Ki(s){let i=ma(),t=_a(s);for(let e of t){let[r,o,...n]=e;i.append(r,o,...n)}return i}l(Ki,"buildFormData");var Vi=class Vi extends Xe{constructor(t,e,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=t,this.code=e,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,Vi.prototype)}};l(Vi,"UploadError");var W=Vi,va=l(s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var o;return(o=r[1])!=null?o:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Tt=l((s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=va(t)),e.toString()},"getUrl"),wa="6.14.1",Ca="UploadcareUploadClient",xa=wa;function Kt(s){return qr({libraryName:Ca,libraryVersion:xa,...s})}l(Kt,"getUserAgent");var Aa="RequestThrottledError",en=15e3,Ea=1e3;function Ta(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return en;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:en}l(Ta,"getTimeoutFromThrottledRequest");function Bt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return ua(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===Aa&&r<t)return o(Ta(n));if(n instanceof ae&&r<e)return o((r+1)*Ea);throw n}))}l(Bt,"retryIfFailed");var ln=l(s=>{let i="";return(Gi(s)||Xi(s)||Wi(s))&&(i=s.type),i||Hi},"getContentType"),an=l(s=>{let i="";return Xi(s)&&s.name?i=s.name:Gi(s)||on()?i="":Wi(s)&&s.name&&(i=s.name),i||sn},"getFileName");function Zr(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(Zr,"getStoreValue");function Sa(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=$.baseURL,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",url:Tt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},data:Ki({signature:o,expire:n,file:{data:s,name:t||an(s),contentType:e||ln(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Zr(a),source:p,metadata:_}),signal:c,onProgress:u}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(Sa,"base");var Gr;(function(s){s.Token="token",s.FileInfo="file_info"})(Gr||(Gr={}));function ka(s,{publicKey:i,baseURL:t=$.baseURL,store:e,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},url:Tt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Zr(e),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:c,source:u,metadata:_}),signal:p}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(ka,"fromUrl");var J;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(J||(J={}));var $a=l(s=>"status"in s&&s.status===J.Error,"isErrorResponse");function Ia(s,{publicKey:i,baseURL:t=$.baseURL,signal:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=$.retryNetworkErrorMaxTimes}={}){return Bt(()=>Nt({method:"GET",headers:i?{"X-UC-User-Agent":Kt({publicKey:i,integration:r,userAgent:o})}:void 0,url:Tt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=kt(JSON.parse(c));if("error"in d&&!$a(d))throw new W(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}l(Ia,"fromUrlStatus");function Oa(s,{publicKey:i,baseURL:t=$.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:o,signal:n,source:a,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"POST",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:c,userAgent:u})},url:Tt(t,"/group/",{jsonerrors:1}),data:Ki({files:s,callback:e,pub_key:i,signature:r,expire:o,source:a}),signal:n}).then(({data:f,headers:g,request:m})=>{let _=kt(JSON.parse(f));if("error"in _)throw new W(_.error.content,_.error.errorCode,m,_,g);return _}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}l(Oa,"group");function cn(s,{publicKey:i,baseURL:t=$.baseURL,signal:e,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"GET",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:o,userAgent:n})},url:Tt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=kt(JSON.parse(u));if("error"in f)throw new W(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(cn,"info");function La(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=$.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",url:Tt(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},data:Ki({filename:e||sn,size:s,content_type:t||Hi,part_size:r,UPLOADCARE_STORE:Zr(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:p,metadata:_}),signal:u}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T.parts=Object.keys(T.parts).map(B=>T.parts[Number(B)]),T}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})}l(La,"multipartStart");function Ma(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:o=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||Hi}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}l(Ma,"multipartUpload");function Ua(s,{publicKey:i,baseURL:t=$.baseURL,source:e="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"POST",url:Tt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:o,userAgent:n})},data:Ki({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=kt(JSON.parse(u));if("error"in f)throw new W(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Ua,"multipartComplete");function Yr(s,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:c,onProgress:u}){return rn({check:p=>cn(s,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}l(Yr,"isReadyPoll");function Pa(s){return"defaultEffects"in s}l(Pa,"isGroupFileInfo");var is=class is{constructor(i,{baseCDN:t=$.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:o}=i,n=Tt(t,`${r}/`),a=o?Tt(`https://${o}.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=o||null,this.s3Url=a,Pa(i)&&(this.defaultEffects=i.defaultEffects)}};l(is,"UploadcareFile");var St=is,Ra=l((s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,contentType:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,baseCDN:_,metadata:C})=>Sa(s,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:C}).then(({file:E})=>Yr(E,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(E=>new St(E,{baseCDN:_})),"uploadDirect"),Da=l((s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:o,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>cn(s,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new St(f,{baseCDN:d,fileName:t})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),Fa=l((s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),o=l(n=>()=>{e=n,r.forEach((a,c)=>c!==n&&a.abort())},"createStopRaceCallback");return ji(i,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,a)=>{let c=o(a);return Promise.resolve().then(()=>n({stopRace:c,signal:r[a].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Na=window.WebSocket,rs=class rs{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(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]=[]}};l(rs,"Events");var Xr=rs,Ba=l((s,i)=>s==="success"?{status:J.Success,...i}:s==="progress"?{status:J.Progress,...i}:{status:J.Error,...i},"response"),ss=class ss{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new Xr);h(this,"disconnectTimeoutId",null);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 Na(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,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,Ba(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.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)}};l(ss,"Pusher");var Wr=ss,jr=null,Jr=l(s=>{if(!jr){let i=typeof window=="undefined"?0:3e4;jr=new Wr(s,i)}return jr},"getPusher"),za=l(s=>{Jr(s).connect()},"preconnect");function Va({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:c}){return rn({check:u=>Ia(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case J.Error:return new W(p.error,p.errorCode);case J.Waiting:return!1;case J.Unknown:return new W(`Token "${s}" was not found.`);case J.Progress:return a&&(p.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:p.done/p.total})),!1;case J.Success:return a&&a({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}l(Va,"pollStrategy");var ja=l(({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,o)=>{let n=Jr(i),a=n.onError(o),c=l(()=>{a(),n.unsubscribe(s)},"destroy");ji(t,()=>{c(),o(new Ft("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case J.Progress:{e&&(u.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:u.done/u.total}));break}case J.Success:{c(),e&&e({isComputable:!0,value:u.done/u.total}),r(u);break}case J.Error:c(),o(new W(u.msg,u.error_code))}})}),"pushStrategy"),Ha=l((s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,pusherKey:C=$.pusherKey,metadata:E})=>Promise.resolve(za(C)).then(()=>ka(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,metadata:E})).catch(A=>{let T=Jr(C);return T==null||T.disconnect(),Promise.reject(A)}).then(A=>A.type===Gr.FileInfo?A:Fa([({signal:T})=>Va({token:A.token,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:d,signal:T}),({signal:T})=>ja({token:A.token,pusherKey:C,signal:T,onProgress:d})],{signal:p})).then(A=>{if(A instanceof W)throw A;return A}).then(A=>Yr(A.uuid,{publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:d,signal:p})).then(A=>new St(A,{baseCDN:r})),"uploadFromUrl"),Hr=new WeakMap,Ga=l(async s=>{if(Hr.has(s))return Hr.get(s);let i=await fetch(s.uri).then(t=>t.blob());return Hr.set(s,i),i},"getBlobFromReactNativeAsset"),un=l(async s=>{if(Xi(s)||Gi(s))return s.size;if(Wi(s))return(await Ga(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Xa=l((s,i=$.multipartMinFileSize)=>s>=i,"isMultipart"),hn=l(s=>{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!ce(s)&&t.test(s)},"isUuid"),Qr=l(s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ce(s)&&t.test(s)},"isUrl"),Wa=l((s,i)=>new Promise((t,e)=>{let r=[],o=!1,n=i.length,a=[...i],c=l(()=>{let u=i.length-a.length,p=a.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():t(r))}).catch(d=>{o=!0,e(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),Ka=l((s,i,t,e)=>{let r=e*i,o=Math.min(r+e,t);return s.slice(r,o)},"sliceChunk"),qa=l(async(s,i,t)=>e=>Ka(s,e,i,t),"prepareChunks"),Za=l((s,i,{publicKey:t,contentType:e,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>Ma(s,i,{publicKey:t,contentType:e,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),Ya=l(async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,contentType:_,multipartChunkSize:C=$.multipartChunkSize,maxConcurrentRequests:E=$.maxConcurrentRequests,baseCDN:A,metadata:T})=>{let B=e!=null?e:await un(s),rt,ht=l((z,q)=>{if(!u)return;rt||(rt=Array(z).fill(0));let nt=l(dt=>dt.reduce((Ct,Or)=>Ct+Or,0),"sum");return dt=>{dt.isComputable&&(rt[q]=dt.value,u({isComputable:!0,value:nt(rt)/z}))}},"createProgressHandler");return _||(_=ln(s)),La(B,{publicKey:i,contentType:_,fileName:t||an(s),baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:T}).then(async({uuid:z,parts:q})=>{let nt=await qa(s,B,C);return Promise.all([z,Wa(E,q.map((dt,Ct)=>()=>Za(nt(Ct),dt,{publicKey:i,contentType:_,onProgress:ht(q.length,Ct),signal:c,integration:d,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})))])}).then(([z])=>Ua(z,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})).then(z=>z.isReady?z:Yr(z.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(z=>new St(z,{baseCDN:A}))},"uploadMultipart");async function ts(s,{publicKey:i,fileName:t,baseURL:e=$.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartMinFileSize:_,multipartChunkSize:C,maxConcurrentRequests:E,baseCDN:A=$.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:B,pusherKey:rt,metadata:ht}){if(ce(s)){let z=await un(s);return Xa(z,_)?Ya(s,{publicKey:i,contentType:m,multipartChunkSize:C,fileSize:z,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A,metadata:ht}):Ra(s,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A,metadata:ht})}if(Qr(s))return Ha(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:B,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,pusherKey:rt,metadata:ht});if(hn(s))return Da(s,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A});throw new TypeError(`File uploading from "${s}" is not supported`)}l(ts,"uploadFile");var os=class os{constructor(i,{baseCDN:t=$.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,o)=>r+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new St(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}};l(os,"UploadcareGroup");var Kr=os,Ja=l(s=>{for(let i of s)if(!ce(i))return!1;return!0},"isFileDataArray"),Qa=l(s=>{for(let i of s)if(!hn(i))return!1;return!0},"isUuidArray"),tc=l(s=>{for(let i of s)if(!Qr(i))return!1;return!0},"isUrlArray");function dn(s,{publicKey:i,fileName:t,baseURL:e=$.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_=$.multipartChunkSize,baseCDN:C=$.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:A,jsonpCallback:T}){if(!Ja(s)&&!tc(s)&&!Qa(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let B,rt=!0,ht=s.length,z=l((q,nt)=>{if(!c)return;B||(B=Array(q).fill(0));let dt=l(Ct=>Ct.reduce((Or,Ol)=>Or+Ol)/q,"normalize");return Ct=>{if(!Ct.isComputable||!rt){rt=!1,c({isComputable:!1});return}B[nt]=Ct.value,c({isComputable:!0,value:dt(B)})}},"createProgressHandler");return Promise.all(s.map((q,nt)=>ce(q)||Qr(q)?ts(q,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:z(ht,nt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_,baseCDN:C,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:A}).then(dt=>dt.uuid):q)).then(q=>Oa(q,{publicKey:i,baseURL:e,jsonpCallback:T,secureSignature:r,secureExpire:o,signal:a,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(nt=>new Kr(nt,{baseCDN:C})).then(nt=>(c&&c({isComputable:!0,value:1}),nt)))}l(dn,"uploadFileGroup");var ns=class ns{constructor(i){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t<i;t++){let e=this._pending.shift();if(!e)return;let r=this._resolvers.get(e),o=this._rejectors.get(e);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,e().finally(()=>{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(n=>r(n)).catch(n=>o(n))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};l(ns,"Queue");var Ni=ns;var ls=l(()=>({}),"blockCtx"),as=l(s=>({...ls(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),qi=l(s=>({...as(s),"*commonProgress":0,"*uploadList":[],"*focusedEntry":null,"*uploadQueue":new Ni(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var We={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"Selected:","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-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","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 ocurred. 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 button","file-item-remove-button":"Remove button"};var Zi=new Map,cs=new Map,pn=l((s,i)=>{Zi.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Zi.set(s,{...We,...i})},"defineLocaleSync"),ec=l((s,i)=>{cs.set(s,i)},"defineLocaleAsync"),us=l((s,i)=>{typeof i=="function"?ec(s,i):pn(s,i)},"defineLocale"),fn=l(async s=>{if(!Zi.has(s)){if(!cs.has(s))throw new Error(`Locale ${s} is not defined`);let t=await cs.get(s)();pn(s,t)}return Zi.get(s)},"resolveLocaleDefinition");us("en",We);var $t=l(s=>`*l10n/${s}`,"localeStateKey"),ic="en",hs=class hs{constructor(i){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[t,e]of Object.entries(We))this._blockInstance.add($t(t),e,!1);setTimeout(()=>{i.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let e=await fn(t);if(t!==ic&&this._localeName!==t)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,a]of Object.entries(e)){let c=r==null?void 0:r[n];this._blockInstance.add($t(n),c!=null?c:a,!0);for(let u of this._callbacks)u()}}),i.subConfigValue("localeDefinitionOverride",t=>{var r;if(!t)return;let e=t[this._localeName];if(e)for(let[o,n]of Object.entries(e)){(r=this._blockInstance)==null||r.add($t(o),n,!0);for(let a of this._callbacks)a()}})})}onLocaleChange(i){let t=P(i,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(i,t,e){var o,n,a;i.$[t]=e(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(t))==null||n();let r=this.onLocaleChange(()=>{i.$[t]=e()});(a=this._boundBlocks.get(i))==null||a.set(t,r)}destroyL10nBindings(i){let t=this._boundBlocks.get(i);if(t){for(let e of t.values())e();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};l(hs,"LocaleManager");var Yi=hs;var rc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ke(s,i){i.tabIndex=0,i.focus(),s.tabIndex=-1}l(Ke,"focus");function ds(s){let i=s.role||s.type||s.tagName;if(!i)return null;let t=rc[i.toLowerCase()];if(!t)return null;for(let e of t){let r=s.closest(`[role=${e}]`);if(r)return r}}l(ds,"findGroupNodeByEventTarget");function ps(s,i){return i.role==="toolbar"?sc(i):i.querySelectorAll(`[role=${s.role}]`)}l(ps,"getItems");function sc(s){return[...s.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}l(sc,"getToolbarItems");function oc(s){let i=s.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let t=s.role;return t==="menubar"||t==="tablist"||t==="toolbar"}l(oc,"isHorizontalOrientation");function mn(s){return i=>{let t=!1,e=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=ds(d.target);if(!f){a();return}let g=ps(d.target,f),m=Array.from(g).indexOf(d.target),_="ArrowDown",C="ArrowUp";if(oc(f)&&(i.document.dir==="rtl"?(_="ArrowLeft",C="ArrowRight"):(_="ArrowRight",C="ArrowLeft")),d.key===_)d.preventDefault(),Ke(d.target,g[m+1]||g[0]);else if(d.key===C)d.preventDefault(),Ke(d.target,g[m-1]||g[g.length-1]);else if(d.key==="Home")d.preventDefault(),Ke(d.target,g[0]);else if(d.key==="End")d.preventDefault(),Ke(d.target,g[g.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let E=Date.now();E-r<=e?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=E;let A=Array.from(g).find(T=>{var B,rt,ht;return(ht=(rt=(B=T.textContent)==null?void 0:B.trim())==null?void 0:rt.toLowerCase())==null?void 0:ht.startsWith(o)});A&&(d.preventDefault(),Ke(d.target,A))}}l(n,"keyDown");function a(){t=!1,i.removeEventListener("keydown",n)}l(a,"stop");function c(d){let f=ds(d.target);if(f){t||(t=!0,i.addEventListener("keydown",n));let g=ps(d.target,f);for(let m of g)m!==d.target&&m.setAttribute("tabindex",-1)}else t&&a()}l(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&a()}l(u,"focusOut");function p(d){let f=ds(d.target);if(f){let g=ps(d.target,f);for(let m of g)m!==d.target&&m.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return l(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{a(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u)}}}l(mn,"focusGroupKeyUX");function gn(){return s=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=!1);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0)}}l(e,"jump");function r(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=!0),i=null)}return l(r,"focusOut"),s.addEventListener("keyuxJump",e),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",e),s.removeEventListener("focusout",r)}}}l(gn,"hiddenKeyUX");function bn(){return s=>{let i=[];function t(u){let p=s.document.activeElement;p&&p!==s.document.body&&i.push(new WeakRef(p)),u.focus({focusVisible:!0})}l(t,"focus");function e(){let u=i.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():e()}l(e,"back");let r=0,o;function n(u){clearInterval(o);let p=u.getAttribute("aria-controls");p&&(o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(p);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:!0})),t(f))}},50))}l(n,"jump");function a(u){u.clientX===0&&u.clientY===0&&n(u.target)}l(a,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&e()}return l(c,"keyDown"),s.addEventListener("click",a),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",a),s.removeEventListener("keydown",c)}}}l(bn,"jumpKeyUX");function yn(s){let i,t=s.split(" ");function e(){i&&i.classList.remove(...t)}l(e,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(e(),o.target.classList.add(...t),i=o.target)}return l(r,"click"),o=>(o.addEventListener("keyup",e),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",e),o.removeEventListener("click",r)})}l(yn,"pressKeyUX");function _n(s,i){let t=i.map(e=>e(s));return()=>{t.forEach(e=>e())}}l(_n,"startKeyUX");var ms=class ms{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(i,t){let e=l(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&t(r)},"wrappedListener");this._listeners.set(t,e),window.addEventListener(i,e)}removeEventListener(i,t){let e=this._listeners.get(t);e&&window.removeEventListener(i,e),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._scope.push(i)}destroy(){this._scope=[],this._listeners.forEach((i,t)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(t)})}};l(ms,"ScopedMinimalWindow");var fs=ms,gs=class gs{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new fs,this._destroyKeyUX=_n(this._scopedWindow,[mn(),yn("is-pressed"),bn(),gn()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};l(gs,"A11y");var Ji=gs;function vn(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n");if(!e)return;let r="textContent",o=!1;if(e.includes(":")){let c=e.split(":");r=c[0],e=c[1],r.startsWith("@")&&(r=r.slice(1),o=!0)}let n=e;i.has(n)&&i.sub(n,c=>{if(!c)return;i.l10nProcessorSubs.has(n)||i.l10nProcessorSubs.set(n,new Set);let u=i.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),i.allSubs.delete(f)});let p=$t(c).replace("*","");i.sharedCtx.has(p)||i.sharedCtx.add(p,c);let d=i.sharedCtx.sub(p,()=>{t[r]=i.l10n(c)});u==null||u.add(d),i.allSubs.add(d),t.removeAttribute("l10n")});let a=$t(e);i.has(a)||i.add(a,""),i.sub(a,()=>{e=e,o?t.setAttribute(r,i.l10n(e)):t[r]=i.l10n(e)}),t.removeAttribute("l10n")})}l(vn,"l10nProcessor");var Q=l(s=>`*cfg/${s}`,"sharedConfigKey");var bs="set";function wn(s){[...s.querySelectorAll(`[${bs}]`)].forEach(i=>{let t=i.getAttribute(bs);t&&(i.removeAttribute(bs),i.setAttribute(b.BIND_ATTR,t))})}l(wn,"bindCompatibilityFallbackProcessor");var nc="uc-",Qi="ctx-name",qe=class qe extends Pt{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",ls());h(this,"_readyResolvers",Fi());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(vn),this.addTemplateProcessor(Po),this.tplProcessors=new Set([wn,...this.tplProcessors])}l10n(t,e={}){if(!t)return"";let r=this.$[$t(t)]||t,o=Jo(r);for(let a of o)e[a.variable]=this.pluralize(a.pluralKey,Number(e[a.countVariable]));return Ge(r,e)}pluralize(t,e){let r=this.l10n("locale-id")||"en",o=Di(r,e);return this.l10n(`${t}__${o}`)}bindL10n(t,e){var r;(r=this.localeManager)==null||r.bindL10n(this,t,e)}emit(t,e,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,e,r)}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Promise.race([Vr({element:this,attribute:b.CTX_NAME_ATTR}),Vr({element:this,attribute:Qi})]).then(e=>{if(console.log(this,e),e.success){if(e.attribute===Qi){let r=e.value;this.setAttribute(b.CTX_NAME_ATTR,r),this.style.setProperty(Qi,`'${r}'`)}super.connectedCallback()}else console.error(`Attribute "${b.CTX_NAME_ATTR}" or "${Qi}" is required and it is not set.`)}):super.connectedCallback(),He.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),He.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Ri(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Yi(this)),this.has("*a11y")||this.add("*a11y",new Ji),this.sub($t("locale-id"),e=>{let r=qo(e);this.style.direction=r==="ltr"?"":r}),setTimeout(()=>{this._readyResolvers.resolve()},0)}get ready(){return this._readyResolvers.promise}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var e;let t=this.blocksRegistry;t==null||t.delete(this),(e=this.localeManager)==null||e.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,I.deleteCtx(this.localCtx.uid),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;I.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}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:Ui(t),cdnUrlModifiers:Nr(t),fileName:Mi(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),t}return this.cfg.secureDeliveryProxy?Ge(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,o)=>{if(typeof r!="string")return!1;let n=Q(r);return this.has(n)||this.add(n,ct[r]),this.$[n]=o,!0},get:(e,r)=>{let o=Q(r);return this.has(o)||this.add(o,ct[r]),this.$[Q(r)]}})}return this.__cfgProxy}subConfigValue(t,e){let r=Q(t);this.has(r)||this.add(r,ct[t]),this.sub(r,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof(t==null?void 0:t[0])=="function"){let r=t[0];e=r()}console.log(`[${this.ctxName}]`,...e)}static reg(t){if(!t){super.reg();return}t.startsWith(nc)&&super.reg(t)}};l(qe,"Block"),h(qe,"StateConsumerScope",null),h(qe,"styleAttrs",[]);var x=qe;var Cn="<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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></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 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 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 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 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 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='apuc-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(#apuc-icon-id__a)'/></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 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 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 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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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 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><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 tr=class tr extends x{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",qi(this));h(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=Cn+t+"<slot></slot>"}static get template(){return this._template}};l(tr,"SolutionBlock"),h(tr,"styleAttrs",["uc-wgt-common"]);var mt=tr;var xn="active",Ze="___ACTIVITY_IS_ACTIVE___",gt=class gt extends x{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",as(this));h(this,"_debouncedHistoryFlush",P(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=gt._activityCallbacks.get(this);this[Ze]=!1,this.removeAttribute(xn),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=gt._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=!0,this.setAttribute(xn,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush(),this.emit(O.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType,this.activityType!==t&&this[Ze]?this._deactivate():this.activityType===t&&!this[Ze]&&this._activate(),t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){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)}_isActivityRegistered(){return this.activityType&>._activityCallbacks.has(this)}get isActivityActive(){return this[Ze]}get couldOpenActivity(){return!0}registerActivity(t,e={}){let{onActivate:r,onDeactivate:o}=e;gt._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),gt._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof gt&&r.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var e;let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(a=>a.activityType===r);o=(e=n==null?void 0:n.couldOpenActivity)!=null?e:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}};l(gt,"ActivityBlock"),h(gt,"_activityCallbacks",new Map);var w=gt;w.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Ye=33.333333333333336,S=1,ys=24,An=6;function qt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}l(qt,"setSvgNodeAttrs");function st(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return qt(t,i),t}l(st,"createSvgNode");function En(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=i.includes("w")?0:1,c=i.includes("n")?0:1,u=[-1,1][a],p=[-1,1][c],d=[e+a*o+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+a*o+1.5*u,r+c*n+1.5*p],g=[e+a*o-24*t*u+1.5*u,r+c*n+1.5*p];return{d:`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}l(En,"cornerPath");function Tn(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=["n","s"].includes(i)?.5:{w:0,e:1}[i],c=["w","e"].includes(i)?.5:{n:0,s:1}[i],u=[-1,1][a],p=[-1,1][c],d,f;["n","s"].includes(i)?(d=[e+a*o-34*t/2,r+c*n+1.5*p],f=[e+a*o+34*t/2,r+c*n+1.5*p]):(d=[e+a*o+1.5*u,r+c*n-34*t/2],f=[e+a*o+1.5*u,r+c*n+34*t/2]);let g=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]}`,m=[f[0]-(f[0]-d[0])/2,f[1]-(f[1]-d[1])/2];return{d:g,center:m}}l(Tn,"sidePath");function Sn(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Sn,"thumbCursor");function kn({rect:s,delta:[i,t],imageBox:e}){return he({...s,x:s.x+i,y:s.y+t},e)}l(kn,"moveRect");function he(s,i){let{x:t}=s,{y:e}=s;return s.x<i.x?t=i.x:s.x+s.width>i.x+i.width&&(t=i.x+i.width-s.width),s.y<i.y?e=i.y:s.y+s.height>i.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}l(he,"constraintRect");function lc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;o+=r,a-=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o<=e.y&&(o=e.y,a=s.y+s.height-o,t&&(n=a*t,c=s.x+s.width/2-n/2)),c<=e.x&&(c=e.x,o=s.y+s.height-a),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(a=n/t),o=s.y+s.height-a),a<S&&(a=S,t&&(n=a*t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),n<S&&(n=S,t&&(a=n/t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:c,y:o,width:n,height:a}}l(lc,"resizeNorth");function ac({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;o+=r,n-=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o<=e.x&&(o=e.x,n=s.x+s.width-o,t&&(a=n/t,c=s.y+s.height/2-a/2)),c<=e.y&&(c=e.y,o=s.x+s.width-n),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(n=a*t),o=s.x+s.width-n),a<S&&(a=S,t&&(n=a*t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),n<S&&(n=S,t&&(a=n/t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:a}}l(ac,"resizeWest");function cc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;a+=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o+a>=e.y+e.height&&(a=e.y+e.height-o,t&&(n=a*t),c=s.x+s.width/2-n/2),c<=e.x&&(c=e.x,o=s.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(a=n/t),o=s.y),a<S&&(a=S,t&&(n=a*t),c=s.x+s.width/2-n/2),n<S&&(n=S,t&&(a=n/t),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:a}}l(cc,"resizeSouth");function uc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;n+=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(a=n/t),c=s.y+s.height/2-a/2),c<=e.y&&(c=e.y,o=s.x),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(n=a*t),o=s.x),a<S&&(a=S,t&&(n=a*t),c=s.y+s.height/2-a/2),n<S&&(n=S,t&&(a=n/t),c=s.y+s.height/2-a/2),{x:o,y:c,width:n,height:a}}l(uc,"resizeEast");function hc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+r<e.x&&(r=e.x-n),a+o<e.y&&(o=e.y-a),n+=r,c-=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=e.y&&(u=u-(e.y-a),c=u*t,n=s.x+s.width-c,a=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,a=s.y+s.height-u)),u<S&&(u=S,t&&(c=u*t),n=s.x+s.width-c,a=s.y+s.height-u),c<S&&(c=S,t&&(u=c/t),n=s.x+s.width-c,a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(hc,"resizeNorthWest");function dc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),a+o<e.y&&(o=e.y-a),c+=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=e.y&&(u=u-(e.y-a),c=u*t,n=s.x,a=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,a=s.y+s.height-u)),u<S&&(u=S,t&&(c=u*t),a=s.y+s.height-u),c<S&&(c=S,t&&(u=c/t),a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(dc,"resizeNorthEast");function pc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+r<e.x&&(r=e.x-n),a+u+o>e.y+e.height&&(o=e.y+e.height-a-u),n+=r,c-=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=e.y+e.height&&(u=e.y+e.height-a,c=u*t,n=s.x+s.width-c,a=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,a=s.y)),u<S&&(u=S,t&&(c=u*t),n=s.x+s.width-c),c<S&&(c=S,t&&(u=c/t),n=s.x+s.width-c),{x:n,y:a,width:c,height:u}}l(pc,"resizeSouthWest");function fc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),a+u+o>e.y+e.height&&(o=e.y+e.height-a-u),c+=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=e.y+e.height&&(u=e.y+e.height-a,c=u*t,n=s.x,a=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,a=s.y)),u<S&&(u=S,t&&(c=u*t)),c<S&&(c=S,t&&(u=c/t)),{x:n,y:a,width:c,height:u}}l(fc,"resizeSouthEast");function $n({direction:s,...i}){switch(s){case"n":return lc(i);case"w":return ac(i);case"s":return cc(i);case"e":return uc(i);case"nw":return hc(i);case"ne":return dc(i);case"sw":return pc(i);case"se":return fc(i);default:return i.rect}}l($n,"resizeRect");function In(s,[i,t]){return s.x<=i&&i<=s.x+s.width&&s.y<=t&&t<=s.y+s.height}l(In,"rectContainsPoint");function On(s,i){return s.x>=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}l(On,"isRectInsideRect");function Ln(s,i){return Math.abs(s.width/s.height-i)<.1}l(Ln,"isRectMatchesAspectRatio");function de({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}l(de,"rotateSize");function Mn(s,i,t){let e=s/i,r,o;e>t?(r=Math.round(i*t),o=i):(r=s,o=Math.round(s/t));let n=Math.round((s-r)/2),a=Math.round((i-o)/2);return n+r>s&&(r=s-n),a+o>i&&(o=i-a),{x:n,y:a,width:r,height:o}}l(Mn,"calculateMaxCenteredCropFrame");function pe(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(pe,"roundRect");function zt(s,i,t){return Math.min(Math.max(s,i),t)}l(zt,"clamp");var ir=l(s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]},"parseCropPreset");var Zt="blocks",Yt="1.2.0";function Un(s){return qr({...s,libraryName:Zt,libraryVersion:Yt})}l(Un,"customUserAgent");var Pn=l(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Rn=l((s,{threshold:i})=>{let{secureExpire:t}=s,e=Pn(Date.now()),r=Number(t),o=Pn(i);return e+o>=r},"isSecureTokenExpired");var _s=class _s{constructor(i){h(this,"_block");h(this,"_secureToken",null);this._block=i}_debugPrint(...i){this._block.debugPrint("[secure-uploads]",...i)}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this._block.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this._secureToken||Rn(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let r=await e();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this._debugPrint("Secure signature resolved:",r),this._debugPrint("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this._secureToken=r):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r)}}return this._secureToken}return i&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};l(_s,"SecureUploadsManager");var rr=_s;var Dn="[Typed State] Wrong property name: ",mc="[Typed State] Wrong property type: ",vs=class vs{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||lt.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=I.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Dn+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(mc+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Dn+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){I.deleteCtx(this.__ctxId)}};l(vs,"TypedData");var sr=vs;var ws=class ws{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||lt.generate(),this.__data=I.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){var t;(t=this.__collectionObservers)==null||t.delete(i)}add(i){let t=new sr(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),t.uid}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){var t;(t=this.__propertyObservers)==null||t.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){I.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};l(ws,"TypedCollection");var or=ws;var tt=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Je=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],nr=l(s=>s?s.filter(i=>typeof i=="string").map(i=>X(i)).flat():[],"mergeFileTypes"),Cs=l((s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),Fn=l((s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),Nn=l(s=>{let i=s==null?void 0:s.type;return i?Cs(i,Je):!1},"fileIsImage");var gc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,bc=new RegExp(`^/?(${gc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Bn=l(({url:s,cdnBase:i})=>{let t=new URL(i),e=new URL(s);if(t.host!==e.host)return null;let[,r,o,n]=bc.exec(e.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var zn=l(s=>{let i=new Map;return(...t)=>{let e=JSON.stringify(t);if(i.has(e))return i.get(e);let r=s(...t);return i.set(e,r),r}},"memoize");var Vn=new Set;function jn(s){Vn.has(s)||(Vn.add(s),console.warn(s))}l(jn,"warnOnce");function yc(s){let i=!1;return setTimeout(()=>{i=!0},0),l(e=>(...r)=>(i&&jn(s),e(...r)),"withAssert")}l(yc,"createAsyncAssertWrapper");function Hn(s){let i={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(r=>r.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>t.allEntries.filter(r=>r.status==="success"),failedEntries:()=>t.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>t.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>t.allEntries.filter(r=>r.status==="idle")},t={},e=yc("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[r,o]of Object.entries(i)){let n=r,c=zn(e(o));Object.defineProperty(t,n,{get:c,enumerable:!0})}return t}l(Hn,"buildOutputCollectionState");var xs=class xs{constructor(i){h(this,"_ctx");h(this,"addFileFromUrl",l((i,{silent:t,fileName:e,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",l((i,{silent:t,fileName:e,source:r}={})=>{let o=this._uploadCollection.add({uuid:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",l((i,{silent:t,fileName:e,source:r}={})=>{var a;let o=Bn({url:i,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:i,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(a=e!=null?e:o.filename)!=null?a:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",l((i,{silent:t,fileName:e,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:i,isImage:Nn(i),mimeType:i.type,fileName:e!=null?e:i.name,fileSize:i.size,silent:t!=null?t:!1,source:r!=null?r:tt.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",l(i=>{if(!this._uploadCollection.read(i))throw new Error(`File with internalId ${i} not found`);this._uploadCollection.remove(i)},"removeFileByInternalId"));h(this,"uploadAll",l(()=>{let i=this._uploadCollection.items().filter(t=>{let e=this._uploadCollection.read(t);return!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")});i.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(i),this._ctx.emit(O.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",l((i={})=>{var r;let t=le(nr([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?Je:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("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.");let e=document.createElement("input");e.type="file",e.multiple=this.cfg.multiple,i.captureCamera?(e.capture=this.cfg.cameraCapture,e.accept="image/*"):e.accept=t,e.dispatchEvent(new MouseEvent("click")),e.onchange=()=>{[...e.files].forEach(o=>this.addFileFromObject(o,{source:i.captureCamera?tt.CAMERA:tt.LOCAL})),this._ctx.$["*currentActivity"]=w.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),e.value=""}},"openSystemDialog"));h(this,"getOutputItem",l(i=>{var n,a,c,u,p,d,f,g,m,_;let t=I.getCtx(i).store,e=t.fileInfo,r=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(a=(n=e==null?void 0:e.uuid)!=null?n:t.uuid)!=null?a:null,internalId:i,name:(c=e==null?void 0:e.originalFilename)!=null?c:t.fileName,size:(u=e==null?void 0:e.size)!=null?u:t.fileSize,isImage:(p=e==null?void 0:e.isImage)!=null?p:t.isImage,mimeType:(d=e==null?void 0:e.mimeType)!=null?d:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(g=(f=t.cdnUrl)!=null?f:e==null?void 0:e.cdnUrl)!=null?g:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:e!=null?e:null,metadata:(_=(m=t.metadata)!=null?m:e==null?void 0:e.metadata)!=null?_:null,isSuccess:r==="success",isUploading:r==="uploading",isFailed:r==="failed",isRemoved:r==="removed",errors:t.errors,status:r}},"getOutputItem"));h(this,"getOutputCollectionState",l(()=>Hn(this._ctx),"getOutputCollectionState"));h(this,"initFlow",l((i=!1)=>{var t;if(this._uploadCollection.size>0&&!i)this._ctx.set$({"*currentActivity":w.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let e=this._sourceList[0];if(e==="local"){this._ctx.$["*currentActivity"]=w.activities.UPLOAD_LIST,this.openSystemDialog();return}let r=this._ctx.$["*blocksRegistry"],o=l(a=>"type"in a&&a.type===e,"isSourceBtn"),n=[...r].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":w.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)},"initFlow"));h(this,"doneFlow",l(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)},"doneFlow"));h(this,"setCurrentActivity",l((i,t={})=>{if(this._ctx.hasBlockInCtx(e=>e.activityType===i)){this._ctx.set$({"*currentActivityParams":t,"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`)},"setCurrentActivity"));h(this,"setModalState",l(i=>{if(i&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",i)},"setModalState"));this._ctx=i}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let i=[];return this.cfg.sourceList&&(i=X(this.cfg.sourceList)),i}};l(xs,"UploaderPublicApi");var lr=xs;var As=l((s,i)=>{let t=i.cfg.imgOnly,e=s.isImage;if(!(!t||e)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Es=l((s,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=nr([...t?Je:[],e]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let a=Cs(o,r),c=Fn(n,r);if(!a&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var yt=1e3,Jt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Qe=l(s=>Math.ceil(s*100)/100,"round"),Gn=l((s,i=Jt.AUTO)=>{let t=i===Jt.AUTO;if(i===Jt.BYTE||t&&s<yt**1){let e=Di("en-US",s),r={one:"byte",other:"bytes"}[e];return`${s} ${r}`}return i===Jt.KB||t&&s<yt**2?`${Qe(s/yt**1)} KB`:i===Jt.MB||t&&s<yt**3?`${Qe(s/yt**2)} MB`:i===Jt.GB||t&&s<yt**4?`${Qe(s/yt**3)} GB`:i===Jt.TB||t&&s<yt**5?`${Qe(s/yt**4)} TB`:`${Qe(s/yt**5)} PB`},"prettyBytes");var Ts=l((s,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=s.size;if(t&&e&&e>t)return{type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Gn(t)}),payload:{entry:s}}},"validateMaxSizeLimit");var Ss=l((s,i)=>{let{internalId:t}=s,e=i._uploadCollection.read(t),r=e==null?void 0:e.getValue("uploadError");if(!r)return;if(r instanceof W)return{type:"UPLOAD_ERROR",message:r.message,payload:{entry:s,error:r}};if(r instanceof ae)return{type:"NETWORK_ERROR",message:r.message,payload:{entry:s,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:s,error:o}}},"validateUploadError");var ks=l((s,i)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var $s=l((s,i)=>{let t=s.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return{type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return{type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var ar={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Is=class Is{constructor(i){h(this,"_blockInstance");h(this,"_fileValidators",[As,Es,Ts,Ss]);h(this,"_collectionValidators",[$s,ks]);this._blockInstance=i,this._uploadCollection=this._blockInstance.uploadCollection;let t=l(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(i){let t=i!=null?i:this._uploadCollection.items();for(let e of t){let r=this._uploadCollection.read(e);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let i=this._blockInstance.api.getOutputCollectionState(),t=[];for(let e of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=e(i,this._blockInstance.api);if(!r)continue;r&&(t.push(r),r.message||console.warn(ar.message))}catch(r){console.warn(ar.collection,r)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit(O.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(i){let t=this._blockInstance.api.getOutputItem(i.uid),e=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(t,this._blockInstance.api);if(!o)continue;o&&(e.push(o),o.message||console.warn(ar.message))}catch(o){console.warn(ar.file,o)}i.setValue("errors",e)}_addCustomTypeToValidators(i){return i.map(t=>(...e)=>{let r=t(...e);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};l(Is,"ValidationManager");var cr=Is;var Xn=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:St,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:null,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var ur=class ur extends w{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",qi(this));h(this,"_flushOutputItems",P(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(O.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._createGroup(e)},300));h(this,"_handleCollectionUpdate",l((t,e,r)=>{var o;(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of e)n.getValue("silent")||this.emit(O.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of r)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit(O.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",l(t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let a of t.errors){let{errors:c}=I.getCtx(a).store;c.length>0&&(this.emit(O.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(O.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(O.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var a;return!!((a=this.uploadCollection.read(n))!=null&&a.getValue("cdnUrl"))}).forEach(n=>{this.emit(O.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",l(()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");t+=a});let o=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(O.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof ur?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new or({typedSchema:Xn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new lr(this)),this.has("*validationManager")||this.add("*validationManager",new cr(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,e;(t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new rr(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await dn(r,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(O.GROUP_CREATED,a),this.emit(O.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=a}setInitialCrop(){let t=ir(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of r){let n=o.getValue("fileInfo"),{width:a,height:c}=n.imageInfo,u=e.width/e.height,p=Mn(a,c,u),d=G(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:D(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===w.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=o,this.$["*currentActivity"]=w.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let e=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Un,integration:this.cfg.userAgentIntegration,secureSignature:e==null?void 0:e.secureSignature,secureExpire:e==null?void 0:e.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};l(ur,"UploaderBlock");var k=ur;k.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});k.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...k.extSrcList});var fe=l(s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var V=l(s=>String(s),"asString"),ut=l(s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},"asNumber"),M=l(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),_c=l(s=>s==="auto"?s:M(s),"asStore"),vc=l(s=>{let i=V(s);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},"asCameraCapture"),wc=l(s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Cc=l(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),Os=l(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),Wn=l(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),xc={pubkey:V,multiple:M,multipleMin:ut,multipleMax:ut,confirmUpload:M,imgOnly:M,accept:V,externalSourcesPreferredTypes:V,store:_c,cameraMirror:M,cameraCapture:vc,sourceList:V,maxLocalFileSizeBytes:ut,thumbSize:ut,showEmptyList:M,useLocalImageEditor:M,useCloudImageEditor:M,cloudImageEditorTabs:V,removeCopyright:M,cropPreset:V,imageShrink:V,modalScrollLock:M,modalBackdropStrokes:M,sourceListWrap:M,remoteTabSessionKey:V,cdnCname:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:ut,multipartMinFileSize:ut,multipartChunkSize:ut,maxConcurrentRequests:ut,multipartMaxConcurrentRequests:ut,multipartMaxAttempts:ut,checkForUrlDuplicates:M,saveUrlForRecurrentUploads:M,groupOutput:M,userAgentIntegration:V,debug:M,localeName:V,metadata:wc,secureUploadsExpireThreshold:ut,localeDefinitionOverride:Cc,secureUploadsSignatureResolver:Os,secureDeliveryProxyUrlResolver:Os,iconHrefResolver:Os,fileValidators:Wn,collectionValidators:Wn},Kn=l((s,i)=>{if(!(typeof i=="undefined"||i===null))try{return xc[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),ct[s]}},"normalizeConfigValue");var Ls=[...new Set(["debug",...Object.keys(ct)])],Ac=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],Ec=l(s=>Ac.includes(s),"isComplexKey"),me=Ls.filter(s=>!Ec(s)),Tc={...Object.fromEntries(me.map(s=>[fe(s),s])),...Object.fromEntries(me.map(s=>[s.toLowerCase(),s]))},Sc={...Object.fromEntries(me.map(s=>[fe(s),Q(s)])),...Object.fromEntries(me.map(s=>[s.toLowerCase(),Q(s)]))},qn=l(s=>"__"+s,"getLocalPropName"),Ms=class Ms extends x{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(ct).map(([t,e])=>[Q(t),e]))}}_flushValueToAttribute(t,e){if(me.includes(t)){let r=[...new Set([fe(t),t.toLowerCase()])];for(let o of r)typeof e=="undefined"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString())}}_flushValueToState(t,e){this.$[Q(t)]!==e&&(typeof e=="undefined"||e===null?this.$[Q(t)]=ct[t]:this.$[Q(t)]=e)}_setValue(t,e){let r=this,o=Kn(t,e),n=qn(t);r[n]!==o&&(this._assertSameValueDifferentReference(t,r[n],o),r[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let e=this,r=qn(t);return e[r]}_assertSameValueDifferentReference(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r))}initCallback(){var e;super.initCallback();let t=this;for(let r of me)this.sub(Q(r),o=>{this._setValue(r,o)},!1);for(let r of Ls){let o=(e=t[r])!=null?e:this.$[Q(r)];o!==ct[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(t,e,r){if(e===r)return;let o=this,n=Tc[t];o[n]=r}};l(Ms,"ConfigClass");var ti=Ms;ti.bindAttributes(Sc);for(let s of Ls)ti.prototype[s]=void 0;var Zn=ti;var Us=class Us extends x{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let t=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",e=>{if(e){let r=e(i);t=r!=null?r:t}this.$.href=t})})}};l(Us,"Icon");var ge=Us;ge.template=y`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use bind="@href: href;"></use></svg>`;ge.bindAttributes({name:"name"});var Yn=l(s=>[...new Set(s)],"uniqueArray");var Jn=l(s=>Object.entries(s).filter(([,i])=>i!==void 0&&i!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var kc="https://ucarecdn.com",ei=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:kc},"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 be="--uc-img-",Ps="unresolved";var Rs=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Ds=3e3,Fs=5e3,Ns=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var tl=Object.create(null),Qn;for(let s in ei)tl[be+s]=((Qn=ei[s])==null?void 0:Qn.default)||"";var Bs=class Bs extends Pt{constructor(){super(...arguments);h(this,"cssInit$",tl)}$$(t){return this.$[be+t]}set$$(t){for(let e in t)this.$[be+e]=t[e]}sub$$(t,e){this.sub(be+t,r=>{r===null||r===""||e(r)})}analyticsParams(){return`-/@clib/${Zt}/${Yt}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{ei[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),I.deleteCtx(this)}static get observedAttributes(){return Object.keys(ei)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[be+t]=r})}};l(Bs,"ImgConfig");var hr=Bs;var zs=class zs extends hr{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!Rs&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],r=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Fs&&this.hasFormatJPG)return Fs+r;if(Number(o)>Ds&&!this.hasFormatJPG)return Ds+r}return t}_getCdnModifiers(t,e){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return G(...Jn(r))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(Rs&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return D(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(D(Rt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(D(Rt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(D(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(D(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Ge(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let o=t.getBoundingClientRect(),n=e*Math.round(o.width),a=r?"":e*Math.round(o.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(t){let e=l(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Ns.PREVIEW,img:this._imgPreview}:{type:Ns.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=X(this.$$("breakpoints"));return Yn(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(Ps,""),r.addEventListener("load",()=>{r.removeAttribute(Ps),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var r;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};l(zs,"ImgBase");var fr=zs;var Vs=class Vs extends fr{initCallback(){super.initCallback(),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")})}};l(Vs,"Img");var mr=Vs;var ye=class ye extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=M(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};l(ye,"SimpleBtn"),h(ye,"styleAttrs",[...Z(ye,ye,"styleAttrs"),"uc-simple-btn"]);var _e=ye;_e.template=y`<uc-drop-area bind="@disabled: !withDropZone"><button type="button" bind="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;_e.bindAttributes({dropzone:null});var js=class js extends w{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(js,"StartFrom");var ii=js;ii.template=y`<div class="uc-content"><slot></slot></div>`;function $c(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=l(r=>{r.type!=="loadend"&&t.abort(),i(!1)},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}l($c,"checkIsDirectory");function Ic(s,i){return new Promise(t=>{let e=0,r=[],o=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(e++,a.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:a.fullPath}),e===0&&t(r)})):a.isDirectory&&n(a.createReader())},"readEntry"),n=l(a=>{e++,a.readEntries(c=>{e--;for(let u of c)o(u);e===0&&t(r)})},"readReaderContent");o(s)})}l(Ic,"readEntryContentAsync");function el(s){let i=[],t=[];for(let e=0;e<s.items.length;e++){let r=s.items[e];if(r)if(r.kind==="file"){let o=r.type;if(typeof r.webkitGetAsEntry=="function"||typeof r.getAsEntry=="function"){let a=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();t.push(Ic(a,o).then(c=>{c&&i.push(...c)}));continue}let n=r.getAsFile();n&&t.push($c(n).then(a=>{a||i.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(o=>{r.getAsString(n=>{i.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>i)}l(el,"getDropItems");var K={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},il=["focus"],Oc=100,Hs=new Map;function Lc(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}l(Lc,"distance");function Gs(s){let i=0,t=document.body,e=new Set,r=l(m=>e.add(m),"handleSwitch"),o=K.INACTIVE,n=l(m=>{s.shouldIgnore()&&m!==K.INACTIVE||(o!==m&&e.forEach(_=>_(m)),o=m)},"setState"),a=l(()=>i>0,"isDragging");r(m=>s.onChange(m));let c=l(()=>{i=0,n(K.INACTIVE)},"onResetEvent"),u=l(()=>{i+=1,o===K.INACTIVE&&n(K.ACTIVE)},"onDragEnter"),p=l(()=>{i-=1,a()||n(K.INACTIVE)},"onDragLeave"),d=l(m=>{m.preventDefault(),i=0,n(K.INACTIVE)},"onDrop"),f=l(m=>{if(s.shouldIgnore())return;a()||(i+=1);let _=[m.x,m.y],C=s.element.getBoundingClientRect(),E=Math.floor(Lc(_,C)),A=E<Oc,T=m.composedPath().includes(s.element);Hs.set(s.element,E);let B=Math.min(...Hs.values())===E;T&&B?(m.preventDefault(),n(K.OVER)):n(A&&B?K.NEAR:K.ACTIVE)},"onDragOver"),g=l(async m=>{if(s.shouldIgnore())return;m.preventDefault();let _=await el(m.dataTransfer);s.onItems(_),n(K.INACTIVE)},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),s.element.addEventListener("drop",g),il.forEach(m=>{window.addEventListener(m,c)}),()=>{Hs.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",g),il.forEach(m=>{window.removeEventListener(m,c)})}}l(Gs,"addDropzone");var rl="uc-drop-area",ve=`${rl}/registry`,we=class we extends k{constructor(){super(),this.init$={...this.init$,state:K.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[ve]:null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return t&&o&&e}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[ve]||(this.$[ve]=new Set),this.$[ve].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!M(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:M(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:M(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:M(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Gs({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:tt.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:tt.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":w.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Gs({element:i,onChange:t=>{var r;let e=(r=Object.entries(K).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(K).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=X(t);this.$.isEnabled=e.includes(k.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[ve]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var t,e;super.destroyCallback();let i=this.$[ve];i&&(i.delete(this),i.size===0&&I.deleteCtx(rl)),(t=this._destroyDropzone)==null||t.call(this),(e=this._destroyContentWrapperDropzone)==null||e.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};l(we,"DropArea"),h(we,"styleAttrs",[...Z(we,we,"styleAttrs"),"uc-drop-area"]);var Ce=we;Ce.template=y`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" bind="@hidden: !isVisible"><div class="uc-icon-container" bind="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;Ce.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Mc="src-type-",Xs=class Xs extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:k.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:k.sourceTypes.URL,activity:w.activities.URL,textKey:"from-url"}),this.registerType({type:k.sourceTypes.CAMERA,activity:w.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:w.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(k.extSrcList))this.registerType({type:t,activity:w.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:e,activate:r,activityParams:o={}}=t;(r?r():!!e)&&this.set$({"*currentActivityParams":o,"*currentActivity":e})}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:o=t}=e;this.$["src-type"]=`${Mc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};l(Xs,"SourceBtn");var xe=Xs;xe.template=y`<button type="button"><uc-icon bind="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;xe.bindAttributes({type:null});var Ws=class Ws extends x{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=X(i),e="";t.forEach(r=>{e+=y`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};l(Ws,"SourceList");var gr=Ws;var yr=l(()=>{let s=[];return{stack:s,promiseReadJpegChunks:l(t=>new Promise((e,r)=>{let o=2,n=l((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result))}),d.addEventListener("error",f=>{r(`Reader error: ${f}`)}),d.readAsArrayBuffer(u)},"readToView"),a=l(()=>n(t.slice(o,o+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=l(()=>{let u=o;return n(t.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(!0);return}let f=p.getUint16(2)-2;return n(t.slice(o,o+=f),g=>{if(g.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:g}),a()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),a()})}),"promiseReadJpegChunks")}},"readJpegChunks"),Uc=l(async s=>{let i=[],{promiseReadJpegChunks:t,stack:e}=yr();return await t(s),e.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&i.push(o)}),i},"getIccProfile"),ol=l(async(s,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:o,stack:n}=yr();await o(s),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let a=[s.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),a.push(p.buffer),a.push(u)}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&a.push(s.slice(c,e[u])),c=e[u]+r[u]+4;return a.push(s.slice(c,s.size)),new Blob(a,{type:s.type})}},"replaceJpegChunk"),Pc=226,nl=l((s,i)=>ol(s,Pc,i.map(t=>t.buffer)),"replaceIccProfile"),Rc=l(async s=>{try{return await nl(s,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Dc=l((s,i,t)=>new Promise((e,r)=>{let o=l(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n)},"callback");s.toBlob(o,i,t),s.width=s.height=1}),"canvasToBlob"),ri=l(()=>{let s=document.createElement("canvas"),i=s.getContext("2d");return{canvas:s,ctx:i}},"createCanvas"),Fc=l(s=>{let{ctx:t,canvas:e}=ri();e.width=e.height=50,t.drawImage(s,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let o=3;o<r.length;o+=4)if(r[o]<254)return!0;return!1},"hasTransparency"),Nc=l(async s=>{let i=null,{promiseReadJpegChunks:t,stack:e}=yr();return await t(s),e.forEach(({marker:r,view:o})=>{if(!i&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){i=o;return}}),i},"getExif"),Bc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",br,zc=l(()=>new Promise(s=>{if(br!==void 0)s(br);else{let i=new Image;i.addEventListener("load",()=>{br=i.naturalWidth<i.naturalHeight,i.src="//:0",s(br)}),i.src=Bc}}),"isBrowserApplyExifOrientation"),Vc=l((s,i)=>{let t,e,r,o;if(!s||s.byteLength<14||s.getUint32(0)!==1165519206||s.getUint16(4)!==0)return;if(s.getUint16(6)===18761)e=!0;else if(s.getUint16(6)===19789)e=!1;else return;if(s.getUint16(8,e)!==42)return;r=8+s.getUint32(10,e);let n=s.getUint16(r-2,e);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(s.byteLength<r+10)return;s.getUint16(r,e)===274&&i(r+8,e),r+=12}},"findExifOrientation"),jc=l((s,i)=>{Vc(s,(t,e)=>s.setUint16(t,i,e))},"setExifOrientation"),Hc=l(async(s,i,t)=>(t&&jc(i,1),ol(s,225,[i.buffer])),"replaceExif"),Gc=l((s,i)=>new Promise((t,e)=>{i&&(s.src=i),s.complete?t(s):(s.addEventListener("load",()=>{t(s)}),s.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),Xc=l(s=>Gc(new Image,s),"imageLoader"),Wc=[1,3],Kc=[192,193,194,195,197,198,199,201,202,203,205,206,207],sl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},qc=l(async s=>{let i=!1,{promiseReadJpegChunks:t,stack:e}=yr();return await t(s).then(()=>(e.forEach(({marker:r,view:o})=>{if(!i&&Kc.indexOf(r)>=0){let n=o.getUint8(5);Wc.indexOf(n)<0&&(i=!0)}}),i)).catch(()=>i)},"shouldSkipShrink"),ll=l((s,i)=>{let t={};return(...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=s(...e)}},"memoize"),al=l((s,i)=>{let[t]=s,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<e.length;r++){let o=e[r],n=!!i[o];if(o>t&&n||o<t&&!n)return o}return t},"memoKeySerializer"),Vt={R:55,G:110,B:165,A:255},Zc=`rgba(${Vt.R}, ${Vt.G}, ${Vt.B}, ${Vt.A/255})`,cl=l((s,i)=>{try{let t=[s-1,i-1,1,1],{canvas:e,ctx:r}=ri();e.width=1,e.height=1;let{canvas:o,ctx:n}=ri();o.width=s,o.height=i,n&&(n.fillStyle=Zc,n.fillRect(...t),r.drawImage(o,s-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,c=!1;return a&&(c=a[0]===Vt.R&&a[1]===Vt.G&&a[2]===Vt.B&&a[3]===Vt.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${i}.`),!1}},"canvasTest");function ul(s){return(...i)=>new Promise(t=>{setTimeout(()=>{let e=s(...i);t(e)},0)})}l(ul,"wrapAsync");var Yc=ul(ll(cl,al)),Jc=ul(ll(cl,al)),hl=l(async(s,i)=>{let t=sl.squareSide.find(n=>n*n>=s*i),e=sl.dimension.find(n=>n>=s&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,o]=await Promise.all([Yc(t,t),Jc(e,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),dl=l(async(s,i,t)=>{try{let{ctx:e,canvas:r}=ri();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(s,0,0,i,t),s instanceof HTMLImageElement&&(s.src="//:0"),s instanceof HTMLCanvasElement&&(s.width=s.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Qc=l(({img:s,targetW:i,targetH:t})=>dl(s,i,t),"native"),tu=l(function({sourceW:s,targetW:i,targetH:t,step:e}){let r=[],o=i,n=t;do r.push([o,n]),o=Math.round(o/e),n=Math.round(n/e);while(o<s*e);return r.reverse()},"calcShrinkSteps"),eu=l(({img:s,sourceW:i,targetW:t,targetH:e,step:r})=>tu({sourceW:i,targetW:t,targetH:e,step:r}).reduce((n,[a,c])=>n.then(u=>hl(a,c).then(()=>dl(u,a,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),iu=l(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),ru=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Ks=.71,su=l((s,i)=>{if(s.width*Ks*s.height*Ks<i.size)throw new Error("Not required");let t=s.width,e=s.height,r=t/e,o=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return hl(o,n).then(()=>{let{ctx:a}=ri();return"imageSmoothingQuality"in a&&!iu()&&!ru?Qc({img:s,targetW:o,targetH:n}):eu({img:s,sourceW:t,targetW:o,targetH:n,step:Ks})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),pl=l(async(s,i)=>{try{if(await qc(s))throw new Error("Should skipped");let e=await Promise.allSettled([Nc(s),zc(),Uc(s)]),o=!e.some(_=>_.status==="rejected"),[n,a,c]=e,u=await Rc(s).catch(()=>s),p=await Xc(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await su(p,i),f="image/jpeg",g=(i==null?void 0:i.quality)||.8;!o&&Fc(d)&&(f="image/png",g=void 0);let m=await Dc(d,f,g);if(o&&n.status==="fulfilled"&&n.value){let _=n.value,C=a.status==="fulfilled"?a.value:!1;m=await Hc(m,_,C)}return o&&c.status==="fulfilled"&&c.value.length>0&&(m=await nl(m,c.value)),m}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");function ou(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}l(ou,"createSvgBlobUrl");function qs(s="hsl(209, 21%, 65%)",i=32,t=32){return ou(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${s}" 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>`)}l(qs,"fileCssBg");function fl(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,o=new Promise((n,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){a();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),o}l(fl,"generateThumb");var nu=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,ml=l(s=>{let i=nu.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!i.length)return!1;let t=i[1]*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).`),!1):{quality:i[3]?i[3]/100:void 0,size:t}},"parseShrink");var ot=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3)}),Ae=class Ae extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",P(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",P(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:ot.IDLE,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===w.activities.DETAILS)?this.$["*currentActivity"]=w.activities.DETAILS:this.$["*currentActivity"]=w.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=ot.IDLE;t.getValue("errors").length>0?e=ot.FAILED:t.getValue("isUploading")?e=ot.UPLOADING:t.getValue("fileInfo")&&(e=ot.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(D(Rt(this.cfg.cdnCname,this._entry.getValue("uuid")),G(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await fl(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qs(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qs(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,o=>{this.isConnected&&e(o)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=e.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{Ae.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),Ae.activeInstances.add(this)}_handleState(t){var e,r,o,n,a;t===ot.FAILED?this.$.badgeIcon="badge-error":t===ot.FINISHED&&(this.$.badgeIcon="badge-success"),t===ot.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===ot.FAILED,isUploading:t===ot.UPLOADING,isFinished:t===ot.FINISHED,progressVisible:t===ot.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:(a=(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message)!=null?a:""})}destroyCallback(){super.destroyCallback(),Ae.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return ml(this.cfg.imageShrink)}_processShrink(t){return pl(t,this._settingsOfShrink())}async upload(){var r,o,n,a,c;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let u=new AbortController;t.setValue("abortController",u);let p=l(async()=>{let f=t.getValue("file");f&&this.cfg.imageShrink&&(f=await this._processShrink(f).catch(()=>f));let g=f||t.getValue("externalUrl")||t.getValue("uuid"),_={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:C=>{if(C.isComputable){let E=C.value*100;t.setValue("uploadProgress",E)}},signal:u.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",g,_),ts(g,_)},"uploadTask"),d=await this.$["*uploadQueue"].add(p);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(n=(o=(r=d.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:d.mimeType,uuid:d.uuid,cdnUrl:(a=t.getValue("cdnUrl"))!=null?a:d.cdnUrl,cdnUrlModifiers:(c=t.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(u){u instanceof Ft&&u.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:u}),t===this._entry&&this._debouncedCalculateState()}}}};l(Ae,"FileItem");var Ee=Ae;Ee.template=y`<div class="uc-inner" bind="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" bind="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon bind="@name: badgeIcon"></uc-icon></div></div><div class="uc-file-name-wrapper"><span class="uc-file-name" bind="@title: itemName">{{itemName}}</span><span class="uc-file-error" bind="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" bind="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" bind="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" bind="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" bind="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Ee.activeInstances=new Set;var Qt=class Qt extends x{constructor(){super();h(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",l(t=>{this._mouseDownTarget=t.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",l(t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};l(Qt,"Modal"),h(Qt,"styleAttrs",[...Z(Qt,Qt,"styleAttrs"),"uc-modal"]),h(Qt,"StateConsumerScope","modal");var si=Qt;si.template=y`<dialog ref="dialog"><slot></slot></dialog>`;var _r=l((s,i)=>{let t,e,r,o=l((...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(e)}}),o},"throttle");var Zs=class Zs extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",w.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",_r(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit(O.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(O.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=e.failed===0&&t.errors.length===0,c=!1,u=!1,p=!1;if(e.total-e.succeed-e.uploading-e.failed>0&&r)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!t.group:!0;p=e.total===e.succeed&&r&&a&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:e.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(e))}_getHeaderText(t){let e=l(r=>{let o=t[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return t.uploading>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._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:e.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};l(Zs,"UploadList");var oi=Zs;oi.template=y`<uc-activity-header><span class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" bind="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" itemize="*uploadList" item-tag="uc-file-item"></div><div class="uc-common-error" bind="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" bind="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" bind="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" bind="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" bind="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Ys=class Ys extends k{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.api.addFileFromUrl(e,{source:tt.URL_TAB}),this.$["*currentActivity"]=w.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(Ys,"UrlSource");var ni=Ys;ni.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" bind="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" bind="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var Js=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Qs=class Qs extends k{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:Js(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",l(()=>{Js()&&this._subscribePermissions(),this._capture()},"_onActivate"));h(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));h(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_setPermissionsState",P(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),console.error("Failed to capture camera",e)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.jpeg`,r="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],e,{lastModified:t,type:r});this.api.addFileFromObject(n,{source:tt.CAMERA}),this.set$({"*currentActivity":w.activities.UPLOAD_LIST})},r)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null});try{let r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));r.length>1&&(this.$.cameraSelectOptions=r,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=r[0])==null?void 0:t.value}catch{}}};l(Qs,"CameraSource");var li=Qs;li.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div bind="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" bind="options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline bind="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" bind="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" bind="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" bind="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var to=class to extends k{constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};l(to,"UploadCtxProviderClass");var vr=to;vr.EventType=O;var gl=vr;var eo=class eo extends k{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};l(eo,"ProgressBarCommon");var ai=eo;ai.template=y`<uc-progress-bar bind="visible: visible; value: value"></uc-progress-bar>`;var io=class io extends x{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let e=this._value;if(this._value=t,t===0&&e>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};l(io,"ProgressBar");var ci=io;ci.template=y`<div ref="line" class="uc-progress"></div>`;var _t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function bl(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}l(bl,"normalize");function j(...s){let i=bl(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}l(j,"classNames");function yl(s,...i){let t=bl(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}l(yl,"applyClassNames");var _l=l(s=>{if(!s)return Y;let i=Wo(s).filter(t=>Y.includes(t));return i.length===0?Y:i},"parseTabs");function vl(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":Y,"*tabId":U.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:_t,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:le(Y),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=_t,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=G(Dt(i),"preview"),r=D(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(vl,"initState");var wl="<svg width='0' height='0' style='position:absolute'><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='puc-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(#puc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-icon-id__h)'/><defs><linearGradient id='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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 Cl=y`${wl} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" bind="visible: presence.networkProblems;"><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" bind="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${_t}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui bind="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var wr=class wr extends x{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",P(this._showLoader.bind(this),300));this.init$={...this.init$,...vl(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let o=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(e(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=Ui(this.$.cdnUrl),e=Rt(this.$.cdnUrl,t);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e;let r=Do(this.$.cdnUrl),o=jo(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=Rt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===U.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(D(this.$["*originalUrl"],G("json"))),e=await fetch(t).then(n=>n.json()),{width:r,height:o}=e;this.$["*imageSize"]={width:r,height:o},this.$["*tabId"]===U.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==_t&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||_t)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=ir(t)}),this.sub("tabs",t=>{this.$["*tabList"]=_l(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=j("uc-image",{"uc-image_hidden_to_cropper":t===U.CROP,"uc-image_hidden_effects":t!==U.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=G(Dt(t),"preview"),o=D(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(wr,"CloudImageEditorBlock"),h(wr,"styleAttrs",["uc-cloud-image-editor"]);var vt=wr;vt.template=Cl;vt.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var ro=class ro extends x{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=S&&t.width<=S)return!0;let e=t.height<=S&&(i.includes("n")||i.includes("s")),r=t.width<=S&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:o}=i,n=this.ref["svg-el"],a=st("mask",{id:"backdrop-mask"}),c=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=st("rect",{x:t,y:e,width:r,height:o,fill:"black"});a.appendChild(c),a.appendChild(u);let p=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(p),n.appendChild(a),this._backdropMask=a,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:o}=i;this._backdropMaskInner&&qt(this._backdropMaskInner,{x:t,y:e,width:r,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:o,groupNode:n}=t,a=e==="",c=e.length===2,{x:u,y:p,width:d,height:f}=i;if(a){let m={x:u+d/3,y:p+f/3,width:d/3,height:f/3};qt(o,m)}else{let m=zt(Math.min(d,f)/(24*2+34)/2,0,1),{d:_,center:C}=c?En(i,e,m):Tn(i,e,m),E=Math.max(ys*zt(Math.min(d,f)/ys/3,0,1),An);qt(o,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),qt(r,{d:_})}let g=this._shouldThumbBeDisabled(e);n.setAttribute("class",j("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}))}qt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,o=st("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=st("rect",{fill:"transparent"}),a=st("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(n),i[r]={direction:r,pathNode:a,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=st("svg"),t=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=st("line",{x1:`${Ye*e}%`,y1:"0%",x2:`${Ye*e}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=st("line",{x1:"0%",y1:`${Ye*e}%`,x2:"100%",y2:`${Ye*e}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("uc-guides","uc-guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))t.appendChild(o);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-o,c=t.y-n;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),o=i.x-e,n=i.y-r,a=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[a,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(i,t){var u,p;let[e,r]=t,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],a=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=a?a.width/a.height:void 0;if(i===""?n=kn({rect:n,delta:[e,r],imageBox:o}):n=$n({rect:n,delta:[e,r],direction:i,aspectRatio:c,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return he(pe(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let o=e.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return In(n,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Sn(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",j("uc-thumb",{"uc-thumb--hidden":!i,"uc-thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=S||i.width<=S,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",j({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&i,"uc-guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(ro,"CropFrame");var ui=ro;ui.template=y`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var so=class so extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=j({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(so,"EditorButtonControl");var It=so;It.template=y`<button type="button" role="option"><uc-icon bind="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function au(s){let i=s+90;return i=i>=360?0:i,i}l(au,"nextAngle");function cu(s,i){return s==="rotate"?au(i):["mirror","flip"].includes(s)?!i:null}l(cu,"nextValue");var oo=class oo extends It{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=()=>{let i=this.$["*cropperEl"].getValue(this._operation),t=cu(this._operation,i);this.$["*cropperEl"].setValue(this._operation,t)}}};l(oo,"EditorCropButtonControl");var Te=oo;var hi={FILTER:"filter",COLOR_OPERATION:"color_operation"},wt="original",no=class no extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?hi.FILTER:hi.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===wt?void 0:this.$.value,filter:this._filter===wt?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ft[this._operation],[r,o]=t;this.$.min=r,this.$.max=o,this.$.zero=e;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===hi.FILTER){let a=o;if(n){let{name:c,amount:u}=n;a=c===this._filter?u:o}this.$.value=a,this.$.defaultValue=a}if(this._controlType===hi.COLOR_OPERATION){let a=typeof n!="undefined"?n:e;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===hi.FILTER?this._filter===wt?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};l(no,"EditorSlider");var di=no;di.template=y`<uc-slider-ui ref="slider-el" bind="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function pi(s){let i=new Image;return{promise:new Promise((r,o)=>{i.src=s,i.onload=r,i.onerror=o}),image:i,cancel:l(()=>{i.naturalWidth===0&&(i.src=_t)},"cancel")}}l(pi,"preloadImage");function fi(s){let i=[];for(let o of s){let n=pi(o);i.push(n)}let t=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:l(()=>{i.forEach(o=>{o.cancel()})},"cancel")}}l(fi,"batchPreloadImages");var lo=class lo extends It{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,"on.click":null}}_previewSrc(){let i=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,e=Math.ceil(t*i),r=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==wt?{name:this._filter,amount:o}:void 0,D(this._originalUrl,G(Pi,Dt(n),`quality/${r}`,`scale_crop/${e}x${e}/center`))}async _observerCallback(i,t){var r;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:a,cancel:c}=pi(o);this._cancelPreload=c,a.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(r=this._cancelPreload)==null||r.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===wt,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let i=this.$["*originalUrl"];this._originalUrl=i,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("active",t=>{if(this.$.isOriginal)return;let e=this.ref["icon-el"];e.style.opacity=t?"1":"0";let r=this.ref["preview-el"];t?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let e=await this.proxyUrl(this._previewSrc()),r=this.ref["preview-el"];r.style.backgroundImage&&(r.style.backgroundImage="none",r.style.backgroundImage=`url(${e})`)}})}destroyCallback(){var i,t;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};l(lo,"EditorFilterControl");var ee=lo;ee.template=y`<button type="button" role="option"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" bind="@name: icon;"></uc-icon></button>`;var ao=class ao extends It{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ft[this._operation],r=t[this._operation],o=typeof r!="undefined"?r!==e:!1;this.$.active=o})}};l(ao,"EditorOperationControl");var Se=ao;function xl(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}l(xl,"pick");function ke(s,i,t){let r=window.devicePixelRatio,o=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return D(s,G(Pi,Dt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Zt}/${Yt}/uc-cloud-image-editor/`))}l(ke,"viewerImageSrc");function uu(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}l(uu,"validateCrop");var co=class co extends x{constructor(){super();h(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=P(this._commit.bind(this),300),this._handleResizeThrottled=_r(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],e=xl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r}_initCanvas(){let t=this.ref["canvas-el"],e=t.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${o}px`,t.width=r*n,t.height=o*n,e==null||e.scale(n,n),this._canvas=t,this._ctx=e}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,e=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=de({width:t.naturalWidth,height:t.naturalHeight},o),c;if(a.width>n.width-e*2||a.height>n.height-e*2){let u=a.width/a.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,g=0+e,m=e+(n.height-e*2)/2-f/2;c={x:g,y:m,width:d,height:f}}else{let d=n.height-e*2,f=d*u,g=e+(n.width-e*2)/2-f/2,m=0+e;c={x:g,y:m,width:f,height:d}}}else{let{width:u,height:p}=a,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p}}this.$["*imageBox"]=pe(c)}_alignCrop(){var f;let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[g,m],coords:[_,C]}=n,{width:E}=de(this._imageSize,o),A=a/E;t=he(pe({x:c+_*A,y:u+C*A,width:g*A,height:m*A}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],d=p?p.width/p.height:void 0;if(!On(t,e)||d&&!Ln(t,d)){let g=e.width/e.height,m=e.width,_=e.height;d&&(g>d?m=Math.min(e.height*d,e.width):_=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-_/2,width:m,height:_}}this.$["*cropBox"]=he(pe(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let e=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:c}=o,u=de({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=j({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=e,{width:c,height:u}=de(this._imageSize,o),{width:p,height:d}=t,f=n/c,g=a/u;return[zt(Math.round(p/f),1,c),zt(Math.round(d/g),1,u)]}_getCropTransformation(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:c,y:u}=e,{width:p,height:d}=de(this._imageSize,o),{x:f,y:g}=t,m=n/p,_=a/d,C=this._getCropDimensions(),E={dimensions:C,coords:[zt(Math.round((f-c)/m),0,p-C[0]),zt(Math.round((g-u)/_),0,d-C[1])]};if(!uu(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(C[0]===p&&C[1]===d))return E}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:o}=t,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:e})}catch(r){console.error("Failed to activate cropper",{error:r})}this._observer=new ResizeObserver(([r])=>{r.contentRect.width>0&&r.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var e;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=j({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(e=this._observer)==null||e.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),e=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(e,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,a=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-a)/o}px)`,this.style.transformOrigin=`${n}px ${a}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,e=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${e}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,e){var p;let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(ke(t,r,e)),{promise:n,cancel:a,image:c}=pi(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=a,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(t){let e="crop",r=this.$["*loadingOperations"];return r.get(e)||r.set(e,new Map),r.get(e).get(t)||(r.set(e,r.get(e).set(t,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(e))!=null&&o.has(t)&&(r.get(e).delete(t),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};l(co,"EditorImageCropper");var mi=co;mi.template=y`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function uo(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}l(uo,"linspace");function hu(s){return s.reduce((i,t,e)=>e<s.length-1?[...i,[t,s[e+1]]]:i,[])}l(hu,"splitBySections");function du(s,i,t){let e=hu(s).find(([r,o])=>r<=i&&i<=o);return s.map(r=>{let o=Math.abs(e[0]-e[1]),n=Math.abs(i-e[0])/o;return e[0]===r?i>t?1:1-n:e[1]===r?i>=t?n:1:0})}l(du,"calculateOpacities");function pu(s,i){return s.map((t,e)=>t<i?s.length-e:e)}l(pu,"calculateZIndices");function Al(s,i){let t=ft[s].keypointsNumber,{range:e,zero:r}=ft[s];return[...new Set([...uo(e[0],r,t+1),...uo(r,e[1],t+1),r,i])].sort((o,n)=>o-n)}l(Al,"keypointsRange");var ho=class ho extends x{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=P(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let o={...this._transformations};e&&(o[e]=t?{name:t,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(ke(i,n,o))}async _constructKeypoint(i,t){return{src:await this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}async _addKeypoint(i,t,e){let r=l(()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(c=>c.value===e),"shouldSkip");if(r())return;let o=await this._constructKeypoint(i,e),n=new Image;n.src=o.src;let a=this._handleImageLoading(o.src);n.addEventListener("load",a,{once:!0}),n.addEventListener("error",a,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(r())return;let c=this._keypoints,u=c.findIndex(d=>d.value>e),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(n,p),this._update(i,e))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ft[i],r=this._keypoints.map(a=>a.value),o=du(r,t,e),n=pu(r,e);for(let[a,c]of Object.entries(this._keypoints))c.opacity=o[a],c.zIndex=n[a];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("uc-fader-image","uc-fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=fi(e);r.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await o,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}async setTransformations(i){if(this._transformations=i,this._previewImage){let t=await this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Al(e,r),n=await Promise.all(o.map(c=>this._imageSrc({url:i,filter:t,operation:e,value:c}))),{cancel:a}=fi(n);this._cancelBatchPreload=a}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=j({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=j({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:t,value:e,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=o,typeof e!="number"&&!r){let a=await this._imageSrc({operation:t,value:e});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Al(t,e).map(a=>this._constructKeypoint(t,a))),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=j({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(ho,"EditorImageFader");var Cr=ho;var fu=1,po=class po extends x{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>fu?this.scrollLeft+=e:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};l(po,"EditorScroller");var gi=po;gi.template=y`<slot></slot>`;function mu(s){return`<uc-presence-toggle class="uc-tab-toggle" bind="visible: presence.tabToggle.${s}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${s}" data-id="${s}" icon="${s}" bind="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${s}" ></uc-btn-ui></uc-presence-toggle>`}l(mu,"renderTabToggle");function gu(s){return y`<uc-presence-toggle id="tab_${s}" class="uc-tab-content" bind="visible: presence.tabContent.${s}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${s}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}l(gu,"renderTabContent");var fo=class fo extends x{constructor(){super();h(this,"_updateInfoTooltip",P(()=>{var n,a;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===U.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(wt);else if(this.$["*tabId"]===U.TUNING&&e){o=!0;let c=(t==null?void 0:t[e])||ft[e].zero;r=this.l10n(e)+" "+c}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":wt,"*currentOperation":null,showLoader:!1,filters:Go,colorOperations:Ho,cropOperations:Xo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})},tab_role:"tab",[`tab_${U.TUNING}`]:`tab_${U.TUNING}`,[`tab_${U.CROP}`]:`tab_${U.CROP}`,[`tab_${U.FILTERS}`]:`tab_${U.FILTERS}`},this._debouncedShowLoader=P(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===U.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let e=new Se;return e.operation=t,e}_createFilterControl(t){let e=new ee;return e.filter=t,e}_createToggleControl(t){let e=new Te;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===U.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):t===U.FILTERS?[wt,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):t===U.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);r.appendChild(n)}),[...r.children].forEach((o,n)=>{n===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===U.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of Y){let o=r===t,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(ke(this.$["*originalUrl"],e,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=fi([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e!=null?e:null)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,o]of r.entries())if(o){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of Y){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(fo,"EditorToolbar");var bi=fo;bi.template=y`<uc-line-loader-ui bind="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" bind="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Y.map(gu).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" bind="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Y.map(mu).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" bind="onclick: on.cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" bind="onclick: on.apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" bind="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" bind="onclick: on.cancelSlider;" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" bind="onclick: on.applySlider;" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var mo=class mo extends x{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":""},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return j("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=`uc-${i}`)}),this.sub("text",()=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",i=>{this.$["aria-role"]=i||""}),this.defineAccessor("aria-controls",i=>{this.$["aria-controls"]=i||""})}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(mo,"BtnUi");var $e=mo;$e.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});$e.template=y`<button type="button" bind="@role:aria-role; @aria-controls: aria-controls"><uc-icon bind="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var go=class go extends x{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(go,"LineLoaderUi");var yi=go;yi.template=y`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var xr={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},bo=class bo extends x{constructor(){super(),this._visible=!1,this._visibleStyle=xr.visible,this._hiddenStyle=xr.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",yl(this,{[xr.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(xr.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};l(bo,"PresenceToggle");var _i=bo;_i.template=y`<slot></slot>`;var yo=class yo extends x{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",a.appendChild(u);for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this._zeroDotEl=p,e.innerHTML="",e.appendChild(a),this._stepsCount=n}destroyCallback(){var t;(t=this._observer)==null||t.disconnect()}};l(yo,"SliderUi");var vi=yo;vi.template=y`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" bind="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var _o=class _o extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new vt,e=this.$.cdnUrl,r=this.cfg.cropPreset,o=this.cfg.cloudImageEditorTabs;t.setAttribute(b.CTX_NAME_ATTR,this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),o&&t.setAttribute("tabs",o),t.addEventListener("apply",n=>{let a=n;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),t.addEventListener("cancel",n=>{let a=n;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),t.addEventListener("change",n=>{let a=n;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(_o,"CloudImageEditorActivity");var Ar=_o;var bu=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),El=l(function(s,i="i"){let t=s.split("*").map(bu);return new RegExp("^"+t.join(".+")+"$",i)},"wildcardRegexp");var yu=l(s=>Object.keys(s).reduce((t,e)=>{let r=s[e],o=Object.keys(r).reduce((n,a)=>{let c=r[a];return n+`${a}: ${c};`},"");return t+`${e}{${o}}`},""),"styleToCss");function Tl({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,secondaryColor:r,secondaryHover:o,secondaryForegroundColor:n,fontFamily:a,fontSize:c,radius:u}){let p=`solid 1px ${r}`;return yu({body:{color:s,"background-color":i,"font-family":a,"font-size":c},".side-bar":{background:"inherit","border-right":p},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":p},".list-table-body .list-items":{"border-bottom":p},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"},"input[type=submit], .button, button":{color:n,background:r,"box-shadow":"none",border:"none","border-radius":u},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":u,background:r,border:p}})}l(Tl,"buildStyles");var jt={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in jt){let t=jt[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Sl=l(function(s,i,t){s in jt||(jt[s]=[]),jt[s].push([i,t])},"registerMessage"),kl=l(function(s,i){s in jt&&(jt[s]=jt[s].filter(t=>t[0]!==i))},"unregisterMessage");function $l(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}l($l,"queryString");var vo=class vo extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.EXTERNAL);h(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:o})}this.$["*currentActivity"]=w.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let e=X(this.cfg.externalSourcesPreferredTypes);for(let r of e){let o=El(r);for(let[n,a]of Object.entries(t.alternatives))if(o.test(n))return a}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:Tl(t)})}remoteUrl(){var u,p;let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r}=this.cfg,{externalSourceType:o}=this.activityParams,a={lang:((p=(u=this.l10n("social-source-lang"))==null?void 0:u.split("-"))==null?void 0:p[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:e},c=new URL(`/window3/${o}`,r);return c.search=$l(a),c.toString()}mountIframe(){let t=Oi({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Sl("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&kl("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(vo,"ExternalSource");var wi=vo;wi.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon bind="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" bind="onclick: onCancel" l10n="cancel"></button><div></div><div bind="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" bind="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var wo=class wo extends k{constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Ii(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var e;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let a=this._createValidationInput();this.appendChild(a),this._validationInputElement=a}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let a=(e=t.errors[0])==null?void 0:e.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(a);return}let r=t.group?t.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let a of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=a,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};l(wo,"FormInput");var Er=wo;var Co=class Co extends w{};l(Co,"ActivityHeader");var Tr=Co;var xo=class xo extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.defineAccessor("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(o=>{e+=y`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=e})}};l(xo,"Select");var Ci=xo;Ci.template=y`<select ref="select" bind="innerHTML: selectHtml; onchange: onSelect"></select>`;var kr=class kr extends x{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};l(kr,"Copyright"),h(kr,"template",y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Sr=kr;var Ie=class Ie extends mt{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",i=>{this.set$({isHidden:M(i)})}),this.sub("*modalActive",i=>{this._lastModalActive!==i&&this.emit(i?O.MODAL_OPEN:O.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=i},!1)}};l(Ie,"FileUploaderRegular"),h(Ie,"styleAttrs",[...Z(Ie,Ie,"styleAttrs"),"uc-file-uploader-regular"]);var Oe=Ie;Oe.template=y`<uc-simple-btn bind="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" bind="onclick: *historyBack"></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></uc-modal><uc-progress-bar-common></uc-progress-bar-common>`;Oe.bindAttributes({headless:null});var Le=class Le extends mt{initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=w.activities.UPLOAD_LIST:this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};l(Le,"FileUploaderMinimal"),h(Le,"styleAttrs",[...Z(Le,Le,"styleAttrs"),"uc-file-uploader-minimal"]);var xi=Le;xi.template=y`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var Me=class Me extends mt{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=w.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let i=this.$["*history"];return i.length>1&&i[i.length-1]!==w.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(i.initActivity||w.activities.START_FROM)&&(this.$["*currentActivity"]=w.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};l(Me,"FileUploaderInline"),h(Me,"styleAttrs",[...Z(Me,Me,"styleAttrs"),"uc-file-uploader-inline"]);var Ai=Me;Ai.template=y`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" bind="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-progress-bar></uc-progress-bar><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var Ue=class Ue extends vt{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};l(Ue,"CloudImageEditor"),h(Ue,"styleAttrs",[...Z(Ue,Ue,"styleAttrs"),"uc-wgt-common"]);var $r=Ue;var _u=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Ir(s){for(let i in s){if(_u.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),s[i].reg&&s[i].reg(t)}}l(Ir,"defineComponents");var Ao="UC";async function Il(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ao]){t(window[Ao]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let o=window[Ao];i&&Ir(o),t(o)},document.head.appendChild(r)})}l(Il,"loadFileUploaderFrom");return Bl(vu);})();
|
|
26
|
+
"use strict";var UC=(()=>{var Pe=Object.defineProperty;var Ll=Object.getOwnPropertyDescriptor;var Ml=Object.getOwnPropertyNames;var Ul=Object.getPrototypeOf,Pl=Object.prototype.hasOwnProperty;var Rl=Reflect.get;var Dl=(s,i,t)=>i in s?Pe(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t;var l=(s,i)=>Pe(s,"name",{value:i,configurable:!0});var Fl=(s,i)=>{for(var t in i)Pe(s,t,{get:i[t],enumerable:!0})},Nl=(s,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Ml(i))!Pl.call(s,r)&&r!==t&&Pe(s,r,{get:()=>i[r],enumerable:!(e=Ll(i,r))||e.enumerable});return s};var Bl=s=>Nl(Pe({},"__esModule",{value:!0}),s);var h=(s,i,t)=>(Dl(s,typeof i!="symbol"?i+"":i,t),t),Ir=(s,i,t)=>{if(!i.has(s))throw TypeError("Cannot "+t)};var v=(s,i,t)=>(Ir(s,i,"read from private field"),t?t.call(s):i.get(s)),L=(s,i,t)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,t)},F=(s,i,t,e)=>(Ir(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t);var R=(s,i,t)=>(Ir(s,i,"access private method"),t),Z=(s,i,t)=>Rl(Ul(s),t,i);var vu={};Fl(vu,{ActivityBlock:()=>w,ActivityHeader:()=>Ar,BaseComponent:()=>Pt,Block:()=>x,BtnUi:()=>$e,CameraSource:()=>li,CloudImageEditor:()=>Sr,CloudImageEditorActivity:()=>Cr,CloudImageEditorBlock:()=>vt,Config:()=>Zn,Copyright:()=>Er,CropFrame:()=>ui,Data:()=>I,DropArea:()=>Ce,EditorCropButtonControl:()=>Te,EditorFilterControl:()=>ee,EditorImageCropper:()=>mi,EditorImageFader:()=>vr,EditorOperationControl:()=>Se,EditorScroller:()=>gi,EditorSlider:()=>di,EditorToolbar:()=>bi,ExternalSource:()=>wi,FileItem:()=>Ee,FileUploaderInline:()=>Ai,FileUploaderMinimal:()=>xi,FileUploaderRegular:()=>Oe,FormInput:()=>xr,Icon:()=>ge,Img:()=>pr,LineLoaderUi:()=>yi,Modal:()=>si,PACKAGE_NAME:()=>Zt,PACKAGE_VERSION:()=>Yt,PresenceToggle:()=>_i,ProgressBar:()=>ci,ProgressBarCommon:()=>ai,PubSub:()=>I,Select:()=>Ci,SimpleBtn:()=>_e,SliderUi:()=>vi,SolutionBlock:()=>mt,SourceBtn:()=>xe,SourceList:()=>fr,StartFrom:()=>ii,Symbiote:()=>Pt,UID:()=>lt,UploadCtxProvider:()=>gl,UploadList:()=>oi,UploaderBlock:()=>k,UrlSource:()=>ni,defineComponents:()=>kr,defineLocale:()=>ls,html:()=>y,loadFileUploaderFrom:()=>Il,toKebabCase:()=>fe});var b=Object.freeze({BIND_ATTR:"bind",ATTR_BIND_PX:"@",SHARED_CTX_PX:"*",PARENT_CTX_PX:"^",NAMED_CTX_SPLTR:"/",COMPUTED_PX:"+",CSS_DATA_PX:"--",CTX_NAME_ATTR:"ctx",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx",EL_REF_ATTR:"ref",AUTO_TAG_PX:"sym",LIST_ATTR:"itemize",LIST_ITEM_TAG_ATTR:"item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL_ATTR:"use-template",DEFAULT_SLOT_KEY:"__default__",TEXT_NODE_SKIP_ATTR:"skip-text-nodes",TEXT_NODE_OPEN_TOKEN:"{{",TEXT_NODE_CLOSE_TOKEN:"}}"});function zl(s){let i=l(t=>{var e;for(let r in t)((e=t[r])==null?void 0:e.constructor)===Object&&(t[r]=i(t[r]));return{...t}},"clone");return i(s)}l(zl,"cloneObj");var re,se,Ot,Lt,ie,Ei,Co,H=class H{constructor(i){L(this,re,void 0);L(this,se,void 0);L(this,Ot,void 0);i.constructor===Object?this.store=zl(i):(F(this,Ot,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var t,e;if(!v(this,Ot)&&!this.store.hasOwnProperty(i))return R(t=H,Lt,ie).call(t,"read",i),null;if(typeof i=="string"&&i.startsWith(b.COMPUTED_PX)){let r=this.store[i];if((r==null?void 0:r.constructor)!==Function){R(e=H,Lt,ie).call(e,"compute",i);return}this.__computedMap||(this.__computedMap={});let o=r();return Object.keys(this.__computedMap).includes(i)||(this.__computedMap[i]=o,this.notify(i)),o}else return this.store[i]}has(i){return v(this,Ot)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,t,e=!1){!e&&Object.keys(this.store).includes(i)||(this.store[i]=t,this.notify(i))}pub(i,t){var e,r;if(!v(this,Ot)&&!this.store.hasOwnProperty(i)){R(e=H,Lt,ie).call(e,"publish",i);return}if(i!=null&&i.startsWith(b.COMPUTED_PX)&&t.constructor!==Function){R(r=H,Lt,ie).call(r,"publish computed",i);return}!(this.store[i]===null||t===null)&&typeof this.store[i]!=typeof t&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof t}]`),this.store[i]=t,this.notify(i)}get proxy(){if(!v(this,se)){let i=Object.create(null);F(this,se,new Proxy(i,{set:(t,e,r)=>(this.pub(e,r),!0),get:(t,e)=>{this.read(e)}}))}return v(this,se)}multiPub(i){for(let t in i)this.pub(t,i[t])}notify(i){var e;let t=i==null?void 0:i.startsWith(b.COMPUTED_PX);if(this.callbackMap[i]){let r=this.read(i);this.callbackMap[i].forEach(o=>{o(r)}),t&&(this.__computedMap[i]=r)}!t&&R(e=H,Ei,Co).call(e,this,i)}sub(i,t,e=!0){var r;return!v(this,Ot)&&!this.store.hasOwnProperty(i)?(R(r=H,Lt,ie).call(r,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(t),e&&t(this.read(i)),{remove:()=>{this.callbackMap[i].delete(t),this.callbackMap[i].size||delete this.callbackMap[i]},callback:t})}set uid(i){!v(this,re)&&F(this,re,i)}get uid(){return v(this,re)}static registerCtx(i,t=Symbol()){let e=H.globalStore.get(t);return e?console.warn('PubSub: context UID "'+t+'" is already in use'):(e=new H(i),e.uid=t,H.globalStore.set(t,e)),e}static deleteCtx(i){H.globalStore.delete(i)}static getCtx(i,t=!0){return H.globalStore.get(i)||(t&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};re=new WeakMap,se=new WeakMap,Ot=new WeakMap,Lt=new WeakSet,ie=l(function(i,t){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+t)},"#warn"),Ei=new WeakSet,Co=l(function(i,t){this.globalStore.forEach(e=>{e.__computedMap&&Object.keys(e.__computedMap).forEach(r=>{if(e===i&&t===r)return;let o=`__${r}_timeout`;e[o]&&window.clearTimeout(e[o]),e[o]=window.setTimeout(()=>{let n=e.read(r);n!==e.__computedMap[r]&&(e.__computedMap[r]=n,e.notify(r))})})})},"#processComputed"),L(H,Lt),L(H,Ei),l(H,"PubSub");var I=H;I.globalStore=new Map;var xt=I;var xo="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Vl=xo.length-1,Or=class Or{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:xo.charAt(Math.random()*Vl);return t}};l(Or,"UID");var lt=Or;function Re(s,i,t){let e=!0,r,o=i.split(".");return o.forEach((n,a)=>{a<o.length-1?s=s[n]:r=n}),s?s[r]=t:e=!1,e}l(Re,"setNestedProp");function Lr(s){let i;return s.constructor===CSSStyleSheet?i=s:s.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(s)),i}l(Lr,"prepareStyleSheet");function Ao(s,i){[...s.querySelectorAll(`[${b.LIST_ATTR}]`)].filter(t=>!t.matches(`[${b.LIST_ATTR}] [${b.LIST_ATTR}]`)).forEach(t=>{var n,a;let e=t.getAttribute(b.LIST_ITEM_TAG_ATTR),r;for(e&&(r=window.customElements.get(e)),r||(r=(n=class extends i.Symbiote{constructor(){super(),e||(this.style.display="contents")}},l(n,"itemClass"),n),r.template=((a=t.querySelector("template"))==null?void 0:a.innerHTML)||t.innerHTML,r.reg(e));t.firstChild;)t.firstChild.remove();let o=t.getAttribute(b.LIST_ATTR);i.sub(o,c=>{if(!c){for(;t.firstChild;)t.firstChild.remove();return}let u=[...t.children],p,d=l(f=>{f.forEach((m,_)=>{if(u[_])if(u[_].set$)u[_].set$(m);else for(let C in m)u[_][C]=m[C];else{p||(p=new DocumentFragment);let C=new r;Object.assign((C==null?void 0:C.init$)||C,m),p.appendChild(C)}}),p&&t.appendChild(p);let g=u.slice(f.length,u.length);for(let m of g)m.remove()},"fillItems");if(c.constructor===Array)d(c);else if(c.constructor===Object){let f=[];for(let g in c){let m=c[g];Object.defineProperty(m,"_KEY_",{value:g,enumerable:!0}),f.push(m)}d(f)}else console.warn("Symbiote list data type error:"),console.log(c)}),t.removeAttribute(b.LIST_ATTR),t.removeAttribute(b.LIST_ITEM_TAG_ATTR)})}l(Ao,"itemizeProcessor");function jl(s,i){[...s.querySelectorAll(`[${b.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(b.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(b.EL_REF_ATTR)})}l(jl,"refProcessor");function Hl(s,i){[...s.querySelectorAll(`[${b.BIND_ATTR}]`)].forEach(t=>{t.getAttribute(b.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(p=>p.trim()),a=n[0],c;a.indexOf(b.ATTR_BIND_PX)===0&&(c=!0,a=a.replace(b.ATTR_BIND_PX,""));let u=n[1].split(",").map(p=>p.trim());for(let p of u){let d;p.startsWith("!!")?(d="double",p=p.replace("!!","")):p.startsWith("!")&&(d="single",p=p.replace("!","")),!i.has(p)&&i.allowTemplateInits&&(p.startsWith(b.ATTR_BIND_PX)?i.add(p,i.getAttribute(p.replace(b.ATTR_BIND_PX,""))):i.add(p,null)),i.sub(p,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):Re(t,a,f)||(t[b.SET_LATER_KEY]||(t[b.SET_LATER_KEY]=Object.create(null)),t[b.SET_LATER_KEY][a]=f)},!(i.ssrMode&&(a==="textContent"||c)))}}),t.removeAttribute(b.BIND_ATTR)})}l(Hl,"domBindProcessor");function Gl(s){let i,t=[],e=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:r=>{var o;return!((o=r.parentElement)!=null&&o.hasAttribute(b.TEXT_NODE_SKIP_ATTR))&&r.textContent.includes(b.TEXT_NODE_OPEN_TOKEN)&&r.textContent.includes(b.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=e.nextNode();)t.push(i);return t}l(Gl,"getTextNodesWithTokens");var Xl=l(function(s,i){Gl(s).forEach(e=>{let r=[],o;for(;e.textContent.includes(b.TEXT_NODE_CLOSE_TOKEN);)e.textContent.startsWith(b.TEXT_NODE_OPEN_TOKEN)?(o=e.textContent.indexOf(b.TEXT_NODE_CLOSE_TOKEN)+b.TEXT_NODE_CLOSE_TOKEN.length,e.splitText(o),r.push(e)):(o=e.textContent.indexOf(b.TEXT_NODE_OPEN_TOKEN),e.splitText(o)),e=e.nextSibling;r.forEach(n=>{let a=n.textContent.replace(b.TEXT_NODE_OPEN_TOKEN,"").replace(b.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(a)&&i.allowTemplateInits&&(a.startsWith(b.ATTR_BIND_PX)?(i.add(a,i.getAttribute(a.replace(b.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(a,null)),i.sub(a,c=>{n.textContent=c})})})},"txtNodesProcessor"),Eo=[Ao,jl,Hl,Xl];var Ti="'",oe='"',Wl=/\\([0-9a-fA-F]{1,6} ?)/g;function Kl(s){return(s[0]===oe||s[0]===Ti)&&(s[s.length-1]===oe||s[s.length-1]===Ti)}l(Kl,"hasLeadingTrailingQuotes");function ql(s){return(s[0]===oe||s[0]===Ti)&&(s=s.slice(1)),(s[s.length-1]===oe||s[s.length-1]===Ti)&&(s=s.slice(0,-1)),s}l(ql,"trimQuotes");function Zl(s){let i="",t="";for(var e=0;e<s.length;e++){let r=s[e+1];s[e]==="\\"&&r==='"'?(i+='\\"',e++):s[e]==='"'&&t!=="\\"?i+='\\"':i+=s[e],t=s[e]}return i}l(Zl,"escapeQuotes");function To(s){let i=s;Kl(s)&&(i=ql(i),i=i.replace(Wl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
|
|
27
|
+
`,"\\n"),i=Zl(i),i=oe+i+oe);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${s}`)}}l(To,"parseCssPropertyValue");var Yl=[b.LIST_ATTR,b.LIST_ITEM_TAG_ATTR,b.EL_REF_ATTR,b.USE_TPL_ATTR,b.CTX_NAME_ATTR,b.CTX_OWNER_ATTR];function y(s,...i){let t="";return s.forEach((e,r)=>{var o;if(t+=e,((o=i[r])==null?void 0:o.constructor)===Object){let n="";for(let a in i[r])Yl.includes(a)?t+=` ${a}="${i[r][a]}"`:n+=`${a}:${i[r][a]};`;n&&(t+=` ${b.BIND_ATTR}="${n}"`)}else i[r]&&(t+=i[r])}),t}l(y,"html");function at(s,...i){let t="",e=new CSSStyleSheet;return s.forEach((r,o)=>{t+=r+i[o]}),at.processors.forEach(r=>{t=r(t)}),at.clearProcessors(),e.replaceSync(t),e}l(at,"css");at.processors=[];at.clearProcessors=function(){at.processors=[]};at.useProcessor=function(...s){return at.processors=[...at.processors,...s],at};var So=0,De,Gt,Fe,Mt,ne,Ne,Ut,pt,Xt,Wt,N,Be,Ur,At,Ht,Si,ko,ki,$o,ze,Pr,$i,Io,Ve,Rr,et=class et extends HTMLElement{constructor(){super();L(this,Be);L(this,Si);L(this,ki);L(this,ze);L(this,$i);L(this,Ve);L(this,De,void 0);L(this,Gt,void 0);L(this,Fe,void 0);L(this,Mt,void 0);L(this,ne,void 0);L(this,Ne,void 0);L(this,Ut,void 0);L(this,pt,void 0);L(this,Xt,void 0);L(this,Wt,void 0);L(this,N,this.constructor);h(this,"updateCssData",l(()=>{var t;this.dropCssDataCache(),(t=v(this,Wt))==null||t.forEach(e=>{let r=this.getCssData(R(this,Ve,Rr).call(this,e),!0);r!==null&&this.$[e]!==r&&(this.$[e]=r)})},"updateCssData"));this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.ssrMode=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1,this.isVirtual=!1,this.allowTemplateInits=!0}get Symbiote(){return et}initCallback(){}renderCallback(){}render(t,e=this.renderShadow){let r;if((e||v(this,N).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let n=this.getAttribute(b.USE_TPL_ATTR);if(n){let a=this.getRootNode(),c=(a==null?void 0:a.querySelector(n))||document.querySelector(n);c?t=c.content.cloneNode(!0):console.warn(`Symbiote template "${n}" is not found...`)}}if(this.processInnerHtml||this.ssrMode)for(let n of this.tplProcessors)n(this,this);if(t||v(this,N).template){if(v(this,N).template&&!v(this,N).__tpl&&(v(this,N).__tpl=document.createElement("template"),v(this,N).__tpl.innerHTML=v(this,N).template),(t==null?void 0:t.constructor)===DocumentFragment)r=t;else if((t==null?void 0:t.constructor)===String){let n=document.createElement("template");n.innerHTML=t,r=n.content.cloneNode(!0)}else v(this,N).__tpl&&(r=v(this,N).__tpl.content.cloneNode(!0));for(let n of this.tplProcessors)n(r,this)}let o=l(()=>{var n;r&&this.isVirtual?this.replaceWith(r):r&&(e&&this.shadowRoot.appendChild(r)||this.appendChild(r)),R(this,Be,Ur).call(this),(n=this.renderCallback)==null||n.call(this)},"addFr");v(this,N).shadowStyleSheets&&(e=!0,this.shadowRoot.adoptedStyleSheets=[...v(this,N).shadowStyleSheets]),o()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return v(this,Gt)||(F(this,Gt,lt.generate()),this.style.setProperty(b.CSS_CTX_PROP,`'${v(this,Gt)}'`)),v(this,Gt)}get cssCtxName(){return this.getCssData(b.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(b.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||v(this,Fe)||this.autoCtxName;return F(this,Fe,t),t}get localCtx(){return v(this,Mt)||F(this,Mt,xt.registerCtx({})),v(this,Mt)}get sharedCtx(){return xt.getCtx(this.ctxName,!1)||xt.registerCtx({},this.ctxName)}sub(t,e,r=!0){var a;let o=l(c=>{v(this,ze,Pr)||e(c)},"subCb"),n=R(a=et,At,Ht).call(a,t,this);n.ctx.has(n.name)?this.allSubs.add(n.ctx.sub(n.name,o,r)):window.setTimeout(()=>{this.allSubs.add(n.ctx.sub(n.name,o,r))})}notify(t){var r;let e=R(r=et,At,Ht).call(r,t,this);e.ctx.notify(e.name)}has(t){var r;let e=R(r=et,At,Ht).call(r,t,this);return e.ctx.has(e.name)}add(t,e,r=!1){var n;let o=R(n=et,At,Ht).call(n,t,this);o.ctx.add(o.name,e,r)}add$(t,e=!1){for(let r in t)this.add(r,t[r],e)}get $(){if(!v(this,ne)){let t=Object.create(null);F(this,ne,new Proxy(t,{set:(e,r,o)=>{var a;let n=R(a=et,At,Ht).call(a,r,this);return n.ctx.pub(n.name,o),!0},get:(e,r)=>{var n;let o=R(n=et,At,Ht).call(n,r,this);return o.ctx.read(o.name)}}))}return v(this,ne)}set$(t,e=!1){for(let r in t){let o=t[r];e||![String,Number,Boolean].includes(o==null?void 0:o.constructor)?this.$[r]=o:this.$[r]!==o&&(this.$[r]=o)}}initAttributeObserver(){this.attributeMutationObserver||(this.attributeMutationObserver=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"){let r=b.ATTR_BIND_PX+e.attributeName;this.has(r)&&(this.$[r]=this.getAttribute(e.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){R(this,$i,Io).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(v(this,Ut)&&window.clearTimeout(v(this,Ut)),F(this,Ut,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);v(this,Mt)&&xt.deleteCtx(v(this,Mt).uid);for(let t of this.tplProcessors)this.tplProcessors.delete(t)},100))))}static reg(t,e=!1){t||(So++,t=`${b.AUTO_TAG_PX}-${So}`),this.__tag=t;let r=window.customElements.get(t);if(r){!e&&r!==this&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
|
|
28
|
+
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,r){var n;if(e===r)return;let o=(n=v(this,N).__attrDesc)==null?void 0:n[t];o?v(this,Ne)?this.$[o]=r:this.init$[o]=r:this[t]=r}getCssData(t,e=!1){if(v(this,pt)||F(this,pt,Object.create(null)),!Object.keys(v(this,pt)).includes(t)){v(this,Xt)||F(this,Xt,window.getComputedStyle(this));let r=v(this,Xt).getPropertyValue(t).trim();try{v(this,pt)[t]=To(r)}catch{!e&&console.warn(`CSS Data error: ${t}`),v(this,pt)[t]=null}}return v(this,pt)[t]}bindCssData(t,e=""){v(this,Wt)||F(this,Wt,new Set),v(this,Wt).add(t);let r=this.getCssData(R(this,Ve,Rr).call(this,t),!0);r===null&&(r=e),t.startsWith(b.CSS_DATA_PX)?this.localCtx.add(t,r):this.add(t,r)}dropCssDataCache(){F(this,pt,null),F(this,Xt,null)}defineAccessor(t,e,r){let o="#"+t;this[o]=this[t],Object.defineProperty(this,t,{set:n=>{this[o]=n,r?window.setTimeout(()=>{e==null||e(n)}):e==null||e(n)},get:()=>this[o]}),this[t]=this[o]}static addRootStyles(t){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(Lr(t))}static addShadowStyles(t){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(Lr(t))}static set rootStyles(t){this.rootStyleSheets=[],this.addRootStyles(t)}static set shadowStyles(t){this.shadowStyleSheets=[],this.addShadowStyles(t)}};De=new WeakMap,Gt=new WeakMap,Fe=new WeakMap,Mt=new WeakMap,ne=new WeakMap,Ne=new WeakMap,Ut=new WeakMap,pt=new WeakMap,Xt=new WeakMap,Wt=new WeakMap,N=new WeakMap,Be=new WeakSet,Ur=l(function(){var t;v(this,De)||(F(this,De,!0),(t=this.initCallback)==null||t.call(this))},"#initCallback"),At=new WeakSet,Ht=l(function(t,e){var n;let r,o;if(t.startsWith(b.SHARED_CTX_PX))r=e.sharedCtx,o=t.replace(b.SHARED_CTX_PX,"");else if(t.startsWith(b.PARENT_CTX_PX)){o=t.replace(b.PARENT_CTX_PX,"");let a=e;for(;a&&!((n=a==null?void 0:a.has)!=null&&n.call(a,o));)a=a.parentElement||a.parentNode||a.host;r=(a==null?void 0:a.localCtx)||e.localCtx}else if(t.includes(b.NAMED_CTX_SPLTR)){let a=t.split(b.NAMED_CTX_SPLTR);r=xt.getCtx(a[0]),o=a[1]}else t.startsWith(b.CSS_DATA_PX)?(r=e.localCtx,o=t,r.has(o)||e.bindCssData(o)):(r=e.localCtx,o=t);return{ctx:r,name:o}},"#parseProp"),Si=new WeakSet,ko=l(function(){return this.ctxOwner||this.hasAttribute(b.CTX_OWNER_ATTR)&&this.getAttribute(b.CTX_OWNER_ATTR)!=="false"},"#ctxOwner"),ki=new WeakSet,$o=l(function(){let t=v(this,N).__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(b.SHARED_CTX_PX))this.sharedCtx.add(e.replace(b.SHARED_CTX_PX,""),this.init$[e],v(this,Si,ko));else if(e.startsWith(b.ATTR_BIND_PX))this.localCtx.add(e,this.getAttribute(e.replace(b.ATTR_BIND_PX,""))||this.init$[e]),this.initAttributeObserver();else if(e.includes(b.NAMED_CTX_SPLTR)){let r=e.split(b.NAMED_CTX_SPLTR),o=r[0].trim(),n=r[1].trim();if(o&&n){let a=xt.getCtx(o,!1);a||(a=xt.registerCtx({},o)),a.add(n,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);F(this,Ne,!0)},"#initDataCtx"),ze=new WeakSet,Pr=l(function(){return!this.isVirtual&&!this.isConnected},"#noInit"),$i=new WeakSet,Io=l(function(){var t;if(!v(this,ze,Pr)){if(v(this,Ut)&&window.clearTimeout(v(this,Ut)),!this.connectedOnce){let e=(t=this.getAttribute(b.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(b.CSS_CTX_PROP,`'${e}'`),R(this,ki,$o).call(this),this[b.SET_LATER_KEY]){for(let r in this[b.SET_LATER_KEY])Re(this,r,this[b.SET_LATER_KEY][r]);delete this[b.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let r of Eo)this.addTemplateProcessor(r);if(this.pauseRender)R(this,Be,Ur).call(this);else{if(v(this,N).rootStyleSheets){let r=this.getRootNode();if(!r)return;let o=new Set([...r.adoptedStyleSheets,...v(this,N).rootStyleSheets]);r.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},"#initComponent"),Ve=new WeakSet,Rr=l(function(t){return t.split("--").map((e,r)=>r===0?"":e).join("--")},"#extractCssName"),L(et,At),l(et,"Symbiote"),h(et,"__tpl"),h(et,"template");var Mr=et,Pt=Mr;function Ii(s,i){for(let t in i)t.includes("-")?s.style.setProperty(t,i[t]):s.style[t]=i[t]}l(Ii,"applyStyles");function Oo(s,i){for(let t in i)i[t].constructor===Boolean?i[t]?s.setAttribute(t,""):s.removeAttribute(t):s.setAttribute(t,i[t])}l(Oo,"applyAttributes");function Oi(s={tag:"div"}){let i=document.createElement(s.tag);if(s.attributes&&Oo(i,s.attributes),s.styles&&Ii(i,s.styles),s.properties)for(let t in s.properties)i[t]=s.properties[t];return s.processors&&s.processors.forEach(t=>{t(i)}),s.children&&s.children.forEach(t=>{let e=Oi(t);i.appendChild(e)}),i}l(Oi,"create");function Lo(s,i){if(i.shadowRoot)return;let t=[...s.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(r=>{let o=r.getAttribute("name")||b.DEFAULT_SLOT_KEY;e[o]={slot:r,fr:document.createDocumentFragment()}}),i.initChildren.forEach(r=>{var n;let o=b.DEFAULT_SLOT_KEY;r instanceof Element&&r.hasAttribute("slot")&&(o=r.getAttribute("slot"),r.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(r)}),Object.values(e).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(o,r.slot)}else r.slot.remove()})}l(Lo,"slotProcessor");var Mo=l(s=>{if(typeof s!="string"||!s)return"";let i=s.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),Li=l((...s)=>s.filter(i=>typeof i=="string"&&i).map(i=>Mo(i)).join("/-/"),"joinCdnOperations"),G=l((...s)=>{let i=Li(...s);return i?`-/${i}/`:""},"createCdnUrlModifiers");function Mi(s){let i=new URL(s),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):r>=0&&(o=t.slice(r+1)),o}l(Mi,"extractFilename");function Ui(s){let i=new URL(s),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}l(Ui,"extractUuid");function Dr(s){let i=Po(s),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}l(Dr,"extractCdnUrlModifiers");function Uo(s){return Dr(s).split("/-/").filter(Boolean).map(t=>Mo(t))}l(Uo,"extractOperations");function Po(s){let i=new URL(s),t=Mi(s),e=Ro(t)?Do(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}l(Po,"trimFilename");function Ro(s){return s.startsWith("http")}l(Ro,"isFileUrl");function Do(s){let i=new URL(s);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}l(Do,"splitFileUrl");var D=l((s,i,t)=>{let e=new URL(Po(s));if(t=t||Mi(s),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Ro(t)){let r=Do(t);e.pathname=e.pathname+(i||"")+(r.pathname||""),e.search=r.search,e.hash=r.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},"createCdnUrl"),Rt=l((s,i)=>{let t=new URL(s);return t.pathname=i+"/",t.toString()},"createOriginalUrl");var X=l((s,i=",")=>s.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var it=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),No=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Jl(s,i){if(typeof i=="number"){let t=i;return it[s]!==t?`${s}/${t}`:""}if(typeof i=="boolean"){let t=i;return it[s]!==t?`${s}`:""}if(s==="filter"&&i){let{name:t,amount:e}=i;return it.filter===e?"":`${s}/${t}/${e}`}if(s==="crop"&&i){let{dimensions:t,coords:e}=i;return`${s}/${t.join("x")}/${e.join(",")}`}return""}l(Jl,"transformationToStr");function Dt(s){return Li(...No.filter(i=>typeof s[i]!="undefined"&&s[i]!==null).map(i=>{let t=s[i];return Jl(i,t)}).filter(i=>!!i))}l(Dt,"transformationsToOperations");var Pi=Li("format/auto","progressive/yes"),Et=l(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),Fo=l(()=>!0,"asBoolean"),Ql=l(([s,i])=>({name:s,amount:typeof i!="undefined"?Number(i):100}),"asFilter"),ta=l(([s,i])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:X(s,"x").map(Number),coords:X(i).map(Number)}},"asCrop"),ea=Object.freeze({enhance:Et,brightness:Et,exposure:Et,gamma:Et,contrast:Et,saturation:Et,vibrance:Et,warmth:Et,filter:Ql,mirror:Fo,flip:Fo,rotate:Et,crop:ta});function Bo(s){let i={};for(let t of s){let[e,...r]=t.split("/");if(!No.includes(e))continue;let o=e,n=ea[o];try{let a=n(r);i[o]=a}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
|
|
29
|
+
`))}}return i}l(Bo,"operationsToTransformations");var U=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Y=[U.CROP,U.TUNING,U.FILTERS],zo=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Vo=["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"],jo=["rotate","mirror","flip"],ft=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var Ho=l(s=>s?s.split(",").map(i=>i.trim()):[],"deserealizeCsv"),le=l(s=>s?s.join(","):"","serializeCsv");var ia="https://ucarecdn.com",ra="https://upload.uploadcare.com",sa="https://social.uploadcare.com",ct={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:le(Y),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:ia,baseUrl:ra,socialBaseUrl:sa,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var O=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"}),Fr=class Fr{constructor(i){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,t){var e;for(let r of this._targets)r.dispatchEvent(new CustomEvent(i,{detail:t}));(e=this._debugPrint)==null||e.call(this,()=>{let r=t&&typeof t=="object"?{...t}:t;return[`event "${i}"`,r]})}emit(i,t,{debounce:e}={}){if(typeof e!="number"&&!e){this._dispatch(i,typeof t=="function"?t():t);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let r=typeof e=="number"?e:20,o=window.setTimeout(()=>{this._dispatch(i,typeof t=="function"?t():t),this._timeoutStore.delete(i)},r);this._timeoutStore.set(i,o)}};l(Fr,"EventEmitter");var Ri=Fr;function P(s,i){let t,e=l((...r)=>{clearTimeout(t),t=setTimeout(()=>s(...r),i)},"debounced");return e.cancel=()=>{clearTimeout(t)},e}l(P,"debounce");var Go="--uploadcare-blocks-window-height",je=class je{static registerClient(i){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(i)}static unregisterClient(i){this.clientsRegistry.delete(i),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Go)}};l(je,"WindowHeightTracker"),h(je,"clientsRegistry",new Set),h(je,"flush",P(()=>{document.documentElement.style.setProperty(Go,`${window.innerHeight}px`)},100));var He=je;var Xo=l(s=>{var e;let i=new Intl.Locale(s),t="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?t=i.getTextInfo().direction:"textInfo"in i&&((e=i.textInfo)!=null&&e.direction)&&(t=i.textInfo.direction),t},"getLocaleDirection");var Di=l((s,i)=>new Intl.PluralRules(s).select(i),"getPluralForm");var oa=l(s=>s,"DEFAULT_TRANSFORMER"),Nr="{{",Ko="}}",Wo="plural:";function Ge(s,i,t={}){var n;let{openToken:e=Nr,closeToken:r=Ko,transform:o=oa}=t;for(let a in i){let c=(n=i[a])==null?void 0:n.toString();s=s.replaceAll(e+a+r,typeof c=="string"?o(c):c)}return s}l(Ge,"applyTemplateData");function qo(s){let i=[],t=s.indexOf(Nr);for(;t!==-1;){let e=s.indexOf(Ko,t),r=s.substring(t+2,e);if(r.startsWith(Wo)){let o=s.substring(t+2,e).replace(Wo,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a})}t=s.indexOf(Nr,e)}return i}l(qo,"getPluralObjects");function Zo(){let s,i,t=new Promise((e,r)=>{s=e,i=r});return{resolve:s,reject:i,promise:t}}l(Zo,"withResolvers");var Yo=l(async({element:s,attribute:i,timeout:t=300})=>{let{promise:e,resolve:r}=Zo(),o=s.getAttribute(i);if(o!==null)return r({success:!0,value:o,attribute:i}),e;let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(s,{attributes:!0,attributeFilter:[i]});let a=setTimeout(()=>{n.disconnect(),r({success:!1,attribute:i})},t),c=l(u=>{let p=s.getAttribute(i);u.type==="attributes"&&u.attributeName===i&&p!==null&&(clearTimeout(a),n.disconnect(),r({success:!0,value:p,attribute:i}))},"handleMutation");return e},"waitForAttribute");function Jo(s){return Object.prototype.toString.call(s)==="[object Object]"}l(Jo,"isObject");var na=/\W|_/g;function la(s){return s.split(na).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}l(la,"camelizeString");function Qo(s,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(s)?s.map(t=>kt(t,{ignoreKeys:i})):s}l(Qo,"camelizeArrayItems");function kt(s,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(s))return Qo(s,{ignoreKeys:i});if(!Jo(s))return s;let t={};for(let e of Object.keys(s)){let r=s[e];if(i.includes(e)){t[e]=r;continue}Jo(r)?r=kt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Qo(r,{ignoreKeys:i})),t[la(e)]=r}return t}l(kt,"camelizeKeys");var aa=l(s=>new Promise(i=>setTimeout(i,s)),"delay");function Xr({libraryName:s,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:s,libraryVersion:i,languageName:o,integration:r});let n=[s,i,e].filter(Boolean).join("/"),a=[o,r].filter(Boolean).join("; ");return`${n} (${a})`}l(Xr,"getUserAgent$1");var ca={factor:2,time:100};function ua(s,i=ca){let t=0;function e(r){let o=Math.round(i.time*i.factor**t);return r({attempt:t,retry:l(a=>aa(a!=null?a:o).then(()=>(t+=1,e(r))),"retry")})}return l(e,"runAttempt"),e(s)}l(ua,"retrier");var Jr=class Jr extends Error{};l(Jr,"UploadcareError");var Xe=Jr,Ni=class Ni extends Xe{constructor(t){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,Ni.prototype),this.originalProgressEvent=t}};l(Ni,"NetworkError");var ae=Ni,Vi=l((s,i)=>{s&&(s.aborted?Promise.resolve().then(i):s.addEventListener("abort",()=>i(),{once:!0}))},"onCancel"),Bi=class Bi extends Xe{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,Bi.prototype)}};l(Bi,"CancelError");var Ft=Bi,ha=500,en=l(({check:s,interval:i=ha,timeout:t,signal:e})=>new Promise((r,o)=>{let n,a;Vi(e,()=>{n&&clearTimeout(n),o(new Ft("Poll cancelled"))}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new Ft("Timed out"))},t));let c=l(()=>{try{Promise.resolve(s(e)).then(u=>{u?(a&&clearTimeout(a),r(u)):n=setTimeout(c,i)}).catch(u=>{a&&clearTimeout(a),o(u)})}catch(u){a&&clearTimeout(a),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),$={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},ji="application/octet-stream",rn="original",Nt=l(({method:s,url:i,data:t,headers:e={},signal:r,onProgress:o})=>new Promise((n,a)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,i,!0),e&&Object.entries(e).forEach(d=>{let[f,g]=d;typeof g!="undefined"&&!Array.isArray(g)&&c.setRequestHeader(f,g)}),c.responseType="text",Vi(r,()=>{p=!0,c.abort(),a(new Ft)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function(C){let E=C.split(": "),A=E.shift(),T=E.join(": ");A&&typeof A!="undefined"&&(g[A]=T)});let m=c.response,_=c.status;n({request:d,data:m,headers:g,status:_})}},c.onerror=d=>{p||a(new ae(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),t?c.send(t):c.send()}),"request");function da(s,...i){return s}l(da,"identity");var pa=l(({name:s})=>s?[s]:[],"getFileOptions"),fa=da,ma=l(()=>new FormData,"getFormData"),sn=l(s=>!1,"isBuffer"),Hi=l(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),Gi=l(s=>typeof File!="undefined"&&s instanceof File,"isFile"),Xi=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),ce=l(s=>Hi(s)||Gi(s)||sn()||Xi(s),"isFileData"),ga=l(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),ba=l(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),ya=l(s=>!!s&&typeof s=="object"&&"data"in s&&ce(s.data),"isFileValue");function on(s,i,t){if(Array.isArray(t))for(let e of t)on(s,`${i}[]`,e);else if(ya(t)){let{name:e,contentType:r}=t,o=fa(t.data,e,r!=null?r:ji),n=pa({name:e,contentType:r});s.push([i,o,...n])}else if(ba(t))for(let[e,r]of Object.entries(t))typeof r!="undefined"&&s.push([`${i}[${e}]`,String(r)]);else ga(t)&&t&&s.push([i,t.toString()])}l(on,"collectParams");function _a(s){let i=[];for(let[t,e]of Object.entries(s))on(i,t,e);return i}l(_a,"getFormDataParams");function Wi(s){let i=ma(),t=_a(s);for(let e of t){let[r,o,...n]=e;i.append(r,o,...n)}return i}l(Wi,"buildFormData");var zi=class zi extends Xe{constructor(t,e,r,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=t,this.code=e,this.request=r,this.response=o,this.headers=n,Object.setPrototypeOf(this,zi.prototype)}};l(zi,"UploadError");var W=zi,va=l(s=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(s))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>{var o;return(o=r[1])!=null?o:!1}).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Tt=l((s,i,t)=>{let e=new URL(s);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=va(t)),e.toString()},"getUrl"),wa="6.14.1",Ca="UploadcareUploadClient",xa=wa;function Kt(s){return Xr({libraryName:Ca,libraryVersion:xa,...s})}l(Kt,"getUserAgent");var Aa="RequestThrottledError",tn=15e3,Ea=1e3;function Ta(s){let{headers:i}=s||{};if(!i||typeof i["retry-after"]!="string")return tn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:tn}l(Ta,"getTimeoutFromThrottledRequest");function Bt(s,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return ua(({attempt:r,retry:o})=>s().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===Aa&&r<t)return o(Ta(n));if(n instanceof ae&&r<e)return o((r+1)*Ea);throw n}))}l(Bt,"retryIfFailed");var nn=l(s=>{let i="";return(Hi(s)||Gi(s)||Xi(s))&&(i=s.type),i||ji},"getContentType"),ln=l(s=>{let i="";return Gi(s)&&s.name?i=s.name:Hi(s)||sn()?i="":Xi(s)&&s.name&&(i=s.name),i||rn},"getFileName");function Wr(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}l(Wr,"getStoreValue");function Sa(s,{publicKey:i,fileName:t,contentType:e,baseURL:r=$.baseURL,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",url:Tt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},data:Wi({signature:o,expire:n,file:{data:s,name:t||ln(s),contentType:e||nn(s)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Wr(a),source:p,metadata:_}),signal:c,onProgress:u}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(Sa,"base");var Vr;(function(s){s.Token="token",s.FileInfo="file_info"})(Vr||(Vr={}));function ka(s,{publicKey:i,baseURL:t=$.baseURL,store:e,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},url:Tt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:s,store:Wr(e),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:c,source:u,metadata:_}),signal:p}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:g})}l(ka,"fromUrl");var J;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(J||(J={}));var $a=l(s=>"status"in s&&s.status===J.Error,"isErrorResponse");function Ia(s,{publicKey:i,baseURL:t=$.baseURL,signal:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=$.retryNetworkErrorMaxTimes}={}){return Bt(()=>Nt({method:"GET",headers:i?{"X-UC-User-Agent":Kt({publicKey:i,integration:r,userAgent:o})}:void 0,url:Tt(t,"/from_url/status/",{jsonerrors:1,token:s}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=kt(JSON.parse(c));if("error"in d&&!$a(d))throw new W(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}l(Ia,"fromUrlStatus");function Oa(s,{publicKey:i,baseURL:t=$.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:o,signal:n,source:a,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"POST",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:c,userAgent:u})},url:Tt(t,"/group/",{jsonerrors:1}),data:Wi({files:s,callback:e,pub_key:i,signature:r,expire:o,source:a}),signal:n}).then(({data:f,headers:g,request:m})=>{let _=kt(JSON.parse(f));if("error"in _)throw new W(_.error.content,_.error.errorCode,m,_,g);return _}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}l(Oa,"group");function an(s,{publicKey:i,baseURL:t=$.baseURL,signal:e,source:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"GET",headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:o,userAgent:n})},url:Tt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:s,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=kt(JSON.parse(u));if("error"in f)throw new W(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(an,"info");function La(s,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=$.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:g=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=$.retryNetworkErrorMaxTimes,metadata:_}){return Bt(()=>Nt({method:"POST",url:Tt(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:d,userAgent:f})},data:Wi({filename:e||rn,size:s,content_type:t||ji,part_size:r,UPLOADCARE_STORE:Wr(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:p,metadata:_}),signal:u}).then(({data:C,headers:E,request:A})=>{let T=kt(JSON.parse(C));if("error"in T)throw new W(T.error.content,T.error.errorCode,A,T,E);return T.parts=Object.keys(T.parts).map(B=>T.parts[Number(B)]),T}),{retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})}l(La,"multipartStart");function Ma(s,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:o=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"PUT",url:i,data:s,onProgress:r,signal:e,headers:{"Content-Type":t||ji}}).then(a=>(r&&r({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}l(Ma,"multipartUpload");function Ua(s,{publicKey:i,baseURL:t=$.baseURL,source:e="local",signal:r,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=$.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=$.retryNetworkErrorMaxTimes}){return Bt(()=>Nt({method:"POST",url:Tt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Kt({publicKey:i,integration:o,userAgent:n})},data:Wi({uuid:s,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=kt(JSON.parse(u));if("error"in f)throw new W(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(Ua,"multipartComplete");function Kr(s,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:c,onProgress:u}){return en({check:p=>an(s,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}l(Kr,"isReadyPoll");function Pa(s){return"defaultEffects"in s}l(Pa,"isGroupFileInfo");var Qr=class Qr{constructor(i,{baseCDN:t=$.baseCDN,fileName:e}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:r,s3Bucket:o}=i,n=Tt(t,`${r}/`),a=o?Tt(`https://${o}.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=o||null,this.s3Url=a,Pa(i)&&(this.defaultEffects=i.defaultEffects)}};l(Qr,"UploadcareFile");var St=Qr,Ra=l((s,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,contentType:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,baseCDN:_,metadata:C})=>Sa(s,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:C}).then(({file:E})=>Kr(E,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(E=>new St(E,{baseCDN:_})),"uploadDirect"),Da=l((s,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:o,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>an(s,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new St(f,{baseCDN:d,fileName:t})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),Fa=l((s,{signal:i}={})=>{let t=null,e=null,r=s.map(()=>new AbortController),o=l(n=>()=>{e=n,r.forEach((a,c)=>c!==n&&a.abort())},"createStopRaceCallback");return Vi(i,()=>{r.forEach(n=>n.abort())}),Promise.all(s.map((n,a)=>{let c=o(a);return Promise.resolve().then(()=>n({stopRace:c,signal:r[a].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Na=window.WebSocket,ts=class ts{constructor(){h(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(r=>r(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]=[]}};l(ts,"Events");var jr=ts,Ba=l((s,i)=>s==="success"?{status:J.Success,...i}:s==="progress"?{status:J.Progress,...i}:{status:J.Error,...i},"response"),es=class es{constructor(i,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new jr);h(this,"disconnectTimeoutId",null);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 Na(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,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,Ba(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=l(()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var r;let e=JSON.stringify({event:i,data:t});(r=this.ws)==null||r.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)}};l(es,"Pusher");var Hr=es,Br=null,qr=l(s=>{if(!Br){let i=typeof window=="undefined"?0:3e4;Br=new Hr(s,i)}return Br},"getPusher"),za=l(s=>{qr(s).connect()},"preconnect");function Va({token:s,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:c}){return en({check:u=>Ia(s,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case J.Error:return new W(p.error,p.errorCode);case J.Waiting:return!1;case J.Unknown:return new W(`Token "${s}" was not found.`);case J.Progress:return a&&(p.total==="unknown"?a({isComputable:!1}):a({isComputable:!0,value:p.done/p.total})),!1;case J.Success:return a&&a({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:c})}l(Va,"pollStrategy");var ja=l(({token:s,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,o)=>{let n=qr(i),a=n.onError(o),c=l(()=>{a(),n.unsubscribe(s)},"destroy");Vi(t,()=>{c(),o(new Ft("pusher cancelled"))}),n.subscribe(s,u=>{switch(u.status){case J.Progress:{e&&(u.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:u.done/u.total}));break}case J.Success:{c(),e&&e({isComputable:!0,value:u.done/u.total}),r(u);break}case J.Error:c(),o(new W(u.msg,u.error_code))}})}),"pushStrategy"),Ha=l((s,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,pusherKey:C=$.pusherKey,metadata:E})=>Promise.resolve(za(C)).then(()=>ka(s,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,store:u,signal:p,source:f,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,metadata:E})).catch(A=>{let T=qr(C);return T==null||T.disconnect(),Promise.reject(A)}).then(A=>A.type===Vr.FileInfo?A:Fa([({signal:T})=>Va({token:A.token,publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:d,signal:T}),({signal:T})=>ja({token:A.token,pusherKey:C,signal:T,onProgress:d})],{signal:p})).then(A=>{if(A instanceof W)throw A;return A}).then(A=>Kr(A.uuid,{publicKey:i,baseURL:e,integration:g,userAgent:m,retryThrottledRequestMaxTimes:_,onProgress:d,signal:p})).then(A=>new St(A,{baseCDN:r})),"uploadFromUrl"),zr=new WeakMap,Ga=l(async s=>{if(zr.has(s))return zr.get(s);let i=await fetch(s.uri).then(t=>t.blob());return zr.set(s,i),i},"getBlobFromReactNativeAsset"),cn=l(async s=>{if(Gi(s)||Hi(s))return s.size;if(Xi(s))return(await Ga(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Xa=l((s,i=$.multipartMinFileSize)=>s>=i,"isMultipart"),un=l(s=>{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!ce(s)&&t.test(s)},"isUuid"),Zr=l(s=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ce(s)&&t.test(s)},"isUrl"),Wa=l((s,i)=>new Promise((t,e)=>{let r=[],o=!1,n=i.length,a=[...i],c=l(()=>{let u=i.length-a.length,p=a.shift();p&&p().then(d=>{o||(r[u]=d,n-=1,n?c():t(r))}).catch(d=>{o=!0,e(d)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),Ka=l((s,i,t,e)=>{let r=e*i,o=Math.min(r+e,t);return s.slice(r,o)},"sliceChunk"),qa=l(async(s,i,t)=>e=>Ka(s,e,i,t),"prepareChunks"),Za=l((s,i,{publicKey:t,contentType:e,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})=>Ma(s,i,{publicKey:t,contentType:e,onProgress:r,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c}),"uploadPart"),Ya=l(async(s,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,contentType:_,multipartChunkSize:C=$.multipartChunkSize,maxConcurrentRequests:E=$.maxConcurrentRequests,baseCDN:A,metadata:T})=>{let B=e!=null?e:await cn(s),rt,ht=l((z,q)=>{if(!u)return;rt||(rt=Array(z).fill(0));let nt=l(dt=>dt.reduce((Ct,$r)=>Ct+$r,0),"sum");return dt=>{dt.isComputable&&(rt[q]=dt.value,u({isComputable:!0,value:nt(rt)/z}))}},"createProgressHandler");return _||(_=nn(s)),La(B,{publicKey:i,contentType:_,fileName:t||ln(s),baseURL:r,secureSignature:o,secureExpire:n,store:a,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,metadata:T}).then(async({uuid:z,parts:q})=>{let nt=await qa(s,B,C);return Promise.all([z,Wa(E,q.map((dt,Ct)=>()=>Za(nt(Ct),dt,{publicKey:i,contentType:_,onProgress:ht(q.length,Ct),signal:c,integration:d,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})))])}).then(([z])=>Ua(z,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m})).then(z=>z.isReady?z:Kr(z.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:g,retryNetworkErrorMaxTimes:m,onProgress:u,signal:c})).then(z=>new St(z,{baseCDN:A}))},"uploadMultipart");async function Yr(s,{publicKey:i,fileName:t,baseURL:e=$.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartMinFileSize:_,multipartChunkSize:C,maxConcurrentRequests:E,baseCDN:A=$.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:B,pusherKey:rt,metadata:ht}){if(ce(s)){let z=await cn(s);return Xa(z,_)?Ya(s,{publicKey:i,contentType:m,multipartChunkSize:C,fileSize:z,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A,metadata:ht}):Ra(s,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A,metadata:ht})}if(Zr(s))return Ha(s,{publicKey:i,fileName:t,baseURL:e,baseCDN:A,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:B,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,pusherKey:rt,metadata:ht});if(un(s))return Da(s,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:A});throw new TypeError(`File uploading from "${s}" is not supported`)}l(Yr,"uploadFile");var is=class is{constructor(i,{baseCDN:t=$.baseCDN}={}){h(this,"uuid");h(this,"filesCount");h(this,"totalSize");h(this,"isStored");h(this,"isImage");h(this,"cdnUrl");h(this,"files");h(this,"createdAt");h(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,o)=>r+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(r=>new St(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}};l(is,"UploadcareGroup");var Gr=is,Ja=l(s=>{for(let i of s)if(!ce(i))return!1;return!0},"isFileDataArray"),Qa=l(s=>{for(let i of s)if(!un(i))return!1;return!0},"isUuidArray"),tc=l(s=>{for(let i of s)if(!Zr(i))return!1;return!0},"isUrlArray");function hn(s,{publicKey:i,fileName:t,baseURL:e=$.baseURL,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_=$.multipartChunkSize,baseCDN:C=$.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:A,jsonpCallback:T}){if(!Ja(s)&&!tc(s)&&!Qa(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let B,rt=!0,ht=s.length,z=l((q,nt)=>{if(!c)return;B||(B=Array(q).fill(0));let dt=l(Ct=>Ct.reduce(($r,Ol)=>$r+Ol)/q,"normalize");return Ct=>{if(!Ct.isComputable||!rt){rt=!1,c({isComputable:!1});return}B[nt]=Ct.value,c({isComputable:!0,value:dt(B)})}},"createProgressHandler");return Promise.all(s.map((q,nt)=>ce(q)||Zr(q)?Yr(q,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:o,store:n,signal:a,onProgress:z(ht,nt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:m,multipartChunkSize:_,baseCDN:C,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:A}).then(dt=>dt.uuid):q)).then(q=>Oa(q,{publicKey:i,baseURL:e,jsonpCallback:T,secureSignature:r,secureExpire:o,signal:a,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g}).then(nt=>new Gr(nt,{baseCDN:C})).then(nt=>(c&&c({isComputable:!0,value:1}),nt)))}l(hn,"uploadFileGroup");var rs=class rs{constructor(i){h(this,"_concurrency",1);h(this,"_pending",[]);h(this,"_running",0);h(this,"_resolvers",new Map);h(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t<i;t++){let e=this._pending.shift();if(!e)return;let r=this._resolvers.get(e),o=this._rejectors.get(e);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,e().finally(()=>{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(n=>r(n)).catch(n=>o(n))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};l(rs,"Queue");var Fi=rs;var ss=l(()=>({}),"blockCtx"),os=l(s=>({...ss(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{s.set$({"*currentActivity":null,"*modalActive":!1})}}),"activityBlockCtx"),Ki=l(s=>({...os(s),"*commonProgress":0,"*uploadList":[],"*focusedEntry":null,"*uploadQueue":new Fi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var We={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"Selected:","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-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","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 ocurred. 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 button","file-item-remove-button":"Remove button"};var qi=new Map,ns=new Map,dn=l((s,i)=>{qi.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),qi.set(s,{...We,...i})},"defineLocaleSync"),ec=l((s,i)=>{ns.set(s,i)},"defineLocaleAsync"),ls=l((s,i)=>{typeof i=="function"?ec(s,i):dn(s,i)},"defineLocale"),pn=l(async s=>{if(!qi.has(s)){if(!ns.has(s))throw new Error(`Locale ${s} is not defined`);let t=await ns.get(s)();dn(s,t)}return qi.get(s)},"resolveLocaleDefinition");ls("en",We);var $t=l(s=>`*l10n/${s}`,"localeStateKey"),ic="en",as=class as{constructor(i){h(this,"_blockInstance",null);h(this,"_localeName","");h(this,"_callbacks",new Set);h(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[t,e]of Object.entries(We))this._blockInstance.add($t(t),e,!1);setTimeout(()=>{i.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let e=await pn(t);if(t!==ic&&this._localeName!==t)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,a]of Object.entries(e)){let c=r==null?void 0:r[n];this._blockInstance.add($t(n),c!=null?c:a,!0);for(let u of this._callbacks)u()}}),i.subConfigValue("localeDefinitionOverride",t=>{var r;if(!t)return;let e=t[this._localeName];if(e)for(let[o,n]of Object.entries(e)){(r=this._blockInstance)==null||r.add($t(o),n,!0);for(let a of this._callbacks)a()}})})}onLocaleChange(i){let t=P(i,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(i,t,e){var o,n,a;i.$[t]=e(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(t))==null||n();let r=this.onLocaleChange(()=>{i.$[t]=e()});(a=this._boundBlocks.get(i))==null||a.set(t,r)}destroyL10nBindings(i){let t=this._boundBlocks.get(i);if(t){for(let e of t.values())e();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};l(as,"LocaleManager");var Zi=as;var rc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ke(s,i){i.tabIndex=0,i.focus(),s.tabIndex=-1}l(Ke,"focus");function cs(s){let i=s.role||s.type||s.tagName;if(!i)return null;let t=rc[i.toLowerCase()];if(!t)return null;for(let e of t){let r=s.closest(`[role=${e}]`);if(r)return r}}l(cs,"findGroupNodeByEventTarget");function us(s,i){return i.role==="toolbar"?sc(i):i.querySelectorAll(`[role=${s.role}]`)}l(us,"getItems");function sc(s){return[...s.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}l(sc,"getToolbarItems");function oc(s){let i=s.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let t=s.role;return t==="menubar"||t==="tablist"||t==="toolbar"}l(oc,"isHorizontalOrientation");function fn(s){return i=>{let t=!1,e=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function n(d){let f=cs(d.target);if(!f){a();return}let g=us(d.target,f),m=Array.from(g).indexOf(d.target),_="ArrowDown",C="ArrowUp";if(oc(f)&&(i.document.dir==="rtl"?(_="ArrowLeft",C="ArrowRight"):(_="ArrowRight",C="ArrowLeft")),d.key===_)d.preventDefault(),Ke(d.target,g[m+1]||g[0]);else if(d.key===C)d.preventDefault(),Ke(d.target,g[m-1]||g[g.length-1]);else if(d.key==="Home")d.preventDefault(),Ke(d.target,g[0]);else if(d.key==="End")d.preventDefault(),Ke(d.target,g[g.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let E=Date.now();E-r<=e?o+=d.key.toLowerCase():o=d.key.toLowerCase(),r=E;let A=Array.from(g).find(T=>{var B,rt,ht;return(ht=(rt=(B=T.textContent)==null?void 0:B.trim())==null?void 0:rt.toLowerCase())==null?void 0:ht.startsWith(o)});A&&(d.preventDefault(),Ke(d.target,A))}}l(n,"keyDown");function a(){t=!1,i.removeEventListener("keydown",n)}l(a,"stop");function c(d){let f=cs(d.target);if(f){t||(t=!0,i.addEventListener("keydown",n));let g=us(d.target,f);for(let m of g)m!==d.target&&m.setAttribute("tabindex",-1)}else t&&a()}l(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&a()}l(u,"focusOut");function p(d){let f=cs(d.target);if(f){let g=us(d.target,f);for(let m of g)m!==d.target&&m.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return l(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{a(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u)}}}l(fn,"focusGroupKeyUX");function mn(){return s=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=!1);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0)}}l(e,"jump");function r(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=!0),i=null)}return l(r,"focusOut"),s.addEventListener("keyuxJump",e),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",e),s.removeEventListener("focusout",r)}}}l(mn,"hiddenKeyUX");function gn(){return s=>{let i=[];function t(u){let p=s.document.activeElement;p&&p!==s.document.body&&i.push(new WeakRef(p)),u.focus({focusVisible:!0})}l(t,"focus");function e(){let u=i.pop();if(!u){s.document.activeElement.blur();return}let p=u.deref();p&&p.isConnected?p.focus():e()}l(e,"back");let r=0,o;function n(u){clearInterval(o);let p=u.getAttribute("aria-controls");p&&(o=setInterval(()=>{if(r++>50){clearInterval(o);return}let d=s.document.getElementById(p);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),d.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:!0})),t(f))}},50))}l(n,"jump");function a(u){u.clientX===0&&u.clientY===0&&n(u.target)}l(a,"click");function c(u){u.target.tagName==="INPUT"&&u.key==="Enter"&&n(u.target),u.key==="Escape"&&e()}return l(c,"keyDown"),s.addEventListener("click",a),s.addEventListener("keydown",c),()=>{s.removeEventListener("click",a),s.removeEventListener("keydown",c)}}}l(gn,"jumpKeyUX");function bn(s){let i,t=s.split(" ");function e(){i&&i.classList.remove(...t)}l(e,"keyUp");function r(o){o.clientX===0&&o.clientY===0&&(e(),o.target.classList.add(...t),i=o.target)}return l(r,"click"),o=>(o.addEventListener("keyup",e),o.addEventListener("click",r),()=>{o.removeEventListener("keyup",e),o.removeEventListener("click",r)})}l(bn,"pressKeyUX");function yn(s,i){let t=i.map(e=>e(s));return()=>{t.forEach(e=>e())}}l(yn,"startKeyUX");var ds=class ds{constructor(){h(this,"_listeners",new Map);h(this,"_scope",[])}addEventListener(i,t){let e=l(r=>{let o=r.target;o&&this._scope.some(n=>n===r.target||n.contains(o))&&t(r)},"wrappedListener");this._listeners.set(t,e),window.addEventListener(i,e)}removeEventListener(i,t){let e=this._listeners.get(t);e&&window.removeEventListener(i,e),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._scope.push(i)}destroy(){this._scope=[],this._listeners.forEach((i,t)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(t)})}};l(ds,"ScopedMinimalWindow");var hs=ds,ps=class ps{constructor(){h(this,"_destroyKeyUX");h(this,"_scopedWindow");this._scopedWindow=new hs,this._destroyKeyUX=yn(this._scopedWindow,[fn(),bn("is-pressed"),gn(),mn()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};l(ps,"A11y");var Yi=ps;function _n(s,i){[...s.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n");if(!e)return;let r="textContent",o=!1;if(e.includes(":")){let c=e.split(":");r=c[0],e=c[1],r.startsWith("@")&&(r=r.slice(1),o=!0)}let n=e;i.has(n)&&i.sub(n,c=>{if(!c)return;i.l10nProcessorSubs.has(n)||i.l10nProcessorSubs.set(n,new Set);let u=i.l10nProcessorSubs.get(n);u==null||u.forEach(f=>{f.remove(),u.delete(f),i.allSubs.delete(f)});let p=$t(c).replace("*","");i.sharedCtx.has(p)||i.sharedCtx.add(p,c);let d=i.sharedCtx.sub(p,()=>{t[r]=i.l10n(c)});u==null||u.add(d),i.allSubs.add(d),t.removeAttribute("l10n")});let a=$t(e);i.has(a)||i.add(a,""),i.sub(a,()=>{e=e,o?t.setAttribute(r,i.l10n(e)):t[r]=i.l10n(e)}),t.removeAttribute("l10n")})}l(_n,"l10nProcessor");var Q=l(s=>`*cfg/${s}`,"sharedConfigKey");var fs="set";function vn(s){[...s.querySelectorAll(`[${fs}]`)].forEach(i=>{let t=i.getAttribute(fs);t&&(i.removeAttribute(fs),i.setAttribute(b.BIND_ATTR,t))})}l(vn,"bindCompatibilityFallbackProcessor");var nc="uc-",wn="ctx-name",qe=class qe extends Pt{constructor(){super();h(this,"requireCtxName",!1);h(this,"activityType",null);h(this,"init$",ss());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(_n),this.addTemplateProcessor(Lo),this.tplProcessors=new Set([vn,...this.tplProcessors])}l10n(t,e={}){if(!t)return"";let r=this.$[$t(t)]||t,o=qo(r);for(let a of o)e[a.variable]=this.pluralize(a.pluralKey,Number(e[a.countVariable]));return Ge(r,e)}pluralize(t,e){let r=this.l10n("locale-id")||"en",o=Di(r,e);return this.l10n(`${t}__${o}`)}bindL10n(t,e){var r;(r=this.localeManager)==null||r.bindL10n(this,t,e)}emit(t,e,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,e,r)}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Yo({element:this,attribute:wn}).then(e=>{if(e.success){let r=e.value;this.style.setProperty(b.CSS_CTX_PROP,`'${r}'`),this.setAttribute(b.CTX_NAME_ATTR,r),super.connectedCallback()}else console.error(`Attribute "${wn}" is required and it is not set.`)}):super.connectedCallback(),He.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),He.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Ri(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Zi(this)),this.has("*a11y")||this.add("*a11y",new Yi),this.sub($t("locale-id"),e=>{let r=Xo(e);this.style.direction=r==="ltr"?"":r})}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var e;let t=this.blocksRegistry;t==null||t.delete(this),(e=this.localeManager)==null||e.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,I.deleteCtx(this.localCtx.uid),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;I.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}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:Ui(t),cdnUrlModifiers:Dr(t),fileName:Mi(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),t}return this.cfg.secureDeliveryProxy?Ge(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,r,o)=>{if(typeof r!="string")return!1;let n=Q(r);return this.has(n)||this.add(n,ct[r]),this.$[n]=o,!0},get:(e,r)=>{let o=Q(r);return this.has(o)||this.add(o,ct[r]),this.$[Q(r)]}})}return this.__cfgProxy}subConfigValue(t,e){let r=Q(t);this.has(r)||this.add(r,ct[t]),this.sub(r,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof(t==null?void 0:t[0])=="function"){let r=t[0];e=r()}console.log(`[${this.ctxName}]`,...e)}static reg(t){if(!t){super.reg();return}t.startsWith(nc)&&super.reg(t)}};l(qe,"Block"),h(qe,"StateConsumerScope",null),h(qe,"styleAttrs",[]);var x=qe;var Cn="<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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></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 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 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 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 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 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='apuc-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(#apuc-icon-id__a)'/></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 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 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 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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-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(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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='asuc-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 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><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 Ji=class Ji extends x{constructor(){super(...arguments);h(this,"requireCtxName",!0);h(this,"init$",Ki(this));h(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=Cn+t+"<slot></slot>"}static get template(){return this._template}};l(Ji,"SolutionBlock"),h(Ji,"styleAttrs",["uc-wgt-common"]);var mt=Ji;var xn="active",Ze="___ACTIVITY_IS_ACTIVE___",gt=class gt extends x{constructor(){super(...arguments);h(this,"historyTracked",!1);h(this,"init$",os(this));h(this,"_debouncedHistoryFlush",P(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=gt._activityCallbacks.get(this);this[Ze]=!1,this.removeAttribute(xn),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=gt._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=!0,this.setAttribute(xn,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush(),this.emit(O.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{this.activityType,this.activityType!==t&&this[Ze]?this._deactivate():this.activityType===t&&!this[Ze]&&this._activate(),t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){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)}_isActivityRegistered(){return this.activityType&>._activityCallbacks.has(this)}get isActivityActive(){return this[Ze]}get couldOpenActivity(){return!0}registerActivity(t,e={}){let{onActivate:r,onDeactivate:o}=e;gt._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),gt._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof gt&&r.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var e;let t=this.$["*history"];if(t){let r=t.pop();for(;r===this.activityType;)r=t.pop();let o=!!r;if(r){let n=[...this.blocksRegistry].find(a=>a.activityType===r);o=(e=n==null?void 0:n.couldOpenActivity)!=null?e:!1}r=o?r:void 0,this.$["*currentActivity"]=r,this.$["*history"]=t,r||this.setOrAddState("*modalActive",!1)}}};l(gt,"ActivityBlock"),h(gt,"_activityCallbacks",new Map);var w=gt;w.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external",DETAILS:"details"});var Ye=33.333333333333336,S=1,ms=24,An=6;function qt(s,i){for(let t in i)s.setAttributeNS(null,t,i[t].toString())}l(qt,"setSvgNodeAttrs");function st(s,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",s);return qt(t,i),t}l(st,"createSvgNode");function En(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=i.includes("w")?0:1,c=i.includes("n")?0:1,u=[-1,1][a],p=[-1,1][c],d=[e+a*o+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+a*o+1.5*u,r+c*n+1.5*p],g=[e+a*o-24*t*u+1.5*u,r+c*n+1.5*p];return{d:`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}l(En,"cornerPath");function Tn(s,i,t){let{x:e,y:r,width:o,height:n}=s,a=["n","s"].includes(i)?.5:{w:0,e:1}[i],c=["w","e"].includes(i)?.5:{n:0,s:1}[i],u=[-1,1][a],p=[-1,1][c],d,f;["n","s"].includes(i)?(d=[e+a*o-34*t/2,r+c*n+1.5*p],f=[e+a*o+34*t/2,r+c*n+1.5*p]):(d=[e+a*o+1.5*u,r+c*n-34*t/2],f=[e+a*o+1.5*u,r+c*n+34*t/2]);let g=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]}`,m=[f[0]-(f[0]-d[0])/2,f[1]-(f[1]-d[1])/2];return{d:g,center:m}}l(Tn,"sidePath");function Sn(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}l(Sn,"thumbCursor");function kn({rect:s,delta:[i,t],imageBox:e}){return he({...s,x:s.x+i,y:s.y+t},e)}l(kn,"moveRect");function he(s,i){let{x:t}=s,{y:e}=s;return s.x<i.x?t=i.x:s.x+s.width>i.x+i.width&&(t=i.x+i.width-s.width),s.y<i.y?e=i.y:s.y+s.height>i.y+i.height&&(e=i.y+i.height-s.height),{...s,x:t,y:e}}l(he,"constraintRect");function lc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;o+=r,a-=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o<=e.y&&(o=e.y,a=s.y+s.height-o,t&&(n=a*t,c=s.x+s.width/2-n/2)),c<=e.x&&(c=e.x,o=s.y+s.height-a),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(a=n/t),o=s.y+s.height-a),a<S&&(a=S,t&&(n=a*t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),n<S&&(n=S,t&&(a=n/t,c=s.x+s.width/2-n/2),o=s.y+s.height-a),{x:c,y:o,width:n,height:a}}l(lc,"resizeNorth");function ac({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;o+=r,n-=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o<=e.x&&(o=e.x,n=s.x+s.width-o,t&&(a=n/t,c=s.y+s.height/2-a/2)),c<=e.y&&(c=e.y,o=s.x+s.width-n),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(n=a*t),o=s.x+s.width-n),a<S&&(a=S,t&&(n=a*t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),n<S&&(n=S,t&&(a=n/t),c=s.y+s.height/2-a/2,o=s.x+s.width-n),{x:o,y:c,width:n,height:a}}l(ac,"resizeWest");function cc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:o,width:n,height:a}=s;a+=r,t&&(n=a*t);let c=s.x+s.width/2-n/2;return o+a>=e.y+e.height&&(a=e.y+e.height-o,t&&(n=a*t),c=s.x+s.width/2-n/2),c<=e.x&&(c=e.x,o=s.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(a=n/t),o=s.y),a<S&&(a=S,t&&(n=a*t),c=s.x+s.width/2-n/2),n<S&&(n=S,t&&(a=n/t),c=s.x+s.width/2-n/2),{x:c,y:o,width:n,height:a}}l(cc,"resizeSouth");function uc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:o,width:n,height:a}=s;n+=r,t&&(a=n/t);let c=s.y+s.height/2-a/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(a=n/t),c=s.y+s.height/2-a/2),c<=e.y&&(c=e.y,o=s.x),c+a>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-c,t&&(n=a*t),o=s.x),a<S&&(a=S,t&&(n=a*t),c=s.y+s.height/2-a/2),n<S&&(n=S,t&&(a=n/t),c=s.y+s.height/2-a/2),{x:o,y:c,width:n,height:a}}l(uc,"resizeEast");function hc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+r<e.x&&(r=e.x-n),a+o<e.y&&(o=e.y-a),n+=r,c-=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=e.y&&(u=u-(e.y-a),c=u*t,n=s.x+s.width-c,a=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,a=s.y+s.height-u)),u<S&&(u=S,t&&(c=u*t),n=s.x+s.width-c,a=s.y+s.height-u),c<S&&(c=S,t&&(u=c/t),n=s.x+s.width-c,a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(hc,"resizeNorthWest");function dc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),a+o<e.y&&(o=e.y-a),c+=r,a+=o,u-=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a-=o,a<=e.y&&(u=u-(e.y-a),c=u*t,n=s.x,a=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,a=s.y+s.height-u)),u<S&&(u=S,t&&(c=u*t),a=s.y+s.height-u),c<S&&(c=S,t&&(u=c/t),a=s.y+s.height-u),{x:n,y:a,width:c,height:u}}l(dc,"resizeNorthEast");function pc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+r<e.x&&(r=e.x-n),a+u+o>e.y+e.height&&(o=e.y+e.height-a-u),n+=r,c-=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=e.y+e.height&&(u=e.y+e.height-a,c=u*t,n=s.x+s.width-c,a=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,a=s.y)),u<S&&(u=S,t&&(c=u*t),n=s.x+s.width-c),c<S&&(c=S,t&&(u=c/t),n=s.x+s.width-c),{x:n,y:a,width:c,height:u}}l(pc,"resizeSouthWest");function fc({rect:s,delta:i,aspectRatio:t,imageBox:e}){let[r,o]=i,{x:n,y:a,width:c,height:u}=s;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),a+u+o>e.y+e.height&&(o=e.y+e.height-a-u),c+=r,u+=o,t&&Math.abs(c/u)>t?(o=c/t-u,u+=o,a+u>=e.y+e.height&&(u=e.y+e.height-a,c=u*t,n=s.x,a=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,a=s.y)),u<S&&(u=S,t&&(c=u*t)),c<S&&(c=S,t&&(u=c/t)),{x:n,y:a,width:c,height:u}}l(fc,"resizeSouthEast");function $n({direction:s,...i}){switch(s){case"n":return lc(i);case"w":return ac(i);case"s":return cc(i);case"e":return uc(i);case"nw":return hc(i);case"ne":return dc(i);case"sw":return pc(i);case"se":return fc(i);default:return i.rect}}l($n,"resizeRect");function In(s,[i,t]){return s.x<=i&&i<=s.x+s.width&&s.y<=t&&t<=s.y+s.height}l(In,"rectContainsPoint");function On(s,i){return s.x>=i.x&&s.y>=i.y&&s.x+s.width<=i.x+i.width&&s.y+s.height<=i.y+i.height}l(On,"isRectInsideRect");function Ln(s,i){return Math.abs(s.width/s.height-i)<.1}l(Ln,"isRectMatchesAspectRatio");function de({width:s,height:i},t){let e=t/90%2!==0;return{width:e?i:s,height:e?s:i}}l(de,"rotateSize");function Mn(s,i,t){let e=s/i,r,o;e>t?(r=Math.round(i*t),o=i):(r=s,o=Math.round(s/t));let n=Math.round((s-r)/2),a=Math.round((i-o)/2);return n+r>s&&(r=s-n),a+o>i&&(o=i-a),{x:n,y:a,width:r,height:o}}l(Mn,"calculateMaxCenteredCropFrame");function pe(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}l(pe,"roundRect");function zt(s,i,t){return Math.min(Math.max(s,i),t)}l(zt,"clamp");var tr=l(s=>{if(!s)return[];let[i,t]=s.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:i,height:t}]},"parseCropPreset");var Zt="blocks",Yt="1.2.0";function Un(s){return Xr({...s,libraryName:Zt,libraryVersion:Yt})}l(Un,"customUserAgent");var Pn=l(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Rn=l((s,{threshold:i})=>{let{secureExpire:t}=s,e=Pn(Date.now()),r=Number(t),o=Pn(i);return e+o>=r},"isSecureTokenExpired");var gs=class gs{constructor(i){h(this,"_block");h(this,"_secureToken",null);this._block=i}_debugPrint(...i){this._block.debugPrint("[secure-uploads]",...i)}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this._block.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this._secureToken||Rn(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let r=await e();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this._debugPrint("Secure signature resolved:",r),this._debugPrint("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this._secureToken=r):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r)}}return this._secureToken}return i&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};l(gs,"SecureUploadsManager");var er=gs;var Dn="[Typed State] Wrong property name: ",mc="[Typed State] Wrong property type: ",bs=class bs{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||lt.generate(),this.__schema=Object.keys(i).reduce((e,r)=>(e[r]=i[r].value,e),{}),this.__data=I.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Dn+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(mc+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(Dn+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){I.deleteCtx(this.__ctxId)}};l(bs,"TypedData");var ir=bs;var ys=class ys{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||lt.generate(),this.__data=I.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){var t;(t=this.__collectionObservers)==null||t.delete(i)}add(i){let t=new ir(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),t.uid}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){var t;(t=this.__propertyObservers)==null||t.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let r=this.read(e);i(r)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){I.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};l(ys,"TypedCollection");var rr=ys;var tt=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Je=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],sr=l(s=>s?s.filter(i=>typeof i=="string").map(i=>X(i)).flat():[],"mergeFileTypes"),_s=l((s,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),s.startsWith(t)):s===t),"matchMimeType"),Fn=l((s,i)=>i.some(t=>t.startsWith(".")?s.toLowerCase().endsWith(t.toLowerCase()):!1),"matchExtension"),Nn=l(s=>{let i=s==null?void 0:s.type;return i?_s(i,Je):!1},"fileIsImage");var gc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,bc=new RegExp(`^/?(${gc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Bn=l(({url:s,cdnBase:i})=>{let t=new URL(i),e=new URL(s);if(t.host!==e.host)return null;let[,r,o,n]=bc.exec(e.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:n||null}},"parseCdnUrl");var zn=l(s=>{let i=new Map;return(...t)=>{let e=JSON.stringify(t);if(i.has(e))return i.get(e);let r=s(...t);return i.set(e,r),r}},"memoize");var Vn=new Set;function jn(s){Vn.has(s)||(Vn.add(s),console.warn(s))}l(jn,"warnOnce");function yc(s){let i=!1;return setTimeout(()=>{i=!0},0),l(e=>(...r)=>(i&&jn(s),e(...r)),"withAssert")}l(yc,"createAsyncAssertWrapper");function Hn(s){let i={progress:()=>s.$["*commonProgress"],errors:()=>s.$["*collectionErrors"],group:()=>s.$["*groupInfo"],totalCount:()=>s.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(r=>r.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>s.getOutputData(),successEntries:()=>t.allEntries.filter(r=>r.status==="success"),failedEntries:()=>t.allEntries.filter(r=>r.status==="failed"),uploadingEntries:()=>t.allEntries.filter(r=>r.status==="uploading"),idleEntries:()=>t.allEntries.filter(r=>r.status==="idle")},t={},e=yc("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[r,o]of Object.entries(i)){let n=r,c=zn(e(o));Object.defineProperty(t,n,{get:c,enumerable:!0})}return t}l(Hn,"buildOutputCollectionState");var vs=class vs{constructor(i){h(this,"_ctx");h(this,"addFileFromUrl",l((i,{silent:t,fileName:e,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(o)},"addFileFromUrl"));h(this,"addFileFromUuid",l((i,{silent:t,fileName:e,source:r}={})=>{let o=this._uploadCollection.add({uuid:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(o)},"addFileFromUuid"));h(this,"addFileFromCdnUrl",l((i,{silent:t,fileName:e,source:r}={})=>{var a;let o=Bn({url:i,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:i,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(a=e!=null?e:o.filename)!=null?a:null,silent:t!=null?t:!1,source:r!=null?r:tt.API});return this.getOutputItem(n)},"addFileFromCdnUrl"));h(this,"addFileFromObject",l((i,{silent:t,fileName:e,source:r,fullPath:o}={})=>{let n=this._uploadCollection.add({file:i,isImage:Nn(i),mimeType:i.type,fileName:e!=null?e:i.name,fileSize:i.size,silent:t!=null?t:!1,source:r!=null?r:tt.API,fullPath:o!=null?o:null});return this.getOutputItem(n)},"addFileFromObject"));h(this,"removeFileByInternalId",l(i=>{if(!this._uploadCollection.read(i))throw new Error(`File with internalId ${i} not found`);this._uploadCollection.remove(i)},"removeFileByInternalId"));h(this,"uploadAll",l(()=>{let i=this._uploadCollection.items().filter(t=>{let e=this._uploadCollection.read(t);return!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")});i.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(i),this._ctx.emit(O.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));h(this,"openSystemDialog",l((i={})=>{var r;let t=le(sr([(r=this.cfg.accept)!=null?r:"",...this.cfg.imgOnly?Je:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("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.");let e=document.createElement("input");e.type="file",e.multiple=this.cfg.multiple,i.captureCamera?(e.capture=this.cfg.cameraCapture,e.accept="image/*"):e.accept=t,e.dispatchEvent(new MouseEvent("click")),e.onchange=()=>{[...e.files].forEach(o=>this.addFileFromObject(o,{source:i.captureCamera?tt.CAMERA:tt.LOCAL})),this._ctx.$["*currentActivity"]=w.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),e.value=""}},"openSystemDialog"));h(this,"getOutputItem",l(i=>{var n,a,c,u,p,d,f,g,m,_;let t=I.getCtx(i).store,e=t.fileInfo,r=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(a=(n=e==null?void 0:e.uuid)!=null?n:t.uuid)!=null?a:null,internalId:i,name:(c=e==null?void 0:e.originalFilename)!=null?c:t.fileName,size:(u=e==null?void 0:e.size)!=null?u:t.fileSize,isImage:(p=e==null?void 0:e.isImage)!=null?p:t.isImage,mimeType:(d=e==null?void 0:e.mimeType)!=null?d:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(g=(f=t.cdnUrl)!=null?f:e==null?void 0:e.cdnUrl)!=null?g:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:e!=null?e:null,metadata:(_=(m=t.metadata)!=null?m:e==null?void 0:e.metadata)!=null?_:null,isSuccess:r==="success",isUploading:r==="uploading",isFailed:r==="failed",isRemoved:r==="removed",errors:t.errors,status:r}},"getOutputItem"));h(this,"getOutputCollectionState",l(()=>Hn(this._ctx),"getOutputCollectionState"));h(this,"initFlow",l((i=!1)=>{var t;if(this._uploadCollection.size>0&&!i)this._ctx.set$({"*currentActivity":w.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let e=this._sourceList[0];if(e==="local"){this._ctx.$["*currentActivity"]=w.activities.UPLOAD_LIST,this.openSystemDialog();return}let r=this._ctx.$["*blocksRegistry"],o=l(a=>"type"in a&&a.type===e,"isSourceBtn"),n=[...r].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":w.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)},"initFlow"));h(this,"doneFlow",l(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)},"doneFlow"));h(this,"setCurrentActivity",l((i,t={})=>{if(this._ctx.hasBlockInCtx(e=>e.activityType===i)){this._ctx.set$({"*currentActivityParams":t,"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`)},"setCurrentActivity"));h(this,"setModalState",l(i=>{if(i&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",i)},"setModalState"));this._ctx=i}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let i=[];return this.cfg.sourceList&&(i=X(this.cfg.sourceList)),i}};l(vs,"UploaderPublicApi");var or=vs;var ws=l((s,i)=>{let t=i.cfg.imgOnly,e=s.isImage;if(!(!t||e)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var Cs=l((s,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=sr([...t?Je:[],e]);if(!r.length)return;let o=s.mimeType,n=s.name;if(!o||!n)return;let a=_s(o,r),c=Fn(n,r);if(!a&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var yt=1e3,Jt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Qe=l(s=>Math.ceil(s*100)/100,"round"),Gn=l((s,i=Jt.AUTO)=>{let t=i===Jt.AUTO;if(i===Jt.BYTE||t&&s<yt**1){let e=Di("en-US",s),r={one:"byte",other:"bytes"}[e];return`${s} ${r}`}return i===Jt.KB||t&&s<yt**2?`${Qe(s/yt**1)} KB`:i===Jt.MB||t&&s<yt**3?`${Qe(s/yt**2)} MB`:i===Jt.GB||t&&s<yt**4?`${Qe(s/yt**3)} GB`:i===Jt.TB||t&&s<yt**5?`${Qe(s/yt**4)} TB`:`${Qe(s/yt**5)} PB`},"prettyBytes");var xs=l((s,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=s.size;if(t&&e&&e>t)return{type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Gn(t)}),payload:{entry:s}}},"validateMaxSizeLimit");var As=l((s,i)=>{let{internalId:t}=s,e=i._uploadCollection.read(t),r=e==null?void 0:e.getValue("uploadError");if(!r)return;if(r instanceof W)return{type:"UPLOAD_ERROR",message:r.message,payload:{entry:s,error:r}};if(r instanceof ae)return{type:"NETWORK_ERROR",message:r.message,payload:{entry:s,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:s,error:o}}},"validateUploadError");var Es=l((s,i)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Ts=l((s,i)=>{let t=s.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return{type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return{type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var nr={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Ss=class Ss{constructor(i){h(this,"_blockInstance");h(this,"_fileValidators",[ws,Cs,xs,As]);h(this,"_collectionValidators",[Ts,Es]);this._blockInstance=i,this._uploadCollection=this._blockInstance.uploadCollection;let t=l(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(i){let t=i!=null?i:this._uploadCollection.items();for(let e of t){let r=this._uploadCollection.read(e);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let i=this._blockInstance.api.getOutputCollectionState(),t=[];for(let e of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=e(i,this._blockInstance.api);if(!r)continue;r&&(t.push(r),r.message||console.warn(nr.message))}catch(r){console.warn(nr.collection,r)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit(O.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(i){let t=this._blockInstance.api.getOutputItem(i.uid),e=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(t,this._blockInstance.api);if(!o)continue;o&&(e.push(o),o.message||console.warn(nr.message))}catch(o){console.warn(nr.file,o)}i.setValue("errors",e)}_addCustomTypeToValidators(i){return i.map(t=>(...e)=>{let r=t(...e);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};l(Ss,"ValidationManager");var lr=Ss;var Xn=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:St,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:null,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var ar=class ar extends w{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!1);h(this,"isCtxOwner",!1);h(this,"init$",Ki(this));h(this,"_flushOutputItems",P(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(O.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._createGroup(e)},300));h(this,"_handleCollectionUpdate",l((t,e,r)=>{var o;(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of e)n.getValue("silent")||this.emit(O.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of r)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit(O.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));h(this,"_handleCollectionPropertiesUpdate",l(t=>{this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:a}=I.getCtx(o).store;n&&!a&&this.emit(O.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let a of t.errors){let{errors:c}=I.getCtx(a).store;c.length>0&&(this.emit(O.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(O.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(O.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var a;return!!((a=this.uploadCollection.read(n))!=null&&a.getValue("cdnUrl"))}).forEach(n=>{this.emit(O.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));h(this,"_flushCommonUploadProgress",l(()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");t+=a});let o=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(O.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof ar?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new rr({typedSchema:Xn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new or(this)),this.has("*validationManager")||this.add("*validationManager",new lr(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,e;(t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new er(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,n=await hn(r,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(O.GROUP_CREATED,a),this.emit(O.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=a}setInitialCrop(){let t=tr(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of r){let n=o.getValue("fileInfo"),{width:a,height:c}=n.imageInfo,u=e.width/e.height,p=Mn(a,c,u),d=G(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:d,cdnUrl:D(o.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===w.activities.CLOUD_IMG_EDIT)&&(this.$["*focusedEntry"]=o,this.$["*currentActivity"]=w.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let e=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Un,integration:this.cfg.userAgentIntegration,secureSignature:e==null?void 0:e.secureSignature,secureExpire:e==null?void 0:e.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};l(ar,"UploaderBlock");var k=ar;k.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});k.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...k.extSrcList});var fe=l(s=>{var i;return(i=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")},"toKebabCase");var V=l(s=>String(s),"asString"),ut=l(s=>{let i=Number(s);if(Number.isNaN(i))throw new Error(`Invalid number: "${s}"`);return i},"asNumber"),M=l(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),_c=l(s=>s==="auto"?s:M(s),"asStore"),vc=l(s=>{let i=V(s);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},"asCameraCapture"),wc=l(s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Cc=l(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),ks=l(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),Wn=l(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),xc={pubkey:V,multiple:M,multipleMin:ut,multipleMax:ut,confirmUpload:M,imgOnly:M,accept:V,externalSourcesPreferredTypes:V,store:_c,cameraMirror:M,cameraCapture:vc,sourceList:V,maxLocalFileSizeBytes:ut,thumbSize:ut,showEmptyList:M,useLocalImageEditor:M,useCloudImageEditor:M,cloudImageEditorTabs:V,removeCopyright:M,cropPreset:V,imageShrink:V,modalScrollLock:M,modalBackdropStrokes:M,sourceListWrap:M,remoteTabSessionKey:V,cdnCname:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:ut,multipartMinFileSize:ut,multipartChunkSize:ut,maxConcurrentRequests:ut,multipartMaxConcurrentRequests:ut,multipartMaxAttempts:ut,checkForUrlDuplicates:M,saveUrlForRecurrentUploads:M,groupOutput:M,userAgentIntegration:V,debug:M,localeName:V,metadata:wc,secureUploadsExpireThreshold:ut,localeDefinitionOverride:Cc,secureUploadsSignatureResolver:ks,secureDeliveryProxyUrlResolver:ks,iconHrefResolver:ks,fileValidators:Wn,collectionValidators:Wn},Kn=l((s,i)=>{if(!(typeof i=="undefined"||i===null))try{return xc[s](i)}catch(t){return console.error(`Invalid value for config key "${s}".`,t),ct[s]}},"normalizeConfigValue");var $s=[...new Set(["debug",...Object.keys(ct)])],Ac=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],Ec=l(s=>Ac.includes(s),"isComplexKey"),me=$s.filter(s=>!Ec(s)),Tc={...Object.fromEntries(me.map(s=>[fe(s),s])),...Object.fromEntries(me.map(s=>[s.toLowerCase(),s]))},Sc={...Object.fromEntries(me.map(s=>[fe(s),Q(s)])),...Object.fromEntries(me.map(s=>[s.toLowerCase(),Q(s)]))},qn=l(s=>"__"+s,"getLocalPropName"),Is=class Is extends x{constructor(){super();h(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(ct).map(([t,e])=>[Q(t),e]))}}_flushValueToAttribute(t,e){if(me.includes(t)){let r=[...new Set([fe(t),t.toLowerCase()])];for(let o of r)typeof e=="undefined"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString())}}_flushValueToState(t,e){this.$[Q(t)]!==e&&(typeof e=="undefined"||e===null?this.$[Q(t)]=ct[t]:this.$[Q(t)]=e)}_setValue(t,e){let r=this,o=Kn(t,e),n=qn(t);r[n]!==o&&(this._assertSameValueDifferentReference(t,r[n],o),r[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let e=this,r=qn(t);return e[r]}_assertSameValueDifferentReference(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r))}initCallback(){var e;super.initCallback();let t=this;for(let r of me)this.sub(Q(r),o=>{this._setValue(r,o)},!1);for(let r of $s){let o=(e=t[r])!=null?e:this.$[Q(r)];o!==ct[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n=>{this._setValue(r,n)},get:()=>this._getValue(r)})}}attributeChangedCallback(t,e,r){if(e===r)return;let o=this,n=Tc[t];o[n]=r}};l(Is,"ConfigClass");var ti=Is;ti.bindAttributes(Sc);for(let s of $s)ti.prototype[s]=void 0;var Zn=ti;var Os=class Os extends x{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let t=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",e=>{if(e){let r=e(i);t=r!=null?r:t}this.$.href=t})})}};l(Os,"Icon");var ge=Os;ge.template=y`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use bind="@href: href;"></use></svg>`;ge.bindAttributes({name:"name"});var Yn=l(s=>[...new Set(s)],"uniqueArray");var Jn=l(s=>Object.entries(s).filter(([,i])=>i!==void 0&&i!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var kc="https://ucarecdn.com",ei=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:kc},"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 be="--uc-img-",Ls="unresolved";var Ms=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Us=3e3,Ps=5e3,Rs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var tl=Object.create(null),Qn;for(let s in ei)tl[be+s]=((Qn=ei[s])==null?void 0:Qn.default)||"";var Ds=class Ds extends Pt{constructor(){super(...arguments);h(this,"cssInit$",tl)}$$(t){return this.$[be+t]}set$$(t){for(let e in t)this.$[be+e]=t[e]}sub$$(t,e){this.sub(be+t,r=>{r===null||r===""||e(r)})}analyticsParams(){return`-/@clib/${Zt}/${Yt}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{ei[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},r),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),I.deleteCtx(this)}static get observedAttributes(){return Object.keys(ei)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{this.$[be+t]=r})}};l(Ds,"ImgConfig");var cr=Ds;var Fs=class Fs extends cr{constructor(){super(...arguments);h(this,"_img",new Image);h(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!Ms&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],r=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Ps&&this.hasFormatJPG)return Ps+r;if(Number(o)>Us&&!this.hasFormatJPG)return Us+r}return t}_getCdnModifiers(t,e){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return G(...Jn(r))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(Ms&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return D(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(D(Rt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(D(Rt(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(D(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(D(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Ge(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}_getElSize(t,e=1,r=!0){let o=t.getBoundingClientRect(),n=e*Math.round(o.width),a=r?"":e*Math.round(o.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(t){let e=l(o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},"proxifyEvent"),r=["load","error"];for(let o of r)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Rs.PREVIEW,img:this._imgPreview}:{type:Rs.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=X(this.$$("breakpoints"));return Yn(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:r}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(Ls,""),r.addEventListener("load",()=>{r.removeAttribute(Ls),o(r)}),r.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:r,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var r;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};l(Fs,"ImgBase");var dr=Fs;var Ns=class Ns extends dr{initCallback(){super.initCallback(),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")})}};l(Ns,"Img");var pr=Ns;var ye=class ye extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=M(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};l(ye,"SimpleBtn"),h(ye,"styleAttrs",[...Z(ye,ye,"styleAttrs"),"uc-simple-btn"]);var _e=ye;_e.template=y`<uc-drop-area bind="@disabled: !withDropZone"><button type="button" bind="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;_e.bindAttributes({dropzone:null});var Bs=class Bs extends w{constructor(){super(...arguments);h(this,"historyTracked",!0);h(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};l(Bs,"StartFrom");var ii=Bs;ii.template=y`<div class="uc-content"><slot></slot></div>`;function $c(s){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=l(r=>{r.type!=="loadend"&&t.abort(),i(!1)},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(s)}catch{i(!1)}})}l($c,"checkIsDirectory");function Ic(s,i){return new Promise(t=>{let e=0,r=[],o=l(a=>{a||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),a.isFile?(e++,a.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:a.fullPath}),e===0&&t(r)})):a.isDirectory&&n(a.createReader())},"readEntry"),n=l(a=>{e++,a.readEntries(c=>{e--;for(let u of c)o(u);e===0&&t(r)})},"readReaderContent");o(s)})}l(Ic,"readEntryContentAsync");function el(s){let i=[],t=[];for(let e=0;e<s.items.length;e++){let r=s.items[e];if(r)if(r.kind==="file"){let o=r.type;if(typeof r.webkitGetAsEntry=="function"||typeof r.getAsEntry=="function"){let a=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();t.push(Ic(a,o).then(c=>{c&&i.push(...c)}));continue}let n=r.getAsFile();n&&t.push($c(n).then(a=>{a||i.push({type:"file",file:n})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&t.push(new Promise(o=>{r.getAsString(n=>{i.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>i)}l(el,"getDropItems");var K={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},il=["focus"],Oc=100,zs=new Map;function Lc(s,i){let t=Math.max(Math.min(s[0],i.x+i.width),i.x),e=Math.max(Math.min(s[1],i.y+i.height),i.y);return Math.sqrt((s[0]-t)*(s[0]-t)+(s[1]-e)*(s[1]-e))}l(Lc,"distance");function Vs(s){let i=0,t=document.body,e=new Set,r=l(m=>e.add(m),"handleSwitch"),o=K.INACTIVE,n=l(m=>{s.shouldIgnore()&&m!==K.INACTIVE||(o!==m&&e.forEach(_=>_(m)),o=m)},"setState"),a=l(()=>i>0,"isDragging");r(m=>s.onChange(m));let c=l(()=>{i=0,n(K.INACTIVE)},"onResetEvent"),u=l(()=>{i+=1,o===K.INACTIVE&&n(K.ACTIVE)},"onDragEnter"),p=l(()=>{i-=1,a()||n(K.INACTIVE)},"onDragLeave"),d=l(m=>{m.preventDefault(),i=0,n(K.INACTIVE)},"onDrop"),f=l(m=>{if(s.shouldIgnore())return;a()||(i+=1);let _=[m.x,m.y],C=s.element.getBoundingClientRect(),E=Math.floor(Lc(_,C)),A=E<Oc,T=m.composedPath().includes(s.element);zs.set(s.element,E);let B=Math.min(...zs.values())===E;T&&B?(m.preventDefault(),n(K.OVER)):n(A&&B?K.NEAR:K.ACTIVE)},"onDragOver"),g=l(async m=>{if(s.shouldIgnore())return;m.preventDefault();let _=await el(m.dataTransfer);s.onItems(_),n(K.INACTIVE)},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),s.element.addEventListener("drop",g),il.forEach(m=>{window.addEventListener(m,c)}),()=>{zs.delete(s.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),s.element.removeEventListener("drop",g),il.forEach(m=>{window.removeEventListener(m,c)})}}l(Vs,"addDropzone");var rl="uc-drop-area",ve=`${rl}/registry`,we=class we extends k{constructor(){super(),this.init$={...this.init$,state:K.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[ve]:null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return t&&o&&e}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[ve]||(this.$[ve]=new Set),this.$[ve].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!M(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:M(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:M(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:M(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Vs({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:tt.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:tt.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":w.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=Vs({element:i,onChange:t=>{var r;let e=(r=Object.entries(K).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var r;let e=(r=Object.entries(K).find(([,o])=>o===t))==null?void 0:r[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=X(t);this.$.isEnabled=e.includes(k.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[ve]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var t,e;super.destroyCallback();let i=this.$[ve];i&&(i.delete(this),i.size===0&&I.deleteCtx(rl)),(t=this._destroyDropzone)==null||t.call(this),(e=this._destroyContentWrapperDropzone)==null||e.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};l(we,"DropArea"),h(we,"styleAttrs",[...Z(we,we,"styleAttrs"),"uc-drop-area"]);var Ce=we;Ce.template=y`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" bind="@hidden: !isVisible"><div class="uc-icon-container" bind="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;Ce.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var Mc="src-type-",js=class js extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"type");h(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:k.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:k.sourceTypes.URL,activity:w.activities.URL,textKey:"from-url"}),this.registerType({type:k.sourceTypes.CAMERA,activity:w.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:w.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(k.extSrcList))this.registerType({type:t,activity:w.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:e,activate:r,activityParams:o={}}=t;(r?r():!!e)&&this.set$({"*currentActivityParams":o,"*currentActivity":e})}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:r=t,icon:o=t}=e;this.$["src-type"]=`${Mc}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};l(js,"SourceBtn");var xe=js;xe.template=y`<button type="button"><uc-icon bind="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;xe.bindAttributes({type:null});var Hs=class Hs extends x{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=X(i),e="";t.forEach(r=>{e+=y`<uc-source-btn type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};l(Hs,"SourceList");var fr=Hs;var gr=l(()=>{let s=[];return{stack:s,promiseReadJpegChunks:l(t=>new Promise((e,r)=>{let o=2,n=l((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result))}),d.addEventListener("error",f=>{r(`Reader error: ${f}`)}),d.readAsArrayBuffer(u)},"readToView"),a=l(()=>n(t.slice(o,o+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=l(()=>{let u=o;return n(t.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(!0);return}let f=p.getUint16(2)-2;return n(t.slice(o,o+=f),g=>{if(g.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:d,view:g}),a()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),a()})}),"promiseReadJpegChunks")}},"readJpegChunks"),Uc=l(async s=>{let i=[],{promiseReadJpegChunks:t,stack:e}=gr();return await t(s),e.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&i.push(o)}),i},"getIccProfile"),ol=l(async(s,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:o,stack:n}=gr();await o(s),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let a=[s.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),a.push(p.buffer),a.push(u)}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&a.push(s.slice(c,e[u])),c=e[u]+r[u]+4;return a.push(s.slice(c,s.size)),new Blob(a,{type:s.type})}},"replaceJpegChunk"),Pc=226,nl=l((s,i)=>ol(s,Pc,i.map(t=>t.buffer)),"replaceIccProfile"),Rc=l(async s=>{try{return await nl(s,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Dc=l((s,i,t)=>new Promise((e,r)=>{let o=l(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n)},"callback");s.toBlob(o,i,t),s.width=s.height=1}),"canvasToBlob"),ri=l(()=>{let s=document.createElement("canvas"),i=s.getContext("2d");return{canvas:s,ctx:i}},"createCanvas"),Fc=l(s=>{let{ctx:t,canvas:e}=ri();e.width=e.height=50,t.drawImage(s,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let o=3;o<r.length;o+=4)if(r[o]<254)return!0;return!1},"hasTransparency"),Nc=l(async s=>{let i=null,{promiseReadJpegChunks:t,stack:e}=gr();return await t(s),e.forEach(({marker:r,view:o})=>{if(!i&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){i=o;return}}),i},"getExif"),Bc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",mr,zc=l(()=>new Promise(s=>{if(mr!==void 0)s(mr);else{let i=new Image;i.addEventListener("load",()=>{mr=i.naturalWidth<i.naturalHeight,i.src="//:0",s(mr)}),i.src=Bc}}),"isBrowserApplyExifOrientation"),Vc=l((s,i)=>{let t,e,r,o;if(!s||s.byteLength<14||s.getUint32(0)!==1165519206||s.getUint16(4)!==0)return;if(s.getUint16(6)===18761)e=!0;else if(s.getUint16(6)===19789)e=!1;else return;if(s.getUint16(8,e)!==42)return;r=8+s.getUint32(10,e);let n=s.getUint16(r-2,e);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(s.byteLength<r+10)return;s.getUint16(r,e)===274&&i(r+8,e),r+=12}},"findExifOrientation"),jc=l((s,i)=>{Vc(s,(t,e)=>s.setUint16(t,i,e))},"setExifOrientation"),Hc=l(async(s,i,t)=>(t&&jc(i,1),ol(s,225,[i.buffer])),"replaceExif"),Gc=l((s,i)=>new Promise((t,e)=>{i&&(s.src=i),s.complete?t(s):(s.addEventListener("load",()=>{t(s)}),s.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),Xc=l(s=>Gc(new Image,s),"imageLoader"),Wc=[1,3],Kc=[192,193,194,195,197,198,199,201,202,203,205,206,207],sl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},qc=l(async s=>{let i=!1,{promiseReadJpegChunks:t,stack:e}=gr();return await t(s).then(()=>(e.forEach(({marker:r,view:o})=>{if(!i&&Kc.indexOf(r)>=0){let n=o.getUint8(5);Wc.indexOf(n)<0&&(i=!0)}}),i)).catch(()=>i)},"shouldSkipShrink"),ll=l((s,i)=>{let t={};return(...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=s(...e)}},"memoize"),al=l((s,i)=>{let[t]=s,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<e.length;r++){let o=e[r],n=!!i[o];if(o>t&&n||o<t&&!n)return o}return t},"memoKeySerializer"),Vt={R:55,G:110,B:165,A:255},Zc=`rgba(${Vt.R}, ${Vt.G}, ${Vt.B}, ${Vt.A/255})`,cl=l((s,i)=>{try{let t=[s-1,i-1,1,1],{canvas:e,ctx:r}=ri();e.width=1,e.height=1;let{canvas:o,ctx:n}=ri();o.width=s,o.height=i,n&&(n.fillStyle=Zc,n.fillRect(...t),r.drawImage(o,s-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,c=!1;return a&&(c=a[0]===Vt.R&&a[1]===Vt.G&&a[2]===Vt.B&&a[3]===Vt.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${i}.`),!1}},"canvasTest");function ul(s){return(...i)=>new Promise(t=>{setTimeout(()=>{let e=s(...i);t(e)},0)})}l(ul,"wrapAsync");var Yc=ul(ll(cl,al)),Jc=ul(ll(cl,al)),hl=l(async(s,i)=>{let t=sl.squareSide.find(n=>n*n>=s*i),e=sl.dimension.find(n=>n>=s&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,o]=await Promise.all([Yc(t,t),Jc(e,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),dl=l(async(s,i,t)=>{try{let{ctx:e,canvas:r}=ri();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(s,0,0,i,t),s instanceof HTMLImageElement&&(s.src="//:0"),s instanceof HTMLCanvasElement&&(s.width=s.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Qc=l(({img:s,targetW:i,targetH:t})=>dl(s,i,t),"native"),tu=l(function({sourceW:s,targetW:i,targetH:t,step:e}){let r=[],o=i,n=t;do r.push([o,n]),o=Math.round(o/e),n=Math.round(n/e);while(o<s*e);return r.reverse()},"calcShrinkSteps"),eu=l(({img:s,sourceW:i,targetW:t,targetH:e,step:r})=>tu({sourceW:i,targetW:t,targetH:e,step:r}).reduce((n,[a,c])=>n.then(u=>hl(a,c).then(()=>dl(u,a,c)).catch(()=>u)),Promise.resolve(s)),"fallback"),iu=l(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),ru=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Gs=.71,su=l((s,i)=>{if(s.width*Gs*s.height*Gs<i.size)throw new Error("Not required");let t=s.width,e=s.height,r=t/e,o=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return hl(o,n).then(()=>{let{ctx:a}=ri();return"imageSmoothingQuality"in a&&!iu()&&!ru?Qc({img:s,targetW:o,targetH:n}):eu({img:s,sourceW:t,targetW:o,targetH:n,step:Gs})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),pl=l(async(s,i)=>{try{if(await qc(s))throw new Error("Should skipped");let e=await Promise.allSettled([Nc(s),zc(),Uc(s)]),o=!e.some(_=>_.status==="rejected"),[n,a,c]=e,u=await Rc(s).catch(()=>s),p=await Xc(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await su(p,i),f="image/jpeg",g=(i==null?void 0:i.quality)||.8;!o&&Fc(d)&&(f="image/png",g=void 0);let m=await Dc(d,f,g);if(o&&n.status==="fulfilled"&&n.value){let _=n.value,C=a.status==="fulfilled"?a.value:!1;m=await Hc(m,_,C)}return o&&c.status==="fulfilled"&&c.value.length>0&&(m=await nl(m,c.value)),m}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");function ou(s){let i=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(i)}l(ou,"createSvgBlobUrl");function Xs(s="hsl(209, 21%, 65%)",i=32,t=32){return ou(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${s}" 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>`)}l(Xs,"fileCssBg");function fl(s,i=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let t=document.createElement("canvas"),e=t.getContext("2d"),r=new Image,o=new Promise((n,a)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){a();return}let p=URL.createObjectURL(u);n(p)})},r.onerror=c=>{a(c)}});return r.src=URL.createObjectURL(s),o}l(fl,"generateThumb");var nu=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,ml=l(s=>{let i=nu.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!i.length)return!1;let t=i[1]*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).`),!1):{quality:i[3]?i[3]/100:void 0,size:t}},"parseShrink");var ot=Object.freeze({FINISHED:Symbol(0),FAILED:Symbol(1),UPLOADING:Symbol(2),IDLE:Symbol(3)}),Ae=class Ae extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"pauseRender",!0);h(this,"_entrySubs",new Set);h(this,"_entry",null);h(this,"_isIntersecting",!1);h(this,"_debouncedGenerateThumb",P(this._generateThumbnail.bind(this),100));h(this,"_debouncedCalculateState",P(this._calculateState.bind(this),100));h(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:ot.IDLE,onEdit:()=>{this.set$({"*focusedEntry":this._entry}),this.hasBlockInCtx(t=>t.activityType===w.activities.DETAILS)?this.$["*currentActivity"]=w.activities.DETAILS:this.$["*currentActivity"]=w.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=ot.IDLE;t.getValue("errors").length>0?e=ot.FAILED:t.getValue("isUploading")?e=ot.UPLOADING:t.getValue("fileInfo")&&(e=ot.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let r=this.cfg.thumbSize,o=await this.proxyUrl(D(Rt(this.cfg.cdnCname,this._entry.getValue("uuid")),G(t.getValue("cdnUrlModifiers"),`scale_crop/${r}x${r}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let r=await fl(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",r)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Xs(o))}else{let r=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Xs(r))}}_subEntry(t,e){let r=this._entry.subscribe(t,o=>{this.isConnected&&e(o)});this._entrySubs.add(r)}_handleEntryId(t){var r;this._reset();let e=(r=this.uploadCollection)==null?void 0:r.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=e.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{Ae.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),Ae.activeInstances.add(this)}_handleState(t){var e,r,o,n,a;t===ot.FAILED?this.$.badgeIcon="badge-error":t===ot.FINISHED&&(this.$.badgeIcon="badge-success"),t===ot.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===ot.FAILED,isUploading:t===ot.UPLOADING,isFinished:t===ot.FINISHED,progressVisible:t===ot.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((r=this._entry)==null?void 0:r.getValue("cdnUrl")),errorText:(a=(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message)!=null?a:""})}destroyCallback(){super.destroyCallback(),Ae.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return ml(this.cfg.imageShrink)}_processShrink(t){return pl(t,this._settingsOfShrink())}async upload(){var r,o,n,a,c;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let u=new AbortController;t.setValue("abortController",u);let p=l(async()=>{let f=t.getValue("file");f&&this.cfg.imageShrink&&(f=await this._processShrink(f).catch(()=>f));let g=f||t.getValue("externalUrl")||t.getValue("uuid"),_={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:C=>{if(C.isComputable){let E=C.value*100;t.setValue("uploadProgress",E)}},signal:u.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",g,_),Yr(g,_)},"uploadTask"),d=await this.$["*uploadQueue"].add(p);t.setMultipleValues({fileInfo:d,isUploading:!1,fileName:d.originalFilename,fileSize:d.size,isImage:d.isImage,mimeType:(n=(o=(r=d.contentInfo)==null?void 0:r.mime)==null?void 0:o.mime)!=null?n:d.mimeType,uuid:d.uuid,cdnUrl:(a=t.getValue("cdnUrl"))!=null?a:d.cdnUrl,cdnUrlModifiers:(c=t.getValue("cdnUrlModifiers"))!=null?c:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(u){u instanceof Ft&&u.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:u}),t===this._entry&&this._debouncedCalculateState()}}}};l(Ae,"FileItem");var Ee=Ae;Ee.template=y`<div class="uc-inner" bind="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" bind="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon bind="@name: badgeIcon"></uc-icon></div></div><div class="uc-file-name-wrapper"><span class="uc-file-name" bind="@title: itemName">{{itemName}}</span><span class="uc-file-error" bind="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" bind="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" bind="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" bind="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" bind="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Ee.activeInstances=new Set;var Qt=class Qt extends x{constructor(){super();h(this,"_handleBackdropClick",l(()=>{this._closeDialog()},"_handleBackdropClick"));h(this,"_closeDialog",l(()=>{this.setOrAddState("*modalActive",!1)},"_closeDialog"));h(this,"_handleDialogClose",l(()=>{this._closeDialog()},"_handleDialogClose"));h(this,"_handleDialogMouseDown",l(t=>{this._mouseDownTarget=t.target},"_handleDialogMouseDown"));h(this,"_handleDialogMouseUp",l(t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?this.show():this.hide()})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};l(Qt,"Modal"),h(Qt,"styleAttrs",[...Z(Qt,Qt,"styleAttrs"),"uc-modal"]),h(Qt,"StateConsumerScope","modal");var si=Qt;si.template=y`<dialog ref="dialog"><slot></slot></dialog>`;var br=l((s,i)=>{let t,e,r,o=l((...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(s(...n),r=Date.now())},Math.max(i-(Date.now()-r),0))):(s(...n),r=Date.now(),t=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(e)}}),o},"throttle");var Ws=class Ws extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"historyTracked",!0);h(this,"activityType",w.activities.UPLOAD_LIST);h(this,"_throttledHandleCollectionUpdate",br(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit(O.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(O.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=e.failed===0&&t.errors.length===0,c=!1,u=!1,p=!1;if(e.total-e.succeed-e.uploading-e.failed>0&&r)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!t.group:!0;p=e.total===e.succeed&&r&&a&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:e.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(e))}_getHeaderText(t){let e=l(r=>{let o=t[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return t.uploading>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._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:e.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};l(Ws,"UploadList");var oi=Ws;oi.template=y`<uc-activity-header><span class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" bind="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" itemize="*uploadList" item-tag="uc-file-item"></div><div class="uc-common-error" bind="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" bind="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" bind="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" bind="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" bind="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Ks=class Ks extends k{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.URL);h(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.api.addFileFromUrl(e,{source:tt.URL_TAB}),this.$["*currentActivity"]=w.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};l(Ks,"UrlSource");var ni=Ks;ni.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" bind="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" bind="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var qs=l(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Zs=class Zs extends k{constructor(){super(...arguments);h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.CAMERA);h(this,"_unsubPermissions",null);h(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:qs(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});h(this,"_onActivate",l(()=>{qs()&&this._subscribePermissions(),this._capture()},"_onActivate"));h(this,"_onDeactivate",l(()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()},"_onDeactivate"));h(this,"_handlePermissionsChange",l(()=>{this._capture()},"_handlePermissionsChange"));h(this,"_setPermissionsState",P(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),console.error("Failed to capture camera",e)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.jpeg`,r="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],e,{lastModified:t,type:r});this.api.addFileFromObject(n,{source:tt.CAMERA}),this.set$({"*currentActivity":w.activities.UPLOAD_LIST})},r)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null});try{let r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));r.length>1&&(this.$.cameraSelectOptions=r,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=r[0])==null?void 0:t.value}catch{}}};l(Zs,"CameraSource");var li=Zs;li.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div bind="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" bind="options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline bind="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" bind="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" bind="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" bind="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var Ys=class Ys extends k{constructor(){super(...arguments);h(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};l(Ys,"UploadCtxProviderClass");var yr=Ys;yr.EventType=O;var gl=yr;var Js=class Js extends k{constructor(){super(...arguments);h(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};l(Js,"ProgressBarCommon");var ai=Js;ai.template=y`<uc-progress-bar bind="visible: visible; value: value"></uc-progress-bar>`;var Qs=class Qs extends x{constructor(){super(...arguments);h(this,"_value",0);h(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let e=this._value;if(this._value=t,t===0&&e>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};l(Qs,"ProgressBar");var ci=Qs;ci.template=y`<div ref="line" class="uc-progress"></div>`;var _t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function bl(...s){return s.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}l(bl,"normalize");function j(...s){let i=bl(...s);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}l(j,"classNames");function yl(s,...i){let t=bl(...i);for(let e of Object.keys(t))s.classList.toggle(e,t[e])}l(yl,"applyClassNames");var _l=l(s=>{if(!s)return Y;let i=Ho(s).filter(t=>Y.includes(t));return i.length===0?Y:i},"parseTabs");function vl(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":Y,"*tabId":U.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:_t,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:le(Y),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=s.querySelectorAll("img");for(let t of i){let e=t.src;t.src=_t,t.src=e}s.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=s.$["*originalUrl"],e=G(Dt(i),"preview"),r=D(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),s.remove()},"*on.cancel":()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}l(vl,"initState");var wl="<svg width='0' height='0' style='position:absolute'><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='puc-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(#puc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-icon-id__h)'/><defs><linearGradient id='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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 Cl=y`${wl} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" bind="visible: presence.networkProblems;"><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" bind="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${_t}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui bind="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var _r=class _r extends x{constructor(){super();h(this,"ctxOwner",!0);h(this,"_debouncedShowLoader",P(this._showLoader.bind(this),300));this.init$={...this.init$,...vl(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,r)=>{let o=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([a])=>{a.contentRect.width>0&&a.contentRect.height>0&&(e(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=Ui(this.$.cdnUrl),e=Rt(this.$.cdnUrl,t);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e;let r=Uo(this.$.cdnUrl),o=Bo(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=Rt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===U.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(D(this.$["*originalUrl"],G("json"))),e=await fetch(t).then(n=>n.json()),{width:r,height:o}=e;this.$["*imageSize"]={width:r,height:o},this.$["*tabId"]===U.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==_t&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||_t)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=tr(t)}),this.sub("tabs",t=>{this.$["*tabList"]=_l(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=j("uc-image",{"uc-image_hidden_to_cropper":t===U.CROP,"uc-image_hidden_effects":t!==U.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=G(Dt(t),"preview"),o=D(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};l(_r,"CloudImageEditorBlock"),h(_r,"styleAttrs",["uc-cloud-image-editor"]);var vt=_r;vt.template=Cl;vt.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var to=class to extends x{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=S&&t.width<=S)return!0;let e=t.height<=S&&(i.includes("n")||i.includes("s")),r=t.width<=S&&(i.includes("e")||i.includes("w"));return e||r}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:o}=i,n=this.ref["svg-el"],a=st("mask",{id:"backdrop-mask"}),c=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=st("rect",{x:t,y:e,width:r,height:o,fill:"black"});a.appendChild(c),a.appendChild(u);let p=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(p),n.appendChild(a),this._backdropMask=a,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:r,height:o}=i;this._backdropMaskInner&&qt(this._backdropMaskInner,{x:t,y:e,width:r,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:r,interactionNode:o,groupNode:n}=t,a=e==="",c=e.length===2,{x:u,y:p,width:d,height:f}=i;if(a){let m={x:u+d/3,y:p+f/3,width:d/3,height:f/3};qt(o,m)}else{let m=zt(Math.min(d,f)/(24*2+34)/2,0,1),{d:_,center:C}=c?En(i,e,m):Tn(i,e,m),E=Math.max(ms*zt(Math.min(d,f)/ms/3,0,1),An);qt(o,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),qt(r,{d:_})}let g=this._shouldThumbBeDisabled(e);n.setAttribute("class",j("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}))}qt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let r=`${["n","","s"][t]}${["w","","e"][e]}`,o=st("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=st("rect",{fill:"transparent"}),a=st("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(a),o.appendChild(n),i[r]={direction:r,pathNode:a,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,r))}return i}_createGuides(){let i=st("svg"),t=st("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let r=st("line",{x1:`${Ye*e}%`,y1:"0%",x2:`${Ye*e}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}for(let e=1;e<=2;e++){let r=st("line",{x1:"0%",y1:`${Ye*e}%`,x2:"100%",y2:`${Ye*e}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(r)}return i.classList.add("uc-guides","uc-guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))t.appendChild(o);i.appendChild(t),this._frameThumbs=r,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let r=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),a=t.x-o,c=t.y-n;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[a,c],this._dragStartCrop={...r}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:r}=t.getBoundingClientRect(),o=i.x-e,n=i.y-r,a=o-this._dragStartPoint[0],c=n-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[a,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(i,t){var u,p;let[e,r]=t,o=this.$["*imageBox"],n=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],a=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=a?a.width/a.height:void 0;if(i===""?n=kn({rect:n,delta:[e,r],imageBox:o}):n=$n({rect:n,delta:[e,r],direction:i,aspectRatio:c,imageBox:o}),!Object.values(n).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return he(pe(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let o=e.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return In(n,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Sn(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",j("uc-thumb",{"uc-thumb--hidden":!i,"uc-thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=S||i.width<=S,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",j({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&i,"uc-guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};l(to,"CropFrame");var ui=to;ui.template=y`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var eo=class eo extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=j({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};l(eo,"EditorButtonControl");var It=eo;It.template=y`<button type="button" role="option"><uc-icon bind="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function au(s){let i=s+90;return i=i>=360?0:i,i}l(au,"nextAngle");function cu(s,i){return s==="rotate"?au(i):["mirror","flip"].includes(s)?!i:null}l(cu,"nextValue");var io=class io extends It{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i)}),this.$["on.click"]=()=>{let i=this.$["*cropperEl"].getValue(this._operation),t=cu(this._operation,i);this.$["*cropperEl"].setValue(this._operation,t)}}};l(io,"EditorCropButtonControl");var Te=io;var hi={FILTER:"filter",COLOR_OPERATION:"color_operation"},wt="original",ro=class ro extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?hi.FILTER:hi.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===wt?void 0:this.$.value,filter:this._filter===wt?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=ft[this._operation],[r,o]=t;this.$.min=r,this.$.max=o,this.$.zero=e;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===hi.FILTER){let a=o;if(n){let{name:c,amount:u}=n;a=c===this._filter?u:o}this.$.value=a,this.$.defaultValue=a}if(this._controlType===hi.COLOR_OPERATION){let a=typeof n!="undefined"?n:e;this.$.value=a,this.$.defaultValue=a}}apply(){let t;this._controlType===hi.FILTER?this._filter===wt?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};l(ro,"EditorSlider");var di=ro;di.template=y`<uc-slider-ui ref="slider-el" bind="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function pi(s){let i=new Image;return{promise:new Promise((r,o)=>{i.src=s,i.onload=r,i.onerror=o}),image:i,cancel:l(()=>{i.naturalWidth===0&&(i.src=_t)},"cancel")}}l(pi,"preloadImage");function fi(s){let i=[];for(let o of s){let n=pi(o);i.push(n)}let t=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:l(()=>{i.forEach(o=>{o.cancel()})},"cancel")}}l(fi,"batchPreloadImages");var so=class so extends It{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,"on.click":null}}_previewSrc(){let i=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,e=Math.ceil(t*i),r=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==wt?{name:this._filter,amount:o}:void 0,D(this._originalUrl,G(Pi,Dt(n),`quality/${r}`,`scale_crop/${e}x${e}/center`))}async _observerCallback(i,t){var r;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:a,cancel:c}=pi(o);this._cancelPreload=c,a.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(r=this._cancelPreload)==null||r.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===wt,this.$.icon=this.$.isOriginal?"original":"slider"}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let i=this.$["*originalUrl"];this._originalUrl=i,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("active",t=>{if(this.$.isOriginal)return;let e=this.ref["icon-el"];e.style.opacity=t?"1":"0";let r=this.ref["preview-el"];t?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let e=await this.proxyUrl(this._previewSrc()),r=this.ref["preview-el"];r.style.backgroundImage&&(r.style.backgroundImage="none",r.style.backgroundImage=`url(${e})`)}})}destroyCallback(){var i,t;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};l(so,"EditorFilterControl");var ee=so;ee.template=y`<button type="button" role="option"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" bind="@name: icon;"></uc-icon></button>`;var oo=class oo extends It{constructor(){super(...arguments);h(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=ft[this._operation],r=t[this._operation],o=typeof r!="undefined"?r!==e:!1;this.$.active=o})}};l(oo,"EditorOperationControl");var Se=oo;function xl(s,i){let t={};for(let e of i){let r=s[e];(s.hasOwnProperty(e)||r!==void 0)&&(t[e]=r)}return t}l(xl,"pick");function ke(s,i,t){let r=window.devicePixelRatio,o=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return D(s,G(Pi,Dt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Zt}/${Yt}/uc-cloud-image-editor/`))}l(ke,"viewerImageSrc");function uu(s){return s?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(s)):!0}l(uu,"validateCrop");var no=class no extends x{constructor(){super();h(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=P(this._commit.bind(this),300),this._handleResizeThrottled=br(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],e=xl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r}_initCanvas(){let t=this.ref["canvas-el"],e=t.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${o}px`,t.width=r*n,t.height=o*n,e==null||e.scale(n,n),this._canvas=t,this._ctx=e}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,e=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=de({width:t.naturalWidth,height:t.naturalHeight},o),c;if(a.width>n.width-e*2||a.height>n.height-e*2){let u=a.width/a.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,g=0+e,m=e+(n.height-e*2)/2-f/2;c={x:g,y:m,width:d,height:f}}else{let d=n.height-e*2,f=d*u,g=e+(n.width-e*2)/2-f/2,m=0+e;c={x:g,y:m,width:f,height:d}}}else{let{width:u,height:p}=a,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p}}this.$["*imageBox"]=pe(c)}_alignCrop(){var f;let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,n=this.$["*editorTransformations"].crop,{width:a,x:c,y:u}=this.$["*imageBox"];if(n){let{dimensions:[g,m],coords:[_,C]}=n,{width:E}=de(this._imageSize,o),A=a/E;t=he(pe({x:c+_*A,y:u+C*A,width:g*A,height:m*A}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],d=p?p.width/p.height:void 0;if(!On(t,e)||d&&!Ln(t,d)){let g=e.width/e.height,m=e.width,_=e.height;d&&(g>d?m=Math.min(e.height*d,e.width):_=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-_/2,width:m,height:_}}this.$["*cropBox"]=he(pe(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let e=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:c}=o,u=de({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=j({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a}=e,{width:c,height:u}=de(this._imageSize,o),{width:p,height:d}=t,f=n/c,g=a/u;return[zt(Math.round(p/f),1,c),zt(Math.round(d/g),1,u)]}_getCropTransformation(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:n,height:a,x:c,y:u}=e,{width:p,height:d}=de(this._imageSize,o),{x:f,y:g}=t,m=n/p,_=a/d,C=this._getCropDimensions(),E={dimensions:C,coords:[zt(Math.round((f-c)/m),0,p-C[0]),zt(Math.round((g-u)/_),0,d-C[1])]};if(!uu(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(C[0]===p&&C[1]===d))return E}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:o}=t,n=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:e})}catch(r){console.error("Failed to activate cropper",{error:r})}this._observer=new ResizeObserver(([r])=>{r.contentRect.width>0&&r.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var e;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=j({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(e=this._observer)==null||e.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),e=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(e,r),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,a=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-a)/o}px)`,this.style.transformOrigin=`${n}px ${a}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,e=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${e}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,e){var p;let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(ke(t,r,e)),{promise:n,cancel:a,image:c}=pi(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=a,n.then(()=>c).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(t){let e="crop",r=this.$["*loadingOperations"];return r.get(e)||r.set(e,new Map),r.get(e).get(t)||(r.set(e,r.get(e).set(t,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(e))!=null&&o.has(t)&&(r.get(e).delete(t),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};l(no,"EditorImageCropper");var mi=no;mi.template=y`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function lo(s,i,t){let e=Array(t);t--;for(let r=t;r>=0;r--)e[r]=Math.ceil((r*i+(t-r)*s)/t);return e}l(lo,"linspace");function hu(s){return s.reduce((i,t,e)=>e<s.length-1?[...i,[t,s[e+1]]]:i,[])}l(hu,"splitBySections");function du(s,i,t){let e=hu(s).find(([r,o])=>r<=i&&i<=o);return s.map(r=>{let o=Math.abs(e[0]-e[1]),n=Math.abs(i-e[0])/o;return e[0]===r?i>t?1:1-n:e[1]===r?i>=t?n:1:0})}l(du,"calculateOpacities");function pu(s,i){return s.map((t,e)=>t<i?s.length-e:e)}l(pu,"calculateZIndices");function Al(s,i){let t=ft[s].keypointsNumber,{range:e,zero:r}=ft[s];return[...new Set([...lo(e[0],r,t+1),...lo(r,e[1],t+1),r,i])].sort((o,n)=>o-n)}l(Al,"keypointsRange");var ao=class ao extends x{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=P(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var r;(r=e==null?void 0:e.get(t))!=null&&r.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:r}={}){let o={...this._transformations};e&&(o[e]=t?{name:t,amount:r}:r);let n=this.offsetWidth;return await this.proxyUrl(ke(i,n,o))}async _constructKeypoint(i,t){return{src:await this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}async _addKeypoint(i,t,e){let r=l(()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(c=>c.value===e),"shouldSkip");if(r())return;let o=await this._constructKeypoint(i,e),n=new Image;n.src=o.src;let a=this._handleImageLoading(o.src);n.addEventListener("load",a,{once:!0}),n.addEventListener("error",a,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(r())return;let c=this._keypoints,u=c.findIndex(d=>d.value>e),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(n,p),this._update(i,e))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=ft[i],r=this._keypoints.map(a=>a.value),o=du(r,t,e),n=pu(r,e);for(let[a,c]of Object.entries(this._keypoints))c.opacity=o[a],c.zIndex=n[a];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("uc-fader-image","uc-fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:n}=fi(e);r.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let a=this._operation,c=this._filter;await o,this._isActive&&this._isSame(a,c)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((u,p)=>{let d=r[p];d.classList.add("uc-fader-image"),u.image=d,this._container.appendChild(d)}),this.appendChild(i),this._flush())}async setTransformations(i){if(this._transformations=i,this._previewImage){let t=await this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:t,operation:e,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Al(e,r),n=await Promise.all(o.map(c=>this._imageSrc({url:i,filter:t,operation:e,value:c}))),{cancel:a}=fi(n);this._cancelBatchPreload=a}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=j({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=j({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:t,value:e,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=r,this._fromViewer=o,typeof e!="number"&&!r){let a=await this._imageSrc({operation:t,value:e});this._setOriginalSrc(a),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Al(t,e).map(a=>this._constructKeypoint(t,a))),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=j({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};l(ao,"EditorImageFader");var vr=ao;var fu=1,co=class co extends x{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>fu?this.scrollLeft+=e:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};l(co,"EditorScroller");var gi=co;gi.template=y`<slot></slot>`;function mu(s){return`<uc-presence-toggle class="uc-tab-toggle" bind="visible: presence.tabToggle.${s}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${s}" data-id="${s}" icon="${s}" bind="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${s}" ></uc-btn-ui></uc-presence-toggle>`}l(mu,"renderTabToggle");function gu(s){return y`<uc-presence-toggle id="tab_${s}" class="uc-tab-content" bind="visible: presence.tabContent.${s}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${s}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}l(gu,"renderTabContent");var uo=class uo extends x{constructor(){super();h(this,"_updateInfoTooltip",P(()=>{var n,a;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===U.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let c=((a=t==null?void 0:t.filter)==null?void 0:a.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(wt);else if(this.$["*tabId"]===U.TUNING&&e){o=!0;let c=(t==null?void 0:t[e])||ft[e].zero;r=this.l10n(e)+" "+c}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":wt,"*currentOperation":null,showLoader:!1,filters:Vo,colorOperations:zo,cropOperations:jo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})},tab_role:"tab",[`tab_${U.TUNING}`]:`tab_${U.TUNING}`,[`tab_${U.CROP}`]:`tab_${U.CROP}`,[`tab_${U.FILTERS}`]:`tab_${U.FILTERS}`},this._debouncedShowLoader=P(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===U.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let e=new Se;return e.operation=t,e}_createFilterControl(t){let e=new ee;return e.filter=t,e}_createToggleControl(t){let e=new Te;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],r=document.createDocumentFragment();t===U.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);r.appendChild(n)}):t===U.FILTERS?[wt,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);r.appendChild(n)}):t===U.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);r.appendChild(n)}),[...r.children].forEach((o,n)=>{n===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),e.innerHTML="",e.appendChild(r)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===U.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let r of Y){let o=r===t,n=this.ref[`tab-toggle-${r}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(ke(this.$["*originalUrl"],e,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=fi([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var r;let e=(r=t==null?void 0:t.filter)==null?void 0:r.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e!=null?e:null)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,r]of t.entries()){if(e)break;for(let[,o]of r.entries())if(o){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of Y){this.$[`presence.tabToggle.${e}`]=t.includes(e);let r=this.ref[`tab-toggle-${e}`];r.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};l(uo,"EditorToolbar");var bi=uo;bi.template=y`<uc-line-loader-ui bind="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" bind="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Y.map(gu).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" bind="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Y.map(mu).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" bind="onclick: on.cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" bind="onclick: on.apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" bind="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" bind="onclick: on.cancelSlider;" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" bind="onclick: on.applySlider;" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var ho=class ho extends x{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":""},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return j("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=`uc-${i}`)}),this.sub("text",()=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",i=>{this.$["aria-role"]=i||""}),this.defineAccessor("aria-controls",i=>{this.$["aria-controls"]=i||""})}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};l(ho,"BtnUi");var $e=ho;$e.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});$e.template=y`<button type="button" bind="@role:aria-role; @aria-controls: aria-controls"><uc-icon bind="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var po=class po extends x{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};l(po,"LineLoaderUi");var yi=po;yi.template=y`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var wr={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},fo=class fo extends x{constructor(){super(),this._visible=!1,this._visibleStyle=wr.visible,this._hiddenStyle=wr.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",yl(this,{[wr.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(wr.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};l(fo,"PresenceToggle");var _i=fo;_i.template=y`<slot></slot>`;var mo=class mo extends x{constructor(){super();h(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let r=this.ref["input-el"];e?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:r}=e.getBoundingClientRect(),o=Math.ceil(r/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",a.appendChild(u);for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());for(let d=0;d<n;d++)a.appendChild(c.cloneNode());a.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this._zeroDotEl=p,e.innerHTML="",e.appendChild(a),this._stepsCount=n}destroyCallback(){var t;(t=this._observer)==null||t.disconnect()}};l(mo,"SliderUi");var vi=mo;vi.template=y`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" bind="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var go=class go extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.CLOUD_IMG_EDIT);this.init$={...this.init$,cdnUrl:null}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.sub("*focusedEntry",t=>{t&&(this.entry=t,this.entry.subscribe("cdnUrl",e=>{e&&(this.$.cdnUrl=e)}))}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this.entry)return;let e=t.detail;this.entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let t=new vt,e=this.$.cdnUrl,r=this.cfg.cropPreset,o=this.cfg.cloudImageEditorTabs;t.setAttribute(b.CTX_NAME_ATTR,this.ctxName),t.setAttribute("cdn-url",e),r&&t.setAttribute("crop-preset",r),o&&t.setAttribute("tabs",o),t.addEventListener("apply",n=>{let a=n;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),t.addEventListener("cancel",n=>{let a=n;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),t.addEventListener("change",n=>{let a=n;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(t),this._mounted=!0,this._instance=t}unmountEditor(){this._instance=void 0,this.innerHTML=""}};l(go,"CloudImageEditorActivity");var Cr=go;var bu=l(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),El=l(function(s,i="i"){let t=s.split("*").map(bu);return new RegExp("^"+t.join(".+")+"$",i)},"wildcardRegexp");var yu=l(s=>Object.keys(s).reduce((t,e)=>{let r=s[e],o=Object.keys(r).reduce((n,a)=>{let c=r[a];return n+`${a}: ${c};`},"");return t+`${e}{${o}}`},""),"styleToCss");function Tl({textColor:s,backgroundColor:i,linkColor:t,linkColorHover:e,secondaryColor:r,secondaryHover:o,secondaryForegroundColor:n,fontFamily:a,fontSize:c,radius:u}){let p=`solid 1px ${r}`;return yu({body:{color:s,"background-color":i,"font-family":a,"font-size":c},".side-bar":{background:"inherit","border-right":p},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:r},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":p},".list-table-body .list-items":{"border-bottom":p},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":r},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"},"input[type=submit], .button, button":{color:n,background:r,"box-shadow":"none",border:"none","border-radius":u},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":u,background:r,border:p}})}l(Tl,"buildStyles");var jt={};window.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}if((i==null?void 0:i.type)in jt){let t=jt[i.type];for(let[e,r]of t)s.source===e&&r(i)}});var Sl=l(function(s,i,t){s in jt||(jt[s]=[]),jt[s].push([i,t])},"registerMessage"),kl=l(function(s,i){s in jt&&(jt[s]=jt[s].filter(t=>t[0]!==i))},"unregisterMessage");function $l(s){let i=[];for(let[t,e]of Object.entries(s))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}l($l,"queryString");var bo=class bo extends k{constructor(){super();h(this,"couldBeCtxOwner",!0);h(this,"activityType",w.activities.EXTERNAL);h(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:r}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:o})}this.$["*currentActivity"]=w.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let e=X(this.cfg.externalSourcesPreferredTypes);for(let r of e){let o=El(r);for(let[n,a]of Object.entries(t.alternatives))if(o.test(n))return a}}return t.url}sendMessage(t){var e,r;(r=(e=this._iframe)==null?void 0:e.contentWindow)==null||r.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:Tl(t)})}remoteUrl(){var u,p;let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r}=this.cfg,{externalSourceType:o}=this.activityParams,a={lang:((p=(u=this.l10n("social-source-lang"))==null?void 0:u.split("-"))==null?void 0:p[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:e},c=new URL(`/window3/${o}`,r);return c.search=$l(a),c.toString()}mountIframe(){let t=Oi({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),Sl("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&kl("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};l(bo,"ExternalSource");var wi=bo;wi.template=y`<uc-activity-header><button type="button" class="uc-mini-btn" bind="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon bind="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" bind="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" bind="onclick: onCancel" l10n="cancel"></button><div></div><div bind="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" bind="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var yo=class yo extends k{constructor(){super(...arguments);h(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Ii(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var e;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let a=this._createValidationInput();this.appendChild(a),this._validationInputElement=a}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let a=(e=t.errors[0])==null?void 0:e.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(a);return}let r=t.group?t.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(a=>a.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let a of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=a,n.appendChild(c)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};l(yo,"FormInput");var xr=yo;var _o=class _o extends w{};l(_o,"ActivityHeader");var Ar=_o;var vo=class vo extends x{constructor(){super(...arguments);h(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(r=>r.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.defineAccessor("options",t=>{var r;this.$.currentText=((r=t==null?void 0:t[0])==null?void 0:r.text)||"";let e="";t==null||t.forEach(o=>{e+=y`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=e})}};l(vo,"Select");var Ci=vo;Ci.template=y`<select ref="select" bind="innerHTML: selectHtml; onchange: onSelect"></select>`;var Tr=class Tr extends x{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};l(Tr,"Copyright"),h(Tr,"template",y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Er=Tr;var Ie=class Ie extends mt{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",i=>{this.set$({isHidden:M(i)})}),this.sub("*modalActive",i=>{this._lastModalActive!==i&&this.emit(i?O.MODAL_OPEN:O.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=i},!1)}};l(Ie,"FileUploaderRegular"),h(Ie,"styleAttrs",[...Z(Ie,Ie,"styleAttrs"),"uc-file-uploader-regular"]);var Oe=Ie;Oe.template=y`<uc-simple-btn bind="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" bind="onclick: *historyBack"></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></uc-modal><uc-progress-bar-common></uc-progress-bar-common>`;Oe.bindAttributes({headless:null});var Le=class Le extends mt{initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=w.activities.UPLOAD_LIST:this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};l(Le,"FileUploaderMinimal"),h(Le,"styleAttrs",[...Z(Le,Le,"styleAttrs"),"uc-file-uploader-minimal"]);var xi=Le;xi.template=y`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var Me=class Me extends mt{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=w.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let i=this.$["*history"];return i.length>1&&i[i.length-1]!==w.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||w.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(i.initActivity||w.activities.START_FROM)&&(this.$["*currentActivity"]=w.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};l(Me,"FileUploaderInline"),h(Me,"styleAttrs",[...Z(Me,Me,"styleAttrs"),"uc-file-uploader-inline"]);var Ai=Me;Ai.template=y`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" bind="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-progress-bar></uc-progress-bar><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var Ue=class Ue extends vt{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};l(Ue,"CloudImageEditor"),h(Ue,"styleAttrs",[...Z(Ue,Ue,"styleAttrs"),"uc-wgt-common"]);var Sr=Ue;var _u=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function kr(s){for(let i in s){if(_u.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),e+=r),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),s[i].reg&&s[i].reg(t)}}l(kr,"defineComponents");var wo="UC";async function Il(s,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[wo]){t(window[wo]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{e()},r.onload=()=>{let o=window[wo];i&&kr(o),t(o)},document.head.appendChild(r)})}l(Il,"loadFileUploaderFrom");return Bl(vu);})();
|