@uploadcare/file-uploader 1.12.1-alpha.1 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  2. package/abstract/UploaderPublicApi.js +11 -4
  3. package/blocks/CameraSource/CameraSource.d.ts +22 -12
  4. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  5. package/blocks/CameraSource/CameraSource.js +83 -81
  6. package/blocks/CameraSource/camera-source.css +0 -1
  7. package/blocks/CloudImageEditor/src/lib/parseTabs.js +2 -2
  8. package/blocks/Config/Config.d.ts +3 -3
  9. package/blocks/Config/Config.d.ts.map +1 -1
  10. package/blocks/Config/Config.js +3 -13
  11. package/blocks/Config/initialConfig.d.ts.map +1 -1
  12. package/blocks/Config/initialConfig.js +3 -4
  13. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  14. package/blocks/Config/normalizeConfigValue.js +7 -20
  15. package/blocks/UploadList/upload-list.css +1 -0
  16. package/blocks/utils/comma-separated.d.ts +1 -1
  17. package/blocks/utils/comma-separated.d.ts.map +1 -1
  18. package/blocks/utils/comma-separated.js +2 -5
  19. package/env.d.ts +1 -1
  20. package/env.js +1 -1
  21. package/index.ssr.d.ts +15 -1
  22. package/index.ssr.d.ts.map +1 -1
  23. package/index.ssr.js +15 -6
  24. package/package.json +2 -2
  25. package/types/exported.d.ts +64 -81
  26. package/web/file-uploader.iife.min.js +4 -4
  27. package/web/file-uploader.min.js +4 -4
  28. package/web/uc-basic.min.css +1 -1
  29. package/web/uc-cloud-image-editor.min.js +4 -4
  30. package/web/uc-file-uploader-inline.min.css +1 -1
  31. package/web/uc-file-uploader-inline.min.js +4 -4
  32. package/web/uc-file-uploader-minimal.min.css +1 -1
  33. package/web/uc-file-uploader-minimal.min.js +3 -3
  34. package/web/uc-file-uploader-regular.min.css +1 -1
  35. package/web/uc-file-uploader-regular.min.js +4 -4
  36. package/web/uc-img.min.js +1 -1
  37. package/blocks/CameraSource/constants.d.ts +0 -15
  38. package/blocks/CameraSource/constants.d.ts.map +0 -1
  39. package/blocks/CameraSource/constants.js +0 -17
  40. package/blocks/Config/assertions.d.ts +0 -5
  41. package/blocks/Config/assertions.d.ts.map +0 -1
  42. package/blocks/Config/assertions.js +0 -37
  43. package/blocks/Config/side-effects.d.ts +0 -7
  44. package/blocks/Config/side-effects.d.ts.map +0 -1
  45. package/blocks/Config/side-effects.js +0 -32
@@ -23,6 +23,6 @@
23
23
  * SOFTWARE.
24
24
  *
25
25
  */
