@uploadcare/file-uploader 1.25.0-alpha.8 → 1.25.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.d.ts +52 -46
- package/dist/index.js +4 -4
- package/dist/index.layered.css +2 -2
- package/dist/index.ssr.js +31 -20
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +2 -2
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/package.json +1 -1
- package/web/file-uploader.iife.min.d.ts +52 -46
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +52 -46
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.layered.min.css +2 -2
- package/web/uc-basic.min.css +2 -2
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +50 -45
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +2 -2
- package/web/uc-file-uploader-inline.min.css +2 -2
- package/web/uc-file-uploader-inline.min.d.ts +52 -46
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.layered.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.d.ts +52 -46
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.layered.min.css +2 -2
- package/web/uc-file-uploader-regular.min.css +2 -2
- package/web/uc-file-uploader-regular.min.d.ts +52 -46
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {listenKeys,map}from'nanostores';import {html,LitElement,nothing}from'lit';import {createContext,ContextConsumer,ContextProvider}from'@lit/context';import {property,state}from'lit/decorators.js';import {uploadFile,CancelError,UploadcareError,Queue,uploadFileGroup,getUserAgent,UploadError,NetworkError}from'@uploadcare/upload-client';import {startKeyUX,focusGroupKeyUX,pressKeyUX,jumpKeyUX,hiddenKeyUX}from'keyux';import {TelemetryAPIService}from'@uploadcare/quality-insights';import {createRef,ref}from'lit/directives/ref.js';import {repeat}from'lit/directives/repeat.js';import {styleMap}from'lit/directives/style-map.js';import {unsafeSVG}from'lit/directives/unsafe-svg.js';import {when}from'lit/directives/when.js';import {classMap}from'lit/directives/class-map.js';import {ifDefined}from'lit/directives/if-defined.js';import {getPrefixedCdnBaseAsync,isPrefixedCdnBase}from'@uploadcare/cname-prefix/async';import {shrinkFile}from'@uploadcare/image-shrink';/**
|
|
2
2
|
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.25.0-alpha.
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.25.0-alpha.9 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/file-uploader/blob/main/LICENSE
|
|
5
|
-
* Built: 2025-12-
|
|
5
|
+
* Built: 2025-12-12T13:27:40.998Z
|
|
6
6
|
*/
|
|
7
|
-
var Os=Object.defineProperty;var Is=Object.getOwnPropertyDescriptor;var u=(o,r,t,e)=>{for(var i=e>1?void 0:e?Is(r,t):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(e?n(r,t,i):n(i))||i);return e&&i&&Os(r,t,i),i};var M=class o{static{this.Ft=new Map;}constructor(r,t){this.w=t;}pub(r,t){r in this.w.get()||console.warn(`PubSub#pub: Key "${String(r)}" not found`),this.w.setKey(r,t);}sub(r,t,e=true){return r in this.w.get()||console.warn(`PubSub#sub: Key "${String(r)}" not found`),e&&t(this.w.get()[r]),{remove:listenKeys(this.w,[r],s=>{t(s[r]);})}}read(r){return r in this.w.get()||console.warn(`PubSub#read: Key "${String(r)}" not found`),this.w.get()[r]}add(r,t,e=false){(!(r in this.w.get())||e)&&this.w.setKey(r,t);}has(r){return r in this.w.get()}get store(){return this.w.get()}static registerCtx(r,t){if(o.Ft.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=map(r);return o.Ft.set(t,e),new o(t,e)}static deleteCtx(r){o.Ft.delete(r);}static getCtx(r){let t=o.Ft.get(r);return t?new o(r,t):null}static hasCtx(r){return o.Ft.has(r)}};var Ls=/\\([0-9a-fA-F]{1,6} ?)/g;function $s(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function Us(o){let r=o;return (r[0]==='"'||r[0]==="'")&&(r=r.slice(1)),(r[r.length-1]==='"'||r[r.length-1]==="'")&&(r=r.slice(0,-1)),r}function Rs(o){let r="",t="";for(let e=0;e<o.length;e++){let i=o[e+1];o[e]==="\\"&&i==='"'?(r+='\\"',e++):o[e]==='"'&&t!=="\\"?r+='\\"':r+=o[e],t=o[e]??"";}return r}function Mr(o){let r=o;$s(o)&&(r=Us(r),r=r.replace(Ls,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),r=r.replaceAll(`\\ `,"\\n"),r=Rs(r),r='"'+r+'"');try{return JSON.parse(r)}catch{return}}function Dt(o){class r extends o{constructor(){super(...arguments);this.qr=null;this.ci=null;}getCssData(i,s=false){let n=this.qr??Object.create(null);if(!Object.keys(n).includes(i)||!n[i]){this.ci||(this.ci=window.getComputedStyle(this));let a=this.ci.getPropertyValue(i).trim();try{n[i]=Mr(a);}catch(l){s||console.warn(`CSS Data error: ${i}`,l),n[i]=null;}}return this.qr=n,n[i]}}return r}function Ee(o){class r extends o{constructor(){super(...arguments);this.willYield=true;this.tt={};this.et=null;this.he=false;}createRenderRoot(){return this}connectedCallback(){this.et||(this.et=Array.from(this.childNodes)),super.connectedCallback();}da(){if(this.he)return;this.he=true,this.tt={};let i=Array.from(this.childNodes),s=i.length?i:this.et??[];for(let n of s){let a=this.Xr(n),l=this.tt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.tt[a]=l;}this.et=null;}Xr(i){return i instanceof Comment&&i.nextSibling instanceof Element?this.Xr(i.nextSibling):"contentFor"in i?i.contentFor||"":i instanceof Element&&i.hasAttribute("content-for")&&i.getAttribute("content-for")||""}pa(i){return !i.textContent||!i.textContent.trim()}ha(i){let s=this.tt[i];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.pa(n))}update(i){!this.hasUpdated&&this.willYield&&this.da(),super.update(i);}yield(i,s){if(i===""&&!this.tt[i]&&!this.he&&this.et?.length){let a=[];for(let l of this.et)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.tt[i]=a,this.he=true,this.et=null;}let n=this.tt[i];return html` ${n} ${this.ha(i)?s:void 0} `}}return r}function Vt(o){class r extends o{static reg(e){let i=this,s=window.customElements.get(e);if(s){s!==i&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,i);}}return r}function T(o,r){let t,e=((...i)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...i),r);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Lr=createContext("ctx-name-context");function Te(){return function(o){class r extends o{constructor(...i){super(...i);this.k=null;this._t=false;this.ui=false;this.di=void 0;this.vt=new Map;this.Nt=new Set;this.init$={};this.ctxOwner=false;this.me=void 0;this.fe=false;this.ctxName=this.K;this.H=false;this.me=this.getAttribute("ctx-name")||void 0,this.ctxName=this.K,this.ma=new ContextConsumer(this,{context:Lr,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Jr=s,this.Yr();},subscribe:true});}get Qr(){return this.me}set Qr(i){let s=i??void 0;this.me!==s&&(this.me=s,this.Yr());}shouldUpdate(i){return this.H?super.shouldUpdate(i):false}get K(){return this.Qr||this.Jr||void 0}Yr(){if(this.ctxName=this.K,!(!this.ctxName||this._t)){if(this.isConnected){this.pi();return}this.fe=true;}}willUpdate(i){super.willUpdate(i),this.ctxName=this.K,this.ctxName&&(this.di?this.di.setValue(this.ctxName):this.di=new ContextProvider(this,{context:Lr,initialValue:this.ctxName}));}to(){if(!(!this.k||this.vt.size===0)){for(let[i,{value:s,rewrite:n}]of this.vt)this.k.add(i,s,n);this.vt.clear();}}eo(){return !this.k&&this.K&&this.hi(),this.k&&this.to(),this.k}mi(){let i=this.eo();if(!i)throw new Error("SymbioteMixin: Shared context is not initialized.");return i}hi(){let i=this.init$,s=this.K;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.k){this.k=M.getCtx(s)??M.registerCtx(i,s);for(let[n,a]of Object.entries(this.init$))this.k.add(n,a,this.ctxOwner);this.to();}}get $(){return this.K&&this.hi(),new Proxy({},{get:(i,s)=>{if(typeof s=="string")return this.k?.read(s)},set:(i,s,n)=>(typeof s!="string"||this.k?.pub(s,n),true)})}sub(i,s,n=true){let a=this.mi().sub(i,s,n);if(!a||typeof a.remove!="function")return ()=>{};let l=a.remove.bind(a),c=false,d=()=>{c||(c=true,l(),this.Nt.delete(d));};return this.Nt.add(d),d}pub(i,s){this.mi().pub(i,s);}set$(i){for(let[s,n]of Object.entries(i))this.pub(s,n);}has(i){return this.k?.has(i)??false}add(i,s,n=false){let a=this.eo();if(!a){if(!n&&this.vt.has(i))return;this.vt.set(i,{value:s,rewrite:n});return}this.vt.delete(i),a.add(i,s,n);}add$(i,s=false){for(let[n,a]of Object.entries(i))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this._t?this.H&&this.ui&&(this.ui=false,this.initCallback()):this.ctxName?(this.fe=false,this.pi()):this.fe&&this.K&&(this.fe=false,this.pi());}pi(){if(this._t)return;this._t=true,this.hi();let i=this.init$;if(Object.keys(i).length>0){let s=this.mi();for(let[n,a]of Object.entries(i))s.read(n)===void 0&&s.pub(n,a),this.sub(n,T(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.H=true,this.requestUpdate();}firstUpdated(i){super.firstUpdated(i);}disconnectedCallback(){this.fa(),super.disconnectedCallback(),this._t&&(this.ui=true);}fa(){if(this.Nt.size!==0){for(let i of [...this.Nt])i();this.Nt.clear();}}initCallback(){}}return u([property({type:String,attribute:"ctx-name",noAccessor:true})],r.prototype,"Qr",1),u([state()],r.prototype,"Jr",2),u([state()],r.prototype,"ctxName",2),u([state()],r.prototype,"H",2),r}}var Ai=class extends Vt(Te()(Dt(Ee(LitElement)))){};var pt=class{static generate(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}};var zs=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Oi(o){for(let r in o){if(zs.includes(r))continue;let t=[...r].reduce((e,i)=>(i.toUpperCase()===i&&(i=`-${i.toLowerCase()}`),e+=i,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[r].reg&&o[r].reg(t);}}var Ii="UC";function Bs(o,r=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ii]){t(window[Ii]);return}let i=document.createElement("script");i.async=true,i.src=o,i.onerror=()=>{e();},i.onload=()=>{let s=window[Ii];r&&Oi(s),t(s);},document.head.appendChild(i);})}var te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Si=new Map,$r=new Map,Ur=(o,r)=>{Si.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...te,...r};return Si.set(o,t),t},Ks=(o,r)=>{$r.set(o,r);},Rr=(o,r)=>{typeof r=="function"?Ks(o,r):Ur(o,r);},Pr=async o=>{let r=Si.get(o);if(!r){let t=$r.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();r=Ur(o,e);}return r};Rr("en",te);var P=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Ce=class{constructor(r){this.it=new Map;this.M=new Set;this.p=new Map;this.n=r;}a(...r){this.n.debugPrint("[modal-manager]",...r);}registerModal(r,t){this.it.set(r,t),this.g(P.ADD,{id:r,modal:t});}deleteModal(r){let t=this.it.get(r);return t?(this.it.delete(r),this.M.delete(r),this.g(P.DELETE,{id:r,modal:t}),true):false}open(r){let t=this.it.get(r);return t?(this.M.add(r),this.g(P.OPEN,{modal:t,id:r}),true):(this.a(`Modal with ID "${r}" not found`),false)}close(r){let t=this.it.get(r);return !t||!this.M.has(r)?(this.a(`Modal with ID "${r}" not found or not active`),false):(this.M.delete(r),this.g(P.CLOSE,{id:r,modal:t}),true)}toggle(r){return this.it.has(r)?this.M.has(r)?this.close(r):this.open(r):(this.a(`Modal with ID "${r}" not found`),false)}get hasActiveModals(){return this.M.size>0}back(){if(this.M.size===0)return this.a("No active modals to go back from"),false;let r=Array.from(this.M).pop();return r?this.close(r):false}closeAll(){let r=this.M.size;return this.M.clear(),this.g(P.CLOSE_ALL,{}),r}subscribe(r,t){return this.p.has(r)||this.p.set(r,new Set),this.p.get(r)?.add(t),()=>this.unsubscribe(r,t)}unsubscribe(r,t){this.p.has(r)&&this.p.get(r)?.delete(t);}g(r,t){if(this.p.has(r))for(let e of this.p.get(r)??new Set)try{e(t);}catch(i){this.n.telemetryManager.sendEventError(i,"modal subscriber"),this.a("Error in modal subscriber:",i);}}destroy(){this.closeAll(),this.it.clear(),this.p.clear(),this.g(P.DESTROY,{});}};var ee=o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(r=>r.toLowerCase()).join("-");var Mi=()=>({}),Li=o=>({...Mi(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),$i=o=>({...Li(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Queue(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Dr=o=>({...$i(o),"*solution":null});var Ui=class{constructor(){this.zt=new Map;this.fi=[];}addEventListener(r,t){let e=i=>{let s=i.target;s instanceof Node&&this.fi.some(n=>n===s||n.contains(s))&&t(i);};this.zt.set(t,e),window.addEventListener(r,e);}removeEventListener(r,t){let e=this.zt.get(t);e&&window.removeEventListener(r,e),this.zt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(r){this.fi.push(r);}destroy(){this.fi=[];for(let r of this.zt.values())window.removeEventListener("keydown",r),window.removeEventListener("keyup",r);this.zt.clear();}},xe=class{constructor(){this.ve=new Ui,this.io=startKeyUX(this.ve,[focusGroupKeyUX(),pressKeyUX("is-pressed"),jumpKeyUX(),hiddenKeyUX()]);}registerBlock(r){this.ve.registerScope(r);}destroy(){this.io?.(),this.ve.destroy();}};var wt=o=>`*l10n/${o}`,Xs="en",ke=class{constructor(r){this.e=null;this.vi="";this.e=r;for(let[t,e]of Object.entries(te)){let i=this.e.has(wt(t))?!this.e.$[wt(t)]:true;this.e.add(wt(t),e,i);}setTimeout(()=>{r.subConfigValue("localeName",async t=>{if(!this.e||!t)return;this.vi=t;let e=await Pr(t);if(t!==Xs&&this.vi!==t)return;let i=this.e.cfg.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=i?.[s];this.e.add(wt(s),a??n,true);}}),r.subConfigValue("localeDefinitionOverride",t=>{if(!t)return;let e=t[this.vi];if(e)for(let[i,s]of Object.entries(e))this.e?.add(wt(i),s,true);});});}};var G=o=>o?o.split(",").map(r=>r.trim()).filter(Boolean):[],ht=o=>o.join(",");var Vr=o=>{if(typeof o!="string"||!o)return "";let r=o.trim();return r.startsWith("-/")?r=r.slice(2):r.startsWith("/")&&(r=r.slice(1)),r.endsWith("/")&&(r=r.slice(0,r.length-1)),r},Ae=(...o)=>o.filter(r=>typeof r=="string"&&!!r).map(r=>Vr(r)).join("/-/"),z=(...o)=>{let r=Ae(...o);return r?`-/${r}/`:""};function Oe(o){let r=new URL(o),t=r.pathname+r.search+r.hash,e=t.lastIndexOf("http"),i=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):i>=0&&(s=t.slice(i+1)),s}function Ie(o){let r=new URL(o),{pathname:t}=r,e=t.indexOf("/"),i=t.indexOf("/",e+1);return t.substring(e+1,i)}function Ri(o){let r=Fr(o),t=new URL(r),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Pi(o){return Ri(o).split("/-/").filter(Boolean).map(t=>Vr(t))}function Fr(o){let r=new URL(o),t=Oe(o),e=_r(t)?Nr(t).pathname:t;return r.pathname=r.pathname.replace(e,""),r.search="",r.hash="",r.toString()}function _r(o){return o.startsWith("http")}function Nr(o){let r=new URL(o);return {pathname:`${r.origin}${r.pathname??""}`,search:r.search??"",hash:r.hash??""}}var D=(o,r,t)=>{let e=new URL(Fr(o)),i=t??Oe(o),s=r??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),i&&_r(i)){let n=Nr(i);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${i||""}`;return e.toString()},Et=(o,r)=>{let t=new URL(o);return t.pathname=`${r}/`,t.toString()};var V=(o,r=",")=>o.trim().split(r).map(t=>t.trim()).filter(t=>t.length>0);var ie=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Br=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Qs(o,r){if(typeof r=="number"){let t=r;return ie[o]!==t?`${o}/${t}`:""}if(typeof r=="boolean"){let t=r;return ie[o]!==t?`${o}`:""}if(o==="filter"&&r){let{name:t,amount:e}=r;return ie.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&r){let{dimensions:t,coords:e}=r;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function Tt(o){return Ae(...Br.filter(r=>typeof o[r]<"u"&&o[r]!==null).map(r=>{let t=o[r];return Qs(r,t)}).filter(r=>!!r))}var Se=Ae("format/auto","progressive/yes"),mt=([o])=>typeof o<"u"?Number(o):void 0,zr=()=>true,Ys=([o,r])=>({name:o,amount:typeof r<"u"?Number(r):100}),Js=([o,r])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(r))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:V(o,"x").map(Number),coords:V(r).map(Number)}},tn=Object.freeze({enhance:mt,brightness:mt,exposure:mt,gamma:mt,contrast:mt,saturation:mt,vibrance:mt,warmth:mt,filter:Ys,mirror:zr,flip:zr,rotate:mt,crop:o=>{let[r,t]=o,{dimensions:e,coords:i}=Js([r,t]);return {dimensions:e,coords:i}}});function Di(o){let r={};for(let t of o){let[e,...i]=t.split("/");if(!e||!Br.includes(e))continue;let s=e,n=tn[s];try{let a=n(i);r[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return r}var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),B=Object.freeze([O.CROP,O.TUNING,O.FILTERS]),Kr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Hr=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),jr=Object.freeze(["rotate","mirror","flip"]),ft=ie,tt=Object.freeze({brightness:{zero:ft.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:ft.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:ft.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:ft.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:ft.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:ft.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:ft.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:ft.enhance,range:[0,100],keypointsNumber:1},filter:{zero:ft.filter,range:[0,100],keypointsNumber:1}});var re="https://ucarecdn.com",en="https://upload.uploadcare.com",rn="https://social.uploadcare.com",on="https://ucarecd.net",sn={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:ht(B),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:re,cdnCnamePrefixed:on,baseUrl:en,socialBaseUrl:rn,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true},W=Object.freeze(sn);var C=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),w=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"}),Me=class{constructor(r){this.ge=new Map;this.gi=new Set;this.a=null;this.a=r;}bindTarget(r){return this.gi.add(r),()=>{this.gi.delete(r);}}ro(r,t){for(let e of this.gi)e.dispatchEvent(new CustomEvent(r,{detail:t}));this.a?.(()=>{let e=t&&typeof t=="object"?{...t}:t;return [`event "${r}"`,e]});}emit(r,t,e={}){let{debounce:i}=e;if(typeof i!="number"&&!i){this.ro(r,typeof t=="function"?t():t);return}this.ge.has(r)&&window.clearTimeout(this.ge.get(r));let s=typeof i=="number"?i:20,n=window.setTimeout(()=>{try{let a=typeof t=="function"?t():t;this.ro(r,a),this.ge.delete(r);}catch(a){this.a?.(()=>`Error while getting payload for event "${r}"`,a);}},s);this.ge.set(r,n);}};var Gr="1.25.0-alpha.8";var ot="blocks",st=Gr;var Le=class{constructor(r){this.va=crypto.randomUUID();this.gt=structuredClone(W);this.yi=false;this.bi=null;this.j=true;this.n=r,this.oo=new TelemetryAPIService,this.yt=new Queue(10),this.n.subConfigValue("qualityInsights",t=>{this.j=!!t;});for(let t of Object.keys(this.gt))this.n.subConfigValue(t,e=>{this.j&&(this.yi&&this.gt[t]!==e&&this.sendEvent({eventType:C.CHANGE_CONFIG}),this.ga(t,e));});}ya(r){r===C.INIT_SOLUTION&&!this.yi&&(this.yi=true);}ga(r,t){this.gt[r]!==t&&(this.gt[r]=t);}ba(r){let t=r.payload?{...r.payload}:{};t.activity&&(t.activity=void 0);let e={...r};return (r.eventType===C.INIT_SOLUTION||r.eventType===C.CHANGE_CONFIG)&&(e.config=this.gt),{...e,appVersion:st,appName:ot,sessionId:this.va,component:this.wa,activity:this.Ea,projectPubkey:this.gt.pubkey,userAgent:navigator.userAgent,eventType:e.eventType??"",eventTimestamp:this.Ta,payload:{location:this.Ca,...t}}}xa(r){return !!(r&&[w.CHANGE,w.COMMON_UPLOAD_PROGRESS,w.FILE_ADDED,w.FILE_REMOVED,w.FILE_UPLOAD_START,w.FILE_UPLOAD_PROGRESS,w.FILE_UPLOAD_SUCCESS,w.FILE_UPLOAD_FAILED].includes(r))}sendEvent(r){if(!this.j)return;let t=this.ba({eventType:r.eventType,payload:r.payload,config:r.config});this.ya(r.eventType),!(this.xa(r.eventType)||this.bi&&this.so(this.bi,t))&&this.yt.add(async()=>{this.bi=t,await this.oo.sendEvent(t);});}sendEventError(r,t="unknown"){this.sendEvent({eventType:C.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:r.message}}});}sendEventCloudImageEditor(r,t,e={}){this.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{tabId:t,node:r.currentTarget?.tagName,event:r.type,...e}}});}so(r,t){if(JSON.stringify(r)===JSON.stringify(t))return true;if(typeof r!="object"||typeof t!="object"||r==null||t==null)return false;let e=Object.keys(r),i=Object.keys(t);if(e.length!==i.length)return false;for(let s of e)if(!Object.hasOwn(t,s)||!this.so(r[s],t[s]))return false;return true}get Ta(){return Date.now()}get wa(){if(!this.n.has("*solution"))return null;let r=this.n.$["*solution"];return r?r.toLowerCase():null}get Ea(){return this.n.has("*currentActivity")?this.n.$["*currentActivity"]??null:null}get Ca(){return location.origin}};var _=o=>`*cfg/${o}`;var Wr=o=>{let r=new Intl.Locale(o),t="ltr",e=r.getTextInfo?.().direction;return e?t=e:r.textInfo?.direction&&(t=r.textInfo.direction),t};var $e=(o,r)=>new Intl.PluralRules(o).select(r);var cn=o=>o;var Zr="plural:";function oe(o,r={},t={}){let{openToken:e="{{",closeToken:i="}}",transform:s=cn}=t;for(let n in r){let a=r[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+i,c);}return o}function qr(o){let r=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let i=o.substring(t+2,e);if(i.startsWith(Zr)){let s=o.substring(t+2,e).replace(Zr,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));r.push({variable:i,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return r}var Xr="--uploadcare-blocks-window-height",se=class o{static{this.clientsRegistry=new Set;}static{this.flush=T(()=>{document.documentElement.style.setProperty(Xr,`${window.innerHeight}px`);},100);}static registerClient(r){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(r);}static unregisterClient(r){o.clientsRegistry.delete(r),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(Xr);}};var un=o=>o.tagName?.includes("-")??false,Ue=class{constructor(r){this.rt=new Set;this.ye=new Map;this.ao=false;this.ot=r,this.ot.addController(this);}hostDisconnected(){this.be?.(),this.be=void 0,this.rt.clear(),this.ye.clear();}hostUpdated(){if(!this.be&&this.ot.has(_("testMode"))){let r=this.ot.subConfigValue("testMode",t=>{this.ao=!!t,this.lo();});this.be=r;}this.ka(),this.lo();}ka(){let r=this.ot,t=r.renderRoot??r;if(!t)return;let e=this.ot,i=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!un(n));for(let n of s)if(!(i&&n.closest(i)!==e)&&!this.rt.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.rt.add(n),this.ye.set(n,a);}for(let n of Array.from(this.rt))(!n.isConnected||i&&n.closest(i)!==e)&&(this.rt.delete(n),this.ye.delete(n));}lo(){if(!this.rt.size)return;let r=this.ot.testId||"";for(let t of this.rt){let e=this.ye.get(t);e&&(this.ao?t.setAttribute("data-testid",`${r}--${e}`):t.removeAttribute("data-testid"));}}};var pn=Vt(Te()(Dt(Ee(LitElement)))),g=class extends pn{constructor(){super();this.we=new Map;this.activityType=null;this.init$=Mi();new Ue(this);}static{this.styleAttrs=[];}l10n(t,e={}){if(!t)return "";let i=this.$[wt(t)]||t,s=qr(i);for(let a of s)e[a.variable]=this.Aa(a.pluralKey,Number(e[a.countVariable]));return oe(i,e)}Aa(t,e){let i=this.l10n("locale-id")||"en",s=$e(i,e);return this.l10n(`${t}__${s}`)}emit(t,e,i){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,i);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),se.registerClient(this);}initCallback(){this.addSharedContextInstance("*blocksRegistry",()=>new Set,{persist:true}),this.addSharedContextInstance("*eventEmitter",()=>new Me(this.debugPrint.bind(this)),{persist:true}),this.addSharedContextInstance("*localeManager",()=>new ke(this)),this.addSharedContextInstance("*modalManager",()=>new Ce(this)),this.addSharedContextInstance("*a11y",()=>new xe,{persist:true}),this.addSharedContextInstance("*telemetryManager",()=>new Le(this)),this.sub(wt("locale-id"),t=>{let e=Wr(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this.getSharedContextInstance("*telemetryManager")}get localeManager(){return this.getSharedContextInstance("*localeManager")}get a11y(){return this.getSharedContextInstance("*a11y")}get blocksRegistry(){return this.getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this.getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),se.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),this.co(),t?.size===0&&setTimeout(()=>{!this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.co(true),M.deleteCtx(this.ctxName);}addSharedContextInstance(t,e,{persist:i=false}={}){if(!this.we.has(t)&&(!this.has(t)||!this.$[t])){let s=e();this.add(t,s,true),this.we.set(t,{persist:i,instance:s});return}}co(t=false){for(let[e,i]of this.we.entries()){let{persist:s,instance:n}=i;s&&!t||(n?.destroy?.(),this.pub(e,null),this.we.delete(e));}}getSharedContextInstance(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:Ie(t),cdnUrlModifiers:Ri(t),fileName:Oe(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?oe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.wi){let t={};this.wi=new Proxy(t,{set:(e,i,s)=>{if(typeof i!="string"||!(i in W))return false;let n=i,a=_(n);return this.has(a)||this.add(a,W[n]),this.$[a]=s,true},get:(e,i)=>{let s=_(i);return this.has(s)||this.add(s,W[i]),this.$[s]}});}return this.wi}subConfigValue(t,e){let i=_(t);return this.has(i)||this.add(i,W[t]),this.sub(i,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof t?.[0]=="function"){let i=t[0];e=i();}console.log(`[${this.ctxName}]`,...e);}};var ne=class extends g{constructor(){super(...arguments);this.name="";this.Ei="";this.uo=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.uo=t,this.po();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.po();}po(){if(!this.name){this.Ei="";return}let t=`#uc-icon-${this.name}`,e=this.uo?.(this.name);this.Ei=e??t;}render(){return html` ${this.yield("",html`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Ei}></use></svg>`)} `}};u([property({type:String})],ne.prototype,"name",2),u([state()],ne.prototype,"Ei",2);var Yr=o=>[...new Set(o)];var It="--uc-img-",Vi="unresolved";var Fi=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),_i=3e3,Ni=5e3,zi=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var fn="https://ucarecdn.com",Ft=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:fn},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var Re=class extends Dt(Vt(LitElement)){constructor(){super();this.bt={};this.p=new Map;this.wt=null;this.Ee=null;for(let t in Ft){let e=Ft[t];this.bt[It+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.bt[It+t]}set$$(t){for(let e in t){let i=It+e,s=t[e];this.bt[i]=s,this.g(i,s);}}sub$$(t,e){let i=It+t;this.p.has(i)||this.p.set(i,new Set),this.p.get(i)?.add(e);let s=this.bt[i];s!==null&&s!==""&&e(s);}g(t,e){this.p.has(t)&&this.p.get(t)?.forEach(i=>{e===null||e===""||i(e);});}analyticsParams(){return `-/@clib/${ot}/${st}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let i=e;Ft[i.name]||t.setAttribute(i.name,i.value);});}initIntersection(t,e){let i={root:null,rootMargin:"0px"};this.wt=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.wt?.unobserve(t));});},i),this.wt.observe(t),this.Ee||(this.Ee=new Set),this.Ee.add(t);}connectedCallback(){super.connectedCallback(),this.Oa();}Oa(){for(let t in Ft){let e=It+t,i=this.getCssData(e,true);i!=null&&(this.bt[e]=i);}}disconnectedCallback(){super.disconnectedCallback(),this.wt&&(this.Ee?.forEach(t=>{this.wt?.unobserve(t);}),this.wt=null),this.p.clear();}static get observedAttributes(){return Object.keys(Ft)}attributeChangedCallback(t,e,i){window.setTimeout(()=>{let s=It+t;this.bt[s]=i,this.g(s,i);});}};var Jr=o=>Object.entries(o).filter(([r,t])=>t!==void 0&&t!=="").map(([r,t])=>r==="cdn-operations"||r==="analytics"?t:`${r}/${t}`);var Ve=class extends Re{constructor(){super(...arguments);this.V=new Image;this.L=new Image;}ho(t){return !t.includes("//")&&!Fi&&(t=new URL(t,document.baseURI).href),t}Te(t){if(!t)return;let e=t,i=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!i||!s)return;let n=parseInt(i,10);return Number(n)>Ni&&this.mo?Ni+s:Number(n)>_i&&!this.mo?_i+s:t}Ia(t,e){let i={format:this.Ti("format"),quality:this.Ti("quality"),resize:this.Te(t),blur:e,"cdn-operations":this.Ti("cdn-operations")??void 0,analytics:this.analyticsParams()};return z(...Jr(i))}Ti(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}A(t="",e=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(Fi&&i&&!i.includes("//"))return this.Bt(i);let s=this.Ia(t,e),n=this.$$("cdn-cname"),a=n;if(i.startsWith(String(n)))return D(i,s);let l=this.$$("uuid");if(a&&l)return this.Bt(D(Et(a,l),s));if(l)return this.Bt(D(Et(a,l),s));let c=this.$$("proxy-cname");if(c)return this.Bt(D(c,s,this.ho(i)));let d=this.$$("pubkey");if(d)return this.Bt(D(`https://${d}.ucr.io/`,s,this.ho(i)))}Bt(t){let e=this.$$("secure-delivery-proxy");return e?oe(e,{previewUrl:t},{transform:i=>window.encodeURIComponent(i)}):t}Et(t,e=1,i=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=i?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Sa(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},i=["load","error"];for(let s of i)t.addEventListener(s,e);}get img(){return this.F||(this.Ci({elNode:this.V}),this.appendChild(this.V)),this.V}get Ce(){return this.F?{type:zi.PREVIEW,img:this.L}:{type:zi.MAIN,img:this.img}}get F(){return this.$$("is-preview-blur")}get fo(){return this.$$("is-background-for")}get vo(){let t=this.$$("breakpoints");if(t){let e=V(t);return Yr(e.map(i=>parseInt(i,10)))}else return null}get mo(){return this.$$("format").toLowerCase()==="jpeg"}go(t){let e=new Set;e.add(`url("${this.A(this.Et(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.A(this.Et(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.A(this.Et(t,3))}") ${3}x`);let i=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",i),t.style.setProperty("background-image",`-webkit-${i}`);}yo(){let t=new Set;return this.vo?this.vo.forEach(e=>{t.add(`${this.A(`${e}x`)} ${this.Te(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.A(`${e*2}x`)} ${this.Te(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.A(`${e*3}x`)} ${this.Te(`${e*3}w`)}`);}):(t.add(`${this.A(this.Et(this.Ce.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.A(this.Et(this.Ce.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.A(this.Et(this.Ce.img,3))} 3x`)),[...t].join()}bo(){return this.A()}get wo(){return this.A("100x","100")}Ma(){let t=this.fo;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.go(e);}):this.go(e);});}La({elNode:t,src:e,srcset:i}){e&&(t.src=e),i&&(t.srcset=i);}Ci({elNode:t}){this.Sa(t),this.initAttributes(t);}xi({src:t,srcset:e,elNode:i}){return new Promise((s,n)=>{this.Ci({elNode:i}),i.setAttribute(Vi,""),i.addEventListener("load",()=>{i.removeAttribute(Vi),s(i);}),i.addEventListener("error",()=>{n(false);}),this.La({elNode:i,src:t,srcset:e});})}async $a(){if(this.$$("intersection")){this.F&&(this.Ci({elNode:this.L}),this.appendChild(this.L)),this.initIntersection(this.Ce.img,async()=>{this.F&&(this.L.src=this.wo);try{await this.xi({src:this.bo(),srcset:this.yo(),elNode:this.V}),this.F&&await this.L.remove(),this.appendChild(this.V);}catch{this.F&&await this.L?.remove(),this.appendChild(this.V);}});return}try{this.F&&(await this.xi({src:this.wo,elNode:this.L}),this.appendChild(this.L)),await this.xi({src:this.bo(),srcset:this.yo(),elNode:this.V}),this.F&&await this.L?.remove(),this.appendChild(this.V);}catch{this.F&&await this.L?.remove(),this.appendChild(this.V);}}init(){this.fo?this.Ma():this.$a();}};var Bi=class extends Ve{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",r=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=r?"lazy":"eager");});}};var Ki=null,Hi=class extends g{constructor(){super(...arguments);this.dialogEl=createRef();this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");};this.Ua=()=>{this.closeDialog();};this.Ra=t=>{this.ki=t.target;};this.Pa=t=>{let e=t.target;e===this.dialogEl.value&&e===this.ki&&this.closeDialog();};this.Kt=({id:t})=>{t===this.id?(Ki=t,this.show(),this.emit(w.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.Ht=({id:t})=>{t===this.id&&(this.hide(),this.emit(w.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Eo=t=>{this.hide(),Ki===this.id&&this.emit(w.MODAL_CLOSE,{modalId:Ki,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(P.OPEN,this.Kt),this.modalManager?.subscribe(P.CLOSE,this.Ht),this.modalManager?.subscribe(P.CLOSE_ALL,this.Eo);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.ki=void 0,this.modalManager?.unsubscribe(P.OPEN,this.Kt),this.modalManager?.unsubscribe(P.CLOSE,this.Ht),this.modalManager?.unsubscribe(P.CLOSE_ALL,this.Eo);}Da(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Ua),this.dialogEl.value?.addEventListener("mousedown",this.Ra),this.dialogEl.value?.addEventListener("mouseup",this.Pa);}render(){return html`<dialog ${ref(this.Da)}>${this.yield("")}</dialog>`}};var to=o=>typeof o!="number"?0:Math.floor(o/1e3),eo=(o,{threshold:r})=>{let{secureExpire:t}=o,e=to(Date.now()),i=Number(t),s=to(r);return e+s>=i};var Fe=class{constructor(r){this.Tt=null;this.n=r;}a(...r){this.n.debugPrint("[secure-uploads]",...r);}async getSecureToken(){let{secureSignature:r,secureExpire:t,secureUploadsSignatureResolver:e}=this.n.cfg;if((r||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this.Tt||eo(this.Tt,{threshold:this.n.cfg.secureUploadsExpireThreshold})){this.Tt?this.a("Secure signature is expired. Resolving a new one..."):this.a("Secure signature is not set yet.");try{let i=await e();i?!i.secureSignature||!i.secureExpire?console.error("Secure signature resolver returned an invalid result:",i):(this.a("Secure signature resolved:",i),this.a("Secure signature will expire in",new Date(Number(i.secureExpire)*1e3).toISOString()),this.Tt=i):(this.a("Secure signature resolver returned nothing."),this.Tt=null);}catch(i){console.error("Secure signature resolving failed. Falling back to the previous one.",i),this.n.telemetryManager.sendEventError(i,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Tt}return r&&t?(this.a("Secure signature and expire are set. Using them...",{secureSignature:r,secureExpire:t}),{secureSignature:r,secureExpire:t}):null}};var ji=(o,r)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:r.l10n("some-files-were-not-uploaded")}};var Gi=(o,r)=>{let t=o.totalCount,e=r.cfg.multiple?r.cfg.multipleMin:0,i=r.cfg.multiple?r.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:r.l10n("files-count-limit-error-too-few",{min:e,max:i,total:t}),payload:{total:t,min:e,max:i}};if(i&&t>i)return {type:"TOO_MANY_FILES",message:r.l10n("files-count-limit-error-too-many",{min:e,max:i,total:t}),payload:{total:t,min:e,max:i}}};var wn=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},En=()=>"capture"in document.createElement("input"),Tn=()=>({safariDesktop:wn()}),Cn=()=>({htmlMediaCapture:En()}),io=Tn(),St=Cn();var ae="image/*",Wi="video/*",xn=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],kn=()=>io.safariDesktop?[ae]:[ae,...xn],le=kn(),_e=o=>o?o.filter(r=>typeof r=="string").flatMap(r=>V(r)):[],Zi=(o,r)=>r.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),ro=(o,r)=>r.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),oo=o=>{let r=o?.type;return r?Zi(r,le):false};var qi=(o,r)=>{let t=r.cfg.imgOnly,e=r.cfg.accept,i=_e([...t?le:[],e]);if(!i.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=Zi(s,i),l=ro(n,i);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:r.l10n("file-type-not-allowed"),payload:{entry:o}}};var Xi=(o,r)=>{let t=r.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:r.l10n("images-only-accepted"),payload:{entry:o}}};var nt=1e3,Mt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),ce=o=>Math.ceil(o*100)/100,so=(o,r=Mt.AUTO)=>{let t=r===Mt.AUTO;if(r===Mt.BYTE||t&&o<nt**1){let i=$e("en-US",o)==="one"?"byte":"bytes";return `${o} ${i}`}return r===Mt.KB||t&&o<nt**2?`${ce(o/nt**1)} KB`:r===Mt.MB||t&&o<nt**3?`${ce(o/nt**2)} MB`:r===Mt.GB||t&&o<nt**4?`${ce(o/nt**3)} GB`:r===Mt.TB||t&&o<nt**5?`${ce(o/nt**4)} TB`:`${ce(o/nt**5)} PB`};var Qi=(o,r)=>{let t=r.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:r.l10n("files-max-size-limit-error",{maxFileSize:so(t)}),payload:{entry:o}}};var Yi=(o,r)=>{let{internalId:t}=o,i=r.h.read(t)?.getValue("uploadError");if(!i)return;if(i instanceof UploadError)return {type:"UPLOAD_ERROR",message:i.message,payload:{entry:o,error:i}};if(i instanceof NetworkError)return {type:"NETWORK_ERROR",message:i.message,payload:{entry:o,error:i}};let s=i instanceof Error?i:new Error("Unknown error",{cause:i});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}};var _t={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},Sn=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Ne=class{constructor(r){this.Va=[Xi,qi,Qi,Yi];this.Fa=[Gi,ji];this.yt=new Queue(20);this._a=T(()=>{this.e.isConnected&&this.yt.run();},500);this.xe=new Map;this.e=r,this.h=this.e.uploadCollection;let t=T(()=>{this.e.isConnected&&(this.runFileValidators("change"),this.runCollectionValidators());},0);this.e.subConfigValue("maxLocalFileSizeBytes",t),this.e.subConfigValue("multipleMin",t),this.e.subConfigValue("multipleMax",t),this.e.subConfigValue("multiple",t),this.e.subConfigValue("imgOnly",t),this.e.subConfigValue("accept",t),this.e.subConfigValue("validationConcurrency",e=>{this.yt.concurrency=e;});}runFileValidators(r,t){let e=t??this.h.items();for(let i of e){let s=this.h.read(i);s&&this.Na(s,r);}}runCollectionValidators(){let r=this.e.api.getOutputCollectionState(),t=[];for(let e of [...this.Fa,...this.e.cfg.collectionValidators])try{let i=e(r,this.e.api);if(!i)continue;i&&(t.push(this.To(i)),i.message||console.warn(_t.MISSING_ERROR_MESSAGE));}catch(i){console.warn(_t.COLLECTION_VALIDATION_FAILED,i);}this.e.$["*collectionErrors"]=t,t.length>0&&this.e.emit(w.COMMON_UPLOAD_FAILED,()=>this.e.api.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(r){let t=this.xe.get(r.uid);t&&(t.abortController?.abort(),this.xe.delete(r.uid));}async Na(r,t){let e=this.Co(r),i=e.promise??Promise.resolve(),s=(async()=>{if(await i,!this.e.isConnected)return;let n=this.za(r,t);if(n.length===0)return;r.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let a=this.e.api.getOutputItem(r.uid),l=new AbortController;e.abortController=l;let c=this.e.cfg.validationTimeout,d=this.xo(),p=new Set(n.map(m=>m.validator)),f=[];for(let m of d)if(!p.has(m.validator)){let k=e.lastErrorThrownByValidator.get(m.validator);k&&f.push(k);}let v=n.map(m=>async()=>{if(!this.e.isConnected)return;let k=setTimeout(()=>{e.skippedValidators.add(m.validator),l.abort(),console.warn(_t.FILE_VALIDATION_TIMEOUT);},c);try{let A=await m.validator(a,this.e.api,{signal:l.signal});if(!A||l.signal.aborted){e.lastErrorThrownByValidator.set(m.validator,void 0);return}let R=this.To(A);e.lastErrorThrownByValidator.set(m.validator,R),f.push(R),A.message||console.warn(_t.MISSING_ERROR_MESSAGE);}catch(A){l.signal.aborted||(e.skippedValidators.add(m.validator),console.warn(_t.FILE_VALIDATION_FAILED,A),this.e.telemetryManager.sendEventError(A,`file validator. ${_t.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(k),m.runOn!=="change"&&e.skippedValidators.add(m.validator);}});if(this._a(),await this.yt.add(async()=>{r.setValue("isQueuedForValidation",false),await Promise.all(v.map(m=>m())).catch(()=>{});},{autoRun:false}),l.signal.aborted){r.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}r.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:f});})();e.promise=s;try{await s;}finally{e.promise===s&&(e.promise=void 0);}}To(r){return {...r,type:r.type??"CUSTOM_ERROR"}}Co(r){let t=this.xe.get(r.uid);if(t)return t;let e={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.xe.set(r.uid,e),e}xo(){return [...this.Va,...this.e.cfg.fileValidators].map(Sn)}za(r,t){let e=this.Co(r);return this.xo().filter(i=>!e.skippedValidators.has(i.validator)).filter(i=>i.runOn===t)}};var no="[Typed State] Wrong property name: ",ze=class{constructor(r){this.G=pt.generate(),this.E=M.registerCtx(r,this.G);}get uid(){return this.G}setValue(r,t){if(!this.E.has(r)){console.warn(`${no}${String(r)}`);return}this.E.read(r)!==t&&this.E.pub(r,t);}setMultipleValues(r){for(let[t,e]of Object.entries(r))this.setValue(t,e);}getValue(r){return this.E.has(r)||console.warn(`${no}${String(r)}`),this.E.read(r)}subscribe(r,t){return this.E.sub(r,t)}remove(){M.deleteCtx(this.G);}};var Be=class{constructor(r){this.st=Object.create(null);this.ke=new Set;this.Ae=new Set;this.W=new Set;this.Ai=new Set;this.Oi=new Set;this.Oo=r.initialValue,this.G=pt.generate(),this.E=M.registerCtx({},this.G),this.ko=r.watchList||[];let t=Object.create(null);this.Ao=(e,i)=>{this.Ii&&window.clearTimeout(this.Ii),t[e]||(t[e]=new Set),t[e].add(i),this.Ii=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.ke.forEach(s=>{s({...t});}),t=Object.create(null));});},r.handler&&this.observeCollection(r.handler);}g(){this.Si&&window.clearTimeout(this.Si),this.Si=window.setTimeout(()=>{let r=new Set(this.Oi),t=new Set(this.Ai);this.Oi.clear(),this.Ai.clear();for(let e of this.Ae)e?.([...this.W],r,t);});}observeCollection(r){return this.Ae.add(r),this.W.size>0&&this.g(),()=>{this.unobserveCollection(r);}}unobserveCollection(r){this.Ae.delete(r);}add(r){let t=new ze(this.Oo);for(let[e,i]of Object.entries(r))t.setValue(e,i);return this.W.add(t.uid),this.g(),this.E.add(t.uid,t),this.Oi.add(t),this.ko.forEach(e=>{this.st[t.uid]||(this.st[t.uid]=[]),this.st[t.uid]?.push(t.subscribe(e,()=>{this.Ao(e,t.uid);}));}),t.uid}read(r){return this.E.read(r)}readProp(r,t){let e=this.read(r);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${r} not found`);return e.getValue(t)}publishProp(r,t,e){let i=this.read(r);if(!i)throw new Error(`TypedCollection#publishProp: Item with id ${r} not found`);i.setValue(t,e);}remove(r){let t=this.read(r);t&&this.Ai.add(t),this.W.delete(r),this.g(),this.E.pub(r,void 0),delete this.st[r];}clearAll(){this.W.forEach(r=>{this.remove(r);});}observeProperties(r){return this.ke.add(r),()=>{this.unobserveProperties(r);}}unobserveProperties(r){this.ke.delete(r);}findItems(r){let t=[];return this.W.forEach(e=>{let i=this.read(e);i&&r(i)&&t.push(e);}),t}items(){return [...this.W]}get size(){return this.W.size}destroy(){M.deleteCtx(this.G),this.ke=new Set,this.Ae=new Set;for(let r of Object.keys(this.st))this.st[r]?.forEach(t=>{t.remove();}),delete this.st[r];}};var y=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Y=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Ji=o=>({isVideoRecordingEnabled:G(o.cameraModes).includes(y.VIDEO),isPhotoEnabled:G(o.cameraModes).includes(y.PHOTO)});var ao="active",Nt="___ACTIVITY_IS_ACTIVE___",lo,h=class o extends(lo=g,lo){constructor(){super(...arguments);this.historyTracked=false;this.init$=Li(this);this.Ba=T(this.Ka.bind(this),10);}Io(){let t=o.jt.get(this);this[Nt]=false,this.removeAttribute(ao),t?.deactivateCallback?.();}Ha(){let t=o.jt.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Nt]=true,this.setAttribute(ao,""),t?.activateCallback?.(),this.Ba(),this.emit(w.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Nt]?this.Io():this.activityType===t&&!this[Nt]&&this.Ha();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Ka(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}ja(){return !!this.activityType&&o.jt.has(this)}static{this.jt=new Map;}get isActivityActive(){return !!this[Nt]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:i,onDeactivate:s}=e;o.jt.set(this,{activateCallback:i,deactivateCallback:s});}Ga(){this.isActivityActive&&this.Io(),o.jt.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.ja()&&this.Ga();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(i=>i instanceof o&&i.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let i=!!e;e&&(i=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=i?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};h.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});function Ke(o,r){for(let t in r)t.includes("-")?o.style.setProperty(t,String(r[t])):o.style[t]=String(r[t]);}var Mn=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ln=new RegExp(`^/?(${Mn.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),co=({url:o,cdnBase:r})=>{let t=new URL(r),e=new URL(re),i=new URL(o);if(t.host!==i.host&&e.host!==i.host)return null;let s=Ln.exec(i.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var at=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),tr=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),L=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...tr,...at});function uo(o){let r=new Map;return (...e)=>{let i=JSON.stringify(e);if(r.has(i))return r.get(i);let s=o(...e);return r.set(i,s),s}}var po=new Set;function He(o){po.has(o)||(po.add(o),console.warn(o));}function $n(o){let r=false;return setTimeout(()=>{r=true;},0),e=>((...i)=>(r&&He(o),e(...i)))}function ho(o){let r={},t={progress:()=>o.$["*commonProgress"],errors:()=>o.$["*collectionErrors"],group:()=>o.$["*groupInfo"],totalCount:()=>o.uploadCollection.size,failedCount:()=>r.failedEntries.length,successCount:()=>r.successEntries.length,uploadingCount:()=>r.uploadingEntries.length,status:()=>r.isFailed?"failed":r.isUploading?"uploading":r.isSuccess?"success":"idle",isSuccess:()=>r.allEntries.length>0&&r.errors.length===0&&r.successEntries.length===r.allEntries.length,isUploading:()=>r.allEntries.some(i=>i.status==="uploading"),isFailed:()=>r.errors.length>0||r.failedEntries.length>0,allEntries:()=>o.getOutputData(),successEntries:()=>r.allEntries.filter(i=>i.status==="success"),failedEntries:()=>r.allEntries.filter(i=>i.status==="failed"),uploadingEntries:()=>r.allEntries.filter(i=>i.status==="uploading"),idleEntries:()=>r.allEntries.filter(i=>i.status==="idle")},e=$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[i,s]of Object.entries(t)){let n=i,l=uo(e(s));Object.defineProperty(r,n,{get:l,enumerable:true});}return r}var je=class{constructor(r){this.addFileFromUrl=(r,{silent:t,fileName:e,source:i}={})=>{let s=this.h.add({externalUrl:r,fileName:e??null,silent:t??false,source:i??L.API});return this.getOutputItem(s)};this.addFileFromUuid=(r,{silent:t,fileName:e,source:i}={})=>{let s=this.h.add({uuid:r,fileName:e??null,silent:t??false,source:i??L.API});return this.getOutputItem(s)};this.addFileFromCdnUrl=(r,{silent:t,fileName:e,source:i}={})=>{let s=co({url:r,cdnBase:this.cfg.cdnCname});if(!s)throw new Error("Invalid CDN URL");let n=this.h.add({uuid:s.uuid,cdnUrl:r,cdnUrlModifiers:s.cdnUrlModifiers,fileName:e??s.filename??null,silent:t??false,source:i??L.API});return this.getOutputItem(n)};this.addFileFromObject=(r,{silent:t,fileName:e,source:i,fullPath:s}={})=>{let n=this.h.add({file:r,isImage:oo(r),mimeType:r.type,fileName:e??r.name,fileSize:r.size,silent:t??false,source:i??L.API,fullPath:s??null});return this.getOutputItem(n)};this.removeFileByInternalId=r=>{if(!this.h.read(r))throw new Error(`File with internalId ${r} not found`);this.h.remove(r);};this.uploadAll=()=>{let r=this.h.items().filter(t=>{let e=this.h.read(t);return e?!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")&&e.getValue("errors").length===0&&!e.getValue("isValidationPending")&&!e.getValue("isQueuedForValidation"):false});r.length!==0&&(this.t.$["*uploadTrigger"]=new Set(r),this.t.emit(w.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(r={})=>{let t=ht(_e([this.cfg.accept??"",...this.cfg.imgOnly?le:[]])),e="uploadcare-file-input",i=document.createElement("input");if(i.setAttribute(e,""),Ke(i,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),i.type="file",i.multiple=this.cfg.multiple,r.captureCamera){i.capture=this.cfg.cameraCapture;let{isPhotoEnabled:s,isVideoRecordingEnabled:n}=Ji(this.cfg);r.modeCamera===y.PHOTO&&s?i.accept=ae:r.modeCamera===y.VIDEO&&n?i.accept=Wi:i.accept=[ae,n&&Wi].filter(Boolean).join(",");}else i.accept=t;i.addEventListener("change",()=>{i.files&&([...i.files].forEach(s=>{this.addFileFromObject(s,{source:r.captureCamera?L.CAMERA:L.LOCAL});}),this.t.modalManager?.open(h.activities.UPLOAD_LIST),this.t.$["*currentActivity"]=h.activities.UPLOAD_LIST,i.remove());},{once:true}),document.querySelectorAll(`[${e}]`).forEach(s=>{s.remove();}),document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click"));};this.initFlow=(r=false)=>{if(this.h.size>0&&!r)this.t.modalManager?.open(h.activities.UPLOAD_LIST),this.t.pub("*currentActivity",h.activities.UPLOAD_LIST);else if(this.So?.length===1){let t=this.So[0];if(t==="local"){this.t.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.openSystemDialog();return}if(t==="camera"&&St.htmlMediaCapture){let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Ji(this.cfg);if(n&&a){this.t.pub("*currentActivity",h.activities.START_FROM);return}else if(n||a){this.openSystemDialog({captureCamera:true,modeCamera:n?y.PHOTO:y.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:y.PHOTO});}let e=this.t.blocksRegistry,i=n=>"type"in n&&n.type===t;[...e].find(i)?.activate(),this.t.$["*currentActivity"]&&this.t.modalManager?.open(this.t.$["*currentActivity"]);}else this.t.modalManager?.open(h.activities.START_FROM),this.t.pub("*currentActivity",h.activities.START_FROM);};this.doneFlow=()=>{this.t.set$({"*currentActivity":this.t.doneActivity,"*history":this.t.doneActivity?[this.t.doneActivity]:[]}),this.t.$["*currentActivity"]||this.t.modalManager?.closeAll();};this.setCurrentActivity=(r,...t)=>{if(this.t.hasBlockInCtx(e=>e.activityType===r)){this.t.set$({"*currentActivityParams":t[0]??{},"*currentActivity":r});return}console.warn(`Activity type "${r}" not found in the context`);};this.getCurrentActivity=()=>this.t.$["*currentActivity"];this.setModalState=r=>{if(r&&!this.t.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}r?this.t.modalManager?.open(this.t.$["*currentActivity"]):(this.t.modalManager?.close(this.t.$["*currentActivity"]),this.t.$["*currentActivity"]=null);};this.t=r;}get h(){return this.t.uploadCollection}get cfg(){return this.t.cfg}get l10n(){return this.t.l10n.bind(this.t)}removeAllFiles(){this.h.clearAll();}getOutputItem(r){let t=M.getCtx(r);if(!t)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${r}" not found in the upload collection`);let e=t.store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return {uuid:i?.uuid??e.uuid??null,internalId:r,name:i?.originalFilename??e.fileName,size:i?.size??e.fileSize,isImage:i?.isImage??e.isImage,mimeType:i?.mimeType??e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:e.cdnUrl??i?.cdnUrl??null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i??null,metadata:e.metadata??i?.metadata??null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",isValidationPending:e.isValidationPending,errors:e.errors,status:s,source:e?.source}}getOutputCollectionState(){return ho(this.t)}get So(){let r=[];return this.cfg.sourceList&&(r=V(this.cfg.sourceList)),r}};var mo={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var ue=33.333333333333336,b=1,er=24,fo=6;function Ct(o,r){for(let[t,e]of Object.entries(r))o.setAttributeNS(null,t,e.toString());}function q(o,r={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return Ct(t,r),t}function vo(o,r,t){let{x:e,y:i,width:s,height:n}=o,a=r.includes("w")?0:1,l=r.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,p=[e+a*s+1.5*c,i+l*n+1.5*d-24*t*d],f=[e+a*s+1.5*c,i+l*n+1.5*d],v=[e+a*s-24*t*c+1.5*c,i+l*n+1.5*d],m=`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,k=[f[0],f[1]];return {d:m,center:k}}function go(o,r,t){let{x:e,y:i,width:s,height:n}=o,a=r==="n"||r==="s",l=r==="w"||r==="e",c=a?.5:r==="w"?0:1,d=l?.5:r==="n"?0:1,p=r==="w"?-1:r==="e"?1:0,f=r==="n"?-1:r==="s"?1:0,v,m;a?(v=[e+c*s-34*t/2,i+d*n+1.5*f],m=[e+c*s+34*t/2,i+d*n+1.5*f]):(v=[e+c*s+1.5*p,i+d*n-34*t/2],m=[e+c*s+1.5*p,i+d*n+34*t/2]);let k=`M ${v[0]} ${v[1]} L ${m[0]} ${m[1]}`,A=[(v[0]+m[0])/2,(v[1]+m[1])/2];return {d:k,center:A}}function yo(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function bo({rect:o,delta:[r,t],imageBox:e}){return Bt({...o,x:o.x+r,y:o.y+t},e)}function Bt(o,r){let{x:t}=o,{y:e}=o;return o.x<r.x?t=r.x:o.x+o.width>r.x+r.width&&(t=r.x+r.width-o.width),o.y<r.y?e=r.y:o.y+o.height>r.y+r.height&&(e=r.y+r.height-o.height),{...o,x:t,y:e}}function Un({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[,i]=r,{y:s,width:n,height:a}=o;s+=i,a-=i,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<b&&(a=b,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<b&&(n=b,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Rn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i]=r,{x:s,width:n,height:a}=o;s+=i,n-=i,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<b&&(a=b,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<b&&(n=b,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Pn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[,i]=r,{y:s,width:n,height:a}=o;a+=i,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<b&&(a=b,t&&(n=a*t),l=o.x+o.width/2-n/2),n<b&&(n=b,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Dn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i]=r,{x:s,width:n,height:a}=o;n+=i,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<b&&(a=b,t&&(n=a*t),l=o.y+o.height/2-a/2),n<b&&(n=b,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Vn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+i<e.x&&(i=e.x-n),a+s<e.y&&(s=e.y-a),n+=i,l-=i,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(i=c*t-l,l=l+i,n-=i,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<b&&(c=b,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<b&&(l=b,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Fn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+l+i>e.x+e.width&&(i=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=i,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(i=c*t-l,l+=i,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<b&&(c=b,t&&(l=c*t),a=o.y+o.height-c),l<b&&(l=b,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function _n({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+i<e.x&&(i=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=i,l-=i,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(i=c*t-l,l+=i,n-=i,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<b&&(c=b,t&&(l=c*t),n=o.x+o.width-l),l<b&&(l=b,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function Nn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+l+i>e.x+e.width&&(i=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=i,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(i=c*t-l,l+=i,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<b&&(c=b,t&&(l=c*t)),l<b&&(l=b,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function wo({direction:o,...r}){switch(o){case "n":return Un(r);case "w":return Rn(r);case "s":return Pn(r);case "e":return Dn(r);case "nw":return Vn(r);case "ne":return Fn(r);case "sw":return _n(r);case "se":return Nn(r);default:return r.rect}}function Eo(o,[r,t]){return o.x<=r&&r<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function To(o,r){return o.x>=r.x&&o.y>=r.y&&o.x+o.width<=r.x+r.width&&o.y+o.height<=r.y+r.height}function Co(o,r){return Math.abs(o.width/o.height-r)<.1}function Kt({width:o,height:r},t){let e=t/90%2!==0;return {width:e?r:o,height:e?o:r}}function xo(o,r,t){let e=o/r,i,s;e>t?(i=Math.round(r*t),s=r):(i=o,s=Math.round(o/t));let n=Math.round((o-i)/2),a=Math.round((r-s)/2);return n+i>o&&(i=o-n),a+s>r&&(s=r-a),{x:n,y:a,width:i,height:s}}function Ht(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function xt(o,r,t){return Math.min(Math.max(o,r),t)}var de=["free"],We=o=>{let r=V(o);if(!r||r.length===0)return [];let t=[];for(let e of r){let i=e.trim();if(!i)continue;let s=i.indexOf(":");if(s===-1&&!de.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}let n=Number(i.slice(0,s)),a=Number(i.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!de.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}t.push({id:pt.generate(),type:"aspect-ratio",width:de.includes(i)?0:n,height:de.includes(i)?0:a,hasFreeform:de.includes(i)});}return t},ko=(o,r,t,e=.1)=>{let i=o/r,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,p=Math.abs(i-d);p<n&&(n=p,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(i-c)/c>e)return null}return s};function Ao(o){return getUserAgent({...o,libraryName:ot,libraryVersion:st})}var E=class o extends h{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Oe=false;this.init$=$i(this);this.$i=T(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Qa(e);},300);this.qa=(t,e,i)=>{if(this.isConnected){(e.size||i.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(w.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of i){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(w.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.$o(),this.$i();}};this.Xa=t=>{if(!this.isConnected)return;this.$i();let e=this.uploadCollection,i=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(i.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=i.filter(n=>t.fileInfo?.has(n)&&!!M.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",i);}),t.uploadProgress){for(let s of t.uploadProgress){let n=M.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.$o();}if(t.isUploading)for(let s of t.isUploading){let n=M.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=M.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Ya(),this.cfg.cloudImageEditorAutoOpen&&this.Ja();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=M.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(w.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(w.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(w.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(w.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.$o=()=>{let t=0,i=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));i.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=i.length?Math.round(t/i.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(w.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get Wa(){return this.hasBlockInCtx(t=>t instanceof o?t.Oe&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.addSharedContextInstance("*uploadCollection",()=>new Be({initialValue:mo,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]}),{persist:true}),this.addSharedContextInstance("*secureUploadsManager",()=>new Fe(this)),this.addSharedContextInstance("*validationManager",()=>new Ne(this)),this.addSharedContextInstance("*publicApi",()=>new je(this)),!this.Wa&&this.couldBeCtxOwner&&this.Za();}get validationManager(){return this.getSharedContextInstance("*validationManager")}get api(){return this.getSharedContextInstance("*publicApi")}getAPI(){return this.api}get uploadCollection(){return this.getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this.getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Oe&&this.Mo(),this.$i.cancel();}connectedCallback(){super.connectedCallback(),this.Oe&&this.Lo();}Za(){this.Oe=true,this.Lo(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Lo(){this.Mo(),this.Mi=this.uploadCollection.observeCollection(this.qa),this.Li=this.uploadCollection.observeProperties(this.Xa);}Mo(){this.Li?.(),this.Mi?.(),this.Li=void 0,this.Mi=void 0;}async Qa(t){let e=await this.getUploadClientOptions(),i=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await uploadFileGroup(i,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(w.GROUP_CREATED,a),this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}Ja(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===h.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT,this.modalManager?.open(h.activities.CLOUD_IMG_EDIT));}Ya(){let t=We(this.cfg.cropPreset);if(t){let[e]=t,i=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of i){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=xo(a,l,c),p=z(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:p,cdnUrl:D(f,p)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(v=>v.activityType===h.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT,this.modalManager?.open(h.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let i=this.api.getOutputItem(t);return await e(i)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ao,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(i=>this.api.getOutputItem(i))}};E.extSrcList=Object.freeze({...at});E.sourceTypes=Object.freeze({...L});var ir=class extends E{constructor(){super(...arguments);this.f=null;this.Ie=null;}Uo(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Ke(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.f=this.Uo(),this.appendChild(this.f),this.sub("*collectionState",t=>{if(!t)return;if(!this.Ie){let n=document.createElement("div");this.appendChild(n),this.Ie=n;}if(!this.f){let n=this.Uo();this.appendChild(n),this.f=n;}if(this.Ie.innerHTML="",t.status==="uploading"||t.status==="idle"){this.f.value="",this.f.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.f.value="",this.f.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.f.value=e.cdnUrl??"",this.f.setCustomValidity("");return}let i=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&i.length===1&&i[0]){this.f.value=i[0],this.f.setCustomValidity("");return}this.f.remove(),this.f=null;let s=new DocumentFragment;for(let n of i){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=n,s.appendChild(a);}this.Ie.replaceChildren(s);},false);}};var rr=class extends g{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",r=>{this.toggleAttribute("hidden",!!r);});}render(){return html`<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 pe=class extends g{constructor(){super(...arguments);this.value=0;this.visible=true;this.O=0;this.Se=createRef();this.Ro=()=>{let t=this.Se.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.O>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.O=this.Ui(this.value),this.Ri(),this.Se.value?.addEventListener("animationiteration",this.Ro);}updated(t){if(super.updated(t),t.has("value")){let e=this.Ui(this.value);if(!this.visible)this.O=e;else {let i=Math.max(this.O,e);i!==this.O&&(this.O=i,this.Ri());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Ri():this.O=this.Ui(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Se.value?.removeEventListener("animationiteration",this.Ro);}Ui(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Ri(){this.visible&&this.style.setProperty("--l-progress-value",this.O.toString());}render(){return html`<div ${ref(this.Se)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};u([property({type:Number})],pe.prototype,"value",2),u([property({type:Boolean,reflect:true})],pe.prototype,"visible",2);var he=class extends E{constructor(){super();this.U=false;this.Ct=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Pi=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.U=t;}),this.sub("*commonProgress",t=>{this.Ct=t;});}updated(t){super.updated(t),t.has("visible")&&(this.U?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Pi?.(),this.Pi=void 0;}render(){return html`<uc-progress-bar .value=${this.Ct} .visible=${this.U}></uc-progress-bar>`}};u([state()],he.prototype,"U",2),u([state()],he.prototype,"Ct",2);var jt=class extends g{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.tl=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return html`<select @change=${this.tl} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>html`<option value=${t.value}>${t.text}</option>`)}</select>`}};u([property({type:String,attribute:false})],jt.prototype,"value",2),u([property({type:Boolean,reflect:true})],jt.prototype,"disabled",2),u([property({type:Array,attribute:false})],jt.prototype,"options",2);var Xn="src-type-",Gt=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Di={};this.Vi="default";this.Fi="";}el(){this.xt({type:L.LOCAL,activate:()=>(this.api.openSystemDialog(),false)}),this.xt({type:L.URL,activity:h.activities.URL,textKey:"from-url"}),this.xt({type:L.CAMERA,activity:h.activities.CAMERA,activate:()=>{let t=St.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t}}),this.xt({type:"draw",activity:h.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(tr))this.xt({type:t,activity:h.activities.CAMERA,activate:()=>{let e=St.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?y.PHOTO:y.VIDEO}),!e}});for(let t of Object.values(at))this.xt({type:t,activity:h.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.el(),this.type&&this.Po(this.type);}xt(t){this.Di[t.type]=t;}activate(){if(!this.type)return;let t=this.Di[this.type];if(!t)return;let{activity:e,activate:i,activityParams:s={}}=t;(i?i():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}Po(t){let e=this.Di[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:i=t,icon:s=t}=e;this.Fi=`${Xn}${i}`,this.Vi=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.Po(this.type):(this.Fi="",this.Vi="default"));}render(){return html`<button type="button" @click=${this.activate}><uc-icon name=${this.Vi}></uc-icon><div class="uc-txt">${this.l10n(this.Fi)}</div></button>`}};u([property({type:String})],Gt.prototype,"type",2),u([state()],Gt.prototype,"Vi",2),u([state()],Gt.prototype,"Fi",2);var Ze=class extends g{constructor(){super(...arguments);this.Do=[];this.b=[];this.Fo=[];}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.Do=V(t),this.Vo();}),this.subConfigValue("cameraModes",t=>{this.b=G(t),this.Vo();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Vo(){let t=[];for(let e of this.Do){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&St.htmlMediaCapture){let i=this.b.length?this.b.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...i);continue}t.push(e);}this.Fo=t;}render(){return html`${this.Fo.map(t=>html`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};u([state()],Ze.prototype,"Fo",2);var sr=class extends g{render(){return html`<div class="uc-spinner"></div>`}};var ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Lt(o){let r=new Image;return {promise:new Promise((i,s)=>{r.src=o,r.onload=()=>i(),r.onerror=n=>s(n);}),image:r,cancel:()=>{r.naturalWidth===0&&(r.src=ct);}}}function me(o){let r=[];for(let s of o){let n=Lt(s);r.push(n);}let t=r.map(s=>s.image);return {promise:Promise.allSettled(r.map(s=>s.promise)),images:t,cancel:()=>{r.forEach(s=>{s.cancel();});}}}function nr(o,r=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let i=new Image,s=new Promise((n,a)=>{i.onload=()=>{let l=i.height/i.width;l>1?(t.width=r,t.height=r*l):(t.height=r,t.width=r/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(i,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},i.onerror=l=>{a(l);};});return i.src=URL.createObjectURL(o),s}var Wt=class extends E{constructor(){super(...arguments);this.Me=new Set;this.entry=null;}withEntry(t){return (...e)=>{let i=this.entry;if(!i){console.warn("No entry found");return}return t(i,...e)}}subEntry(t,e){this.withEntry((i,s,n)=>{let a=i.subscribe(s,l=>{this.isConnected&&n(l);});this.Me.add(a);})(t,e);}reset(){for(let t of this.Me)t.remove();this.Me=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Me=new Set;}};function Jn(o){let r=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(r)}function qe(o="hsl(209, 21%, 65%)",r=32,t=32){return Jn(`<svg width="${r}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}var ia=3e3,Zt=class extends Wt{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Z="";this._o=false;this.Le=null;this.No=false;this.il=this.cfg.filesViewMode;this.zo=this.withEntry(async(t,e=false)=>{let i=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.rl(e);if(i&&s&&n){let d=await this.proxyUrl(D(Et(this.cfg.cdnCname,n),z(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:p}=Lt(d);p.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let v=await nr(f,l);t.setValue("thumbUrl",v);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let v=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(v));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await nr(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(p));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(d));}});this.$e=T(this.zo.bind(this),100);}rl(t=false){t&&(this.Le=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Le?.height||0),10),parseInt(String(this?.Le?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,ia)}ol(t,e){return new Promise((i,s)=>{let n=new Image;n.decoding="async";let a=()=>{n.src="",e?.removeEventListener("abort",l);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),i();},d=p=>{a(),s(p);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Ni(){this._i?.cancel(),this._i=void 0;}sl(t){if(this.Ni(),!t){this.Z&&(this.Z="");return}if(t===this.Z)return;let e=new AbortController,i={controller:e,cancel:()=>{e.abort(),i.rafId!==void 0&&window.cancelAnimationFrame(i.rafId);}};this._i=i,this.ol(t,e.signal).catch(()=>{}).then(()=>{e.signal.aborted||(i.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Z=t);}));});}Ue(t=false){if(this.entry){if(t){this.zo(true);return}this.No&&this.$e();}}firstUpdated(t){super.firstUpdated(t),this.Bo();}updated(t){super.updated(t),t.has("uid")&&this.Bo();}Gt(t){let[e]=t;e&&(this.No=e.isIntersecting,e.isIntersecting&&(this.Le=e.boundingClientRect,this.Ue(),this.i?.disconnect()),e.intersectionRatio===0&&this.$e.cancel());}reset(){super.reset(),this.$e.cancel(),this.Ni(),this.Z&&(this.Z="");}Bo(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let i=()=>{this.Ue();};this.subEntry("fileInfo",s=>{s?.isImage&&i();}),this.subEntry("thumbUrl",s=>{this.sl(s??void 0);}),this.subEntry("cdnUrlModifiers",i),this.Ue(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this._o&&(this.il==="list"&&this.Ue(true),this._o=true);}),this.setAttribute("role","img");}connectedCallback(){super.connectedCallback(),this.i?.disconnect(),this.i=new window.IntersectionObserver(this.Gt.bind(this),{threshold:.1}),this.i.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.$e.cancel(),this.Ni(),this.i?.disconnect();}render(){return html`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Z||ct} alt="" ?hidden=${!this.Z} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};u([property({type:String})],Zt.prototype,"badgeIcon",2),u([property({type:String})],Zt.prototype,"uid",2),u([state()],Zt.prototype,"Z",2);var ar=class extends h{};var lr=class extends h{constructor(){super(...arguments);this.historyTracked=true;this.activityType=h.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return html`<div class="uc-content">${this.yield("")}</div>`}};var cr=class extends E{constructor(){super(...arguments);this.Ko=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=w;}initCallback(){super.initCallback(),this.Ko=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Ko?.();}};var qt=(o,r)=>{let t=false,e,i=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-i>=r&&(o(...n),i=Date.now());},Math.max(r-(Date.now()-i),0))):(o(...n),i=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var et=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=h.activities.UPLOAD_LIST;this.Ho=false;this.jo=false;this.Go=false;this.zi=false;this.Bi=false;this.Re=null;this.Wo=false;this.Ki=null;this.Zo=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.Hi=()=>{this.emit(w.UPLOAD_CLICK),this.api.uploadAll(),this._();};this.ji=()=>{this.emit(w.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.N=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this._=qt(()=>{this.isConnected&&(this.ll(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get nl(){return this.Ki?this.al(this.Ki):""}ll(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(v=>v.isValidationPending).length},i=!t.errors.some(v=>v.type==="TOO_MANY_FILES"||v.type==="TOO_FEW_FILES"),s=t.errors.some(v=>v.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(v=>v.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,p=false;if(e.total-e.succeed-e.uploading-e.failed>0&&i&&l)c=true;else {d=true;let v=this.cfg.groupOutput?!!t.group:true;p=e.total===e.succeed&&i&&l&&v;}this.Ho=d,this.jo=p,this.Go=c,this.Bi=e.total===0||!s&&!n,this.zi=!n||this.cfg.multiple,this.Wo=e.total>0,this.Ki=e;}al(t){let e=i=>{let s=t[i];return i==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${i}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._),this.subConfigValue("multipleMin",this._),this.subConfigValue("multipleMax",this._),this.sub("*groupInfo",t=>{t&&this._();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this._),this.uploadCollection.observeCollection(this._),this.sub("*collectionErrors",t=>{let e=t.filter(i=>i.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Re=null;return}this.Re=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this._),this.uploadCollection.unobserveCollection(this._));}render(){return html`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.nl}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Wo}>${this.yield("empty",html`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${repeat(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>html`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Zo} ?disabled=${!this.Bi} ?hidden=${!this.zi} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Re} >${this.Re??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.N}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.zi} ?disabled=${!this.Bi} @click=${this.Zo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Go} @click=${this.Hi} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Ho} ?disabled=${!this.jo} @click=${this.ji} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};u([state()],et.prototype,"Ho",2),u([state()],et.prototype,"jo",2),u([state()],et.prototype,"Go",2),u([state()],et.prototype,"zi",2),u([state()],et.prototype,"Bi",2),u([state()],et.prototype,"Re",2),u([state()],et.prototype,"Wo",2),u([state()],et.prototype,"Ki",2);var Xe=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.URL;this.Gi={importDisabled:true};this.q=createRef();this.Wi=t=>{let e=t.target?.value??"";this.Gi={importDisabled:!e};};this.Hi=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let i=this.q.value?.value?.trim();i&&(this.api.addFileFromUrl(i,{source:L.URL}),this.modalManager?.open(h.activities.UPLOAD_LIST),this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:()=>{let t=this.q.value;t&&(t.value="",t.focus()),this.Gi={importDisabled:true};}});}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.Hi}><label><input ${ref(this.q)} placeholder="https://" class="uc-url-input" type="text" @input=${this.Wi} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.Gi.importDisabled} >${this.l10n("upload-url")}</button></form>`}};u([state()],Xe.prototype,"Gi",2);var Uo=()=>typeof navigator.permissions<"u";var da={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},pa=["camera","microphone"];function Je(o){let r=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${r}:${t}`}var Ro="image/jpeg",Po="video/webm",I=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.CAMERA;this.Pe=null;this.Zi=false;this.Wt=[];this.R=null;this.P=null;this.De=null;this.Ve=null;this.l=null;this.Zt={};this.D=null;this.t=null;this.kt=[];this.At=[];this.cl={};this.Fe=[];this._e=null;this.qo=()=>{this.Xo(),this.qt="pause";};this.Qo=()=>{this.qt="play",this.ul();};this.Xt=createRef();this.nt=createRef();this.v=createRef();this.Yo=createRef();this.Jo=0;this.ts=0;this.es=null;this.Ne=true;this.ze=true;this.dl=Uo();this.is=[];this.at=true;this.qi="";this.Ot=true;this.lt=true;this.It=true;this.rs=[];this.ct=true;this.Xi=true;this.ut=true;this.z=true;this.dt=true;this.St="camera-full";this.qt="play";this.os="microphone";this.Be="uc-shot-btn uc-camera-action";this.pl=()=>{if(this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.l}}}),this.l===y.PHOTO&&this.hl(),this.l===y.VIDEO){if(this.R?.state==="recording"){this.ss();return}this.ml();}};this.fl=t=>{let e=t.target;e&&(this.Ve=e.value,this.Mt());};this.vl=t=>{let e=t.target;e&&(this.De=e.value,this.Mt());};this.gl=()=>{this.Mt();};this.yl=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.l}}}),this.pl();};this.bl=()=>{this.wl();};this.El=()=>{this.Tl();};this.Cl=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.l}}}),this.xl();};this.kl=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.l}}}),this.Al();};this.ns=t=>{let i=t.currentTarget?.getAttribute("data-id");i&&this.as(i);};this.ls=()=>{let t=Math.floor((performance.now()-this.Jo+this.ts)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Xt.value;s&&(s.textContent=Je(e)),this.ss();return}let i=this.Xt.value;i&&(i.textContent=Je(e));}else {let e=this.Xt.value;e&&(e.textContent=Je(t));}this.Lt=requestAnimationFrame(this.ls);};this.Ol=()=>{this.Jo=performance.now(),this.ts=0,this.ls();};this.cs=()=>{this.Lt&&cancelAnimationFrame(this.Lt);};this.Xo=()=>{let t=this.v.value;if(!t)return;let e=t.currentTime,i=t.duration||1,s=this.nt.value;s&&(s.style.transform=`scaleX(${e/i})`);let n=this.Xt.value;n&&(n.textContent=Je(e)),this.Lt=requestAnimationFrame(this.Xo);};this.ul=()=>{this.Lt&&cancelAnimationFrame(this.Lt);};this.Lt=null;this.ml=()=>{try{this.Wt=[],this.Zt={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Zt.mimeType=t:MediaRecorder.isTypeSupported(Po)?this.Zt.mimeType=Po:this.Zt.mimeType="video/mp4",this.P&&(this.R=new MediaRecorder(this.P,this.Zt),this.R.start(),this.R.addEventListener("dataavailable",e=>{this.Wt.push(e.data);}),this.Ol(),this.classList.add("uc-recording"),this.Qt(Y.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.ss=()=>{this.R?.addEventListener("stop",()=>{this.Il(),this.cs(),this.Qt(Y.STOP);}),this.R?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.l}}});};this.wl=()=>{if(this.R?.state==="recording")return;let t=this.v.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Tl=()=>{this.P?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.os=t.enabled?"microphone":"microphone-mute",this.Xi=!t.enabled;});};this.Il=()=>{try{let t=new Blob(this.Wt,{type:this.R?.mimeType}),e=URL.createObjectURL(t),i=this.v.value;if(!i)return;i.muted=!1,i.volume=1,this.Yt(null),i.src=e,this.Sl(i);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.xl=()=>{if(this.Qt(Y.RETAKE),this.l===y.VIDEO){this.Yt(this.P);let t=this.v.value;t&&(t.muted=true);}this.v.value?.play?.();};this.Al=()=>{if(this.Qt(Y.ACCEPT),this.l===y.PHOTO){this.D?.toBlob(s=>{if(!s)return;let n=this.us("camera","jpeg",Ro,s);this.ds(n);},Ro);return}let t=new Blob(this.Wt,{type:this.R?.mimeType}),e=this.Ml(this.R?.mimeType),i=this.us("video",e,`video/${e}`,t);this.ds(i),this.Wt=[];};this.Ll=t=>{t===Y.SHOT&&(this.dt=true,this.lt=true,this.z=true,this.It=false,this.at=true),(t===Y.RETAKE||t===Y.ACCEPT)&&(this.dt=!this.b.includes(y.VIDEO),this.z=!this.b.includes(y.PHOTO),this.lt=false,this.It=true,this.at=this.kt.length<=1);};this.$l=t=>{t===Y.PLAY&&(this.Ot=false,this.z=true,this.at=true,this.ct=true,this.qt="pause",this.St="square",this.Be="uc-shot-btn uc-camera-action uc-stop-record"),t===Y.STOP&&(this.Ot=false,this.lt=true,this.ut=true,this.It=false),(t===Y.RETAKE||t===Y.ACCEPT)&&(this.Ot=true,this.dt=!this.b.includes(y.VIDEO),this.z=!this.b.includes(y.PHOTO),this.lt=false,this.It=true,this.ut=!this.cfg.enableAudioRecording,this.St="video-camera-full",this.Be="uc-shot-btn uc-camera-action",this.ct=!this.cfg.enableAudioRecording||this.At.length<=1,this.at=this.kt.length<=1);};this.Qt=t=>{this.l===y.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Ll(t),this.l===y.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.$l(t);};this.as=t=>{this.Yo.value?.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===t);}),t===y.PHOTO&&(this.St="camera-full",this.ct=true,this.ut=true),t===y.VIDEO&&(this.qt="play",this.St="video-camera-full",this.ct=!this.cfg.enableAudioRecording||this.At.length<=1,this.ut=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.l=t;};this.us=(t,e,i,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:i})};this.ds=t=>{this.api.addFileFromObject(t,{source:L.CAMERA}),this.set$({"*currentActivity":h.activities.UPLOAD_LIST}),this.modalManager?.open(h.activities.UPLOAD_LIST);};this.Jt=T(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.l===y.VIDEO&&this.cfg.enableAudioRecording,i=this.l===y.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Ne=false,this.lt=false,this.z=!this.b.includes(y.PHOTO),this.dt=!this.b.includes(y.VIDEO),this.ze=true,this.Ot=true,this.St=i,this.ut=!e,this.ct=!e):t==="prompt"?(this.qi="camera-permissions-prompt",this.Ne=true,this.lt=true,this.z=true,this.ze=false,this.Ji()):(this.qi="camera-permissions-denied",this.Ne=true,this.ze=false,this.z=!this.b.includes(y.PHOTO),this.dt=!this.b.includes(y.VIDEO),this.It=true,this.Be="uc-shot-btn uc-camera-action",this.Ji());},300);this.Ul=()=>{if(!this.P)return false;let t=this.P?.getAudioTracks(),e=this.P?.getVideoTracks();return t.forEach(i=>{i.stop();}),e.forEach(i=>{i.stop();}),true};this.Ji=()=>{this.Zi&&(this.v.value&&(this.v.value.volume=0),this._e?.getTracks?.()?.[0]?.stop(),this.Qi(this.v.value),this.Yt(null),this.Ul(),this.cs(),this.Zi=false);};this.Mt=async()=>{let t={video:{...da},audio:this.cfg.enableAudioRecording?{}:false};this.Ve&&(t.video={deviceId:{exact:this.Ve}}),this.De&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.De}}),this.v.value&&(this.v.value.volume=0);try{this.Jt("prompt"),this.P=await navigator.mediaDevices.getUserMedia(t),this.P.addEventListener("inactive",()=>{this.Jt("denied");}),this.Yt(this.P),this.Zi=!0,this.Jt("granted");}catch(e){this.Jt("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.ps=()=>{this.Mt();};this.Rl=async()=>{try{this.Ke();for(let t of pa){let e=await navigator.permissions.query({name:t});this.cl[t]=e,e.addEventListener("change",this.ps),this.Fe.push(()=>{e.removeEventListener("change",this.ps);});}this.Pe=()=>{this.Ke();};}catch(t){this.Ke(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Mt();}};this.Pl=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.tr(),navigator.mediaDevices.addEventListener("devicechange",this.tr);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.tr=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.kt=t.filter(e=>e.kind==="videoinput").map((e,i)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${i+1}`,value:e.deviceId})),this.At=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.is=this.kt,this.at=this.kt.length<=1,this.Ve=this.kt[0]?.value??null,this.rs=this.At,this.ct=!this.cfg.enableAudioRecording||this.At.length<=1,this.De=this.At[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Dl=async()=>{await this.Rl(),await this.Pl(),await this.Mt(),this.hs(this.b);};this.Vl=async()=>{this.Pe&&this.Pe(),window.chrome||this.Jt("denied"),this.Ji();};this.hs=t=>{this.dt=!t.includes(y.VIDEO),this.z=!t.includes(y.PHOTO);let e=t[0];e&&(!this.l||!t.includes(this.l))&&this.as(e);};}Sl(t){this.Qi(t),t.addEventListener("play",this.qo),t.addEventListener("pause",this.Qo);}Qi(t){t?.removeEventListener("play",this.qo),t?.removeEventListener("pause",this.Qo);}Yt(t){this._e!==t&&(this._e=t,this.Yi());}Yi(){let t=this.v.value;if(!t)return;let e=this._e??null;t.srcObject!==e&&(t.srcObject=e);}hl(){if(this.Qt("shot"),this.D=document.createElement("canvas"),this.t=this.D.getContext("2d"),!this.t)throw new Error("Failed to get canvas context");let t=this.v.value;if(!t)throw new Error("Video element not found");this.D.height=t.videoHeight,this.D.width=t.videoWidth,this.cfg.cameraMirror&&(this.t.translate(this.D.width,0),this.t.scale(-1,1)),this.t.drawImage(t,0,0),t.pause();}Ml(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let i=t.split("/");if(i?.[0]==="video"){let n=i.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get b(){return V(this.cfg.cameraModes).filter(t=>t===y.PHOTO||t===y.VIDEO)}Ke(){if(this.Fe.length!==0){for(let t of this.Fe)t();this.Fe=[],this.Pe=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.Dl,onDeactivate:this.Vl}),this.subConfigValue("cameraMirror",t=>{this.es=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ut=!t,this.Xi=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=G(t);this.hs(e.filter(i=>i===y.PHOTO||i===y.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.Yi();}updated(t){super.updated(t),this.Yi();}Fl(){this.Ke(),navigator.mediaDevices?.removeEventListener("devicechange",this.tr),this.Qi(this.v.value),this.Yt(null);}disconnectedCallback(){super.disconnectedCallback(),this.Fl();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.at}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.is} ?hidden=${this.at} @change=${this.fl} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${styleMap({transform:this.es})} ?hidden=${this.Ne} ${ref(this.v)} ></video><div class="uc-message-box" ?hidden=${this.ze}><span>${this.l10n(this.qi)}</span><button type="button" @click=${this.gl} ?hidden=${this.dl} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${ref(this.Yo)} class="uc-switcher" ?hidden=${!this.Ot}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.ns} ?hidden=${this.z} ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.ns} ?hidden=${this.dt} ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.bl} ?hidden=${this.Ot} ><uc-icon name=${this.qt}></uc-icon><span ${ref(this.Xt)}> 00:00 </span><span ${ref(this.nt)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.It} ><button type="button" class="uc-secondary-btn" @click=${this.Cl}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.kl} data-testid="accept" > Accept </button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" @click=${this.yl} class=${this.Be} ?hidden=${this.lt} ><uc-icon name=${this.St}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.El} ?hidden=${this.ut} ><uc-icon name=${this.os}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.rs} ?hidden=${this.ct} ?disabled=${this.Xi} @change=${this.vl} ></uc-select></div></div>`}};u([state()],I.prototype,"es",2),u([state()],I.prototype,"Ne",2),u([state()],I.prototype,"ze",2),u([state()],I.prototype,"dl",2),u([state()],I.prototype,"is",2),u([state()],I.prototype,"at",2),u([state()],I.prototype,"qi",2),u([state()],I.prototype,"Ot",2),u([state()],I.prototype,"lt",2),u([state()],I.prototype,"It",2),u([state()],I.prototype,"rs",2),u([state()],I.prototype,"ct",2),u([state()],I.prototype,"Xi",2),u([state()],I.prototype,"ut",2),u([state()],I.prototype,"z",2),u([state()],I.prototype,"dt",2),u([state()],I.prototype,"St",2),u([state()],I.prototype,"qt",2),u([state()],I.prototype,"os",2),u([state()],I.prototype,"Be",2);function Do(...o){return o.reduce((r,t)=>{if(typeof t=="string")return r[t]=true,r;for(let e of Object.keys(t))r[e]=t[e];return r},{})}function X(...o){let r=Do(...o);return Object.keys(r).reduce((t,e)=>(r[e]&&t.push(e),t),[]).join(" ")}function Vo(o,...r){let t=Do(...r);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var ha=o=>B.includes(o),Fo=o=>{if(!o)return B;let r=G(o).filter(ha);return r.length===0?B:r};function _o(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":B,"*tabId":O.CROP,"*on.retryNetwork":()=>{let r=o.querySelectorAll("img");for(let t of r){let e=t.src;t.src=ct,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":r=>{if(!r)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=z(Tt(r),"preview"),i=D(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:i,transformations:r};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var No="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Bo=ht([...B]),K=class extends g{constructor(){super(...arguments);this.ctxOwner=true;this._l="";this.pt=ct;this.Nl="";this.te=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Bo;this.ms=false;this.H=false;this.er=null;this.He=T(t=>{this.te=t;},300);this.je=createRef();this.fs=createRef();this.vs=createRef();this.gs=createRef();this.ys=()=>{this.He(false),this.pt!==ct&&(this.$["*networkProblems"]=false);};this.bs=()=>{this.He(false),this.$["*networkProblems"]=true;};this.zl=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,..._o(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Bl(){this.H||this.er||(this.er=this.updateComplete.then(()=>{this.er=null,this.H=true;}));}initCallback(){super.initCallback(),this.ws(),this.Es();}Ge(){let t=this.vs.value;t&&(this.$["*faderEl"]=t);let e=this.fs.value;e&&(this.$["*cropperEl"]=e);let i=this.gs.value;i&&(this.$["*imgContainerEl"]=i);let s=this.je.value;s&&(this.$["*imgEl"]=s);}Kl(){let t=this.je.value;t&&(t.addEventListener("load",this.ys),t.addEventListener("error",this.bs));}Hl(){let t=this.je.value;t&&(t.removeEventListener("load",this.ys),t.removeEventListener("error",this.bs));}get jl(){let t=this.$["*tabId"];return X("uc-image",{"uc-image_hidden_to_cropper":t===O.CROP,"uc-image_hidden_effects":t!==O.CROP})}Ts(){return new Promise((e,i)=>{let s=window.setTimeout(()=>{i(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.Ge(),this.Kl(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),i=t.has("uuid")||t.has("cdnUrl");e&&!i&&this.updateImage();}disconnectedCallback(){this.Hl(),super.disconnectedCallback();}render(){let t=this.Nl??"",e=this._l??"",i=this.pt||ct,s=this.te,n=this.ms;return html` ${unsafeSVG(No)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.zl}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${ref(this.gs)}><img src=${i} class=${this.jl} ${ref(this.je)} />${when(this.H,()=>html`<uc-editor-image-cropper ${ref(this.fs)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${ref(this.vs)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${when(this.H,()=>html`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.ws(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.Es();}ws(){let t=this.tabs||Bo;this.$["*tabList"]=Fo(t);}Es(){let t=We(this.cropPreset??""),e=null;if(this.cdnUrl){let i=Pi(this.cdnUrl),s=Di(i);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=ko(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Ts(),this.cdnUrl){let t=this.cdnUrl,e=Ie(t),i=Et(t,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let s=Pi(t),n=Di(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Et(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={};}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(D(t,z("json"))),i=await fetch(e).then(a=>a.json()),{width:s,height:n}=i;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.Bl();}}async initEditor(){try{await this.Ts();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ms=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],i=z(Tt(t),"preview"),s=D(e,i),n={originalUrl:e,cdnUrlModifiers:i,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};u([state()],K.prototype,"_l",2),u([state()],K.prototype,"pt",2),u([state()],K.prototype,"Nl",2),u([state()],K.prototype,"te",2),u([property({type:String,reflect:true})],K.prototype,"uuid",2),u([property({type:String,attribute:"cdn-url",reflect:true})],K.prototype,"cdnUrl",2),u([property({type:String,attribute:"crop-preset",reflect:true})],K.prototype,"cropPreset",2),u([property({type:String,reflect:true})],K.prototype,"tabs",2),u([state()],K.prototype,"ms",2),u([state()],K.prototype,"H",2);var ri=class extends g{constructor(){super(...arguments);this.Ze=false;this.oe=false;this.ks=createRef();this.se=false;this.ne=null;this.Os=t=>{this.Is(),this.ae&&(t.stopPropagation(),t.preventDefault(),this.ae=false);};this.Ss=t=>{if(!this.ae||!this.We||!this.rr)return;t.stopPropagation(),t.preventDefault();let e=this.X;if(!e)return;let{x:i,y:s}=e.getBoundingClientRect(),n=t.x-i,a=t.y-s,l=n-this.We[0],c=a-this.We[1],{direction:d}=this.rr,p=this.tc(d,[l,c]);p&&(this.$["*cropBox"]=p);};this.Ms=t=>{if(!this.B)return;let e=Object.values(this.B).find(i=>{if(!i||this.sr(i.direction))return false;let n=i.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Eo(a,[t.x,t.y])});this.Cs=e,this.Is();};}get X(){return this.ks.value??null}get ae(){return this.oe}set ae(t){this.oe!==t&&(this.oe=t,this.or());}or(){this.ie&&this.ie.setAttribute("class",X({"uc-guides--hidden":this.Ze,"uc-guides--visible":!this.Ze&&this.oe,"uc-guides--semi-hidden":!this.Ze&&!this.oe}));}sr(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=b&&e.width<=b)return true;let i=e.height<=b&&(t.includes("n")||t.includes("s")),s=e.width<=b&&(t.includes("e")||t.includes("w"));return i||s}Gl(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:n}=t,a=this.X;if(!a)return;let l=q("mask",{id:"backdrop-mask"}),c=q("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=q("rect",{x:e,y:i,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let p=q("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});a.appendChild(p),a.appendChild(l),this.ee=l,this.ir=d;}Wl(){this.ee&&(this.ee.style.display="none",window.requestAnimationFrame(()=>{this.ee&&(this.ee.style.display="block");}));}Zl(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:n}=t;this.ir&&Ct(this.ir,{x:e,y:i,width:s,height:n});}ql(){let t=this.$["*cropBox"];if(!(!t||!this.ie||!this.B)){for(let e of Object.values(this.B)){if(!e)continue;let{direction:i,pathNode:s,interactionNode:n,groupNode:a}=e,l=i==="",c=i.length===2,{x:d,y:p,width:f,height:v}=t;if(l)Ct(n,{x:d,y:p,width:f,height:v});else {let k=xt(Math.min(f,v)/82/2,0,1),A=c?vo(t,i,k):go(t,i,k),R=A.center;if(!R)continue;let Pt=Math.max(er*xt(Math.min(f,v)/er/3,0,1),fo);Ct(n,{x:R[0]-Pt,y:R[1]-Pt,width:Pt*2,height:Pt*2}),Ct(s,{d:A.d});}let m=this.sr(i);a.setAttribute("class",X("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}));}Ct(this.ie,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}As(t,e){let i=q("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let s=q("rect",{fill:"transparent"}),n=q("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(n),i.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:i},e===""&&(i.style.cursor="move"),s.addEventListener("pointerdown",this.Xl.bind(this,e));}Ql(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let s=`${["n","","s"][e]}${["w","","e"][i]}`;s!==""&&this.As(t,s);}return this.As(t,""),t}Yl(){let t=q("svg"),e=q("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let s=q("line",{x1:`${ue*i}%`,y1:"0%",x2:`${ue*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let i=1;i<=2;i++){let s=q("line",{x1:"0%",y1:`${ue*i}%`,x2:"100%",y2:`${ue*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Jl(){let t=this.X;if(!t)return;let e=document.createDocumentFragment(),i=this.Yl();e.appendChild(i);let s=this.Ql();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.B=s,this.ie=i,this.or();}Xl(t,e){if(!this.B)return;let i=this.B[t];if(!i||this.sr(t))return;let s=this.$["*cropBox"],n=this.X;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.ae=true,this.rr=i,this.We=[c,d],this.xs={...s};}tc(t,e){let[i,s]=e,n=this.$["*imageBox"],a=this.xs??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=bo({rect:a,delta:[i,s],imageBox:n}):a=wo({rect:a,delta:[i,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Bt(Ht(a),n)}Is(){let t=this.Cs,e=this.X;e&&(e.style.cursor=t?yo(t.direction):"initial");}Ls(t){if(this.re){this.re.setAttribute("href",t);return}let e=this.X;if(!e){this.ne=t;return}this.ne=null;let i=document.createDocumentFragment(),s=q("image",{href:t});s.setAttribute("class","uc-cloud-mask"),i.appendChild(s),e.appendChild(i),this.re=s;}ec(){let t=this.$["*cropBox"];if(!t||!this.re)return;let{x:e,y:i,width:s,height:n}=t;Ct(this.re,{x:e,y:i,height:n,width:s});}nr(){this.se&&(this.Zl(),this.ql(),this.ec());}toggleThumbs(t){if(this.B)for(let e of Object.values(this.B)){if(!e)continue;let{groupNode:i}=e;i.setAttribute("class",X("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Wl(),this.se&&window.requestAnimationFrame(()=>{this.nr();});}),this.sub("*cropBox",t=>{t&&(this.Ze=t.height<=b||t.width<=b,this.or(),this.se&&window.requestAnimationFrame(()=>{this.nr();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Ls(t);}),document.addEventListener("pointermove",this.Ss,true),document.addEventListener("pointerup",this.Os,true);}firstUpdated(t){super.firstUpdated(t),this.ic();}ic(){let t=this.X;if(!(!t||this.se)){if(this.Gl(),this.Jl(),this.se=true,t.addEventListener("pointermove",this.Ms,true),this.ne){let e=this.ne;this.ne=null,this.Ls(e);}this.nr();}}disconnectedCallback(){super.disconnectedCallback(),this.X?.removeEventListener("pointermove",this.Ms,true),document.removeEventListener("pointermove",this.Ss,true),document.removeEventListener("pointerup",this.Os,true);}render(){return html`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${ref(this.ks)}></svg>`}};u([state()],ri.prototype,"oe",2);var H=class extends g{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}$s(){let t=this.buttonClasses;for(let[e,i]of Object.entries(t))this.classList.toggle(e,i);}onClick(t){}connectedCallback(){super.connectedCallback(),this.$s();}updated(t){super.updated(t),t.has("active")&&this.$s();}render(){let t=this.onClick,e=this.title;return html`<button role="option" type="button" aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};u([state()],H.prototype,"active",2),u([state()],H.prototype,"title",2),u([state()],H.prototype,"icon",2),u([state()],H.prototype,"titleProp",2);var si=12,ni=16,Ta=o=>{let r=12,t=12;return o.width/o.height>=1?(r=si,t=Math.round(si*o.height/o.width)):(t=si,r=Math.round(si*o.width/o.height)),{width:r,height:t}},pr=class extends H{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",r=>{let t=this.rc(r);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}rc(r){return r?r.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${r.width}:${r.height}`}):""}render(){let r=this.onClick,t=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${r} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},li=class extends H{constructor(){super(...arguments);this.T=null;}get aspectRatio(){return this.T}set aspectRatio(t){if(this.T===t)return;let e=this.T;this.T=t,this.requestUpdate("aspectRatio",e),t?this.Us(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.T&&this.Us(this.T),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.T?.id||t?.width===this.T?.width&&t?.height===this.T?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.T?.id&&(this.$["*currentAspectRatio"]=this.T);}Us(t){let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let i=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};i(),s(),e||this.requestUpdate();}oc(){let t=this.T;if(!t||t.hasFreeform)return html`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:i}=Ta(t),s=(ni-e)/2,n=(ni-i)/2;return html`<uc-icon><svg viewBox="0 0 ${ni} ${ni}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${i} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} >${this.oc()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};u([property({attribute:false})],li.prototype,"aspectRatio",1);function xa(o){let r=o+90;return r=r>=360?0:r,r}function ka(o,r){if(o==="rotate")return xa(typeof r=="number"?r:0);if(o==="mirror"||o==="flip")return !r;throw new Error(`Unsupported operation: ${o}`)}var ui=class extends H{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],i=e.getValue(this.operation),s=ka(this.operation,i);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:i}),e.setValue(this.operation,s);}};u([property({type:String})],ui.prototype,"operation",2);var ut="original",di=class extends g{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Wi=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.sc();let i=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];i&&s&&i.activate({url:s,operation:this.state.operation,value:this.state.filter===ut?void 0:this.state.value,filter:this.state.filter===ut?void 0:this.state.filter,fromViewer:false});}sc(){let t=this.state.operation,{range:e,zero:i}=tt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:i};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),p=l;if(p){let{name:f,amount:v}=p;d=f===this.state.filter?v:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:i;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===ut?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return html`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.Wi} ></uc-slider-ui>`}};u([state()],di.prototype,"state",2);function Qt(o){if(!o)return null;let r=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!r)return null;let[,t,e]=r;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var At=class extends H{constructor(){super(...arguments);this.r="";this.s="";this.le="";this.qe=0;this.o=null;this.Ut=false;this.isOriginal=false;this.Rs=20;}get filter(){return this.s}set filter(t){let e=t??"";if(this.s===e)return;let i=this.s;this.s=e,this.r="filter",this.isOriginal=e===ut,this.icon=this.isOriginal?"original":"slider",this.Rs=this.isOriginal?40:20,this.requestUpdate("filter",i),this.Ps(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.r,this.s),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.r,this.s),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Qt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.s;}nc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Rs||32,i=window.devicePixelRatio,s=Math.ceil(i*e),n=i>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.r]=this.s!==ut?{name:this.s,amount:a}:void 0,D(this.le,z(Se,Tt(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${ot}/${st}/uc-cloud-image-editor/`))}async Gt(t,e){t[0]?.isIntersecting?await this.ar(e):this.c?.();}initCallback(){super.initCallback(),"IntersectionObserver"in window&&(this.i=new window.IntersectionObserver(this.Gt.bind(this),{threshold:[0,1]}));let t=this.$["*originalUrl"];this.le=t??"",this.sub("*originalUrl",e=>{this.le=e??"",!this.isOriginal&&this.le&&this.isConnected&&!this.o&&(this.i?.observe(this),this.ht());}),this.isOriginal||(this.i?.observe(this),this.ht()),this.s&&this.Ps(this.s),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.s);}),this.sub("*networkProblems",async e=>{e||(this.o?await this.ar():this.ht());});}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),this.c?.(),this.Xe();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.i?.unobserve(this):(this.i?.observe(this),this.ht()));}Ps(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async ar(t){if(!this.isConnected){t?.unobserve(this),this.c?.(),this.c=void 0;return}if(!this.le){!this.$t&&!this.Q&&this.ht();return}let e=++this.qe,i="";try{i=await this.proxyUrl(this.nc());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ut=false,this.c?.();let{promise:s,cancel:n}=Lt(i);this.c=()=>{n(),this.qe===e&&(this.c=void 0);};try{if(await s,this.qe!==e||!this.isConnected)return;this.o=i,this.Ut=!0,this.Xe(),(t??this.i)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.ht();}finally{this.qe===e&&(this.c=void 0);}}ht(){if(!this.isConnected||this.o||this.Ut||this.isOriginal||this.$["*networkProblems"]){this.Xe();return}this.Q&&cancelAnimationFrame(this.Q),this.Q=requestAnimationFrame(()=>{if(this.Q=void 0,!this.isConnected||this.o||this.Ut||this.isOriginal){this.Xe();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<i){this.ar();return}this.$t=window.setTimeout(()=>{this.$t=void 0,this.ht();},500);});}Xe(){this.Q&&(cancelAnimationFrame(this.Q),this.Q=void 0),this.$t&&(window.clearTimeout(this.$t),this.$t=void 0);}get Ds(){return !!(this.Ut&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ds?"1":"0"};this.o&&(e.backgroundImage=`url(${this.o})`);let i={opacity:this.Ds?"0":"1"};return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} ><div class="uc-preview" ?loaded=${this.Ut} style=${styleMap(e)}></div><uc-icon class=${classMap({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${styleMap(i)} ></uc-icon></button>`}};u([state()],At.prototype,"o",2),u([state()],At.prototype,"Ut",2),u([state()],At.prototype,"isOriginal",2),u([state()],At.prototype,"Rs",2),u([property({type:String})],At.prototype,"filter",1);function Zo(o,r){let t={};for(let e of r){let i=o[e];(Object.hasOwn(o,e)||i!==void 0)&&(t[e]=i);}return t}function Yt(o,r,t){let i=window.devicePixelRatio,s=Math.min(Math.ceil(r*i),3e3),n=i>=2?"lightest":"normal";return D(o,z(Se,Tt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${ot}/${st}/uc-cloud-image-editor/`))}function $a(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(i=>Number.isInteger(i)&&Number.isFinite(i)),({dimensions:t,coords:e})=>t.every(i=>i>0)&&e.every(i=>i>=0)].every(t=>t(o)):true}var hi=class extends g{constructor(){super();this.ctxOwner=true;this.mt={width:0,height:0};this.t=null;this.m=false;this.I=null;this.Fs=createRef();this.cr=createRef();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Vs=T(this._s.bind(this),300),this.lr=qt(()=>{!this.isConnected||!this.m||(this.ur(),this.Ns(),this.zs(),this.dr(),this.pr());},100);}firstUpdated(t){super.firstUpdated(t),this.ur();}Ns(){let t=this.$["*editorTransformations"],e=Zo(t,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...e};this.$["*operations"]=i;}ur(){let t=this.Fs.value;if(!t)return;let e=t.getContext("2d"),i=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${i}px`,t.style.height=`${s}px`,t.width=i*n,t.height=s*n,e?.scale(n,n),this.D=t,this.t=e;}zs(){if(!this.m||!this.I)return;let t=this.I,e=this.$["*padding"],i=this.$["*operations"],{rotate:s}=i,n={width:this.offsetWidth,height:this.offsetHeight},a=Kt({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let p=n.width-e*2,f=p/c,v=0+e,m=e+(n.height-e*2)/2-f/2;l={x:v,y:m,width:p,height:f};}else {let p=n.height-e*2,f=p*c,v=e+(n.width-e*2)/2-f/2,m=0+e;l={x:v,y:m,width:f,height:p};}}else {let{width:c,height:d}=a,p=e+(n.width-e*2)/2-c/2,f=e+(n.height-e*2)/2-d/2;l={x:p,y:f,width:c,height:d};}this.$["*imageBox"]=Ht(l);}dr(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[f,v],coords:[m,k]}=n,{width:A}=Kt(this.mt,s),R=a/A;t=Bt(Ht({x:l+m*R,y:c+k*R,width:f*R,height:v*R}),e);}let d=this.$["*currentAspectRatio"],p=d?d.width/d.height:void 0;if(!To(t,e)||p&&!Co(t,p)){let f=e.width/e.height,v=e.width,m=e.height;p&&(f>p?v=Math.min(e.height*p,e.width):m=Math.min(e.width/p,e.height)),t={x:e.x+e.width/2-v/2,y:e.y+e.height/2-m/2,width:v,height:m};}this.$["*cropBox"]=Bt(Ht(t),e);}ac(){let t=this.t;if(!t)return;let e=this.I;if(!e)return;let i=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Kt({width:i.width,height:i.height},l);t.save(),t.translate(i.x+i.width/2,i.y+i.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}pr(){if(!this.m||!this.I||!this.D||!this.t)return;let t=this.D;this.t.clearRect(0,0,t.width,t.height),this.ac();}lc({fromViewer:t}){this.I&&(this.cr.value?.toggleThumbs(true),this.cc(),setTimeout(()=>{this.className=X({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Bs(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a}=e,{width:l,height:c}=Kt(this.mt,s),{width:d,height:p}=t,f=n/l,v=a/c;return [xt(Math.round(d/f),1,l),xt(Math.round(p/v),1,c)]}uc(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a,x:l,y:c}=e,{width:d,height:p}=Kt(this.mt,s),{x:f,y:v}=t,m=n/d,k=a/p,A=this.Bs(),R={dimensions:A,coords:[xt(Math.round((f-l)/m),0,d-A[0]),xt(Math.round((v-c)/k),0,p-A[1])]};if(!$a(R)){console.error("Cropper is trying to create invalid crop object",{payload:R});return}if(!(A[0]===d&&A[1]===p))return R}_s(){if(!this.isConnected||!this.mt)return;let t=this.$["*operations"],{rotate:e,mirror:i,flip:s}=t,n=this.uc(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:i,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.m&&(this.zs(),this.dr(),this.pr());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.m){this.m=true,await this.updateComplete,this.ur(),this.mt=t,this.removeEventListener("transitionend",this.Ks);try{let i=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.I=await this.dc(i,s),this.Ns(),this.lr(),this.lc({fromViewer:e});}catch(i){console.error("Failed to activate cropper",{error:i}),this.telemetryManager.sendEventError(i,"cloud editor image. Failed to activate cropper");}this.i=new ResizeObserver(i=>{let[s]=i;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.m&&this.I&&this.lr();}),this.i.observe(this);}}deactivate({reset:t=false}={}){this.m&&(!t&&this._s(),this.m=false,this.pc(),this.className=X({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.cr.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Ks,{once:true}),this.i?.disconnect());}pc(){let t=this.Bs(),e=this.$["*cropBox"],i=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(i,s),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}cc(){let t=this.$["*cropBox"],e=t.x+t.width/2,i=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`;}Ks(){this.m||(this.I=null);}async dc(t,e){let i=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Yt(t,i,e)),{promise:n,cancel:a,image:l}=Lt(s),c=this.Rt(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.c?.(),this.c=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Rt(t){let e="crop",i=this.$["*loadingOperations"],s=i.get(e);return s||(s=new Map,i.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=i);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.pr();}),this.sub("*cropBox",()=>{this.I&&this.Vs();}),this.sub("*currentAspectRatio",()=>{this.dr();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.m&&this.mt&&this.activate(this.mt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),this.I&&(this.I=null);}render(){return html`<canvas class="uc-canvas" ${ref(this.Fs)}></canvas><uc-crop-frame ${ref(this.cr)}></uc-crop-frame>`}};u([state()],hi.prototype,"I",2);function hr(o,r,t){let e=t,i=t-1,s=new Array(e);for(let n=i;n>=0;n-=1)s[n]=Math.ceil((n*r+(i-n)*o)/i);return s}function Ra(o){return typeof o=="string"&&o in tt}function Pa(o){let r=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],i=o[t+1];typeof e=="number"&&typeof i=="number"&&r.push([e,i]);}return r}function Da(o,r,t){let e=Pa(o).find(([n,a])=>n<=r&&r<=a);if(!e)return o.map(()=>0);let[i,s]=e;return o.map(n=>{let a=Math.abs(i-s)||1,l=Math.abs(r-i)/a;return i===n?r>t?1:1-l:s===n?r>=t?l:1:0})}function Va(o,r){return o.map((t,e)=>t<r?o.length-e:e)}function Jo(o,r){let t=tt[o].keypointsNumber,{range:e,zero:i}=tt[o];return [...new Set([...hr(e[0],i,t+1),...hr(i,e[1],t+1),i,r])].sort((s,n)=>s-n)}var mr=class extends g{constructor(){super();this.m=false;this.hr=true;this.r="initial";this.Hs={};this.Y=[];this.Gs=0;this.Zs=createRef();this.Qe=createRef();this.classList.add("uc-inactive_to_cropper"),this.Ws=T(async(t,e,i)=>{let s=()=>!this.qs(t,e)||this.Ct!==i||!!this.Y.find(c=>c.value===i);if(s())return;let n=await this.Xs(t,i),a=new Image;a.src=n.src;let l=this.Rt(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Y,d=c.findIndex(m=>m.value>i);d===-1&&(d=c.length);let f=c[d]?.image,v=this.Qe.value;!v||f&&!v.contains(f)||(c.splice(d,0,n),f?v.insertBefore(a,f):v.appendChild(a),this.vr(t,i));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Rt(t){let e=this.r,i=this.$["*loadingOperations"];i.has(e)||i.set(e,new Map);let s=i.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=i);}}Qs(){window.cancelAnimationFrame(this.Gs),this.Gs=window.requestAnimationFrame(()=>{for(let t of this.Y){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}pt({url:t=this.js,filter:e=this.s??void 0,operation:i,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.Hs};i&&(i==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[i]=s));let a=this.offsetWidth;return this.proxyUrl(Yt(t,a,n))}async Xs(t,e){return {src:await this.pt({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}qs(t,e){return this.r===t&&this.s===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Ra(this.r)||!Number.isFinite(e)||(this.vr(this.r,e),this.Ws(this.r,this.s,e));}vr(t,e){this.r=t,this.Ct=e;let{zero:i}=tt[t],s=this.Y.map(l=>l.value),n=Da(s,e,i),a=Va(s,i);this.Y.forEach((l,c)=>{let d=n[c],p=a[c];typeof d=="number"&&(l.opacity=d),typeof p=="number"&&(l.zIndex=p);}),this.Qs();}Ys(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async hc(){this.o=this.o||this.Ys();let t=this.o;t&&this.Js(t);let e=this.Y.map(c=>c.src),{images:i,promise:s,cancel:n}=me(e);i.forEach(c=>{let d=this.Rt(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.mr=()=>{n(),this.mr=void 0;};let a=this.r,l=this.s;if(await s,this.m&&this.qs(a,l)){let c=this.Qe.value;if(!c)return;c.replaceChildren(),this.Y.forEach((d,p)=>{let f=i[p];f&&(f.classList.add("uc-fader-image"),d.image=f,c.appendChild(f));}),this.Qs();}}async setTransformations(t){if(this.Hs=t,this.o){let e=await this.pt(),i=this.Rt(e);this.o.src=e,this.o.addEventListener("load",i,{once:true}),this.o.addEventListener("error",i,{once:true}),this.o.style.opacity="1",this.o.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:i,value:s}){if(!i||typeof s!="number")return;this.fr?.();let n=Jo(i,s),a=await Promise.all(n.map(c=>this.pt({url:t,filter:e,operation:i,value:c}))),{cancel:l}=me(a);this.fr=l;}mc(t){let e=this.o||this.Ys();if(this.Js(e),this.o=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=X({"uc-active_from_viewer":this.ce,"uc-active_from_cropper":!this.ce,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let i=this.Rt(t);e.addEventListener("error",i,{once:true}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=X({"uc-active_from_viewer":this.ce,"uc-active_from_cropper":!this.ce,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:i,filter:s,fromViewer:n}){if(this.m=true,this.hr=false,await this.updateComplete,this.js=t,this.r=e??"initial",this.Ct=i,this.s=s,this.ce=n,typeof i!="number"&&!s){let l=await this.pt({operation:e,value:i});this.mc(l),this.gr();return}!e||typeof i!="number"||(this.Y=await Promise.all(Jo(e,i).map(l=>this.Xs(e,l))),this.vr(e,i),this.hc());}deactivate({hide:t=true}={}){this.m=false,this.mr?.(),this.fr?.(),t&&!this.hr?(this.hr=true,this.o&&(this.o.style.transform="scale(1)"),this.className=X({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.gr();},{once:true})):this.gr();}Js(t){let e=this.Zs.value;e&&(e.contains(t)||e.appendChild(t));}gr(){this.Qe.value?.replaceChildren();}render(){return html`<div class="uc-fader-preview-host" ${ref(this.Zs)}></div><div class="uc-fader-layers-host" ${ref(this.Qe)}></div>`}};var mi=class extends H{constructor(){super(...arguments);this.r="";}get operation(){return this.r}set operation(t){let e=t??"";if(this.r===e)return;let i=this.r;this.r=e,this.requestUpdate("operation",i),e&&this.tn(e);}tn(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},i=()=>{let s=this.l10n(t);return this.title=s,s};e(),i();}initCallback(){super.initCallback(),this.r&&this.tn(this.r),this.sub("*editorTransformations",t=>{if(!this.r)return;let{zero:e}=tt[this.r],i=t[this.r],s=typeof i<"u"?i!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.r),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.r,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Qt(this.$["*operationTooltip"])});}};u([property({type:String})],mi.prototype,"operation",1);var _a=1,ts=()=>{},fr=class extends g{constructor(){super(...arguments);this.en=t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;if(Math.abs(i)>_a){this.scrollLeft+=i;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.en,{passive:false}),this.addEventListener("scroll",ts,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.en),this.removeEventListener("scroll",ts),super.disconnectedCallback();}};var Q=class extends g{constructor(){super(...arguments);this.te=false;this.showMainToolbar=true;this.showSubToolbar=false;this.rn=true;this.tabList=[...B];this.activeTab=O.CROP;this.Ye=true;this.yr=false;this.sn=null;this.nn=0;this.an=0;this.Je=createRef();this.ln=createRef();this.tabToggleRefs={[O.CROP]:createRef(),[O.TUNING]:createRef(),[O.FILTERS]:createRef()};this.cn=()=>{this.ft();};this.ue=[];this.He=T(t=>{this.te=t;},500);this.ti=T(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],i="",s=false;if(this.$["*tabId"]===O.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;i=`${this.$["*currentFilter"]} ${n}`;}else i=this.l10n(ut);else if(this.showSubToolbar&&this.$["*tabId"]===O.TUNING&&e){s=true;let n=t?.[e]||tt[e].zero;i=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=i),this.yr=s;},0);this.fc={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.vc={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.gc={hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"};this.yc={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.bc={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":ut,"*currentOperation":null,"*operationTooltip":null};this.N=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.c?.();let e=this.$["*on.cancel"];e?.();};this.Tr=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Mc=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Qt(this.$["*operationTooltip"])}),this.Je.value?.apply(),this.un();};this.Lc=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Je.value?.cancel(),this.un();};this.$c=t=>{let i=t.currentTarget?.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(t,i),this.br(i,{fromViewer:false}));};}un(){this.$["*showSlider"]=false,this.$["*tabId"]===O.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===O.TUNING&&(this.yr=false);}br(t,{fromViewer:e=false,force:i=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.dn(t,{fromViewer:e,force:i});}dn(t,{fromViewer:e,force:i=false}){if(!i&&this.activeTab===t){this.ft();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===O.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of B){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ft();}}ft(){let e=this.tabToggleRefs[this.activeTab]?.value,i=this.ln.value;if(!e||!i)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.nn!==s||this.an!==n)&&(this.nn=s,this.an=n,i.style.transform=`translateX(${s}px)`,i.style.width=`${n}px`);}get wr(){return this.ue.length>=3}wc(t){switch(t){case O.CROP:return this.Ec();case O.FILTERS:return this.Tc();case O.TUNING:return this.Cc();default:return []}}Ec(){let t=[];if(this.wr)t.push(()=>this.xc());else for(let e of this.ue)t.push(()=>this.pn(e));for(let e of jr)t.push(()=>this.kc(e));return this.Er(t)}Tc(){let e=[ut,...Hr].map(i=>()=>this.Ac(i));return this.Er(e)}Cc(){let t=Kr.map(e=>()=>this.Oc(e));return this.Er(t)}Er(t){return t.length?t.map(i=>i()):[]}xc(){return html`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}pn(t){return html`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}kc(t){return html`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Ac(t){return html`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Oc(t){return html`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Ic(){return this.wr?this.ue.map(t=>this.pn(t)):[]}async Sc(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Yt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.c?.();let{cancel:i}=me([e]);this.c=()=>{i(),this.c=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.ue=[...t],this.sub("*cropPresetList",e=>{this.ue=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.br(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let i=e?.filter?.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i??"");}),this.sub("*currentFilter",()=>{this.ti();}),this.sub("*currentOperation",()=>{this.ti();}),this.sub("*tabId",e=>{this.dn(e,{fromViewer:false,force:true}),this.ti();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Sc(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let i=false;for(let[,s]of e.entries()){if(i)break;for(let[,n]of s.entries())if(n){i=true;break}}this.He(i);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ye=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ye=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.rn=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[i]=e;i&&this.br(i,{fromViewer:false});return}this.ft();}),this.sub("*operationTooltip",e=>{this.sn=e;}),this.ti();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.cn);}firstUpdated(t){super.firstUpdated(t),this.Ge(),this.ft();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ft()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ge();}disconnectedCallback(){window.removeEventListener("resize",this.cn),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ge(){let t=this.Je.value;t&&(this.$["*sliderEl"]=t);}Uc(t){let e=this.tabList.includes(t),i=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?styleMap({gridColumn:`${s+1}`}):nothing;return html`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.yc}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${i?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${i} style=${n} @click=${this.$c} ${ref(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Rc(t){let e=this.activeTab===t,i=this.wc(t);return html`<uc-presence-toggle id=${`tab_${t}`} class="uc-tab-content" .visible=${e} .styles=${this.gc} ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${i.length?i:nothing}</div></div></uc-editor-scroller></uc-presence-toggle>`}render(){let t=["uc-info-tooltip",this.yr?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.wr;return html`<uc-line-loader-ui .active=${this.te}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.sn??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.fc} ><div class="uc-tab-content-row">${B.map(i=>this.Rc(i))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.rn} .styles=${this.bc} @initial-render=${()=>this.ft()} ><div class="uc-tab-toggles_indicator" ${ref(this.ln)} ></div>${B.map(i=>this.Uc(i))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.N} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Tr}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.vc}><div class="uc-slider" ?hidden=${!this.Ye}><uc-editor-slider ${ref(this.Je)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ye||!e}>${e?html`<div class="uc-list-aspect-ratio">${this.Ic()}</div>`:nothing}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Lc} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Mc} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};u([state()],Q.prototype,"te",2),u([state()],Q.prototype,"showMainToolbar",2),u([state()],Q.prototype,"showSubToolbar",2),u([state()],Q.prototype,"rn",2),u([state()],Q.prototype,"tabList",2),u([state()],Q.prototype,"activeTab",2),u([state()],Q.prototype,"Ye",2),u([state()],Q.prototype,"yr",2),u([state()],Q.prototype,"sn",2),u([state()],Q.prototype,"ue",2);var it=class extends g{constructor(){super(...arguments);this.text="";this.icon="";this.active=false;this.reverse=false;this.theme="default";this.ariaRole="";this.ariaControls="";this.titleProp="";}firstUpdated(t){super.firstUpdated(t),this.hn(),this.mn();}updated(t){super.updated(t),t.has("reverse")&&this.hn(),t.has("theme")&&this.mn();}hn(){this.style.flexDirection=this.reverse?"row-reverse":"";}mn(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Pc(){let t=this.Cr;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Dc}}get Cr(){return !this.icon}get Dc(){return !this.text&&!this.Cr}render(){return html`<button type="button" role=${ifDefined(this.ariaRole||void 0)} aria-controls=${ifDefined(this.ariaControls||void 0)} aria-label=${ifDefined(this.l10n(this.titleProp))} title=${ifDefined(this.l10n(this.titleProp))} ><uc-icon class=${classMap(this.Pc)} name=${ifDefined(this.icon||void 0)} ?hidden=${this.Cr} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};u([property({type:String})],it.prototype,"text",2),u([property({type:String})],it.prototype,"icon",2),u([property({type:Boolean,reflect:true})],it.prototype,"active",2),u([property({type:Boolean,reflect:true})],it.prototype,"reverse",2),u([property({type:String,reflect:true})],it.prototype,"theme",2),u([property({attribute:"aria-role"})],it.prototype,"ariaRole",2),u([property({attribute:"aria-controls"})],it.prototype,"ariaControls",2),u([property({attribute:"title-prop"})],it.prototype,"titleProp",2);var fi=class extends g{constructor(){super(...arguments);this.active=false;this.nt=createRef();this.xr=false;this.kr=()=>{let t=this.nt.value;t&&(this.vn(t),this.xr&&this.active&&this.Ar());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Ar();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Ar():this.Vc());}Ar(){let t=this.nt.value;if(!t)return;this.xr=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.kr),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.kr,{once:true});}Vc(){let t=this.nt.value;t&&(this.xr=false,t.removeEventListener("transitionend",this.kr),this.vn(t));}vn(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return html`<div class="uc-inner"><div class="uc-line" ${ref(this.nt)}></div></div>`}};u([property({type:Boolean,reflect:true})],fi.prototype,"active",2);var Ut={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ge=class extends g{constructor(){super(...arguments);this.U=false;this.gn=Ut;this.yn=Ut.visible;this.bn=Ut.hidden;this.Or=false;this.wn=false;}set visible(t){this.U=t,this.En();}get visible(){return this.U}set styles(t){this.gn=t,this.Or=true,this.yn=t.visible??Ut.visible,this.bn=t.hidden??Ut.hidden;}get styles(){return this.gn}En(){this.style.visibility=this.U?"inherit":"hidden",Vo(this,{[Ut.transition]:!this.Or,[this.yn]:this.U,[this.bn]:!this.U}),this.toggleAttribute("inert",!this.U);}Fc(){this.wn||(this.wn=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Or||this.classList.add(Ut.transition),this.En(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Fc();},0);}};u([property({type:Boolean})],ge.prototype,"visible",1),u([property({attribute:false})],ge.prototype,"styles",1);var gt=class extends g{constructor(){super();this.Ir=0;this.q=createRef();this.Cn=createRef();this.xn=createRef();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.J=0;this._c=t=>{t.stopPropagation();let e=this.An(t);e!==null&&(this.Sr(e),this.kn("slider-input",e));};this.Nc=t=>{t.stopPropagation();let e=this.An(t);e!==null&&(this.Sr(e),this.kn("slider-change",e));};this.On=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.In=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}kn(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Ir=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Sn(this.J),this.Mr(),this.i=new ResizeObserver(()=>{this.Mr(),this.ei(this.J);}),this.i.observe(this);let e=this.q.value;e?.addEventListener("focus",this.On),e?.addEventListener("blur",this.In),window.setTimeout(()=>{this.ei(this.J);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.J&&this.Sr(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Mr(),this.ei(this.J)),t.has("zero")&&this.hasUpdated&&this.Mn(this.J);}ei(t){this.Mn(t);let e=this.max-this.min;if(e===0)return;let{width:i}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(i-this.Ir)/100;window.requestAnimationFrame(()=>{let l=this.Cn.value;l&&(l.style.transform=`translateX(${a}px)`);});}Mn(t){if(!this.de)return;let e=this.max-this.min;if(e===0)return;this.de.style.opacity=t===this.zero?"0":"1";let{width:i}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(i-this.Ir)/100;window.requestAnimationFrame(()=>{this.de&&(this.de.style.transform=`translateX(${a}px)`);});}Mr(){let e=this.xn.value;if(!e)return;let{width:i}=e.getBoundingClientRect(),s=Math.ceil(i/2),n=Math.ceil(s/15)-2;if(this.Tn===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.de=d,e.innerHTML="",e.appendChild(a),this.Tn=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.q.value;t?.removeEventListener("focus",this.On),t?.removeEventListener("blur",this.In),this.i?.disconnect(),this.i=void 0;}Sr(t){Number.isFinite(t)&&(this.J=t,this.hasUpdated&&(this.Sn(t),this.ei(t)));}Sn(t){let e=this.q.value;e&&(e.value=String(t));}An(t){let e=t.currentTarget;if(!e)return null;let i=Number.parseInt(e.value,10);return Number.isFinite(i)?i:null}render(){return html`<div class="uc-steps" ${ref(this.xn)}></div><div class="uc-thumb" ${ref(this.Cn)}></div><input class="uc-input" type="range" ${ref(this.q)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.J)} ?disabled=${this.disabled} @input=${this._c} @change=${this.Nc} />`}};u([property({type:Boolean,reflect:true})],gt.prototype,"disabled",2),u([property({type:Number})],gt.prototype,"min",2),u([property({type:Number})],gt.prototype,"max",2),u([property({type:Number,attribute:false})],gt.prototype,"defaultValue",2),u([property({type:Number})],gt.prototype,"zero",2),u([state()],gt.prototype,"J",2);var vi=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.CLOUD_IMG_EDIT;this.C=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.zc(),onDeactivate:()=>this.Bc()}),this.subConfigValue("cropPreset",t=>{if(!this.C)return;let e=t||void 0;this.C.cropPreset!==e&&(this.C={...this.C,cropPreset:e});}),this.subConfigValue("cloudImageEditorTabs",t=>{if(!this.C)return;let e=t||void 0;this.C.tabs!==e&&(this.C={...this.C,tabs:e});});}Tr(t){if(!this.pe)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.pe.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(h.activities.CLOUD_IMG_EDIT),this.historyBack();}N(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(h.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}zc(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.pe=e;let i=this.pe.getValue("cdnUrl");if(!i)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.C=this.Kc(i);}Bc(){this.pe=void 0,this.C=null;}render(){if(!this.C)return nothing;let{cdnUrl:t,cropPreset:e,tabs:i}=this.C;return html`<uc-cloud-image-editor cdn-url=${t} crop-preset=${ifDefined(e)} tabs=${ifDefined(i)} @apply=${this.Tr} @cancel=${this.N} @change=${this.handleChange} ></uc-cloud-image-editor>`}Kc(t){let e={cdnUrl:t},i=this.cfg.cropPreset;i&&(e.cropPreset=i);let s=this.cfg.cloudImageEditorTabs;return s&&(e.tabs=s),e}};u([state()],vi.prototype,"C",2);var Ya=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],rs=T(o=>{for(let{test:r,message:t}of Ya)r(o)&&He(t);},0);var os=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var wr=o=>o,el=[wr({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:o,enableVideoRecording:r})=>{if(r===null)return o;let t=G(o);return r&&!t.includes("video")?t=t.concat("video"):r||(t=t.filter(e=>e!=="video")),ht(t)}}),wr({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:o,defaultCameraMode:r})=>{if(r===null)return o;let t=G(o);return t=t.sort((e,i)=>e===r?-1:i===r?1:0),ht(t)}}),wr({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:r,cdnCnamePrefixed:t})=>o&&(r===re||isPrefixedCdnBase(r,t))?getPrefixedCdnBaseAsync(o,t):r})],ss=({key:o,setValue:r,getValue:t,computationControllers:e})=>{for(let i of el)if(i.deps.includes(o)){let s={[i.key]:t(i.key)};for(let l of i.deps)s[l]=t(l);let n=new AbortController;e.get(i.key)?.abort(),e.set(i.key,n);let a;try{a=i.fn(s,{signal:n.signal});}catch(l){e.get(i.key)===n&&e.delete(i.key),console.error(`Failed to compute value for "${i.key}"`,l);return}os(a)?a.then(l=>{n.signal.aborted||r(i.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${i.key}"`,l);}).finally(()=>{e.get(i.key)===n&&e.delete(i.key);}):r(i.key,a);}};var x=o=>String(o),N=o=>{let r=Number(o);if(Number.isNaN(r))throw new Error(`Invalid number: "${o}"`);return r},S=o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},ns=o=>o==="auto"?o:S(o),as=o=>{let r=x(o);if(r!=="user"&&r!=="environment"&&r!=="")throw new Error(`Invalid value: "${r}"`);return r},ls=o=>{let r=x(o);if(!Object.values(y).includes(r))throw new Error(`Invalid value: "${r}"`);return r},cs=o=>{let r=x(o),t=G(r);if(t.some(e=>!Object.values(y).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return r},us=o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},Er=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},gi=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},Tr=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},ds=o=>{let r=x(o);if(["grid","list"].includes(r))return r;throw new Error(`Invalid value: "${r}"`)};var il={pubkey:x,multiple:S,multipleMin:N,multipleMax:N,confirmUpload:S,imgOnly:S,accept:x,externalSourcesPreferredTypes:x,externalSourcesEmbedCss:x,store:ns,cameraMirror:S,cameraCapture:as,sourceList:x,topLevelOrigin:x,maxLocalFileSizeBytes:N,thumbSize:N,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:x,removeCopyright:S,cropPreset:x,imageShrink:x,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:x,cdnCname:x,cdnCnamePrefixed:x,baseUrl:x,socialBaseUrl:x,secureSignature:x,secureExpire:x,secureDeliveryProxy:x,retryThrottledRequestMaxTimes:N,retryNetworkErrorMaxTimes:N,multipartMinFileSize:N,multipartChunkSize:N,maxConcurrentRequests:N,multipartMaxConcurrentRequests:N,multipartMaxAttempts:N,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:x,debug:S,localeName:x,metadata:us,secureUploadsExpireThreshold:N,localeDefinitionOverride:o=>Er(o),secureUploadsSignatureResolver:o=>gi(o),secureDeliveryProxyUrlResolver:o=>gi(o),iconHrefResolver:o=>gi(o),fileValidators:Tr,collectionValidators:Tr,validationTimeout:N,validationConcurrency:N,cameraModes:cs,defaultCameraMode:ls,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:Er,maxVideoRecordingDuration:N,filesViewMode:ds,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:x,testMode:S,qualityInsights:S},ps=(o,r)=>{if(!(typeof r>"u"||r===null))try{return il[o](r)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),W[o]}};var yi=[...new Set(["debug",...Object.keys(W)])],rl=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],fs=o=>rl.includes(o),be=yi.filter(o=>!fs(o)),hs={...Object.fromEntries(be.map(o=>[ee(o),o])),...Object.fromEntries(be.map(o=>[o.toLowerCase(),o]))},ol={...Object.fromEntries(be.map(o=>[ee(o),_(o)])),...Object.fromEntries(be.map(o=>[o.toLowerCase(),_(o)]))},ms=o=>`__${o}`,bi=class extends g{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(W).map(([t,e])=>[_(t),e]))};this.Hc=new Map;}jc(t,e){if(!fs(t)){let i=[...new Set([ee(t),t.toLowerCase()])];for(let s of i)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Gc(t,e){this.$[_(t)]!==e&&(typeof e>"u"||e===null?this.$[_(t)]=W[t]:this.$[_(t)]=e);}ii(t,e){let i=this,s=ps(t,e),n=ms(t);i[n]!==s&&(this.Wc(t,i[n],s),i[n]=s,this.jc(t,s),this.Gc(t,s),this.debugPrint(`[uc-config] "${t}"`,s),rs(this.cfg));}Ln(t){let e=this,i=ms(t);return e[i]??this.$[_(t)]}Wc(t,e,i){this.cfg.debug&&i!==e&&typeof i=="object"&&typeof e=="object"&&JSON.stringify(i)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,i));}initCallback(){super.initCallback();let t=this;for(let e of be)this.sub(_(e),i=>{this.ii(e,i);},false);for(let e of yi){let i=t[e]??this.$[_(e)];i!==W[e]&&this.ii(e,i),Object.defineProperty(this,e,{set:s=>{this.ii(e,s);},get:()=>this.Ln(e)});}for(let e of yi)this.sub(_(e),()=>{ss({key:e,setValue:this.ii.bind(this),getValue:this.Ln.bind(this),computationControllers:this.Hc});});}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback(t,e,i),e===i)return;let s=this,n=hs[t];n&&(s[n]=i),ol[t]&&(this[t]=i);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(hs)]}};for(let o of yi)bi.prototype[o]=void 0;function sl(o){return new Promise(r=>{typeof window.FileReader!="function"&&r(false);try{let t=new FileReader;t.onerror=()=>{r(!0);};let e=i=>{i.type!=="loadend"&&t.abort(),r(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{r(false);}})}function nl(o,r){return new Promise(t=>{let e=0,i=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||r});i.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(i);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(i);});};s(o);})}function vs(o){let r=[],t=[];for(let e=0;e<o.items.length;e++){let i=o.items[e];if(i)if(i.kind==="file"){let s=i.type,n=i;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(nl(l,s).then(c=>{c&&r.push(...c);}));continue}let a=i.getAsFile();a&&t.push(sl(a).then(l=>{l||r.push({type:"file",file:a});}));}else i.kind==="string"&&/^text\/uri-list/.test(i.type)&&t.push(new Promise(s=>{i.getAsString(n=>{r.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>r)}var j=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),gs=["focus"],al=100,Cr=new Map;function ll(o,r){let t=Math.max(Math.min(o[0],r.x+r.width),r.x),e=Math.max(Math.min(o[1],r.y+r.height),r.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}function xr(o){let r=0,t=document.body,e=new Set,i=m=>{e.add(m);},s=j.INACTIVE,n=m=>{o.shouldIgnore()&&m!==j.INACTIVE||(s!==m&&e.forEach(k=>{k(m);}),s=m);},a=()=>r>0;i(m=>o.onChange(m));let l=()=>{r=0,n(j.INACTIVE);},c=()=>{r+=1,s===j.INACTIVE&&n(j.ACTIVE);},d=()=>{r-=1,a()||n(j.INACTIVE);},p=m=>{m.preventDefault(),r=0,n(j.INACTIVE);},f=m=>{if(o.shouldIgnore())return;a()||(r+=1);let k=[m.x,m.y],A=o.element.getBoundingClientRect(),R=Math.floor(ll(k,A)),Pt=R<al,As=m.composedPath().includes(o.element);Cr.set(o.element,R);let Sr=Math.min(...Cr.values())===R;As&&Sr?(m.preventDefault(),n(j.OVER)):n(Pt&&Sr?j.NEAR:j.ACTIVE);},v=async m=>{if(o.shouldIgnore())return;m.preventDefault();let{dataTransfer:k}=m;if(!k)return;let A=await vs(k);o.onItems(A),n(j.INACTIVE);};return t.addEventListener("drop",p),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",f),o.element.addEventListener("drop",v),gs.forEach(m=>{window.addEventListener(m,l);}),()=>{Cr.delete(o.element),t.removeEventListener("drop",p),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",v),gs.forEach(m=>{window.removeEventListener(m,l);});}}var kr=new Set,rt=class extends E{constructor(){super(...arguments);this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.j=true;this.$n=true;this.Un=null;this.Rn=null;this.Pn=createRef();this.Pt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.Dn=true;this.Dt=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get Zc(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.j)return false;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(),kr.add(this),this.Lr(),this.$r(),this.Vn(),this.Fn(j.INACTIVE),this.Un=xr({element:this,shouldIgnore:()=>this._n(),onChange:e=>{this.Fn(e);},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:L.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:L.DROP_AREA,fullPath:i.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(h.activities.UPLOAD_LIST),this.set$({"*currentActivity":h.activities.UPLOAD_LIST})));}});let t=this.Pn.value;t&&(this.Rn=xr({element:t,onChange:e=>{let i=Object.entries(j).find(([,s])=>s===e)?.[0].toLowerCase();i&&t.setAttribute("drag-state",i);},onItems:()=>{},shouldIgnore:()=>this._n()})),this.subConfigValue("sourceList",e=>{let i=V(e);this.Dn=i.includes(L.LOCAL),this.Lr(),this.$r();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Lr(),this.$r());}updated(t){super.updated(t),t.has("clickable")&&this.Vn();}_n(){if(!this.j||!this.qc())return true;if(!this.fullscreen)return false;let t=kr;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}qc(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return !(t&&e&&i>=e||!t&&i>0)}Lr(){let t=this.Dn&&!this.disabled;this.j=t;}$r(){let t=this.j||!this.querySelector("[data-default-slot]");this.$n=t,this.hidden=!t;}Fn(t){let e=Object.entries(j).find(([,i])=>i===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}Vn(){this.clickable&&!this.Dt?(this.addEventListener("keydown",this.Pt),this.addEventListener("click",this.Pt),this.Dt=true):!this.clickable&&this.Dt&&(this.removeEventListener("keydown",this.Pt),this.removeEventListener("click",this.Pt),this.Dt=false);}disconnectedCallback(){super.disconnectedCallback(),kr.delete(this),this.Un?.(),this.Rn?.(),this.Dt&&(this.removeEventListener("keydown",this.Pt),this.removeEventListener("click",this.Pt),this.Dt=false);}render(){return html` ${this.yield("",html`<div data-default-slot hidden></div><div ${ref(this.Pn)} class="uc-content-wrapper" ?hidden=${!this.$n}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.Zc}</span></div>`)} `}};u([property({type:Boolean,reflect:true})],rt.prototype,"disabled",2),u([property({type:Boolean,reflect:true})],rt.prototype,"clickable",2),u([property({type:Boolean,attribute:"with-icon",reflect:true})],rt.prototype,"withIcon",2),u([property({type:Boolean,reflect:true})],rt.prototype,"fullscreen",2),u([property({type:Boolean,reflect:true})],rt.prototype,"initflow",2),u([property({type:String})],rt.prototype,"text",2),u([state()],rt.prototype,"j",2),u([state()],rt.prototype,"$n",2);var ws=()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(r){return console.warn("Unable to access top-level window location:",r),globalThis.location.origin}};var dl=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Es=(o,r="i")=>{let t=o.split("*").map(dl);return new RegExp(`^${t.join(".+")}$`,r)};var pl=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],hl=(o,r)=>window.getComputedStyle(o).getPropertyValue(r).trim(),Ts=o=>{let r={};for(let t of pl){let e=hl(o,t);e&&(r[t]=e);}return r};var ml=["selected-files-change","toolbar-state-change"],fl=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let r=o.type;return !(typeof r!="string"||!ml.includes(r))},wi=class{constructor(r,t){this.ri=new Map;this.zn=r=>{if(r.source!==this.Ur)return;let t=r.data;if(!fl(t))return;let e=this.ri.get(t.type);if(e)for(let i of e)i(t);};this.Ur=r,this.Nn=t,window.addEventListener("message",this.zn);}on(r,t){let e=this.ri.get(r)??new Set;this.ri.has(r)||this.ri.set(r,e),e.add(t);}send(r){let t=this.Nn();this.Ur.postMessage(r,t);}destroy(){window.removeEventListener("message",this.zn);}};function Cs(o){let r=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||r.push(`${t}=${encodeURIComponent(e)}`);return r.join("&")}var bl={[at.GDRIVE]:"ngdrive"},J=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.EXTERNAL;this.Vt=createRef();this.oi=null;this.Rr=[];this.Pr=false;this.Dr=false;this.Vr=false;this.Fr=false;this.si=false;this._r=false;this.Nr="uc-hidden";this.Bn=true;this.ji=()=>{for(let t of this.Rr){let e=this.Qc(t),{filename:i}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:i,source:s});}this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.modalManager?.open(h.activities.UPLOAD_LIST);};this.N=()=>{this.historyBack();};this.ru=()=>{this.S?.send({type:"select-all"});};this.ou=()=>{this.S?.send({type:"deselect-all"});};}get Xc(){if(!this.oi)return "";let{selectedCount:t,total:e}=this.oi;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Kn();}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.zr(),this.Kn());}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.zr();}),this.subConfigValue("multiple",t=>{this.si=t;}),this.subConfigValue("localeName",()=>{this.Hn();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.jn(t);});}Qc(t){if(t.alternatives){let e=V(this.cfg.externalSourcesPreferredTypes);for(let i of e){let s=Es(i);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}Yc(t){this.Bn=t.isVisible;}async Jc(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.tu(t.selectedCount,t.total),this.Nr=t.isReady?"":"uc-hidden",this.Pr=t.isReady,this.Dr=t.isReady&&t.selectedFiles.length>0,this.si=t.isMultipleMode&&t.total>0,this.Vr=t.selectedCount<t.total,this.Fr=t.selectedCount===t.total,this.Rr=t.selectedFiles??[],this._r=t.total>0;}Gn(){this.jn(this.cfg.externalSourcesEmbedCss),this.eu(),this.Hn();}eu(){this.S?.send({type:"set-theme-definition",theme:Ts(this)});}jn(t){this.S?.send({type:"set-embed-css",css:t});}Hn(){this.S?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}iu(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:i,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=bl[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ws(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,i);return d.search=Cs(c),d.toString()}tu(t,e){this.oi={selectedCount:t,total:e};}Kn(){let t=document.createElement("iframe");t.src=this.iu(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Gn.bind(this)),t.addEventListener("load",this.Gn.bind(this)),this.Vt.value&&(this.Vt.value.innerHTML="",this.Vt.value.appendChild(t)),t.contentWindow&&(this.S?.destroy(),this.S=new wi(t.contentWindow,()=>this.cfg.socialBaseUrl),this.S.on("selected-files-change",this.Jc.bind(this)),this.S.on("toolbar-state-change",this.Yc.bind(this)),this.Wn());}zr(){this.S?.destroy(),this.S=void 0,this.Vt.value&&(this.Vt.value.innerHTML=""),this.Wn();}Wn(){this.Rr=[],this.Pr=false,this.Dr=false,this.Vr=false,this.Fr=false,this.si=false,this._r=false,this.Nr="uc-hidden",this.oi=null;}disconnectedCallback(){super.disconnectedCallback(),this.zr();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${ref(this.Vt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Bn}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.N}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.si}><span>${this.Xc}</span><button type="button" @click=${this.ru} ?hidden=${!this.Vr}>${this.l10n("select-all")}</button><button type="button" @click=${this.ou} ?hidden=${!this.Fr}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ji} ?disabled=${!this.Dr} ?hidden=${!this._r} ><uc-spinner ?hidden=${this.Pr}></uc-spinner><span class=${this.Nr}>${this.l10n("done")}</span></button></div></div>`}};u([state()],J.prototype,"Rr",2),u([state()],J.prototype,"Pr",2),u([state()],J.prototype,"Dr",2),u([state()],J.prototype,"Vr",2),u([state()],J.prototype,"Fr",2),u([state()],J.prototype,"si",2),u([state()],J.prototype,"_r",2),u([state()],J.prototype,"Nr",2),u([state()],J.prototype,"Bn",2);var wl=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,xs=o=>{if(typeof o!="string")return false;let r=wl.exec(o.toLocaleLowerCase())??[];if(r.length===0)return false;let t=Number(r[1])*Number(r[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${r[1]}x${r[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:r[3]?Number(r[3])/100:void 0,size:t}};var F=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),U=class U extends Wt{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Zn=true;this.uid="";this.Br="";this.Kr="";this.Hr="";this.O=0;this.qn=false;this.jr="";this.Xn=false;this.Qn=false;this.Yn=false;this.Jn=false;this.ta=false;this.ni=false;this.ea="";this.ia=false;this.su=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(h.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT;});this.nu=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.remove(this.uid);};this.au=()=>{this.ra();};this.u=T(()=>this.oa(),100);this.cu=this.withEntry(qt((t,e)=>{let i=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===F.FINISHED,l=e===F.UPLOADING,c=e===F.QUEUED_UPLOADING,d=e===F.QUEUED_VALIDATION,p=e===F.VALIDATION,f=t.getValue("fileName"),v="";i?v="":!a&&n&&s&&Object.values(at).includes(s)&&(v=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.Hr=v,this.Kr=i,this.qn=l||c||d||p,this.O=d||p?0:t.getValue("uploadProgress"),this.ea=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.ra=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.u();try{let i=new AbortController;t.setValue("abortController",i);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File&&this.cfg.imageShrink)try{let p=xs(this.cfg.imageShrink);p?a=await shrinkFile(a,p):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:p=>{if(p.isComputable){let f=p.value*100;t.setValue("uploadProgress",f);}},signal:i.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),uploadFile(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.u();}catch(i){this.telemetryManager.sendEventError(i,"file upload. Failed to upload file"),i instanceof CancelError&&i.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):i instanceof UploadcareError?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:i}):(console.error("Unknown upload error",i),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:i})})),t===this.entry&&this.u();}}});}oa(){let t=this.entry;if(!t)return;let e=F.IDLE;t.getValue("errors").length>0?e=F.FAILED:t.getValue("isQueuedForUploading")?e=F.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=F.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=F.VALIDATION:t.getValue("isUploading")?e=F.UPLOADING:t.getValue("fileInfo")&&(e=F.FINISHED),this.lu(t,e);}lu(t,e){e===F.FAILED?this.jr="badge-error":e===F.FINISHED&&(this.jr="badge-success"),e===F.UPLOADING&&(this.Jn=false,this.removeAttribute("focused")),this.Qn=e===F.FAILED,this.Yn=e===F.UPLOADING,this.Xn=e===F.FINISHED,this.ta=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.cu(e);}reset(){super.reset(),this.u.cancel();}Gt(t){let[e]=t;e&&e.isIntersecting&&!this.ia&&(this.Zn=false,this.ia=true);}sa(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.u();}),this.subEntry("isValidationPending",()=>{this.u();}),this.subEntry("uploadProgress",()=>{this.u();}),this.subEntry("isQueuedForUploading",()=>{this.u();}),this.subEntry("fileName",i=>{this.Br=i||e.getValue("externalUrl")||this.l10n("file-no-name"),this.u();}),this.subEntry("externalUrl",i=>{this.Br=e.getValue("fileName")||i||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.u();}),this.subEntry("errors",()=>this.u()),this.subEntry("isUploading",()=>this.u()),this.subEntry("fileSize",()=>this.u()),this.subEntry("mimeType",()=>this.u()),this.subEntry("isImage",()=>this.u()),this.oa());}na(t){if(this.cfg.filesViewMode==="list"){this.ni=true;return}this.ni=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.sa(this.uid);}initCallback(){super.initCallback(),this.sa(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.u()),this.subConfigValue("filesViewMode",t=>{this.na(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.na(t);}),this.onclick=()=>{U.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.ra());}),U.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.i=new window.IntersectionObserver(this.Gt.bind(this),{threshold:[0,1]}),this.i.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),U.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Zn?false:super.shouldUpdate(t)}render(){return html`<div class="uc-inner" ?finished=${this.Xn} ?uploading=${this.Yn} ?failed=${this.Qn} ?focused=${this.Jn}><uc-thumb .uid=${this.uid} .badgeIcon=${this.jr}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.ea}><span class="uc-file-name" ?hidden=${!this.ni}>${this.Br}</span><span class="uc-file-error" ?hidden=${!this.Kr}>${this.Kr}</span><span class="uc-file-hint" ?hidden=${!this.Hr}>${this.Hr}</span></div><div class="uc-file-actions"><button type="button" @click=${this.su} ?hidden=${!this.ta} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.nu} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.au}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.O} .visible=${this.qn} ?hasFileName=${this.ni}></uc-progress-bar></div>`}};u([state()],U.prototype,"Zn",2),u([property({type:String,attribute:false})],U.prototype,"uid",2),u([state()],U.prototype,"Br",2),u([state()],U.prototype,"Kr",2),u([state()],U.prototype,"Hr",2),u([state()],U.prototype,"O",2),u([state()],U.prototype,"qn",2),u([state()],U.prototype,"jr",2),u([state()],U.prototype,"Xn",2),u([state()],U.prototype,"Qn",2),u([state()],U.prototype,"Yn",2),u([state()],U.prototype,"Jn",2),u([state()],U.prototype,"ta",2),u([state()],U.prototype,"ni",2),u([state()],U.prototype,"ea",2);var Ar=U;var we=class extends E{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.aa="upload-file";this.uu=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.aa=t?"upload-files":"upload-file";});}render(){return html`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.uu}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.aa)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};u([property({attribute:"dropzone",type:Boolean})],we.prototype,"dropzone",2),u([state()],we.prototype,"aa",2);var ks="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var bt=class extends g{constructor(){super(...arguments);this.init$=Dr(this);}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this);}render(){return html`${unsafeSVG(ks)}`}};var Ei=class extends bt{constructor(){super();this.headless=false;this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});}render(){return html` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};u([property({type:Boolean})],Ei.prototype,"headless",2);var Or=class extends K{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ti=class extends bt{constructor(){super();this.la=false;this.N=()=>{if(this.ca){let t=this.$["*historyBack"];t?.();return}this.ua&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get ca(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==h.activities.START_FROM}get ua(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Gr(){return this.getCssData("--cfg-init-activity")||h.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});let t=this.Gr();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.la=this.ca||this.ua;});}render(){return html` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.N} ?hidden=${!this.la} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};u([state()],Ti.prototype,"la",2);var Ir="active",xi="",Rt=class extends bt{constructor(){super();this.Wr=false;this.ai=false;this.li=xi;this.Zr=xi;this.Kt=t=>{t.id===h.activities.CLOUD_IMG_EDIT&&(this.li=Ir),this.$["*currentActivity"]===h.activities.UPLOAD_LIST&&(this.li=Ir,this.ai=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.Zr=Ir);};this.Ht=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.ai=false),t.id===h.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Gr(){return this.getCssData("--cfg-init-activity")||h.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});let t=this.Gr();this.sub("*currentActivity",e=>{e===h.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.Zr=xi):(this.li=xi,this.ai=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",i=>{e==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Wr=!i):(this.style.removeProperty("--uc-grid-col"),this.Wr=false);});}),this.modalManager?.subscribe(P.OPEN,this.Kt),this.modalManager?.subscribe(P.CLOSE,this.Ht);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(P.OPEN,this.Kt),this.modalManager?.unsubscribe(P.CLOSE,this.Ht);}render(){return html` ${super.render()}<uc-start-from ?hidden=${this.ai} class=${this.Zr}><uc-drop-area ?single=${this.Wr} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.li}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};u([state()],Rt.prototype,"Wr",2),u([state()],Rt.prototype,"ai",2),u([state()],Rt.prototype,"li",2),u([state()],Rt.prototype,"Zr",2);
|
|
8
|
-
export{h as ActivityBlock,ar as ActivityHeader,Ai as BaseComponent,g as Block,
|
|
7
|
+
var Is=Object.defineProperty;var Os=Object.getOwnPropertyDescriptor;var u=(o,r,t,e)=>{for(var i=e>1?void 0:e?Os(r,t):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(e?n(r,t,i):n(i))||i);return e&&i&&Is(r,t,i),i};var M=class o{static{this._t=new Map;}constructor(r,t){this.w=t;}pub(r,t){r in this.w.get()||console.warn(`PubSub#pub: Key "${String(r)}" not found`),this.w.setKey(r,t);}sub(r,t,e=true){return r in this.w.get()||console.warn(`PubSub#sub: Key "${String(r)}" not found`),e&&t(this.w.get()[r]),{remove:listenKeys(this.w,[r],s=>{t(s[r]);})}}read(r){return r in this.w.get()||console.warn(`PubSub#read: Key "${String(r)}" not found`),this.w.get()[r]}add(r,t,e=false){(!(r in this.w.get())||e)&&this.w.setKey(r,t);}has(r){return r in this.w.get()}get store(){return this.w.get()}static registerCtx(r,t){if(o._t.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=map(r);return o._t.set(t,e),new o(t,e)}static deleteCtx(r){o._t.delete(r);}static getCtx(r){let t=o._t.get(r);return t?new o(r,t):null}static hasCtx(r){return o._t.has(r)}};var Ls=/\\([0-9a-fA-F]{1,6} ?)/g;function $s(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function Us(o){let r=o;return (r[0]==='"'||r[0]==="'")&&(r=r.slice(1)),(r[r.length-1]==='"'||r[r.length-1]==="'")&&(r=r.slice(0,-1)),r}function Rs(o){let r="",t="";for(let e=0;e<o.length;e++){let i=o[e+1];o[e]==="\\"&&i==='"'?(r+='\\"',e++):o[e]==='"'&&t!=="\\"?r+='\\"':r+=o[e],t=o[e]??"";}return r}function Mr(o){let r=o;$s(o)&&(r=Us(r),r=r.replace(Ls,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),r=r.replaceAll(`\\ `,"\\n"),r=Rs(r),r='"'+r+'"');try{return JSON.parse(r)}catch{return}}function Dt(o){class r extends o{constructor(){super(...arguments);this.Qr=null;this.hi=null;}getCssData(i,s=false){let n=this.Qr??Object.create(null);if(!Object.keys(n).includes(i)||!n[i]){this.hi||(this.hi=window.getComputedStyle(this));let a=this.hi.getPropertyValue(i).trim();try{n[i]=Mr(a);}catch(l){s||console.warn(`CSS Data error: ${i}`,l),n[i]=null;}}return this.Qr=n,n[i]}}return r}function Te(o){class r extends o{constructor(){super(...arguments);this.willYield=true;this.et={};this.it=null;this.ge=false;}createRenderRoot(){return this}connectedCallback(){this.it||(this.it=Array.from(this.childNodes)),super.connectedCallback();}ma(){if(this.ge)return;this.ge=true,this.et={};let i=Array.from(this.childNodes),s=i.length?i:this.it??[];for(let n of s){let a=this.Yr(n),l=this.et[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.et[a]=l;}this.it=null;}Yr(i){return i instanceof Comment&&i.nextSibling instanceof Element?this.Yr(i.nextSibling):"contentFor"in i?i.contentFor||"":i instanceof Element&&i.hasAttribute("content-for")&&i.getAttribute("content-for")||""}fa(i){return !i.textContent||!i.textContent.trim()}va(i){let s=this.et[i];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.fa(n))}update(i){!this.hasUpdated&&this.willYield&&this.ma(),super.update(i);}yield(i,s){if(i===""&&!this.et[i]&&!this.ge&&this.it?.length){let a=[];for(let l of this.it)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.et[i]=a,this.ge=true,this.it=null;}let n=this.et[i];return html` ${n} ${this.va(i)?s:void 0} `}}return r}function Vt(o){class r extends o{static reg(e){let i=this,s=window.customElements.get(e);if(s){s!==i&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,i);}}return r}function E(o,r){let t,e=((...i)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...i),r);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Lr=createContext("ctx-name-context");function Ee(){return function(o){class r extends o{constructor(...i){super(...i);this.k=null;this.Nt=false;this.mi=false;this.fi=void 0;this.vt=new Map;this.zt=new Set;this.init$={};this.ctxOwner=false;this.ye=void 0;this.be=false;this.ctxName=this.j;this.G=false;this.ye=this.getAttribute("ctx-name")||void 0,this.ctxName=this.j,this.ga=new ContextConsumer(this,{context:Lr,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.eo=s,this.to();},subscribe:true});}get Jr(){return this.ye}set Jr(i){let s=i??void 0;this.ye!==s&&(this.ye=s,this.to());}shouldUpdate(i){return this.G?super.shouldUpdate(i):false}get j(){return this.Jr||this.eo||void 0}to(){if(this.ctxName=this.j,!(!this.ctxName||this.Nt)){if(this.isConnected){this.vi();return}this.be=true;}}willUpdate(i){super.willUpdate(i),this.ctxName=this.j,this.ctxName&&(this.fi?this.fi.setValue(this.ctxName):this.fi=new ContextProvider(this,{context:Lr,initialValue:this.ctxName}));}io(){if(!(!this.k||this.vt.size===0)){for(let[i,{value:s,rewrite:n}]of this.vt)this.k.add(i,s,n);this.vt.clear();}}ro(){return !this.k&&this.j&&this.gi(),this.k&&this.io(),this.k}yi(){let i=this.ro();if(!i)throw new Error("SymbioteMixin: Shared context is not initialized.");return i}gi(){let i=this.init$,s=this.j;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.k){this.k=M.getCtx(s)??M.registerCtx(i,s);for(let[n,a]of Object.entries(this.init$))this.k.add(n,a,this.ctxOwner);this.io();}}get $(){return this.j&&this.gi(),new Proxy({},{get:(i,s)=>{if(typeof s=="string")return this.k?.read(s)},set:(i,s,n)=>(typeof s!="string"||this.k?.pub(s,n),true)})}sub(i,s,n=true){let a=this.yi().sub(i,s,n);if(!a||typeof a.remove!="function")return ()=>{};let l=a.remove.bind(a),c=false,d=()=>{c||(c=true,l(),this.zt.delete(d));};return this.zt.add(d),d}pub(i,s){this.yi().pub(i,s);}set$(i){for(let[s,n]of Object.entries(i))this.pub(s,n);}has(i){return this.k?.has(i)??false}add(i,s,n=false){let a=this.ro();if(!a){if(!n&&this.vt.has(i))return;this.vt.set(i,{value:s,rewrite:n});return}this.vt.delete(i),a.add(i,s,n);}add$(i,s=false){for(let[n,a]of Object.entries(i))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Nt?this.G&&this.mi&&(this.mi=false,this.initCallback()):this.ctxName?(this.be=false,this.vi()):this.be&&this.j&&(this.be=false,this.vi());}vi(){if(this.Nt)return;this.Nt=true,this.gi();let i=this.init$;if(Object.keys(i).length>0){let s=this.yi();for(let[n,a]of Object.entries(i))s.read(n)===void 0&&s.pub(n,a),this.sub(n,E(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.G=true,this.requestUpdate();}firstUpdated(i){super.firstUpdated(i);}disconnectedCallback(){this.ya(),super.disconnectedCallback(),this.Nt&&(this.mi=true);}ya(){if(this.zt.size!==0){for(let i of [...this.zt])i();this.zt.clear();}}initCallback(){}}return u([property({type:String,attribute:"ctx-name",noAccessor:true})],r.prototype,"Jr",1),u([state()],r.prototype,"eo",2),u([state()],r.prototype,"ctxName",2),u([state()],r.prototype,"G",2),r}}var Ai=class extends Vt(Ee()(Dt(Te(LitElement)))){};var q=class o{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let r=globalThis.crypto;return r&&typeof r.randomUUID=="function"?r.randomUUID():o.generateFastUid()}};var zs=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Ii(o){for(let r in o){if(zs.includes(r))continue;let t=[...r].reduce((e,i)=>(i.toUpperCase()===i&&(i=`-${i.toLowerCase()}`),e+=i,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[r].reg&&o[r].reg(t);}}var Oi="UC";function Bs(o,r=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Oi]){t(window[Oi]);return}let i=document.createElement("script");i.async=true,i.src=o,i.onerror=()=>{e();},i.onload=()=>{let s=window[Oi];r&&Ii(s),t(s);},document.head.appendChild(i);})}var te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Si=new Map,$r=new Map,Ur=(o,r)=>{Si.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...te,...r};return Si.set(o,t),t},Ks=(o,r)=>{$r.set(o,r);},Rr=(o,r)=>{typeof r=="function"?Ks(o,r):Ur(o,r);},Pr=async o=>{let r=Si.get(o);if(!r){let t=$r.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();r=Ur(o,e);}return r};Rr("en",te);var P=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Ce=class{constructor(r){this.rt=new Map;this.M=new Set;this.h=new Map;this.s=r;}a(...r){this.s.debugPrint("[modal-manager]",...r);}registerModal(r,t){this.rt.set(r,t),this.g(P.ADD,{id:r,modal:t});}deleteModal(r){let t=this.rt.get(r);return t?(this.rt.delete(r),this.M.delete(r),this.g(P.DELETE,{id:r,modal:t}),true):false}open(r){let t=this.rt.get(r);return t?(this.M.add(r),this.g(P.OPEN,{modal:t,id:r}),true):(this.a(`Modal with ID "${r}" not found`),false)}close(r){let t=this.rt.get(r);return !t||!this.M.has(r)?(this.a(`Modal with ID "${r}" not found or not active`),false):(this.M.delete(r),this.g(P.CLOSE,{id:r,modal:t}),true)}toggle(r){return this.rt.has(r)?this.M.has(r)?this.close(r):this.open(r):(this.a(`Modal with ID "${r}" not found`),false)}get hasActiveModals(){return this.M.size>0}back(){if(this.M.size===0)return this.a("No active modals to go back from"),false;let r=Array.from(this.M).pop();return r?this.close(r):false}closeAll(){let r=this.M.size;return this.M.clear(),this.g(P.CLOSE_ALL,{}),r}subscribe(r,t){return this.h.has(r)||this.h.set(r,new Set),this.h.get(r)?.add(t),()=>this.unsubscribe(r,t)}unsubscribe(r,t){this.h.has(r)&&this.h.get(r)?.delete(t);}g(r,t){if(this.h.has(r))for(let e of this.h.get(r)??new Set)try{e(t);}catch(i){this.s.telemetryManager.sendEventError(i,"modal subscriber"),this.a("Error in modal subscriber:",i);}}destroy(){this.closeAll(),this.rt.clear(),this.h.clear(),this.g(P.DESTROY,{});}};var ee=o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(r=>r.toLowerCase()).join("-");var Mi=()=>({}),Li=o=>({...Mi(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),$i=o=>({...Li(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Queue(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Dr=o=>({...$i(o),"*solution":null});var Ui=class{constructor(){this.Bt=new Map;this.bi=[];}addEventListener(r,t){let e=i=>{let s=i.target;s instanceof Node&&this.bi.some(n=>n===s||n.contains(s))&&t(i);};this.Bt.set(t,e),window.addEventListener(r,e);}removeEventListener(r,t){let e=this.Bt.get(t);e&&window.removeEventListener(r,e),this.Bt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(r){this.bi.push(r);}destroy(){this.bi=[];for(let r of this.Bt.values())window.removeEventListener("keydown",r),window.removeEventListener("keyup",r);this.Bt.clear();}},xe=class{constructor(){this.we=new Ui,this.oo=startKeyUX(this.we,[focusGroupKeyUX(),pressKeyUX("is-pressed"),jumpKeyUX(),hiddenKeyUX()]);}registerBlock(r){this.we.registerScope(r);}destroy(){this.oo?.(),this.we.destroy();}};var wt=o=>`*l10n/${o}`,Xs="en",ke=class{constructor(r){this.e=null;this.wi="";this.e=r;for(let[t,e]of Object.entries(te)){let i=this.e.has(wt(t))?!this.e.$[wt(t)]:true;this.e.add(wt(t),e,i);}setTimeout(()=>{r.subConfigValue("localeName",async t=>{if(!this.e||!t)return;this.wi=t;let e=await Pr(t);if(t!==Xs&&this.wi!==t)return;let i=this.e.cfg.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=i?.[s];this.e.add(wt(s),a??n,true);}}),r.subConfigValue("localeDefinitionOverride",t=>{if(!t)return;let e=t[this.wi];if(e)for(let[i,s]of Object.entries(e))this.e?.add(wt(i),s,true);});});}};var G=o=>o?o.split(",").map(r=>r.trim()).filter(Boolean):[],ht=o=>o.join(",");var Vr=o=>{if(typeof o!="string"||!o)return "";let r=o.trim();return r.startsWith("-/")?r=r.slice(2):r.startsWith("/")&&(r=r.slice(1)),r.endsWith("/")&&(r=r.slice(0,r.length-1)),r},Ae=(...o)=>o.filter(r=>typeof r=="string"&&!!r).map(r=>Vr(r)).join("/-/"),z=(...o)=>{let r=Ae(...o);return r?`-/${r}/`:""};function Ie(o){let r=new URL(o),t=r.pathname+r.search+r.hash,e=t.lastIndexOf("http"),i=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):i>=0&&(s=t.slice(i+1)),s}function Oe(o){let r=new URL(o),{pathname:t}=r,e=t.indexOf("/"),i=t.indexOf("/",e+1);return t.substring(e+1,i)}function Ri(o){let r=Fr(o),t=new URL(r),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Pi(o){return Ri(o).split("/-/").filter(Boolean).map(t=>Vr(t))}function Fr(o){let r=new URL(o),t=Ie(o),e=_r(t)?Nr(t).pathname:t;return r.pathname=r.pathname.replace(e,""),r.search="",r.hash="",r.toString()}function _r(o){return o.startsWith("http")}function Nr(o){let r=new URL(o);return {pathname:`${r.origin}${r.pathname??""}`,search:r.search??"",hash:r.hash??""}}var D=(o,r,t)=>{let e=new URL(Fr(o)),i=t??Ie(o),s=r??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),i&&_r(i)){let n=Nr(i);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${i||""}`;return e.toString()},Tt=(o,r)=>{let t=new URL(o);return t.pathname=`${r}/`,t.toString()};var V=(o,r=",")=>o.trim().split(r).map(t=>t.trim()).filter(t=>t.length>0);var ie=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Br=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Qs(o,r){if(typeof r=="number"){let t=r;return ie[o]!==t?`${o}/${t}`:""}if(typeof r=="boolean"){let t=r;return ie[o]!==t?`${o}`:""}if(o==="filter"&&r){let{name:t,amount:e}=r;return ie.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&r){let{dimensions:t,coords:e}=r;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function Et(o){return Ae(...Br.filter(r=>typeof o[r]<"u"&&o[r]!==null).map(r=>{let t=o[r];return Qs(r,t)}).filter(r=>!!r))}var Se=Ae("format/auto","progressive/yes"),mt=([o])=>typeof o<"u"?Number(o):void 0,zr=()=>true,Ys=([o,r])=>({name:o,amount:typeof r<"u"?Number(r):100}),Js=([o,r])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(r))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:V(o,"x").map(Number),coords:V(r).map(Number)}},tn=Object.freeze({enhance:mt,brightness:mt,exposure:mt,gamma:mt,contrast:mt,saturation:mt,vibrance:mt,warmth:mt,filter:Ys,mirror:zr,flip:zr,rotate:mt,crop:o=>{let[r,t]=o,{dimensions:e,coords:i}=Js([r,t]);return {dimensions:e,coords:i}}});function Di(o){let r={};for(let t of o){let[e,...i]=t.split("/");if(!e||!Br.includes(e))continue;let s=e,n=tn[s];try{let a=n(i);r[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return r}var I=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),B=Object.freeze([I.CROP,I.TUNING,I.FILTERS]),Kr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Hr=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),jr=Object.freeze(["rotate","mirror","flip"]),ft=ie,et=Object.freeze({brightness:{zero:ft.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:ft.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:ft.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:ft.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:ft.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:ft.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:ft.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:ft.enhance,range:[0,100],keypointsNumber:1},filter:{zero:ft.filter,range:[0,100],keypointsNumber:1}});var re="https://ucarecdn.com",en="https://upload.uploadcare.com",rn="https://social.uploadcare.com",on="https://ucarecd.net",sn={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:ht(B),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:re,cdnCnamePrefixed:on,baseUrl:en,socialBaseUrl:rn,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true},W=Object.freeze(sn);var C=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),w=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"}),Me=class{constructor(r){this.Te=new Map;this.Ti=new Set;this.a=null;this.a=r;}bindTarget(r){return this.Ti.add(r),()=>{this.Ti.delete(r);}}so(r,t){for(let e of this.Ti)e.dispatchEvent(new CustomEvent(r,{detail:t}));this.a?.(()=>{let e=t&&typeof t=="object"?{...t}:t;return [`event "${r}"`,e]});}emit(r,t,e={}){let{debounce:i}=e;if(typeof i!="number"&&!i){this.so(r,typeof t=="function"?t():t);return}this.Te.has(r)&&window.clearTimeout(this.Te.get(r));let s=typeof i=="number"?i:20,n=window.setTimeout(()=>{try{let a=typeof t=="function"?t():t;this.so(r,a),this.Te.delete(r);}catch(a){this.a?.(()=>`Error while getting payload for event "${r}"`,a);}},s);this.Te.set(r,n);}};var Gr="1.25.0-alpha.9";var st="blocks",nt=Gr;var Le=class{constructor(r){this.ba=q.generateRandomUUID();this.gt=structuredClone(W);this.Ei=false;this.Ci=null;this.V=true;this.s=r,this.ao=new TelemetryAPIService,this.yt=new Queue(10),this.V=!!this.s.cfg.qualityInsights,this.s.subConfigValue("qualityInsights",t=>{this.V=!!t;});for(let t of Object.keys(this.gt))this.s.subConfigValue(t,e=>{this.V&&(this.Ei&&this.gt[t]!==e&&this.sendEvent({eventType:C.CHANGE_CONFIG}),this.wa(t,e));});}Ta(r){r===C.INIT_SOLUTION&&!this.Ei&&(this.Ei=true);}wa(r,t){this.gt[r]!==t&&(this.gt[r]=t);}Ea(r){let t=r.payload?{...r.payload}:{};t.activity&&(t.activity=void 0);let e={...r};return (r.eventType===C.INIT_SOLUTION||r.eventType===C.CHANGE_CONFIG)&&(e.config=this.gt),{...e,appVersion:nt,appName:st,sessionId:this.ba,component:this.Ca,activity:this.xa,projectPubkey:this.gt.pubkey,userAgent:navigator.userAgent,eventType:e.eventType??"",eventTimestamp:this.ka,payload:{location:this.Aa,...t}}}Ia(r){return !!(r&&[w.CHANGE,w.COMMON_UPLOAD_PROGRESS,w.FILE_ADDED,w.FILE_REMOVED,w.FILE_UPLOAD_START,w.FILE_UPLOAD_PROGRESS,w.FILE_UPLOAD_SUCCESS,w.FILE_UPLOAD_FAILED].includes(r))}sendEvent(r){if(!this.V)return;let t=this.Ea({eventType:r.eventType,payload:r.payload,config:r.config});this.Ta(r.eventType),!(this.Ia(r.eventType)||this.Ci&&this.lo(this.Ci,t))&&this.yt.add(async()=>{this.Ci=t,await this.ao.sendEvent(t);});}sendEventError(r,t="unknown"){this.sendEvent({eventType:C.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:r.message}}});}sendEventCloudImageEditor(r,t,e={}){this.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{tabId:t,node:r.currentTarget?.tagName,event:r.type,...e}}});}lo(r,t){if(JSON.stringify(r)===JSON.stringify(t))return true;if(typeof r!="object"||typeof t!="object"||r==null||t==null)return false;let e=Object.keys(r),i=Object.keys(t);if(e.length!==i.length)return false;for(let s of e)if(!Object.hasOwn(t,s)||!this.lo(r[s],t[s]))return false;return true}get ka(){return Date.now()}get Ca(){if(!this.s.has("*solution"))return null;let r=this.s.$["*solution"];return r?r.toLowerCase():null}get xa(){return this.s.has("*currentActivity")?this.s.$["*currentActivity"]??null:null}get Aa(){return location.origin}};var _=o=>`*cfg/${o}`;var Wr=o=>{let r=new Intl.Locale(o),t="ltr",e=r.getTextInfo?.().direction;return e?t=e:r.textInfo?.direction&&(t=r.textInfo.direction),t};var $e=(o,r)=>new Intl.PluralRules(o).select(r);var cn=o=>o;var Zr="plural:";function oe(o,r={},t={}){let{openToken:e="{{",closeToken:i="}}",transform:s=cn}=t;for(let n in r){let a=r[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+i,c);}return o}function qr(o){let r=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let i=o.substring(t+2,e);if(i.startsWith(Zr)){let s=o.substring(t+2,e).replace(Zr,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));r.push({variable:i,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return r}var Xr="--uploadcare-blocks-window-height",se=class o{static{this.clientsRegistry=new Set;}static{this.flush=E(()=>{document.documentElement.style.setProperty(Xr,`${window.innerHeight}px`);},100);}static registerClient(r){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(r);}static unregisterClient(r){o.clientsRegistry.delete(r),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(Xr);}};var un=o=>o.tagName?.includes("-")??false,Ue=class{constructor(r){this.ot=new Set;this.Ee=new Map;this.co=false;this.st=r,this.st.addController(this);}hostDisconnected(){this.Ce?.(),this.Ce=void 0,this.ot.clear(),this.Ee.clear();}hostUpdated(){if(!this.Ce&&this.st.has(_("testMode"))){let r=this.st.subConfigValue("testMode",t=>{this.co=!!t,this.uo();});this.Ce=r;}this.Oa(),this.uo();}Oa(){let r=this.st,t=r.renderRoot??r;if(!t)return;let e=this.st,i=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!un(n));for(let n of s)if(!(i&&n.closest(i)!==e)&&!this.ot.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.ot.add(n),this.Ee.set(n,a);}for(let n of Array.from(this.ot))(!n.isConnected||i&&n.closest(i)!==e)&&(this.ot.delete(n),this.Ee.delete(n));}uo(){if(!this.ot.size)return;let r=this.st.testId||"";for(let t of this.ot){let e=this.Ee.get(t);e&&(this.co?t.setAttribute("data-testid",`${r}--${e}`):t.removeAttribute("data-testid"));}}};var pn=Vt(Ee()(Dt(Te(LitElement)))),g=class extends pn{constructor(){super();this.xe=new Map;this.activityType=null;this.init$=Mi();new Ue(this);}static{this.styleAttrs=[];}l10n(t,e={}){if(!t)return "";let i=this.$[wt(t)]||t,s=qr(i);for(let a of s)e[a.variable]=this.Sa(a.pluralKey,Number(e[a.countVariable]));return oe(i,e)}Sa(t,e){let i=this.l10n("locale-id")||"en",s=$e(i,e);return this.l10n(`${t}__${s}`)}emit(t,e,i){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,i);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),se.registerClient(this);}initCallback(){this.addSharedContextInstance("*blocksRegistry",()=>new Set,{persist:true}),this.addSharedContextInstance("*eventEmitter",()=>new Me(this.debugPrint.bind(this)),{persist:true}),this.addSharedContextInstance("*localeManager",()=>new ke(this)),this.addSharedContextInstance("*modalManager",()=>new Ce(this)),this.addSharedContextInstance("*a11y",()=>new xe,{persist:true}),this.addSharedContextInstance("*telemetryManager",()=>new Le(this)),this.sub(wt("locale-id"),t=>{let e=Wr(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this.getSharedContextInstance("*telemetryManager")}get localeManager(){return this.getSharedContextInstance("*localeManager")}get a11y(){return this.getSharedContextInstance("*a11y")}get blocksRegistry(){return this.getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this.getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),se.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),this.po(),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.po(true),M.deleteCtx(this.ctxName);}addSharedContextInstance(t,e,{persist:i=false}={}){if(!this.xe.has(t)&&(!this.has(t)||!this.$[t])){let s=e();this.add(t,s,true),this.xe.set(t,{persist:i,instance:s});return}}po(t=false){for(let[e,i]of this.xe.entries()){let{persist:s,instance:n}=i;s&&!t||(n?.destroy?.(),this.pub(e,null),this.xe.delete(e));}}getSharedContextInstance(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:Oe(t),cdnUrlModifiers:Ri(t),fileName:Ie(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?oe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.xi){let t={};this.xi=new Proxy(t,{set:(e,i,s)=>{if(typeof i!="string"||!(i in W))return false;let n=i,a=_(n);return this.has(a)||this.add(a,W[n]),this.$[a]=s,true},get:(e,i)=>{let s=_(i);return this.has(s)||this.add(s,W[i]),this.$[s]}});}return this.xi}subConfigValue(t,e){let i=_(t);return this.has(i)||this.add(i,W[t]),this.sub(i,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof t?.[0]=="function"){let i=t[0];e=i();}console.log(`[${this.ctxName}]`,...e);}};var ne=class extends g{constructor(){super(...arguments);this.name="";this.ki="";this.ho=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.ho=t,this.mo();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.mo();}mo(){if(!this.name){this.ki="";return}let t=`#uc-icon-${this.name}`,e=this.ho?.(this.name);this.ki=e??t;}render(){return html` ${this.yield("",html`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.ki}></use></svg>`)} `}};u([property({type:String})],ne.prototype,"name",2),u([state()],ne.prototype,"ki",2);var Yr=o=>[...new Set(o)];var It="--uc-img-",Vi="unresolved";var Fi=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),_i=3e3,Ni=5e3,zi=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var fn="https://ucarecdn.com",Ft=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:fn},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var Re=class extends Dt(Vt(LitElement)){constructor(){super();this.bt={};this.h=new Map;this.wt=null;this.ke=null;for(let t in Ft){let e=Ft[t];this.bt[It+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.bt[It+t]}set$$(t){for(let e in t){let i=It+e,s=t[e];this.bt[i]=s,this.g(i,s);}}sub$$(t,e){let i=It+t;this.h.has(i)||this.h.set(i,new Set),this.h.get(i)?.add(e);let s=this.bt[i];s!==null&&s!==""&&e(s);}g(t,e){this.h.has(t)&&this.h.get(t)?.forEach(i=>{e===null||e===""||i(e);});}analyticsParams(){return `-/@clib/${st}/${nt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let i=e;Ft[i.name]||t.setAttribute(i.name,i.value);});}initIntersection(t,e){let i={root:null,rootMargin:"0px"};this.wt=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.wt?.unobserve(t));});},i),this.wt.observe(t),this.ke||(this.ke=new Set),this.ke.add(t);}connectedCallback(){super.connectedCallback(),this.Ma();}Ma(){for(let t in Ft){let e=It+t,i=this.getCssData(e,true);i!=null&&(this.bt[e]=i);}}disconnectedCallback(){super.disconnectedCallback(),this.wt&&(this.ke?.forEach(t=>{this.wt?.unobserve(t);}),this.wt=null),this.h.clear();}static get observedAttributes(){return Object.keys(Ft)}attributeChangedCallback(t,e,i){window.setTimeout(()=>{let s=It+t;this.bt[s]=i,this.g(s,i);});}};var Jr=o=>Object.entries(o).filter(([r,t])=>t!==void 0&&t!=="").map(([r,t])=>r==="cdn-operations"||r==="analytics"?t:`${r}/${t}`);var Ve=class extends Re{constructor(){super(...arguments);this.F=new Image;this.L=new Image;}fo(t){return !t.includes("//")&&!Fi&&(t=new URL(t,document.baseURI).href),t}Ae(t){if(!t)return;let e=t,i=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!i||!s)return;let n=parseInt(i,10);return Number(n)>Ni&&this.vo?Ni+s:Number(n)>_i&&!this.vo?_i+s:t}La(t,e){let i={format:this.Ai("format"),quality:this.Ai("quality"),resize:this.Ae(t),blur:e,"cdn-operations":this.Ai("cdn-operations")??void 0,analytics:this.analyticsParams()};return z(...Jr(i))}Ai(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}A(t="",e=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(Fi&&i&&!i.includes("//"))return this.Kt(i);let s=this.La(t,e),n=this.$$("cdn-cname"),a=n;if(i.startsWith(String(n)))return D(i,s);let l=this.$$("uuid");if(a&&l)return this.Kt(D(Tt(a,l),s));if(l)return this.Kt(D(Tt(a,l),s));let c=this.$$("proxy-cname");if(c)return this.Kt(D(c,s,this.fo(i)));let d=this.$$("pubkey");if(d)return this.Kt(D(`https://${d}.ucr.io/`,s,this.fo(i)))}Kt(t){let e=this.$$("secure-delivery-proxy");return e?oe(e,{previewUrl:t},{transform:i=>window.encodeURIComponent(i)}):t}Tt(t,e=1,i=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=i?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}$a(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},i=["load","error"];for(let s of i)t.addEventListener(s,e);}get img(){return this._||(this.Ii({elNode:this.F}),this.appendChild(this.F)),this.F}get Ie(){return this._?{type:zi.PREVIEW,img:this.L}:{type:zi.MAIN,img:this.img}}get _(){return this.$$("is-preview-blur")}get go(){return this.$$("is-background-for")}get yo(){let t=this.$$("breakpoints");if(t){let e=V(t);return Yr(e.map(i=>parseInt(i,10)))}else return null}get vo(){return this.$$("format").toLowerCase()==="jpeg"}bo(t){let e=new Set;e.add(`url("${this.A(this.Tt(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.A(this.Tt(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.A(this.Tt(t,3))}") ${3}x`);let i=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",i),t.style.setProperty("background-image",`-webkit-${i}`);}wo(){let t=new Set;return this.yo?this.yo.forEach(e=>{t.add(`${this.A(`${e}x`)} ${this.Ae(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.A(`${e*2}x`)} ${this.Ae(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.A(`${e*3}x`)} ${this.Ae(`${e*3}w`)}`);}):(t.add(`${this.A(this.Tt(this.Ie.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.A(this.Tt(this.Ie.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.A(this.Tt(this.Ie.img,3))} 3x`)),[...t].join()}To(){return this.A()}get Eo(){return this.A("100x","100")}Ua(){let t=this.go;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.bo(e);}):this.bo(e);});}Ra({elNode:t,src:e,srcset:i}){e&&(t.src=e),i&&(t.srcset=i);}Ii({elNode:t}){this.$a(t),this.initAttributes(t);}Oi({src:t,srcset:e,elNode:i}){return new Promise((s,n)=>{this.Ii({elNode:i}),i.setAttribute(Vi,""),i.addEventListener("load",()=>{i.removeAttribute(Vi),s(i);}),i.addEventListener("error",()=>{n(false);}),this.Ra({elNode:i,src:t,srcset:e});})}async Pa(){if(this.$$("intersection")){this._&&(this.Ii({elNode:this.L}),this.appendChild(this.L)),this.initIntersection(this.Ie.img,async()=>{this._&&(this.L.src=this.Eo);try{await this.Oi({src:this.To(),srcset:this.wo(),elNode:this.F}),this._&&await this.L.remove(),this.appendChild(this.F);}catch{this._&&await this.L?.remove(),this.appendChild(this.F);}});return}try{this._&&(await this.Oi({src:this.Eo,elNode:this.L}),this.appendChild(this.L)),await this.Oi({src:this.To(),srcset:this.wo(),elNode:this.F}),this._&&await this.L?.remove(),this.appendChild(this.F);}catch{this._&&await this.L?.remove(),this.appendChild(this.F);}}init(){this.go?this.Ua():this.Pa();}};var Bi=class extends Ve{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",r=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=r?"lazy":"eager");});}};var Ki=null,Hi=class extends g{constructor(){super(...arguments);this.dialogEl=createRef();this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");};this.Da=()=>{this.closeDialog();};this.Va=t=>{this.Si=t.target;};this.Fa=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Si&&this.closeDialog();};this.Ht=({id:t})=>{t===this.id?(Ki=t,this.show(),this.emit(w.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.jt=({id:t})=>{t===this.id&&(this.hide(),this.emit(w.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Co=t=>{this.hide(),Ki===this.id&&this.emit(w.MODAL_CLOSE,{modalId:Ki,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(P.OPEN,this.Ht),this.modalManager?.subscribe(P.CLOSE,this.jt),this.modalManager?.subscribe(P.CLOSE_ALL,this.Co);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Si=void 0,this.modalManager?.unsubscribe(P.OPEN,this.Ht),this.modalManager?.unsubscribe(P.CLOSE,this.jt),this.modalManager?.unsubscribe(P.CLOSE_ALL,this.Co);}_a(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Da),this.dialogEl.value?.addEventListener("mousedown",this.Va),this.dialogEl.value?.addEventListener("mouseup",this.Fa);}render(){return html`<dialog ${ref(this._a)}>${this.yield("")}</dialog>`}};var to=o=>typeof o!="number"?0:Math.floor(o/1e3),eo=(o,{threshold:r})=>{let{secureExpire:t}=o,e=to(Date.now()),i=Number(t),s=to(r);return e+s>=i};var Fe=class{constructor(r){this.Et=null;this.s=r;}a(...r){this.s.debugPrint("[secure-uploads]",...r);}async getSecureToken(){let{secureSignature:r,secureExpire:t,secureUploadsSignatureResolver:e}=this.s.cfg;if((r||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this.Et||eo(this.Et,{threshold:this.s.cfg.secureUploadsExpireThreshold})){this.Et?this.a("Secure signature is expired. Resolving a new one..."):this.a("Secure signature is not set yet.");try{let i=await e();i?!i.secureSignature||!i.secureExpire?console.error("Secure signature resolver returned an invalid result:",i):(this.a("Secure signature resolved:",i),this.a("Secure signature will expire in",new Date(Number(i.secureExpire)*1e3).toISOString()),this.Et=i):(this.a("Secure signature resolver returned nothing."),this.Et=null);}catch(i){console.error("Secure signature resolving failed. Falling back to the previous one.",i),this.s.telemetryManager.sendEventError(i,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Et}return r&&t?(this.a("Secure signature and expire are set. Using them...",{secureSignature:r,secureExpire:t}),{secureSignature:r,secureExpire:t}):null}};var ji=(o,r)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:r.l10n("some-files-were-not-uploaded")}};var Gi=(o,r)=>{let t=o.totalCount,e=r.cfg.multiple?r.cfg.multipleMin:0,i=r.cfg.multiple?r.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:r.l10n("files-count-limit-error-too-few",{min:e,max:i,total:t}),payload:{total:t,min:e,max:i}};if(i&&t>i)return {type:"TOO_MANY_FILES",message:r.l10n("files-count-limit-error-too-many",{min:e,max:i,total:t}),payload:{total:t,min:e,max:i}}};var wn=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},Tn=()=>"capture"in document.createElement("input"),En=()=>({safariDesktop:wn()}),Cn=()=>({htmlMediaCapture:Tn()}),io=En(),Ot=Cn();var ae="image/*",Wi="video/*",xn=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],kn=()=>io.safariDesktop?[ae]:[ae,...xn],le=kn(),_e=o=>o?o.filter(r=>typeof r=="string").flatMap(r=>V(r)):[],Zi=(o,r)=>r.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),ro=(o,r)=>r.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),oo=o=>{let r=o?.type;return r?Zi(r,le):false};var qi=(o,r)=>{let t=r.cfg.imgOnly,e=r.cfg.accept,i=_e([...t?le:[],e]);if(!i.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=Zi(s,i),l=ro(n,i);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:r.l10n("file-type-not-allowed"),payload:{entry:o}}};var Xi=(o,r)=>{let t=r.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:r.l10n("images-only-accepted"),payload:{entry:o}}};var at=1e3,St=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),ce=o=>Math.ceil(o*100)/100,so=(o,r=St.AUTO)=>{let t=r===St.AUTO;if(r===St.BYTE||t&&o<at**1){let i=$e("en-US",o)==="one"?"byte":"bytes";return `${o} ${i}`}return r===St.KB||t&&o<at**2?`${ce(o/at**1)} KB`:r===St.MB||t&&o<at**3?`${ce(o/at**2)} MB`:r===St.GB||t&&o<at**4?`${ce(o/at**3)} GB`:r===St.TB||t&&o<at**5?`${ce(o/at**4)} TB`:`${ce(o/at**5)} PB`};var Qi=(o,r)=>{let t=r.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:r.l10n("files-max-size-limit-error",{maxFileSize:so(t)}),payload:{entry:o}}};var Yi=(o,r)=>{let{internalId:t}=o;if(!r.l.hasItem(t))return;let i=r.l.read(t)?.getValue("uploadError");if(!i)return;if(i instanceof UploadError)return {type:"UPLOAD_ERROR",message:i.message,payload:{entry:o,error:i}};if(i instanceof NetworkError)return {type:"NETWORK_ERROR",message:i.message,payload:{entry:o,error:i}};let s=i instanceof Error?i:new Error("Unknown error",{cause:i});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}};var _t={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},Sn=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Ne=class{constructor(r){this.Na=[Xi,qi,Qi,Yi];this.za=[Gi,ji];this.yt=new Queue(20);this.Ba=E(()=>{this.e.isConnected&&this.yt.run();},500);this.Oe=new Map;this.e=r,this.l=this.e.uploadCollection;let t=E(()=>{this.e.isConnected&&(this.runFileValidators("change"),this.runCollectionValidators());},0);this.e.subConfigValue("maxLocalFileSizeBytes",t),this.e.subConfigValue("multipleMin",t),this.e.subConfigValue("multipleMax",t),this.e.subConfigValue("multiple",t),this.e.subConfigValue("imgOnly",t),this.e.subConfigValue("accept",t),this.e.subConfigValue("validationConcurrency",e=>{this.yt.concurrency=e;});}runFileValidators(r,t){let e=t??this.l.items();for(let i of e){let s=this.l.read(i);s&&this.Ka(s,r);}}runCollectionValidators(){let r=this.e.api.getOutputCollectionState(),t=[];for(let e of [...this.za,...this.e.cfg.collectionValidators])try{let i=e(r,this.e.api);if(!i)continue;i&&(t.push(this.xo(i)),i.message||console.warn(_t.MISSING_ERROR_MESSAGE));}catch(i){console.warn(_t.COLLECTION_VALIDATION_FAILED,i);}this.e.$["*collectionErrors"]=t,t.length>0&&this.e.emit(w.COMMON_UPLOAD_FAILED,()=>this.e.api.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(r){let t=this.Oe.get(r.uid);t&&(t.abortController?.abort(),this.Oe.delete(r.uid));}async Ka(r,t){let e=this.ko(r),i=e.promise??Promise.resolve(),s=(async()=>{if(await i,!this.e.isConnected)return;let n=this.Ha(r,t);if(n.length===0)return;r.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let a=this.e.api.getOutputItem(r.uid),l=new AbortController;e.abortController=l;let c=this.e.cfg.validationTimeout,d=this.Ao(),p=new Set(n.map(m=>m.validator)),f=[];for(let m of d)if(!p.has(m.validator)){let k=e.lastErrorThrownByValidator.get(m.validator);k&&f.push(k);}let v=n.map(m=>async()=>{if(!this.e.isConnected)return;let k=setTimeout(()=>{e.skippedValidators.add(m.validator),l.abort(),console.warn(_t.FILE_VALIDATION_TIMEOUT);},c);try{let A=await m.validator(a,this.e.api,{signal:l.signal});if(!A||l.signal.aborted){e.lastErrorThrownByValidator.set(m.validator,void 0);return}let R=this.xo(A);e.lastErrorThrownByValidator.set(m.validator,R),f.push(R),A.message||console.warn(_t.MISSING_ERROR_MESSAGE);}catch(A){l.signal.aborted||(e.skippedValidators.add(m.validator),console.warn(_t.FILE_VALIDATION_FAILED,A),this.e.telemetryManager.sendEventError(A,`file validator. ${_t.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(k),m.runOn!=="change"&&e.skippedValidators.add(m.validator);}});if(this.Ba(),await this.yt.add(async()=>{r.setValue("isQueuedForValidation",false),await Promise.all(v.map(m=>m())).catch(()=>{});},{autoRun:false}),l.signal.aborted){r.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}r.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:f});})();e.promise=s;try{await s;}finally{e.promise===s&&(e.promise=void 0);}}xo(r){return {...r,type:r.type??"CUSTOM_ERROR"}}ko(r){let t=this.Oe.get(r.uid);if(t)return t;let e={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Oe.set(r.uid,e),e}Ao(){return [...this.Na,...this.e.cfg.fileValidators].map(Sn)}Ha(r,t){let e=this.ko(r);return this.Ao().filter(i=>!e.skippedValidators.has(i.validator)).filter(i=>i.runOn===t)}};var no="[Typed State] Wrong property name: ",ze=class{constructor(r){this.W=q.generateFastUid(),this.T=M.registerCtx(r,this.W);}get uid(){return this.W}setValue(r,t){if(!this.T.has(r)){console.warn(`${no}${String(r)}`);return}this.T.read(r)!==t&&this.T.pub(r,t);}setMultipleValues(r){for(let[t,e]of Object.entries(r))this.setValue(t,e);}getValue(r){return this.T.has(r)||console.warn(`${no}${String(r)}`),this.T.read(r)}subscribe(r,t){return this.T.sub(r,t)}destroy(){M.deleteCtx(this.W);}};var Be=class o{constructor(r){this.Z=Object.create(null);this.Se=new Set;this.Me=new Set;this.N=new Set;this.Mi=new Set;this.Li=new Set;this.Ct=new Set;this.So=r.initialValue,this.W=q.generateFastUid(),this.T=M.registerCtx({},this.W),this.Io=r.watchList||[];let t=Object.create(null);this.Oo=(e,i)=>{this.Gt&&window.clearTimeout(this.Gt),t[e]||(t[e]=new Set),t[e].add(i),this.Gt=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Se.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Mo();},r.handler&&this.observeCollection(r.handler);}static{this.ja=1e4;}g(){this.Wt&&window.clearTimeout(this.Wt),this.Wt=window.setTimeout(()=>{let r=new Set(this.Li),t=new Set(this.Mi);this.Li.clear(),this.Mi.clear();for(let e of this.Me)e?.([...this.N],r,t);this.Mo();});}Mo(){this.Ct.size!==0&&(this.Zt&&window.clearTimeout(this.Zt),this.Zt=window.setTimeout(()=>{let r=[...this.Ct];this.Ct.clear();for(let t of r)t.destroy();},o.ja));}observeCollection(r){return this.Me.add(r),this.N.size>0&&this.g(),()=>{this.unobserveCollection(r);}}unobserveCollection(r){this.Me.delete(r);}add(r){let t=new ze(this.So);for(let[e,i]of Object.entries(r))t.setValue(e,i);return this.N.add(t.uid),this.g(),this.T.add(t.uid,t),this.Li.add(t),this.Io.forEach(e=>{this.Z[t.uid]||(this.Z[t.uid]=[]),this.Z[t.uid]?.push(t.subscribe(e,()=>{this.Oo(e,t.uid);}));}),t.uid}hasItem(r){return this.N.has(r)}read(r){return this.T.read(r)??null}readProp(r,t){let e=this.read(r);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${r} not found`);return e.getValue(t)}publishProp(r,t,e){let i=this.read(r);if(!i)throw new Error(`TypedCollection#publishProp: Item with id ${r} not found`);i.setValue(t,e);}remove(r){let t=this.read(r);t&&(this.Mi.add(t),this.Ct.add(t)),this.N.delete(r),this.g(),this.T.pub(r,void 0),this.Z[r]?.forEach(e=>{e.remove();}),delete this.Z[r];}clearAll(){this.N.forEach(r=>{this.remove(r);});}observeProperties(r){return this.Se.add(r),()=>{this.unobserveProperties(r);}}unobserveProperties(r){this.Se.delete(r);}findItems(r){let t=[];return this.N.forEach(e=>{let i=this.read(e);i&&r(i)&&t.push(e);}),t}items(){return [...this.N]}get size(){return this.N.size}destroy(){this.Gt&&window.clearTimeout(this.Gt),this.Wt&&window.clearTimeout(this.Wt),this.Zt&&window.clearTimeout(this.Zt);for(let r of this.Ct)r.destroy();this.Ct.clear(),M.deleteCtx(this.W),this.Se=new Set,this.Me=new Set;for(let r of Object.keys(this.Z))this.Z[r]?.forEach(t=>{t.remove();}),delete this.Z[r];}};var y=Object.freeze({PHOTO:"photo",VIDEO:"video"}),J=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Ji=o=>({isVideoRecordingEnabled:G(o.cameraModes).includes(y.VIDEO),isPhotoEnabled:G(o.cameraModes).includes(y.PHOTO)});var ao="active",Nt="___ACTIVITY_IS_ACTIVE___",lo,h=class o extends(lo=g,lo){constructor(){super(...arguments);this.historyTracked=false;this.init$=Li(this);this.Ga=E(this.Wa.bind(this),10);}Lo(){let t=o.qt.get(this);this[Nt]=false,this.removeAttribute(ao),t?.deactivateCallback?.();}Za(){let t=o.qt.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Nt]=true,this.setAttribute(ao,""),t?.activateCallback?.(),this.Ga(),this.emit(w.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Nt]?this.Lo():this.activityType===t&&!this[Nt]&&this.Za();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}Wa(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}qa(){return !!this.activityType&&o.qt.has(this)}static{this.qt=new Map;}get isActivityActive(){return !!this[Nt]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:i,onDeactivate:s}=e;o.qt.set(this,{activateCallback:i,deactivateCallback:s});}Xa(){this.isActivityActive&&this.Lo(),o.qt.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.qa()&&this.Xa();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(i=>i instanceof o&&i.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let i=!!e;e&&(i=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=i?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};h.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});function Ke(o,r){for(let t in r)t.includes("-")?o.style.setProperty(t,String(r[t])):o.style[t]=String(r[t]);}var Mn=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ln=new RegExp(`^/?(${Mn.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),co=({url:o,cdnBase:r})=>{let t=new URL(r),e=new URL(re),i=new URL(o);if(t.host!==i.host&&e.host!==i.host)return null;let s=Ln.exec(i.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var lt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),tr=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),L=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...tr,...lt});function uo(o){let r=new Map;return (...e)=>{let i=JSON.stringify(e);if(r.has(i))return r.get(i);let s=o(...e);return r.set(i,s),s}}var po=new Set;function He(o){po.has(o)||(po.add(o),console.warn(o));}function $n(o){let r=false;return setTimeout(()=>{r=true;},0),e=>((...i)=>(r&&He(o),e(...i)))}function ho(o){let r={},t={progress:()=>o.$["*commonProgress"],errors:()=>o.$["*collectionErrors"],group:()=>o.$["*groupInfo"],totalCount:()=>o.uploadCollection.size,failedCount:()=>r.failedEntries.length,successCount:()=>r.successEntries.length,uploadingCount:()=>r.uploadingEntries.length,status:()=>r.isFailed?"failed":r.isUploading?"uploading":r.isSuccess?"success":"idle",isSuccess:()=>r.allEntries.length>0&&r.errors.length===0&&r.successEntries.length===r.allEntries.length,isUploading:()=>r.allEntries.some(i=>i.status==="uploading"),isFailed:()=>r.errors.length>0||r.failedEntries.length>0,allEntries:()=>o.getOutputData(),successEntries:()=>r.allEntries.filter(i=>i.status==="success"),failedEntries:()=>r.allEntries.filter(i=>i.status==="failed"),uploadingEntries:()=>r.allEntries.filter(i=>i.status==="uploading"),idleEntries:()=>r.allEntries.filter(i=>i.status==="idle")},e=$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[i,s]of Object.entries(t)){let n=i,l=uo(e(s));Object.defineProperty(r,n,{get:l,enumerable:true});}return r}var je=class{constructor(r){this.addFileFromUrl=(r,{silent:t,fileName:e,source:i}={})=>{let s=this.l.add({externalUrl:r,fileName:e??null,silent:t??false,source:i??L.API});return this.getOutputItem(s)};this.addFileFromUuid=(r,{silent:t,fileName:e,source:i}={})=>{let s=this.l.add({uuid:r,fileName:e??null,silent:t??false,source:i??L.API});return this.getOutputItem(s)};this.addFileFromCdnUrl=(r,{silent:t,fileName:e,source:i}={})=>{let s=co({url:r,cdnBase:this.cfg.cdnCname});if(!s)throw new Error("Invalid CDN URL");let n=this.l.add({uuid:s.uuid,cdnUrl:r,cdnUrlModifiers:s.cdnUrlModifiers,fileName:e??s.filename??null,silent:t??false,source:i??L.API});return this.getOutputItem(n)};this.addFileFromObject=(r,{silent:t,fileName:e,source:i,fullPath:s}={})=>{let n=this.l.add({file:r,isImage:oo(r),mimeType:r.type,fileName:e??r.name,fileSize:r.size,silent:t??false,source:i??L.API,fullPath:s??null});return this.getOutputItem(n)};this.removeFileByInternalId=r=>{if(!this.l.read(r))throw new Error(`File with internalId ${r} not found`);this.l.remove(r);};this.uploadAll=()=>{let r=this.l.items().filter(t=>{let e=this.l.read(t);return e?!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")&&e.getValue("errors").length===0&&!e.getValue("isValidationPending")&&!e.getValue("isQueuedForValidation"):false});r.length!==0&&(this.t.$["*uploadTrigger"]=new Set(r),this.t.emit(w.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(r={})=>{let t=ht(_e([this.cfg.accept??"",...this.cfg.imgOnly?le:[]])),e="uploadcare-file-input",i=document.createElement("input");if(i.setAttribute(e,""),Ke(i,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),i.type="file",i.multiple=this.cfg.multiple,r.captureCamera){i.capture=this.cfg.cameraCapture;let{isPhotoEnabled:s,isVideoRecordingEnabled:n}=Ji(this.cfg);r.modeCamera===y.PHOTO&&s?i.accept=ae:r.modeCamera===y.VIDEO&&n?i.accept=Wi:i.accept=[ae,n&&Wi].filter(Boolean).join(",");}else i.accept=t;i.addEventListener("change",()=>{i.files&&([...i.files].forEach(s=>{this.addFileFromObject(s,{source:r.captureCamera?L.CAMERA:L.LOCAL});}),this.t.modalManager?.open(h.activities.UPLOAD_LIST),this.t.$["*currentActivity"]=h.activities.UPLOAD_LIST,i.remove());},{once:true}),document.querySelectorAll(`[${e}]`).forEach(s=>{s.remove();}),document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click"));};this.initFlow=(r=false)=>{if(this.l.size>0&&!r)this.t.modalManager?.open(h.activities.UPLOAD_LIST),this.t.pub("*currentActivity",h.activities.UPLOAD_LIST);else if(this.$o?.length===1){let t=this.$o[0];if(t==="local"){this.t.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.openSystemDialog();return}if(t==="camera"&&Ot.htmlMediaCapture){let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Ji(this.cfg);if(n&&a){this.t.pub("*currentActivity",h.activities.START_FROM);return}else if(n||a){this.openSystemDialog({captureCamera:true,modeCamera:n?y.PHOTO:y.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:y.PHOTO});}let e=this.t.blocksRegistry,i=n=>"type"in n&&n.type===t;[...e].find(i)?.activate(),this.t.$["*currentActivity"]&&this.t.modalManager?.open(this.t.$["*currentActivity"]);}else this.t.modalManager?.open(h.activities.START_FROM),this.t.pub("*currentActivity",h.activities.START_FROM);};this.doneFlow=()=>{this.t.set$({"*currentActivity":this.t.doneActivity,"*history":this.t.doneActivity?[this.t.doneActivity]:[]}),this.t.$["*currentActivity"]||this.t.modalManager?.closeAll();};this.setCurrentActivity=(r,...t)=>{if(this.t.hasBlockInCtx(e=>e.activityType===r)){this.t.set$({"*currentActivityParams":t[0]??{},"*currentActivity":r});return}console.warn(`Activity type "${r}" not found in the context`);};this.getCurrentActivity=()=>this.t.$["*currentActivity"];this.setModalState=r=>{if(r&&!this.t.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}r?this.t.modalManager?.open(this.t.$["*currentActivity"]):(this.t.modalManager?.close(this.t.$["*currentActivity"]),this.t.$["*currentActivity"]=null);};this.t=r;}get l(){return this.t.uploadCollection}get cfg(){return this.t.cfg}get l10n(){return this.t.l10n.bind(this.t)}removeAllFiles(){this.l.clearAll();}getOutputItem(r){let t=M.getCtx(r);if(!t)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${r}" not found in the upload collection`);let e=t.store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return {uuid:i?.uuid??e.uuid??null,internalId:r,name:i?.originalFilename??e.fileName,size:i?.size??e.fileSize,isImage:i?.isImage??e.isImage,mimeType:i?.mimeType??e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:e.cdnUrl??i?.cdnUrl??null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i??null,metadata:e.metadata??i?.metadata??null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",isValidationPending:e.isValidationPending,errors:e.errors,status:s,source:e?.source}}getOutputCollectionState(){return ho(this.t)}get $o(){let r=[];return this.cfg.sourceList&&(r=V(this.cfg.sourceList)),r}};var mo={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var ue=33.333333333333336,b=1,er=24,fo=6;function Ct(o,r){for(let[t,e]of Object.entries(r))o.setAttributeNS(null,t,e.toString());}function X(o,r={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return Ct(t,r),t}function vo(o,r,t){let{x:e,y:i,width:s,height:n}=o,a=r.includes("w")?0:1,l=r.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,p=[e+a*s+1.5*c,i+l*n+1.5*d-24*t*d],f=[e+a*s+1.5*c,i+l*n+1.5*d],v=[e+a*s-24*t*c+1.5*c,i+l*n+1.5*d],m=`M ${p[0]} ${p[1]} L ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,k=[f[0],f[1]];return {d:m,center:k}}function go(o,r,t){let{x:e,y:i,width:s,height:n}=o,a=r==="n"||r==="s",l=r==="w"||r==="e",c=a?.5:r==="w"?0:1,d=l?.5:r==="n"?0:1,p=r==="w"?-1:r==="e"?1:0,f=r==="n"?-1:r==="s"?1:0,v,m;a?(v=[e+c*s-34*t/2,i+d*n+1.5*f],m=[e+c*s+34*t/2,i+d*n+1.5*f]):(v=[e+c*s+1.5*p,i+d*n-34*t/2],m=[e+c*s+1.5*p,i+d*n+34*t/2]);let k=`M ${v[0]} ${v[1]} L ${m[0]} ${m[1]}`,A=[(v[0]+m[0])/2,(v[1]+m[1])/2];return {d:k,center:A}}function yo(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function bo({rect:o,delta:[r,t],imageBox:e}){return Bt({...o,x:o.x+r,y:o.y+t},e)}function Bt(o,r){let{x:t}=o,{y:e}=o;return o.x<r.x?t=r.x:o.x+o.width>r.x+r.width&&(t=r.x+r.width-o.width),o.y<r.y?e=r.y:o.y+o.height>r.y+r.height&&(e=r.y+r.height-o.height),{...o,x:t,y:e}}function Un({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[,i]=r,{y:s,width:n,height:a}=o;s+=i,a-=i,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<b&&(a=b,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<b&&(n=b,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Rn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i]=r,{x:s,width:n,height:a}=o;s+=i,n-=i,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<b&&(a=b,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<b&&(n=b,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Pn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[,i]=r,{y:s,width:n,height:a}=o;a+=i,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<b&&(a=b,t&&(n=a*t),l=o.x+o.width/2-n/2),n<b&&(n=b,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Dn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i]=r,{x:s,width:n,height:a}=o;n+=i,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<b&&(a=b,t&&(n=a*t),l=o.y+o.height/2-a/2),n<b&&(n=b,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Vn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+i<e.x&&(i=e.x-n),a+s<e.y&&(s=e.y-a),n+=i,l-=i,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(i=c*t-l,l=l+i,n-=i,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<b&&(c=b,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<b&&(l=b,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Fn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+l+i>e.x+e.width&&(i=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=i,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(i=c*t-l,l+=i,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<b&&(c=b,t&&(l=c*t),a=o.y+o.height-c),l<b&&(l=b,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function _n({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+i<e.x&&(i=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=i,l-=i,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(i=c*t-l,l+=i,n-=i,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<b&&(c=b,t&&(l=c*t),n=o.x+o.width-l),l<b&&(l=b,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function Nn({rect:o,delta:r,aspectRatio:t,imageBox:e}){let[i,s]=r,{x:n,y:a,width:l,height:c}=o;return n+l+i>e.x+e.width&&(i=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=i,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(i=c*t-l,l+=i,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<b&&(c=b,t&&(l=c*t)),l<b&&(l=b,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function wo({direction:o,...r}){switch(o){case "n":return Un(r);case "w":return Rn(r);case "s":return Pn(r);case "e":return Dn(r);case "nw":return Vn(r);case "ne":return Fn(r);case "sw":return _n(r);case "se":return Nn(r);default:return r.rect}}function To(o,[r,t]){return o.x<=r&&r<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function Eo(o,r){return o.x>=r.x&&o.y>=r.y&&o.x+o.width<=r.x+r.width&&o.y+o.height<=r.y+r.height}function Co(o,r){return Math.abs(o.width/o.height-r)<.1}function Kt({width:o,height:r},t){let e=t/90%2!==0;return {width:e?r:o,height:e?o:r}}function xo(o,r,t){let e=o/r,i,s;e>t?(i=Math.round(r*t),s=r):(i=o,s=Math.round(o/t));let n=Math.round((o-i)/2),a=Math.round((r-s)/2);return n+i>o&&(i=o-n),a+s>r&&(s=r-a),{x:n,y:a,width:i,height:s}}function Ht(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function xt(o,r,t){return Math.min(Math.max(o,r),t)}var de=["free"],We=o=>{let r=V(o);if(!r||r.length===0)return [];let t=[];for(let e of r){let i=e.trim();if(!i)continue;let s=i.indexOf(":");if(s===-1&&!de.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}let n=Number(i.slice(0,s)),a=Number(i.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!de.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}t.push({id:q.generateFastUid(),type:"aspect-ratio",width:de.includes(i)?0:n,height:de.includes(i)?0:a,hasFreeform:de.includes(i)});}return t},ko=(o,r,t,e=.1)=>{let i=o/r,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,p=Math.abs(i-d);p<n&&(n=p,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(i-c)/c>e)return null}return s};function Ao(o){return getUserAgent({...o,libraryName:st,libraryVersion:nt})}var T=class o extends h{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Le=false;this.init$=$i(this);this.Ri=E(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.el(e);},300);this.Ja=(t,e,i)=>{if(this.isConnected){(e.size||i.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(w.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of i){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(w.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Po(),this.Ri();}};this.tl=t=>{if(!this.isConnected)return;this.Ri();let e=this.uploadCollection,i=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(i.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=i.filter(n=>t.fileInfo?.has(n)&&!!M.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",i);}),t.uploadProgress){for(let s of t.uploadProgress){let n=M.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Po();}if(t.isUploading)for(let s of t.isUploading){let n=M.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=M.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(w.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.il(),this.cfg.cloudImageEditorAutoOpen&&this.rl();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=M.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(w.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(w.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(w.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(w.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Po=()=>{let t=0,i=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));i.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=i.length?Math.round(t/i.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(w.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get Qa(){return this.hasBlockInCtx(t=>t instanceof o?t.Le&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.addSharedContextInstance("*uploadCollection",()=>new Be({initialValue:mo,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]}),{persist:true}),this.addSharedContextInstance("*secureUploadsManager",()=>new Fe(this)),this.addSharedContextInstance("*validationManager",()=>new Ne(this)),this.addSharedContextInstance("*publicApi",()=>new je(this)),!this.Qa&&this.couldBeCtxOwner&&this.Ya();}get validationManager(){return this.getSharedContextInstance("*validationManager")}get api(){return this.getSharedContextInstance("*publicApi")}getAPI(){return this.api}get uploadCollection(){return this.getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this.getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Le&&this.Uo(),this.Ri.cancel();}connectedCallback(){super.connectedCallback(),this.Le&&this.Ro();}Ya(){this.Le=true,this.Ro(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ro(){this.Uo(),this.$i=this.uploadCollection.observeCollection(this.Ja),this.Ui=this.uploadCollection.observeProperties(this.tl);}Uo(){this.Ui?.(),this.$i?.(),this.Ui=void 0,this.$i=void 0;}async el(t){let e=await this.getUploadClientOptions(),i=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await uploadFileGroup(i,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(w.GROUP_CREATED,a),this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}rl(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===h.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT,this.modalManager?.open(h.activities.CLOUD_IMG_EDIT));}il(){let t=We(this.cfg.cropPreset);if(t){let[e]=t,i=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of i){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=xo(a,l,c),p=z(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:p,cdnUrl:D(f,p)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(v=>v.activityType===h.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT,this.modalManager?.open(h.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let i=this.api.getOutputItem(t);return await e(i)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ao,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(i=>this.api.getOutputItem(i))}};T.extSrcList=Object.freeze({...lt});T.sourceTypes=Object.freeze({...L});var ir=class extends T{constructor(){super(...arguments);this.f=null;this.$e=null;}Do(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Ke(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.f=this.Do(),this.appendChild(this.f),this.sub("*collectionState",t=>{if(!t)return;if(!this.$e){let n=document.createElement("div");this.appendChild(n),this.$e=n;}if(!this.f){let n=this.Do();this.appendChild(n),this.f=n;}if(this.$e.innerHTML="",t.status==="uploading"||t.status==="idle"){this.f.value="",this.f.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.f.value="",this.f.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.f.value=e.cdnUrl??"",this.f.setCustomValidity("");return}let i=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&i.length===1&&i[0]){this.f.value=i[0],this.f.setCustomValidity("");return}this.f.remove(),this.f=null;let s=new DocumentFragment;for(let n of i){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=n,s.appendChild(a);}this.$e.replaceChildren(s);},false);}};var rr=class extends g{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",r=>{this.toggleAttribute("hidden",!!r);});}render(){return html`<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 pe=class extends g{constructor(){super(...arguments);this.value=0;this.visible=true;this.I=0;this.Ue=createRef();this.Vo=()=>{let t=this.Ue.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.I>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.I=this.Pi(this.value),this.Di(),this.Ue.value?.addEventListener("animationiteration",this.Vo);}updated(t){if(super.updated(t),t.has("value")){let e=this.Pi(this.value);if(!this.visible)this.I=e;else {let i=Math.max(this.I,e);i!==this.I&&(this.I=i,this.Di());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Di():this.I=this.Pi(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Ue.value?.removeEventListener("animationiteration",this.Vo);}Pi(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Di(){this.visible&&this.style.setProperty("--l-progress-value",this.I.toString());}render(){return html`<div ${ref(this.Ue)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};u([property({type:Number})],pe.prototype,"value",2),u([property({type:Boolean,reflect:true})],pe.prototype,"visible",2);var he=class extends T{constructor(){super();this.U=false;this.xt=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Vi=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.U=t;}),this.sub("*commonProgress",t=>{this.xt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.U?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Vi?.(),this.Vi=void 0;}render(){return html`<uc-progress-bar .value=${this.xt} .visible=${this.U}></uc-progress-bar>`}};u([state()],he.prototype,"U",2),u([state()],he.prototype,"xt",2);var jt=class extends g{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.ol=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return html`<select @change=${this.ol} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>html`<option value=${t.value}>${t.text}</option>`)}</select>`}};u([property({type:String,attribute:false})],jt.prototype,"value",2),u([property({type:Boolean,reflect:true})],jt.prototype,"disabled",2),u([property({type:Array,attribute:false})],jt.prototype,"options",2);var Xn="src-type-",Gt=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Fi={};this._i="default";this.Ni="";}sl(){this.kt({type:L.LOCAL,activate:()=>(this.api.openSystemDialog(),false)}),this.kt({type:L.URL,activity:h.activities.URL,textKey:"from-url"}),this.kt({type:L.CAMERA,activity:h.activities.CAMERA,activate:()=>{let t=Ot.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t}}),this.kt({type:"draw",activity:h.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(tr))this.kt({type:t,activity:h.activities.CAMERA,activate:()=>{let e=Ot.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?y.PHOTO:y.VIDEO}),!e}});for(let t of Object.values(lt))this.kt({type:t,activity:h.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.sl(),this.type&&this.Fo(this.type);}kt(t){this.Fi[t.type]=t;}activate(){if(!this.type)return;let t=this.Fi[this.type];if(!t)return;let{activity:e,activate:i,activityParams:s={}}=t;(i?i():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}Fo(t){let e=this.Fi[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:i=t,icon:s=t}=e;this.Ni=`${Xn}${i}`,this._i=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.Fo(this.type):(this.Ni="",this._i="default"));}render(){return html`<button type="button" @click=${this.activate}><uc-icon name=${this._i}></uc-icon><div class="uc-txt">${this.l10n(this.Ni)}</div></button>`}};u([property({type:String})],Gt.prototype,"type",2),u([state()],Gt.prototype,"_i",2),u([state()],Gt.prototype,"Ni",2);var Ze=class extends g{constructor(){super(...arguments);this._o=[];this.b=[];this.zo=[];}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this._o=V(t),this.No();}),this.subConfigValue("cameraModes",t=>{this.b=G(t),this.No();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}No(){let t=[];for(let e of this._o){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&Ot.htmlMediaCapture){let i=this.b.length?this.b.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...i);continue}t.push(e);}this.zo=t;}render(){return html`${this.zo.map(t=>html`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};u([state()],Ze.prototype,"zo",2);var sr=class extends g{render(){return html`<div class="uc-spinner"></div>`}};var it="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Mt(o){let r=new Image;return {promise:new Promise((i,s)=>{r.src=o,r.onload=()=>i(),r.onerror=n=>s(n);}),image:r,cancel:()=>{r.naturalWidth===0&&(r.src=it);}}}function me(o){let r=[];for(let s of o){let n=Mt(s);r.push(n);}let t=r.map(s=>s.image);return {promise:Promise.allSettled(r.map(s=>s.promise)),images:t,cancel:()=>{r.forEach(s=>{s.cancel();});}}}function nr(o,r=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let i=new Image,s=new Promise((n,a)=>{i.onload=()=>{let l=i.height/i.width;l>1?(t.width=r,t.height=r*l):(t.height=r,t.width=r/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(i,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},i.onerror=l=>{a(l);};});return i.src=URL.createObjectURL(o),s}var Wt=class extends T{constructor(){super(...arguments);this.Re=new Set;this.entry=null;}withEntry(t){return (...e)=>{let i=this.entry;if(!i){console.warn("No entry found");return}return t(i,...e)}}subEntry(t,e){this.withEntry((i,s,n)=>{let a=i.subscribe(s,l=>{this.isConnected&&n(l);});this.Re.add(a);})(t,e);}reset(){for(let t of this.Re)t.remove();this.Re=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.Re=new Set;}};function Jn(o){let r=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(r)}function qe(o="hsl(209, 21%, 65%)",r=32,t=32){return Jn(`<svg width="${r}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}var ia=3e3,Zt=class extends Wt{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.q="";this.Bo=false;this.Pe=null;this.Ko=false;this.nl=this.cfg.filesViewMode;this.Ho=this.withEntry(async(t,e=false)=>{let i=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.al(e);if(i&&s&&n){let d=await this.proxyUrl(D(Tt(this.cfg.cdnCname,n),z(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:p}=Mt(d);p.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let v=await nr(f,l);t.setValue("thumbUrl",v);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let v=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(v));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await nr(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(p));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",qe(d));}});this.De=E(this.Ho.bind(this),100);}al(t=false){t&&(this.Pe=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Pe?.height||0),10),parseInt(String(this?.Pe?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,ia)}ll(t,e){return new Promise((i,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=it,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),i();},d=p=>{a(),s(p);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Bi(){this.zi?.cancel(),this.zi=void 0;}cl(t){if(this.Bi(),!t){this.q&&(this.q="");return}if(t===this.q)return;let e=new AbortController,i={controller:e,cancel:()=>{e.abort(),i.rafId!==void 0&&window.cancelAnimationFrame(i.rafId);}};this.zi=i,this.ll(t,e.signal).then(()=>{e.signal.aborted||(i.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.q=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}Ve(t=false){if(this.entry){if(t){this.Ho(true);return}this.Ko&&this.De();}}firstUpdated(t){super.firstUpdated(t),this.jo();}updated(t){super.updated(t),t.has("uid")&&this.jo();}Xt(t){let[e]=t;e&&(this.Ko=e.isIntersecting,e.isIntersecting&&(this.Pe=e.boundingClientRect,this.Ve(),this.i?.disconnect()),e.intersectionRatio===0&&this.De.cancel());}reset(){super.reset(),this.De.cancel(),this.Bi(),this.q&&(this.q="");}jo(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let i=()=>{this.Ve();};this.subEntry("fileInfo",s=>{s?.isImage&&i();}),this.subEntry("thumbUrl",s=>{this.cl(s??void 0);}),this.subEntry("cdnUrlModifiers",i),this.Ve(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.Bo&&(this.nl==="list"&&this.Ve(true),this.Bo=true);}),this.setAttribute("role","img");}connectedCallback(){super.connectedCallback(),this.i?.disconnect(),this.i=new window.IntersectionObserver(this.Xt.bind(this),{threshold:.1}),this.i.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.De.cancel(),this.Bi(),this.i?.disconnect();}render(){return html`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.q||it} alt="" ?hidden=${!this.q} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};u([property({type:String})],Zt.prototype,"badgeIcon",2),u([property({type:String})],Zt.prototype,"uid",2),u([state()],Zt.prototype,"q",2);var ar=class extends h{};var lr=class extends h{constructor(){super(...arguments);this.historyTracked=true;this.activityType=h.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return html`<div class="uc-content">${this.yield("")}</div>`}};var cr=class extends T{constructor(){super(...arguments);this.Go=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=w;}initCallback(){super.initCallback(),this.Go=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Go?.();}};var qt=(o,r)=>{let t=false,e,i=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-i>=r&&(o(...n),i=Date.now());},Math.max(r-(Date.now()-i),0))):(o(...n),i=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var rt=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=h.activities.UPLOAD_LIST;this.Wo=false;this.Zo=false;this.qo=false;this.Ki=false;this.Hi=false;this.Fe=null;this.Xo=false;this.ji=null;this.Qo=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.Gi=()=>{this.emit(w.UPLOAD_CLICK),this.api.uploadAll(),this.z();};this.Wi=()=>{this.emit(w.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.B=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.z=qt(()=>{this.isConnected&&(this.pl(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get ul(){return this.ji?this.dl(this.ji):""}pl(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(v=>v.isValidationPending).length},i=!t.errors.some(v=>v.type==="TOO_MANY_FILES"||v.type==="TOO_FEW_FILES"),s=t.errors.some(v=>v.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(v=>v.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,p=false;if(e.total-e.succeed-e.uploading-e.failed>0&&i&&l)c=true;else {d=true;let v=this.cfg.groupOutput?!!t.group:true;p=e.total===e.succeed&&i&&l&&v;}this.Wo=d,this.Zo=p,this.qo=c,this.Hi=e.total===0||!s&&!n,this.Ki=!n||this.cfg.multiple,this.Xo=e.total>0,this.ji=e;}dl(t){let e=i=>{let s=t[i];return i==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${i}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.z),this.subConfigValue("multipleMin",this.z),this.subConfigValue("multipleMax",this.z),this.sub("*groupInfo",t=>{t&&this.z();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.z),this.uploadCollection.observeCollection(this.z),this.sub("*collectionErrors",t=>{let e=t.filter(i=>i.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Fe=null;return}this.Fe=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.z),this.uploadCollection.unobserveCollection(this.z));}render(){return html`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.ul}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Xo}>${this.yield("empty",html`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${repeat(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>html`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Qo} ?disabled=${!this.Hi} ?hidden=${!this.Ki} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Fe} >${this.Fe??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.B}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Ki} ?disabled=${!this.Hi} @click=${this.Qo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.qo} @click=${this.Gi} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Wo} ?disabled=${!this.Zo} @click=${this.Wi} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};u([state()],rt.prototype,"Wo",2),u([state()],rt.prototype,"Zo",2),u([state()],rt.prototype,"qo",2),u([state()],rt.prototype,"Ki",2),u([state()],rt.prototype,"Hi",2),u([state()],rt.prototype,"Fe",2),u([state()],rt.prototype,"Xo",2),u([state()],rt.prototype,"ji",2);var Xe=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.URL;this.Zi={importDisabled:true};this.X=createRef();this.qi=t=>{let e=t.target?.value??"";this.Zi={importDisabled:!e};};this.Gi=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let i=this.X.value?.value?.trim();i&&(this.api.addFileFromUrl(i,{source:L.URL}),this.modalManager?.open(h.activities.UPLOAD_LIST),this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:()=>{let t=this.X.value;t&&(t.value="",t.focus()),this.Zi={importDisabled:true};}});}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.Gi}><label><input ${ref(this.X)} placeholder="https://" class="uc-url-input" type="text" @input=${this.qi} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.Zi.importDisabled} >${this.l10n("upload-url")}</button></form>`}};u([state()],Xe.prototype,"Zi",2);var Uo=()=>typeof navigator.permissions<"u";var da={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},pa=["camera","microphone"];function Je(o){let r=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${r}:${t}`}var Ro="image/jpeg",Po="video/webm",O=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.CAMERA;this._e=null;this.Xi=false;this.Qt=[];this.R=null;this.P=null;this.Ne=null;this.ze=null;this.c=null;this.Yt={};this.D=null;this.t=null;this.At=[];this.It=[];this.hl={};this.Be=[];this.Ke=null;this.Yo=()=>{this.Jo(),this.Jt="pause";};this.ts=()=>{this.Jt="play",this.ml();};this.te=createRef();this.nt=createRef();this.v=createRef();this.es=createRef();this.is=0;this.rs=0;this.os=null;this.He=true;this.je=true;this.fl=Uo();this.ss=[];this.at=true;this.Qi="";this.Ot=true;this.lt=true;this.St=true;this.ns=[];this.ct=true;this.Yi=true;this.ut=true;this.K=true;this.dt=true;this.Mt="camera-full";this.Jt="play";this.as="microphone";this.Ge="uc-shot-btn uc-camera-action";this.vl=()=>{if(this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.c}}}),this.c===y.PHOTO&&this.gl(),this.c===y.VIDEO){if(this.R?.state==="recording"){this.ls();return}this.yl();}};this.bl=t=>{let e=t.target;e&&(this.ze=e.value,this.Lt());};this.wl=t=>{let e=t.target;e&&(this.Ne=e.value,this.Lt());};this.Tl=()=>{this.Lt();};this.El=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.c}}}),this.vl();};this.Cl=()=>{this.xl();};this.kl=()=>{this.Al();};this.Il=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.c}}}),this.Ol();};this.Sl=()=>{this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.c}}}),this.Ml();};this.cs=t=>{let i=t.currentTarget?.getAttribute("data-id");i&&this.us(i);};this.ds=()=>{let t=Math.floor((performance.now()-this.is+this.rs)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.te.value;s&&(s.textContent=Je(e)),this.ls();return}let i=this.te.value;i&&(i.textContent=Je(e));}else {let e=this.te.value;e&&(e.textContent=Je(t));}this.$t=requestAnimationFrame(this.ds);};this.Ll=()=>{this.is=performance.now(),this.rs=0,this.ds();};this.ps=()=>{this.$t&&cancelAnimationFrame(this.$t);};this.Jo=()=>{let t=this.v.value;if(!t)return;let e=t.currentTime,i=t.duration||1,s=this.nt.value;s&&(s.style.transform=`scaleX(${e/i})`);let n=this.te.value;n&&(n.textContent=Je(e)),this.$t=requestAnimationFrame(this.Jo);};this.ml=()=>{this.$t&&cancelAnimationFrame(this.$t);};this.$t=null;this.yl=()=>{try{this.Qt=[],this.Yt={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Yt.mimeType=t:MediaRecorder.isTypeSupported(Po)?this.Yt.mimeType=Po:this.Yt.mimeType="video/mp4",this.P&&(this.R=new MediaRecorder(this.P,this.Yt),this.R.start(),this.R.addEventListener("dataavailable",e=>{this.Qt.push(e.data);}),this.Ll(),this.classList.add("uc-recording"),this.ee(J.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.ls=()=>{this.R?.addEventListener("stop",()=>{this.$l(),this.ps(),this.ee(J.STOP);}),this.R?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.c}}});};this.xl=()=>{if(this.R?.state==="recording")return;let t=this.v.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Al=()=>{this.P?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.as=t.enabled?"microphone":"microphone-mute",this.Yi=!t.enabled;});};this.$l=()=>{try{let t=new Blob(this.Qt,{type:this.R?.mimeType}),e=URL.createObjectURL(t),i=this.v.value;if(!i)return;i.muted=!1,i.volume=1,this.ie(null),i.src=e,this.Ul(i);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Ol=()=>{if(this.ee(J.RETAKE),this.c===y.VIDEO){this.ie(this.P);let t=this.v.value;t&&(t.muted=true);}this.v.value?.play?.();};this.Ml=()=>{if(this.ee(J.ACCEPT),this.c===y.PHOTO){this.D?.toBlob(s=>{if(!s)return;let n=this.hs("camera","jpeg",Ro,s);this.ms(n);},Ro);return}let t=new Blob(this.Qt,{type:this.R?.mimeType}),e=this.Rl(this.R?.mimeType),i=this.hs("video",e,`video/${e}`,t);this.ms(i),this.Qt=[];};this.Pl=t=>{t===J.SHOT&&(this.dt=true,this.lt=true,this.K=true,this.St=false,this.at=true),(t===J.RETAKE||t===J.ACCEPT)&&(this.dt=!this.b.includes(y.VIDEO),this.K=!this.b.includes(y.PHOTO),this.lt=false,this.St=true,this.at=this.At.length<=1);};this.Dl=t=>{t===J.PLAY&&(this.Ot=false,this.K=true,this.at=true,this.ct=true,this.Jt="pause",this.Mt="square",this.Ge="uc-shot-btn uc-camera-action uc-stop-record"),t===J.STOP&&(this.Ot=false,this.lt=true,this.ut=true,this.St=false),(t===J.RETAKE||t===J.ACCEPT)&&(this.Ot=true,this.dt=!this.b.includes(y.VIDEO),this.K=!this.b.includes(y.PHOTO),this.lt=false,this.St=true,this.ut=!this.cfg.enableAudioRecording,this.Mt="video-camera-full",this.Ge="uc-shot-btn uc-camera-action",this.ct=!this.cfg.enableAudioRecording||this.It.length<=1,this.at=this.At.length<=1);};this.ee=t=>{this.c===y.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Pl(t),this.c===y.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Dl(t);};this.us=t=>{this.es.value?.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===t);}),t===y.PHOTO&&(this.Mt="camera-full",this.ct=true,this.ut=true),t===y.VIDEO&&(this.Jt="play",this.Mt="video-camera-full",this.ct=!this.cfg.enableAudioRecording||this.It.length<=1,this.ut=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:C.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.c=t;};this.hs=(t,e,i,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:i})};this.ms=t=>{this.api.addFileFromObject(t,{source:L.CAMERA}),this.set$({"*currentActivity":h.activities.UPLOAD_LIST}),this.modalManager?.open(h.activities.UPLOAD_LIST);};this.re=E(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.c===y.VIDEO&&this.cfg.enableAudioRecording,i=this.c===y.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.He=false,this.lt=false,this.K=!this.b.includes(y.PHOTO),this.dt=!this.b.includes(y.VIDEO),this.je=true,this.Ot=true,this.Mt=i,this.ut=!e,this.ct=!e):t==="prompt"?(this.Qi="camera-permissions-prompt",this.He=true,this.lt=true,this.K=true,this.je=false,this.er()):(this.Qi="camera-permissions-denied",this.He=true,this.je=false,this.K=!this.b.includes(y.PHOTO),this.dt=!this.b.includes(y.VIDEO),this.St=true,this.Ge="uc-shot-btn uc-camera-action",this.er());},300);this.Vl=()=>{if(!this.P)return false;let t=this.P?.getAudioTracks(),e=this.P?.getVideoTracks();return t.forEach(i=>{i.stop();}),e.forEach(i=>{i.stop();}),true};this.er=()=>{this.Xi&&(this.v.value&&(this.v.value.volume=0),this.Ke?.getTracks?.()?.[0]?.stop(),this.Ji(this.v.value),this.ie(null),this.Vl(),this.ps(),this.Xi=false);};this.Lt=async()=>{let t={video:{...da},audio:this.cfg.enableAudioRecording?{}:false};this.ze&&(t.video={deviceId:{exact:this.ze}}),this.Ne&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Ne}}),this.v.value&&(this.v.value.volume=0);try{this.re("prompt"),this.P=await navigator.mediaDevices.getUserMedia(t),this.P.addEventListener("inactive",()=>{this.re("denied");}),this.ie(this.P),this.Xi=!0,this.re("granted");}catch(e){this.re("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.fs=()=>{this.Lt();};this.Fl=async()=>{try{this.We();for(let t of pa){let e=await navigator.permissions.query({name:t});this.hl[t]=e,e.addEventListener("change",this.fs),this.Be.push(()=>{e.removeEventListener("change",this.fs);});}this._e=()=>{this.We();};}catch(t){this.We(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Lt();}};this._l=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.ir(),navigator.mediaDevices.addEventListener("devicechange",this.ir);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.ir=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.At=t.filter(e=>e.kind==="videoinput").map((e,i)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${i+1}`,value:e.deviceId})),this.It=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.ss=this.At,this.at=this.At.length<=1,this.ze=this.At[0]?.value??null,this.ns=this.It,this.ct=!this.cfg.enableAudioRecording||this.It.length<=1,this.Ne=this.It[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Nl=async()=>{await this.Fl(),await this._l(),await this.Lt(),this.vs(this.b);};this.zl=async()=>{this._e&&this._e(),window.chrome||this.re("denied"),this.er();};this.vs=t=>{this.dt=!t.includes(y.VIDEO),this.K=!t.includes(y.PHOTO);let e=t[0];e&&(!this.c||!t.includes(this.c))&&this.us(e);};}Ul(t){this.Ji(t),t.addEventListener("play",this.Yo),t.addEventListener("pause",this.ts);}Ji(t){t?.removeEventListener("play",this.Yo),t?.removeEventListener("pause",this.ts);}ie(t){this.Ke!==t&&(this.Ke=t,this.tr());}tr(){let t=this.v.value;if(!t)return;let e=this.Ke??null;t.srcObject!==e&&(t.srcObject=e);}gl(){if(this.ee("shot"),this.D=document.createElement("canvas"),this.t=this.D.getContext("2d"),!this.t)throw new Error("Failed to get canvas context");let t=this.v.value;if(!t)throw new Error("Video element not found");this.D.height=t.videoHeight,this.D.width=t.videoWidth,this.cfg.cameraMirror&&(this.t.translate(this.D.width,0),this.t.scale(-1,1)),this.t.drawImage(t,0,0),t.pause();}Rl(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let i=t.split("/");if(i?.[0]==="video"){let n=i.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get b(){return V(this.cfg.cameraModes).filter(t=>t===y.PHOTO||t===y.VIDEO)}We(){if(this.Be.length!==0){for(let t of this.Be)t();this.Be=[],this._e=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.Nl,onDeactivate:this.zl}),this.subConfigValue("cameraMirror",t=>{this.os=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ut=!t,this.Yi=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=G(t);this.vs(e.filter(i=>i===y.PHOTO||i===y.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.tr();}updated(t){super.updated(t),this.tr();}Bl(){this.We(),navigator.mediaDevices?.removeEventListener("devicechange",this.ir),this.Ji(this.v.value),this.ie(null);}disconnectedCallback(){super.disconnectedCallback(),this.Bl();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.at}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.ss} ?hidden=${this.at} @change=${this.bl} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${styleMap({transform:this.os})} ?hidden=${this.He} ${ref(this.v)} ></video><div class="uc-message-box" ?hidden=${this.je}><span>${this.l10n(this.Qi)}</span><button type="button" @click=${this.Tl} ?hidden=${this.fl} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${ref(this.es)} class="uc-switcher" ?hidden=${!this.Ot}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.cs} ?hidden=${this.K} ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.cs} ?hidden=${this.dt} ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.Cl} ?hidden=${this.Ot} ><uc-icon name=${this.Jt}></uc-icon><span ${ref(this.te)}> 00:00 </span><span ${ref(this.nt)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.St} ><button type="button" class="uc-secondary-btn" @click=${this.Il}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Sl} data-testid="accept" > Accept </button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" @click=${this.El} class=${this.Ge} ?hidden=${this.lt} ><uc-icon name=${this.Mt}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.kl} ?hidden=${this.ut} ><uc-icon name=${this.as}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.ns} ?hidden=${this.ct} ?disabled=${this.Yi} @change=${this.wl} ></uc-select></div></div>`}};u([state()],O.prototype,"os",2),u([state()],O.prototype,"He",2),u([state()],O.prototype,"je",2),u([state()],O.prototype,"fl",2),u([state()],O.prototype,"ss",2),u([state()],O.prototype,"at",2),u([state()],O.prototype,"Qi",2),u([state()],O.prototype,"Ot",2),u([state()],O.prototype,"lt",2),u([state()],O.prototype,"St",2),u([state()],O.prototype,"ns",2),u([state()],O.prototype,"ct",2),u([state()],O.prototype,"Yi",2),u([state()],O.prototype,"ut",2),u([state()],O.prototype,"K",2),u([state()],O.prototype,"dt",2),u([state()],O.prototype,"Mt",2),u([state()],O.prototype,"Jt",2),u([state()],O.prototype,"as",2),u([state()],O.prototype,"Ge",2);function Do(...o){return o.reduce((r,t)=>{if(typeof t=="string")return r[t]=true,r;for(let e of Object.keys(t))r[e]=t[e];return r},{})}function Q(...o){let r=Do(...o);return Object.keys(r).reduce((t,e)=>(r[e]&&t.push(e),t),[]).join(" ")}function Vo(o,...r){let t=Do(...r);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var ha=o=>B.includes(o),Fo=o=>{if(!o)return B;let r=G(o).filter(ha);return r.length===0?B:r};function _o(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":B,"*tabId":I.CROP,"*on.retryNetwork":()=>{let r=o.querySelectorAll("img");for(let t of r){let e=t.src;t.src=it,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":r=>{if(!r)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=z(Et(r),"preview"),i=D(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:i,transformations:r};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var No="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Bo=ht([...B]),K=class extends g{constructor(){super(...arguments);this.ctxOwner=true;this.Kl="";this.pt=it;this.Hl="";this.oe=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Bo;this.gs=false;this.G=false;this.rr=null;this.Ze=E(t=>{this.oe=t;},300);this.qe=createRef();this.ys=createRef();this.bs=createRef();this.ws=createRef();this.Ts=()=>{this.Ze(false),this.pt!==it&&(this.$["*networkProblems"]=false);};this.Es=()=>{this.Ze(false),this.$["*networkProblems"]=true;};this.jl=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,..._o(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Gl(){this.G||this.rr||(this.rr=this.updateComplete.then(()=>{this.rr=null,this.G=true;}));}initCallback(){super.initCallback(),this.Cs(),this.xs();}Xe(){let t=this.bs.value;t&&(this.$["*faderEl"]=t);let e=this.ys.value;e&&(this.$["*cropperEl"]=e);let i=this.ws.value;i&&(this.$["*imgContainerEl"]=i);let s=this.qe.value;s&&(this.$["*imgEl"]=s);}Wl(){let t=this.qe.value;t&&(t.addEventListener("load",this.Ts),t.addEventListener("error",this.Es));}Zl(){let t=this.qe.value;t&&(t.removeEventListener("load",this.Ts),t.removeEventListener("error",this.Es));}get ql(){let t=this.$["*tabId"];return Q("uc-image",{"uc-image_hidden_to_cropper":t===I.CROP,"uc-image_hidden_effects":t!==I.CROP})}ks(){return new Promise((e,i)=>{let s=window.setTimeout(()=>{i(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.Xe(),this.Wl(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),i=t.has("uuid")||t.has("cdnUrl");e&&!i&&this.updateImage();}disconnectedCallback(){this.Zl(),super.disconnectedCallback();}render(){let t=this.Hl??"",e=this.Kl??"",i=this.pt||it,s=this.oe,n=this.gs;return html` ${unsafeSVG(No)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.jl}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${ref(this.ws)}><img src=${i} class=${this.ql} ${ref(this.qe)} />${when(this.G,()=>html`<uc-editor-image-cropper ${ref(this.ys)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${ref(this.bs)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${when(this.G,()=>html`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Cs(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.xs();}Cs(){let t=this.tabs||Bo;this.$["*tabList"]=Fo(t);}xs(){let t=We(this.cropPreset??""),e=null;if(this.cdnUrl){let i=Pi(this.cdnUrl),s=Di(i);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=ko(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.ks(),this.cdnUrl){let t=this.cdnUrl,e=Oe(t),i=Tt(t,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let s=Pi(t),n=Di(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Tt(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={};}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===I.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(D(t,z("json"))),i=await fetch(e).then(a=>a.json()),{width:s,height:n}=i;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===I.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.Gl();}}async initEditor(){try{await this.ks();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.gs=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],i=z(Et(t),"preview"),s=D(e,i),n={originalUrl:e,cdnUrlModifiers:i,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};u([state()],K.prototype,"Kl",2),u([state()],K.prototype,"pt",2),u([state()],K.prototype,"Hl",2),u([state()],K.prototype,"oe",2),u([property({type:String,reflect:true})],K.prototype,"uuid",2),u([property({type:String,attribute:"cdn-url",reflect:true})],K.prototype,"cdnUrl",2),u([property({type:String,attribute:"crop-preset",reflect:true})],K.prototype,"cropPreset",2),u([property({type:String,reflect:true})],K.prototype,"tabs",2),u([state()],K.prototype,"gs",2),u([state()],K.prototype,"G",2);var ri=class extends g{constructor(){super(...arguments);this.As=`uc-backdrop-mask-${q.generateFastUid()}`;this.Ye=false;this.le=false;this.Ss=createRef();this.ce=false;this.ue=null;this.Ls=t=>{this.$s(),this.de&&(t.stopPropagation(),t.preventDefault(),this.de=false);};this.Us=t=>{if(!this.de||!this.Qe||!this.sr)return;t.stopPropagation(),t.preventDefault();let e=this.Q;if(!e)return;let{x:i,y:s}=e.getBoundingClientRect(),n=t.x-i,a=t.y-s,l=n-this.Qe[0],c=a-this.Qe[1],{direction:d}=this.sr,p=this.oc(d,[l,c]);p&&(this.$["*cropBox"]=p);};this.Rs=t=>{if(!this.H)return;let e=Object.values(this.H).find(i=>{if(!i||this.ar(i.direction))return false;let n=i.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return To(a,[t.x,t.y])});this.Is=e,this.$s();};}get Q(){return this.Ss.value??null}get de(){return this.le}set de(t){this.le!==t&&(this.le=t,this.nr());}nr(){this.ne&&this.ne.setAttribute("class",Q({"uc-guides--hidden":this.Ye,"uc-guides--visible":!this.Ye&&this.le,"uc-guides--semi-hidden":!this.Ye&&!this.le}));}ar(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=b&&e.width<=b)return true;let i=e.height<=b&&(t.includes("n")||t.includes("s")),s=e.width<=b&&(t.includes("e")||t.includes("w"));return i||s}Xl(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:n}=t,a=this.Q;if(!a)return;let l=X("mask",{id:this.As}),c=X("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=X("rect",{x:e,y:i,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let p=X("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.As})`});a.appendChild(p),a.appendChild(l),this.se=l,this.or=d;}Ql(){this.se&&(this.se.style.display="none",window.requestAnimationFrame(()=>{this.se&&(this.se.style.display="block");}));}Yl(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:n}=t;this.or&&Ct(this.or,{x:e,y:i,width:s,height:n});}Jl(){let t=this.$["*cropBox"];if(!(!t||!this.ne||!this.H)){for(let e of Object.values(this.H)){if(!e)continue;let{direction:i,pathNode:s,interactionNode:n,groupNode:a}=e,l=i==="",c=i.length===2,{x:d,y:p,width:f,height:v}=t;if(l)Ct(n,{x:d,y:p,width:f,height:v});else {let k=xt(Math.min(f,v)/82/2,0,1),A=c?vo(t,i,k):go(t,i,k),R=A.center;if(!R)continue;let Pt=Math.max(er*xt(Math.min(f,v)/er/3,0,1),fo);Ct(n,{x:R[0]-Pt,y:R[1]-Pt,width:Pt*2,height:Pt*2}),Ct(s,{d:A.d});}let m=this.ar(i);a.setAttribute("class",Q("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}));}Ct(this.ne,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Ms(t,e){let i=X("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let s=X("rect",{fill:"transparent"}),n=X("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(n),i.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:i},e===""&&(i.style.cursor="move"),s.addEventListener("pointerdown",this.tc.bind(this,e));}ec(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let s=`${["n","","s"][e]}${["w","","e"][i]}`;s!==""&&this.Ms(t,s);}return this.Ms(t,""),t}ic(){let t=X("svg"),e=X("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let s=X("line",{x1:`${ue*i}%`,y1:"0%",x2:`${ue*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let i=1;i<=2;i++){let s=X("line",{x1:"0%",y1:`${ue*i}%`,x2:"100%",y2:`${ue*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}rc(){let t=this.Q;if(!t)return;let e=document.createDocumentFragment(),i=this.ic();e.appendChild(i);let s=this.ec();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.H=s,this.ne=i,this.nr();}tc(t,e){if(!this.H)return;let i=this.H[t];if(!i||this.ar(t))return;let s=this.$["*cropBox"],n=this.Q;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.de=true,this.sr=i,this.Qe=[c,d],this.Os={...s};}oc(t,e){let[i,s]=e,n=this.$["*imageBox"],a=this.Os??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=bo({rect:a,delta:[i,s],imageBox:n}):a=wo({rect:a,delta:[i,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Bt(Ht(a),n)}$s(){let t=this.Is,e=this.Q;e&&(e.style.cursor=t?yo(t.direction):"initial");}Ps(t){if(this.ae){this.ae.setAttribute("href",t);return}let e=this.Q;if(!e){this.ue=t;return}this.ue=null;let i=document.createDocumentFragment(),s=X("image",{href:t});s.setAttribute("class","uc-cloud-mask"),i.appendChild(s),e.appendChild(i),this.ae=s;}sc(){let t=this.$["*cropBox"];if(!t||!this.ae)return;let{x:e,y:i,width:s,height:n}=t;Ct(this.ae,{x:e,y:i,height:n,width:s});}lr(){this.ce&&(this.Yl(),this.Jl(),this.sc());}toggleThumbs(t){if(this.H)for(let e of Object.values(this.H)){if(!e)continue;let{groupNode:i}=e;i.setAttribute("class",Q("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ql(),this.ce&&window.requestAnimationFrame(()=>{this.lr();});}),this.sub("*cropBox",t=>{t&&(this.Ye=t.height<=b||t.width<=b,this.nr(),this.ce&&window.requestAnimationFrame(()=>{this.lr();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Ps(t);}),document.addEventListener("pointermove",this.Us,true),document.addEventListener("pointerup",this.Ls,true);}firstUpdated(t){super.firstUpdated(t),this.nc();}nc(){let t=this.Q;if(!(!t||this.ce)){if(this.Xl(),this.rc(),this.ce=true,t.addEventListener("pointermove",this.Rs,true),this.ue){let e=this.ue;this.ue=null,this.Ps(e);}this.lr();}}disconnectedCallback(){super.disconnectedCallback(),this.Q?.removeEventListener("pointermove",this.Rs,true),document.removeEventListener("pointermove",this.Us,true),document.removeEventListener("pointerup",this.Ls,true);}render(){return html`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${ref(this.Ss)}></svg>`}};u([state()],ri.prototype,"le",2);var H=class extends g{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Ds(){let t=this.buttonClasses;for(let[e,i]of Object.entries(t))this.classList.toggle(e,i);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Ds();}updated(t){super.updated(t),t.has("active")&&this.Ds();}render(){let t=this.onClick,e=this.title;return html`<button role="option" type="button" aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};u([state()],H.prototype,"active",2),u([state()],H.prototype,"title",2),u([state()],H.prototype,"icon",2),u([state()],H.prototype,"titleProp",2);var si=12,ni=16,Ea=o=>{let r=12,t=12;return o.width/o.height>=1?(r=si,t=Math.round(si*o.height/o.width)):(t=si,r=Math.round(si*o.width/o.height)),{width:r,height:t}},pr=class extends H{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",r=>{let t=this.ac(r);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ac(r){return r?r.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${r.width}:${r.height}`}):""}render(){let r=this.onClick,t=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${r} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},li=class extends H{constructor(){super(...arguments);this.E=null;}get aspectRatio(){return this.E}set aspectRatio(t){if(this.E===t)return;let e=this.E;this.E=t,this.requestUpdate("aspectRatio",e),t?this.Vs(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.E&&this.Vs(this.E),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.E?.id||t?.width===this.E?.width&&t?.height===this.E?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.E?.id&&(this.$["*currentAspectRatio"]=this.E);}Vs(t){let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let i=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};i(),s(),e||this.requestUpdate();}lc(){let t=this.E;if(!t||t.hasFreeform)return html`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:i}=Ea(t),s=(ni-e)/2,n=(ni-i)/2;return html`<uc-icon><svg viewBox="0 0 ${ni} ${ni}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${i} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} >${this.lc()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};u([property({attribute:false})],li.prototype,"aspectRatio",1);function xa(o){let r=o+90;return r=r>=360?0:r,r}function ka(o,r){if(o==="rotate")return xa(typeof r=="number"?r:0);if(o==="mirror"||o==="flip")return !r;throw new Error(`Unsupported operation: ${o}`)}var ui=class extends H{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],i=e.getValue(this.operation),s=ka(this.operation,i);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:i}),e.setValue(this.operation,s);}};u([property({type:String})],ui.prototype,"operation",2);var ut="original",di=class extends g{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.qi=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.cc();let i=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];i&&s&&i.activate({url:s,operation:this.state.operation,value:this.state.filter===ut?void 0:this.state.value,filter:this.state.filter===ut?void 0:this.state.filter,fromViewer:false});}cc(){let t=this.state.operation,{range:e,zero:i}=et[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:i};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),p=l;if(p){let{name:f,amount:v}=p;d=f===this.state.filter?v:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:i;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===ut?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return html`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.qi} ></uc-slider-ui>`}};u([state()],di.prototype,"state",2);function Qt(o){if(!o)return null;let r=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!r)return null;let[,t,e]=r;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var At=class extends H{constructor(){super(...arguments);this.r="";this.n="";this.pe="";this.Je=0;this.o=null;this.Rt=false;this.isOriginal=false;this.Fs=20;}get filter(){return this.n}set filter(t){let e=t??"";if(this.n===e)return;let i=this.n;this.n=e,this.r="filter",this.isOriginal=e===ut,this.icon=this.isOriginal?"original":"slider",this.Fs=this.isOriginal?40:20,this.requestUpdate("filter",i),this._s(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.r,this.n),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.r,this.n),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Qt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.n;}uc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Fs||32,i=window.devicePixelRatio,s=Math.ceil(i*e),n=i>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.r]=this.n!==ut?{name:this.n,amount:a}:void 0,D(this.pe,z(Se,Et(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${st}/${nt}/uc-cloud-image-editor/`))}async Xt(t,e){t[0]?.isIntersecting?await this.cr(e):this.u?.();}initCallback(){super.initCallback(),this.i=new window.IntersectionObserver(this.Xt.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.pe=t??"",this.sub("*originalUrl",e=>{this.pe=e??"",!this.isOriginal&&this.pe&&this.isConnected&&!this.o&&(this.i?.observe(this),this.ht());}),this.isOriginal||(this.i?.observe(this),this.ht()),this.n&&this._s(this.n),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.n);}),this.sub("*networkProblems",async e=>{e||(this.o?await this.cr():this.ht());});}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),this.u?.(),this.ti();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.i?.unobserve(this):(this.i?.observe(this),this.ht()));}_s(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async cr(t){if(!this.isConnected){t?.unobserve(this),this.u?.(),this.u=void 0;return}if(!this.pe){!this.Ut&&!this.Y&&this.ht();return}let e=++this.Je,i="";try{i=await this.proxyUrl(this.uc());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Rt=false,this.u?.();let{promise:s,cancel:n}=Mt(i);this.u=()=>{n(),this.Je===e&&(this.u=void 0);};try{if(await s,this.Je!==e||!this.isConnected)return;this.o=i,this.Rt=!0,this.ti(),(t??this.i)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.ht();}finally{this.Je===e&&(this.u=void 0);}}ht(){if(!this.isConnected||this.o||this.Rt||this.isOriginal||this.$["*networkProblems"]){this.ti();return}this.Y&&cancelAnimationFrame(this.Y),this.Y=requestAnimationFrame(()=>{if(this.Y=void 0,!this.isConnected||this.o||this.Rt||this.isOriginal){this.ti();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<i){this.cr();return}this.Ut=window.setTimeout(()=>{this.Ut=void 0,this.ht();},500);});}ti(){this.Y&&(cancelAnimationFrame(this.Y),this.Y=void 0),this.Ut&&(window.clearTimeout(this.Ut),this.Ut=void 0);}get Ns(){return !!(this.Rt&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ns?"1":"0"};this.o&&(e.backgroundImage=`url(${this.o})`);let i={opacity:this.Ns?"0":"1"};return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${t} ><div class="uc-preview" ?loaded=${this.Rt} style=${styleMap(e)}></div><uc-icon class=${classMap({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${styleMap(i)} ></uc-icon></button>`}};u([state()],At.prototype,"o",2),u([state()],At.prototype,"Rt",2),u([state()],At.prototype,"isOriginal",2),u([state()],At.prototype,"Fs",2),u([property({type:String})],At.prototype,"filter",1);function Zo(o,r){let t={};for(let e of r){let i=o[e];(Object.hasOwn(o,e)||i!==void 0)&&(t[e]=i);}return t}function Yt(o,r,t){let i=window.devicePixelRatio,s=Math.min(Math.ceil(r*i),3e3),n=i>=2?"lightest":"normal";return D(o,z(Se,Et(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${st}/${nt}/uc-cloud-image-editor/`))}function $a(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(i=>Number.isInteger(i)&&Number.isFinite(i)),({dimensions:t,coords:e})=>t.every(i=>i>0)&&e.every(i=>i>=0)].every(t=>t(o)):true}var hi=class extends g{constructor(){super();this.ctxOwner=true;this.mt={width:0,height:0};this.t=null;this.m=false;this.O=null;this.Bs=createRef();this.dr=createRef();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.zs=E(this.Ks.bind(this),300),this.ur=qt(()=>{!this.isConnected||!this.m||(this.pr(),this.Hs(),this.js(),this.hr(),this.mr());},100);}firstUpdated(t){super.firstUpdated(t),this.pr();}Hs(){let t=this.$["*editorTransformations"],e=Zo(t,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...e};this.$["*operations"]=i;}pr(){let t=this.Bs.value;if(!t)return;let e=t.getContext("2d"),i=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${i}px`,t.style.height=`${s}px`,t.width=i*n,t.height=s*n,e?.scale(n,n),this.D=t,this.t=e;}js(){if(!this.m||!this.O)return;let t=this.O,e=this.$["*padding"],i=this.$["*operations"],{rotate:s}=i,n={width:this.offsetWidth,height:this.offsetHeight},a=Kt({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let p=n.width-e*2,f=p/c,v=0+e,m=e+(n.height-e*2)/2-f/2;l={x:v,y:m,width:p,height:f};}else {let p=n.height-e*2,f=p*c,v=e+(n.width-e*2)/2-f/2,m=0+e;l={x:v,y:m,width:f,height:p};}}else {let{width:c,height:d}=a,p=e+(n.width-e*2)/2-c/2,f=e+(n.height-e*2)/2-d/2;l={x:p,y:f,width:c,height:d};}this.$["*imageBox"]=Ht(l);}hr(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[f,v],coords:[m,k]}=n,{width:A}=Kt(this.mt,s),R=a/A;t=Bt(Ht({x:l+m*R,y:c+k*R,width:f*R,height:v*R}),e);}let d=this.$["*currentAspectRatio"],p=d?d.width/d.height:void 0;if(!Eo(t,e)||p&&!Co(t,p)){let f=e.width/e.height,v=e.width,m=e.height;p&&(f>p?v=Math.min(e.height*p,e.width):m=Math.min(e.width/p,e.height)),t={x:e.x+e.width/2-v/2,y:e.y+e.height/2-m/2,width:v,height:m};}this.$["*cropBox"]=Bt(Ht(t),e);}dc(){let t=this.t;if(!t)return;let e=this.O;if(!e)return;let i=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Kt({width:i.width,height:i.height},l);t.save(),t.translate(i.x+i.width/2,i.y+i.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}mr(){if(!this.m||!this.O||!this.D||!this.t)return;let t=this.D;this.t.clearRect(0,0,t.width,t.height),this.dc();}pc({fromViewer:t}){this.O&&(this.dr.value?.toggleThumbs(true),this.hc(),setTimeout(()=>{this.className=Q({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Gs(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a}=e,{width:l,height:c}=Kt(this.mt,s),{width:d,height:p}=t,f=n/l,v=a/c;return [xt(Math.round(d/f),1,l),xt(Math.round(p/v),1,c)]}mc(){let t=this.$["*cropBox"],e=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a,x:l,y:c}=e,{width:d,height:p}=Kt(this.mt,s),{x:f,y:v}=t,m=n/d,k=a/p,A=this.Gs(),R={dimensions:A,coords:[xt(Math.round((f-l)/m),0,d-A[0]),xt(Math.round((v-c)/k),0,p-A[1])]};if(!$a(R)){console.error("Cropper is trying to create invalid crop object",{payload:R});return}if(!(A[0]===d&&A[1]===p))return R}Ks(){if(!this.isConnected||!this.mt)return;let t=this.$["*operations"],{rotate:e,mirror:i,flip:s}=t,n=this.mc(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:i,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.m&&(this.js(),this.hr(),this.mr());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.m){this.m=true,await this.updateComplete,this.pr(),this.mt=t,this.removeEventListener("transitionend",this.Ws);try{let i=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.O=await this.fc(i,s),this.Hs(),this.ur(),this.pc({fromViewer:e});}catch(i){console.error("Failed to activate cropper",{error:i}),this.telemetryManager.sendEventError(i,"cloud editor image. Failed to activate cropper");}this.i=new ResizeObserver(i=>{let[s]=i;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.m&&this.O&&this.ur();}),this.i.observe(this);}}deactivate({reset:t=false}={}){this.m&&(!t&&this.Ks(),this.m=false,this.vc(),this.className=Q({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.dr.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Ws,{once:true}),this.i?.disconnect());}vc(){let t=this.Gs(),e=this.$["*cropBox"],i=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(i,s),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}hc(){let t=this.$["*cropBox"],e=t.x+t.width/2,i=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`;}Ws(){this.m||(this.O=null);}async fc(t,e){let i=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Yt(t,i,e)),{promise:n,cancel:a,image:l}=Mt(s),c=this.Pt(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.u?.(),this.u=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Pt(t){let e="crop",i=this.$["*loadingOperations"],s=i.get(e);return s||(s=new Map,i.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=i);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.mr();}),this.sub("*cropBox",()=>{this.O&&this.zs();}),this.sub("*currentAspectRatio",()=>{this.hr();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.m&&this.mt&&this.activate(this.mt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),this.O&&(this.O=null);}render(){return html`<canvas class="uc-canvas" ${ref(this.Bs)}></canvas><uc-crop-frame ${ref(this.dr)}></uc-crop-frame>`}};u([state()],hi.prototype,"O",2);function hr(o,r,t){let e=t,i=t-1,s=new Array(e);for(let n=i;n>=0;n-=1)s[n]=Math.ceil((n*r+(i-n)*o)/i);return s}function Ra(o){return typeof o=="string"&&o in et}function Pa(o){let r=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],i=o[t+1];typeof e=="number"&&typeof i=="number"&&r.push([e,i]);}return r}function Da(o,r,t){let e=Pa(o).find(([n,a])=>n<=r&&r<=a);if(!e)return o.map(()=>0);let[i,s]=e;return o.map(n=>{let a=Math.abs(i-s)||1,l=Math.abs(r-i)/a;return i===n?r>t?1:1-l:s===n?r>=t?l:1:0})}function Va(o,r){return o.map((t,e)=>t<r?o.length-e:e)}function Jo(o,r){let t=et[o].keypointsNumber,{range:e,zero:i}=et[o];return [...new Set([...hr(e[0],i,t+1),...hr(i,e[1],t+1),i,r])].sort((s,n)=>s-n)}var mr=class extends g{constructor(){super();this.m=false;this.fr=true;this.r="initial";this.Zs={};this.J=[];this.Xs=0;this.Ys=createRef();this.ei=createRef();this.classList.add("uc-inactive_to_cropper"),this.Qs=E(async(t,e,i)=>{let s=()=>!this.Js(t,e)||this.xt!==i||!!this.J.find(c=>c.value===i);if(s())return;let n=await this.tn(t,i),a=new Image;a.src=n.src;let l=this.Pt(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.J,d=c.findIndex(m=>m.value>i);d===-1&&(d=c.length);let f=c[d]?.image,v=this.ei.value;!v||f&&!v.contains(f)||(c.splice(d,0,n),f?v.insertBefore(a,f):v.appendChild(a),this.yr(t,i));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Pt(t){let e=this.r,i=this.$["*loadingOperations"];i.has(e)||i.set(e,new Map);let s=i.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=i);}}en(){window.cancelAnimationFrame(this.Xs),this.Xs=window.requestAnimationFrame(()=>{for(let t of this.J){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}pt({url:t=this.qs,filter:e=this.n??void 0,operation:i,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.Zs};i&&(i==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[i]=s));let a=this.offsetWidth;return this.proxyUrl(Yt(t,a,n))}async tn(t,e){return {src:await this.pt({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Js(t,e){return this.r===t&&this.n===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Ra(this.r)||!Number.isFinite(e)||(this.yr(this.r,e),this.Qs(this.r,this.n,e));}yr(t,e){this.r=t,this.xt=e;let{zero:i}=et[t],s=this.J.map(l=>l.value),n=Da(s,e,i),a=Va(s,i);this.J.forEach((l,c)=>{let d=n[c],p=a[c];typeof d=="number"&&(l.opacity=d),typeof p=="number"&&(l.zIndex=p);}),this.en();}rn(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async gc(){this.o=this.o||this.rn();let t=this.o;t&&this.sn(t);let e=this.J.map(c=>c.src),{images:i,promise:s,cancel:n}=me(e);i.forEach(c=>{let d=this.Pt(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.vr=()=>{n(),this.vr=void 0;};let a=this.r,l=this.n;if(await s,this.m&&this.Js(a,l)){let c=this.ei.value;if(!c)return;c.replaceChildren(),this.J.forEach((d,p)=>{let f=i[p];f&&(f.classList.add("uc-fader-image"),d.image=f,c.appendChild(f));}),this.en();}}async setTransformations(t){if(this.Zs=t,this.o){let e=await this.pt(),i=this.Pt(e);this.o.src=e,this.o.addEventListener("load",i,{once:true}),this.o.addEventListener("error",i,{once:true}),this.o.style.opacity="1",this.o.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:i,value:s}){if(!i||typeof s!="number")return;this.gr?.();let n=Jo(i,s),a=await Promise.all(n.map(c=>this.pt({url:t,filter:e,operation:i,value:c}))),{cancel:l}=me(a);this.gr=l;}yc(t){let e=this.o||this.rn();if(this.sn(e),this.o=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Q({"uc-active_from_viewer":this.he,"uc-active_from_cropper":!this.he,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let i=this.Pt(t);e.addEventListener("error",i,{once:true}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=Q({"uc-active_from_viewer":this.he,"uc-active_from_cropper":!this.he,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:i,filter:s,fromViewer:n}){if(this.m=true,this.fr=false,await this.updateComplete,this.qs=t,this.r=e??"initial",this.xt=i,this.n=s,this.he=n,typeof i!="number"&&!s){let l=await this.pt({operation:e,value:i});this.yc(l),this.br();return}!e||typeof i!="number"||(this.J=await Promise.all(Jo(e,i).map(l=>this.tn(e,l))),this.yr(e,i),this.gc());}deactivate({hide:t=true}={}){this.m=false,this.vr?.(),this.gr?.(),t&&!this.fr?(this.fr=true,this.o&&(this.o.style.transform="scale(1)"),this.className=Q({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.br();},{once:true})):this.br();}sn(t){let e=this.Ys.value;e&&(e.contains(t)||e.appendChild(t));}br(){this.ei.value?.replaceChildren();}render(){return html`<div class="uc-fader-preview-host" ${ref(this.Ys)}></div><div class="uc-fader-layers-host" ${ref(this.ei)}></div>`}};var mi=class extends H{constructor(){super(...arguments);this.r="";}get operation(){return this.r}set operation(t){let e=t??"";if(this.r===e)return;let i=this.r;this.r=e,this.requestUpdate("operation",i),e&&this.nn(e);}nn(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},i=()=>{let s=this.l10n(t);return this.title=s,s};e(),i();}initCallback(){super.initCallback(),this.r&&this.nn(this.r),this.sub("*editorTransformations",t=>{if(!this.r)return;let{zero:e}=et[this.r],i=t[this.r],s=typeof i<"u"?i!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.r),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.r,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Qt(this.$["*operationTooltip"])});}};u([property({type:String})],mi.prototype,"operation",1);var _a=1,ts=()=>{},fr=class extends g{constructor(){super(...arguments);this.an=t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;if(Math.abs(i)>_a){this.scrollLeft+=i;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.an,{passive:false}),this.addEventListener("scroll",ts,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.an),this.removeEventListener("scroll",ts),super.disconnectedCallback();}};var Y=class extends g{constructor(){super(...arguments);this.oe=false;this.showMainToolbar=true;this.showSubToolbar=false;this.ln=true;this.tabList=[...B];this.activeTab=I.CROP;this.ii=true;this.wr=false;this.cn=null;this.un=0;this.dn=0;this.ri=createRef();this.pn=createRef();this.tabToggleRefs={[I.CROP]:createRef(),[I.TUNING]:createRef(),[I.FILTERS]:createRef()};this.hn=()=>{this.ft();};this.me=[];this.Ze=E(t=>{this.oe=t;},500);this.oi=E(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],i="",s=false;if(this.$["*tabId"]===I.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;i=`${this.$["*currentFilter"]} ${n}`;}else i=this.l10n(ut);else if(this.showSubToolbar&&this.$["*tabId"]===I.TUNING&&e){s=true;let n=t?.[e]||et[e].zero;i=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=i),this.wr=s;},0);this.bc={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.wc={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Tc={hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"};this.Ec={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Cc={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":ut,"*currentOperation":null,"*operationTooltip":null};this.B=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.u?.();let e=this.$["*on.cancel"];e?.();};this.xr=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Rc=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Qt(this.$["*operationTooltip"])}),this.ri.value?.apply(),this.mn();};this.Pc=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.ri.value?.cancel(),this.mn();};this.Dc=t=>{let i=t.currentTarget?.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(t,i),this.Tr(i,{fromViewer:false}));};}mn(){this.$["*showSlider"]=false,this.$["*tabId"]===I.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===I.TUNING&&(this.wr=false);}Tr(t,{fromViewer:e=false,force:i=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.vn(t,{fromViewer:e,force:i});}vn(t,{fromViewer:e,force:i=false}){if(!i&&this.activeTab===t){this.ft();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===I.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of B){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ft();}}ft(){let e=this.tabToggleRefs[this.activeTab]?.value,i=this.pn.value;if(!e||!i)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.un!==s||this.dn!==n)&&(this.un=s,this.dn=n,i.style.transform=`translateX(${s}px)`,i.style.width=`${n}px`);}get Er(){return this.me.length>=3}xc(t){switch(t){case I.CROP:return this.kc();case I.FILTERS:return this.Ac();case I.TUNING:return this.Ic();default:return []}}kc(){let t=[];if(this.Er)t.push(()=>this.Oc());else for(let e of this.me)t.push(()=>this.gn(e));for(let e of jr)t.push(()=>this.Sc(e));return this.Cr(t)}Ac(){let e=[ut,...Hr].map(i=>()=>this.Mc(i));return this.Cr(e)}Ic(){let t=Kr.map(e=>()=>this.Lc(e));return this.Cr(t)}Cr(t){return t.length?t.map(i=>i()):[]}Oc(){return html`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}gn(t){return html`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Sc(t){return html`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Mc(t){return html`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Lc(t){return html`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}$c(){return this.Er?this.me.map(t=>this.gn(t)):[]}async Uc(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Yt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.u?.();let{cancel:i}=me([e]);this.u=()=>{i(),this.u=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.me=[...t],this.sub("*cropPresetList",e=>{this.me=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Tr(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let i=e?.filter?.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i??"");}),this.sub("*currentFilter",()=>{this.oi();}),this.sub("*currentOperation",()=>{this.oi();}),this.sub("*tabId",e=>{this.vn(e,{fromViewer:false,force:true}),this.oi();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Uc(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let i=false;for(let[,s]of e.entries()){if(i)break;for(let[,n]of s.entries())if(n){i=true;break}}this.Ze(i);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.ii=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.ii=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.ln=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[i]=e;i&&this.Tr(i,{fromViewer:false});return}this.ft();}),this.sub("*operationTooltip",e=>{this.cn=e;}),this.oi();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.hn);}firstUpdated(t){super.firstUpdated(t),this.Xe(),this.ft();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ft()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Xe();}disconnectedCallback(){window.removeEventListener("resize",this.hn),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Xe(){let t=this.ri.value;t&&(this.$["*sliderEl"]=t);}Vc(t){let e=this.tabList.includes(t),i=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?styleMap({gridColumn:`${s+1}`}):nothing;return html`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Ec}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${i?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${i} style=${n} @click=${this.Dc} ${ref(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Fc(t){let e=this.activeTab===t,i=this.xc(t);return html`<uc-presence-toggle id=${`tab_${t}`} class="uc-tab-content" .visible=${e} .styles=${this.Tc} ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${i.length?i:nothing}</div></div></uc-editor-scroller></uc-presence-toggle>`}render(){let t=["uc-info-tooltip",this.wr?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Er;return html`<uc-line-loader-ui .active=${this.oe}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.cn??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.bc} ><div class="uc-tab-content-row">${B.map(i=>this.Fc(i))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.ln} .styles=${this.Cc} @initial-render=${()=>this.ft()} ><div class="uc-tab-toggles_indicator" ${ref(this.pn)} ></div>${B.map(i=>this.Vc(i))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.B} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.xr}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.wc}><div class="uc-slider" ?hidden=${!this.ii}><uc-editor-slider ${ref(this.ri)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.ii||!e}>${e?html`<div class="uc-list-aspect-ratio">${this.$c()}</div>`:nothing}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Pc} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Rc} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};u([state()],Y.prototype,"oe",2),u([state()],Y.prototype,"showMainToolbar",2),u([state()],Y.prototype,"showSubToolbar",2),u([state()],Y.prototype,"ln",2),u([state()],Y.prototype,"tabList",2),u([state()],Y.prototype,"activeTab",2),u([state()],Y.prototype,"ii",2),u([state()],Y.prototype,"wr",2),u([state()],Y.prototype,"cn",2),u([state()],Y.prototype,"me",2);var pt=class extends g{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole="";this.ariaControls="";this.titleProp="";}firstUpdated(t){super.firstUpdated(t),this.yn(),this.bn();}updated(t){super.updated(t),t.has("reverse")&&this.yn(),t.has("theme")&&this.bn();}yn(){this.style.flexDirection=this.reverse?"row-reverse":"";}bn(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get _c(){let t=this.kr;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Nc}}get kr(){return !this.icon}get Nc(){return !this.text&&!this.kr}render(){return html`<button type="button" role=${ifDefined(this.ariaRole||void 0)} aria-controls=${ifDefined(this.ariaControls||void 0)} aria-label=${ifDefined(this.l10n(this.titleProp))} title=${ifDefined(this.l10n(this.titleProp))} ><uc-icon class=${classMap(this._c)} name=${ifDefined(this.icon||void 0)} ?hidden=${this.kr} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};u([property({type:String})],pt.prototype,"text",2),u([property({type:String})],pt.prototype,"icon",2),u([property({type:Boolean,reflect:true})],pt.prototype,"reverse",2),u([property({type:String,reflect:true})],pt.prototype,"theme",2),u([property({attribute:"aria-role"})],pt.prototype,"ariaRole",2),u([property({attribute:"aria-controls"})],pt.prototype,"ariaControls",2),u([property({attribute:"title-prop"})],pt.prototype,"titleProp",2);var fi=class extends g{constructor(){super(...arguments);this.active=false;this.nt=createRef();this.Ar=false;this.Ir=()=>{let t=this.nt.value;t&&(this.wn(t),this.Ar&&this.active&&this.Or());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Or();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Or():this.zc());}Or(){let t=this.nt.value;if(!t)return;this.Ar=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Ir),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Ir,{once:true});}zc(){let t=this.nt.value;t&&(this.Ar=false,t.removeEventListener("transitionend",this.Ir),this.wn(t));}wn(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return html`<div class="uc-inner"><div class="uc-line" ${ref(this.nt)}></div></div>`}};u([property({type:Boolean,reflect:true})],fi.prototype,"active",2);var Ut={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ge=class extends g{constructor(){super(...arguments);this.U=false;this.Tn=Ut;this.En=Ut.visible;this.Cn=Ut.hidden;this.Sr=false;this.xn=false;}set visible(t){this.U=t,this.kn();}get visible(){return this.U}set styles(t){this.Tn=t,this.Sr=true,this.En=t.visible??Ut.visible,this.Cn=t.hidden??Ut.hidden;}get styles(){return this.Tn}kn(){this.style.visibility=this.U?"inherit":"hidden",Vo(this,{[Ut.transition]:!this.Sr,[this.En]:this.U,[this.Cn]:!this.U}),this.toggleAttribute("inert",!this.U);}Bc(){this.xn||(this.xn=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Sr||this.classList.add(Ut.transition),this.kn(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Bc();},0);}};u([property({type:Boolean})],ge.prototype,"visible",1),u([property({attribute:false})],ge.prototype,"styles",1);var gt=class extends g{constructor(){super();this.Mr=0;this.X=createRef();this.In=createRef();this.On=createRef();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.tt=0;this.Hc=t=>{t.stopPropagation();let e=this.Sn(t);e!==null&&(this.Lr(e),this.Kc("slider-input",e));};this.jc=t=>{t.stopPropagation();let e=this.Sn(t);e!==null&&this.Lr(e);};this.Mn=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Ln=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Kc(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Mr=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.$n(this.tt),this.$r(),this.i=new ResizeObserver(()=>{this.$r(),this.si(this.tt);}),this.i.observe(this);let e=this.X.value;e?.addEventListener("focus",this.Mn),e?.addEventListener("blur",this.Ln),window.setTimeout(()=>{this.si(this.tt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.tt&&this.Lr(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.$r(),this.si(this.tt)),t.has("zero")&&this.hasUpdated&&this.Un(this.tt);}si(t){this.Un(t);let e=this.max-this.min;if(e===0)return;let{width:i}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(i-this.Mr)/100;window.requestAnimationFrame(()=>{let l=this.In.value;l&&(l.style.transform=`translateX(${a}px)`);});}Un(t){if(!this.fe)return;let e=this.max-this.min;if(e===0)return;this.fe.style.opacity=t===this.zero?"0":"1";let{width:i}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(i-this.Mr)/100;window.requestAnimationFrame(()=>{this.fe&&(this.fe.style.transform=`translateX(${a}px)`);});}$r(){let e=this.On.value;if(!e)return;let{width:i}=e.getBoundingClientRect(),s=Math.ceil(i/2),n=Math.ceil(s/15)-2;if(this.An===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.fe=d,e.innerHTML="",e.appendChild(a),this.An=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.X.value;t?.removeEventListener("focus",this.Mn),t?.removeEventListener("blur",this.Ln),this.i?.disconnect(),this.i=void 0;}Lr(t){Number.isFinite(t)&&(this.tt=t,this.hasUpdated&&(this.$n(t),this.si(t)));}$n(t){let e=this.X.value;e&&(e.value=String(t));}Sn(t){let e=t.currentTarget;if(!e)return null;let i=Number.parseInt(e.value,10);return Number.isFinite(i)?i:null}render(){return html`<div class="uc-steps" ${ref(this.On)}></div><div class="uc-thumb" ${ref(this.In)}></div><input class="uc-input" type="range" ${ref(this.X)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.tt)} ?disabled=${this.disabled} @input=${this.Hc} @change=${this.jc} />`}};u([property({type:Boolean,reflect:true})],gt.prototype,"disabled",2),u([property({type:Number})],gt.prototype,"min",2),u([property({type:Number})],gt.prototype,"max",2),u([property({type:Number,attribute:false})],gt.prototype,"defaultValue",2),u([property({type:Number})],gt.prototype,"zero",2),u([state()],gt.prototype,"tt",2);var vi=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.CLOUD_IMG_EDIT;this.C=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.Gc(),onDeactivate:()=>this.Wc()}),this.subConfigValue("cropPreset",t=>{this.C&&this.C.cropPreset!==t&&(this.C={...this.C,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.C&&this.C.tabs!==t&&(this.C={...this.C,tabs:t});});}xr(t){if(!this.ve)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.ve.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(h.activities.CLOUD_IMG_EDIT),this.historyBack();}B(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(h.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Gc(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.ve=e;let i=this.ve.getValue("cdnUrl");if(!i)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.C=this.Zc(i);}Wc(){this.ve=void 0,this.C=null;}render(){if(!this.C)return nothing;let{cdnUrl:t,cropPreset:e,tabs:i}=this.C;return html`<uc-cloud-image-editor cdn-url=${t} crop-preset=${ifDefined(e)} tabs=${ifDefined(i)} @apply=${this.xr} @cancel=${this.B} @change=${this.handleChange} ></uc-cloud-image-editor>`}Zc(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};u([state()],vi.prototype,"C",2);var Ya=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],rs=E(o=>{for(let{test:r,message:t}of Ya)r(o)&&He(t);},0);var os=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var wr=o=>o,el=[wr({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:o,enableVideoRecording:r})=>{if(r===null)return o;let t=G(o);return r&&!t.includes("video")?t=t.concat("video"):r||(t=t.filter(e=>e!=="video")),ht(t)}}),wr({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:o,defaultCameraMode:r})=>{if(r===null)return o;let t=G(o);return t=t.sort((e,i)=>e===r?-1:i===r?1:0),ht(t)}}),wr({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:r,cdnCnamePrefixed:t})=>o&&(r===re||isPrefixedCdnBase(r,t))?getPrefixedCdnBaseAsync(o,t):r})],ss=({key:o,setValue:r,getValue:t,computationControllers:e})=>{for(let i of el)if(i.deps.includes(o)){let s={[i.key]:t(i.key)};for(let l of i.deps)s[l]=t(l);let n=new AbortController;e.get(i.key)?.abort(),e.set(i.key,n);let a;try{a=i.fn(s,{signal:n.signal});}catch(l){e.get(i.key)===n&&e.delete(i.key),console.error(`Failed to compute value for "${i.key}"`,l);return}os(a)?a.then(l=>{n.signal.aborted||r(i.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${i.key}"`,l);}).finally(()=>{e.get(i.key)===n&&e.delete(i.key);}):r(i.key,a);}};var x=o=>String(o),N=o=>{let r=Number(o);if(Number.isNaN(r))throw new Error(`Invalid number: "${o}"`);return r},S=o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},ns=o=>o==="auto"?o:S(o),as=o=>{let r=x(o);if(r!=="user"&&r!=="environment"&&r!=="")throw new Error(`Invalid value: "${r}"`);return r},ls=o=>{let r=x(o);if(!Object.values(y).includes(r))throw new Error(`Invalid value: "${r}"`);return r},cs=o=>{let r=x(o),t=G(r);if(t.some(e=>!Object.values(y).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return r},us=o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},Tr=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},gi=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},Er=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},ds=o=>{let r=x(o);if(["grid","list"].includes(r))return r;throw new Error(`Invalid value: "${r}"`)};var il={pubkey:x,multiple:S,multipleMin:N,multipleMax:N,confirmUpload:S,imgOnly:S,accept:x,externalSourcesPreferredTypes:x,externalSourcesEmbedCss:x,store:ns,cameraMirror:S,cameraCapture:as,sourceList:x,topLevelOrigin:x,maxLocalFileSizeBytes:N,thumbSize:N,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:x,removeCopyright:S,cropPreset:x,imageShrink:x,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:x,cdnCname:x,cdnCnamePrefixed:x,baseUrl:x,socialBaseUrl:x,secureSignature:x,secureExpire:x,secureDeliveryProxy:x,retryThrottledRequestMaxTimes:N,retryNetworkErrorMaxTimes:N,multipartMinFileSize:N,multipartChunkSize:N,maxConcurrentRequests:N,multipartMaxConcurrentRequests:N,multipartMaxAttempts:N,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:x,debug:S,localeName:x,metadata:us,secureUploadsExpireThreshold:N,localeDefinitionOverride:o=>Tr(o),secureUploadsSignatureResolver:o=>gi(o),secureDeliveryProxyUrlResolver:o=>gi(o),iconHrefResolver:o=>gi(o),fileValidators:Er,collectionValidators:Er,validationTimeout:N,validationConcurrency:N,cameraModes:cs,defaultCameraMode:ls,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:Tr,maxVideoRecordingDuration:N,filesViewMode:ds,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:x,testMode:S,qualityInsights:S},ps=(o,r)=>{if(!(typeof r>"u"||r===null))try{return il[o](r)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),W[o]}};var yi=[...new Set(["debug",...Object.keys(W)])],rl=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],fs=o=>rl.includes(o),be=yi.filter(o=>!fs(o)),hs={...Object.fromEntries(be.map(o=>[ee(o),o])),...Object.fromEntries(be.map(o=>[o.toLowerCase(),o]))},ol={...Object.fromEntries(be.map(o=>[ee(o),_(o)])),...Object.fromEntries(be.map(o=>[o.toLowerCase(),_(o)]))},ms=o=>`__${o}`,bi=class extends g{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(W).map(([t,e])=>[_(t),e]))};this.qc=new Map;}Xc(t,e){if(!fs(t)){let i=[...new Set([ee(t),t.toLowerCase()])];for(let s of i)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}Qc(t,e){this.$[_(t)]!==e&&(typeof e>"u"||e===null?this.$[_(t)]=W[t]:this.$[_(t)]=e);}ni(t,e){let i=this,s=ps(t,e),n=ms(t);i[n]!==s&&(this.Yc(t,i[n],s),i[n]=s,this.Xc(t,s),this.Qc(t,s),this.debugPrint(`[uc-config] "${t}"`,s),rs(this.cfg));}Rn(t){let e=this,i=ms(t);return e[i]??this.$[_(t)]}Yc(t,e,i){this.cfg.debug&&i!==e&&typeof i=="object"&&typeof e=="object"&&JSON.stringify(i)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,i));}initCallback(){super.initCallback();let t=this;for(let e of be)this.sub(_(e),i=>{this.ni(e,i);},false);for(let e of yi){let i=t[e]??this.$[_(e)];i!==W[e]&&this.ni(e,i),Object.defineProperty(this,e,{set:s=>{this.ni(e,s);},get:()=>this.Rn(e)});}for(let e of yi)this.sub(_(e),()=>{ss({key:e,setValue:this.ni.bind(this),getValue:this.Rn.bind(this),computationControllers:this.qc});});}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback(t,e,i),e===i)return;let s=this,n=hs[t];n&&(s[n]=i),ol[t]&&(this[t]=i);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(hs)]}};for(let o of yi)bi.prototype[o]=void 0;function sl(o){return new Promise(r=>{typeof window.FileReader!="function"&&r(false);try{let t=new FileReader;t.onerror=()=>{r(!0);};let e=i=>{i.type!=="loadend"&&t.abort(),r(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{r(false);}})}function nl(o,r){return new Promise(t=>{let e=0,i=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||r});i.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(i);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(i);});};s(o);})}function vs(o){let r=[],t=[];for(let e=0;e<o.items.length;e++){let i=o.items[e];if(i)if(i.kind==="file"){let s=i.type,n=i;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(nl(l,s).then(c=>{c&&r.push(...c);}));continue}let a=i.getAsFile();a&&t.push(sl(a).then(l=>{l||r.push({type:"file",file:a});}));}else i.kind==="string"&&/^text\/uri-list/.test(i.type)&&t.push(new Promise(s=>{i.getAsString(n=>{r.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>r)}var j=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),gs=["focus"],al=100,Cr=new Map;function ll(o,r){let t=Math.max(Math.min(o[0],r.x+r.width),r.x),e=Math.max(Math.min(o[1],r.y+r.height),r.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}function xr(o){let r=0,t=document.body,e=new Set,i=m=>{e.add(m);},s=j.INACTIVE,n=m=>{o.shouldIgnore()&&m!==j.INACTIVE||(s!==m&&e.forEach(k=>{k(m);}),s=m);},a=()=>r>0;i(m=>o.onChange(m));let l=()=>{r=0,n(j.INACTIVE);},c=()=>{r+=1,s===j.INACTIVE&&n(j.ACTIVE);},d=()=>{r-=1,a()||n(j.INACTIVE);},p=m=>{m.preventDefault(),r=0,n(j.INACTIVE);},f=m=>{if(o.shouldIgnore())return;a()||(r+=1);let k=[m.x,m.y],A=o.element.getBoundingClientRect(),R=Math.floor(ll(k,A)),Pt=R<al,As=m.composedPath().includes(o.element);Cr.set(o.element,R);let Sr=Math.min(...Cr.values())===R;As&&Sr?(m.preventDefault(),n(j.OVER)):n(Pt&&Sr?j.NEAR:j.ACTIVE);},v=async m=>{if(o.shouldIgnore())return;m.preventDefault();let{dataTransfer:k}=m;if(!k)return;let A=await vs(k);o.onItems(A),n(j.INACTIVE);};return t.addEventListener("drop",p),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",f),o.element.addEventListener("drop",v),gs.forEach(m=>{window.addEventListener(m,l);}),()=>{Cr.delete(o.element),t.removeEventListener("drop",p),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",v),gs.forEach(m=>{window.removeEventListener(m,l);});}}var kr=new Set,ot=class extends T{constructor(){super(...arguments);this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.V=true;this.Pn=true;this.Dn=null;this.Vn=null;this.Fn=createRef();this.Dt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this._n=true;this.Vt=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get Jc(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.V)return false;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(),kr.add(this),this.Ur(),this.Rr(),this.Nn(),this.zn(j.INACTIVE),this.Dn=xr({element:this,shouldIgnore:()=>this.Bn(),onChange:e=>{this.zn(e);},onItems:e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:L.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:L.DROP_AREA,fullPath:i.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(h.activities.UPLOAD_LIST),this.set$({"*currentActivity":h.activities.UPLOAD_LIST})));}});let t=this.Fn.value;t&&(this.Vn=xr({element:t,onChange:e=>{let i=Object.entries(j).find(([,s])=>s===e)?.[0].toLowerCase();i&&t.setAttribute("drag-state",i);},onItems:()=>{},shouldIgnore:()=>this.Bn()})),this.subConfigValue("sourceList",e=>{let i=V(e);this._n=i.includes(L.LOCAL),this.Ur(),this.Rr();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Ur(),this.Rr());}updated(t){super.updated(t),t.has("clickable")&&this.Nn();}Bn(){if(!this.V||!this.tu())return true;if(!this.fullscreen)return false;let t=kr;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}tu(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return !(t&&e&&i>=e||!t&&i>0)}Ur(){let t=this._n&&!this.disabled;this.V=t;}Rr(){let t=this.V||!this.querySelector("[data-default-slot]");this.Pn=t,this.hidden=!t;}zn(t){let e=Object.entries(j).find(([,i])=>i===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}Nn(){this.clickable&&!this.Vt?(this.addEventListener("keydown",this.Dt),this.addEventListener("click",this.Dt),this.Vt=true):!this.clickable&&this.Vt&&(this.removeEventListener("keydown",this.Dt),this.removeEventListener("click",this.Dt),this.Vt=false);}disconnectedCallback(){super.disconnectedCallback(),kr.delete(this),this.Dn?.(),this.Vn?.(),this.Vt&&(this.removeEventListener("keydown",this.Dt),this.removeEventListener("click",this.Dt),this.Vt=false);}render(){return html` ${this.yield("",html`<div data-default-slot hidden></div><div ${ref(this.Fn)} class="uc-content-wrapper" ?hidden=${!this.Pn}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.Jc}</span></div>`)} `}};u([property({type:Boolean,reflect:true})],ot.prototype,"disabled",2),u([property({type:Boolean,reflect:true})],ot.prototype,"clickable",2),u([property({type:Boolean,attribute:"with-icon",reflect:true})],ot.prototype,"withIcon",2),u([property({type:Boolean,reflect:true})],ot.prototype,"fullscreen",2),u([property({type:Boolean,reflect:true})],ot.prototype,"initflow",2),u([property({type:String})],ot.prototype,"text",2),u([state()],ot.prototype,"V",2),u([state()],ot.prototype,"Pn",2);var ws=()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(r){return console.warn("Unable to access top-level window location:",r),globalThis.location.origin}};var dl=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Ts=(o,r="i")=>{let t=o.split("*").map(dl);return new RegExp(`^${t.join(".+")}$`,r)};var pl=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],hl=(o,r)=>window.getComputedStyle(o).getPropertyValue(r).trim(),Es=o=>{let r={};for(let t of pl){let e=hl(o,t);e&&(r[t]=e);}return r};var ml=["selected-files-change","toolbar-state-change"],fl=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let r=o.type;return !(typeof r!="string"||!ml.includes(r))},wi=class{constructor(r,t){this.ai=new Map;this.Hn=r=>{if(r.source!==this.Pr)return;let t=r.data;if(!fl(t))return;let e=this.ai.get(t.type);if(e)for(let i of e)i(t);};this.Pr=r,this.Kn=t,window.addEventListener("message",this.Hn);}on(r,t){let e=this.ai.get(r)??new Set;this.ai.has(r)||this.ai.set(r,e),e.add(t);}send(r){let t=this.Kn();this.Pr.postMessage(r,t);}destroy(){window.removeEventListener("message",this.Hn);}};function Cs(o){let r=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||r.push(`${t}=${encodeURIComponent(e)}`);return r.join("&")}var bl={[lt.GDRIVE]:"ngdrive"},tt=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=h.activities.EXTERNAL;this.Ft=createRef();this.li=null;this.Dr=[];this.Vr=false;this.Fr=false;this._r=false;this.Nr=false;this.ci=false;this.zr=false;this.Br="uc-hidden";this.jn=true;this.Wi=()=>{for(let t of this.Dr){let e=this.iu(t),{filename:i}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:i,source:s});}this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.modalManager?.open(h.activities.UPLOAD_LIST);};this.B=()=>{this.historyBack();};this.lu=()=>{this.S?.send({type:"select-all"});};this.cu=()=>{this.S?.send({type:"deselect-all"});};}get eu(){if(!this.li)return "";let{selectedCount:t,total:e}=this.li;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Gn();}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.Kr(),this.Gn());}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.Kr();}),this.subConfigValue("multiple",t=>{this.ci=t;}),this.subConfigValue("localeName",()=>{this.Wn();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.Zn(t);});}iu(t){if(t.alternatives){let e=V(this.cfg.externalSourcesPreferredTypes);for(let i of e){let s=Ts(i);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}ru(t){this.jn=t.isVisible;}async ou(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.su(t.selectedCount,t.total),this.Br=t.isReady?"":"uc-hidden",this.Vr=t.isReady,this.Fr=t.isReady&&t.selectedFiles.length>0,this.ci=t.isMultipleMode&&t.total>0,this._r=t.selectedCount<t.total,this.Nr=t.selectedCount===t.total,this.Dr=t.selectedFiles??[],this.zr=t.total>0;}qn(){this.Zn(this.cfg.externalSourcesEmbedCss),this.nu(),this.Wn();}nu(){this.S?.send({type:"set-theme-definition",theme:Es(this)});}Zn(t){this.S?.send({type:"set-embed-css",css:t});}Wn(){this.S?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}au(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:i,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=bl[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||ws(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,i);return d.search=Cs(c),d.toString()}su(t,e){this.li={selectedCount:t,total:e};}Gn(){let t=document.createElement("iframe");t.src=this.au(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.qn.bind(this)),t.addEventListener("load",this.qn.bind(this)),this.Ft.value&&(this.Ft.value.innerHTML="",this.Ft.value.appendChild(t)),t.contentWindow&&(this.S?.destroy(),this.S=new wi(t.contentWindow,()=>this.cfg.socialBaseUrl),this.S.on("selected-files-change",this.ou.bind(this)),this.S.on("toolbar-state-change",this.ru.bind(this)),this.Xn());}Kr(){this.S?.destroy(),this.S=void 0,this.Ft.value&&(this.Ft.value.innerHTML=""),this.Xn();}Xn(){this.Dr=[],this.Vr=false,this.Fr=false,this._r=false,this.Nr=false,this.ci=false,this.zr=false,this.Br="uc-hidden",this.li=null;}disconnectedCallback(){super.disconnectedCallback(),this.Kr();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${ref(this.Ft)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.jn}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.B}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.ci}><span>${this.eu}</span><button type="button" @click=${this.lu} ?hidden=${!this._r}>${this.l10n("select-all")}</button><button type="button" @click=${this.cu} ?hidden=${!this.Nr}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Wi} ?disabled=${!this.Fr} ?hidden=${!this.zr} ><uc-spinner ?hidden=${this.Vr}></uc-spinner><span class=${this.Br}>${this.l10n("done")}</span></button></div></div>`}};u([state()],tt.prototype,"Dr",2),u([state()],tt.prototype,"Vr",2),u([state()],tt.prototype,"Fr",2),u([state()],tt.prototype,"_r",2),u([state()],tt.prototype,"Nr",2),u([state()],tt.prototype,"ci",2),u([state()],tt.prototype,"zr",2),u([state()],tt.prototype,"Br",2),u([state()],tt.prototype,"jn",2);var wl=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,xs=o=>{if(typeof o!="string")return false;let r=wl.exec(o.toLocaleLowerCase())??[];if(r.length===0)return false;let t=Number(r[1])*Number(r[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${r[1]}x${r[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:r[3]?Number(r[3])/100:void 0,size:t}};var F=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),U=class U extends Wt{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Qn=true;this.uid="";this.Hr="";this.jr="";this.Gr="";this.I=0;this.Yn=false;this.Wr="";this.Jn=false;this.ta=false;this.ea=false;this.ia=false;this.ra=false;this.ui=false;this.oa="";this.sa=false;this.uu=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(h.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=h.activities.CLOUD_IMG_EDIT;});this.du=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.pu=()=>{this.na();};this.p=E(()=>this.aa(),100);this.mu=this.withEntry(qt((t,e)=>{let i=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===F.FINISHED,l=e===F.UPLOADING,c=e===F.QUEUED_UPLOADING,d=e===F.QUEUED_VALIDATION,p=e===F.VALIDATION,f=t.getValue("fileName"),v="";i?v="":!a&&n&&s&&Object.values(lt).includes(s)&&(v=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.Gr=v,this.jr=i,this.Yn=l||c||d||p,this.I=d||p?0:t.getValue("uploadProgress"),this.oa=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.na=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.p();try{let i=new AbortController;t.setValue("abortController",i);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File&&this.cfg.imageShrink)try{let p=xs(this.cfg.imageShrink);p?a=await shrinkFile(a,p):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:p=>{if(p.isComputable){let f=p.value*100;t.setValue("uploadProgress",f);}},signal:i.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),uploadFile(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.p();}catch(i){this.telemetryManager.sendEventError(i,"file upload. Failed to upload file"),i instanceof CancelError&&i.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):i instanceof UploadcareError?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:i}):(console.error("Unknown upload error",i),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:i})})),t===this.entry&&this.p();}}});}aa(){let t=this.entry;if(!t)return;let e=F.IDLE;t.getValue("errors").length>0?e=F.FAILED:t.getValue("isQueuedForUploading")?e=F.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=F.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=F.VALIDATION:t.getValue("isUploading")?e=F.UPLOADING:t.getValue("fileInfo")&&(e=F.FINISHED),this.hu(t,e);}hu(t,e){e===F.FAILED?this.Wr="badge-error":e===F.FINISHED&&(this.Wr="badge-success"),e===F.UPLOADING&&(this.ia=false,this.removeAttribute("focused")),this.ta=e===F.FAILED,this.ea=e===F.UPLOADING,this.Jn=e===F.FINISHED,this.ra=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.mu(e);}reset(){super.reset(),this.p.cancel();}Xt(t){let[e]=t;e&&e.isIntersecting&&!this.sa&&(this.Qn=false,this.sa=true);}la(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.p();}),this.subEntry("isValidationPending",()=>{this.p();}),this.subEntry("uploadProgress",()=>{this.p();}),this.subEntry("isQueuedForUploading",()=>{this.p();}),this.subEntry("fileName",i=>{this.Hr=i||e.getValue("externalUrl")||this.l10n("file-no-name"),this.p();}),this.subEntry("externalUrl",i=>{this.Hr=e.getValue("fileName")||i||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.p();}),this.subEntry("errors",()=>this.p()),this.subEntry("isUploading",()=>this.p()),this.subEntry("fileSize",()=>this.p()),this.subEntry("mimeType",()=>this.p()),this.subEntry("isImage",()=>this.p()),this.aa());}ca(t){if(this.cfg.filesViewMode==="list"){this.ui=true;return}this.ui=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.la(this.uid);}initCallback(){super.initCallback(),this.la(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.p()),this.subConfigValue("filesViewMode",t=>{this.ca(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.ca(t);}),this.onclick=()=>{U.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.na());}),U.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.i=new window.IntersectionObserver(this.Xt.bind(this),{threshold:[0,1]}),this.i.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.i?.disconnect(),U.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Qn?false:super.shouldUpdate(t)}render(){return html`<div class="uc-inner" ?finished=${this.Jn} ?uploading=${this.ea} ?failed=${this.ta} ?focused=${this.ia}><uc-thumb .uid=${this.uid} .badgeIcon=${this.Wr}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.oa}><span class="uc-file-name" ?hidden=${!this.ui}>${this.Hr}</span><span class="uc-file-error" ?hidden=${!this.jr}>${this.jr}</span><span class="uc-file-hint" ?hidden=${!this.Gr}>${this.Gr}</span></div><div class="uc-file-actions"><button type="button" @click=${this.uu} ?hidden=${!this.ra} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.du} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.pu}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.I} .visible=${this.Yn} ?hasFileName=${this.ui}></uc-progress-bar></div>`}};u([state()],U.prototype,"Qn",2),u([property({type:String,attribute:false})],U.prototype,"uid",2),u([state()],U.prototype,"Hr",2),u([state()],U.prototype,"jr",2),u([state()],U.prototype,"Gr",2),u([state()],U.prototype,"I",2),u([state()],U.prototype,"Yn",2),u([state()],U.prototype,"Wr",2),u([state()],U.prototype,"Jn",2),u([state()],U.prototype,"ta",2),u([state()],U.prototype,"ea",2),u([state()],U.prototype,"ia",2),u([state()],U.prototype,"ra",2),u([state()],U.prototype,"ui",2),u([state()],U.prototype,"oa",2);var Ar=U;var we=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.ua="upload-file";this.fu=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.ua=t?"upload-files":"upload-file";});}render(){return html`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.fu}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.ua)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};u([property({attribute:"dropzone",type:Boolean})],we.prototype,"dropzone",2),u([state()],we.prototype,"ua",2);var ks="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var bt=class extends g{constructor(){super(...arguments);this.init$=Dr(this);}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this);}render(){return html`${unsafeSVG(ks)}`}};var Ti=class extends bt{constructor(){super();this.headless=false;this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});}render(){return html` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};u([property({type:Boolean})],Ti.prototype,"headless",2);var Ir=class extends K{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ei=class extends bt{constructor(){super();this.da=false;this.B=()=>{if(this.pa){let t=this.$["*historyBack"];t?.();return}this.ha&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get pa(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==h.activities.START_FROM}get ha(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Zr(){return this.getCssData("--cfg-init-activity")||h.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});let t=this.Zr();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.da=this.pa||this.ha;});}render(){return html` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.B} ?hidden=${!this.da} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};u([state()],Ei.prototype,"da",2);var Or="active",xi="",Rt=class extends bt{constructor(){super();this.qr=false;this.di=false;this.pi=xi;this.Xr=xi;this.Ht=t=>{t.id===h.activities.CLOUD_IMG_EDIT&&(this.pi=Or),this.$["*currentActivity"]===h.activities.UPLOAD_LIST&&(this.pi=Or,this.di=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.Xr=Or);};this.jt=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.di=false),t.id===h.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=h.activities.UPLOAD_LIST);};this.init$={...this.init$,"*solution":this.tagName};}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Zr(){return this.getCssData("--cfg-init-activity")||h.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:C.INIT_SOLUTION});let t=this.Zr();this.sub("*currentActivity",e=>{e===h.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=h.activities.UPLOAD_LIST,this.Xr=xi):(this.pi=xi,this.di=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",i=>{e==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.qr=!i):(this.style.removeProperty("--uc-grid-col"),this.qr=false);});}),this.modalManager?.subscribe(P.OPEN,this.Ht),this.modalManager?.subscribe(P.CLOSE,this.jt);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(P.OPEN,this.Ht),this.modalManager?.unsubscribe(P.CLOSE,this.jt);}render(){return html` ${super.render()}<uc-start-from ?hidden=${this.di} class=${this.Xr}><uc-drop-area ?single=${this.qr} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.pi}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};u([state()],Rt.prototype,"qr",2),u([state()],Rt.prototype,"di",2),u([state()],Rt.prototype,"pi",2),u([state()],Rt.prototype,"Xr",2);
|
|
8
|
+
export{h as ActivityBlock,ar as ActivityHeader,Ai as BaseComponent,g as Block,pt as BtnUi,O as CameraSource,Ir as CloudImageEditor,vi as CloudImageEditorActivity,K as CloudImageEditorBlock,bi as Config,rr as Copyright,ri as CropFrame,M as Data,ot as DropArea,li as EditorAspectRatioButtonControl,ui as EditorCropButtonControl,At as EditorFilterControl,pr as EditorFreeformButtonControl,hi as EditorImageCropper,mr as EditorImageFader,mi as EditorOperationControl,fr as EditorScroller,di as EditorSlider,Y as EditorToolbar,tt as ExternalSource,lt as ExternalUploadSource,Ar as FileItem,Ei as FileUploaderInline,Rt as FileUploaderMinimal,Ti as FileUploaderRegular,ir as FormInput,ne as Icon,Bi as Img,fi as LineLoaderUi,Hi as Modal,P as ModalEvents,st as PACKAGE_NAME,nt as PACKAGE_VERSION,ge as PresenceToggle,pe as ProgressBar,he as ProgressBarCommon,jt as Select,we as SimpleBtn,gt as SliderUi,bt as SolutionBlock,Gt as SourceBtn,Ze as SourceList,sr as Spinner,lr as StartFrom,Zt as Thumb,q as UID,cr as UploadCtxProvider,rt as UploadList,L as UploadSource,T as UploaderBlock,Xe as UrlSource,Ii as defineComponents,Rr as defineLocale,Bs as loadFileUploaderFrom,ee as toKebabCase};
|