26
- var Ri=Object.defineProperty;var Di=Object.getPrototypeOf;var $i=Reflect.get;var Fi=(r,t,e)=>t in r?Ri(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>(Fi(r,typeof t!="symbol"?t+"":t,e),e);var De=(r,t,e)=>$i(Di(r),e,t);function Ni(r){for(let t in r){let e=[...t].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[t].reg&&r[t].reg(e)}}var _e={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error 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","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var $e=new Map,vt=new Map,or=(r,t)=>{$e.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),$e.set(r,{..._e,...t})},Vi=(r,t)=>{vt.set(r,t)},lr=(r,t)=>{typeof t=="function"?Vi(r,t):or(r,t)},ar=async r=>{if(!$e.has(r)){if(!vt.has(r))throw new Error(`Locale ${r} is not defined`);let e=await vt.get(r)();or(r,e)}return $e.get(r)};lr("en",_e);function $(r,t){let e,i=(...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),t)};return i.cancel=()=>{clearTimeout(e)},i}var E=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"}),Fe=class{constructor(t){u(this,"_timeoutStore",new Map);u(this,"_targets",new Set);u(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let s of this._targets)s.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,s]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let s=typeof i=="number"?i:20,n=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},s);this._timeoutStore.set(t,n)}};var zi=Object.defineProperty,ji=(r,t,e)=>t in r?zi(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ct=(r,t,e)=>(ji(r,typeof t!="symbol"?t+"":t,e),e);function Bi(r){let t=e=>{var i;for(let s in e)((i=e[s])==null?void 0:i.constructor)===Object&&(e[s]=t(e[s]));return{...e}};return t(r)}var v=class{constructor(r){r.constructor===Object?this.store=Bi(r):(this._storeIsProxy=!0,this.store=r),this.callbackMap=Object.create(null)}static warn(r,t){console.warn(`Symbiote Data: cannot ${r}. Prop name: `+t)}read(r){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(v.warn("read",r),null):this.store[r]}has(r){return this._storeIsProxy?this.store[r]!==void 0:this.store.hasOwnProperty(r)}add(r,t,e=!1){!e&&Object.keys(this.store).includes(r)||(this.store[r]=t,this.notify(r))}pub(r,t){if(!this._storeIsProxy&&!this.store.hasOwnProperty(r)){v.warn("publish",r);return}this.store[r]=t,this.notify(r)}multiPub(r){for(let t in r)this.pub(t,r[t])}notify(r){this.callbackMap[r]&&this.callbackMap[r].forEach(t=>{t(this.store[r])})}sub(r,t,e=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(v.warn("subscribe",r),null):(this.callbackMap[r]||(this.callbackMap[r]=new Set),this.callbackMap[r].add(t),e&&t(this.store[r]),{remove:()=>{this.callbackMap[r].delete(t),this.callbackMap[r].size||delete this.callbackMap[r]},callback:t})}static registerCtx(r,t=Symbol()){let e=v.globalStore.get(t);return e?console.warn('State: context UID "'+t+'" already in use'):(e=new v(r),v.globalStore.set(t,e)),e}static deleteCtx(r){v.globalStore.delete(r)}static getCtx(r,t=!0){return v.globalStore.get(r)||(t&&console.warn('State: wrong context UID - "'+r+'"'),null)}};v.globalStore=new Map;var _=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),dr="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Hi=dr.length-1,we=class{static generate(r="XXXXXXXXX-XXX"){let t="";for(let e=0;e<r.length;e++)t+=r[e]==="-"?r[e]:dr.charAt(Math.random()*Hi);return t}};function hr(r,t,e){let i=!0,s,n=t.split(".");return n.forEach((o,l)=>{l<n.length-1?r=r[o]:s=o}),r?r[s]=e:i=!1,i}function Gi(r){return r.split("-").map((t,e)=>t&&e?t[0].toUpperCase()+t.slice(1):t).join("").split("_").map((t,e)=>t&&e?t.toUpperCase():t).join("")}function Xi(r,t){[...r.querySelectorAll(`[${_.REPEAT_ATTR}]`)].forEach(e=>{let i=e.getAttribute(_.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=class extends t.BaseComponent{constructor(){super(),i||(this.style.display="contents")}};let o=e.innerHTML;s.template=o,s.reg(i)}for(;e.firstChild;)e.firstChild.remove();let n=e.getAttribute(_.REPEAT_ATTR);t.sub(n,o=>{if(!o){for(;e.firstChild;)e.firstChild.remove();return}let l=[...e.children],a,c=h=>{h.forEach((f,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(f)});else for(let p in f)l[m][p]=f[p];else{a||(a=new DocumentFragment);let p=new s;Object.assign(p.init$,f),a.appendChild(p)}}),a&&e.appendChild(a);let d=l.slice(h.length,l.length);for(let f of d)f.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let h=[];for(let d in o){let f=o[d];Object.defineProperty(f,"_KEY_",{value:d,enumerable:!0}),h.push(f)}c(h)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),e.removeAttribute(_.REPEAT_ATTR),e.removeAttribute(_.REPEAT_ITEM_TAG_ATTR)})}var cr="__default__";function qi(r,t){if(t.shadowRoot)return;let e=[...r.querySelectorAll("slot")];if(!e.length)return;let i={};e.forEach(s=>{let n=s.getAttribute("name")||cr;i[n]={slot:s,fr:document.createDocumentFragment()}}),t.initChildren.forEach(s=>{var n;let o=cr;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=i[o])==null||n.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(n,s.slot)}else s.slot.remove()})}function Wi(r,t){[...r.querySelectorAll(`[${_.EL_REF_ATTR}]`)].forEach(e=>{let i=e.getAttribute(_.EL_REF_ATTR);t.ref[i]=e,e.removeAttribute(_.EL_REF_ATTR)})}function Zi(r,t){[...r.querySelectorAll(`[${_.BIND_ATTR}]`)].forEach(e=>{let s=e.getAttribute(_.BIND_ATTR).split(";");[...e.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Gi(n.name.replace("-",""));s.push(o+":"+n.value),e.removeAttribute(n.name)}}),s.forEach(n=>{if(!n)return;let o=n.split(":").map(h=>h.trim()),l=o[0],a;l.indexOf(_.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(_.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(h=>h.trim());for(let h of c){let d;h.startsWith("!!")?(d="double",h=h.replace("!!","")):h.startsWith("!")&&(d="single",h=h.replace("!","")),t.sub(h,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):hr(e,l,f)||(e[_.SET_LATER_KEY]||(e[_.SET_LATER_KEY]=Object.create(null)),e[_.SET_LATER_KEY][l]=f)})}}),e.removeAttribute(_.BIND_ATTR)})}var Ne="{{",ve="}}",Ki="skip-text";function Yi(r){let t,e=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var n;return!((n=s.parentElement)!=null&&n.hasAttribute(Ki))&&s.textContent.includes(Ne)&&s.textContent.includes(ve)&&1}});for(;t=i.nextNode();)e.push(t);return e}var Ji=function(r,t){Yi(r).forEach(i=>{let s=[],n;for(;i.textContent.includes(ve);)i.textContent.startsWith(Ne)?(n=i.textContent.indexOf(ve)+ve.length,i.splitText(n),s.push(i)):(n=i.textContent.indexOf(Ne),i.splitText(n)),i=i.nextSibling;s.forEach(o=>{let l=o.textContent.replace(Ne,"").replace(ve,"");o.textContent="",t.sub(l,a=>{o.textContent=a})})})},Qi=[Xi,qi,Wi,Zi,Ji],Ve="'",pe='"',es=/\\([0-9a-fA-F]{1,6} ?)/g;function ts(r){return(r[0]===pe||r[0]===Ve)&&(r[r.length-1]===pe||r[r.length-1]===Ve)}function rs(r){return(r[0]===pe||r[0]===Ve)&&(r=r.slice(1)),(r[r.length-1]===pe||r[r.length-1]===Ve)&&(r=r.slice(0,-1)),r}function is(r){let t="",e="";for(var i=0;i<r.length;i++){let s=r[i+1];r[i]==="\\"&&s==='"'?(t+='\\"',i++):r[i]==='"'&&e!=="\\"?t+='\\"':t+=r[i],e=r[i]}return t}function ss(r){let t=r;ts(r)&&(t=rs(t),t=t.replace(es,(e,i)=>String.fromCodePoint(parseInt(i.trim(),16))),t=t.replaceAll(`\\
27
- `,"\\n"),t=is(t),t=pe+t+pe);try{return JSON.parse(t)}catch{throw new Error(`Failed to parse CSS property value: ${t}. Original input: ${r}`)}}var ur=0,fe=null,Z=null,ie=class extends HTMLElement{constructor(){super(),Ct(this,"updateCssData",()=>{var r;this.dropCssDataCache(),(r=this.__boundCssProps)==null||r.forEach(t=>{let e=this.getCssData(this.__extractCssName(t),!0);e!==null&&this.$[t]!==e&&(this.$[t]=e)})}),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.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return ie}initCallback(){}__initCallback(){var r;this.__initialized||(this.__initialized=!0,(r=this.initCallback)==null||r.call(this))}render(r,t=this.renderShadow){let e;if((t||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(_.USE_TPL);if(s){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(s))||document.querySelector(s);o?r=o.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(r||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(r==null?void 0:r.constructor)===DocumentFragment)e=r;else if((r==null?void 0:r.constructor)===String){let s=document.createElement("template");s.innerHTML=r,e=s.content.cloneNode(!0)}else this.constructor.__tpl&&(e=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(e,this)}let i=()=>{e&&(t&&this.shadowRoot.appendChild(e)||this.appendChild(e)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){t=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=i,this.shadowRoot.prepend(s)}else i()}addTemplateProcessor(r){this.tplProcessors.add(r)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=we.generate(),this.style.setProperty(_.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(_.CSS_CTX_PROP,!0)}get ctxName(){var r;let t=((r=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:r.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=t,t}get localCtx(){return this.__localCtx||(this.__localCtx=v.registerCtx({},this)),this.__localCtx}get nodeCtx(){return v.getCtx(this.ctxName,!1)||v.registerCtx({},this.ctxName)}static __parseProp(r,t){let e,i;if(r.startsWith(_.EXT_DATA_CTX_PRFX))e=t.nodeCtx,i=r.replace(_.EXT_DATA_CTX_PRFX,"");else if(r.includes(_.NAMED_DATA_CTX_SPLTR)){let s=r.split(_.NAMED_DATA_CTX_SPLTR);e=v.getCtx(s[0]),i=s[1]}else e=t.localCtx,i=r;return{ctx:e,name:i}}sub(r,t,e=!0){let i=n=>{this.isConnected&&t(n)},s=ie.__parseProp(r,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,i,e)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,i,e))})}notify(r){let t=ie.__parseProp(r,this);t.ctx.notify(t.name)}has(r){let t=ie.__parseProp(r,this);return t.ctx.has(t.name)}add(r,t,e=!1){let i=ie.__parseProp(r,this);i.ctx.add(i.name,t,e)}add$(r,t=!1){for(let e in r)this.add(e,r[e],t)}get $(){if(!this.__stateProxy){let r=Object.create(null);this.__stateProxy=new Proxy(r,{set:(t,e,i)=>{let s=ie.__parseProp(e,this);return s.ctx.pub(s.name,i),!0},get:(t,e)=>{let i=ie.__parseProp(e,this);return i.ctx.read(i.name)}})}return this.__stateProxy}set$(r,t=!1){for(let e in r){let i=r[e];t||![String,Number,Boolean].includes(i==null?void 0:i.constructor)?this.$[e]=i:this.$[e]!==i&&(this.$[e]=i)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(_.CTX_OWNER_ATTR)&&this.getAttribute(_.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let r=this.constructor.__attrDesc;if(r)for(let t of Object.values(r))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(_.EXT_DATA_CTX_PRFX))this.nodeCtx.add(t.replace(_.EXT_DATA_CTX_PRFX,""),this.init$[t],this.__ctxOwner);else if(t.includes(_.NAMED_DATA_CTX_SPLTR)){let e=t.split(_.NAMED_DATA_CTX_SPLTR),i=e[0].trim(),s=e[1].trim();if(i&&s){let n=v.getCtx(i,!1);n||(n=v.registerCtx({},i)),n.add(s,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);this.__dataCtxInitialized=!0}connectedCallback(){var r;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let t=(r=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:r.trim();if(t&&this.style.setProperty(_.CSS_CTX_PROP,`'${t}'`),this.__initDataCtx(),this[_.SET_LATER_KEY]){for(let e in this[_.SET_LATER_KEY])hr(this,e,this[_.SET_LATER_KEY][e]);delete this[_.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let e of Qi)this.addTemplateProcessor(e);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let e=this.getRootNode();if(!e)return;if(e==null?void 0:e.querySelector(`link[${_.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(_.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},e.nodeType===Node.DOCUMENT_NODE?e.head.appendChild(s):e.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let r of this.allSubs)r.remove(),this.allSubs.delete(r);for(let r of this.tplProcessors)this.tplProcessors.delete(r);Z==null||Z.delete(this.updateCssData),Z!=null&&Z.size||(fe==null||fe.disconnect(),fe=null,Z=null)},100)))}static reg(r,t=!1){r||(ur++,r=`${_.AUTO_TAG_PRFX}-${ur}`),this.__tag=r;let e=window.customElements.get(r);if(e){!t&&e!==this&&console.warn([`Element with tag name "${r}" 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(r,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(r){this.observedAttributes=Object.keys(r),this.__attrDesc=r}attributeChangedCallback(r,t,e){var i;if(t===e)return;let s=(i=this.constructor.__attrDesc)==null?void 0:i[r];s?this.__dataCtxInitialized?this.$[s]=e:this.init$[s]=e:this[r]=e}getCssData(r,t=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(r)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let e=this.__computedStyle.getPropertyValue(r).trim();try{this.__cssDataCache[r]=ss(e)}catch{!t&&console.warn(`CSS Data error: ${r}`),this.__cssDataCache[r]=null}}return this.__cssDataCache[r]}__extractCssName(r){return r.split("--").map((t,e)=>e===0?"":t).join("--")}__initStyleAttrObserver(){Z||(Z=new Set),Z.add(this.updateCssData),fe||(fe=new MutationObserver(r=>{r[0].type==="attributes"&&Z.forEach(t=>{t()})}),fe.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(r,t=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(r);let e=this.getCssData(this.__extractCssName(r),!0);e===null&&(e=t),this.add(r,e),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(r,t,e){let i="__"+r;this[i]=this[r],Object.defineProperty(this,r,{set:s=>{this[i]=s,e?window.setTimeout(()=>{t==null||t(s)}):t==null||t(s)},get:()=>this[i]}),this[r]=this[i]}static set shadowStyles(r){let t=new Blob([r],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(t)}static set rootStyles(r){if(!this.__rootStylesLink){let t=new Blob([r],{type:"text/css"}),e=URL.createObjectURL(t),i=document.createElement("link");i.href=e,i.rel="stylesheet",this.__rootStylesLink=i}}},At=ie;Ct(At,"template");var wt=class{static _print(r){console.warn(r)}static setDefaultTitle(r){this.defaultTitle=r}static setRoutingMap(r){Object.assign(this.appMap,r);for(let t in this.appMap)!this.defaultRoute&&this.appMap[t].default===!0?this.defaultRoute=t:!this.errorRoute&&this.appMap[t].error===!0&&(this.errorRoute=t)}static set routingEventName(r){this.__routingEventName=r}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let r={route:null,options:{}};return window.location.search.split(this.separator).forEach(e=>{if(e.includes("?"))r.route=e.replace("?","");else if(e.includes("=")){let i=e.split("=");r.options[i[0]]=decodeURI(i[1])}else r.options[e]=!0}),r}static notify(){let r=this.readAddressBar(),t=this.appMap[r.route];if(t&&t.title&&(document.title=t.title),r.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!t&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t){this._print(`Route "${r.route}" not found...`);return}let e=new CustomEvent(wt.routingEventName,{detail:{route:r.route,options:Object.assign(t||{},r.options)}});window.dispatchEvent(e)}static reflect(r,t={}){let e=this.appMap[r];if(!e){this._print("Wrong route: "+r);return}let i="?"+r;for(let n in t)t[n]===!0?i+=this.separator+n:i+=this.separator+n+`=${t[n]}`;let s=e.title||this.defaultTitle||"";window.history.pushState(null,s,i),document.title=s}static applyRoute(r,t={}){this.reflect(r,t),this.notify()}static setSeparator(r){this._separator=r}static get separator(){return this._separator||"&"}static createRouterData(r,t){this.setRoutingMap(t);let e=v.registerCtx({route:null,options:null,title:null},r);return window.addEventListener(this.routingEventName,i=>{var s;e.multiPub({route:i.detail.route,options:i.detail.options,title:((s=i.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),wt.notify(),this.initPopstateListener(),e}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};wt.appMap=Object.create(null);function ze(r,t){for(let e in t)e.includes("-")?r.style.setProperty(e,t[e]):r.style[e]=t[e]}var fr="idb-store-ready",ns="symbiote-db",os="symbiote-idb-update_",ls=class{_notifyWhenReady(r=null){window.dispatchEvent(new CustomEvent(fr,{detail:{dbName:this.name,storeName:this.storeName,event:r}}))}get _updEventName(){return os+this.name}_getUpdateEvent(r){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:r}})}_notifySubscribers(r){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,r),window.dispatchEvent(this._getUpdateEvent(r))}constructor(r,t){this.name=r,this.storeName=t,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=e=>{this.db=e.target.result,this.objStore=this.db.createObjectStore(t,{keyPath:"_key"}),this.objStore.transaction.oncomplete=i=>{this._notifyWhenReady(i)}},this.request.onsuccess=e=>{this.db=e.target.result,this._notifyWhenReady(e)},this.request.onerror=e=>{console.error(e)},this._subscriptionsMap={},this._updateHandler=e=>{e.key===this.name&&this._subscriptionsMap[e.newValue]&&this._subscriptionsMap[e.newValue].forEach(async s=>{s(await this.read(e.newValue))})},this._localUpdateHandler=e=>{this._updateHandler(e.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(r){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(r);return new Promise((i,s)=>{e.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?i(n.target.result._value):(i(null),console.warn(`IDB: cannot read "${r}"`))},e.onerror=n=>{s(n)}})}write(r,t,e=!1){let i={_key:r,_value:t},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(i);return new Promise((o,l)=>{n.onsuccess=a=>{e||this._notifySubscribers(r),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(r,t=!1){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(r);return new Promise((s,n)=>{i.onsuccess=o=>{t||this._notifySubscribers(r),s(o)},i.onerror=o=>{n(o)}})}getAll(){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((e,i)=>{t.onsuccess=s=>{let n=s.target.result;e(n.map(o=>o._value))},t.onerror=s=>{i(s)}})}subscribe(r,t){this._subscriptionsMap[r]||(this._subscriptionsMap[r]=new Set);let e=this._subscriptionsMap[r];return e.add(t),{remove:()=>{e.delete(t),e.size||delete this._subscriptionsMap[r]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,pr.clear(this.name)}},pr=class{static get readyEventName(){return fr}static open(r=ns,t="store"){let e=r+"/"+t;return this._reg[e]||(this._reg[e]=new ls(r,t)),this._reg[e]}static clear(r){window.indexedDB.deleteDatabase(r);for(let t in this._reg)t.split("/")[0]===r&&delete this._reg[t]}};Ct(pr,"_reg",Object.create(null));var as=r=>{if(typeof r!="string"||!r)return"";let t=r.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},Et=(...r)=>r.filter(t=>typeof t=="string"&&t).map(t=>as(t)).join("/-/"),je=(...r)=>{let t=Et(...r);return t?`-/${t}/`:""};function Be(r){let t=new URL(r),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),s=e.lastIndexOf("/"),n="";return i>=0?n=e.slice(i):s>=0&&(n=e.slice(s+1)),n}function mr(r){let t=new URL(r),{pathname:e}=t,i=e.indexOf("/"),s=e.indexOf("/",i+1);return e.substring(i+1,s)}function gr(r){let t=yr(r),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}function yr(r){let t=new URL(r),e=Be(r),i=br(e)?_r(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}function br(r){return r.startsWith("http")}function _r(r){let t=new URL(r);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}var He=(r,t,e)=>{let i=new URL(yr(r));if(e=e||Be(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),br(e)){let s=_r(e);i.pathname=i.pathname+(t||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},vr=(r,t)=>{let e=new URL(r);return e.pathname=t+"/",e.toString()};var K=(r,t=",")=>r.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0);var X=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});var Lo=Et("format/auto","progressive/yes"),Y=([r])=>typeof r!="undefined"?Number(r):void 0,wr=()=>!0,cs=([r,t])=>({name:r,amount:typeof t!="undefined"?Number(t):100}),us=([r,t])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:K(r,"x").map(Number),coords:K(t).map(Number)}},ko=Object.freeze({enhance:Y,brightness:Y,exposure:Y,gamma:Y,contrast:Y,saturation:Y,vibrance:Y,warmth:Y,filter:cs,mirror:wr,flip:wr,rotate:Y,crop:us});var xt=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Cr=[xt.CROP,xt.TUNING,xt.FILTERS];var Ro=Object.freeze({brightness:{zero:X.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:X.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:X.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:X.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:X.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:X.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:X.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:X.enhance,range:[0,100],keypointsNumber:1},filter:{zero:X.filter,range:[0,100],keypointsNumber:1}});var ae=r=>r?r.split(",").map(t=>t.trim()).filter(Boolean):[],ce=r=>r?r.join(","):"";var ds="https://ucarecdn.com",hs="https://upload.uploadcare.com",fs="https://social.uploadcare.com",B={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:ce(Cr),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:ds,baseUrl:hs,socialBaseUrl:fs,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:[],cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null};var Ar="--uploadcare-blocks-window-height",ue=class{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),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(Ar)}};u(ue,"clientsRegistry",new Set),u(ue,"flush",$(()=>{document.documentElement.style.setProperty(Ar,`${window.innerHeight}px`)},100));var Er=r=>{var i;let t=new Intl.Locale(r),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e};var Ge=(r,t)=>new Intl.PluralRules(r).select(t);var ps=r=>r,St="{{",Sr="}}",xr="plural:";function Tt(r,t,e={}){var o;let{openToken:i=St,closeToken:s=Sr,transform:n=ps}=e;for(let l in t){let a=(o=t[l])==null?void 0:o.toString();r=r.replaceAll(i+l+s,typeof a=="string"?n(a):a)}return r}function Tr(r){let t=[],e=r.indexOf(St);for(;e!==-1;){let i=r.indexOf(Sr,e),s=r.substring(e+2,i);if(s.startsWith(xr)){let n=r.substring(e+2,i).replace(xr,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));t.push({variable:s,pluralKey:o,countVariable:l})}e=r.indexOf(St,i)}return t}var Or=({element:r,attribute:t,onSuccess:e,onTimeout:i,timeout:s=300})=>{let n=r.getAttribute(t);if(n!==null){e(n);return}let o=new MutationObserver(c=>{let h=c[c.length-1];a(h)});o.observe(r,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{o.disconnect(),i()},s),a=c=>{let h=r.getAttribute(t);c.type==="attributes"&&c.attributeName===t&&h!==null&&(clearTimeout(l),o.disconnect(),e(h))}};function Ir(r){return Object.prototype.toString.call(r)==="[object Object]"}var ms=/\W|_/g;function gs(r){return r.split(ms).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}function Ur(r,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(r)?r.map(e=>ee(e,{ignoreKeys:t})):r}function ee(r,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(r))return Ur(r,{ignoreKeys:t});if(!Ir(r))return r;let e={};for(let i of Object.keys(r)){let s=r[i];if(t.includes(i)){e[i]=s;continue}Ir(s)?s=ee(s,{ignoreKeys:t}):Array.isArray(s)&&(s=Ur(s,{ignoreKeys:t})),e[gs(i)]=s}return e}var ys=r=>new Promise(t=>setTimeout(t,r));function Pt({libraryName:r,libraryVersion:t,userAgent:e,publicKey:i="",integration:s=""}){let n="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:r,libraryVersion:t,languageName:n,integration:s});let o=[r,t,i].filter(Boolean).join("/"),l=[n,s].filter(Boolean).join("; ");return`${o} (${l})`}var bs={factor:2,time:100};function _s(r,t=bs){let e=0;function i(s){let n=Math.round(t.time*t.factor**e);return s({attempt:e,retry:l=>ys(l!=null?l:n).then(()=>(e+=1,i(s)))})}return i(r)}var Ce=class extends Error{},me=class r extends Ce{constructor(e){super();u(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=e}},qe=(r,t)=>{r&&(r.aborted?Promise.resolve().then(t):r.addEventListener("abort",()=>t(),{once:!0}))},se=class r extends Ce{constructor(e="Request canceled"){super(e);u(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,r.prototype)}},vs=500,kr=({check:r,interval:t=vs,timeout:e,signal:i})=>new Promise((s,n)=>{let o,l;qe(i,()=>{o&&clearTimeout(o),n(new se("Poll cancelled"))}),e&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new se("Timed out"))},e));let a=()=>{try{Promise.resolve(r(i)).then(c=>{c?(l&&clearTimeout(l),s(c)):o=setTimeout(a,t)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),w={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"},We="application/octet-stream",Mr="original",ne=({method:r,url:t,data:e,headers:i={},signal:s,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(r==null?void 0:r.toUpperCase())||"GET",h=!1;a.open(c,t,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(f,m)}),a.responseType="text",qe(s,()=>{h=!0,a.abort(),l(new se)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:t,data:e,headers:i||void 0,signal:s,onProgress:n},f=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(C){let A=C.split(": "),y=A.shift(),b=A.join(": ");y&&typeof y!="undefined"&&(m[y]=b)});let p=a.response,g=a.status;o({request:d,data:p,headers:m,status:g})}},a.onerror=d=>{h||l(new me(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),e?a.send(e):a.send()});function ws(r,...t){return r}var Cs=({name:r})=>r?[r]:[],As=ws,Es=()=>new FormData,Pr=r=>!1,Ze=r=>typeof Blob!="undefined"&&r instanceof Blob,Ke=r=>typeof File!="undefined"&&r instanceof File,Ye=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",ge=r=>Ze(r)||Ke(r)||Pr()||Ye(r),xs=r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined",Ss=r=>!!r&&typeof r=="object"&&!Array.isArray(r),Ts=r=>!!r&&typeof r=="object"&&"data"in r&&ge(r.data);function Rr(r,t,e){if(Array.isArray(e))for(let i of e)Rr(r,`${t}[]`,i);else if(Ts(e)){let{name:i,contentType:s}=e,n=As(e.data,i,s!=null?s:We),o=Cs({name:i,contentType:s});r.push([t,n,...o])}else if(Ss(e))for(let[i,s]of Object.entries(e))typeof s!="undefined"&&r.push([`${t}[${i}]`,String(s)]);else xs(e)&&e&&r.push([t,e.toString()])}function Os(r){let t=[];for(let[e,i]of Object.entries(r))Rr(t,e,i);return t}function Je(r){let t=Es(),e=Os(r);for(let i of e){let[s,n,...o]=i;t.append(s,n,...o)}return t}var L=class r extends Ce{constructor(e,i,s,n,o){super();u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=s,this.response=n,this.headers=o,Object.setPrototypeOf(this,r.prototype)}},Is=r=>{let t=new URLSearchParams;for(let[e,i]of Object.entries(r))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(s=>{var n;return(n=s[1])!=null?n:!1}).forEach(s=>t.set(`${e}[${s[0]}]`,String(s[1]))):Array.isArray(i)?i.forEach(s=>{t.append(`${e}[]`,s)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},J=(r,t,e)=>{let i=new URL(r);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Is(e)),i.toString()},Us="6.14.1",Ls="UploadcareUploadClient",ks=Us;function de(r){return Pt({libraryName:Ls,libraryVersion:ks,...r})}var Ms="RequestThrottledError",Lr=15e3,Ps=1e3;function Rs(r){let{headers:t}=r||{};if(!t||typeof t["retry-after"]!="string")return Lr;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:Lr}function oe(r,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return _s(({attempt:s,retry:n})=>r().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Ms&&s<e)return n(Rs(o));if(o instanceof me&&s<i)return n((s+1)*Ps);throw o}))}var Dr=r=>{let t="";return(Ze(r)||Ke(r)||Ye(r))&&(t=r.type),t||We},$r=r=>{let t="";return Ke(r)&&r.name?t=r.name:Ze(r)||Pr()?t="":Ye(r)&&r.name&&(t=r.name),t||Mr};function Rt(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}function Ds(r,{publicKey:t,fileName:e,contentType:i,baseURL:s=w.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",url:J(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":de({publicKey:t,integration:d,userAgent:f})},data:Je({signature:n,expire:o,file:{data:r,name:e||$r(r),contentType:i||Dr(r)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:Rt(l),source:h,metadata:g}),signal:a,onProgress:c}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var Ut;(function(r){r.Token="token",r.FileInfo="file_info"})(Ut||(Ut={}));function $s(r,{publicKey:t,baseURL:e=w.baseURL,store:i,fileName:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",headers:{"X-UC-User-Agent":de({publicKey:t,integration:d,userAgent:f})},url:J(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:r,store:Rt(i),filename:s,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:g}),signal:h}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var R;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(R||(R={}));var Fs=r=>"status"in r&&r.status===R.Error;function Ns(r,{publicKey:t,baseURL:e=w.baseURL,signal:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=w.retryNetworkErrorMaxTimes}={}){return oe(()=>ne({method:"GET",headers:t?{"X-UC-User-Agent":de({publicKey:t,integration:s,userAgent:n})}:void 0,url:J(e,"/from_url/status/",{jsonerrors:1,token:r}),signal:i}).then(({data:a,headers:c,request:h})=>{let d=ee(JSON.parse(a));if("error"in d&&!Fs(d))throw new L(d.error.content,d.error.errorCode,h,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function Vs(r,{publicKey:t,baseURL:e=w.baseURL,jsonpCallback:i,secureSignature:s,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"POST",headers:{"X-UC-User-Agent":de({publicKey:t,integration:a,userAgent:c})},url:J(e,"/group/",{jsonerrors:1}),data:Je({files:r,callback:i,pub_key:t,signature:s,expire:n,source:l}),signal:o}).then(({data:f,headers:m,request:p})=>{let g=ee(JSON.parse(f));if("error"in g)throw new L(g.error.content,g.error.errorCode,p,g,m);return g}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:h})}function Fr(r,{publicKey:t,baseURL:e=w.baseURL,signal:i,source:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"GET",headers:{"X-UC-User-Agent":de({publicKey:t,integration:n,userAgent:o})},url:J(e,"/info/",{jsonerrors:1,pub_key:t,file_id:r,source:s}),signal:i}).then(({data:c,headers:h,request:d})=>{let f=ee(JSON.parse(c));if("error"in f)throw new L(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function zs(r,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:s=w.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",url:J(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":de({publicKey:t,integration:d,userAgent:f})},data:Je({filename:i||Mr,size:r,content_type:e||We,part_size:s,UPLOADCARE_STORE:Rt(a),UPLOADCARE_PUB_KEY:t,signature:o,expire:l,source:h,metadata:g}),signal:c}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b.parts=Object.keys(b.parts).map(O=>b.parts[Number(O)]),b}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})}function js(r,t,{contentType:e,signal:i,onProgress:s,retryThrottledRequestMaxTimes:n=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"PUT",url:t,data:r,onProgress:s,signal:i,headers:{"Content-Type":e||We}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Bs(r,{publicKey:t,baseURL:e=w.baseURL,source:i="local",signal:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"POST",url:J(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":de({publicKey:t,integration:n,userAgent:o})},data:Je({uuid:r,UPLOADCARE_PUB_KEY:t,source:i}),signal:s}).then(({data:c,headers:h,request:d})=>{let f=ee(JSON.parse(c));if("error"in f)throw new L(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Dt(r,{publicKey:t,baseURL:e,source:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return kr({check:h=>Fr(r,{publicKey:t,baseURL:e,signal:h,source:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function Hs(r){return"defaultEffects"in r}var Q=class{constructor(t,{baseCDN:e=w.baseCDN,fileName:i}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:s,s3Bucket:n}=t,o=J(e,`${s}/`),l=n?J(`https://${n}.s3.amazonaws.com/`,`${s}/${t.filename}`):null;this.uuid=s,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=o,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Hs(t)&&(this.defaultEffects=t.defaultEffects)}},Gs=(r,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,baseCDN:g,metadata:C})=>Ds(r,{publicKey:t,fileName:e,contentType:l,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:C}).then(({file:A})=>Dt(A,{publicKey:t,baseURL:i,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(A=>new Q(A,{baseCDN:g})),Xs=(r,{publicKey:t,fileName:e,baseURL:i,signal:s,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h,baseCDN:d})=>Fr(r,{publicKey:t,baseURL:i,signal:s,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h}).then(f=>new Q(f,{baseCDN:d,fileName:e})).then(f=>(n&&n({isComputable:!0,value:1}),f)),qs=(r,{signal:t}={})=>{let e=null,i=null,s=r.map(()=>new AbortController),n=o=>()=>{i=o,s.forEach((l,a)=>a!==o&&l.abort())};return qe(t,()=>{s.forEach(o=>o.abort())}),Promise.all(r.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(e=c,null))})).then(o=>{if(i===null)throw e;return o[i]})},Ws=window.WebSocket,Lt=class{constructor(){u(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(s=>s(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}},Zs=(r,t)=>r==="success"?{status:R.Success,...t}:r==="progress"?{status:R.Progress,...t}:{status:R.Error,...t},kt=class{constructor(t,e=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new Lt);u(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Ws(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.data.toString());switch(i.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(i.channel,Zs(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var s;let i=JSON.stringify({event:t,data:e});(s=this.ws)==null||s.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,s={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(s=>s.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}},Ot=null,$t=r=>{if(!Ot){let t=typeof window=="undefined"?0:3e4;Ot=new kt(r,t)}return Ot},Ks=r=>{$t(r).connect()};function Ys({token:r,publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return kr({check:c=>Ns(r,{publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(h=>{switch(h.status){case R.Error:return new L(h.error,h.errorCode);case R.Waiting:return!1;case R.Unknown:return new L(`Token "${r}" was not found.`);case R.Progress:return l&&(h.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:h.done/h.total})),!1;case R.Success:return l&&l({isComputable:!0,value:h.done/h.total}),h;default:throw new Error("Unknown status")}}),signal:a})}var Js=({token:r,pusherKey:t,signal:e,onProgress:i})=>new Promise((s,n)=>{let o=$t(t),l=o.onError(n),a=()=>{l(),o.unsubscribe(r)};qe(e,()=>{a(),n(new se("pusher cancelled"))}),o.subscribe(r,c=>{switch(c.status){case R.Progress:{i&&(c.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:c.done/c.total}));break}case R.Success:{a(),i&&i({isComputable:!0,value:c.done/c.total}),s(c);break}case R.Error:a(),n(new L(c.msg,c.error_code))}})}),Qs=(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,onProgress:d,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,pusherKey:C=w.pusherKey,metadata:A})=>Promise.resolve(Ks(C)).then(()=>$s(r,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,metadata:A})).catch(y=>{let b=$t(C);return b==null||b.disconnect(),Promise.reject(y)}).then(y=>y.type===Ut.FileInfo?y:qs([({signal:b})=>Ys({token:y.token,publicKey:t,baseURL:i,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,onProgress:d,signal:b}),({signal:b})=>Js({token:y.token,pusherKey:C,signal:b,onProgress:d})],{signal:h})).then(y=>{if(y instanceof L)throw y;return y}).then(y=>Dt(y.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,onProgress:d,signal:h})).then(y=>new Q(y,{baseCDN:s})),It=new WeakMap,en=async r=>{if(It.has(r))return It.get(r);let t=await fetch(r.uri).then(e=>e.blob());return It.set(r,t),t},Nr=async r=>{if(Ke(r)||Ze(r))return r.size;if(Ye(r))return(await en(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},tn=(r,t=w.multipartMinFileSize)=>r>=t,Vr=r=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!ge(r)&&e.test(r)},Ft=r=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!ge(r)&&e.test(r)},rn=(r,t)=>new Promise((e,i)=>{let s=[],n=!1,o=t.length,l=[...t],a=()=>{let c=t.length-l.length,h=l.shift();h&&h().then(d=>{n||(s[c]=d,o-=1,o?a():e(s))}).catch(d=>{n=!0,i(d)})};for(let c=0;c<r;c++)a()}),sn=(r,t,e,i)=>{let s=i*t,n=Math.min(s+i,e);return r.slice(s,n)},nn=async(r,t,e)=>i=>sn(r,i,t,e),on=(r,t,{publicKey:e,contentType:i,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>js(r,t,{publicKey:e,contentType:i,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),ln=async(r,{publicKey:t,fileName:e,fileSize:i,baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,contentType:g,multipartChunkSize:C=w.multipartChunkSize,maxConcurrentRequests:A=w.maxConcurrentRequests,baseCDN:y,metadata:b})=>{let O=i!=null?i:await Nr(r),N,H=(I,P)=>{if(!c)return;N||(N=Array(I).fill(0));let j=G=>G.reduce((W,_t)=>W+_t,0);return G=>{G.isComputable&&(N[P]=G.value,c({isComputable:!0,value:j(N)/I}))}};return g||(g=Dr(r)),zs(O,{publicKey:t,contentType:g,fileName:e||$r(r),baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:b}).then(async({uuid:I,parts:P})=>{let j=await nn(r,O,C);return Promise.all([I,rn(A,P.map((G,W)=>()=>on(j(W),G,{publicKey:t,contentType:g,onProgress:H(P.length,W),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})))])}).then(([I])=>Bs(I,{publicKey:t,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})).then(I=>I.isReady?I:Dt(I.uuid,{publicKey:t,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(I=>new Q(I,{baseCDN:y}))};async function Nt(r,{publicKey:t,fileName:e,baseURL:i=w.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartMinFileSize:g,multipartChunkSize:C,maxConcurrentRequests:A,baseCDN:y=w.baseCDN,checkForUrlDuplicates:b,saveUrlForRecurrentUploads:O,pusherKey:N,metadata:H}){if(ge(r)){let I=await Nr(r);return tn(I,g)?ln(r,{publicKey:t,contentType:p,multipartChunkSize:C,fileSize:I,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,maxConcurrentRequests:A,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:H}):Gs(r,{publicKey:t,fileName:e,contentType:p,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:H})}if(Ft(r))return Qs(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:y,checkForUrlDuplicates:b,saveUrlForRecurrentUploads:O,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:N,metadata:H});if(Vr(r))return Xs(r,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y});throw new TypeError(`File uploading from "${r}" is not supported`)}var Mt=class{constructor(t,{baseCDN:e=w.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((s,n)=>s+n.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(s=>s.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(s=>new Q(s,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}},an=r=>{for(let t of r)if(!ge(t))return!1;return!0},cn=r=>{for(let t of r)if(!Vr(t))return!1;return!0},un=r=>{for(let t of r)if(!Ft(t))return!1;return!0};function zr(r,{publicKey:t,fileName:e,baseURL:i=w.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:g=w.multipartChunkSize,baseCDN:C=w.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:y,jsonpCallback:b}){if(!an(r)&&!un(r)&&!cn(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let O,N=!0,H=r.length,I=(P,j)=>{if(!a)return;O||(O=Array(P).fill(0));let G=W=>W.reduce((_t,Pi)=>_t+Pi)/P;return W=>{if(!W.isComputable||!N){N=!1,a({isComputable:!1});return}O[j]=W.value,a({isComputable:!0,value:G(O)})}};return Promise.all(r.map((P,j)=>ge(P)||Ft(P)?Nt(P,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:I(H,j),source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:g,baseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:y}).then(G=>G.uuid):P)).then(P=>Vs(P,{publicKey:t,baseURL:i,jsonpCallback:b,secureSignature:s,secureExpire:n,signal:l,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(j=>new Mt(j,{baseCDN:C})).then(j=>(a&&a({isComputable:!0,value:1}),j)))}var Xe=class{constructor(t){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){let i=this._pending.shift();if(!i)return;let s=this._resolvers.get(i),n=this._rejectors.get(i);if(!s||!n)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(o=>s(o)).catch(o=>n(o))}}add(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};var Vt=()=>({}),zt=r=>({...Vt(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.set$({"*currentActivity":null,"*modalActive":!1})}}),Qe=r=>({...zt(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Xe(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null});var te=r=>`*l10n/${r}`,dn="en",et=class{constructor(t){u(this,"_blockInstance",null);u(this,"_localeName","");u(this,"_callbacks",new Set);u(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(_e))this._blockInstance.add(te(e),i,!1);setTimeout(()=>{t.subConfigValue("localeName",async e=>{var n;if(!this._blockInstance||!e)return;this._localeName=e;let i=await ar(e);if(e!==dn&&this._localeName!==e)return;let s=(n=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:n[e];for(let[o,l]of Object.entries(i)){let a=s==null?void 0:s[o];this._blockInstance.add(te(o),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),t.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let i=e[this._localeName];if(i)for(let[n,o]of Object.entries(i)){(s=this._blockInstance)==null||s.add(te(n),o,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=$(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var n,o,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(o=(n=this._boundBlocks.get(t))==null?void 0:n.get(e))==null||o();let s=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,s)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};function jr(r,t){[...r.querySelectorAll("[l10n]")].forEach(e=>{let i=e.getAttribute("l10n");if(!i)return;let s="textContent",n=!1;if(i.includes(":")){let a=i.split(":");s=a[0],i=a[1],s.startsWith("@")&&(s=s.slice(1),n=!0)}let o=i;t.has(o)&&t.sub(o,a=>{if(!a)return;t.l10nProcessorSubs.has(o)||t.l10nProcessorSubs.set(o,new Set);let c=t.l10nProcessorSubs.get(o);c==null||c.forEach(f=>{f.remove(),c.delete(f),t.allSubs.delete(f)});let h=te(a).replace("*","");t.nodeCtx.has(h)||t.nodeCtx.add(h,a);let d=t.nodeCtx.sub(h,()=>{e[s]=t.l10n(a)});c==null||c.add(d),t.allSubs.add(d),e.removeAttribute("l10n")});let l=te(i);t.has(l)||t.add(l,""),t.sub(l,()=>{i=i,n?e.setAttribute(s,t.l10n(i)):e[s]=t.l10n(i)}),e.removeAttribute("l10n")})}var k=r=>`*cfg/${r}`;var hn={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ae(r,t){t.tabIndex=0,t.focus(),r.tabIndex=-1}function jt(r){let t=r.role||r.type||r.tagName;if(!t)return null;let e=hn[t.toLowerCase()];if(!e)return null;for(let i of e){let s=r.closest(`[role=${i}]`);if(s)return s}}function Bt(r,t){return t.role==="toolbar"?fn(t):t.querySelectorAll(`[role=${r.role}]`)}function fn(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function pn(r){let t=r.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function Br(r){return t=>{let e=!1,i=(r==null?void 0:r.searchDelayMs)||300,s=0,n="";function o(d){let f=jt(d.target);if(!f){l();return}let m=Bt(d.target,f),p=Array.from(m).indexOf(d.target),g="ArrowDown",C="ArrowUp";if(pn(f)&&(t.document.dir==="rtl"?(g="ArrowLeft",C="ArrowRight"):(g="ArrowRight",C="ArrowLeft")),d.key===g)d.preventDefault(),Ae(d.target,m[p+1]||m[0]);else if(d.key===C)d.preventDefault(),Ae(d.target,m[p-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),Ae(d.target,m[0]);else if(d.key==="End")d.preventDefault(),Ae(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let A=Date.now();A-s<=i?n+=d.key.toLowerCase():n=d.key.toLowerCase(),s=A;let y=Array.from(m).find(b=>{var O,N,H;return(H=(N=(O=b.textContent)==null?void 0:O.trim())==null?void 0:N.toLowerCase())==null?void 0:H.startsWith(n)});y&&(d.preventDefault(),Ae(d.target,y))}}function l(){e=!1,t.removeEventListener("keydown",o)}function a(d){let f=jt(d.target);if(f){e||(e=!0,t.addEventListener("keydown",o));let m=Bt(d.target,f);for(let p of m)p!==d.target&&p.setAttribute("tabindex",-1)}else e&&l()}function c(d){(!d.relatedTarget||d.relatedTarget===t.document)&&l()}function h(d){let f=jt(d.target);if(f){let m=Bt(d.target,f);for(let p of m)p!==d.target&&p.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return t.addEventListener("click",h),t.addEventListener("focusin",a),t.addEventListener("focusout",c),()=>{l(),t.removeEventListener("click",h),t.removeEventListener("focusin",a),t.removeEventListener("focusout",c)}}}function Hr(){return r=>{let t,e;function i(n){if(n.target.getAttribute("aria-hidden")==="true"){t=n.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.hidden=!1);let o=n.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');o&&(o.tabIndex=0)}}function s(n){t&&t.contains(n.target)&&(!n.relatedTarget||!t.contains(n.relatedTarget))&&(n.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return r.addEventListener("keyuxJump",i),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",i),r.removeEventListener("focusout",s)}}}function Gr(){return r=>{let t=[];function e(c){let h=r.document.activeElement;h&&h!==r.document.body&&t.push(new WeakRef(h)),c.focus({focusVisible:!0})}function i(){let c=t.pop();if(!c){r.document.activeElement.blur();return}let h=c.deref();h&&h.isConnected?h.focus():i()}let s=0,n;function o(c){clearInterval(n);let h=c.getAttribute("aria-controls");h&&(n=setInterval(()=>{if(s++>50){clearInterval(n);return}let d=r.document.getElementById(h);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(n),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(f))}},50))}function l(c){c.clientX===0&&c.clientY===0&&o(c.target)}function a(c){c.target.tagName==="INPUT"&&c.key==="Enter"&&o(c.target),c.key==="Escape"&&i()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function Xr(r){let t,e=r.split(" ");function i(){t&&t.classList.remove(...e)}function s(n){n.clientX===0&&n.clientY===0&&(i(),n.target.classList.add(...e),t=n.target)}return n=>(n.addEventListener("keyup",i),n.addEventListener("click",s),()=>{n.removeEventListener("keyup",i),n.removeEventListener("click",s)})}function qr(r,t){let e=t.map(i=>i(r));return()=>{e.forEach(i=>i())}}var Ht=class{constructor(){u(this,"_listeners",new Map);u(this,"_scope",[])}addEventListener(t,e){let i=s=>{let n=s.target;n&&this._scope.some(o=>o===s.target||o.contains(n))&&e(s)};this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}},tt=class{constructor(){u(this,"_destroyKeyUX");u(this,"_scopedWindow");this._scopedWindow=new Ht,this._destroyKeyUX=qr(this._scopedWindow,[Br(),Xr("is-pressed"),Gr(),Hr()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};var mn="uc-",U=class extends At{constructor(){super();u(this,"requireCtxName",!1);u(this,"activityType",null);u(this,"init$",Vt());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(jr)}l10n(e,i={}){if(!e)return"";let s=this.$[te(e)]||e,n=Tr(s);for(let l of n)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return Tt(s,i)}pluralize(e,i){let s=this.l10n("locale-id")||"en",n=Ge(s,i);return this.l10n(`${e}__${n}`)}bindL10n(e,i){var s;(s=this.localeManager)==null||s.bindL10n(this,e,i)}emit(e,i,s){let n=this.has("*eventEmitter")&&this.$["*eventEmitter"];n&&n.emit(e,i,s)}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Or({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),ue.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),ue.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Fe(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new et(this)),this.has("*a11y")||this.add("*a11y",new tt),this.sub(te("locale-id"),i=>{let s=Er(i);this.style.direction=s==="ltr"?"":s})}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 i;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,v.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;v.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:mr(e),cdnUrlModifiers:gr(e),fileName:Be(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?Tt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(i,s,n)=>{if(typeof s!="string")return!1;let o=k(s);return this.has(o)||this.add(o,B[s]),this.$[o]=n,!0},get:(i,s)=>{let n=k(s);return this.has(n)||this.add(n,B[s]),this.$[k(s)]}})}return this.__cfgProxy}subConfigValue(e,i){let s=k(e);this.has(s)||this.add(s,B[e]),this.sub(s,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];i=s()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(mn)&&super.reg(e)}};u(U,"StateConsumerScope",null),u(U,"styleAttrs",[]);var Wr="active",Ee="___ACTIVITY_IS_ACTIVE___",re=class re extends U{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",zt(this));u(this,"_debouncedHistoryFlush",$(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=re._activityCallbacks.get(this);this[Ee]=!1,this.removeAttribute(Wr),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=re._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ee]=!0,this.setAttribute(Wr,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(E.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",e=>{this.setAttribute("current-activity",e)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Ee]?this._deactivate():this.activityType===e&&!this[Ee]&&this._activate()}catch(s){console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",e=>{!e&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&re._activityCallbacks.has(this)}get isActivityActive(){return this[Ee]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:s,onDeactivate:n}=i;re._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:n})}unregisterActivity(){this.isActivityActive&&this._deactivate(),re._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof re&&s.activityType===e)||(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 i;let e=this.$["*history"];if(e){let s=e.pop();for(;s===this.activityType;)s=e.pop();let n=!!s;if(s){let o=[...this.blocksRegistry].find(l=>l.activityType===s);n=(i=o==null?void 0:o.couldOpenActivity)!=null?i:!1}s=n?s:void 0,this.$["*currentActivity"]=s,this.$["*history"]=e,s||this.setOrAddState("*modalActive",!1)}}};u(re,"_activityCallbacks",new Map);var x=re;x.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"});var Zr="<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 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var xe=class extends U{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",Qe(this));u(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=Zr+e+"<slot></slot>"}static get template(){return this._template}};u(xe,"styleAttrs",["uc-wgt-common"]);var Se=class Se extends xe{initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||x.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=x.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||x.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};u(Se,"styleAttrs",[...De(Se,Se,"styleAttrs"),"uc-file-uploader-minimal"]);var rt=Se;rt.template=`<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 it=class extends x{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};it.template='<div class="uc-content"><slot></slot></div>';function Kr(r,t,e){let i=r/t,s,n;i>e?(s=Math.round(t*e),n=t):(s=r,n=Math.round(r/e));let o=Math.round((r-s)/2),l=Math.round((t-n)/2);return o+s>r&&(s=r-o),l+n>t&&(n=t-l),{x:o,y:l,width:s,height:n}}var Yr=r=>{if(!r)return[];let[t,e]=r.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:t,height:e}]};var Jr="blocks",Qr="1.12.0";function ei(r){return Pt({...r,libraryName:Jr,libraryVersion:Qr})}var ti=r=>Math.floor(r/1e3),ri=(r,{threshold:t})=>{let{secureExpire:e}=r,i=ti(Date.now()),s=Number(e),n=ti(t);return i+n>=s};var st=class{constructor(t){u(this,"_block");u(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||ri(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 s=await i();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s)}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};var ii="[Typed State] Wrong property name: ",gn="[Typed State] Wrong property type: ",nt=class{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||we.generate(),this.__schema=Object.keys(t).reduce((i,s)=>(i[s]=t[s].value,i),{}),this.__data=v.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(ii+t);return}let i=this.__typedSchema[t];if((e==null?void 0:e.constructor)===i.type||e instanceof i.type||i.nullable&&e===null){this.__data.pub(t,e);return}console.warn(gn+t)}setMultipleValues(t){for(let e in t)this.setValue(e,t[e])}getValue(t){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(ii+t);return}return this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){v.deleteCtx(this.__ctxId)}};var ot=class{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||we.generate(),this.__data=v.registerCtx({},this.__ctxId),this.__watchList=t.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 e=Object.create(null);this.__notifyObservers=(i,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(n=>{n({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new nt(this.__typedSchema);for(let i in t)e.setValue(i,t[i]);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){return this.read(t).getValue(e)}publishProp(t,e,i){this.read(t).setValue(e,i)}remove(t){this.__removed.add(this.__data.read(t)),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let s=this.read(i);t(s)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){v.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};var Gt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),F=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Gt});var Te=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],lt=r=>r?r.filter(t=>typeof t=="string").map(t=>K(t)).flat():[],Xt=(r,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),r.startsWith(e)):r===e),si=(r,t)=>t.some(e=>e.startsWith(".")?r.toLowerCase().endsWith(e.toLowerCase()):!1),ni=r=>{let t=r==null?void 0:r.type;return t?Xt(t,Te):!1};var yn=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,bn=new RegExp(`^/?(${yn.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),oi=({url:r,cdnBase:t})=>{let e=new URL(t),i=new URL(r);if(e.host!==i.host)return null;let[,s,n,o]=bn.exec(i.pathname);return{uuid:s,cdnUrlModifiers:n||"",filename:o||null}};var li=r=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let s=r(...e);return t.set(i,s),s}};var ai=new Set;function at(r){ai.has(r)||(ai.add(r),console.warn(r))}function _n(r){let t=!1;return setTimeout(()=>{t=!0},0),i=>(...s)=>(t&&at(r),i(...s))}function ci(r){let t={progress:()=>r.$["*commonProgress"],errors:()=>r.$["*collectionErrors"],group:()=>r.$["*groupInfo"],totalCount:()=>r.uploadCollection.size,failedCount:()=>e.failedEntries.length,successCount:()=>e.successEntries.length,uploadingCount:()=>e.uploadingEntries.length,status:()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle",isSuccess:()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,isUploading:()=>e.allEntries.some(s=>s.status==="uploading"),isFailed:()=>e.errors.length>0||e.failedEntries.length>0,allEntries:()=>r.getOutputData(),successEntries:()=>e.allEntries.filter(s=>s.status==="success"),failedEntries:()=>e.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>e.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>e.allEntries.filter(s=>s.status==="idle")},e={},i=_n("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(t)){let o=s,a=li(i(n));Object.defineProperty(e,o,{get:a,enumerable:!0})}return e}var Oe=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Sa=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ct=class{constructor(t){u(this,"_ctx");u(this,"addFileFromUrl",(t,{silent:e,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:F.API});return this.getOutputItem(n)});u(this,"addFileFromUuid",(t,{silent:e,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:F.API});return this.getOutputItem(n)});u(this,"addFileFromCdnUrl",(t,{silent:e,fileName:i,source:s}={})=>{var l;let n=oi({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let o=this._uploadCollection.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:(l=i!=null?i:n.filename)!=null?l:null,silent:e!=null?e:!1,source:s!=null?s:F.API});return this.getOutputItem(o)});u(this,"addFileFromObject",(t,{silent:e,fileName:i,source:s,fullPath:n}={})=>{let o=this._uploadCollection.add({file:t,isImage:ni(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:s!=null?s:F.API,fullPath:n!=null?n:null});return this.getOutputItem(o)});u(this,"removeFileByInternalId",t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)});u(this,"uploadAll",()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(E.COMMON_UPLOAD_START,this.getOutputCollectionState()))});u(this,"openSystemDialog",(t={})=>{var n;let e=ce(lt([(n=this.cfg.accept)!=null?n:"",...this.cfg.imgOnly?Te:[]])),i="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(i,""),ze(s,{opacity:0,height:0,width:0,visibility:"hidden"}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let o=ae(this.cfg.cameraModes).includes(Oe.VIDEO);s.accept=["image/*",o&&"video/*"].filter(Boolean).join(",")}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(o=>this.addFileFromObject(o,{source:t.captureCamera?F.CAMERA:F.LOCAL})),this._ctx.$["*currentActivity"]=x.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),s.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(o=>o.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))});u(this,"getOutputItem",t=>{var o,l,a,c,h,d,f,m,p,g;let e=v.getCtx(t).store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(o=i==null?void 0:i.uuid)!=null?o:e.uuid)!=null?l:null,internalId:t,name:(a=i==null?void 0:i.originalFilename)!=null?a:e.fileName,size:(c=i==null?void 0:i.size)!=null?c:e.fileSize,isImage:(h=i==null?void 0:i.isImage)!=null?h:e.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(g=(p=e.metadata)!=null?p:i==null?void 0:i.metadata)!=null?g:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:e.errors,status:s,source:e==null?void 0:e.source}});u(this,"getOutputCollectionState",()=>ci(this._ctx));u(this,"initFlow",(t=!1)=>{var e;if(this._uploadCollection.size>0&&!t)this._ctx.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((e=this._sourceList)==null?void 0:e.length)===1){let i=this._sourceList[0];if(i==="local"){this._ctx.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.openSystemDialog();return}let s=this._ctx.$["*blocksRegistry"],n=l=>"type"in l&&l.type===i,o=[...s].find(n);o==null||o.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":x.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)});u(this,"doneFlow",()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)});u(this,"setCurrentActivity",(t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)});u(this,"getCurrentActivity",()=>this._ctx.$["*currentActivity"]);u(this,"setModalState",t=>{if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",t)});this._ctx=t}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 t=[];return this.cfg.sourceList&&(t=K(this.cfg.sourceList)),t}};var qt=(r,t)=>{let e=t.cfg.imgOnly,i=r.isImage;if(!(!e||i)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:r}}};var Wt=(r,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,s=lt([...e?Te:[],i]);if(!s.length)return;let n=r.mimeType,o=r.name;if(!n||!o)return;let l=Xt(n,s),a=si(o,s);if(!l&&!a)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:r}}};var q=1e3,he=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ie=r=>Math.ceil(r*100)/100,ui=(r,t=he.AUTO)=>{let e=t===he.AUTO;if(t===he.BYTE||e&&r<q**1){let i=Ge("en-US",r),s={one:"byte",other:"bytes"}[i];return`${r} ${s}`}return t===he.KB||e&&r<q**2?`${Ie(r/q**1)} KB`:t===he.MB||e&&r<q**3?`${Ie(r/q**2)} MB`:t===he.GB||e&&r<q**4?`${Ie(r/q**3)} GB`:t===he.TB||e&&r<q**5?`${Ie(r/q**4)} TB`:`${Ie(r/q**5)} PB`};var Zt=(r,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=r.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:ui(e)}),payload:{entry:r}}};var Kt=(r,t)=>{let{internalId:e}=r,i=t._uploadCollection.read(e),s=i==null?void 0:i.getValue("uploadError");if(!s)return;if(s instanceof L)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof me)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let n=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:n.message,payload:{entry:r,error:n}}};var Yt=(r,t)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}};var Jt=(r,t)=>{let e=r.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,s=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}};if(s&&e>s)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}}};var ut={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},dt=class{constructor(t){u(this,"_blockInstance");u(this,"_fileValidators",[qt,Wt,Zt,Kt]);u(this,"_collectionValidators",[Jt,Yt]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=()=>{this.runFileValidators(),this.runCollectionValidators()};this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let s=this._uploadCollection.read(i);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=i(t,this._blockInstance.api);if(!s)continue;s&&(e.push(s),s.message||console.warn(ut.message))}catch(s){console.warn(ut.collection,s)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(E.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let n=s(e,this._blockInstance.api);if(!n)continue;n&&(i.push(n),n.message||console.warn(ut.message))}catch(n){console.warn(ut.file,n)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let s=e(...i);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};var di=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:Q,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:!1,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 D=class r extends x{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!1);u(this,"isCtxOwner",!1);u(this,"init$",Qe(this));u(this,"_flushOutputItems",$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(E.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));u(this,"_handleCollectionUpdate",(e,i,s)=>{var n;(i.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let o of i)o.getValue("silent")||this.emit(E.FILE_ADDED,this.api.getOutputItem(o.uid));for(let o of s)this.$["*uploadTrigger"].delete(o.uid),(n=o.getValue("abortController"))==null||n.abort(),o.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl")),this.emit(E.FILE_REMOVED,this.api.getOutputItem(o.uid));this.$["*uploadList"]=e.map(o=>({uid:o})),this._flushCommonUploadProgress(),this._flushOutputItems()});u(this,"_handleCollectionPropertiesUpdate",e=>{this._flushOutputItems();let i=this.uploadCollection,s=[...new Set(Object.entries(e).filter(([n])=>["uploadError","fileInfo"].includes(n)).map(([,n])=>[...n]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),e.uploadProgress){for(let n of e.uploadProgress){let{isUploading:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(E.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(n))}this._flushCommonUploadProgress()}if(e.isUploading)for(let n of e.isUploading){let{isUploading:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(E.FILE_UPLOAD_START,this.api.getOutputItem(n))}if(e.fileInfo){for(let n of e.fileInfo){let{fileInfo:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(E.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(n))}this.cfg.cropPreset&&this.setInitialCrop()}if(e.errors){for(let l of e.errors){let{errors:a}=v.getCtx(l).store;a.length>0&&(this.emit(E.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(E.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let n=i.findItems(l=>!!l.getValue("fileInfo")),o=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&o.length===0&&i.size===n.length&&this.$["*collectionErrors"].length===0&&this.emit(E.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(o=>{var l;return!!((l=this.uploadCollection.read(o))!=null&&l.getValue("cdnUrl"))}).forEach(o=>{this.emit(E.FILE_URL_CHANGED,this.api.getOutputItem(o))}),this.$["*groupInfo"]=null)});u(this,"_flushCommonUploadProgress",()=>{let e=0,s=[...this.$["*uploadTrigger"]].filter(o=>!!this.uploadCollection.read(o));s.forEach(o=>{let l=this.uploadCollection.readProp(o,"uploadProgress");e+=l});let n=s.length?Math.round(e/s.length):0;this.$["*commonProgress"]!==n&&(this.$["*commonProgress"]=n,this.emit(E.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))})}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof r?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new ot({typedSchema:di,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new ct(this)),this.has("*validationManager")||this.add("*validationManager",new dt(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 e,i;(e=this._unobserveCollectionProperties)==null||e.call(this),(i=this._unobserveCollection)==null||i.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",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new st(this)),this.has("*modalActive")&&this.sub("*modalActive",e=>{e&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(e){let i=await this.getUploadClientOptions(),s=e.allEntries.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:"")),n=new AbortController,o=await zr(s,{...i,signal:n.signal});if(this.$["*collectionState"]!==e){n.abort();return}this.$["*groupInfo"]=o;let l=this.api.getOutputCollectionState();this.emit(E.GROUP_CREATED,l),this.emit(E.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let e=Yr(this.cfg.cropPreset);if(e){let[i]=e,s=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of s){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=i.width/i.height,h=Kr(l,a,c),d=je(`crop/${h.width}x${h.height}/${h.x},${h.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:He(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===x.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:n.uid},this.$["*currentActivity"]=x.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let s=this.api.getOutputItem(e);return await i(s)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:ei,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.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(s=>this.api.getOutputItem(s))}};D.extSrcList=Object.freeze({...Gt});D.sourceTypes=Object.freeze({...F});var T=r=>String(r),V=r=>{let t=Number(r);if(Number.isNaN(t))throw new Error(`Invalid number: "${r}"`);return t},S=r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},vn=r=>r==="auto"?r:S(r),wn=r=>{let t=T(r);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid value: "${t}"`);return t},Cn=r=>{let t=T(r);if(!Object.values(Oe).includes(t))throw new Error(`Invalid value: "${t}"`);return t},An=r=>{let t=T(r),e=ae(t);if(e.some(i=>!Object.values(Oe).includes(i)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return t},En=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},hi=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Qt=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},fi=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},xn={pubkey:T,multiple:S,multipleMin:V,multipleMax:V,confirmUpload:S,imgOnly:S,accept:T,externalSourcesPreferredTypes:T,externalSourcesEmbedCss:T,store:vn,cameraMirror:S,cameraCapture:wn,sourceList:T,maxLocalFileSizeBytes:V,thumbSize:V,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:T,removeCopyright:S,cropPreset:T,imageShrink:T,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:T,cdnCname:T,baseUrl:T,socialBaseUrl:T,secureSignature:T,secureExpire:T,secureDeliveryProxy:T,retryThrottledRequestMaxTimes:V,multipartMinFileSize:V,multipartChunkSize:V,maxConcurrentRequests:V,multipartMaxConcurrentRequests:V,multipartMaxAttempts:V,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:T,debug:S,localeName:T,metadata:En,secureUploadsExpireThreshold:V,localeDefinitionOverride:hi,secureUploadsSignatureResolver:Qt,secureDeliveryProxyUrlResolver:Qt,iconHrefResolver:Qt,fileValidators:fi,collectionValidators:fi,cameraModes:An,defaultCameraMode:Cn,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:hi,maxVideoRecordingDuration:V},pi=(r,t)=>{if(!(typeof t=="undefined"||t===null))try{return xn[r](t)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),B[r]}};function Sn(r){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=s=>{s.type!=="loadend"&&e.abort(),t(!1)};e.onloadend=i,e.onprogress=i,e.readAsDataURL(r)}catch{t(!1)}})}function Tn(r,t){return new Promise(e=>{let i=0,s=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(a=>{i--;let c=new File([a],a.name,{type:a.type||t});s.push({type:"file",file:c,fullPath:l.fullPath}),i===0&&e(s)})):l.isDirectory&&o(l.createReader())},o=l=>{i++,l.readEntries(a=>{i--;for(let c of a)n(c);i===0&&e(s)})};n(r)})}function mi(r){let t=[],e=[];for(let i=0;i<r.items.length;i++){let s=r.items[i];if(s)if(s.kind==="file"){let n=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();e.push(Tn(l,n).then(a=>{a&&t.push(...a)}));continue}let o=s.getAsFile();o&&e.push(Sn(o).then(l=>{l||t.push({type:"file",file:o})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&e.push(new Promise(n=>{s.getAsString(o=>{t.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(e).then(()=>t)}var M={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},gi=["focus"],On=100,er=new Map;function In(r,t){let e=Math.max(Math.min(r[0],t.x+t.width),t.x),i=Math.max(Math.min(r[1],t.y+t.height),t.y);return Math.sqrt((r[0]-e)*(r[0]-e)+(r[1]-i)*(r[1]-i))}function tr(r){let t=0,e=document.body,i=new Set,s=p=>i.add(p),n=M.INACTIVE,o=p=>{r.shouldIgnore()&&p!==M.INACTIVE||(n!==p&&i.forEach(g=>g(p)),n=p)},l=()=>t>0;s(p=>r.onChange(p));let a=()=>{t=0,o(M.INACTIVE)},c=()=>{t+=1,n===M.INACTIVE&&o(M.ACTIVE)},h=()=>{t-=1,l()||o(M.INACTIVE)},d=p=>{p.preventDefault(),t=0,o(M.INACTIVE)},f=p=>{if(r.shouldIgnore())return;l()||(t+=1);let g=[p.x,p.y],C=r.element.getBoundingClientRect(),A=Math.floor(In(g,C)),y=A<On,b=p.composedPath().includes(r.element);er.set(r.element,A);let O=Math.min(...er.values())===A;b&&O?(p.preventDefault(),o(M.OVER)):o(y&&O?M.NEAR:M.ACTIVE)},m=async p=>{if(r.shouldIgnore())return;p.preventDefault();let g=await mi(p.dataTransfer);r.onItems(g),o(M.INACTIVE)};return e.addEventListener("drop",d),e.addEventListener("dragleave",h),e.addEventListener("dragenter",c),e.addEventListener("dragover",f),r.element.addEventListener("drop",m),gi.forEach(p=>{window.addEventListener(p,a)}),()=>{er.delete(r.element),e.removeEventListener("drop",d),e.removeEventListener("dragleave",h),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",f),r.element.removeEventListener("drop",m),gi.forEach(p=>{window.removeEventListener(p,a)})}}var yi="uc-drop-area",ye=`${yi}/registry`,Ue=class Ue extends D{constructor(){super(),this.init$={...this.init$,state:M.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[ye]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[ye]||(this.$[ye]=new Set),this.$[ye].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!S(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:S(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:S(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:S(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=tr({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this.$.state=e},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:F.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:F.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=tr({element:t,onChange:e=>{var s;let i=(s=Object.entries(M).find(([,n])=>n===e))==null?void 0:s[0].toLowerCase();i&&t.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",e=>{var s;let i=(s=Object.entries(M).find(([,n])=>n===e))==null?void 0:s[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=K(e);this.$.isEnabled=i.includes(F.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{e.type==="keydown"?(e.code==="Space"||e.code==="Enter")&&this.api.openSystemDialog():e.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.$[ye]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[ye];t&&(t.delete(this),t.size===0&&v.deleteCtx(yi)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};u(Ue,"styleAttrs",[...De(Ue,Ue,"styleAttrs"),"uc-drop-area"]);var Le=Ue;Le.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;Le.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var bi=(r,t)=>{let e,i,s,n=(...o)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=t&&(r(...o),s=Date.now())},Math.max(t-(Date.now()-s),0))):(r(...o),s=Date.now(),e=!0)};return Object.defineProperty(n,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),n};var ht=class extends D{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",x.activities.UPLOAD_LIST);u(this,"_throttledHandleCollectionUpdate",bi(()=>{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(E.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(E.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},s=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),n=e.errors.some(f=>f.type==="TOO_MANY_FILES"),o=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.errors.length===0,a=!1,c=!1,h=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&s)a=!0;else{c=!0;let f=this.cfg.groupOutput?!!e.group:!0;h=i.total===i.succeed&&s&&l&&f}this.set$({doneBtnVisible:c,doneBtnEnabled:h,uploadBtnVisible:a,addMoreBtnEnabled:i.total===0||!n&&!o,addMoreBtnVisible:!o||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(e){let i=s=>{let n=e[s];return this.l10n(`header-${s}`,{count:n})};return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.succeed>0?i("succeed"):i("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",e=>{e&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};ht.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="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" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var pt=()=>{let r=[];return{stack:r,promiseReadJpegChunks:e=>new Promise((i,s)=>{let n=2,o=(c,h)=>{let d=new FileReader;d.addEventListener("load",()=>{h(new DataView(d.result))}),d.addEventListener("error",f=>{s(`Reader error: ${f}`)}),d.readAsArrayBuffer(c)},l=()=>o(e.slice(n,n+128),c=>{let h,d,f;for(h=d=0,f=c.byteLength;f>=0?d<f:d>f;h=f>=0?++d:--d)if(c.getUint8(h)===255){n+=h;break}a()}),a=()=>{let c=n;return o(e.slice(n,n+=4),h=>{if(h.byteLength!==4||h.getUint8(0)!==255){s("Corrupted");return}let d=h.getUint8(1);if(d===218){i(!0);return}let f=h.getUint16(2)-2;return o(e.slice(n,n+=f),m=>{if(m.byteLength!==f){s("Corrupted");return}r.push({startPos:c,length:f,marker:d,view:m}),l()})})};FileReader&&DataView||s("Not Support"),o(e.slice(0,2),c=>{c.getUint16(0)!==65496&&s("Not jpeg"),l()})})}},Un=async r=>{let t=[],{promiseReadJpegChunks:e,stack:i}=pt();return await e(r),i.forEach(({marker:s,view:n})=>{s===226&&n.getUint32(0)===1229144927&&n.getUint32(4)===1347571526&&n.getUint32(8)===1229735168&&t.push(n)}),t},vi=async(r,t,e)=>{{let i=[],s=[],{promiseReadJpegChunks:n,stack:o}=pt();await n(r),o.forEach(c=>{if(c.marker===t)return i.push(c.startPos),s.push(c.length)});let l=[r.slice(0,2)];for(let c of e){let h=new DataView(new ArrayBuffer(4));h.setUint16(0,65280+t),h.setUint16(2,c.byteLength+2),l.push(h.buffer),l.push(c)}let a=2;for(let c=0;c<i.length;c++)i[c]>a&&l.push(r.slice(a,i[c])),a=i[c]+s[c]+4;return l.push(r.slice(a,r.size)),new Blob(l,{type:r.type})}};var wi=(r,t)=>vi(r,226,t.map(e=>e.buffer)),Ln=async r=>{try{return await wi(r,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},kn=(r,t,e)=>new Promise((i,s)=>{let n=o=>{if(!o){s("Failed to convert canvas to blob");return}i(o)};r.toBlob(n,t,e),r.width=r.height=1}),ke=()=>{let r=document.createElement("canvas"),t=r.getContext("2d");return{canvas:r,ctx:t}},Mn=r=>{let{ctx:e,canvas:i}=ke();i.width=i.height=50,e.drawImage(r,0,0,50,50);let s=e.getImageData(0,0,50,50).data;i.width=i.height=1;for(let n=3;n<s.length;n+=4)if(s[n]<254)return!0;return!1},Pn=async r=>{let t=null,{promiseReadJpegChunks:e,stack:i}=pt();return await e(r),i.forEach(({marker:s,view:n})=>{if(!t&&s===225&&n.byteLength>=14&&n.getUint32(0)===1165519206&&n.getUint16(4)===0){t=n;return}}),t},Rn="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ft,Dn=()=>new Promise(r=>{if(ft!==void 0)r(ft);else{let t=new Image;t.addEventListener("load",()=>{ft=t.naturalWidth<t.naturalHeight,t.src="//:0",r(ft)}),t.src=Rn}}),$n=(r,t)=>{let e,i,s,n;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)i=!0;else if(r.getUint16(6)===19789)i=!1;else return;if(r.getUint16(8,i)!==42)return;s=8+r.getUint32(10,i);let o=r.getUint16(s-2,i);for(e=0,n=o;n>=0?e<n:e>n;n>=0?++e:--e){if(r.byteLength<s+10)return;r.getUint16(s,i)===274&&t(s+8,i),s+=12}},Fn=(r,t)=>{$n(r,(e,i)=>r.setUint16(e,t,i))},Nn=async(r,t,e)=>(e&&Fn(t,1),vi(r,225,[t.buffer])),Vn=(r,t)=>new Promise((e,i)=>{t&&(r.src=t),r.complete?e(r):(r.addEventListener("load",()=>{e(r)}),r.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),zn=r=>Vn(new Image,r),jn=[1,3],Bn=[192,193,194,195,197,198,199,201,202,203,205,206,207],_i={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Hn=async r=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=pt();return await e(r).then(()=>(i.forEach(({marker:s,view:n})=>{if(!t&&Bn.indexOf(s)>=0){let o=n.getUint8(5);jn.indexOf(o)<0&&(t=!0)}}),t)).catch(()=>t)},Ci=(r,t)=>{let e={};return(...i)=>{let s=t(i,e);return s in e?e[s]:e[s]=r(...i)}},Ai=(r,t)=>{let[e]=r,i=Object.keys(t).map(s=>parseInt(s,10)).sort((s,n)=>s-n);for(let s=0;s<i.length;s++){let n=i[s],o=!!t[n];if(n>e&&o||n<e&&!o)return n}return e},le={R:55,G:110,B:165,A:255},Gn=`rgba(${le.R}, ${le.G}, ${le.B}, ${le.A/255})`,Ei=(r,t)=>{try{let e=[r-1,t-1,1,1],{canvas:i,ctx:s}=ke();i.width=1,i.height=1;let{canvas:n,ctx:o}=ke();n.width=r,n.height=t,o&&(o.fillStyle=Gn,o.fillRect(...e),s.drawImage(n,r-1,t-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,a=!1;return l&&(a=l[0]===le.R&&l[1]===le.G&&l[2]===le.B&&l[3]===le.A),n.width=n.height=1,a}catch{return console.error(`Failed to test for max canvas size of ${r}x${t}.`),!1}};function xi(r){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=r(...t);e(i)},0)})}var Xn=xi(Ci(Ei,Ai)),qn=xi(Ci(Ei,Ai)),Si=async(r,t)=>{let e=_i.squareSide.find(o=>o*o>=r*t),i=_i.dimension.find(o=>o>=r&&o>=t);if(!e||!i)throw new Error("Not supported");let[s,n]=await Promise.all([Xn(e,e),qn(i,1)]);if(s&&n)return!0;throw new Error("Not supported")},Ti=async(r,t,e)=>{try{let{ctx:i,canvas:s}=ke();return s.width=t,s.height=e,i.imageSmoothingQuality="high",i.drawImage(r,0,0,t,e),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(i){throw new Error("Canvas resize error",{cause:i})}},Wn=({img:r,targetW:t,targetH:e})=>Ti(r,t,e),Zn=function({sourceW:r,targetW:t,targetH:e,step:i}){let s=[],n=t,o=e;do s.push([n,o]),n=Math.round(n/i),o=Math.round(o/i);while(n<r*i);return s.reverse()},Kn=({img:r,sourceW:t,targetW:e,targetH:i,step:s})=>Zn({sourceW:t,targetW:e,targetH:i,step:s}).reduce((o,[l,a])=>o.then(c=>Si(l,a).then(()=>Ti(c,l,a)).catch(()=>c)),Promise.resolve(r)),Yn=()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Jn=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),rr=.71,Qn=(r,t)=>{if(r.width*rr*r.height*rr<t.size)throw new Error("Not required");let e=r.width,i=r.height,s=e/i,n=Math.floor(Math.sqrt(t.size*s)),o=Math.floor(t.size/Math.sqrt(t.size*s));return Si(n,o).then(()=>{let{ctx:l}=ke();return"imageSmoothingQuality"in l&&!Yn()&&!Jn?Wn({img:r,targetW:n,targetH:o}):Kn({img:r,sourceW:e,targetW:n,targetH:o,step:rr})}).catch(()=>Promise.reject("Not supported"))},Oi=async(r,t)=>{try{if(await Hn(r))throw new Error("Should skipped");let i=await Promise.allSettled([Pn(r),Dn(),Un(r)]),n=!i.some(g=>g.status==="rejected"),[o,l,a]=i,c=await Ln(r).catch(()=>r),h=await zn(URL.createObjectURL(c));URL.revokeObjectURL(h.src);let d=await Qn(h,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!n&&Mn(d)&&(f="image/png",m=void 0);let p=await kn(d,f,m);if(n&&o.status==="fulfilled"&&o.value){let g=o.value,C=l.status==="fulfilled"?l.value:!1;p=await Nn(p,g,C)}return n&&a.status==="fulfilled"&&a.value.length>0&&(p=await wi(p,a.value)),p}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}};function eo(r){let t=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(t)}function ir(r="hsl(209, 21%, 65%)",t=32,e=32){return eo(`<svg width="${t}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}function Ii(r,t=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let e=document.createElement("canvas"),i=e.getContext("2d"),s=new Image,n=new Promise((o,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(e.width=t,e.height=t*a):(e.height=t,e.width=t/a),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(s,0,0,e.width,e.height),e.toBlob(c=>{if(!c){l();return}let h=URL.createObjectURL(c);o(h)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(r),n}var to=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Ui=r=>{let t=to.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}};var z=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),Me=class r extends D{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",$(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",$(this._calculateState.bind(this),100));u(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:z.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=x.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let e of this._entrySubs)e.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(e){let[i]=e;this._isIntersecting=i.isIntersecting,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),i.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let e=this._entry,i=z.IDLE;e.getValue("errors").length>0?i=z.FAILED:e.getValue("isUploading")?i=z.UPLOADING:e.getValue("fileInfo")&&(i=z.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let e=this._entry;if(e.getValue("fileInfo")&&e.getValue("isImage")){let s=this.cfg.thumbSize,n=await this.proxyUrl(He(vr(this.cfg.cdnCname,this._entry.getValue("uuid")),je(e.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),o=e.getValue("thumbUrl");o!==n&&(e.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!e.getValue("thumbUrl"))if((i=e.getValue("file"))!=null&&i.type.includes("image"))try{let s=await Ii(e.getValue("file"),this.cfg.thumbSize);e.setValue("thumbUrl",s)}catch{let n=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ir(n))}else{let s=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ir(s))}}_subEntry(e,i){let s=this._entry.subscribe(e,n=>{this.isConnected&&i(n)});this._entrySubs.add(s)}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=i.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("fileInfo",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),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",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{r.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{e.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),r.activeInstances.add(this)}_handleState(e){var i,s,n,o,l,a,c;e===z.FAILED?this.$.badgeIcon="badge-error":e===z.FINISHED&&(this.$.badgeIcon="badge-success"),e===z.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:e===z.FAILED,isUploading:e===z.UPLOADING,isFinished:e===z.FINISHED,progressVisible:e===z.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((i=this._entry)==null?void 0:i.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:(o=(n=this._entry.getValue("errors"))==null?void 0:n[0])==null?void 0:o.message,ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(l=this._entry)==null?void 0:l.getValue("fileName"),status:this.l10n((c=(a=e==null?void 0:e.description)==null?void 0:a.toLocaleLowerCase())!=null?c:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),r.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 e;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return Ui(this.cfg.imageShrink)}_processShrink(e){return Oi(e,this._settingsOfShrink())}async upload(){var s,n,o,l,a,c;let e=this._entry;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setValue("isUploading",!0),e.setValue("errors",[]);try{let h=new AbortController;e.setValue("abortController",h);let d=async()=>{let m=e.getValue("file");m&&this.cfg.imageShrink&&(m=await this._processShrink(m).catch(()=>m));let p=m||e.getValue("externalUrl")||e.getValue("uuid"),C={...await this.getUploadClientOptions(),fileName:e.getValue("fileName"),source:e.getValue("source"),onProgress:A=>{if(A.isComputable){let y=A.value*100;e.setValue("uploadProgress",y)}},signal:h.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",p,C),Nt(p,C)},f=await this.$["*uploadQueue"].add(d);e.setMultipleValues({fileInfo:f,isUploading:!1,fileName:f.originalFilename,fileSize:f.size,isImage:f.isImage,mimeType:(o=(n=(s=f.contentInfo)==null?void 0:s.mime)==null?void 0:n.mime)!=null?o:f.mimeType,uuid:f.uuid,cdnUrl:(l=e.getValue("cdnUrl"))!=null?l:f.cdnUrl,cdnUrlModifiers:(a=e.getValue("cdnUrlModifiers"))!=null?a:"",uploadProgress:100,source:(c=e.getValue("source"))!=null?c:null}),e===this._entry&&this._debouncedCalculateState()}catch(h){h instanceof se&&h.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:h}),e===this._entry&&this._debouncedCalculateState()}}}};Me.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@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" set="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" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Me.activeInstances=new Set;var Pe=class extends U{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let s=i(t);e=s!=null?s:e}this.$.href=e})})}};Pe.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Pe.bindAttributes({name:"name"});var mt=class extends U{constructor(){super(...arguments);u(this,"_value",0);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",e=>{if(e===void 0)return;let i=this._value;if(this._value=e,e===0&&i>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",e=>{this.ref.line.classList.toggle("uc-progress--hidden",!e)})}};mt.template='<div ref="line" class="uc-progress"></div>';var gt=class extends U{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};u(gt,"template",`<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=class extends D{constructor(){super(...arguments);u(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,ze(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=e.group?e.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let n=e.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&n.length===1){this._validationInputElement.value=n[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let o=new DocumentFragment;for(let l of n){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=l,o.appendChild(a)}this._dynamicInputsContainer.replaceChildren(o)}},!1)}};var yt=r=>{var t;return(t=r.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:t.map(e=>e.toLowerCase()).join("-")};var ro=[{test:r=>r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Li=$(r=>{for(let{test:t,message:e}of ro)t(r)&&at(e)},0);var ki=({key:r,value:t,setValue:e,getValue:i})=>{if(r==="enableVideoRecording"&&t!==null){let s=ae(i("cameraModes"));t&&!s.includes("video")?s=s.concat("video"):t||(s=s.filter(n=>n!=="video")),e("cameraModes",ce(s))}if(r==="defaultCameraMode"&&t!==null){let s=ae(i("cameraModes"));s=s.sort((n,o)=>n===t?-1:o===t?1:0),e("cameraModes",ce(s))}};var nr=[...new Set(["debug",...Object.keys(B)])],io=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],so=r=>io.includes(r),be=nr.filter(r=>!so(r)),no={...Object.fromEntries(be.map(r=>[yt(r),r])),...Object.fromEntries(be.map(r=>[r.toLowerCase(),r]))},oo={...Object.fromEntries(be.map(r=>[yt(r),k(r)])),...Object.fromEntries(be.map(r=>[r.toLowerCase(),k(r)]))},Mi=r=>"__"+r,Re=class extends U{constructor(){super();u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(B).map(([e,i])=>[k(e),i]))}}_flushValueToAttribute(e,i){if(be.includes(e)){let s=[...new Set([yt(e),e.toLowerCase()])];for(let n of s)typeof i=="undefined"||i===null?this.removeAttribute(n):this.getAttribute(n)!==i.toString()&&this.setAttribute(n,i.toString())}}_flushValueToState(e,i){this.$[k(e)]!==i&&(typeof i=="undefined"||i===null?this.$[k(e)]=B[e]:this.$[k(e)]=i)}_setValue(e,i){let s=this,n=pi(e,i),o=Mi(e);s[o]!==n&&(this._assertSameValueDifferentReference(e,s[o],n),s[o]=n,this._flushValueToAttribute(e,n),this._flushValueToState(e,n),this.debugPrint(`[uc-config] "${e}"`,n),Li(this.cfg),ki({key:e,value:n!=null?n:null,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)}))}_getValue(e){var n;let i=this,s=Mi(e);return(n=i[s])!=null?n:this.$[k(e)]}_assertSameValueDifferentReference(e,i,s){this.cfg.debug&&s!==i&&typeof s=="object"&&typeof i=="object"&&JSON.stringify(s)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var i;super.initCallback();let e=this;for(let s of be)this.sub(k(s),n=>{this._setValue(s,n)},!1);for(let s of nr){let n=(i=e[s])!=null?i:this.$[k(s)];n!==B[s]&&this._setValue(s,n),Object.defineProperty(this,s,{set:o=>{this._setValue(s,o)},get:()=>this._getValue(s)})}}attributeChangedCallback(e,i,s){if(i===s)return;let n=this,o=no[e];n[o]=s}};Re.bindAttributes(oo);for(let r of nr)Re.prototype[r]=void 0;var lo=Re;var bt=class extends D{constructor(){super(...arguments);u(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};bt.EventType=E;var ao=bt;export{lo as Config,gt as Copyright,Le as DropArea,Me as FileItem,rt as FileUploaderMinimal,sr as FormInput,Pe as Icon,mt as ProgressBar,it as StartFrom,ao as UploadCtxProvider,ht as UploadList,Ni as defineComponents,lr as defineLocale};
26
+ var Li=Object.defineProperty;var ki=Object.getPrototypeOf;var Pi=Reflect.get;var Mi=(r,t,e)=>t in r?Li(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>(Mi(r,typeof t!="symbol"?t+"":t,e),e);var Pe=(r,t,e)=>Pi(ki(r),e,t);function Ri(r){for(let t in r){let e=[...t].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[t].reg&&r[t].reg(e)}}var ye={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error 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","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var Me=new Map,yt=new Map,ir=(r,t)=>{Me.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),Me.set(r,{...ye,...t})},Di=(r,t)=>{yt.set(r,t)},sr=(r,t)=>{typeof t=="function"?Di(r,t):ir(r,t)},nr=async r=>{if(!Me.has(r)){if(!yt.has(r))throw new Error(`Locale ${r} is not defined`);let e=await yt.get(r)();ir(r,e)}return Me.get(r)};sr("en",ye);function j(r,t){let e,i=(...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),t)};return i.cancel=()=>{clearTimeout(e)},i}var x=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"}),Re=class{constructor(t){u(this,"_timeoutStore",new Map);u(this,"_targets",new Set);u(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let s of this._targets)s.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,s]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let s=typeof i=="number"?i:20,n=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},s);this._timeoutStore.set(t,n)}};var $i=Object.defineProperty,Fi=(r,t,e)=>t in r?$i(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_t=(r,t,e)=>(Fi(r,typeof t!="symbol"?t+"":t,e),e);function Ni(r){let t=e=>{var i;for(let s in e)((i=e[s])==null?void 0:i.constructor)===Object&&(e[s]=t(e[s]));return{...e}};return t(r)}var v=class{constructor(r){r.constructor===Object?this.store=Ni(r):(this._storeIsProxy=!0,this.store=r),this.callbackMap=Object.create(null)}static warn(r,t){console.warn(`Symbiote Data: cannot ${r}. Prop name: `+t)}read(r){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(v.warn("read",r),null):this.store[r]}has(r){return this._storeIsProxy?this.store[r]!==void 0:this.store.hasOwnProperty(r)}add(r,t,e=!1){!e&&Object.keys(this.store).includes(r)||(this.store[r]=t,this.notify(r))}pub(r,t){if(!this._storeIsProxy&&!this.store.hasOwnProperty(r)){v.warn("publish",r);return}this.store[r]=t,this.notify(r)}multiPub(r){for(let t in r)this.pub(t,r[t])}notify(r){this.callbackMap[r]&&this.callbackMap[r].forEach(t=>{t(this.store[r])})}sub(r,t,e=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(r)?(v.warn("subscribe",r),null):(this.callbackMap[r]||(this.callbackMap[r]=new Set),this.callbackMap[r].add(t),e&&t(this.store[r]),{remove:()=>{this.callbackMap[r].delete(t),this.callbackMap[r].size||delete this.callbackMap[r]},callback:t})}static registerCtx(r,t=Symbol()){let e=v.globalStore.get(t);return e?console.warn('State: context UID "'+t+'" already in use'):(e=new v(r),v.globalStore.set(t,e)),e}static deleteCtx(r){v.globalStore.delete(r)}static getCtx(r,t=!0){return v.globalStore.get(r)||(t&&console.warn('State: wrong context UID - "'+r+'"'),null)}};v.globalStore=new Map;var _=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),ar="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Vi=ar.length-1,_e=class{static generate(r="XXXXXXXXX-XXX"){let t="";for(let e=0;e<r.length;e++)t+=r[e]==="-"?r[e]:ar.charAt(Math.random()*Vi);return t}};function cr(r,t,e){let i=!0,s,n=t.split(".");return n.forEach((o,l)=>{l<n.length-1?r=r[o]:s=o}),r?r[s]=e:i=!1,i}function zi(r){return r.split("-").map((t,e)=>t&&e?t[0].toUpperCase()+t.slice(1):t).join("").split("_").map((t,e)=>t&&e?t.toUpperCase():t).join("")}function ji(r,t){[...r.querySelectorAll(`[${_.REPEAT_ATTR}]`)].forEach(e=>{let i=e.getAttribute(_.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=class extends t.BaseComponent{constructor(){super(),i||(this.style.display="contents")}};let o=e.innerHTML;s.template=o,s.reg(i)}for(;e.firstChild;)e.firstChild.remove();let n=e.getAttribute(_.REPEAT_ATTR);t.sub(n,o=>{if(!o){for(;e.firstChild;)e.firstChild.remove();return}let l=[...e.children],a,c=h=>{h.forEach((f,m)=>{if(l[m])if(l[m].set$)setTimeout(()=>{l[m].set$(f)});else for(let p in f)l[m][p]=f[p];else{a||(a=new DocumentFragment);let p=new s;Object.assign(p.init$,f),a.appendChild(p)}}),a&&e.appendChild(a);let d=l.slice(h.length,l.length);for(let f of d)f.remove()};if(o.constructor===Array)c(o);else if(o.constructor===Object){let h=[];for(let d in o){let f=o[d];Object.defineProperty(f,"_KEY_",{value:d,enumerable:!0}),h.push(f)}c(h)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),e.removeAttribute(_.REPEAT_ATTR),e.removeAttribute(_.REPEAT_ITEM_TAG_ATTR)})}var or="__default__";function Bi(r,t){if(t.shadowRoot)return;let e=[...r.querySelectorAll("slot")];if(!e.length)return;let i={};e.forEach(s=>{let n=s.getAttribute("name")||or;i[n]={slot:s,fr:document.createDocumentFragment()}}),t.initChildren.forEach(s=>{var n;let o=or;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=i[o])==null||n.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(n,s.slot)}else s.slot.remove()})}function Hi(r,t){[...r.querySelectorAll(`[${_.EL_REF_ATTR}]`)].forEach(e=>{let i=e.getAttribute(_.EL_REF_ATTR);t.ref[i]=e,e.removeAttribute(_.EL_REF_ATTR)})}function Gi(r,t){[...r.querySelectorAll(`[${_.BIND_ATTR}]`)].forEach(e=>{let s=e.getAttribute(_.BIND_ATTR).split(";");[...e.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=zi(n.name.replace("-",""));s.push(o+":"+n.value),e.removeAttribute(n.name)}}),s.forEach(n=>{if(!n)return;let o=n.split(":").map(h=>h.trim()),l=o[0],a;l.indexOf(_.ATTR_BIND_PRFX)===0&&(a=!0,l=l.replace(_.ATTR_BIND_PRFX,""));let c=o[1].split(",").map(h=>h.trim());for(let h of c){let d;h.startsWith("!!")?(d="double",h=h.replace("!!","")):h.startsWith("!")&&(d="single",h=h.replace("!","")),t.sub(h,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):cr(e,l,f)||(e[_.SET_LATER_KEY]||(e[_.SET_LATER_KEY]=Object.create(null)),e[_.SET_LATER_KEY][l]=f)})}}),e.removeAttribute(_.BIND_ATTR)})}var De="{{",be="}}",Xi="skip-text";function qi(r){let t,e=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var n;return!((n=s.parentElement)!=null&&n.hasAttribute(Xi))&&s.textContent.includes(De)&&s.textContent.includes(be)&&1}});for(;t=i.nextNode();)e.push(t);return e}var Wi=function(r,t){qi(r).forEach(i=>{let s=[],n;for(;i.textContent.includes(be);)i.textContent.startsWith(De)?(n=i.textContent.indexOf(be)+be.length,i.splitText(n),s.push(i)):(n=i.textContent.indexOf(De),i.splitText(n)),i=i.nextSibling;s.forEach(o=>{let l=o.textContent.replace(De,"").replace(be,"");o.textContent="",t.sub(l,a=>{o.textContent=a})})})},Zi=[ji,Bi,Hi,Gi,Wi],$e="'",he='"',Ki=/\\([0-9a-fA-F]{1,6} ?)/g;function Yi(r){return(r[0]===he||r[0]===$e)&&(r[r.length-1]===he||r[r.length-1]===$e)}function Ji(r){return(r[0]===he||r[0]===$e)&&(r=r.slice(1)),(r[r.length-1]===he||r[r.length-1]===$e)&&(r=r.slice(0,-1)),r}function Qi(r){let t="",e="";for(var i=0;i<r.length;i++){let s=r[i+1];r[i]==="\\"&&s==='"'?(t+='\\"',i++):r[i]==='"'&&e!=="\\"?t+='\\"':t+=r[i],e=r[i]}return t}function es(r){let t=r;Yi(r)&&(t=Ji(t),t=t.replace(Ki,(e,i)=>String.fromCodePoint(parseInt(i.trim(),16))),t=t.replaceAll(`\\
27
+ `,"\\n"),t=Qi(t),t=he+t+he);try{return JSON.parse(t)}catch{throw new Error(`Failed to parse CSS property value: ${t}. Original input: ${r}`)}}var lr=0,de=null,Z=null,ie=class extends HTMLElement{constructor(){super(),_t(this,"updateCssData",()=>{var r;this.dropCssDataCache(),(r=this.__boundCssProps)==null||r.forEach(t=>{let e=this.getCssData(this.__extractCssName(t),!0);e!==null&&this.$[t]!==e&&(this.$[t]=e)})}),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.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return ie}initCallback(){}__initCallback(){var r;this.__initialized||(this.__initialized=!0,(r=this.initCallback)==null||r.call(this))}render(r,t=this.renderShadow){let e;if((t||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let s=this.getAttribute(_.USE_TPL);if(s){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(s))||document.querySelector(s);o?r=o.content.cloneNode(!0):console.warn(`Symbiote template "${s}" is not found...`)}}if(this.processInnerHtml)for(let s of this.tplProcessors)s(this,this);if(r||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(r==null?void 0:r.constructor)===DocumentFragment)e=r;else if((r==null?void 0:r.constructor)===String){let s=document.createElement("template");s.innerHTML=r,e=s.content.cloneNode(!0)}else this.constructor.__tpl&&(e=this.constructor.__tpl.content.cloneNode(!0));for(let s of this.tplProcessors)s(e,this)}let i=()=>{e&&(t&&this.shadowRoot.appendChild(e)||this.appendChild(e)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){t=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.constructor.__shadowStylesUrl,s.onload=i,this.shadowRoot.prepend(s)}else i()}addTemplateProcessor(r){this.tplProcessors.add(r)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=_e.generate(),this.style.setProperty(_.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(_.CSS_CTX_PROP,!0)}get ctxName(){var r;let t=((r=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:r.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=t,t}get localCtx(){return this.__localCtx||(this.__localCtx=v.registerCtx({},this)),this.__localCtx}get nodeCtx(){return v.getCtx(this.ctxName,!1)||v.registerCtx({},this.ctxName)}static __parseProp(r,t){let e,i;if(r.startsWith(_.EXT_DATA_CTX_PRFX))e=t.nodeCtx,i=r.replace(_.EXT_DATA_CTX_PRFX,"");else if(r.includes(_.NAMED_DATA_CTX_SPLTR)){let s=r.split(_.NAMED_DATA_CTX_SPLTR);e=v.getCtx(s[0]),i=s[1]}else e=t.localCtx,i=r;return{ctx:e,name:i}}sub(r,t,e=!0){let i=n=>{this.isConnected&&t(n)},s=ie.__parseProp(r,this);s.ctx.has(s.name)?this.allSubs.add(s.ctx.sub(s.name,i,e)):window.setTimeout(()=>{this.allSubs.add(s.ctx.sub(s.name,i,e))})}notify(r){let t=ie.__parseProp(r,this);t.ctx.notify(t.name)}has(r){let t=ie.__parseProp(r,this);return t.ctx.has(t.name)}add(r,t,e=!1){let i=ie.__parseProp(r,this);i.ctx.add(i.name,t,e)}add$(r,t=!1){for(let e in r)this.add(e,r[e],t)}get $(){if(!this.__stateProxy){let r=Object.create(null);this.__stateProxy=new Proxy(r,{set:(t,e,i)=>{let s=ie.__parseProp(e,this);return s.ctx.pub(s.name,i),!0},get:(t,e)=>{let i=ie.__parseProp(e,this);return i.ctx.read(i.name)}})}return this.__stateProxy}set$(r,t=!1){for(let e in r){let i=r[e];t||![String,Number,Boolean].includes(i==null?void 0:i.constructor)?this.$[e]=i:this.$[e]!==i&&(this.$[e]=i)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(_.CTX_OWNER_ATTR)&&this.getAttribute(_.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let r=this.constructor.__attrDesc;if(r)for(let t of Object.values(r))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(_.EXT_DATA_CTX_PRFX))this.nodeCtx.add(t.replace(_.EXT_DATA_CTX_PRFX,""),this.init$[t],this.__ctxOwner);else if(t.includes(_.NAMED_DATA_CTX_SPLTR)){let e=t.split(_.NAMED_DATA_CTX_SPLTR),i=e[0].trim(),s=e[1].trim();if(i&&s){let n=v.getCtx(i,!1);n||(n=v.registerCtx({},i)),n.add(s,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);this.__dataCtxInitialized=!0}connectedCallback(){var r;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let t=(r=this.getAttribute(_.CTX_NAME_ATTR))==null?void 0:r.trim();if(t&&this.style.setProperty(_.CSS_CTX_PROP,`'${t}'`),this.__initDataCtx(),this[_.SET_LATER_KEY]){for(let e in this[_.SET_LATER_KEY])cr(this,e,this[_.SET_LATER_KEY][e]);delete this[_.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let e of Zi)this.addTemplateProcessor(e);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let e=this.getRootNode();if(!e)return;if(e==null?void 0:e.querySelector(`link[${_.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let s=this.constructor.__rootStylesLink.cloneNode(!0);s.setAttribute(_.ROOT_STYLE_ATTR_NAME,this.constructor.is),s.onload=()=>{this.render()},e.nodeType===Node.DOCUMENT_NODE?e.head.appendChild(s):e.prepend(s)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let r of this.allSubs)r.remove(),this.allSubs.delete(r);for(let r of this.tplProcessors)this.tplProcessors.delete(r);Z==null||Z.delete(this.updateCssData),Z!=null&&Z.size||(de==null||de.disconnect(),de=null,Z=null)},100)))}static reg(r,t=!1){r||(lr++,r=`${_.AUTO_TAG_PRFX}-${lr}`),this.__tag=r;let e=window.customElements.get(r);if(e){!t&&e!==this&&console.warn([`Element with tag name "${r}" 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(r,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(r){this.observedAttributes=Object.keys(r),this.__attrDesc=r}attributeChangedCallback(r,t,e){var i;if(t===e)return;let s=(i=this.constructor.__attrDesc)==null?void 0:i[r];s?this.__dataCtxInitialized?this.$[s]=e:this.init$[s]=e:this[r]=e}getCssData(r,t=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(r)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let e=this.__computedStyle.getPropertyValue(r).trim();try{this.__cssDataCache[r]=es(e)}catch{!t&&console.warn(`CSS Data error: ${r}`),this.__cssDataCache[r]=null}}return this.__cssDataCache[r]}__extractCssName(r){return r.split("--").map((t,e)=>e===0?"":t).join("--")}__initStyleAttrObserver(){Z||(Z=new Set),Z.add(this.updateCssData),de||(de=new MutationObserver(r=>{r[0].type==="attributes"&&Z.forEach(t=>{t()})}),de.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(r,t=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(r);let e=this.getCssData(this.__extractCssName(r),!0);e===null&&(e=t),this.add(r,e),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(r,t,e){let i="__"+r;this[i]=this[r],Object.defineProperty(this,r,{set:s=>{this[i]=s,e?window.setTimeout(()=>{t==null||t(s)}):t==null||t(s)},get:()=>this[i]}),this[r]=this[i]}static set shadowStyles(r){let t=new Blob([r],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(t)}static set rootStyles(r){if(!this.__rootStylesLink){let t=new Blob([r],{type:"text/css"}),e=URL.createObjectURL(t),i=document.createElement("link");i.href=e,i.rel="stylesheet",this.__rootStylesLink=i}}},vt=ie;_t(vt,"template");var bt=class{static _print(r){console.warn(r)}static setDefaultTitle(r){this.defaultTitle=r}static setRoutingMap(r){Object.assign(this.appMap,r);for(let t in this.appMap)!this.defaultRoute&&this.appMap[t].default===!0?this.defaultRoute=t:!this.errorRoute&&this.appMap[t].error===!0&&(this.errorRoute=t)}static set routingEventName(r){this.__routingEventName=r}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let r={route:null,options:{}};return window.location.search.split(this.separator).forEach(e=>{if(e.includes("?"))r.route=e.replace("?","");else if(e.includes("=")){let i=e.split("=");r.options[i[0]]=decodeURI(i[1])}else r.options[e]=!0}),r}static notify(){let r=this.readAddressBar(),t=this.appMap[r.route];if(t&&t.title&&(document.title=t.title),r.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!t&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t){this._print(`Route "${r.route}" not found...`);return}let e=new CustomEvent(bt.routingEventName,{detail:{route:r.route,options:Object.assign(t||{},r.options)}});window.dispatchEvent(e)}static reflect(r,t={}){let e=this.appMap[r];if(!e){this._print("Wrong route: "+r);return}let i="?"+r;for(let n in t)t[n]===!0?i+=this.separator+n:i+=this.separator+n+`=${t[n]}`;let s=e.title||this.defaultTitle||"";window.history.pushState(null,s,i),document.title=s}static applyRoute(r,t={}){this.reflect(r,t),this.notify()}static setSeparator(r){this._separator=r}static get separator(){return this._separator||"&"}static createRouterData(r,t){this.setRoutingMap(t);let e=v.registerCtx({route:null,options:null,title:null},r);return window.addEventListener(this.routingEventName,i=>{var s;e.multiPub({route:i.detail.route,options:i.detail.options,title:((s=i.detail.options)==null?void 0:s.title)||this.defaultTitle||""})}),bt.notify(),this.initPopstateListener(),e}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};bt.appMap=Object.create(null);function Fe(r,t){for(let e in t)e.includes("-")?r.style.setProperty(e,t[e]):r.style[e]=t[e]}var ur="idb-store-ready",ts="symbiote-db",rs="symbiote-idb-update_",is=class{_notifyWhenReady(r=null){window.dispatchEvent(new CustomEvent(ur,{detail:{dbName:this.name,storeName:this.storeName,event:r}}))}get _updEventName(){return rs+this.name}_getUpdateEvent(r){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:r}})}_notifySubscribers(r){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,r),window.dispatchEvent(this._getUpdateEvent(r))}constructor(r,t){this.name=r,this.storeName=t,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=e=>{this.db=e.target.result,this.objStore=this.db.createObjectStore(t,{keyPath:"_key"}),this.objStore.transaction.oncomplete=i=>{this._notifyWhenReady(i)}},this.request.onsuccess=e=>{this.db=e.target.result,this._notifyWhenReady(e)},this.request.onerror=e=>{console.error(e)},this._subscriptionsMap={},this._updateHandler=e=>{e.key===this.name&&this._subscriptionsMap[e.newValue]&&this._subscriptionsMap[e.newValue].forEach(async s=>{s(await this.read(e.newValue))})},this._localUpdateHandler=e=>{this._updateHandler(e.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(r){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(r);return new Promise((i,s)=>{e.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?i(n.target.result._value):(i(null),console.warn(`IDB: cannot read "${r}"`))},e.onerror=n=>{s(n)}})}write(r,t,e=!1){let i={_key:r,_value:t},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(i);return new Promise((o,l)=>{n.onsuccess=a=>{e||this._notifySubscribers(r),o(a.target.result)},n.onerror=a=>{l(a)}})}delete(r,t=!1){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(r);return new Promise((s,n)=>{i.onsuccess=o=>{t||this._notifySubscribers(r),s(o)},i.onerror=o=>{n(o)}})}getAll(){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((e,i)=>{t.onsuccess=s=>{let n=s.target.result;e(n.map(o=>o._value))},t.onerror=s=>{i(s)}})}subscribe(r,t){this._subscriptionsMap[r]||(this._subscriptionsMap[r]=new Set);let e=this._subscriptionsMap[r];return e.add(t),{remove:()=>{e.delete(t),e.size||delete this._subscriptionsMap[r]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,dr.clear(this.name)}},dr=class{static get readyEventName(){return ur}static open(r=ts,t="store"){let e=r+"/"+t;return this._reg[e]||(this._reg[e]=new is(r,t)),this._reg[e]}static clear(r){window.indexedDB.deleteDatabase(r);for(let t in this._reg)t.split("/")[0]===r&&delete this._reg[t]}};_t(dr,"_reg",Object.create(null));var ss=r=>{if(typeof r!="string"||!r)return"";let t=r.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},wt=(...r)=>r.filter(t=>typeof t=="string"&&t).map(t=>ss(t)).join("/-/"),Ne=(...r)=>{let t=wt(...r);return t?`-/${t}/`:""};function Ve(r){let t=new URL(r),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),s=e.lastIndexOf("/"),n="";return i>=0?n=e.slice(i):s>=0&&(n=e.slice(s+1)),n}function hr(r){let t=new URL(r),{pathname:e}=t,i=e.indexOf("/"),s=e.indexOf("/",i+1);return e.substring(i+1,s)}function fr(r){let t=pr(r),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}function pr(r){let t=new URL(r),e=Ve(r),i=mr(e)?gr(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}function mr(r){return r.startsWith("http")}function gr(r){let t=new URL(r);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}var ze=(r,t,e)=>{let i=new URL(pr(r));if(e=e||Ve(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),mr(e)){let s=gr(e);i.pathname=i.pathname+(t||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},yr=(r,t)=>{let e=new URL(r);return e.pathname=t+"/",e.toString()};var K=(r,t=",")=>r.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0);var X=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});var Eo=wt("format/auto","progressive/yes"),Y=([r])=>typeof r!="undefined"?Number(r):void 0,br=()=>!0,ns=([r,t])=>({name:r,amount:typeof t!="undefined"?Number(t):100}),os=([r,t])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:K(r,"x").map(Number),coords:K(t).map(Number)}},So=Object.freeze({enhance:Y,brightness:Y,exposure:Y,gamma:Y,contrast:Y,saturation:Y,vibrance:Y,warmth:Y,filter:ns,mirror:br,flip:br,rotate:Y,crop:os});var Ct=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),_r=[Ct.CROP,Ct.TUNING,Ct.FILTERS];var Io=Object.freeze({brightness:{zero:X.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:X.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:X.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:X.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:X.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:X.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:X.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:X.enhance,range:[0,100],keypointsNumber:1},filter:{zero:X.filter,range:[0,100],keypointsNumber:1}});var je=r=>r?r.join(","):"";var ls="https://ucarecdn.com",as="https://upload.uploadcare.com",cs="https://social.uploadcare.com",B={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:je(_r),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:ls,baseUrl:as,socialBaseUrl:cs,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:[],defaultCameraMode:"photo",enableAudioRecording:!0,enableVideoRecording:!0,maxVideoRecordingDuration:null,mediaRecorerOptions:null};var vr="--uploadcare-blocks-window-height",ae=class{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),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(vr)}};u(ae,"clientsRegistry",new Set),u(ae,"flush",j(()=>{document.documentElement.style.setProperty(vr,`${window.innerHeight}px`)},100));var wr=r=>{var i;let t=new Intl.Locale(r),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e};var Be=(r,t)=>new Intl.PluralRules(r).select(t);var us=r=>r,At="{{",Ar="}}",Cr="plural:";function xt(r,t,e={}){var o;let{openToken:i=At,closeToken:s=Ar,transform:n=us}=e;for(let l in t){let a=(o=t[l])==null?void 0:o.toString();r=r.replaceAll(i+l+s,typeof a=="string"?n(a):a)}return r}function xr(r){let t=[],e=r.indexOf(At);for(;e!==-1;){let i=r.indexOf(Ar,e),s=r.substring(e+2,i);if(s.startsWith(Cr)){let n=r.substring(e+2,i).replace(Cr,""),o=n.substring(0,n.indexOf("(")),l=n.substring(n.indexOf("(")+1,n.indexOf(")"));t.push({variable:s,pluralKey:o,countVariable:l})}e=r.indexOf(At,i)}return t}var Er=({element:r,attribute:t,onSuccess:e,onTimeout:i,timeout:s=300})=>{let n=r.getAttribute(t);if(n!==null){e(n);return}let o=new MutationObserver(c=>{let h=c[c.length-1];a(h)});o.observe(r,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{o.disconnect(),i()},s),a=c=>{let h=r.getAttribute(t);c.type==="attributes"&&c.attributeName===t&&h!==null&&(clearTimeout(l),o.disconnect(),e(h))}};function Sr(r){return Object.prototype.toString.call(r)==="[object Object]"}var ds=/\W|_/g;function hs(r){return r.split(ds).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}function Tr(r,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(r)?r.map(e=>ee(e,{ignoreKeys:t})):r}function ee(r,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(r))return Tr(r,{ignoreKeys:t});if(!Sr(r))return r;let e={};for(let i of Object.keys(r)){let s=r[i];if(t.includes(i)){e[i]=s;continue}Sr(s)?s=ee(s,{ignoreKeys:t}):Array.isArray(s)&&(s=Tr(s,{ignoreKeys:t})),e[hs(i)]=s}return e}var fs=r=>new Promise(t=>setTimeout(t,r));function Lt({libraryName:r,libraryVersion:t,userAgent:e,publicKey:i="",integration:s=""}){let n="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:r,libraryVersion:t,languageName:n,integration:s});let o=[r,t,i].filter(Boolean).join("/"),l=[n,s].filter(Boolean).join("; ");return`${o} (${l})`}var ps={factor:2,time:100};function ms(r,t=ps){let e=0;function i(s){let n=Math.round(t.time*t.factor**e);return s({attempt:e,retry:l=>fs(l!=null?l:n).then(()=>(e+=1,i(s)))})}return i(r)}var ve=class extends Error{},fe=class r extends ve{constructor(e){super();u(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=e}},Ge=(r,t)=>{r&&(r.aborted?Promise.resolve().then(t):r.addEventListener("abort",()=>t(),{once:!0}))},se=class r extends ve{constructor(e="Request canceled"){super(e);u(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,r.prototype)}},gs=500,Ir=({check:r,interval:t=gs,timeout:e,signal:i})=>new Promise((s,n)=>{let o,l;Ge(i,()=>{o&&clearTimeout(o),n(new se("Poll cancelled"))}),e&&(l=setTimeout(()=>{o&&clearTimeout(o),n(new se("Timed out"))},e));let a=()=>{try{Promise.resolve(r(i)).then(c=>{c?(l&&clearTimeout(l),s(c)):o=setTimeout(a,t)}).catch(c=>{l&&clearTimeout(l),n(c)})}catch(c){l&&clearTimeout(l),n(c)}};o=setTimeout(a,0)}),w={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"},Xe="application/octet-stream",Ur="original",ne=({method:r,url:t,data:e,headers:i={},signal:s,onProgress:n})=>new Promise((o,l)=>{let a=new XMLHttpRequest,c=(r==null?void 0:r.toUpperCase())||"GET",h=!1;a.open(c,t,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&a.setRequestHeader(f,m)}),a.responseType="text",Ge(s,()=>{h=!0,a.abort(),l(new se)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let d={method:c,url:t,data:e,headers:i||void 0,signal:s,onProgress:n},f=a.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(C){let A=C.split(": "),y=A.shift(),b=A.join(": ");y&&typeof y!="undefined"&&(m[y]=b)});let p=a.response,g=a.status;o({request:d,data:p,headers:m,status:g})}},a.onerror=d=>{h||l(new fe(d))},n&&typeof n=="function"&&(a.upload.onprogress=d=>{d.lengthComputable?n({isComputable:!0,value:d.loaded/d.total}):n({isComputable:!1})}),e?a.send(e):a.send()});function ys(r,...t){return r}var bs=({name:r})=>r?[r]:[],_s=ys,vs=()=>new FormData,Lr=r=>!1,qe=r=>typeof Blob!="undefined"&&r instanceof Blob,We=r=>typeof File!="undefined"&&r instanceof File,Ze=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",pe=r=>qe(r)||We(r)||Lr()||Ze(r),ws=r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined",Cs=r=>!!r&&typeof r=="object"&&!Array.isArray(r),As=r=>!!r&&typeof r=="object"&&"data"in r&&pe(r.data);function kr(r,t,e){if(Array.isArray(e))for(let i of e)kr(r,`${t}[]`,i);else if(As(e)){let{name:i,contentType:s}=e,n=_s(e.data,i,s!=null?s:Xe),o=bs({name:i,contentType:s});r.push([t,n,...o])}else if(Cs(e))for(let[i,s]of Object.entries(e))typeof s!="undefined"&&r.push([`${t}[${i}]`,String(s)]);else ws(e)&&e&&r.push([t,e.toString()])}function xs(r){let t=[];for(let[e,i]of Object.entries(r))kr(t,e,i);return t}function Ke(r){let t=vs(),e=xs(r);for(let i of e){let[s,n,...o]=i;t.append(s,n,...o)}return t}var L=class r extends ve{constructor(e,i,s,n,o){super();u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=s,this.response=n,this.headers=o,Object.setPrototypeOf(this,r.prototype)}},Es=r=>{let t=new URLSearchParams;for(let[e,i]of Object.entries(r))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(s=>{var n;return(n=s[1])!=null?n:!1}).forEach(s=>t.set(`${e}[${s[0]}]`,String(s[1]))):Array.isArray(i)?i.forEach(s=>{t.append(`${e}[]`,s)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},J=(r,t,e)=>{let i=new URL(r);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Es(e)),i.toString()},Ss="6.14.1",Ts="UploadcareUploadClient",Os=Ss;function ce(r){return Lt({libraryName:Ts,libraryVersion:Os,...r})}var Is="RequestThrottledError",Or=15e3,Us=1e3;function Ls(r){let{headers:t}=r||{};if(!t||typeof t["retry-after"]!="string")return Or;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:Or}function oe(r,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return ms(({attempt:s,retry:n})=>r().catch(o=>{if("response"in o&&(o==null?void 0:o.code)===Is&&s<e)return n(Ls(o));if(o instanceof fe&&s<i)return n((s+1)*Us);throw o}))}var Pr=r=>{let t="";return(qe(r)||We(r)||Ze(r))&&(t=r.type),t||Xe},Mr=r=>{let t="";return We(r)&&r.name?t=r.name:qe(r)||Lr()?t="":Ze(r)&&r.name&&(t=r.name),t||Ur};function kt(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}function ks(r,{publicKey:t,fileName:e,contentType:i,baseURL:s=w.baseURL,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",url:J(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ce({publicKey:t,integration:d,userAgent:f})},data:Ke({file:{data:r,name:e||Mr(r),contentType:i||Pr(r)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:kt(l),signature:n,expire:o,source:h,metadata:g}),signal:a,onProgress:c}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var Tt;(function(r){r.Token="token",r.FileInfo="file_info"})(Tt||(Tt={}));function Ps(r,{publicKey:t,baseURL:e=w.baseURL,store:i,fileName:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,source:c="url",signal:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",headers:{"X-UC-User-Agent":ce({publicKey:t,integration:d,userAgent:f})},url:J(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:r,store:kt(i),filename:s,check_URL_duplicates:n?1:void 0,save_URL_duplicates:o?1:void 0,signature:l,expire:a,source:c,metadata:g}),signal:h}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b}),{retryNetworkErrorMaxTimes:p,retryThrottledRequestMaxTimes:m})}var M;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(M||(M={}));var Ms=r=>"status"in r&&r.status===M.Error;function Rs(r,{publicKey:t,baseURL:e=w.baseURL,signal:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=w.retryNetworkErrorMaxTimes}={}){return oe(()=>ne({method:"GET",headers:t?{"X-UC-User-Agent":ce({publicKey:t,integration:s,userAgent:n})}:void 0,url:J(e,"/from_url/status/",{jsonerrors:1,token:r}),signal:i}).then(({data:a,headers:c,request:h})=>{let d=ee(JSON.parse(a));if("error"in d&&!Ms(d))throw new L(d.error.content,d.error.errorCode,h,d,c);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:o})}function Ds(r,{publicKey:t,baseURL:e=w.baseURL,jsonpCallback:i,secureSignature:s,secureExpire:n,signal:o,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:h=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"POST",headers:{"X-UC-User-Agent":ce({publicKey:t,integration:a,userAgent:c})},url:J(e,"/group/",{jsonerrors:1}),data:Ke({files:r,callback:i,pub_key:t,signature:s,expire:n,source:l}),signal:o}).then(({data:f,headers:m,request:p})=>{let g=ee(JSON.parse(f));if("error"in g)throw new L(g.error.content,g.error.errorCode,p,g,m);return g}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:h})}function Rr(r,{publicKey:t,baseURL:e=w.baseURL,signal:i,source:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"GET",headers:{"X-UC-User-Agent":ce({publicKey:t,integration:n,userAgent:o})},url:J(e,"/info/",{jsonerrors:1,pub_key:t,file_id:r,source:s}),signal:i}).then(({data:c,headers:h,request:d})=>{let f=ee(JSON.parse(c));if("error"in f)throw new L(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function $s(r,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:s=w.multipartChunkSize,baseURL:n="",secureSignature:o,secureExpire:l,store:a,signal:c,source:h="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:p=w.retryNetworkErrorMaxTimes,metadata:g}){return oe(()=>ne({method:"POST",url:J(n,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ce({publicKey:t,integration:d,userAgent:f})},data:Ke({filename:i||Ur,size:r,content_type:e||Xe,part_size:s,UPLOADCARE_STORE:kt(a),UPLOADCARE_PUB_KEY:t,signature:o,expire:l,source:h,metadata:g}),signal:c}).then(({data:C,headers:A,request:y})=>{let b=ee(JSON.parse(C));if("error"in b)throw new L(b.error.content,b.error.errorCode,y,b,A);return b.parts=Object.keys(b.parts).map(O=>b.parts[Number(O)]),b}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})}function Fs(r,t,{contentType:e,signal:i,onProgress:s,retryThrottledRequestMaxTimes:n=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"PUT",url:t,data:r,onProgress:s,signal:i,headers:{"Content-Type":e||Xe}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o})}function Ns(r,{publicKey:t,baseURL:e=w.baseURL,source:i="local",signal:s,integration:n,userAgent:o,retryThrottledRequestMaxTimes:l=w.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=w.retryNetworkErrorMaxTimes}){return oe(()=>ne({method:"POST",url:J(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ce({publicKey:t,integration:n,userAgent:o})},data:Ke({uuid:r,UPLOADCARE_PUB_KEY:t,source:i}),signal:s}).then(({data:c,headers:h,request:d})=>{let f=ee(JSON.parse(c));if("error"in f)throw new L(f.error.content,f.error.errorCode,d,f,h);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function Pt(r,{publicKey:t,baseURL:e,source:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Ir({check:h=>Rr(r,{publicKey:t,baseURL:e,signal:h,source:i,integration:s,userAgent:n,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function Vs(r){return"defaultEffects"in r}var Q=class{constructor(t,{baseCDN:e=w.baseCDN,fileName:i}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:s,s3Bucket:n}=t,o=J(e,`${s}/`),l=n?J(`https://${n}.s3.amazonaws.com/`,`${s}/${t.filename}`):null;this.uuid=s,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=o,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=n||null,this.s3Url=l,Vs(t)&&(this.defaultEffects=t.defaultEffects)}},zs=(r,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,contentType:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,baseCDN:g,metadata:C})=>ks(r,{publicKey:t,fileName:e,contentType:l,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:C}).then(({file:A})=>Pt(A,{publicKey:t,baseURL:i,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(A=>new Q(A,{baseCDN:g})),js=(r,{publicKey:t,fileName:e,baseURL:i,signal:s,onProgress:n,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h,baseCDN:d})=>Rr(r,{publicKey:t,baseURL:i,signal:s,source:o,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:h}).then(f=>new Q(f,{baseCDN:d,fileName:e})).then(f=>(n&&n({isComputable:!0,value:1}),f)),Bs=(r,{signal:t}={})=>{let e=null,i=null,s=r.map(()=>new AbortController),n=o=>()=>{i=o,s.forEach((l,a)=>a!==o&&l.abort())};return Ge(t,()=>{s.forEach(o=>o.abort())}),Promise.all(r.map((o,l)=>{let a=n(l);return Promise.resolve().then(()=>o({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(e=c,null))})).then(o=>{if(i===null)throw e;return o[i]})},Hs=window.WebSocket,Ot=class{constructor(){u(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(s=>s(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}},Gs=(r,t)=>r==="success"?{status:M.Success,...t}:r==="progress"?{status:M.Progress,...t}:{status:M.Error,...t},It=class{constructor(t,e=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new Ot);u(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Hs(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.data.toString());switch(i.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(i.channel,Gs(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var s;let i=JSON.stringify({event:t,data:e});(s=this.ws)==null||s.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,s={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(s=>s.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}},Et=null,Mt=r=>{if(!Et){let t=typeof window=="undefined"?0:3e4;Et=new It(r,t)}return Et},Xs=r=>{Mt(r).connect()};function qs({token:r,publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,onProgress:l,signal:a}){return Ir({check:c=>Rs(r,{publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:o,signal:c}).then(h=>{switch(h.status){case M.Error:return new L(h.error,h.errorCode);case M.Waiting:return!1;case M.Unknown:return new L(`Token "${r}" was not found.`);case M.Progress:return l&&(h.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:h.done/h.total})),!1;case M.Success:return l&&l({isComputable:!0,value:h.done/h.total}),h;default:throw new Error("Unknown status")}}),signal:a})}var Ws=({token:r,pusherKey:t,signal:e,onProgress:i})=>new Promise((s,n)=>{let o=Mt(t),l=o.onError(n),a=()=>{l(),o.unsubscribe(r)};Ge(e,()=>{a(),n(new se("pusher cancelled"))}),o.subscribe(r,c=>{switch(c.status){case M.Progress:{i&&(c.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:c.done/c.total}));break}case M.Success:{a(),i&&i({isComputable:!0,value:c.done/c.total}),s(c);break}case M.Error:a(),n(new L(c.msg,c.error_code))}})}),Zs=(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:s,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,onProgress:d,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,pusherKey:C=w.pusherKey,metadata:A})=>Promise.resolve(Xs(C)).then(()=>Ps(r,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:n,saveUrlForRecurrentUploads:o,secureSignature:l,secureExpire:a,store:c,signal:h,source:f,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,metadata:A})).catch(y=>{let b=Mt(C);return b==null||b.disconnect(),Promise.reject(y)}).then(y=>y.type===Tt.FileInfo?y:Bs([({signal:b})=>qs({token:y.token,publicKey:t,baseURL:i,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,onProgress:d,signal:b}),({signal:b})=>Ws({token:y.token,pusherKey:C,signal:b,onProgress:d})],{signal:h})).then(y=>{if(y instanceof L)throw y;return y}).then(y=>Pt(y.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:p,retryThrottledRequestMaxTimes:g,onProgress:d,signal:h})).then(y=>new Q(y,{baseCDN:s})),St=new WeakMap,Ks=async r=>{if(St.has(r))return St.get(r);let t=await fetch(r.uri).then(e=>e.blob());return St.set(r,t),t},Dr=async r=>{if(We(r)||qe(r))return r.size;if(Ze(r))return(await Ks(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},Ys=(r,t=w.multipartMinFileSize)=>r>=t,$r=r=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!pe(r)&&e.test(r)},Rt=r=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!pe(r)&&e.test(r)},Js=(r,t)=>new Promise((e,i)=>{let s=[],n=!1,o=t.length,l=[...t],a=()=>{let c=t.length-l.length,h=l.shift();h&&h().then(d=>{n||(s[c]=d,o-=1,o?a():e(s))}).catch(d=>{n=!0,i(d)})};for(let c=0;c<r;c++)a()}),Qs=(r,t,e,i)=>{let s=i*t,n=Math.min(s+i,e);return r.slice(s,n)},en=async(r,t,e)=>i=>Qs(r,i,t,e),tn=(r,t,{publicKey:e,contentType:i,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>Fs(r,t,{publicKey:e,contentType:i,onProgress:s,signal:n,integration:o,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),rn=async(r,{publicKey:t,fileName:e,fileSize:i,baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,onProgress:c,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,contentType:g,multipartChunkSize:C=w.multipartChunkSize,maxConcurrentRequests:A=w.maxConcurrentRequests,baseCDN:y,metadata:b})=>{let O=i!=null?i:await Dr(r),F,H=(I,P)=>{if(!c)return;F||(F=Array(I).fill(0));let z=G=>G.reduce((W,gt)=>W+gt,0);return G=>{G.isComputable&&(F[P]=G.value,c({isComputable:!0,value:z(F)/I}))}};return g||(g=Pr(r)),$s(O,{publicKey:t,contentType:g,fileName:e||Mr(r),baseURL:s,secureSignature:n,secureExpire:o,store:l,signal:a,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,metadata:b}).then(async({uuid:I,parts:P})=>{let z=await en(r,O,C);return Promise.all([I,Js(A,P.map((G,W)=>()=>tn(z(W),G,{publicKey:t,contentType:g,onProgress:H(P.length,W),signal:a,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})))])}).then(([I])=>Ns(I,{publicKey:t,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p})).then(I=>I.isReady?I:Pt(I.uuid,{publicKey:t,baseURL:s,source:h,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:p,onProgress:c,signal:a})).then(I=>new Q(I,{baseCDN:y}))};async function Dt(r,{publicKey:t,fileName:e,baseURL:i=w.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartMinFileSize:g,multipartChunkSize:C,maxConcurrentRequests:A,baseCDN:y=w.baseCDN,checkForUrlDuplicates:b,saveUrlForRecurrentUploads:O,pusherKey:F,metadata:H}){if(pe(r)){let I=await Dr(r);return Ys(I,g)?rn(r,{publicKey:t,contentType:p,multipartChunkSize:C,fileSize:I,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,maxConcurrentRequests:A,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:H}):zs(r,{publicKey:t,fileName:e,contentType:p,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:H})}if(Rt(r))return Zs(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:y,checkForUrlDuplicates:b,saveUrlForRecurrentUploads:O,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:F,metadata:H});if($r(r))return js(r,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y});throw new TypeError(`File uploading from "${r}" is not supported`)}var Ut=class{constructor(t,{baseCDN:e=w.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((s,n)=>s+n.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(s=>s.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(s=>new Q(s,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}},sn=r=>{for(let t of r)if(!pe(t))return!1;return!0},nn=r=>{for(let t of r)if(!$r(t))return!1;return!0},on=r=>{for(let t of r)if(!Rt(t))return!1;return!0};function Fr(r,{publicKey:t,fileName:e,baseURL:i=w.baseURL,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:a,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:g=w.multipartChunkSize,baseCDN:C=w.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:y,jsonpCallback:b}){if(!sn(r)&&!on(r)&&!nn(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let O,F=!0,H=r.length,I=(P,z)=>{if(!a)return;O||(O=Array(P).fill(0));let G=W=>W.reduce((gt,Ui)=>gt+Ui)/P;return W=>{if(!W.isComputable||!F){F=!1,a({isComputable:!1});return}O[z]=W.value,a({isComputable:!0,value:G(O)})}};return Promise.all(r.map((P,z)=>pe(P)||Rt(P)?Dt(P,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:n,store:o,signal:l,onProgress:I(H,z),source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:p,multipartChunkSize:g,baseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:y}).then(G=>G.uuid):P)).then(P=>Ds(P,{publicKey:t,baseURL:i,jsonpCallback:b,secureSignature:s,secureExpire:n,signal:l,source:c,integration:h,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(z=>new Ut(z,{baseCDN:C})).then(z=>(a&&a({isComputable:!0,value:1}),z)))}var He=class{constructor(t){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){let i=this._pending.shift();if(!i)return;let s=this._resolvers.get(i),n=this._rejectors.get(i);if(!s||!n)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(o=>s(o)).catch(o=>n(o))}}add(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};var $t=()=>({}),Ft=r=>({...$t(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.set$({"*currentActivity":null,"*modalActive":!1})}}),Ye=r=>({...Ft(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new He(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null});var te=r=>`*l10n/${r}`,ln="en",Je=class{constructor(t){u(this,"_blockInstance",null);u(this,"_localeName","");u(this,"_callbacks",new Set);u(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(ye))this._blockInstance.add(te(e),i,!1);setTimeout(()=>{t.subConfigValue("localeName",async e=>{var n;if(!this._blockInstance||!e)return;this._localeName=e;let i=await nr(e);if(e!==ln&&this._localeName!==e)return;let s=(n=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:n[e];for(let[o,l]of Object.entries(i)){let a=s==null?void 0:s[o];this._blockInstance.add(te(o),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),t.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let i=e[this._localeName];if(i)for(let[n,o]of Object.entries(i)){(s=this._blockInstance)==null||s.add(te(n),o,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=j(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var n,o,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(o=(n=this._boundBlocks.get(t))==null?void 0:n.get(e))==null||o();let s=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,s)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};function Nr(r,t){[...r.querySelectorAll("[l10n]")].forEach(e=>{let i=e.getAttribute("l10n");if(!i)return;let s="textContent",n=!1;if(i.includes(":")){let a=i.split(":");s=a[0],i=a[1],s.startsWith("@")&&(s=s.slice(1),n=!0)}let o=i;t.has(o)&&t.sub(o,a=>{if(!a)return;t.l10nProcessorSubs.has(o)||t.l10nProcessorSubs.set(o,new Set);let c=t.l10nProcessorSubs.get(o);c==null||c.forEach(f=>{f.remove(),c.delete(f),t.allSubs.delete(f)});let h=te(a).replace("*","");t.nodeCtx.has(h)||t.nodeCtx.add(h,a);let d=t.nodeCtx.sub(h,()=>{e[s]=t.l10n(a)});c==null||c.add(d),t.allSubs.add(d),e.removeAttribute("l10n")});let l=te(i);t.has(l)||t.add(l,""),t.sub(l,()=>{i=i,n?e.setAttribute(s,t.l10n(i)):e[s]=t.l10n(i)}),e.removeAttribute("l10n")})}var R=r=>`*cfg/${r}`;var an={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function we(r,t){t.tabIndex=0,t.focus(),r.tabIndex=-1}function Nt(r){let t=r.role||r.type||r.tagName;if(!t)return null;let e=an[t.toLowerCase()];if(!e)return null;for(let i of e){let s=r.closest(`[role=${i}]`);if(s)return s}}function Vt(r,t){return t.role==="toolbar"?cn(t):t.querySelectorAll(`[role=${r.role}]`)}function cn(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function un(r){let t=r.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function Vr(r){return t=>{let e=!1,i=(r==null?void 0:r.searchDelayMs)||300,s=0,n="";function o(d){let f=Nt(d.target);if(!f){l();return}let m=Vt(d.target,f),p=Array.from(m).indexOf(d.target),g="ArrowDown",C="ArrowUp";if(un(f)&&(t.document.dir==="rtl"?(g="ArrowLeft",C="ArrowRight"):(g="ArrowRight",C="ArrowLeft")),d.key===g)d.preventDefault(),we(d.target,m[p+1]||m[0]);else if(d.key===C)d.preventDefault(),we(d.target,m[p-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),we(d.target,m[0]);else if(d.key==="End")d.preventDefault(),we(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let A=Date.now();A-s<=i?n+=d.key.toLowerCase():n=d.key.toLowerCase(),s=A;let y=Array.from(m).find(b=>{var O,F,H;return(H=(F=(O=b.textContent)==null?void 0:O.trim())==null?void 0:F.toLowerCase())==null?void 0:H.startsWith(n)});y&&(d.preventDefault(),we(d.target,y))}}function l(){e=!1,t.removeEventListener("keydown",o)}function a(d){let f=Nt(d.target);if(f){e||(e=!0,t.addEventListener("keydown",o));let m=Vt(d.target,f);for(let p of m)p!==d.target&&p.setAttribute("tabindex",-1)}else e&&l()}function c(d){(!d.relatedTarget||d.relatedTarget===t.document)&&l()}function h(d){let f=Nt(d.target);if(f){let m=Vt(d.target,f);for(let p of m)p!==d.target&&p.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0)}}return t.addEventListener("click",h),t.addEventListener("focusin",a),t.addEventListener("focusout",c),()=>{l(),t.removeEventListener("click",h),t.removeEventListener("focusin",a),t.removeEventListener("focusout",c)}}}function zr(){return r=>{let t,e;function i(n){if(n.target.getAttribute("aria-hidden")==="true"){t=n.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.hidden=!1);let o=n.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');o&&(o.tabIndex=0)}}function s(n){t&&t.contains(n.target)&&(!n.relatedTarget||!t.contains(n.relatedTarget))&&(n.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return r.addEventListener("keyuxJump",i),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",i),r.removeEventListener("focusout",s)}}}function jr(){return r=>{let t=[];function e(c){let h=r.document.activeElement;h&&h!==r.document.body&&t.push(new WeakRef(h)),c.focus({focusVisible:!0})}function i(){let c=t.pop();if(!c){r.document.activeElement.blur();return}let h=c.deref();h&&h.isConnected?h.focus():i()}let s=0,n;function o(c){clearInterval(n);let h=c.getAttribute("aria-controls");h&&(n=setInterval(()=>{if(s++>50){clearInterval(n);return}let d=r.document.getElementById(h);if(d){let f=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(n),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(f))}},50))}function l(c){c.clientX===0&&c.clientY===0&&o(c.target)}function a(c){c.target.tagName==="INPUT"&&c.key==="Enter"&&o(c.target),c.key==="Escape"&&i()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function Br(r){let t,e=r.split(" ");function i(){t&&t.classList.remove(...e)}function s(n){n.clientX===0&&n.clientY===0&&(i(),n.target.classList.add(...e),t=n.target)}return n=>(n.addEventListener("keyup",i),n.addEventListener("click",s),()=>{n.removeEventListener("keyup",i),n.removeEventListener("click",s)})}function Hr(r,t){let e=t.map(i=>i(r));return()=>{e.forEach(i=>i())}}var zt=class{constructor(){u(this,"_listeners",new Map);u(this,"_scope",[])}addEventListener(t,e){let i=s=>{let n=s.target;n&&this._scope.some(o=>o===s.target||o.contains(n))&&e(s)};this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}},Qe=class{constructor(){u(this,"_destroyKeyUX");u(this,"_scopedWindow");this._scopedWindow=new zt,this._destroyKeyUX=Hr(this._scopedWindow,[Vr(),Br("is-pressed"),jr(),zr()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};var dn="uc-",U=class extends vt{constructor(){super();u(this,"requireCtxName",!1);u(this,"activityType",null);u(this,"init$",$t());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Nr)}l10n(e,i={}){if(!e)return"";let s=this.$[te(e)]||e,n=xr(s);for(let l of n)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return xt(s,i)}pluralize(e,i){let s=this.l10n("locale-id")||"en",n=Be(s,i);return this.l10n(`${e}__${n}`)}bindL10n(e,i){var s;(s=this.localeManager)==null||s.bindL10n(this,e,i)}emit(e,i,s){let n=this.has("*eventEmitter")&&this.$["*eventEmitter"];n&&n.emit(e,i,s)}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Er({element:this,attribute:"ctx-name",onSuccess:()=>{super.connectedCallback()},onTimeout:()=>{console.error("Attribute `ctx-name` is required and it is not set.")}}):super.connectedCallback(),ae.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),ae.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Re(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Je(this)),this.has("*a11y")||this.add("*a11y",new Qe),this.sub(te("locale-id"),i=>{let s=wr(i);this.style.direction=s==="ltr"?"":s})}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 i;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,v.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;v.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:hr(e),cdnUrlModifiers:fr(e),fileName:Ve(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?xt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(i,s,n)=>{if(typeof s!="string")return!1;let o=R(s);return this.has(o)||this.add(o,B[s]),this.$[o]=n,!0},get:(i,s)=>{let n=R(s);return this.has(n)||this.add(n,B[s]),this.$[R(s)]}})}return this.__cfgProxy}subConfigValue(e,i){let s=R(e);this.has(s)||this.add(s,B[e]),this.sub(s,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];i=s()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(dn)&&super.reg(e)}};u(U,"StateConsumerScope",null),u(U,"styleAttrs",[]);var Gr="active",Ce="___ACTIVITY_IS_ACTIVE___",re=class re extends U{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",Ft(this));u(this,"_debouncedHistoryFlush",j(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=re._activityCallbacks.get(this);this[Ce]=!1,this.removeAttribute(Gr),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=re._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ce]=!0,this.setAttribute(Gr,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(x.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",e=>{this.setAttribute("current-activity",e)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Ce]?this._deactivate():this.activityType===e&&!this[Ce]&&this._activate()}catch(s){console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",e=>{!e&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&re._activityCallbacks.has(this)}get isActivityActive(){return this[Ce]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:s,onDeactivate:n}=i;re._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:n})}unregisterActivity(){this.isActivityActive&&this._deactivate(),re._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof re&&s.activityType===e)||(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 i;let e=this.$["*history"];if(e){let s=e.pop();for(;s===this.activityType;)s=e.pop();let n=!!s;if(s){let o=[...this.blocksRegistry].find(l=>l.activityType===s);n=(i=o==null?void 0:o.couldOpenActivity)!=null?i:!1}s=n?s:void 0,this.$["*currentActivity"]=s,this.$["*history"]=e,s||this.setOrAddState("*modalActive",!1)}}};u(re,"_activityCallbacks",new Map);var E=re;E.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"});var Xr="<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 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Ae=class extends U{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",Ye(this));u(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=Xr+e+"<slot></slot>"}static get template(){return this._template}};u(Ae,"styleAttrs",["uc-wgt-common"]);var xe=class xe extends Ae{initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||E.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?this.$["*currentActivity"]=E.activities.UPLOAD_LIST:this.$["*currentActivity"]=t.initActivity||E.activities.START_FROM}),this.subConfigValue("sourceList",e=>{e!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)})}};u(xe,"styleAttrs",[...Pe(xe,xe,"styleAttrs"),"uc-file-uploader-minimal"]);var et=xe;et.template=`<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 tt=class extends E{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};tt.template='<div class="uc-content"><slot></slot></div>';function qr(r,t,e){let i=r/t,s,n;i>e?(s=Math.round(t*e),n=t):(s=r,n=Math.round(r/e));let o=Math.round((r-s)/2),l=Math.round((t-n)/2);return o+s>r&&(s=r-o),l+n>t&&(n=t-l),{x:o,y:l,width:s,height:n}}var Wr=r=>{if(!r)return[];let[t,e]=r.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:t,height:e}]};var Zr="blocks",Kr="1.12.1";function Yr(r){return Lt({...r,libraryName:Zr,libraryVersion:Kr})}var Jr=r=>Math.floor(r/1e3),Qr=(r,{threshold:t})=>{let{secureExpire:e}=r,i=Jr(Date.now()),s=Number(e),n=Jr(t);return i+n>=s};var rt=class{constructor(t){u(this,"_block");u(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Qr(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 s=await i();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s)}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};var ei="[Typed State] Wrong property name: ",hn="[Typed State] Wrong property type: ",it=class{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||_e.generate(),this.__schema=Object.keys(t).reduce((i,s)=>(i[s]=t[s].value,i),{}),this.__data=v.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(ei+t);return}let i=this.__typedSchema[t];if((e==null?void 0:e.constructor)===i.type||e instanceof i.type||i.nullable&&e===null){this.__data.pub(t,e);return}console.warn(hn+t)}setMultipleValues(t){for(let e in t)this.setValue(e,t[e])}getValue(t){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(ei+t);return}return this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){v.deleteCtx(this.__ctxId)}};var st=class{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||_e.generate(),this.__data=v.registerCtx({},this.__ctxId),this.__watchList=t.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 e=Object.create(null);this.__notifyObservers=(i,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(n=>{n({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new it(this.__typedSchema);for(let i in t)e.setValue(i,t[i]);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){return this.read(t).getValue(e)}publishProp(t,e,i){this.read(t).setValue(e,i)}remove(t){this.__removed.add(this.__data.read(t)),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let s=this.read(i);t(s)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){v.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};var jt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),$=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...jt});var Ee=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],nt=r=>r?r.filter(t=>typeof t=="string").map(t=>K(t)).flat():[],Bt=(r,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),r.startsWith(e)):r===e),ti=(r,t)=>t.some(e=>e.startsWith(".")?r.toLowerCase().endsWith(e.toLowerCase()):!1),ri=r=>{let t=r==null?void 0:r.type;return t?Bt(t,Ee):!1};var fn=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,pn=new RegExp(`^/?(${fn.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ii=({url:r,cdnBase:t})=>{let e=new URL(t),i=new URL(r);if(e.host!==i.host)return null;let[,s,n,o]=pn.exec(i.pathname);return{uuid:s,cdnUrlModifiers:n||"",filename:o||null}};var si=r=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let s=r(...e);return t.set(i,s),s}};var ni=new Set;function oi(r){ni.has(r)||(ni.add(r),console.warn(r))}function mn(r){let t=!1;return setTimeout(()=>{t=!0},0),i=>(...s)=>(t&&oi(r),i(...s))}function li(r){let t={progress:()=>r.$["*commonProgress"],errors:()=>r.$["*collectionErrors"],group:()=>r.$["*groupInfo"],totalCount:()=>r.uploadCollection.size,failedCount:()=>e.failedEntries.length,successCount:()=>e.successEntries.length,uploadingCount:()=>e.uploadingEntries.length,status:()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle",isSuccess:()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,isUploading:()=>e.allEntries.some(s=>s.status==="uploading"),isFailed:()=>e.errors.length>0||e.failedEntries.length>0,allEntries:()=>r.getOutputData(),successEntries:()=>e.allEntries.filter(s=>s.status==="success"),failedEntries:()=>e.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>e.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>e.allEntries.filter(s=>s.status==="idle")},e={},i=mn("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(t)){let o=s,a=si(i(n));Object.defineProperty(e,o,{get:a,enumerable:!0})}return e}var ot=class{constructor(t){u(this,"_ctx");u(this,"addFileFromUrl",(t,{silent:e,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:$.API});return this.getOutputItem(n)});u(this,"addFileFromUuid",(t,{silent:e,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:$.API});return this.getOutputItem(n)});u(this,"addFileFromCdnUrl",(t,{silent:e,fileName:i,source:s}={})=>{var l;let n=ii({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let o=this._uploadCollection.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:(l=i!=null?i:n.filename)!=null?l:null,silent:e!=null?e:!1,source:s!=null?s:$.API});return this.getOutputItem(o)});u(this,"addFileFromObject",(t,{silent:e,fileName:i,source:s,fullPath:n}={})=>{let o=this._uploadCollection.add({file:t,isImage:ri(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:s!=null?s:$.API,fullPath:n!=null?n:null});return this.getOutputItem(o)});u(this,"removeFileByInternalId",t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)});u(this,"uploadAll",()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(x.COMMON_UPLOAD_START,this.getOutputCollectionState()))});u(this,"openSystemDialog",(t={})=>{var n;let e=je(nt([(n=this.cfg.accept)!=null?n:"",...this.cfg.imgOnly?Ee:[]]));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 i="uploadcare-file-input",s=document.createElement("input");s.setAttribute(i,""),Fe(s,{opacity:0,height:0,width:0,visibility:"hidden"}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera?(s.capture=this.cfg.cameraCapture,s.accept=this.cfg.enableVideoRecording?["image/*","video/*"].join(","):"image/*"):s.accept=e,s.addEventListener("change",()=>{s.files&&([...s.files].forEach(o=>this.addFileFromObject(o,{source:t.captureCamera?$.CAMERA:$.LOCAL})),this._ctx.$["*currentActivity"]=E.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),s.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(o=>o.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))});u(this,"getOutputItem",t=>{var o,l,a,c,h,d,f,m,p,g;let e=v.getCtx(t).store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(o=i==null?void 0:i.uuid)!=null?o:e.uuid)!=null?l:null,internalId:t,name:(a=i==null?void 0:i.originalFilename)!=null?a:e.fileName,size:(c=i==null?void 0:i.size)!=null?c:e.fileSize,isImage:(h=i==null?void 0:i.isImage)!=null?h:e.isImage,mimeType:(d=i==null?void 0:i.mimeType)!=null?d:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(g=(p=e.metadata)!=null?p:i==null?void 0:i.metadata)!=null?g:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:e.errors,status:s,source:e==null?void 0:e.source}});u(this,"getOutputCollectionState",()=>li(this._ctx));u(this,"initFlow",(t=!1)=>{var e;if(this._uploadCollection.size>0&&!t)this._ctx.set$({"*currentActivity":E.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((e=this._sourceList)==null?void 0:e.length)===1){let i=this._sourceList[0];if(i==="local"){this._ctx.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.openSystemDialog();return}let s=this._ctx.$["*blocksRegistry"],n=l=>"type"in l&&l.type===i,o=[...s].find(n);o==null||o.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":E.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)});u(this,"doneFlow",()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)});u(this,"setCurrentActivity",(t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)});u(this,"getCurrentActivity",()=>this._ctx.$["*currentActivity"]);u(this,"setModalState",t=>{if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",t)});this._ctx=t}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 t=[];return this.cfg.sourceList&&(t=K(this.cfg.sourceList)),t}};var Ht=(r,t)=>{let e=t.cfg.imgOnly,i=r.isImage;if(!(!e||i)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:r}}};var Gt=(r,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,s=nt([...e?Ee:[],i]);if(!s.length)return;let n=r.mimeType,o=r.name;if(!n||!o)return;let l=Bt(n,s),a=ti(o,s);if(!l&&!a)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:r}}};var q=1e3,ue=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Se=r=>Math.ceil(r*100)/100,ai=(r,t=ue.AUTO)=>{let e=t===ue.AUTO;if(t===ue.BYTE||e&&r<q**1){let i=Be("en-US",r),s={one:"byte",other:"bytes"}[i];return`${r} ${s}`}return t===ue.KB||e&&r<q**2?`${Se(r/q**1)} KB`:t===ue.MB||e&&r<q**3?`${Se(r/q**2)} MB`:t===ue.GB||e&&r<q**4?`${Se(r/q**3)} GB`:t===ue.TB||e&&r<q**5?`${Se(r/q**4)} TB`:`${Se(r/q**5)} PB`};var Xt=(r,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=r.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:ai(e)}),payload:{entry:r}}};var qt=(r,t)=>{let{internalId:e}=r,i=t._uploadCollection.read(e),s=i==null?void 0:i.getValue("uploadError");if(!s)return;if(s instanceof L)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof fe)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let n=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:n.message,payload:{entry:r,error:n}}};var Wt=(r,t)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}};var Zt=(r,t)=>{let e=r.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,s=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}};if(s&&e>s)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}}};var lt={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},at=class{constructor(t){u(this,"_blockInstance");u(this,"_fileValidators",[Ht,Gt,Xt,qt]);u(this,"_collectionValidators",[Zt,Wt]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=()=>{this.runFileValidators(),this.runCollectionValidators()};this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let s=this._uploadCollection.read(i);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=i(t,this._blockInstance.api);if(!s)continue;s&&(e.push(s),s.message||console.warn(lt.message))}catch(s){console.warn(lt.collection,s)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(x.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let n=s(e,this._blockInstance.api);if(!n)continue;n&&(i.push(n),n.message||console.warn(lt.message))}catch(n){console.warn(lt.file,n)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let s=e(...i);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};var ci=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:Q,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:!1,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 D=class r extends E{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!1);u(this,"isCtxOwner",!1);u(this,"init$",Ye(this));u(this,"_flushOutputItems",j(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(x.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));u(this,"_handleCollectionUpdate",(e,i,s)=>{var n;(i.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let o of i)o.getValue("silent")||this.emit(x.FILE_ADDED,this.api.getOutputItem(o.uid));for(let o of s)this.$["*uploadTrigger"].delete(o.uid),(n=o.getValue("abortController"))==null||n.abort(),o.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(o==null?void 0:o.getValue("thumbUrl")),this.emit(x.FILE_REMOVED,this.api.getOutputItem(o.uid));this.$["*uploadList"]=e.map(o=>({uid:o})),this._flushCommonUploadProgress(),this._flushOutputItems()});u(this,"_handleCollectionPropertiesUpdate",e=>{this._flushOutputItems();let i=this.uploadCollection,s=[...new Set(Object.entries(e).filter(([n])=>["uploadError","fileInfo"].includes(n)).map(([,n])=>[...n]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),e.uploadProgress){for(let n of e.uploadProgress){let{isUploading:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(x.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(n))}this._flushCommonUploadProgress()}if(e.isUploading)for(let n of e.isUploading){let{isUploading:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(x.FILE_UPLOAD_START,this.api.getOutputItem(n))}if(e.fileInfo){for(let n of e.fileInfo){let{fileInfo:o,silent:l}=v.getCtx(n).store;o&&!l&&this.emit(x.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(n))}this.cfg.cropPreset&&this.setInitialCrop()}if(e.errors){for(let l of e.errors){let{errors:a}=v.getCtx(l).store;a.length>0&&(this.emit(x.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(x.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let n=i.findItems(l=>!!l.getValue("fileInfo")),o=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&o.length===0&&i.size===n.length&&this.$["*collectionErrors"].length===0&&this.emit(x.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(o=>{var l;return!!((l=this.uploadCollection.read(o))!=null&&l.getValue("cdnUrl"))}).forEach(o=>{this.emit(x.FILE_URL_CHANGED,this.api.getOutputItem(o))}),this.$["*groupInfo"]=null)});u(this,"_flushCommonUploadProgress",()=>{let e=0,s=[...this.$["*uploadTrigger"]].filter(o=>!!this.uploadCollection.read(o));s.forEach(o=>{let l=this.uploadCollection.readProp(o,"uploadProgress");e+=l});let n=s.length?Math.round(e/s.length):0;this.$["*commonProgress"]!==n&&(this.$["*commonProgress"]=n,this.emit(x.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))})}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof r?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new st({typedSchema:ci,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new ot(this)),this.has("*validationManager")||this.add("*validationManager",new at(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 e,i;(e=this._unobserveCollectionProperties)==null||e.call(this),(i=this._unobserveCollection)==null||i.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",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new rt(this)),this.has("*modalActive")&&this.sub("*modalActive",e=>{e&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(e){let i=await this.getUploadClientOptions(),s=e.allEntries.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:"")),n=new AbortController,o=await Fr(s,{...i,signal:n.signal});if(this.$["*collectionState"]!==e){n.abort();return}this.$["*groupInfo"]=o;let l=this.api.getOutputCollectionState();this.emit(x.GROUP_CREATED,l),this.emit(x.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let e=Wr(this.cfg.cropPreset);if(e){let[i]=e,s=this.uploadCollection.findItems(n=>{var o;return n.getValue("fileInfo")&&n.getValue("isImage")&&!((o=n.getValue("cdnUrlModifiers"))!=null&&o.includes("/crop/"))}).map(n=>this.uploadCollection.read(n));for(let n of s){let o=n.getValue("fileInfo"),{width:l,height:a}=o.imageInfo,c=i.width/i.height,h=qr(l,a,c),d=Ne(`crop/${h.width}x${h.height}/${h.x},${h.y}`,"preview");n.setMultipleValues({cdnUrlModifiers:d,cdnUrl:ze(n.getValue("cdnUrl"),d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:n.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let s=this.api.getOutputItem(e);return await i(s)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Yr,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.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(s=>this.api.getOutputItem(s))}};D.extSrcList=Object.freeze({...jt});D.sourceTypes=Object.freeze({...$});var T=r=>String(r),N=r=>{let t=Number(r);if(Number.isNaN(t))throw new Error(`Invalid number: "${r}"`);return t},S=r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},gn=r=>r==="auto"?r:S(r),yn=r=>{let t=T(r);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid "cameraCapture" value: "${t}"`);return t},bn=r=>{let t=T(r);if(t!=="photo"&&t!=="video")throw new Error(`Invalid "CameraTab" value: "${t}"`);return t},_n=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},ui=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Kt=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},di=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},vn={pubkey:T,multiple:S,multipleMin:N,multipleMax:N,confirmUpload:S,imgOnly:S,accept:T,externalSourcesPreferredTypes:T,externalSourcesEmbedCss:T,store:gn,cameraMirror:S,cameraCapture:yn,sourceList:T,maxLocalFileSizeBytes:N,thumbSize:N,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:T,removeCopyright:S,cropPreset:T,imageShrink:T,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:T,cdnCname:T,baseUrl:T,socialBaseUrl:T,secureSignature:T,secureExpire:T,secureDeliveryProxy:T,retryThrottledRequestMaxTimes:N,multipartMinFileSize:N,multipartChunkSize:N,maxConcurrentRequests:N,multipartMaxConcurrentRequests:N,multipartMaxAttempts:N,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:T,debug:S,localeName:T,metadata:_n,secureUploadsExpireThreshold:N,localeDefinitionOverride:ui,secureUploadsSignatureResolver:Kt,secureDeliveryProxyUrlResolver:Kt,iconHrefResolver:Kt,fileValidators:di,collectionValidators:di,defaultCameraMode:bn,enableAudioRecording:S,enableVideoRecording:S,mediaRecorerOptions:ui,maxVideoRecordingDuration:N},hi=(r,t)=>{if(!(typeof t=="undefined"||t===null))try{return vn[r](t)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),B[r]}};function wn(r){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=s=>{s.type!=="loadend"&&e.abort(),t(!1)};e.onloadend=i,e.onprogress=i,e.readAsDataURL(r)}catch{t(!1)}})}function Cn(r,t){return new Promise(e=>{let i=0,s=[],n=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(a=>{i--;let c=new File([a],a.name,{type:a.type||t});s.push({type:"file",file:c,fullPath:l.fullPath}),i===0&&e(s)})):l.isDirectory&&o(l.createReader())},o=l=>{i++,l.readEntries(a=>{i--;for(let c of a)n(c);i===0&&e(s)})};n(r)})}function fi(r){let t=[],e=[];for(let i=0;i<r.items.length;i++){let s=r.items[i];if(s)if(s.kind==="file"){let n=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();e.push(Cn(l,n).then(a=>{a&&t.push(...a)}));continue}let o=s.getAsFile();o&&e.push(wn(o).then(l=>{l||t.push({type:"file",file:o})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&e.push(new Promise(n=>{s.getAsString(o=>{t.push({type:"url",url:o}),n(void 0)})}))}return Promise.all(e).then(()=>t)}var k={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},pi=["focus"],An=100,Yt=new Map;function xn(r,t){let e=Math.max(Math.min(r[0],t.x+t.width),t.x),i=Math.max(Math.min(r[1],t.y+t.height),t.y);return Math.sqrt((r[0]-e)*(r[0]-e)+(r[1]-i)*(r[1]-i))}function Jt(r){let t=0,e=document.body,i=new Set,s=p=>i.add(p),n=k.INACTIVE,o=p=>{r.shouldIgnore()&&p!==k.INACTIVE||(n!==p&&i.forEach(g=>g(p)),n=p)},l=()=>t>0;s(p=>r.onChange(p));let a=()=>{t=0,o(k.INACTIVE)},c=()=>{t+=1,n===k.INACTIVE&&o(k.ACTIVE)},h=()=>{t-=1,l()||o(k.INACTIVE)},d=p=>{p.preventDefault(),t=0,o(k.INACTIVE)},f=p=>{if(r.shouldIgnore())return;l()||(t+=1);let g=[p.x,p.y],C=r.element.getBoundingClientRect(),A=Math.floor(xn(g,C)),y=A<An,b=p.composedPath().includes(r.element);Yt.set(r.element,A);let O=Math.min(...Yt.values())===A;b&&O?(p.preventDefault(),o(k.OVER)):o(y&&O?k.NEAR:k.ACTIVE)},m=async p=>{if(r.shouldIgnore())return;p.preventDefault();let g=await fi(p.dataTransfer);r.onItems(g),o(k.INACTIVE)};return e.addEventListener("drop",d),e.addEventListener("dragleave",h),e.addEventListener("dragenter",c),e.addEventListener("dragover",f),r.element.addEventListener("drop",m),pi.forEach(p=>{window.addEventListener(p,a)}),()=>{Yt.delete(r.element),e.removeEventListener("drop",d),e.removeEventListener("dragleave",h),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",f),r.element.removeEventListener("drop",m),pi.forEach(p=>{window.removeEventListener(p,a)})}}var mi="uc-drop-area",me=`${mi}/registry`,Te=class Te extends D{constructor(){super(),this.init$={...this.init$,state:k.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[me]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[me]||(this.$[me]=new Set),this.$[me].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!S(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:S(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:S(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:S(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Jt({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this.$.state=e},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:$.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:$.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":E.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=Jt({element:t,onChange:e=>{var s;let i=(s=Object.entries(k).find(([,n])=>n===e))==null?void 0:s[0].toLowerCase();i&&t.setAttribute("drag-state",i)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",e=>{var s;let i=(s=Object.entries(k).find(([,n])=>n===e))==null?void 0:s[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=K(e);this.$.isEnabled=i.includes($.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{e.type==="keydown"?(e.code==="Space"||e.code==="Enter")&&this.api.openSystemDialog():e.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.$[me]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[me];t&&(t.delete(this),t.size===0&&v.deleteCtx(mi)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};u(Te,"styleAttrs",[...Pe(Te,Te,"styleAttrs"),"uc-drop-area"]);var Oe=Te;Oe.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;Oe.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var gi=(r,t)=>{let e,i,s,n=(...o)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=t&&(r(...o),s=Date.now())},Math.max(t-(Date.now()-s),0))):(r(...o),s=Date.now(),e=!0)};return Object.defineProperty(n,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(i)}}),n};var ct=class extends D{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",E.activities.UPLOAD_LIST);u(this,"_throttledHandleCollectionUpdate",gi(()=>{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(x.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(x.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},s=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),n=e.errors.some(f=>f.type==="TOO_MANY_FILES"),o=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.errors.length===0,a=!1,c=!1,h=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&s)a=!0;else{c=!0;let f=this.cfg.groupOutput?!!e.group:!0;h=i.total===i.succeed&&s&&l&&f}this.set$({doneBtnVisible:c,doneBtnEnabled:h,uploadBtnVisible:a,addMoreBtnEnabled:i.total===0||!n&&!o,addMoreBtnVisible:!o||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(e){let i=s=>{let n=e[s];return this.l10n(`header-${s}`,{count:n})};return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.succeed>0?i("succeed"):i("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",e=>{e&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};ct.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="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" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var dt=()=>{let r=[];return{stack:r,promiseReadJpegChunks:e=>new Promise((i,s)=>{let n=2,o=(c,h)=>{let d=new FileReader;d.addEventListener("load",()=>{h(new DataView(d.result))}),d.addEventListener("error",f=>{s(`Reader error: ${f}`)}),d.readAsArrayBuffer(c)},l=()=>o(e.slice(n,n+128),c=>{let h,d,f;for(h=d=0,f=c.byteLength;f>=0?d<f:d>f;h=f>=0?++d:--d)if(c.getUint8(h)===255){n+=h;break}a()}),a=()=>{let c=n;return o(e.slice(n,n+=4),h=>{if(h.byteLength!==4||h.getUint8(0)!==255){s("Corrupted");return}let d=h.getUint8(1);if(d===218){i(!0);return}let f=h.getUint16(2)-2;return o(e.slice(n,n+=f),m=>{if(m.byteLength!==f){s("Corrupted");return}r.push({startPos:c,length:f,marker:d,view:m}),l()})})};FileReader&&DataView||s("Not Support"),o(e.slice(0,2),c=>{c.getUint16(0)!==65496&&s("Not jpeg"),l()})})}},En=async r=>{let t=[],{promiseReadJpegChunks:e,stack:i}=dt();return await e(r),i.forEach(({marker:s,view:n})=>{s===226&&n.getUint32(0)===1229144927&&n.getUint32(4)===1347571526&&n.getUint32(8)===1229735168&&t.push(n)}),t},bi=async(r,t,e)=>{{let i=[],s=[],{promiseReadJpegChunks:n,stack:o}=dt();await n(r),o.forEach(c=>{if(c.marker===t)return i.push(c.startPos),s.push(c.length)});let l=[r.slice(0,2)];for(let c of e){let h=new DataView(new ArrayBuffer(4));h.setUint16(0,65280+t),h.setUint16(2,c.byteLength+2),l.push(h.buffer),l.push(c)}let a=2;for(let c=0;c<i.length;c++)i[c]>a&&l.push(r.slice(a,i[c])),a=i[c]+s[c]+4;return l.push(r.slice(a,r.size)),new Blob(l,{type:r.type})}};var _i=(r,t)=>bi(r,226,t.map(e=>e.buffer)),Sn=async r=>{try{return await _i(r,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},Tn=(r,t,e)=>new Promise((i,s)=>{let n=o=>{if(!o){s("Failed to convert canvas to blob");return}i(o)};r.toBlob(n,t,e),r.width=r.height=1}),Ie=()=>{let r=document.createElement("canvas"),t=r.getContext("2d");return{canvas:r,ctx:t}},On=r=>{let{ctx:e,canvas:i}=Ie();i.width=i.height=50,e.drawImage(r,0,0,50,50);let s=e.getImageData(0,0,50,50).data;i.width=i.height=1;for(let n=3;n<s.length;n+=4)if(s[n]<254)return!0;return!1},In=async r=>{let t=null,{promiseReadJpegChunks:e,stack:i}=dt();return await e(r),i.forEach(({marker:s,view:n})=>{if(!t&&s===225&&n.byteLength>=14&&n.getUint32(0)===1165519206&&n.getUint16(4)===0){t=n;return}}),t},Un="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ut,Ln=()=>new Promise(r=>{if(ut!==void 0)r(ut);else{let t=new Image;t.addEventListener("load",()=>{ut=t.naturalWidth<t.naturalHeight,t.src="//:0",r(ut)}),t.src=Un}}),kn=(r,t)=>{let e,i,s,n;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)i=!0;else if(r.getUint16(6)===19789)i=!1;else return;if(r.getUint16(8,i)!==42)return;s=8+r.getUint32(10,i);let o=r.getUint16(s-2,i);for(e=0,n=o;n>=0?e<n:e>n;n>=0?++e:--e){if(r.byteLength<s+10)return;r.getUint16(s,i)===274&&t(s+8,i),s+=12}},Pn=(r,t)=>{kn(r,(e,i)=>r.setUint16(e,t,i))},Mn=async(r,t,e)=>(e&&Pn(t,1),bi(r,225,[t.buffer])),Rn=(r,t)=>new Promise((e,i)=>{t&&(r.src=t),r.complete?e(r):(r.addEventListener("load",()=>{e(r)}),r.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),Dn=r=>Rn(new Image,r),$n=[1,3],Fn=[192,193,194,195,197,198,199,201,202,203,205,206,207],yi={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Nn=async r=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=dt();return await e(r).then(()=>(i.forEach(({marker:s,view:n})=>{if(!t&&Fn.indexOf(s)>=0){let o=n.getUint8(5);$n.indexOf(o)<0&&(t=!0)}}),t)).catch(()=>t)},vi=(r,t)=>{let e={};return(...i)=>{let s=t(i,e);return s in e?e[s]:e[s]=r(...i)}},wi=(r,t)=>{let[e]=r,i=Object.keys(t).map(s=>parseInt(s,10)).sort((s,n)=>s-n);for(let s=0;s<i.length;s++){let n=i[s],o=!!t[n];if(n>e&&o||n<e&&!o)return n}return e},le={R:55,G:110,B:165,A:255},Vn=`rgba(${le.R}, ${le.G}, ${le.B}, ${le.A/255})`,Ci=(r,t)=>{try{let e=[r-1,t-1,1,1],{canvas:i,ctx:s}=Ie();i.width=1,i.height=1;let{canvas:n,ctx:o}=Ie();n.width=r,n.height=t,o&&(o.fillStyle=Vn,o.fillRect(...e),s.drawImage(n,r-1,t-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,a=!1;return l&&(a=l[0]===le.R&&l[1]===le.G&&l[2]===le.B&&l[3]===le.A),n.width=n.height=1,a}catch{return console.error(`Failed to test for max canvas size of ${r}x${t}.`),!1}};function Ai(r){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=r(...t);e(i)},0)})}var zn=Ai(vi(Ci,wi)),jn=Ai(vi(Ci,wi)),xi=async(r,t)=>{let e=yi.squareSide.find(o=>o*o>=r*t),i=yi.dimension.find(o=>o>=r&&o>=t);if(!e||!i)throw new Error("Not supported");let[s,n]=await Promise.all([zn(e,e),jn(i,1)]);if(s&&n)return!0;throw new Error("Not supported")},Ei=async(r,t,e)=>{try{let{ctx:i,canvas:s}=Ie();return s.width=t,s.height=e,i.imageSmoothingQuality="high",i.drawImage(r,0,0,t,e),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(i){throw new Error("Canvas resize error",{cause:i})}},Bn=({img:r,targetW:t,targetH:e})=>Ei(r,t,e),Hn=function({sourceW:r,targetW:t,targetH:e,step:i}){let s=[],n=t,o=e;do s.push([n,o]),n=Math.round(n/i),o=Math.round(o/i);while(n<r*i);return s.reverse()},Gn=({img:r,sourceW:t,targetW:e,targetH:i,step:s})=>Hn({sourceW:t,targetW:e,targetH:i,step:s}).reduce((o,[l,a])=>o.then(c=>xi(l,a).then(()=>Ei(c,l,a)).catch(()=>c)),Promise.resolve(r)),Xn=()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),qn=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Qt=.71,Wn=(r,t)=>{if(r.width*Qt*r.height*Qt<t.size)throw new Error("Not required");let e=r.width,i=r.height,s=e/i,n=Math.floor(Math.sqrt(t.size*s)),o=Math.floor(t.size/Math.sqrt(t.size*s));return xi(n,o).then(()=>{let{ctx:l}=Ie();return"imageSmoothingQuality"in l&&!Xn()&&!qn?Bn({img:r,targetW:n,targetH:o}):Gn({img:r,sourceW:e,targetW:n,targetH:o,step:Qt})}).catch(()=>Promise.reject("Not supported"))},Si=async(r,t)=>{try{if(await Nn(r))throw new Error("Should skipped");let i=await Promise.allSettled([In(r),Ln(),En(r)]),n=!i.some(g=>g.status==="rejected"),[o,l,a]=i,c=await Sn(r).catch(()=>r),h=await Dn(URL.createObjectURL(c));URL.revokeObjectURL(h.src);let d=await Wn(h,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!n&&On(d)&&(f="image/png",m=void 0);let p=await Tn(d,f,m);if(n&&o.status==="fulfilled"&&o.value){let g=o.value,C=l.status==="fulfilled"?l.value:!1;p=await Mn(p,g,C)}return n&&a.status==="fulfilled"&&a.value.length>0&&(p=await _i(p,a.value)),p}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}};function Zn(r){let t=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(t)}function er(r="hsl(209, 21%, 65%)",t=32,e=32){return Zn(`<svg width="${t}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}function Ti(r,t=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let e=document.createElement("canvas"),i=e.getContext("2d"),s=new Image,n=new Promise((o,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(e.width=t,e.height=t*a):(e.height=t,e.width=t/a),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(s,0,0,e.width,e.height),e.toBlob(c=>{if(!c){l();return}let h=URL.createObjectURL(c);o(h)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(r),n}var Kn=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Oi=r=>{let t=Kn.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}};var V=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),Ue=class r extends D{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",j(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",j(this._calculateState.bind(this),100));u(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:V.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let e of this._entrySubs)e.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(e){let[i]=e;this._isIntersecting=i.isIntersecting,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),i.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let e=this._entry,i=V.IDLE;e.getValue("errors").length>0?i=V.FAILED:e.getValue("isUploading")?i=V.UPLOADING:e.getValue("fileInfo")&&(i=V.FINISHED),this.$.state=i}async _generateThumbnail(){var i;if(!this._entry)return;let e=this._entry;if(e.getValue("fileInfo")&&e.getValue("isImage")){let s=this.cfg.thumbSize,n=await this.proxyUrl(ze(yr(this.cfg.cdnCname,this._entry.getValue("uuid")),Ne(e.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),o=e.getValue("thumbUrl");o!==n&&(e.setValue("thumbUrl",n),o!=null&&o.startsWith("blob:")&&URL.revokeObjectURL(o));return}if(!e.getValue("thumbUrl"))if((i=e.getValue("file"))!=null&&i.type.includes("image"))try{let s=await Ti(e.getValue("file"),this.cfg.thumbSize);e.setValue("thumbUrl",s)}catch{let n=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",er(n))}else{let s=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",er(s))}}_subEntry(e,i){let s=this._entry.subscribe(e,n=>{this.isConnected&&i(n)});this._entrySubs.add(s)}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("uploadProgress",n=>{this.$.progressValue=n}),this._subEntry("fileName",n=>{this.$.itemName=n||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",n=>{this.$.itemName=i.getValue("fileName")||n||this.l10n("file-no-name")}),this._subEntry("fileInfo",n=>{this._debouncedCalculateState(),n&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",n=>{this.$.thumbUrl=n?`url(${n})`:""}),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",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{r.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{e.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),r.activeInstances.add(this)}_handleState(e){var i,s,n,o,l,a,c;e===V.FAILED?this.$.badgeIcon="badge-error":e===V.FINISHED&&(this.$.badgeIcon="badge-success"),e===V.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:e===V.FAILED,isUploading:e===V.UPLOADING,isFinished:e===V.FINISHED,progressVisible:e===V.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((i=this._entry)==null?void 0:i.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:(o=(n=this._entry.getValue("errors"))==null?void 0:n[0])==null?void 0:o.message,ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(l=this._entry)==null?void 0:l.getValue("fileName"),status:this.l10n((c=(a=e==null?void 0:e.description)==null?void 0:a.toLocaleLowerCase())!=null?c:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),r.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 e;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return Oi(this.cfg.imageShrink)}_processShrink(e){return Si(e,this._settingsOfShrink())}async upload(){var s,n,o,l,a,c;let e=this._entry;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setValue("isUploading",!0),e.setValue("errors",[]);try{let h=new AbortController;e.setValue("abortController",h);let d=async()=>{let m=e.getValue("file");m&&this.cfg.imageShrink&&(m=await this._processShrink(m).catch(()=>m));let p=m||e.getValue("externalUrl")||e.getValue("uuid"),C={...await this.getUploadClientOptions(),fileName:e.getValue("fileName"),source:e.getValue("source"),onProgress:A=>{if(A.isComputable){let y=A.value*100;e.setValue("uploadProgress",y)}},signal:h.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",p,C),Dt(p,C)},f=await this.$["*uploadQueue"].add(d);e.setMultipleValues({fileInfo:f,isUploading:!1,fileName:f.originalFilename,fileSize:f.size,isImage:f.isImage,mimeType:(o=(n=(s=f.contentInfo)==null?void 0:s.mime)==null?void 0:n.mime)!=null?o:f.mimeType,uuid:f.uuid,cdnUrl:(l=e.getValue("cdnUrl"))!=null?l:f.cdnUrl,cdnUrlModifiers:(a=e.getValue("cdnUrlModifiers"))!=null?a:"",uploadProgress:100,source:(c=e.getValue("source"))!=null?c:null}),e===this._entry&&this._debouncedCalculateState()}catch(h){h instanceof se&&h.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:h}),e===this._entry&&this._debouncedCalculateState()}}}};Ue.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@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" set="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" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Ue.activeInstances=new Set;var Le=class extends U{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let s=i(t);e=s!=null?s:e}this.$.href=e})})}};Le.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Le.bindAttributes({name:"name"});var ht=class extends U{constructor(){super(...arguments);u(this,"_value",0);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",e=>{if(e===void 0)return;let i=this._value;if(this._value=e,e===0&&i>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",e=>{this.ref.line.classList.toggle("uc-progress--hidden",!e)})}};ht.template='<div ref="line" class="uc-progress"></div>';var ft=class extends U{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};u(ft,"template",`<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 tr=class extends D{constructor(){super(...arguments);u(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,Fe(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=e.group?e.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let n=e.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&n.length===1){this._validationInputElement.value=n[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let o=new DocumentFragment;for(let l of n){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=l,o.appendChild(a)}this._dynamicInputsContainer.replaceChildren(o)}},!1)}};var pt=r=>{var t;return(t=r.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:t.map(e=>e.toLowerCase()).join("-")};var rr=[...new Set(["debug",...Object.keys(B)])],Yn=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorerOptions"],Jn=r=>Yn.includes(r),ge=rr.filter(r=>!Jn(r)),Qn={...Object.fromEntries(ge.map(r=>[pt(r),r])),...Object.fromEntries(ge.map(r=>[r.toLowerCase(),r]))},eo={...Object.fromEntries(ge.map(r=>[pt(r),R(r)])),...Object.fromEntries(ge.map(r=>[r.toLowerCase(),R(r)]))},Ii=r=>"__"+r,ke=class extends U{constructor(){super();u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(B).map(([e,i])=>[R(e),i]))}}_flushValueToAttribute(e,i){if(ge.includes(e)){let s=[...new Set([pt(e),e.toLowerCase()])];for(let n of s)typeof i=="undefined"||i===null?this.removeAttribute(n):this.getAttribute(n)!==i.toString()&&this.setAttribute(n,i.toString())}}_flushValueToState(e,i){this.$[R(e)]!==i&&(typeof i=="undefined"||i===null?this.$[R(e)]=B[e]:this.$[R(e)]=i)}_setValue(e,i){let s=this,n=hi(e,i),o=Ii(e);s[o]!==n&&(this._assertSameValueDifferentReference(e,s[o],n),s[o]=n,this._flushValueToAttribute(e,n),this._flushValueToState(e,n),this.debugPrint(`[uc-config] "${e}"`,n))}_getValue(e){let i=this,s=Ii(e);return i[s]}_assertSameValueDifferentReference(e,i,s){this.cfg.debug&&s!==i&&typeof s=="object"&&typeof i=="object"&&JSON.stringify(s)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var i;super.initCallback();let e=this;for(let s of ge)this.sub(R(s),n=>{this._setValue(s,n)},!1);for(let s of rr){let n=(i=e[s])!=null?i:this.$[R(s)];n!==B[s]&&this._setValue(s,n),Object.defineProperty(this,s,{set:o=>{this._setValue(s,o)},get:()=>this._getValue(s)})}}attributeChangedCallback(e,i,s){if(i===s)return;let n=this,o=Qn[e];n[o]=s}};ke.bindAttributes(eo);for(let r of rr)ke.prototype[r]=void 0;var to=ke;var mt=class extends D{constructor(){super(...arguments);u(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};mt.EventType=x;var ro=mt;export{to as Config,ft as Copyright,Oe as DropArea,Ue as FileItem,et as FileUploaderMinimal,tr as FormInput,Le as Icon,ht as ProgressBar,tt as StartFrom,ro as UploadCtxProvider,ct as UploadList,Ri as defineComponents,sr as defineLocale};