@scaleflex/uploader 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- "use strict";const n=require("lit"),p=require("lit/decorators.js"),U=require("lit/directives/unsafe-svg.js"),O=require("lit/directives/unsafe-html.js");class we{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const t=this.state;this.state={...t,...e},this._notifying=!0;try{this.listeners.forEach(r=>r(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const r=this._pendingState;this._pendingState=null,this.setState(r)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function k(a,e,t){const r=a.getState().files,i=r.get(e);if(!i)return;const s=new Map(r);s.set(e,{...i,...t}),a.setState({files:s})}function L(a,e){const t=new Map(a.getState().files);t.set(e.id,e),a.setState({files:t})}function ge(a,e){const t=a.getState().files;if(!t.has(e))return;const r=new Map(t);r.delete(e),a.setState({files:r})}function _e(){return new we({files:new Map,queueConfig:{concurrency:3,autoProceed:!1,retryConfig:{maxRetries:0,baseDelay:1e3,maxDelay:3e4,backoffFactor:2}},isPaused:!1,restrictions:{maxFileSize:null,maxTotalFilesSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,blockedFileTypes:null},targetFolder:"/",totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0,isUploading:!1})}class Ee{constructor(e,t){this.host=e,this.store=t,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Ue(a,e){const t=new XMLHttpRequest;let r=!1;const s=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",s);for(const[l,c]of Object.entries(e.authHeaders))t.setRequestHeader(l,c);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!r&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(r)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{r||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{r||e.onError(new Error("Upload timed out"))});const o=new FormData;if(a.file){const l={name:a.name,type:a.type};Object.keys(a.meta).length>0&&(l.meta=a.meta),a.tags.length>0&&(l.tags=a.tags),o.append("info[files[]]",JSON.stringify(l)),o.append("files[]",a.file,a.name)}return t.timeout=6e4,t.send(o),{abort(){r=!0,t.abort()}}}function Pe(a,e){const t=new XMLHttpRequest;let r=!1;const s=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",s);for(const[l,c]of Object.entries(e.authHeaders))t.setRequestHeader(l,c);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(r)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{r||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{r||e.onError(new Error("Upload timed out"))}),!a.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const o={files_urls:[{url:a.remoteUrl,name:a.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(o)),{abort(){r=!0,t.abort()}}}function G(a){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":a}}function A(a){return a.replace(/\/+$/,"")}const De={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function B(a){return De[a]??a}function ze(a,e){const t=A(a),r=btoa(JSON.stringify({origin:window.location.origin})),i=B(e);return`${t}/${i}/connect?state=${encodeURIComponent(r)}`}async function Fe(a,e,t,r=""){const i=A(a),s=r?`/${r}`:"",o=B(e),l=await fetch(`${i}/${o}/list${s}`,{method:"GET",headers:G(t),credentials:"same-origin"});if(l.status===401)throw new J;if(!l.ok){const c=await l.json().catch(()=>null);throw new Error((c==null?void 0:c.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Te(a,e,t){const r=A(a),i=await fetch(`${r}/${t}`,{method:"GET",headers:G(e),credentials:"same-origin"});if(i.status===401)throw new J;if(!i.ok){const s=await i.json().catch(()=>null);throw new Error((s==null?void 0:s.message)||`Companion list failed (HTTP ${i.status})`)}return i.json()}async function Le(a,e,t,r){const i=A(a),s=B(e),o=r?`q=${encodeURIComponent(t)}&${r}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${i}/search/${s}/list?${o}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const c=await l.json().catch(()=>null);throw new Error((c==null?void 0:c.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Re(a,e,t,r,i,s=!1){const o=A(a),l=B(e),c=s?`${o}/search/${l}/get/${r}`:`${o}/${l}/get/${r}`,d=s?{Accept:"application/json","Content-Type":"application/json"}:G(t),u=await fetch(c,{method:"POST",headers:d,credentials:"same-origin",body:JSON.stringify({...i,httpMethod:i.httpMethod??"POST",useFormData:i.useFormData??!0,fieldname:i.fieldname??"files[]"})});if(u.status===401)throw new J;if(!u.ok){const f=await u.json().catch(()=>null);throw new Error((f==null?void 0:f.message)||`Companion upload failed (HTTP ${u.status})`)}return u.json()}async function Oe(a,e,t){const r=A(a),i=B(e),s=await fetch(`${r}/${i}/logout`,{method:"GET",headers:G(t),credentials:"same-origin"});return s.ok?s.json():{ok:!1,revoked:!1}}function Me(a){var i;const t=((i=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(a))==null?void 0:i[1])??a;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class J extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function je(a,e){const t=a.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let r=!1,i=null;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`,l={};a.meta&&Object.keys(a.meta).length>0&&Object.assign(l,a.meta),a.tags&&a.tags.length>0&&(l.tags=a.tags);const c=!t.token;return Re(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:o,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},c).then(d=>{if(r)return;const f=`${Me(t.companionUrl)}/api/${d.token}`;try{i=new WebSocket(f)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}i.onmessage=h=>{var g,m,v;if(!r)try{const T=JSON.parse(h.data);switch(T.action){case"progress":{const y=T.payload,E=y.bytesUploaded??0,I=y.bytesTotal??(t.size||1);e.onProgress(E,I);break}case"success":{const y=T.payload;if(i==null||i.close(),(g=y.response)!=null&&g.responseText)try{const E=JSON.parse(y.response.responseText);if(E.status==="success"){e.onComplete(E);return}e.onError(new Error(E.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{i==null||i.close();const y=T.payload;let E=((m=y.error)==null?void 0:m.message)||"Upload failed";if((v=y.response)!=null&&v.responseText)try{const I=JSON.parse(y.response.responseText);E=I.hint||I.msg||I.message||E}catch{}e.onError(new Error(E));break}}}catch{}},i.onerror=()=>{r||e.onError(new Error("Upload progress connection failed"))},i.onclose=()=>{i=null}}).catch(d=>{r||e.onError(d instanceof Error?d:new Error(String(d)))}),{abort(){if(r=!0,i){try{i.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}i.close(),i=null}}}}class ke{constructor(e,t){this.activeUploads=new Map,this.retryTimers=new Map,this.unsubscribe=null,this.store=e,this.config=t}start(){this.unsubscribe||(this.unsubscribe=this.store.subscribe(()=>this.processQueue()),this.processQueue())}uploadAll(){const{files:e}=this.store.getState();let t=!1;for(const r of e.values())r.status==="idle"?(k(this.store,r.id,{status:"queued"}),t=!0):r.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(k(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&k(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!xe(t.status)||(this.abortUpload(e),k(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())xe(t.status)&&(this.abortUpload(t.id),k(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,r=this.activeUploads.size,i=t-r;if(i<=0)return;const o=[...e.files.values()].filter(l=>l.status==="queued").sort((l,c)=>l.retryCount!==c.retryCount?c.retryCount-l.retryCount:l.addedAt-c.addedAt).slice(0,i);for(const l of o)this.startUpload(l)}startUpload(e){k(this.store,e.id,{status:"uploading",error:null});let t=0,r=Date.now(),i=0;const s={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:c=>this.handleComplete(e.id,c),onError:c=>this.handleError(e.id,c)},o=(c,d)=>{const u=Date.now(),f=(u-r)/1e3;if(f>0){const g=(c-t)/f;i=i===0?g:.3*g+.7*i}t=c,r=u;const h=d>0?c/d*100:0;k(this.store,e.id,{progress:h,bytesUploaded:c,speed:i}),this.updateTotalProgress()};let l;e.remoteInfo?l=je(e,{...s,onProgress:o}):e.remoteUrl?l=Pe(e,s):l=Ue(e,{...s,onProgress:o}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),k(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const r=this.store.getState().files.get(e);if(!r)return;const{retryConfig:i}=this.store.getState().queueConfig,s=r.retryCount+1;if(s<=i.maxRetries){const o=Math.min(i.baseDelay*Math.pow(i.backoffFactor,r.retryCount),i.maxDelay);k(this.store,e,{status:"retrying",error:t.message,retryCount:s});const l=setTimeout(()=>{this.retryTimers.delete(e),k(this.store,e,{status:"queued"}),this.processQueue()},o);this.retryTimers.set(e,l)}else k(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var r;(r=this.activeUploads.get(e))==null||r.abort(),this.activeUploads.delete(e);const t=this.retryTimers.get(e);t&&(clearTimeout(t),this.retryTimers.delete(e))}updateTotalProgress(){const{files:e}=this.store.getState();let t=0,r=0,i=0;for(const s of e.values())(s.status==="queued"||s.status==="uploading"||s.status==="retrying"||s.status==="complete"||s.status==="failed")&&(t+=s.size,r+=s.status==="complete"?s.size:s.bytesUploaded),s.status==="uploading"&&(i+=s.speed);this.store.setState({totalBytes:t,totalBytesUploaded:r,totalSpeed:i,totalProgress:t>0?r/t*100:0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(r=>r.status==="queued"||r.status==="uploading"||r.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function xe(a){return a==="queued"||a==="uploading"||a==="retrying"}function Z(a){return`https://api.filerobot.com/${a}`}async function Ce(a,e){const t=`${Z(a)}/key/${encodeURIComponent(e)}`,r=new AbortController,i=setTimeout(()=>r.abort(),3e4);try{const s=await fetch(t,{signal:r.signal});if(clearTimeout(i),!s.ok)throw new Error(`SASS key exchange failed (HTTP ${s.status})`);const o=await s.json();if(o.status==="error")throw new Error(`SASS key exchange failed: ${o.msg||"Unknown error"}`);return o.key}catch(s){throw clearTimeout(i),s instanceof DOMException&&s.name==="AbortError"?new Error("SASS key exchange timed out"):s}}function N(a,e){const t={};switch(a.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=a.sassKey;break;case"session":t["X-Filerobot-Session"]=a.sessionToken,a.companyToken&&(t["X-Company-Token"]=a.companyToken),a.projectToken&&(t["X-Project-Token"]=a.projectToken);break}return a.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=a.airboxPuid),t}async function $e(a){const e=Z(a.container);if(a.mode==="security-template"){const t=await Ce(a.container,a.securityTemplateId);return{apiBase:e,headers:N(a,t),sassKey:t}}return{apiBase:e,headers:N(a)}}const x={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let Ae=0;function R(){return`file-${Date.now()}-${++Ae}`}function V(a){if(a<=0)return"0 B";const e=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(a)/Math.log(1024)),e.length-1),r=a/Math.pow(1024,t);return`${t===0?r:r.toFixed(1)} ${e[t]}`}function Ie(a){var t;const e=((t=a.name.split(".").pop())==null?void 0:t.toLowerCase())??"";return a.type.startsWith("image/")?"image":a.type.startsWith("video/")||["mp4","mov","avi","webm","mkv"].includes(e)?"vid":a.type==="application/pdf"||e==="pdf"?"pdf":["doc","docx","xls","xlsx","ppt","pptx","txt","rtf","odt"].includes(e)?"doc":["zip","rar","7z","tar","gz","bz2"].includes(e)?"zip":"gen"}function Be(a){const e=a.lastIndexOf(".");return e>=0?a.slice(e+1).toUpperCase():""}const He={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",webm:"video/webm",pdf:"application/pdf",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function qe(a){var t;const e=((t=a.split(".").pop())==null?void 0:t.toLowerCase())??"";return He[e]||""}function Ye(a){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const r=URL.createObjectURL(a);let i=!1;const s=()=>{i||(i=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(r)};t.addEventListener("seeked",()=>{try{const o=document.createElement("canvas");o.width=t.videoWidth||320,o.height=t.videoHeight||240;const l=o.getContext("2d");if(l){l.drawImage(t,0,0,o.width,o.height),o.toBlob(c=>{i||(i=!0,e(c?URL.createObjectURL(c):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(r))},"image/jpeg",.7);return}}catch{}s()},{once:!0}),t.addEventListener("error",()=>s(),{once:!0}),setTimeout(()=>s(),5e3),t.src=r,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function te(a,e,t){var r,i;if(e.maxFileSize!=null&&a.size>0&&a.size>e.maxFileSize)return`File exceeds ${(e.maxFileSize/1048576).toFixed(1)} MB limit`;if(e.maxTotalFilesSize!=null&&a.size>0){let s=a.size;for(const o of t.values())o.status!=="rejected"&&o.status!=="cancelled"&&(s+=o.size);if(s>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let s=0;for(const o of t.values())o.status!=="rejected"&&o.status!=="cancelled"&&s++;if(s>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const s=e.allowedFileTypes,o="."+(((r=a.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(!s.some(c=>c.startsWith(".")?o===c.toLowerCase():c.endsWith("/*")?a.type.startsWith(c.slice(0,-1)):a.type===c))return"File type not allowed"}if(e.blockedFileTypes!=null){const s=e.blockedFileTypes,o="."+(((i=a.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(s.some(c=>c.startsWith(".")?o===c.toLowerCase():c.endsWith("/*")?a.type.startsWith(c.slice(0,-1)):a.type===c))return"File type is blocked"}return null}function Ne(a,e,t){return te(a,e,t)}function Ve(a){return a.allowedFileTypes?a.allowedFileTypes.join(","):""}const ve={"google-drive":{id:"google-drive",label:"Google Drive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:transparent"><svg width="16" height="16" viewBox="0 0 87.3 78"><path d="M6.6 66.85l3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3L27.5 53H0c0 1.55.4 3.1 1.2 4.5z" fill="#0066da"/><path d="M43.65 25L29.9 1.2C28.55 2 27.4 3.1 26.6 4.5L1.2 48.5C.4 49.9 0 51.45 0 53h27.5z" fill="#00ac47"/><path d="M73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5H59.8l5.65 10.85z" fill="#ea4335"/><path d="M43.65 25L57.4 1.2C56.05.4 54.5 0 52.9 0H34.4c-1.6 0-3.15.45-4.5 1.2z" fill="#00832d"/><path d="M59.8 53H27.5L13.75 76.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z" fill="#2684fc"/><path d="M73.4 26.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65 25 59.8 53h27.45c0-1.55-.4-3.1-1.2-4.5z" fill="#ffba00"/></svg></span>'},dropbox:{id:"dropbox",label:"Dropbox",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0061ff"><svg width="11" height="11" viewBox="0 0 528 512" fill="white"><path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zm-132 284.5l132-84.3 132 84.3-132 84.4-132-84.4zm132-116.6l132.3-84.3-132.3-83.9 131.6-84.3L528 116.3l-132.3 84.1L528 284.7l-132.4 83.9-131.2-84.4z"/></svg></span>'},onedrive:{id:"onedrive",label:"OneDrive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0078d4"><svg width="11" height="11" viewBox="0 0 24 24" fill="white"><path d="M10.5 13.5C10.5 11.57 12.07 10 14 10h6.5c.17 0 .34.01.5.02A6 6 0 009.01 11.6 4 4 0 0010.5 13.5zM12 14.5a5 5 0 00-5-5 5 5 0 00-5 5 3 3 0 003 3h9.5A3.5 3.5 0 0018 14c0-.18-.01-.35-.03-.52A5.48 5.48 0 0112 14.5z"/></svg></span>'},box:{id:"box",label:"Box",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0e50a0;font-size:9px;font-weight:800;color:#fff">box</span>'},instagram:{id:"instagram",label:"Instagram",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M12 2.16c2.94 0 3.29.01 4.45.06 1.07.05 1.8.22 2.43.46.66.25 1.21.6 1.77 1.16.55.55.9 1.1 1.16 1.77.25.64.41 1.37.46 2.43.05 1.16.06 1.51.06 4.45s-.01 3.29-.06 4.45c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 01-1.16 1.77c-.55.55-1.1.9-1.77 1.16-.64.25-1.37.41-2.43.46-1.16.05-1.51.06-4.45.06s-3.29-.01-4.45-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 01-1.77-1.16 4.9 4.9 0 01-1.16-1.77c-.25-.64-.41-1.37-.46-2.43C2.17 15.29 2.16 14.94 2.16 12s.01-3.29.06-4.45c.05-1.07.22-1.8.46-2.43a4.9 4.9 0 011.16-1.77A4.9 4.9 0 015.61 2.2c.64-.25 1.37-.41 2.43-.46C9.21 2.17 9.56 2.16 12 2.16zM12 16a4 4 0 110-8 4 4 0 010 8zm6.4-9.85a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg></span>'},facebook:{id:"facebook",label:"Facebook",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#1877f2"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07c0 6.02 4.39 11.02 10.12 11.93v-8.44H7.08v-3.49h3.04V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.95.93-1.95 1.89v2.26h3.33l-.53 3.49h-2.8v8.44C19.61 23.09 24 18.09 24 12.07z"/></svg></span>'},unsplash:{id:"unsplash",label:"Unsplash",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'}};function Se(a){return a.filter(e=>e in ve).map(e=>ve[e])}var Xe=Object.defineProperty,We=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&Xe(e,t,i),i};const Ke='<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',Ge='<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>',Je='<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>',Ze='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',M=[{id:"device",label:"My Device",icon:Ke,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Ge,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:Je,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:Ze,iconColor:"#ea580c"}],oe=class oe extends n.LitElement{constructor(){super(...arguments),this.sources=M}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return n.html`
2
- ${this.sources.map(e=>n.html`
1
+ "use strict";const a=require("lit"),p=require("lit/decorators.js"),U=require("lit/directives/unsafe-svg.js"),T=require("lit/directives/unsafe-html.js");class we{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const t=this.state;this.state={...t,...e},this._notifying=!0;try{this.listeners.forEach(r=>r(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const r=this._pendingState;this._pendingState=null,this.setState(r)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function k(n,e,t){const r=n.getState().files,i=r.get(e);if(!i)return;const s=new Map(r);s.set(e,{...i,...t}),n.setState({files:s})}function R(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function ge(n,e){const t=n.getState().files;if(!t.has(e))return;const r=new Map(t);r.delete(e),n.setState({files:r})}function _e(){return new we({files:new Map,queueConfig:{concurrency:3,autoProceed:!1,retryConfig:{maxRetries:0,baseDelay:1e3,maxDelay:3e4,backoffFactor:2}},isPaused:!1,restrictions:{maxFileSize:null,maxTotalFilesSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,blockedFileTypes:null},targetFolder:"/",totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0,isUploading:!1})}class Ee{constructor(e,t){this.host=e,this.store=t,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Ue(n,e){const t=new XMLHttpRequest;let r=!1;const s=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",s);for(const[l,c]of Object.entries(e.authHeaders))t.setRequestHeader(l,c);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!r&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(r)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{r||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{r||e.onError(new Error("Upload timed out"))});const o=new FormData;if(n.file){const l={name:n.name,type:n.type};Object.keys(n.meta).length>0&&(l.meta=n.meta),n.tags.length>0&&(l.tags=n.tags),o.append("info[files[]]",JSON.stringify(l)),o.append("files[]",n.file,n.name)}return t.timeout=6e4,t.send(o),{abort(){r=!0,t.abort()}}}function Pe(n,e){const t=new XMLHttpRequest;let r=!1;const s=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",s);for(const[l,c]of Object.entries(e.authHeaders))t.setRequestHeader(l,c);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(r)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{r||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{r||e.onError(new Error("Upload timed out"))}),!n.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const o={files_urls:[{url:n.remoteUrl,name:n.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(o)),{abort(){r=!0,t.abort()}}}function G(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function j(n){return n.replace(/\/+$/,"")}const De={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function B(n){return De[n]??n}function ze(n,e){const t=j(n),r=btoa(JSON.stringify({origin:window.location.origin})),i=B(e);return`${t}/${i}/connect?state=${encodeURIComponent(r)}`}async function Fe(n,e,t,r=""){const i=j(n),s=r?`/${r}`:"",o=B(e),l=await fetch(`${i}/${o}/list${s}`,{method:"GET",headers:G(t),credentials:"same-origin"});if(l.status===401)throw new J;if(!l.ok){const c=await l.json().catch(()=>null);throw new Error((c==null?void 0:c.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Le(n,e,t){const r=j(n),i=await fetch(`${r}/${t}`,{method:"GET",headers:G(e),credentials:"same-origin"});if(i.status===401)throw new J;if(!i.ok){const s=await i.json().catch(()=>null);throw new Error((s==null?void 0:s.message)||`Companion list failed (HTTP ${i.status})`)}return i.json()}async function Re(n,e,t,r){const i=j(n),s=B(e),o=r?`q=${encodeURIComponent(t)}&${r}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${i}/search/${s}/list?${o}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const c=await l.json().catch(()=>null);throw new Error((c==null?void 0:c.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Oe(n,e,t,r,i,s=!1){const o=j(n),l=B(e),c=s?`${o}/search/${l}/get/${r}`:`${o}/${l}/get/${r}`,d=s?{Accept:"application/json","Content-Type":"application/json"}:G(t),u=await fetch(c,{method:"POST",headers:d,credentials:"same-origin",body:JSON.stringify({...i,httpMethod:i.httpMethod??"POST",useFormData:i.useFormData??!0,fieldname:i.fieldname??"files[]"})});if(u.status===401)throw new J;if(!u.ok){const f=await u.json().catch(()=>null);throw new Error((f==null?void 0:f.message)||`Companion upload failed (HTTP ${u.status})`)}return u.json()}async function Te(n,e,t){const r=j(n),i=B(e),s=await fetch(`${r}/${i}/logout`,{method:"GET",headers:G(t),credentials:"same-origin"});return s.ok?s.json():{ok:!1,revoked:!1}}function Me(n){var i;const t=((i=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:i[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class J extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function Ae(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let r=!1,i=null;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`,l={};n.meta&&Object.keys(n.meta).length>0&&Object.assign(l,n.meta),n.tags&&n.tags.length>0&&(l.tags=n.tags);const c=!t.token;return Oe(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:o,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},c).then(d=>{if(r)return;const f=`${Me(t.companionUrl)}/api/${d.token}`;try{i=new WebSocket(f)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}i.onmessage=h=>{var g,m,v;if(!r)try{const L=JSON.parse(h.data);switch(L.action){case"progress":{const y=L.payload,E=y.bytesUploaded??0,I=y.bytesTotal??(t.size||1);e.onProgress(E,I);break}case"success":{const y=L.payload;if(i==null||i.close(),(g=y.response)!=null&&g.responseText)try{const E=JSON.parse(y.response.responseText);if(E.status==="success"){e.onComplete(E);return}e.onError(new Error(E.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{i==null||i.close();const y=L.payload;let E=((m=y.error)==null?void 0:m.message)||"Upload failed";if((v=y.response)!=null&&v.responseText)try{const I=JSON.parse(y.response.responseText);E=I.hint||I.msg||I.message||E}catch{}e.onError(new Error(E));break}}}catch{}},i.onerror=()=>{r||e.onError(new Error("Upload progress connection failed"))},i.onclose=()=>{i=null}}).catch(d=>{r||e.onError(d instanceof Error?d:new Error(String(d)))}),{abort(){if(r=!0,i){try{i.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}i.close(),i=null}}}}class ke{constructor(e,t){this.activeUploads=new Map,this.retryTimers=new Map,this.unsubscribe=null,this.store=e,this.config=t}start(){this.unsubscribe||(this.unsubscribe=this.store.subscribe(()=>this.processQueue()),this.processQueue())}uploadAll(){const{files:e}=this.store.getState();let t=!1;for(const r of e.values())r.status==="idle"?(k(this.store,r.id,{status:"queued"}),t=!0):r.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(k(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&k(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!xe(t.status)||(this.abortUpload(e),k(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())xe(t.status)&&(this.abortUpload(t.id),k(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,r=this.activeUploads.size,i=t-r;if(i<=0)return;const o=[...e.files.values()].filter(l=>l.status==="queued").sort((l,c)=>l.retryCount!==c.retryCount?c.retryCount-l.retryCount:l.addedAt-c.addedAt).slice(0,i);for(const l of o)this.startUpload(l)}startUpload(e){k(this.store,e.id,{status:"uploading",error:null});let t=0,r=Date.now(),i=0;const s={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:c=>this.handleComplete(e.id,c),onError:c=>this.handleError(e.id,c)},o=(c,d)=>{const u=Date.now(),f=(u-r)/1e3;if(f>0){const g=(c-t)/f;i=i===0?g:.3*g+.7*i}t=c,r=u;const h=d>0?c/d*100:0;k(this.store,e.id,{progress:h,bytesUploaded:c,speed:i}),this.updateTotalProgress()};let l;e.remoteInfo?l=Ae(e,{...s,onProgress:o}):e.remoteUrl?l=Pe(e,s):l=Ue(e,{...s,onProgress:o}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),k(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const r=this.store.getState().files.get(e);if(!r)return;const{retryConfig:i}=this.store.getState().queueConfig,s=r.retryCount+1;if(s<=i.maxRetries){const o=Math.min(i.baseDelay*Math.pow(i.backoffFactor,r.retryCount),i.maxDelay);k(this.store,e,{status:"retrying",error:t.message,retryCount:s});const l=setTimeout(()=>{this.retryTimers.delete(e),k(this.store,e,{status:"queued"}),this.processQueue()},o);this.retryTimers.set(e,l)}else k(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var r;(r=this.activeUploads.get(e))==null||r.abort(),this.activeUploads.delete(e);const t=this.retryTimers.get(e);t&&(clearTimeout(t),this.retryTimers.delete(e))}updateTotalProgress(){const{files:e}=this.store.getState();let t=0,r=0,i=0;for(const s of e.values())(s.status==="queued"||s.status==="uploading"||s.status==="retrying"||s.status==="complete"||s.status==="failed")&&(t+=s.size,r+=s.status==="complete"?s.size:s.bytesUploaded),s.status==="uploading"&&(i+=s.speed);this.store.setState({totalBytes:t,totalBytesUploaded:r,totalSpeed:i,totalProgress:t>0?r/t*100:0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(r=>r.status==="queued"||r.status==="uploading"||r.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function xe(n){return n==="queued"||n==="uploading"||n==="retrying"}function Z(n){return`https://api.filerobot.com/${n}`}async function Ce(n,e){const t=`${Z(n)}/key/${encodeURIComponent(e)}`,r=new AbortController,i=setTimeout(()=>r.abort(),3e4);try{const s=await fetch(t,{signal:r.signal});if(clearTimeout(i),!s.ok)throw new Error(`SASS key exchange failed (HTTP ${s.status})`);const o=await s.json();if(o.status==="error")throw new Error(`SASS key exchange failed: ${o.msg||"Unknown error"}`);return o.key}catch(s){throw clearTimeout(i),s instanceof DOMException&&s.name==="AbortError"?new Error("SASS key exchange timed out"):s}}function N(n,e){const t={};switch(n.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=n.sassKey;break}return n.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=n.airboxPuid),t}async function $e(n){const e=Z(n.container);if(n.mode==="security-template"){const t=await Ce(n.container,n.securityTemplateId);return{apiBase:e,headers:N(n,t),sassKey:t}}return{apiBase:e,headers:N(n)}}const x={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let je=0;function O(){return`file-${Date.now()}-${++je}`}function V(n){if(n<=0)return"0 B";const e=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(n)/Math.log(1024)),e.length-1),r=n/Math.pow(1024,t);return`${t===0?r:r.toFixed(1)} ${e[t]}`}function Ie(n){var t;const e=((t=n.name.split(".").pop())==null?void 0:t.toLowerCase())??"";return n.type.startsWith("image/")?"image":n.type.startsWith("video/")||["mp4","mov","avi","webm","mkv"].includes(e)?"vid":n.type==="application/pdf"||e==="pdf"?"pdf":["doc","docx","xls","xlsx","ppt","pptx","txt","rtf","odt"].includes(e)?"doc":["zip","rar","7z","tar","gz","bz2"].includes(e)?"zip":"gen"}function Be(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const He={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",webm:"video/webm",pdf:"application/pdf",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function qe(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return He[e]||""}function Ye(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const r=URL.createObjectURL(n);let i=!1;const s=()=>{i||(i=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(r)};t.addEventListener("seeked",()=>{try{const o=document.createElement("canvas");o.width=t.videoWidth||320,o.height=t.videoHeight||240;const l=o.getContext("2d");if(l){l.drawImage(t,0,0,o.width,o.height),o.toBlob(c=>{i||(i=!0,e(c?URL.createObjectURL(c):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(r))},"image/jpeg",.7);return}}catch{}s()},{once:!0}),t.addEventListener("error",()=>s(),{once:!0}),setTimeout(()=>s(),5e3),t.src=r,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function te(n,e,t){var r,i;if(e.maxFileSize!=null&&n.size>0&&n.size>e.maxFileSize)return`File exceeds ${(e.maxFileSize/1048576).toFixed(1)} MB limit`;if(e.maxTotalFilesSize!=null&&n.size>0){let s=n.size;for(const o of t.values())o.status!=="rejected"&&o.status!=="cancelled"&&(s+=o.size);if(s>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let s=0;for(const o of t.values())o.status!=="rejected"&&o.status!=="cancelled"&&s++;if(s>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const s=e.allowedFileTypes,o="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(!s.some(c=>c.startsWith(".")?o===c.toLowerCase():c.endsWith("/*")?n.type.startsWith(c.slice(0,-1)):n.type===c))return"File type not allowed"}if(e.blockedFileTypes!=null){const s=e.blockedFileTypes,o="."+(((i=n.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(s.some(c=>c.startsWith(".")?o===c.toLowerCase():c.endsWith("/*")?n.type.startsWith(c.slice(0,-1)):n.type===c))return"File type is blocked"}return null}function Ne(n,e,t){return te(n,e,t)}function Ve(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const ve={"google-drive":{id:"google-drive",label:"Google Drive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:transparent"><svg width="16" height="16" viewBox="0 0 87.3 78"><path d="M6.6 66.85l3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3L27.5 53H0c0 1.55.4 3.1 1.2 4.5z" fill="#0066da"/><path d="M43.65 25L29.9 1.2C28.55 2 27.4 3.1 26.6 4.5L1.2 48.5C.4 49.9 0 51.45 0 53h27.5z" fill="#00ac47"/><path d="M73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5H59.8l5.65 10.85z" fill="#ea4335"/><path d="M43.65 25L57.4 1.2C56.05.4 54.5 0 52.9 0H34.4c-1.6 0-3.15.45-4.5 1.2z" fill="#00832d"/><path d="M59.8 53H27.5L13.75 76.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z" fill="#2684fc"/><path d="M73.4 26.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65 25 59.8 53h27.45c0-1.55-.4-3.1-1.2-4.5z" fill="#ffba00"/></svg></span>'},dropbox:{id:"dropbox",label:"Dropbox",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0061ff"><svg width="11" height="11" viewBox="0 0 528 512" fill="white"><path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zm-132 284.5l132-84.3 132 84.3-132 84.4-132-84.4zm132-116.6l132.3-84.3-132.3-83.9 131.6-84.3L528 116.3l-132.3 84.1L528 284.7l-132.4 83.9-131.2-84.4z"/></svg></span>'},onedrive:{id:"onedrive",label:"OneDrive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0078d4"><svg width="11" height="11" viewBox="0 0 24 24" fill="white"><path d="M10.5 13.5C10.5 11.57 12.07 10 14 10h6.5c.17 0 .34.01.5.02A6 6 0 009.01 11.6 4 4 0 0010.5 13.5zM12 14.5a5 5 0 00-5-5 5 5 0 00-5 5 3 3 0 003 3h9.5A3.5 3.5 0 0018 14c0-.18-.01-.35-.03-.52A5.48 5.48 0 0112 14.5z"/></svg></span>'},box:{id:"box",label:"Box",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0e50a0;font-size:9px;font-weight:800;color:#fff">box</span>'},instagram:{id:"instagram",label:"Instagram",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M12 2.16c2.94 0 3.29.01 4.45.06 1.07.05 1.8.22 2.43.46.66.25 1.21.6 1.77 1.16.55.55.9 1.1 1.16 1.77.25.64.41 1.37.46 2.43.05 1.16.06 1.51.06 4.45s-.01 3.29-.06 4.45c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 01-1.16 1.77c-.55.55-1.1.9-1.77 1.16-.64.25-1.37.41-2.43.46-1.16.05-1.51.06-4.45.06s-3.29-.01-4.45-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 01-1.77-1.16 4.9 4.9 0 01-1.16-1.77c-.25-.64-.41-1.37-.46-2.43C2.17 15.29 2.16 14.94 2.16 12s.01-3.29.06-4.45c.05-1.07.22-1.8.46-2.43a4.9 4.9 0 011.16-1.77A4.9 4.9 0 015.61 2.2c.64-.25 1.37-.41 2.43-.46C9.21 2.17 9.56 2.16 12 2.16zM12 16a4 4 0 110-8 4 4 0 010 8zm6.4-9.85a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg></span>'},facebook:{id:"facebook",label:"Facebook",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#1877f2"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07c0 6.02 4.39 11.02 10.12 11.93v-8.44H7.08v-3.49h3.04V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.95.93-1.95 1.89v2.26h3.33l-.53 3.49h-2.8v8.44C19.61 23.09 24 18.09 24 12.07z"/></svg></span>'},unsplash:{id:"unsplash",label:"Unsplash",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'}};function Se(n){return n.filter(e=>e in ve).map(e=>ve[e])}var Xe=Object.defineProperty,We=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&Xe(e,t,i),i};const Ke='<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',Ge='<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>',Je='<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>',Ze='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',M=[{id:"device",label:"My Device",icon:Ke,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Ge,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:Je,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:Ze,iconColor:"#ea580c"}],oe=class oe extends a.LitElement{constructor(){super(...arguments),this.sources=M}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return a.html`
2
+ ${this.sources.map(e=>a.html`
3
3
  <button @click=${()=>this._handleClick(e)}>
4
- ${e.brandHtml?O.unsafeHTML(e.brandHtml):n.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
4
+ ${e.brandHtml?T.unsafeHTML(e.brandHtml):a.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
5
5
  ${e.label}
6
6
  </button>
7
7
  `)}
8
- `}};oe.styles=n.css`
8
+ `}};oe.styles=a.css`
9
9
  :host {
10
10
  display: flex;
11
11
  flex-wrap: wrap;
@@ -77,28 +77,28 @@
77
77
  stroke: none;
78
78
  stroke-width: 0;
79
79
  }
80
- `;let X=oe;We([p.property({type:Array})],X.prototype,"sources");var Qe=Object.defineProperty,S=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&Qe(e,t,i),i};const me=3,ae=class ae extends n.LitElement{constructor(){super(...arguments),this.compact=!1,this.externalDragOver=!1,this.accept="",this.sources=[],this.sourcesLayout="pills",this._dragOver=!1,this._moreOpen=!1,this._visiblePills=me,this._dragCounter=0,this._onDragEnter=e=>{e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._dragOver=!0)},this._onDragOver=e=>{e.preventDefault()},this._onDragLeave=e=>{e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._dragOver=!1)},this._onDrop=e=>{var r;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((r=e.dataTransfer)==null?void 0:r.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const r=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-r.left}px`,this._rippleEl.style.top=`${e.clientY-r.top}px`,this._rippleEl.classList.remove("go"),this._rippleEl.offsetWidth,this._rippleEl.classList.add("go")}this.browse()},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.browse())},this._onFileChange=e=>{const t=e.target,r=Array.from(t.files??[]);r.length>0&&this._emitFiles(r),t.value=""},this._onPaste=e=>{var i;if(!this.isConnected||this.offsetWidth===0)return;const t=(i=e.clipboardData)==null?void 0:i.items;if(!t)return;const r=[];for(const s of t)if(s.kind==="file"){const o=s.getAsFile();o&&r.push(o)}r.length>0&&(e.preventDefault(),this._emitFiles(r))},this._onDocClick=()=>{this._moreOpen&&(this._moreOpen=!1)},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1)},this._resizeTimer=null,this._onScrollOrResize=()=>{this._moreOpen&&this._positionDropdown(),this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>this._updateVisiblePills(),100)}}browse(){var e;(e=this.fileInput)==null||e.click()}_onSourceIconClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}_emitFiles(e){this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:e},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen&&requestAnimationFrame(()=>this._positionDropdown())}_positionDropdown(){var f,h;const e=(f=this.shadowRoot)==null?void 0:f.querySelector(".more-wrap > button"),t=(h=this.shadowRoot)==null?void 0:h.querySelector(".more-dropdown");if(!e||!t)return;const r=e.getBoundingClientRect(),i=8,s=t.scrollHeight,o=t.offsetWidth,l=r.top,c=window.innerHeight-r.bottom;l>=s+i||l>c?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${r.top-s-i}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${r.bottom+i}px`);let u=r.right-o;u=Math.max(8,Math.min(u,window.innerWidth-o-8)),t.style.left=`${u}px`}_onMoreItemClick(e,t){t.stopPropagation(),this._moreOpen=!1,this._onSourceIconClick(e)}_updateVisiblePills(){const e=window.innerWidth;this.sourcesLayout==="cards"?e<=480?this._visiblePills=2:e<=768?this._visiblePills=3:this._visiblePills=5:e<=480?this._visiblePills=1:e<=768?this._visiblePills=2:this._visiblePills=me}connectedCallback(){super.connectedCallback(),document.addEventListener("paste",this._onPaste),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize),this._updateVisiblePills()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("paste",this._onPaste),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize),this._resizeTimer&&clearTimeout(this._resizeTimer)}_renderPill(e){return n.html`
80
+ `;let X=oe;We([p.property({type:Array})],X.prototype,"sources");var Qe=Object.defineProperty,S=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&Qe(e,t,i),i};const me=3,ae=class ae extends a.LitElement{constructor(){super(...arguments),this.compact=!1,this.externalDragOver=!1,this.accept="",this.sources=[],this.sourcesLayout="pills",this._dragOver=!1,this._moreOpen=!1,this._visiblePills=me,this._dragCounter=0,this._onDragEnter=e=>{e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._dragOver=!0)},this._onDragOver=e=>{e.preventDefault()},this._onDragLeave=e=>{e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._dragOver=!1)},this._onDrop=e=>{var r;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((r=e.dataTransfer)==null?void 0:r.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const r=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-r.left}px`,this._rippleEl.style.top=`${e.clientY-r.top}px`,this._rippleEl.classList.remove("go"),this._rippleEl.offsetWidth,this._rippleEl.classList.add("go")}this.browse()},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.browse())},this._onFileChange=e=>{const t=e.target,r=Array.from(t.files??[]);r.length>0&&this._emitFiles(r),t.value=""},this._onPaste=e=>{var i;if(!this.isConnected||this.offsetWidth===0)return;const t=(i=e.clipboardData)==null?void 0:i.items;if(!t)return;const r=[];for(const s of t)if(s.kind==="file"){const o=s.getAsFile();o&&r.push(o)}r.length>0&&(e.preventDefault(),this._emitFiles(r))},this._onDocClick=()=>{this._moreOpen&&(this._moreOpen=!1)},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1)},this._resizeTimer=null,this._onScrollOrResize=()=>{this._moreOpen&&this._positionDropdown(),this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>this._updateVisiblePills(),100)}}browse(){var e;(e=this.fileInput)==null||e.click()}_onSourceIconClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}_emitFiles(e){this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:e},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen&&requestAnimationFrame(()=>this._positionDropdown())}_positionDropdown(){var f,h;const e=(f=this.shadowRoot)==null?void 0:f.querySelector(".more-wrap > button"),t=(h=this.shadowRoot)==null?void 0:h.querySelector(".more-dropdown");if(!e||!t)return;const r=e.getBoundingClientRect(),i=8,s=t.scrollHeight,o=t.offsetWidth,l=r.top,c=window.innerHeight-r.bottom;l>=s+i||l>c?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${r.top-s-i}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${r.bottom+i}px`);let u=r.right-o;u=Math.max(8,Math.min(u,window.innerWidth-o-8)),t.style.left=`${u}px`}_onMoreItemClick(e,t){t.stopPropagation(),this._moreOpen=!1,this._onSourceIconClick(e)}_updateVisiblePills(){const e=window.innerWidth;this.sourcesLayout==="cards"?e<=480?this._visiblePills=2:e<=768?this._visiblePills=3:this._visiblePills=5:e<=480?this._visiblePills=1:e<=768?this._visiblePills=2:this._visiblePills=me}connectedCallback(){super.connectedCallback(),document.addEventListener("paste",this._onPaste),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize),this._updateVisiblePills()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("paste",this._onPaste),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize),this._resizeTimer&&clearTimeout(this._resizeTimer)}_renderPill(e){return a.html`
81
81
  <button
82
82
  class="src-pill"
83
83
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
84
84
  >
85
- ${e.brandHtml?O.unsafeHTML(e.brandHtml):n.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
86
- ${n.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
85
+ ${e.brandHtml?T.unsafeHTML(e.brandHtml):a.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
86
+ ${a.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
87
87
  </span>`}
88
88
  ${e.label}
89
89
  </button>
90
- `}_renderCard(e){return n.html`
90
+ `}_renderCard(e){return a.html`
91
91
  <button
92
92
  class="src-card"
93
93
  aria-label=${e.label}
94
94
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
95
95
  >
96
- ${e.brandHtml?n.html`<span class="card-ico">${O.unsafeHTML(e.brandHtml)}</span>`:n.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
97
- ${n.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
96
+ ${e.brandHtml?a.html`<span class="card-ico">${T.unsafeHTML(e.brandHtml)}</span>`:a.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
97
+ ${a.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
98
98
  </span>`}
99
99
  <span class="card-label">${e.label}</span>
100
100
  </button>
101
- `}_renderMoreCard(e){return n.html`
101
+ `}_renderMoreCard(e){return a.html`
102
102
  <div class="more-wrap ${this._moreOpen?"open":""}">
103
103
  <button class="src-card" @click=${t=>this._toggleMore(t)}>
104
104
  <span class="card-ico" style="color: var(--sfx-up-text-muted, #94a3b8)">
@@ -111,17 +111,17 @@
111
111
  <span class="card-label">More</span>
112
112
  </button>
113
113
  <div class="more-dropdown">
114
- ${e.map(t=>n.html`
114
+ ${e.map(t=>a.html`
115
115
  <button class="more-item" @click=${r=>this._onMoreItemClick(t,r)}>
116
116
  <div class="more-item-ico">
117
- ${t.brandHtml?O.unsafeHTML(t.brandHtml):t.iconColor?n.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:n.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
117
+ ${t.brandHtml?T.unsafeHTML(t.brandHtml):t.iconColor?a.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:a.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
118
118
  </div>
119
119
  ${t.label}
120
120
  </button>
121
121
  `)}
122
122
  </div>
123
123
  </div>
124
- `}_renderMoreDropdown(e){return n.html`
124
+ `}_renderMoreDropdown(e){return a.html`
125
125
  <div class="more-wrap ${this._moreOpen?"open":""}">
126
126
  <button class="more-pill" @click=${t=>this._toggleMore(t)}>
127
127
  <svg class="more-dots" viewBox="0 0 24 24"><circle cx="5" cy="12" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="19" cy="12" r="1.5"/></svg>
@@ -129,17 +129,17 @@
129
129
  <svg class="more-chevron" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg>
130
130
  </button>
131
131
  <div class="more-dropdown">
132
- ${e.map(t=>n.html`
132
+ ${e.map(t=>a.html`
133
133
  <button class="more-item" @click=${r=>this._onMoreItemClick(t,r)}>
134
134
  <div class="more-item-ico">
135
- ${t.brandHtml?O.unsafeHTML(t.brandHtml):t.iconColor?n.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:n.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
135
+ ${t.brandHtml?T.unsafeHTML(t.brandHtml):t.iconColor?a.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:a.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
136
136
  </div>
137
137
  ${t.label}
138
138
  </button>
139
139
  `)}
140
140
  </div>
141
141
  </div>
142
- `}render(){const e=["drop-zone",this._dragOver||this.externalDragOver?"drag-over":"",this.compact?"compact":""].filter(Boolean).join(" "),t=this.sources.slice(0,this._visiblePills),r=this.sources.slice(this._visiblePills);return n.html`
142
+ `}render(){const e=["drop-zone",this._dragOver||this.externalDragOver?"drag-over":"",this.compact?"compact":""].filter(Boolean).join(" "),t=this.sources.slice(0,this._visiblePills),r=this.sources.slice(this._visiblePills);return a.html`
143
143
  <div
144
144
  class=${e}
145
145
  role="button"
@@ -168,27 +168,27 @@
168
168
  <div class="title">
169
169
  Drag & Drop or click to <span>browse</span>
170
170
  </div>
171
- ${this.compact?n.nothing:n.html`<div class="subtitle">Drop files anywhere on this page</div>`}
171
+ ${this.compact?a.nothing:a.html`<div class="subtitle">Drop files anywhere on this page</div>`}
172
172
 
173
- ${!this.compact&&this.sources.length>0?n.html`
173
+ ${!this.compact&&this.sources.length>0?a.html`
174
174
  <div class="import-divider"><span>Or import from</span></div>
175
- ${this.sourcesLayout==="cards"?n.html`
175
+ ${this.sourcesLayout==="cards"?a.html`
176
176
  <div class="sources-cards">
177
177
  ${t.map(i=>this._renderCard(i))}
178
- ${r.length>0?this._renderMoreCard(r):n.nothing}
178
+ ${r.length>0?this._renderMoreCard(r):a.nothing}
179
179
  </div>
180
- `:n.html`
180
+ `:a.html`
181
181
  <div class="sources-grid">
182
182
  ${t.map(i=>this._renderPill(i))}
183
- ${r.length>0?this._renderMoreDropdown(r):n.nothing}
183
+ ${r.length>0?this._renderMoreDropdown(r):a.nothing}
184
184
  </div>
185
185
  `}
186
- `:n.nothing}
186
+ `:a.nothing}
187
187
 
188
- ${this.compact&&this.sources.length>0?n.html`
188
+ ${this.compact&&this.sources.length>0?a.html`
189
189
  <div class="sources-row">
190
190
  <span class="src-divider"></span>
191
- ${this.sources.map(i=>n.html`
191
+ ${this.sources.map(i=>a.html`
192
192
  <button
193
193
  class="src-ico"
194
194
  style=${i.iconColor&&!i.brandHtml?`color:${i.iconColor}`:""}
@@ -196,21 +196,21 @@
196
196
  aria-label=${i.label}
197
197
  @click=${s=>{s.stopPropagation(),this._onSourceIconClick(i)}}
198
198
  >
199
- ${i.brandHtml?O.unsafeHTML(i.brandHtml):n.svg`<svg viewBox="0 0 24 24" class=${i.fillIcon?"fill-icon":""}>${U.unsafeSVG(i.icon)}</svg>`}
199
+ ${i.brandHtml?T.unsafeHTML(i.brandHtml):a.svg`<svg viewBox="0 0 24 24" class=${i.fillIcon?"fill-icon":""}>${U.unsafeSVG(i.icon)}</svg>`}
200
200
  </button>
201
201
  `)}
202
202
  </div>
203
- `:n.nothing}
203
+ `:a.nothing}
204
204
 
205
205
  <div class="ripple"></div>
206
206
  <input
207
207
  type="file"
208
208
  multiple
209
- accept=${this.accept||n.nothing}
209
+ accept=${this.accept||a.nothing}
210
210
  @change=${this._onFileChange}
211
211
  />
212
212
  </div>
213
- `}};ae.styles=n.css`
213
+ `}};ae.styles=a.css`
214
214
  :host {
215
215
  display: flex;
216
216
  flex-shrink: 0;
@@ -1003,11 +1003,11 @@
1003
1003
  animation: none;
1004
1004
  }
1005
1005
  }
1006
- `;let b=ae;S([p.property({type:Boolean,reflect:!0})],b.prototype,"compact");S([p.property({type:Boolean,attribute:"external-drag-over"})],b.prototype,"externalDragOver");S([p.property({type:String})],b.prototype,"accept");S([p.property({type:Array})],b.prototype,"sources");S([p.property({type:String,attribute:"sources-layout"})],b.prototype,"sourcesLayout");S([p.state()],b.prototype,"_dragOver");S([p.state()],b.prototype,"_moreOpen");S([p.state()],b.prototype,"_visiblePills");S([p.query(".ripple")],b.prototype,"_rippleEl");S([p.query('input[type="file"]')],b.prototype,"fileInput");const ne=class ne extends n.LitElement{render(){return n.html`
1006
+ `;let b=ae;S([p.property({type:Boolean,reflect:!0})],b.prototype,"compact");S([p.property({type:Boolean,attribute:"external-drag-over"})],b.prototype,"externalDragOver");S([p.property({type:String})],b.prototype,"accept");S([p.property({type:Array})],b.prototype,"sources");S([p.property({type:String,attribute:"sources-layout"})],b.prototype,"sourcesLayout");S([p.state()],b.prototype,"_dragOver");S([p.state()],b.prototype,"_moreOpen");S([p.state()],b.prototype,"_visiblePills");S([p.query(".ripple")],b.prototype,"_rippleEl");S([p.query('input[type="file"]')],b.prototype,"fileInput");const ne=class ne extends a.LitElement{render(){return a.html`
1007
1007
  <div class="line"></div>
1008
1008
  <div class="label">or import from</div>
1009
1009
  <div class="line"></div>
1010
- `}};ne.styles=n.css`
1010
+ `}};ne.styles=a.css`
1011
1011
  :host {
1012
1012
  display: flex;
1013
1013
  align-items: center;
@@ -1029,11 +1029,11 @@
1029
1029
  letter-spacing: 1px;
1030
1030
  white-space: nowrap;
1031
1031
  }
1032
- `;let re=ne;var et=Object.defineProperty,tt=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&et(e,t,i),i};const le=class le extends n.LitElement{constructor(){super(...arguments),this.files=[]}render(){return n.html`
1032
+ `;let re=ne;var et=Object.defineProperty,tt=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&et(e,t,i),i};const le=class le extends a.LitElement{constructor(){super(...arguments),this.files=[]}render(){return a.html`
1033
1033
  <div class="grid">
1034
- ${this.files.map((e,t)=>n.html`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`)}
1034
+ ${this.files.map((e,t)=>a.html`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`)}
1035
1035
  </div>
1036
- `}};le.styles=n.css`
1036
+ `}};le.styles=a.css`
1037
1037
  :host {
1038
1038
  display: block;
1039
1039
  flex: 1;
@@ -1072,22 +1072,22 @@
1072
1072
  gap: 8px;
1073
1073
  }
1074
1074
  }
1075
- `;let W=le;tt([p.property({attribute:!1})],W.prototype,"files");var rt=Object.defineProperty,it=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&rt(e,t,i),i};const ce=class ce extends n.LitElement{_remove(){this.dispatchEvent(new CustomEvent("file-remove",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_retry(){this.dispatchEvent(new CustomEvent("file-retry",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_preview(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("file-preview",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}render(){const e=this.file;if(!e)return n.nothing;const t=Ie(e),r=e.status==="complete",i=e.status==="uploading",s=e.status==="error"||e.status==="failed",o=e.status==="rejected",l=Be(e.name),c=["tile",r?"done":"",i?"uploading":"",o?"rejected":""].filter(Boolean).join(" ");return n.html`
1075
+ `;let W=le;tt([p.property({attribute:!1})],W.prototype,"files");var rt=Object.defineProperty,it=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&rt(e,t,i),i};const ce=class ce extends a.LitElement{_remove(){this.dispatchEvent(new CustomEvent("file-remove",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_retry(){this.dispatchEvent(new CustomEvent("file-retry",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_preview(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("file-preview",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}render(){const e=this.file;if(!e)return a.nothing;const t=Ie(e),r=e.status==="complete",i=e.status==="uploading",s=e.status==="error"||e.status==="failed",o=e.status==="rejected",l=Be(e.name),c=["tile",r?"done":"",i?"uploading":"",o?"rejected":""].filter(Boolean).join(" ");return a.html`
1076
1076
  <div class=${c} tabindex="0">
1077
1077
  <!-- Preview area -->
1078
1078
  <div class="preview">
1079
- ${e.previewUrl?n.html`<div class="preview-bg" style="background-image:url(${e.previewUrl})"></div>`:n.html`
1079
+ ${e.previewUrl?a.html`<div class="preview-bg" style="background-image:url(${e.previewUrl})"></div>`:a.html`
1080
1080
  <div class="preview-bg ${t}"></div>
1081
1081
  <div class="type-icon">
1082
1082
  <div class="type-icon-inner ${t}">
1083
1083
  ${this._renderTypeIcon(t)}
1084
- ${l?n.html`<div class="ext-label">${l}</div>`:n.nothing}
1084
+ ${l?a.html`<div class="ext-label">${l}</div>`:a.nothing}
1085
1085
  </div>
1086
1086
  </div>
1087
1087
  `}
1088
1088
 
1089
1089
  <!-- Preview button -->
1090
- ${!r&&!i&&!s&&e.status!=="rejected"?n.html`
1090
+ ${!r&&!i&&!s&&e.status!=="rejected"?a.html`
1091
1091
  <button class="preview-btn" @click=${this._preview} aria-label="Preview file">
1092
1092
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
1093
1093
  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
@@ -1095,7 +1095,7 @@
1095
1095
  </svg>
1096
1096
  Preview
1097
1097
  </button>
1098
- `:n.nothing}
1098
+ `:a.nothing}
1099
1099
 
1100
1100
  <!-- Spinner overlay -->
1101
1101
  <div class="spinner-overlay">
@@ -1103,33 +1103,33 @@
1103
1103
  </div>
1104
1104
 
1105
1105
  <!-- Done badge -->
1106
- ${r?n.html`<div class="done-badge">
1106
+ ${r?a.html`<div class="done-badge">
1107
1107
  <svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round">
1108
1108
  <polyline points="20 6 9 17 4 12" />
1109
1109
  </svg>
1110
- </div>`:n.nothing}
1110
+ </div>`:a.nothing}
1111
1111
 
1112
1112
  <!-- Progress bar -->
1113
- ${e.status==="uploading"?n.html`
1113
+ ${e.status==="uploading"?a.html`
1114
1114
  <div class="progress">
1115
1115
  <div class="progress-fill" style="transform:scaleX(${Math.min(e.progress,100)/100})"></div>
1116
1116
  </div>
1117
- `:n.nothing}
1117
+ `:a.nothing}
1118
1118
 
1119
1119
  <!-- Error / rejected badge -->
1120
- ${(s||o)&&e.error?n.html`<div class="error-badge" title=${e.error}>${e.error}</div>`:n.nothing}
1120
+ ${(s||o)&&e.error?a.html`<div class="error-badge" title=${e.error}>${e.error}</div>`:a.nothing}
1121
1121
  </div>
1122
1122
 
1123
1123
  <!-- Action buttons -->
1124
1124
  <div class="actions">
1125
- ${s?n.html`
1125
+ ${s?a.html`
1126
1126
  <button class="act-btn retry" @click=${this._retry} title="Retry" aria-label="Retry upload">
1127
1127
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1128
1128
  <polyline points="23 4 23 10 17 10" />
1129
1129
  <path d="M20.49 15a9 9 0 11-2.12-9.36L23 10" />
1130
1130
  </svg>
1131
1131
  </button>
1132
- `:n.nothing}
1132
+ `:a.nothing}
1133
1133
  <button class="act-btn del" @click=${this._remove} title="Remove" aria-label="Remove file">
1134
1134
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
1135
1135
  <polyline points="3 6 5 6 21 6" />
@@ -1147,7 +1147,7 @@
1147
1147
  <div class="meta">${e.size?V(e.size):""}${e.type?`${e.size?" · ":""}${e.type}`:""}</div>
1148
1148
  </div>
1149
1149
  </div>
1150
- `}_renderTypeIcon(e){switch(e){case"pdf":return n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>`;case"doc":return n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>`;case"vid":return n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;case"zip":return n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>`}}};ce.styles=n.css`
1150
+ `}_renderTypeIcon(e){switch(e){case"pdf":return a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>`;case"doc":return a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>`;case"vid":return a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;case"zip":return a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>`}}};ce.styles=a.css`
1151
1151
  :host {
1152
1152
  display: block;
1153
1153
  }
@@ -1502,7 +1502,7 @@
1502
1502
  .tile { animation: none; }
1503
1503
  .spin-ring { animation: none; }
1504
1504
  }
1505
- `;let K=ce;it([p.property({attribute:!1})],K.prototype,"file");const H=n.css`
1505
+ `;let K=ce;it([p.property({attribute:!1})],K.prototype,"file");const H=a.css`
1506
1506
  .btn,
1507
1507
  .btn-ghost,
1508
1508
  .btn-primary,
@@ -1571,12 +1571,12 @@
1571
1571
  opacity: 0.55;
1572
1572
  cursor: not-allowed;
1573
1573
  }
1574
- `,q=n.css`
1574
+ `,q=a.css`
1575
1575
  button:focus-visible {
1576
1576
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1577
1577
  outline-offset: 2px;
1578
1578
  }
1579
- `;var st=Object.defineProperty,Q=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&st(e,t,i),i};const be=7,de=class de extends n.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done"}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,be),t=this.thumbnails.length-be;return n.html`
1579
+ `;var st=Object.defineProperty,Q=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&st(e,t,i),i};const be=7,de=class de extends a.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done"}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,be),t=this.thumbnails.length-be;return a.html`
1580
1580
  <div class="card" role="status" aria-live="polite">
1581
1581
  <div class="icon">
1582
1582
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
@@ -1586,12 +1586,12 @@
1586
1586
  <div class="title">Uploaded successfully!</div>
1587
1587
  <div class="subtitle">All files are ready for use</div>
1588
1588
 
1589
- ${e.length>0?n.html`
1589
+ ${e.length>0?a.html`
1590
1590
  <div class="thumbs">
1591
- ${e.map(r=>n.html`<img class="thumb" src=${r} alt="" />`)}
1592
- ${t>0?n.html`<div class="thumb-more">+${t}</div>`:n.nothing}
1591
+ ${e.map(r=>a.html`<img class="thumb" src=${r} alt="" />`)}
1592
+ ${t>0?a.html`<div class="thumb-more">+${t}</div>`:a.nothing}
1593
1593
  </div>
1594
- `:n.nothing}
1594
+ `:a.nothing}
1595
1595
 
1596
1596
  <div class="summary">${this.fileCount} ${this.fileCount===1?"file":"files"} · ${V(this.totalSize)} uploaded</div>
1597
1597
 
@@ -1600,7 +1600,7 @@
1600
1600
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
1601
1601
  </div>
1602
1602
  </div>
1603
- `}};de.styles=[H,q,n.css`
1603
+ `}};de.styles=[H,q,a.css`
1604
1604
  :host {
1605
1605
  display: flex;
1606
1606
  flex: 1;
@@ -1726,18 +1726,18 @@
1726
1726
  .card { animation: none; }
1727
1727
  .icon { animation: none; }
1728
1728
  }
1729
- `];let D=de;Q([p.property({type:Number})],D.prototype,"fileCount");Q([p.property({type:Number})],D.prototype,"totalSize");Q([p.property({type:Array})],D.prototype,"thumbnails");Q([p.property({type:String})],D.prototype,"primaryLabel");var ot=Object.defineProperty,F=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&ot(e,t,i),i};const pe=class pe extends n.LitElement{constructor(){super(...arguments),this.uploadState="idle",this.fileCount=0,this.totalSize=0,this.failedCount=0,this.showFillMetadata=!1,this.completedCount=0,this.uploadProgress=0}_clear(){this.dispatchEvent(new CustomEvent("clear-all",{bubbles:!0,composed:!0}))}_addMore(){this.dispatchEvent(new CustomEvent("add-more",{bubbles:!0,composed:!0}))}_fillMetadata(){this.dispatchEvent(new CustomEvent("fill-metadata",{bubbles:!0,composed:!0}))}_upload(){this.dispatchEvent(new CustomEvent("upload-start",{bubbles:!0,composed:!0}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}render(){const e=this.uploadState==="uploading";return n.html`
1730
- ${e?n.html`
1729
+ `];let D=de;Q([p.property({type:Number})],D.prototype,"fileCount");Q([p.property({type:Number})],D.prototype,"totalSize");Q([p.property({type:Array})],D.prototype,"thumbnails");Q([p.property({type:String})],D.prototype,"primaryLabel");var ot=Object.defineProperty,F=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&ot(e,t,i),i};const pe=class pe extends a.LitElement{constructor(){super(...arguments),this.uploadState="idle",this.fileCount=0,this.totalSize=0,this.failedCount=0,this.showFillMetadata=!1,this.completedCount=0,this.uploadProgress=0}_clear(){this.dispatchEvent(new CustomEvent("clear-all",{bubbles:!0,composed:!0}))}_addMore(){this.dispatchEvent(new CustomEvent("add-more",{bubbles:!0,composed:!0}))}_fillMetadata(){this.dispatchEvent(new CustomEvent("fill-metadata",{bubbles:!0,composed:!0}))}_upload(){this.dispatchEvent(new CustomEvent("upload-start",{bubbles:!0,composed:!0}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}render(){const e=this.uploadState==="uploading";return a.html`
1730
+ ${e?a.html`
1731
1731
  <div class="progress-row">
1732
1732
  <div class="progress-track" role="progressbar" aria-valuenow=${Math.round(this.uploadProgress)} aria-valuemin="0" aria-valuemax="100" aria-label="Upload progress">
1733
1733
  <div class="progress-fill" style="width:${this.uploadProgress}%"></div>
1734
1734
  </div>
1735
1735
  <span class="progress-label">${this.completedCount}/${this.fileCount} files</span>
1736
1736
  </div>
1737
- `:n.nothing}
1737
+ `:a.nothing}
1738
1738
  <div class="buttons-row">
1739
1739
  <div class="left">
1740
- ${this.showFillMetadata&&this.uploadState==="idle"?n.html`
1740
+ ${this.showFillMetadata&&this.uploadState==="idle"?a.html`
1741
1741
  <button class="btn-sec" @click=${this._fillMetadata}>
1742
1742
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1743
1743
  <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
@@ -1748,7 +1748,7 @@
1748
1748
  </svg>
1749
1749
  Fill Metadata
1750
1750
  </button>
1751
- `:n.nothing}
1751
+ `:a.nothing}
1752
1752
  </div>
1753
1753
  <div class="right">
1754
1754
  <button class="btn-ghost" @click=${this._clear}>
@@ -1768,7 +1768,7 @@
1768
1768
  </svg>
1769
1769
  Add more
1770
1770
  </button>
1771
- ${this.failedCount>0?n.html`
1771
+ ${this.failedCount>0?a.html`
1772
1772
  <button class="btn-retry" @click=${this._retryAll}>
1773
1773
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
1774
1774
  <polyline points="23 4 23 10 17 10" />
@@ -1776,22 +1776,22 @@
1776
1776
  </svg>
1777
1777
  Retry all (${this.failedCount})
1778
1778
  </button>
1779
- `:n.nothing}
1779
+ `:a.nothing}
1780
1780
  ${this._renderUploadButton()}
1781
1781
  </div>
1782
1782
  </div>
1783
- `}_renderUploadButton(){const e=this.uploadState==="uploading",t=this.uploadState==="done",r=["btn-primary",t?"done-state":""].filter(Boolean).join(" ");return n.html`
1783
+ `}_renderUploadButton(){const e=this.uploadState==="uploading",t=this.uploadState==="done",r=["btn-primary",t?"done-state":""].filter(Boolean).join(" ");return a.html`
1784
1784
  <button
1785
1785
  class=${r}
1786
1786
  @click=${this._upload}
1787
1787
  ?disabled=${e}
1788
1788
  >
1789
- ${e?n.html`<span class="btn-spin"></span> Uploading\u2026`:t?n.html`
1789
+ ${e?a.html`<span class="btn-spin"></span> Uploading\u2026`:t?a.html`
1790
1790
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1791
1791
  <polyline points="20 6 9 17 4 12" />
1792
1792
  </svg>
1793
1793
  Done!
1794
- `:n.html`
1794
+ `:a.html`
1795
1795
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
1796
1796
  <polyline points="16 16 12 12 8 16" />
1797
1797
  <line x1="12" y1="12" x2="12" y2="21" />
@@ -1800,7 +1800,7 @@
1800
1800
  Upload
1801
1801
  `}
1802
1802
  </button>
1803
- `}};pe.styles=[H,q,n.css`
1803
+ `}};pe.styles=[H,q,a.css`
1804
1804
  :host {
1805
1805
  display: flex;
1806
1806
  flex-direction: column;
@@ -1948,7 +1948,7 @@
1948
1948
  :host { animation: none; }
1949
1949
  .btn-spin { animation: none; }
1950
1950
  }
1951
- `];let $=pe;F([p.property({type:String})],$.prototype,"uploadState");F([p.property({type:Number})],$.prototype,"fileCount");F([p.property({type:Number})],$.prototype,"totalSize");F([p.property({type:Number})],$.prototype,"failedCount");F([p.property({type:Boolean})],$.prototype,"showFillMetadata");F([p.property({type:Number})],$.prototype,"completedCount");F([p.property({type:Number})],$.prototype,"uploadProgress");const at='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ie(a,e){return t=>{if(t.key!=="Tab")return;const r=a();if(!r)return;const i=r.querySelector(e);if(!i)return;const s=Array.from(i.querySelectorAll(at));if(s.length===0)return;const o=s[0],l=s[s.length-1],c=r.activeElement;t.shiftKey?(c===o||!i.contains(c))&&(t.preventDefault(),l.focus()):(c===l||!i.contains(c))&&(t.preventDefault(),o.focus())}}var nt=Object.defineProperty,se=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&nt(e,t,i),i};const he=class he extends n.LitElement{constructor(){super(...arguments),this._url="",this._name="",this._error="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._onUrlInput=e=>{this._url=e.target.value,this._error="",this._autoName()},this._onNameInput=e=>{this._name=e.target.value},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{var t;e.key==="Escape"&&this._cancel(),e.key==="Enter"&&((t=e.target)==null?void 0:t.tagName)==="INPUT"&&this._submit(),this._focusTrap(e)}}_autoName(){var e;if(!this._name)try{const t=new URL(this._url).pathname.split("/"),r=t[t.length-1];if(r){const i=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");i&&(i.placeholder=r)}}catch{}}_cancel(){this.dispatchEvent(new CustomEvent("url-cancel",{bubbles:!0,composed:!0}))}_submit(){const e=this._url.trim();if(!e){this._error="Please enter a URL";return}try{new URL(e)}catch{this._error="Please enter a valid URL";return}this._error="";let t=this._name.trim();if(!t)try{const r=new URL(e).pathname.split("/");t=r[r.length-1]||"imported-file"}catch{t="imported-file"}this.dispatchEvent(new CustomEvent("url-submit",{detail:{url:e,name:t},bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var e,t;(t=(e=this.shadowRoot)==null?void 0:e.querySelector("#urlInput"))==null||t.focus()})}render(){return n.html`
1951
+ `];let $=pe;F([p.property({type:String})],$.prototype,"uploadState");F([p.property({type:Number})],$.prototype,"fileCount");F([p.property({type:Number})],$.prototype,"totalSize");F([p.property({type:Number})],$.prototype,"failedCount");F([p.property({type:Boolean})],$.prototype,"showFillMetadata");F([p.property({type:Number})],$.prototype,"completedCount");F([p.property({type:Number})],$.prototype,"uploadProgress");const at='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ie(n,e){return t=>{if(t.key!=="Tab")return;const r=n();if(!r)return;const i=r.querySelector(e);if(!i)return;const s=Array.from(i.querySelectorAll(at));if(s.length===0)return;const o=s[0],l=s[s.length-1],c=r.activeElement;t.shiftKey?(c===o||!i.contains(c))&&(t.preventDefault(),l.focus()):(c===l||!i.contains(c))&&(t.preventDefault(),o.focus())}}var nt=Object.defineProperty,se=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&nt(e,t,i),i};const he=class he extends a.LitElement{constructor(){super(...arguments),this._url="",this._name="",this._error="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._onUrlInput=e=>{this._url=e.target.value,this._error="",this._autoName()},this._onNameInput=e=>{this._name=e.target.value},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{var t;e.key==="Escape"&&this._cancel(),e.key==="Enter"&&((t=e.target)==null?void 0:t.tagName)==="INPUT"&&this._submit(),this._focusTrap(e)}}_autoName(){var e;if(!this._name)try{const t=new URL(this._url).pathname.split("/"),r=t[t.length-1];if(r){const i=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");i&&(i.placeholder=r)}}catch{}}_cancel(){this.dispatchEvent(new CustomEvent("url-cancel",{bubbles:!0,composed:!0}))}_submit(){const e=this._url.trim();if(!e){this._error="Please enter a URL";return}try{new URL(e)}catch{this._error="Please enter a valid URL";return}this._error="";let t=this._name.trim();if(!t)try{const r=new URL(e).pathname.split("/");t=r[r.length-1]||"imported-file"}catch{t="imported-file"}this.dispatchEvent(new CustomEvent("url-submit",{detail:{url:e,name:t},bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var e,t;(t=(e=this.shadowRoot)==null?void 0:e.querySelector("#urlInput"))==null||t.focus()})}render(){return a.html`
1952
1952
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
1953
1953
  <div class="card">
1954
1954
  <div class="head">
@@ -1982,7 +1982,7 @@
1982
1982
  @input=${this._onNameInput}
1983
1983
  />
1984
1984
  </div>
1985
- ${this._error?n.html`<div class="error">${this._error}</div>`:""}
1985
+ ${this._error?a.html`<div class="error">${this._error}</div>`:""}
1986
1986
  <div class="actions">
1987
1987
  <button class="btn btn-ghost" @click=${this._cancel}>Cancel</button>
1988
1988
  <button class="btn btn-primary" @click=${this._submit}>
@@ -1992,7 +1992,7 @@
1992
1992
  </div>
1993
1993
  </div>
1994
1994
  </div>
1995
- `}};he.styles=[H,q,n.css`
1995
+ `}};he.styles=[H,q,a.css`
1996
1996
  :host {
1997
1997
  display: block;
1998
1998
  }
@@ -2165,7 +2165,7 @@
2165
2165
  outline: none;
2166
2166
  }
2167
2167
 
2168
- `];let j=he;se([p.state()],j.prototype,"_url");se([p.state()],j.prototype,"_name");se([p.state()],j.prototype,"_error");var lt=Object.defineProperty,ee=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&lt(e,t,i),i};const ue=class ue extends n.LitElement{constructor(){super(...arguments),this._stream=null,this._error="",this._captured=null,this._previewUrl="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var i,s;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("video"),t=(s=this.shadowRoot)==null?void 0:s.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(o=>{o&&(this._captured=o,this._previewUrl=URL.createObjectURL(o),this._stopStream())},"image/jpeg",.92)},this._retake=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._captured=null,this._previewUrl="",this._startCamera()},this._usePhoto=()=>{if(!this._captured)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._captured],`camera-${e}.jpg`,{type:"image/jpeg"});this.dispatchEvent(new CustomEvent("camera-capture",{detail:{file:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this._startCamera()}disconnectedCallback(){super.disconnectedCallback(),this._stopStream(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}async _startCamera(){var e;try{this._stream=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream)}catch{this._error="Could not access camera. Please check your permissions."}}_stopStream(){var e;(e=this._stream)==null||e.getTracks().forEach(t=>t.stop()),this._stream=null}_cancel(){this._stopStream(),this.dispatchEvent(new CustomEvent("camera-cancel",{bubbles:!0,composed:!0}))}render(){return n.html`
2168
+ `];let A=he;se([p.state()],A.prototype,"_url");se([p.state()],A.prototype,"_name");se([p.state()],A.prototype,"_error");var lt=Object.defineProperty,ee=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&lt(e,t,i),i};const ue=class ue extends a.LitElement{constructor(){super(...arguments),this._stream=null,this._error="",this._captured=null,this._previewUrl="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var i,s;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("video"),t=(s=this.shadowRoot)==null?void 0:s.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(o=>{o&&(this._captured=o,this._previewUrl=URL.createObjectURL(o),this._stopStream())},"image/jpeg",.92)},this._retake=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._captured=null,this._previewUrl="",this._startCamera()},this._usePhoto=()=>{if(!this._captured)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._captured],`camera-${e}.jpg`,{type:"image/jpeg"});this.dispatchEvent(new CustomEvent("camera-capture",{detail:{file:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this._startCamera()}disconnectedCallback(){super.disconnectedCallback(),this._stopStream(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}async _startCamera(){var e;try{this._stream=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream)}catch{this._error="Could not access camera. Please check your permissions."}}_stopStream(){var e;(e=this._stream)==null||e.getTracks().forEach(t=>t.stop()),this._stream=null}_cancel(){this._stopStream(),this.dispatchEvent(new CustomEvent("camera-cancel",{bubbles:!0,composed:!0}))}render(){return a.html`
2169
2169
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2170
2170
  <div class="card">
2171
2171
  <div class="head">
@@ -2179,13 +2179,13 @@
2179
2179
  <button class="close-btn" aria-label="Close" @click=${this._cancel}>\u2715</button>
2180
2180
  </div>
2181
2181
  <div class="body">
2182
- ${this._error?n.html`<div class="error">${this._error}</div>`:this._captured?n.html`
2182
+ ${this._error?a.html`<div class="error">${this._error}</div>`:this._captured?a.html`
2183
2183
  <img class="preview-img" src=${this._previewUrl} alt="Captured photo" />
2184
2184
  <div class="actions">
2185
2185
  <button class="btn btn-ghost" @click=${this._retake}>Retake</button>
2186
2186
  <button class="btn btn-primary" @click=${this._usePhoto}>Use photo</button>
2187
2187
  </div>
2188
- `:n.html`
2188
+ `:a.html`
2189
2189
  <video autoplay playsinline muted></video>
2190
2190
  <canvas></canvas>
2191
2191
  <div class="actions">
@@ -2195,7 +2195,7 @@
2195
2195
  </div>
2196
2196
  </div>
2197
2197
  </div>
2198
- `}};ue.styles=[H,q,n.css`
2198
+ `}};ue.styles=[H,q,a.css`
2199
2199
  :host { display: block; }
2200
2200
 
2201
2201
  .backdrop {
@@ -2275,7 +2275,7 @@
2275
2275
 
2276
2276
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2277
2277
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2278
- `];let z=ue;ee([p.state()],z.prototype,"_stream");ee([p.state()],z.prototype,"_error");ee([p.state()],z.prototype,"_captured");ee([p.state()],z.prototype,"_previewUrl");var ct=Object.defineProperty,Y=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&ct(e,t,i),i};const fe=class fe extends n.LitElement{constructor(){super(...arguments),this._stream=null,this._recording=!1,this._error="",this._recordedBlob=null,this._previewUrl="",this._recorder=null,this._chunks=[],this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._startRecording=async()=>{var e;try{this._stream=await navigator.mediaDevices.getDisplayMedia({video:{width:1280,height:720,frameRate:5},audio:!0}),this._stream.getVideoTracks()[0].addEventListener("ended",()=>{this._stopRecording()}),this._recording=!0,await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream),this._chunks=[];const r=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:r}),this._recorder.ondataavailable=i=>{i.data.size>0&&this._chunks.push(i.data)},this._recorder.onstop=()=>{var s;const i=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=i,this._previewUrl=URL.createObjectURL(i),(s=this._stream)==null||s.getTracks().forEach(o=>o.stop()),this._stream=null},this._recorder.start()}catch{this._error="Could not start screen capture. Please check your permissions."}},this._stopRecording=()=>{var e;this._recording=!1,((e=this._recorder)==null?void 0:e.state)==="recording"&&this._recorder.stop(),this._recorder=null},this._useRecording=()=>{if(!this._recordedBlob)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._recordedBlob],`screencap-${e}.webm`,{type:"video/webm"});this.dispatchEvent(new CustomEvent("screencast-capture",{detail:{file:t},bubbles:!0,composed:!0}))},this._discard=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._recordedBlob=null,this._previewUrl=""}}disconnectedCallback(){super.disconnectedCallback(),this._stopAll(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}_stopAll(){var e,t;(e=this._recorder)==null||e.stop(),this._recorder=null,(t=this._stream)==null||t.getTracks().forEach(r=>r.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return n.html`
2278
+ `];let z=ue;ee([p.state()],z.prototype,"_stream");ee([p.state()],z.prototype,"_error");ee([p.state()],z.prototype,"_captured");ee([p.state()],z.prototype,"_previewUrl");var ct=Object.defineProperty,Y=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&ct(e,t,i),i};const fe=class fe extends a.LitElement{constructor(){super(...arguments),this._stream=null,this._recording=!1,this._error="",this._recordedBlob=null,this._previewUrl="",this._recorder=null,this._chunks=[],this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ie(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._startRecording=async()=>{var e;try{this._stream=await navigator.mediaDevices.getDisplayMedia({video:{width:1280,height:720,frameRate:5},audio:!0}),this._stream.getVideoTracks()[0].addEventListener("ended",()=>{this._stopRecording()}),this._recording=!0,await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream),this._chunks=[];const r=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:r}),this._recorder.ondataavailable=i=>{i.data.size>0&&this._chunks.push(i.data)},this._recorder.onstop=()=>{var s;const i=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=i,this._previewUrl=URL.createObjectURL(i),(s=this._stream)==null||s.getTracks().forEach(o=>o.stop()),this._stream=null},this._recorder.start()}catch{this._error="Could not start screen capture. Please check your permissions."}},this._stopRecording=()=>{var e;this._recording=!1,((e=this._recorder)==null?void 0:e.state)==="recording"&&this._recorder.stop(),this._recorder=null},this._useRecording=()=>{if(!this._recordedBlob)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._recordedBlob],`screencap-${e}.webm`,{type:"video/webm"});this.dispatchEvent(new CustomEvent("screencast-capture",{detail:{file:t},bubbles:!0,composed:!0}))},this._discard=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._recordedBlob=null,this._previewUrl=""}}disconnectedCallback(){super.disconnectedCallback(),this._stopAll(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}_stopAll(){var e,t;(e=this._recorder)==null||e.stop(),this._recorder=null,(t=this._stream)==null||t.getTracks().forEach(r=>r.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return a.html`
2279
2279
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2280
2280
  <div class="card">
2281
2281
  <div class="head">
@@ -2290,19 +2290,19 @@
2290
2290
  <button class="close-btn" aria-label="Close" @click=${this._cancel}>\u2715</button>
2291
2291
  </div>
2292
2292
  <div class="body">
2293
- ${this._error?n.html`<div class="error">${this._error}</div>`:this._recordedBlob?n.html`
2293
+ ${this._error?a.html`<div class="error">${this._error}</div>`:this._recordedBlob?a.html`
2294
2294
  <video src=${this._previewUrl} controls></video>
2295
2295
  <div class="actions">
2296
2296
  <button class="btn btn-ghost" @click=${this._discard}>Discard</button>
2297
2297
  <button class="btn btn-primary" @click=${this._useRecording}>Use recording</button>
2298
2298
  </div>
2299
- `:this._recording?n.html`
2299
+ `:this._recording?a.html`
2300
2300
  <video autoplay playsinline muted></video>
2301
2301
  <div class="status"><div class="rec-dot"></div> Recording...</div>
2302
2302
  <div class="actions">
2303
2303
  <button class="btn btn-danger" @click=${this._stopRecording}>Stop recording</button>
2304
2304
  </div>
2305
- `:n.html`
2305
+ `:a.html`
2306
2306
  <div class="start-view">
2307
2307
  <div class="start-icon">
2308
2308
  <svg viewBox="0 0 24 24">
@@ -2321,7 +2321,7 @@
2321
2321
  </div>
2322
2322
  </div>
2323
2323
  </div>
2324
- `}};fe.styles=[H,q,n.css`
2324
+ `}};fe.styles=[H,q,a.css`
2325
2325
  :host { display: block; }
2326
2326
 
2327
2327
  .backdrop {
@@ -2419,34 +2419,34 @@
2419
2419
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2420
2420
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2421
2421
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
2422
- `];let P=fe;Y([p.state()],P.prototype,"_stream");Y([p.state()],P.prototype,"_recording");Y([p.state()],P.prototype,"_error");Y([p.state()],P.prototype,"_recordedBlob");Y([p.state()],P.prototype,"_previewUrl");var dt=Object.defineProperty,C=(a,e,t,r)=>{for(var i=void 0,s=a.length-1,o;s>=0;s--)(o=a[s])&&(i=o(e,t,i)||i);return i&&dt(e,t,i),i};const ye=new Set(["unsplash"]);var w;const _=(w=class extends n.LitElement{constructor(){super(),this.config=null,this._isOpen=!1,this._activeConnector=null,this._showUrlDialog=!1,this._showCameraDialog=!1,this._showScreenCastDialog=!1,this._previewFileId=null,this._previewDims="—",this._fullscreenPreviewUrl=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._bodyDragCounter=0,this._engine=null,this._cachedSources=M,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onSourceClick=async e=>{var s,o;const t=e.detail.source,r=this._mergedSources.find(l=>l.id===t);if(r!=null&&r.onActivate){try{r.onActivate(this)}catch(l){console.error(`[sfx-uploader] onActivate for custom source "${t}" threw:`,l)}return}if(t==="device"){const l=this.shadowRoot.querySelector("sfx-drop-zone");l==null||l.browse();return}if(t==="url"){this._showUrlDialog=!0;return}if(t==="camera"){this._showCameraDialog=!0;return}if(t==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(s=this.config)==null?void 0:s.connectors)==null?void 0:o.providers)??[]).includes(t)){if(ye.has(t)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:c}=await Promise.resolve().then(()=>require("./search-provider-browser-uDZrkDBZ.cjs"));customElements.define("sfx-search-provider-browser",c)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:c}=await Promise.resolve().then(()=>require("./provider-browser-D7G2wcFH.cjs"));customElements.define("sfx-provider-browser",c)}this._activeConnector=t}},this._onUrlSubmit=e=>{var u,f,h;this._showUrlDialog=!1;const{url:t,name:r}=e.detail,i=(u=this.config)==null?void 0:u.callbacks,s=qe(r),o=s.startsWith("image/"),l=this._store.getState(),c=te({name:r,size:0,type:s},l.restrictions,l.files);if(c){const g={id:R(),status:"rejected",file:null,remoteUrl:t,name:r,size:0,type:s,previewUrl:null,progress:0,speed:0,bytesUploaded:0,error:c,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,g),this._dispatchPublic(x.FILE_REJECTED,{file:g,reason:c}),(f=i==null?void 0:i.onFileRejected)==null||f.call(i,g,c);return}const d={id:R(),status:"idle",file:null,remoteUrl:t,name:r,size:0,type:s,previewUrl:o?t:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,d),this._dispatchPublic(x.FILE_ADDED,{file:d}),(h=i==null?void 0:i.onFileAdded)==null||h.call(i,d),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var r,i,s;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(x.FILE_PREVIEW,{file:t}),(s=(i=(r=this.config)==null?void 0:r.callbacks)==null?void 0:i.onFilePreview)==null||s.call(i,t))},this._onFillMetadata=()=>{var t,r,i;const e=[...this._store.getState().files.values()].filter(s=>w._MODIFIABLE_STATUSES.has(s.status));this._dispatchPublic(x.FILL_METADATA,{files:e}),(i=(r=(t=this.config)==null?void 0:t.callbacks)==null?void 0:r.onFillMetadata)==null||i.call(r,e)},this._onFileRetry=e=>{var t;this._ensureEngine(),(t=this._engine)==null||t.retryFile(e.detail.fileId)},this._onRetryAll=()=>{var e;this._ensureEngine(),(e=this._engine)==null||e.retryAll()},this._onClearAll=()=>{var r,i,s;const e=(r=this.config)==null?void 0:r.callbacks;(i=this._engine)==null||i.cancelAll();const t=[...this._store.getState().files.values()];for(const o of t)o.previewUrl&&URL.revokeObjectURL(o.previewUrl),this._dispatchPublic(x.FILE_REMOVED,{file:o}),(s=e==null?void 0:e.onFileRemoved)==null||s.call(e,o);for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear(),this._dimCache.clear(),this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{const e=this.shadowRoot.querySelector("sfx-drop-zone");e==null||e.browse()},this._onUploadStart=()=>{var e;if(this._phase==="complete"){((e=this.config)==null?void 0:e.clearOnComplete)!==!1&&this._onClearAll();return}this.upload()},this._onUploadMore=()=>{this._onClearAll()},this._onConnectorFilesSelected=e=>{var r,i,s;const t=(r=this.config)==null?void 0:r.callbacks;for(const o of e.detail.files){const l=this._store.getState(),c=te({name:o.name,size:o.size,type:o.mimeType},l.restrictions,l.files);if(c){const u={id:R(),status:"rejected",file:null,remoteUrl:null,name:o.name,size:o.size,type:o.mimeType,previewUrl:o.thumbnail,progress:0,speed:0,bytesUploaded:0,error:c,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:o};L(this._store,u),this._dispatchPublic(x.FILE_REJECTED,{file:u,reason:c}),(i=t==null?void 0:t.onFileRejected)==null||i.call(t,u,c);continue}const d={id:R(),status:"idle",file:null,remoteUrl:null,name:o.name,size:o.size,type:o.mimeType,previewUrl:o.thumbnail,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:o};L(this._store,d),this._dispatchPublic(x.FILE_ADDED,{file:d}),(s=t==null?void 0:t.onFileAdded)==null||s.call(t,d)}this._activeConnector=null,this._store.getState().queueConfig.autoProceed&&this.upload()},this._onConnectorClose=()=>{this._activeConnector=null},this._onConnectorBackdropClick=e=>{e.target===e.currentTarget&&(this._activeConnector=null)},this._onPrimaryAction=()=>{var e,t;this._dispatchPublic(x.COMPLETE_ACTION,{}),((e=this.config)==null?void 0:e.mode)==="modal"?this.close():((t=this.config)==null?void 0:t.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,r;(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||r.call(t),this._dispatchPublic(x.CANCEL,{})},this._onModalDismiss=()=>{var e,t,r;(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||r.call(t),this._dispatchPublic(x.CANCEL,{}),this.close()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var r;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((r=e.dataTransfer)==null?void 0:r.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,r;if(e.key==="Escape"){if(this._fullscreenPreviewUrl){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((r=this.config)==null?void 0:r.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onFsToggleZoom=e=>{e==null||e.stopPropagation(),this._fullscreenZoomed=!this._fullscreenZoomed,this._fullscreenZoomed||(this._fsPanX=0,this._fsPanY=0)},this._onFsOverlayClick=e=>{this._fsDragDidMove||this._onFsToggleZoom(e)},this._fsDragDidMove=!1,this._onFsPanStart=e=>{this._fullscreenZoomed&&(this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=e.clientX,this._fsDragStartY=e.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY,e.preventDefault())},this._onFsPanMove=e=>{if(!this._fsDragging)return;const t=e.clientX-this._fsDragStartX,r=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+r,this.requestUpdate()},this._onFsPanEnd=()=>{this._fsDragging=!1,requestAnimationFrame(()=>{this._fsDragDidMove=!1})},this._onFsTouchStart=e=>{if(!this._fullscreenZoomed||e.touches.length!==1)return;const t=e.touches[0];this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=t.clientX,this._fsDragStartY=t.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY},this._onFsTouchMove=e=>{if(!this._fsDragging||e.touches.length!==1)return;const t=e.touches[0],r=t.clientX-this._fsDragStartX,i=t.clientY-this._fsDragStartY;(Math.abs(r)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+r,this._fsPanY=this._fsPanStartY+i,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=_e(),this._storeCtrl=new Ee(this,this._store)}open(){var e,t,r;this._isOpen||(this._isOpen=!0,(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||r.call(t),this._dispatchPublic(x.OPEN,{}),this.requestUpdate())}close(){var e,t,r,i;this._isOpen&&(this._isOpen=!1,((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(i=(r=(t=this.config)==null?void 0:t.callbacks)==null?void 0:r.onClose)==null||i.call(r),this._dispatchPublic(x.CLOSE,{}),this.requestUpdate())}upload(){var i,s,o,l,c;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(d=>d.status==="idle"||d.status==="queued");if((s=(i=this.config)==null?void 0:i.callbacks)!=null&&s.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(x.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(x.UPLOAD_STARTED,{files:e}),(c=(l=(o=this.config)==null?void 0:o.callbacks)==null?void 0:l.onUploadStarted)==null||c.call(l,e),this._engine.uploadAll())}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const r=this._store.getState().files,i=new Map(r);let s=!1;for(const o of e){const l=r.get(o.id);l&&(i.set(o.id,{...l,...o}),s=!0)}s&&this._store.setState({files:i})}this._ensureEngine(),(t=this._engine)==null||t.uploadAll()}cancelUpload(){var e;(e=this._engine)==null||e.cancelAll()}getFiles(){return[...this._store.getState().files.values()]}getFile(e){return this._store.getState().files.get(e)}updateFileMeta(e,t,r){const i=this._store.getState().files,s=i.get(e);if(!s||!w._MODIFIABLE_STATUSES.has(s.status))return;const o=new Map(i);o.set(e,{...s,meta:t!=null?{...s.meta,...t}:s.meta,tags:r??s.tags}),this._store.setState({files:o})}updateFilesMeta(e){const t=this._store.getState().files,r=new Map(t);let i=!1;for(const{fileId:s,meta:o,tags:l}of e){const c=t.get(s);!c||!w._MODIFIABLE_STATUSES.has(c.status)||(r.set(s,{...c,meta:o!=null?{...c.meta,...o}:c.meta,tags:l??c.tags}),i=!0)}i&&this._store.setState({files:r})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._store.getState().files.get(this._previewFileId);t?this._getImageDimensions(t).then(r=>{this._previewDims=r?`${r.w} × ${r.h}`:"—"}):this._previewDims="—"}}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null;for(const r of this._rejectedTimers.values())clearTimeout(r);this._rejectedTimers.clear();for(const r of this._store.getState().files.values())r.previewUrl&&URL.revokeObjectURL(r.previewUrl);(t=this._engine)==null||t.destroy(),this._engine=null}_applyConfig(e){const t={};if(e.targetFolder&&(t.targetFolder=e.targetFolder),e.restrictions&&(t.restrictions={...this._store.getState().restrictions,...e.restrictions}),e.concurrency!=null){const r=this._store.getState().queueConfig;t.queueConfig={...r,concurrency:e.concurrency}}if(e.autoProceed!=null){const r=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...r,autoProceed:e.autoProceed}}Object.keys(t).length>0&&this._store.setState(t),this._resolveAuthAndEngine(e),(e.mode==="inline"||!e.mode)&&(this._isOpen=!0)}async _resolveAuthAndEngine(e){var i,s;const t=e.auth;if(t.mode==="sass-key"||t.mode==="session"){this._apiBase=Z(t.container),this._authHeaders=N(t),this._ensureEngine(),(i=this._engine)==null||i.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const r=++this._authResolveId;try{const o=await $e(t);if(r!==this._authResolveId)return;this._apiBase=o.apiBase,this._authHeaders=o.headers,this._ensureEngine(),(s=this._engine)==null||s.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(o){if(r!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",o)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new ke(this._store,{apiBase:this._apiBase,authHeaders:this._authHeaders}),this._engine.start())}_dispatchPublic(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}_onStoreChange(){var i,s,o,l,c,d,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const r=(i=this.config)==null?void 0:i.callbacks;for(const[f,h]of e.files){const g=t.files.get(f);if(g){if(g.status!==h.status)switch(h.status){case"uploading":break;case"complete":h.response&&(this._dispatchPublic(x.UPLOAD_COMPLETE,{file:h,response:h.response}),(s=r==null?void 0:r.onUploadComplete)==null||s.call(r,h,h.response));break;case"error":case"failed":{const m=new Error(h.error??"Upload failed");this._dispatchPublic(x.UPLOAD_ERROR,{file:h,error:m}),(o=r==null?void 0:r.onUploadError)==null||o.call(r,h,m);break}case"retrying":this._dispatchPublic(x.UPLOAD_RETRY,{file:h,attempt:h.retryCount}),(l=r==null?void 0:r.onUploadRetry)==null||l.call(r,h,h.retryCount);break}h.status==="uploading"&&g.progress!==h.progress&&(this._dispatchPublic(x.UPLOAD_PROGRESS,{file:h,progress:h.progress,speed:h.speed}),(c=r==null?void 0:r.onUploadProgress)==null||c.call(r,h,h.progress,h.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const f=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(x.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:f}),(d=r==null?void 0:r.onTotalProgress)==null||d.call(r,e.totalProgress,e.totalSpeed,f)}if(t.isUploading&&!e.isUploading){const f=[...e.files.values()];if(!f.some(g=>g.status==="cancelled")){const g=f.filter(v=>v.status==="complete"),m=f.filter(v=>v.status==="failed"||v.status==="error");this._dispatchPublic(x.ALL_COMPLETE,{successful:g,failed:m}),(u=r==null?void 0:r.onAllComplete)==null||u.call(r,g,m)}}}get _mergedSources(){var c;const e=(c=this.config)==null?void 0:c.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=M,this._cachedSources;const t=e.providers.length>0?Se(e.providers):[],r=e.customSources??[],i=M.filter(d=>d.id==="device"||d.id==="url"),s=M.filter(d=>d.id!=="device"&&d.id!=="url"),o=new Set,l=[];for(const d of[...i,...t,...s,...r])if(!o.has(d.id)){if(w._RESERVED_IDS.has(d.id)&&d.onActivate){console.warn(`[sfx-uploader] Custom source id "${d.id}" conflicts with a built-in source and was skipped.`);continue}o.add(d.id),l.push(d)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const r=new Set(["complete","rejected","cancelled","failed"]);return t.every(i=>r.has(i.status))&&t.some(i=>i.status==="complete")?"complete":"ready"}_processIncomingFiles(e){var r,i,s,o;const t=(r=this.config)==null?void 0:r.callbacks;for(const l of e){const c=this._store.getState(),d=Ne(l,c.restrictions,c.files);if(d){const h={id:R(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,h),this._dispatchPublic(x.FILE_REJECTED,{file:h,reason:d}),(i=t==null?void 0:t.onFileRejected)==null||i.call(t,h,d);const g=(s=this.config)==null?void 0:s.rejectedFileAutoRemoveDelay,m=g===!1||g===0?0:g??4e3;if(m>0){const v=h.id,T=setTimeout(()=>{this._rejectedTimers.delete(v);const y=this._store.getState().files.get(v);y&&y.status==="rejected"&&ge(this._store,v)},m);this._rejectedTimers.set(v,T)}continue}let u=null;l.type.startsWith("image/")&&(u=URL.createObjectURL(l));const f={id:R(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:u,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,f),this._dispatchPublic(x.FILE_ADDED,{file:f}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,f),l.type.startsWith("video/")&&Ye(l).then(h=>{if(!h)return;const g=this._store.getState(),m=g.files.get(f.id);if(m){const v=new Map(g.files);v.set(f.id,{...m,previewUrl:h}),this._store.setState({files:v})}else URL.revokeObjectURL(h)})}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var i,s,o,l;const t=this._store.getState().files.get(e);if(!t)return;const r={...t};t.previewUrl&&URL.revokeObjectURL(t.previewUrl),(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((i=this._engine)==null||i.cancelFile(e)),ge(this._store,e),this._dimCache.delete(e),this._dispatchPublic(x.FILE_REMOVED,{file:r}),(l=(o=(s=this.config)==null?void 0:s.callbacks)==null?void 0:o.onFileRemoved)==null||l.call(o,r)}render(){var t;return(((t=this.config)==null?void 0:t.mode)??"modal")==="modal"?this._isOpen?n.html`
2422
+ `];let P=fe;Y([p.state()],P.prototype,"_stream");Y([p.state()],P.prototype,"_recording");Y([p.state()],P.prototype,"_error");Y([p.state()],P.prototype,"_recordedBlob");Y([p.state()],P.prototype,"_previewUrl");var dt=Object.defineProperty,C=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(e,t,i)||i);return i&&dt(e,t,i),i};const ye=new Set(["unsplash"]);var w;const _=(w=class extends a.LitElement{constructor(){super(),this.config=null,this._isOpen=!1,this._activeConnector=null,this._showUrlDialog=!1,this._showCameraDialog=!1,this._showScreenCastDialog=!1,this._previewFileId=null,this._previewDims="—",this._fullscreenPreviewUrl=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._bodyDragCounter=0,this._engine=null,this._cachedSources=M,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onSourceClick=async e=>{var s,o;const t=e.detail.source,r=this._mergedSources.find(l=>l.id===t);if(r!=null&&r.onActivate){try{r.onActivate(this)}catch(l){console.error(`[sfx-uploader] onActivate for custom source "${t}" threw:`,l)}return}if(t==="device"){const l=this.shadowRoot.querySelector("sfx-drop-zone");l==null||l.browse();return}if(t==="url"){this._showUrlDialog=!0;return}if(t==="camera"){this._showCameraDialog=!0;return}if(t==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(s=this.config)==null?void 0:s.connectors)==null?void 0:o.providers)??[]).includes(t)){if(ye.has(t)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:c}=await Promise.resolve().then(()=>require("./search-provider-browser-BrKVwGf_.cjs"));customElements.define("sfx-search-provider-browser",c)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:c}=await Promise.resolve().then(()=>require("./provider-browser-yW3pZFSP.cjs"));customElements.define("sfx-provider-browser",c)}this._activeConnector=t}},this._onUrlSubmit=e=>{var u,f,h;this._showUrlDialog=!1;const{url:t,name:r}=e.detail,i=(u=this.config)==null?void 0:u.callbacks,s=qe(r),o=s.startsWith("image/"),l=this._store.getState(),c=te({name:r,size:0,type:s},l.restrictions,l.files);if(c){const g={id:O(),status:"rejected",file:null,remoteUrl:t,name:r,size:0,type:s,previewUrl:null,progress:0,speed:0,bytesUploaded:0,error:c,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};R(this._store,g),this._dispatchPublic(x.FILE_REJECTED,{file:g,reason:c}),(f=i==null?void 0:i.onFileRejected)==null||f.call(i,g,c);return}const d={id:O(),status:"idle",file:null,remoteUrl:t,name:r,size:0,type:s,previewUrl:o?t:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};R(this._store,d),this._dispatchPublic(x.FILE_ADDED,{file:d}),(h=i==null?void 0:i.onFileAdded)==null||h.call(i,d),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var r,i,s;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(x.FILE_PREVIEW,{file:t}),(s=(i=(r=this.config)==null?void 0:r.callbacks)==null?void 0:i.onFilePreview)==null||s.call(i,t))},this._onFillMetadata=()=>{var t,r,i;const e=[...this._store.getState().files.values()].filter(s=>w._MODIFIABLE_STATUSES.has(s.status));this._dispatchPublic(x.FILL_METADATA,{files:e}),(i=(r=(t=this.config)==null?void 0:t.callbacks)==null?void 0:r.onFillMetadata)==null||i.call(r,e)},this._onFileRetry=e=>{var t;this._ensureEngine(),(t=this._engine)==null||t.retryFile(e.detail.fileId)},this._onRetryAll=()=>{var e;this._ensureEngine(),(e=this._engine)==null||e.retryAll()},this._onClearAll=()=>{var r,i,s;const e=(r=this.config)==null?void 0:r.callbacks;(i=this._engine)==null||i.cancelAll();const t=[...this._store.getState().files.values()];for(const o of t)o.previewUrl&&URL.revokeObjectURL(o.previewUrl),this._dispatchPublic(x.FILE_REMOVED,{file:o}),(s=e==null?void 0:e.onFileRemoved)==null||s.call(e,o);for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear(),this._dimCache.clear(),this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{const e=this.shadowRoot.querySelector("sfx-drop-zone");e==null||e.browse()},this._onUploadStart=()=>{var e;if(this._phase==="complete"){((e=this.config)==null?void 0:e.clearOnComplete)!==!1&&this._onClearAll();return}this.upload()},this._onUploadMore=()=>{this._onClearAll()},this._onConnectorFilesSelected=e=>{var r,i,s;const t=(r=this.config)==null?void 0:r.callbacks;for(const o of e.detail.files){const l=this._store.getState(),c=te({name:o.name,size:o.size,type:o.mimeType},l.restrictions,l.files);if(c){const u={id:O(),status:"rejected",file:null,remoteUrl:null,name:o.name,size:o.size,type:o.mimeType,previewUrl:o.thumbnail,progress:0,speed:0,bytesUploaded:0,error:c,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:o};R(this._store,u),this._dispatchPublic(x.FILE_REJECTED,{file:u,reason:c}),(i=t==null?void 0:t.onFileRejected)==null||i.call(t,u,c);continue}const d={id:O(),status:"idle",file:null,remoteUrl:null,name:o.name,size:o.size,type:o.mimeType,previewUrl:o.thumbnail,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:o};R(this._store,d),this._dispatchPublic(x.FILE_ADDED,{file:d}),(s=t==null?void 0:t.onFileAdded)==null||s.call(t,d)}this._activeConnector=null,this._store.getState().queueConfig.autoProceed&&this.upload()},this._onConnectorClose=()=>{this._activeConnector=null},this._onConnectorBackdropClick=e=>{e.target===e.currentTarget&&(this._activeConnector=null)},this._onPrimaryAction=()=>{var e,t;this._dispatchPublic(x.COMPLETE_ACTION,{}),((e=this.config)==null?void 0:e.mode)==="modal"?this.close():((t=this.config)==null?void 0:t.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,r;(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||r.call(t),this._dispatchPublic(x.CANCEL,{})},this._onModalDismiss=()=>{var e,t,r;(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||r.call(t),this._dispatchPublic(x.CANCEL,{}),this.close()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var r;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((r=e.dataTransfer)==null?void 0:r.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,r;if(e.key==="Escape"){if(this._fullscreenPreviewUrl){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((r=this.config)==null?void 0:r.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onFsToggleZoom=e=>{e==null||e.stopPropagation(),this._fullscreenZoomed=!this._fullscreenZoomed,this._fullscreenZoomed||(this._fsPanX=0,this._fsPanY=0)},this._onFsOverlayClick=e=>{this._fsDragDidMove||this._onFsToggleZoom(e)},this._fsDragDidMove=!1,this._onFsPanStart=e=>{this._fullscreenZoomed&&(this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=e.clientX,this._fsDragStartY=e.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY,e.preventDefault())},this._onFsPanMove=e=>{if(!this._fsDragging)return;const t=e.clientX-this._fsDragStartX,r=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+r,this.requestUpdate()},this._onFsPanEnd=()=>{this._fsDragging=!1,requestAnimationFrame(()=>{this._fsDragDidMove=!1})},this._onFsTouchStart=e=>{if(!this._fullscreenZoomed||e.touches.length!==1)return;const t=e.touches[0];this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=t.clientX,this._fsDragStartY=t.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY},this._onFsTouchMove=e=>{if(!this._fsDragging||e.touches.length!==1)return;const t=e.touches[0],r=t.clientX-this._fsDragStartX,i=t.clientY-this._fsDragStartY;(Math.abs(r)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+r,this._fsPanY=this._fsPanStartY+i,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=_e(),this._storeCtrl=new Ee(this,this._store)}open(){var e,t,r;this._isOpen||(this._isOpen=!0,(r=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||r.call(t),this._dispatchPublic(x.OPEN,{}),this.requestUpdate())}close(){var e,t,r,i;this._isOpen&&(this._isOpen=!1,((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(i=(r=(t=this.config)==null?void 0:t.callbacks)==null?void 0:r.onClose)==null||i.call(r),this._dispatchPublic(x.CLOSE,{}),this.requestUpdate())}upload(){var i,s,o,l,c;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(d=>d.status==="idle"||d.status==="queued");if((s=(i=this.config)==null?void 0:i.callbacks)!=null&&s.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(x.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(x.UPLOAD_STARTED,{files:e}),(c=(l=(o=this.config)==null?void 0:o.callbacks)==null?void 0:l.onUploadStarted)==null||c.call(l,e),this._engine.uploadAll())}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const r=this._store.getState().files,i=new Map(r);let s=!1;for(const o of e){const l=r.get(o.id);l&&(i.set(o.id,{...l,...o}),s=!0)}s&&this._store.setState({files:i})}this._ensureEngine(),(t=this._engine)==null||t.uploadAll()}cancelUpload(){var e;(e=this._engine)==null||e.cancelAll()}getFiles(){return[...this._store.getState().files.values()]}getFile(e){return this._store.getState().files.get(e)}updateFileMeta(e,t,r){const i=this._store.getState().files,s=i.get(e);if(!s||!w._MODIFIABLE_STATUSES.has(s.status))return;const o=new Map(i);o.set(e,{...s,meta:t!=null?{...s.meta,...t}:s.meta,tags:r??s.tags}),this._store.setState({files:o})}updateFilesMeta(e){const t=this._store.getState().files,r=new Map(t);let i=!1;for(const{fileId:s,meta:o,tags:l}of e){const c=t.get(s);!c||!w._MODIFIABLE_STATUSES.has(c.status)||(r.set(s,{...c,meta:o!=null?{...c.meta,...o}:c.meta,tags:l??c.tags}),i=!0)}i&&this._store.setState({files:r})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._store.getState().files.get(this._previewFileId);t?this._getImageDimensions(t).then(r=>{this._previewDims=r?`${r.w} × ${r.h}`:"—"}):this._previewDims="—"}}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null;for(const r of this._rejectedTimers.values())clearTimeout(r);this._rejectedTimers.clear();for(const r of this._store.getState().files.values())r.previewUrl&&URL.revokeObjectURL(r.previewUrl);(t=this._engine)==null||t.destroy(),this._engine=null}_applyConfig(e){const t={};if(e.targetFolder&&(t.targetFolder=e.targetFolder),e.restrictions&&(t.restrictions={...this._store.getState().restrictions,...e.restrictions}),e.concurrency!=null){const r=this._store.getState().queueConfig;t.queueConfig={...r,concurrency:e.concurrency}}if(e.autoProceed!=null){const r=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...r,autoProceed:e.autoProceed}}Object.keys(t).length>0&&this._store.setState(t),this._resolveAuthAndEngine(e),(e.mode==="inline"||!e.mode)&&(this._isOpen=!0)}async _resolveAuthAndEngine(e){var i,s;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=Z(t.container),this._authHeaders=N(t),this._ensureEngine(),(i=this._engine)==null||i.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const r=++this._authResolveId;try{const o=await $e(t);if(r!==this._authResolveId)return;this._apiBase=o.apiBase,this._authHeaders=o.headers,this._ensureEngine(),(s=this._engine)==null||s.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(o){if(r!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",o)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new ke(this._store,{apiBase:this._apiBase,authHeaders:this._authHeaders}),this._engine.start())}_dispatchPublic(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}_onStoreChange(){var i,s,o,l,c,d,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const r=(i=this.config)==null?void 0:i.callbacks;for(const[f,h]of e.files){const g=t.files.get(f);if(g){if(g.status!==h.status)switch(h.status){case"uploading":break;case"complete":h.response&&(this._dispatchPublic(x.UPLOAD_COMPLETE,{file:h,response:h.response}),(s=r==null?void 0:r.onUploadComplete)==null||s.call(r,h,h.response));break;case"error":case"failed":{const m=new Error(h.error??"Upload failed");this._dispatchPublic(x.UPLOAD_ERROR,{file:h,error:m}),(o=r==null?void 0:r.onUploadError)==null||o.call(r,h,m);break}case"retrying":this._dispatchPublic(x.UPLOAD_RETRY,{file:h,attempt:h.retryCount}),(l=r==null?void 0:r.onUploadRetry)==null||l.call(r,h,h.retryCount);break}h.status==="uploading"&&g.progress!==h.progress&&(this._dispatchPublic(x.UPLOAD_PROGRESS,{file:h,progress:h.progress,speed:h.speed}),(c=r==null?void 0:r.onUploadProgress)==null||c.call(r,h,h.progress,h.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const f=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(x.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:f}),(d=r==null?void 0:r.onTotalProgress)==null||d.call(r,e.totalProgress,e.totalSpeed,f)}if(t.isUploading&&!e.isUploading){const f=[...e.files.values()];if(!f.some(g=>g.status==="cancelled")){const g=f.filter(v=>v.status==="complete"),m=f.filter(v=>v.status==="failed"||v.status==="error");this._dispatchPublic(x.ALL_COMPLETE,{successful:g,failed:m}),(u=r==null?void 0:r.onAllComplete)==null||u.call(r,g,m)}}}get _mergedSources(){var c;const e=(c=this.config)==null?void 0:c.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=M,this._cachedSources;const t=e.providers.length>0?Se(e.providers):[],r=e.customSources??[],i=M.filter(d=>d.id==="device"||d.id==="url"),s=M.filter(d=>d.id!=="device"&&d.id!=="url"),o=new Set,l=[];for(const d of[...i,...t,...s,...r])if(!o.has(d.id)){if(w._RESERVED_IDS.has(d.id)&&d.onActivate){console.warn(`[sfx-uploader] Custom source id "${d.id}" conflicts with a built-in source and was skipped.`);continue}o.add(d.id),l.push(d)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const r=new Set(["complete","rejected","cancelled","failed"]);return t.every(i=>r.has(i.status))&&t.some(i=>i.status==="complete")?"complete":"ready"}_processIncomingFiles(e){var r,i,s,o;const t=(r=this.config)==null?void 0:r.callbacks;for(const l of e){const c=this._store.getState(),d=Ne(l,c.restrictions,c.files);if(d){const h={id:O(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};R(this._store,h),this._dispatchPublic(x.FILE_REJECTED,{file:h,reason:d}),(i=t==null?void 0:t.onFileRejected)==null||i.call(t,h,d);const g=(s=this.config)==null?void 0:s.rejectedFileAutoRemoveDelay,m=g===!1||g===0?0:g??4e3;if(m>0){const v=h.id,L=setTimeout(()=>{this._rejectedTimers.delete(v);const y=this._store.getState().files.get(v);y&&y.status==="rejected"&&ge(this._store,v)},m);this._rejectedTimers.set(v,L)}continue}let u=null;l.type.startsWith("image/")&&(u=URL.createObjectURL(l));const f={id:O(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:u,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};R(this._store,f),this._dispatchPublic(x.FILE_ADDED,{file:f}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,f),l.type.startsWith("video/")&&Ye(l).then(h=>{if(!h)return;const g=this._store.getState(),m=g.files.get(f.id);if(m){const v=new Map(g.files);v.set(f.id,{...m,previewUrl:h}),this._store.setState({files:v})}else URL.revokeObjectURL(h)})}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var i,s,o,l;const t=this._store.getState().files.get(e);if(!t)return;const r={...t};t.previewUrl&&URL.revokeObjectURL(t.previewUrl),(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((i=this._engine)==null||i.cancelFile(e)),ge(this._store,e),this._dimCache.delete(e),this._dispatchPublic(x.FILE_REMOVED,{file:r}),(l=(o=(s=this.config)==null?void 0:s.callbacks)==null?void 0:o.onFileRemoved)==null||l.call(o,r)}render(){var t;return(((t=this.config)==null?void 0:t.mode)??"modal")==="modal"?this._isOpen?a.html`
2423
2423
  <div class="modal-backdrop" @click=${this._onModalBackdropClick}>
2424
2424
  <div class="modal-card">
2425
2425
  ${this._renderHeader()}
2426
2426
  ${this._renderBody()}
2427
2427
  </div>
2428
2428
  </div>
2429
- `:n.nothing:n.html`
2429
+ `:a.nothing:a.html`
2430
2430
  <div class="inline">
2431
2431
  ${this._renderHeader()}
2432
2432
  ${this._renderBody()}
2433
2433
  </div>
2434
- `}_renderHeader(){var l,c;const e=((l=this.config)==null?void 0:l.mode)??"modal",t=((c=this.config)==null?void 0:c.headerButton)??(e==="modal"?"close":"none"),r=this._phase==="complete",i=e==="modal"?this._onModalDismiss:this._onInlineDismiss,s=t==="back"?n.html`<button class="header-btn header-btn-back" aria-label="Back to Asset Picker" @click=${i}>
2434
+ `}_renderHeader(){var l,c;const e=((l=this.config)==null?void 0:l.mode)??"modal",t=((c=this.config)==null?void 0:c.headerButton)??(e==="modal"?"close":"none"),r=this._phase==="complete",i=e==="modal"?this._onModalDismiss:this._onInlineDismiss,s=t==="back"?a.html`<button class="header-btn header-btn-back" aria-label="Back to Asset Picker" @click=${i}>
2435
2435
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2436
2436
  <polyline points="15 18 9 12 15 6"/>
2437
2437
  </svg>
2438
- </button>`:n.nothing,o=t==="close"?n.html`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
2438
+ </button>`:a.nothing,o=t==="close"?a.html`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
2439
2439
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
2440
2440
  <line x1="18" y1="6" x2="6" y2="18" />
2441
2441
  <line x1="6" y1="6" x2="18" y2="18" />
2442
2442
  </svg>
2443
- </button>`:n.nothing;return n.html`
2443
+ </button>`:a.nothing;return a.html`
2444
2444
  <div class="header">
2445
2445
  ${s}
2446
2446
  <div class="header-icon ${r?"header-icon-done":""}">
2447
- ${r?n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
2447
+ ${r?a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
2448
2448
  <polyline points="20 6 9 17 4 12" />
2449
- </svg>`:n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2449
+ </svg>`:a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2450
2450
  <polyline points="16 16 12 12 8 16" />
2451
2451
  <line x1="12" y1="12" x2="12" y2="21" />
2452
2452
  <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
@@ -2455,7 +2455,7 @@
2455
2455
  <div class="header-title">${r?"Upload Complete":"Upload Files"}</div>
2456
2456
  ${o}
2457
2457
  </div>
2458
- `}_getImageDimensions(e){return e.previewUrl?this._dimCache.has(e.id)?Promise.resolve(this._dimCache.get(e.id)):new Promise(t=>{const r=new Image;r.onload=()=>{const i={w:r.naturalWidth,h:r.naturalHeight};this._dimCache.set(e.id,i),t(i)},r.onerror=()=>{this._dimCache.set(e.id,null),t(null)},r.src=e.previewUrl}):Promise.resolve(null)}_renderPreviewLayout(e){var s;if(e.length===0)return n.nothing;const t=e.find(o=>o.id===this._previewFileId)??e[0],r=((s=t.name.split(".").pop())==null?void 0:s.toUpperCase())||"",i=new Date(t.addedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return n.html`
2458
+ `}_getImageDimensions(e){return e.previewUrl?this._dimCache.has(e.id)?Promise.resolve(this._dimCache.get(e.id)):new Promise(t=>{const r=new Image;r.onload=()=>{const i={w:r.naturalWidth,h:r.naturalHeight};this._dimCache.set(e.id,i),t(i)},r.onerror=()=>{this._dimCache.set(e.id,null),t(null)},r.src=e.previewUrl}):Promise.resolve(null)}_renderPreviewLayout(e){var s;if(e.length===0)return a.nothing;const t=e.find(o=>o.id===this._previewFileId)??e[0],r=((s=t.name.split(".").pop())==null?void 0:s.toUpperCase())||"",i=new Date(t.addedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return a.html`
2459
2459
  <div class="preview-topbar">
2460
2460
  <div class="asset-count" style="padding:0">${e.length} ${e.length===1?"asset":"assets"}</div>
2461
2461
  <div class="preview-panel-header">
@@ -2489,7 +2489,7 @@
2489
2489
  <sfx-file-list .files=${e}></sfx-file-list>
2490
2490
  </div>
2491
2491
  <div class="preview-panel">
2492
- ${t.previewUrl?n.html`
2492
+ ${t.previewUrl?a.html`
2493
2493
  <div class="preview-img-wrap">
2494
2494
  <img class="preview-image" src=${t.previewUrl} alt=${t.name} />
2495
2495
  <button class="preview-nav prev" ?disabled=${e.indexOf(t)===0} @click=${()=>this._navigatePreview(e,-1)}>
@@ -2499,7 +2499,7 @@
2499
2499
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="9 6 15 12 9 18"/></svg>
2500
2500
  </button>
2501
2501
  </div>
2502
- `:n.nothing}
2502
+ `:a.nothing}
2503
2503
  <div class="preview-meta-list">
2504
2504
  <div class="preview-meta-row">
2505
2505
  <span class="preview-meta-label">Type</span>
@@ -2524,7 +2524,7 @@
2524
2524
  </div>
2525
2525
  </div>
2526
2526
  </div>
2527
- `}_navigatePreview(e,t){const i=e.findIndex(s=>s.id===this._previewFileId)+t;i>=0&&i<e.length&&(this._previewFileId=e[i].id)}_onFileRemoveById(e){this._removeFile(e);const t=[...this._store.getState().files.values()];t.length===0?this._previewFileId=null:this._previewFileId===e&&(this._previewFileId=t[0].id)}_renderBody(){var o,l,c;const e=this._storeCtrl.state,t=[...e.files.values()],r=this._phase,i=Ve(e.restrictions),s=t.length>0;return n.html`
2527
+ `}_navigatePreview(e,t){const i=e.findIndex(s=>s.id===this._previewFileId)+t;i>=0&&i<e.length&&(this._previewFileId=e[i].id)}_onFileRemoveById(e){this._removeFile(e);const t=[...this._store.getState().files.values()];t.length===0?this._previewFileId=null:this._previewFileId===e&&(this._previewFileId=t[0].id)}_renderBody(){var o,l,c;const e=this._storeCtrl.state,t=[...e.files.values()],r=this._phase,i=Ve(e.restrictions),s=t.length>0;return a.html`
2528
2528
  <div class="content"
2529
2529
  @files-selected=${this._onFilesSelected}
2530
2530
  @source-click=${this._onSourceClick}
@@ -2549,18 +2549,18 @@
2549
2549
  >
2550
2550
  <div
2551
2551
  class="body ${s?"has-files":""} ${this._bodyDragOver?"body-drag-over":""}"
2552
- @dragenter=${s?this._onBodyDragEnter:n.nothing}
2553
- @dragover=${s?this._onBodyDragOver:n.nothing}
2554
- @dragleave=${s?this._onBodyDragLeave:n.nothing}
2555
- @drop=${s?this._onBodyDrop:n.nothing}
2552
+ @dragenter=${s?this._onBodyDragEnter:a.nothing}
2553
+ @dragover=${s?this._onBodyDragOver:a.nothing}
2554
+ @dragleave=${s?this._onBodyDragLeave:a.nothing}
2555
+ @drop=${s?this._onBodyDrop:a.nothing}
2556
2556
  >
2557
- ${r==="complete"?n.html`
2557
+ ${r==="complete"?a.html`
2558
2558
  <sfx-success-card
2559
2559
  .fileCount=${t.filter(d=>d.status==="complete").length}
2560
2560
  .totalSize=${t.filter(d=>d.status==="complete").reduce((d,u)=>d+(u.size||0),0)}
2561
2561
  .thumbnails=${t.filter(d=>d.status==="complete"&&d.previewUrl).map(d=>d.previewUrl)}
2562
2562
  ></sfx-success-card>
2563
- `:n.html`
2563
+ `:a.html`
2564
2564
  <sfx-drop-zone
2565
2565
  .compact=${s}
2566
2566
  .externalDragOver=${this._bodyDragOver}
@@ -2569,14 +2569,14 @@
2569
2569
  .sourcesLayout=${((o=this.config)==null?void 0:o.sourcesLayout)??"pills"}
2570
2570
  ></sfx-drop-zone>
2571
2571
 
2572
- ${s?this._previewFileId?this._renderPreviewLayout(t):n.html`
2572
+ ${s?this._previewFileId?this._renderPreviewLayout(t):a.html`
2573
2573
  <div class="asset-count">${t.length} ${t.length===1?"file":"files"} · ${V(t.reduce((d,u)=>d+(u.size||0),0))}</div>
2574
2574
  <sfx-file-list .files=${t}></sfx-file-list>
2575
- `:n.nothing}
2575
+ `:a.nothing}
2576
2576
  `}
2577
2577
  </div>
2578
2578
 
2579
- ${s&&r!=="complete"?n.html`
2579
+ ${s&&r!=="complete"?a.html`
2580
2580
  <sfx-actions-bar
2581
2581
  .uploadState=${r==="uploading"?"uploading":"idle"}
2582
2582
  .fileCount=${t.length}
@@ -2586,20 +2586,20 @@
2586
2586
  .uploadProgress=${e.totalProgress??0}
2587
2587
  .showFillMetadata=${!!((l=this.config)!=null&&l.showFillMetadata)}
2588
2588
  ></sfx-actions-bar>
2589
- `:n.nothing}
2589
+ `:a.nothing}
2590
2590
 
2591
- ${this._showUrlDialog?n.html`<sfx-url-dialog></sfx-url-dialog>`:n.nothing}
2592
- ${this._showCameraDialog?n.html`<sfx-camera-dialog></sfx-camera-dialog>`:n.nothing}
2593
- ${this._showScreenCastDialog?n.html`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>`:n.nothing}
2594
- ${this._activeConnector&&((c=this.config)!=null&&c.connectors)?n.html`
2591
+ ${this._showUrlDialog?a.html`<sfx-url-dialog></sfx-url-dialog>`:a.nothing}
2592
+ ${this._showCameraDialog?a.html`<sfx-camera-dialog></sfx-camera-dialog>`:a.nothing}
2593
+ ${this._showScreenCastDialog?a.html`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>`:a.nothing}
2594
+ ${this._activeConnector&&((c=this.config)!=null&&c.connectors)?a.html`
2595
2595
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
2596
2596
  <div class="connector-modal">
2597
- ${ye.has(this._activeConnector)?n.html`
2597
+ ${ye.has(this._activeConnector)?a.html`
2598
2598
  <sfx-search-provider-browser
2599
2599
  .provider=${this._activeConnector}
2600
2600
  .companionUrl=${this.config.connectors.companionUrl}
2601
2601
  ></sfx-search-provider-browser>
2602
- `:n.html`
2602
+ `:a.html`
2603
2603
  <sfx-provider-browser
2604
2604
  .provider=${this._activeConnector}
2605
2605
  .companionUrl=${this.config.connectors.companionUrl}
@@ -2607,9 +2607,9 @@
2607
2607
  `}
2608
2608
  </div>
2609
2609
  </div>
2610
- `:n.nothing}
2610
+ `:a.nothing}
2611
2611
 
2612
- ${this._fullscreenPreviewUrl?n.html`
2612
+ ${this._fullscreenPreviewUrl?a.html`
2613
2613
  <div
2614
2614
  class="fs-overlay ${this._fullscreenZoomed?"zoomed":""} ${this._fsDragging?"panning":""}"
2615
2615
  @click=${this._onFsOverlayClick}
@@ -2623,7 +2623,7 @@
2623
2623
  >
2624
2624
  <div class="fs-toolbar" @click=${d=>d.stopPropagation()}>
2625
2625
  <button class="fs-btn" @click=${this._onFsToggleZoom} title="${this._fullscreenZoomed?"Zoom out":"Zoom in"}">
2626
- ${this._fullscreenZoomed?n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`:n.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`}
2626
+ ${this._fullscreenZoomed?a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`:a.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`}
2627
2627
  </button>
2628
2628
  <button class="fs-btn" @click=${this._onFsClose} title="Close">
2629
2629
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
@@ -2640,9 +2640,9 @@
2640
2640
  />
2641
2641
  <div class="fs-filename">${this._getFullscreenFilename()}</div>
2642
2642
  </div>
2643
- `:n.nothing}
2643
+ `:a.nothing}
2644
2644
  </div>
2645
- `}_getFullscreenFilename(){if(!this._previewFileId)return"";const e=this._store.getState().files.get(this._previewFileId);return(e==null?void 0:e.name)??""}},w.styles=n.css`
2645
+ `}_getFullscreenFilename(){if(!this._previewFileId)return"";const e=this._store.getState().files.get(this._previewFileId);return(e==null?void 0:e.name)??""}},w.styles=a.css`
2646
2646
  :host {
2647
2647
  display: block;
2648
2648
  font-family: var(--sfx-up-font, 'Inter', system-ui, -apple-system, sans-serif);
@@ -3295,4 +3295,4 @@
3295
3295
  min-height: auto;
3296
3296
  }
3297
3297
  }
3298
- `,w._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),w._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),w);C([p.property({attribute:!1})],_.prototype,"config");C([p.state()],_.prototype,"_isOpen");C([p.state()],_.prototype,"_activeConnector");C([p.state()],_.prototype,"_showUrlDialog");C([p.state()],_.prototype,"_showCameraDialog");C([p.state()],_.prototype,"_showScreenCastDialog");C([p.state()],_.prototype,"_previewFileId");C([p.state()],_.prototype,"_previewDims");C([p.state()],_.prototype,"_fullscreenPreviewUrl");C([p.state()],_.prototype,"_fullscreenZoomed");C([p.state()],_.prototype,"_bodyDragOver");let pt=_;exports.AuthExpiredError=J;exports.CORE_SOURCES=M;exports.PublicEvents=x;exports.SfxActionsBar=$;exports.SfxCameraDialog=z;exports.SfxDropZone=b;exports.SfxFileItem=K;exports.SfxFileList=W;exports.SfxImportDivider=re;exports.SfxScreenCastDialog=P;exports.SfxSourcePills=X;exports.SfxSuccessCard=D;exports.SfxUploader=pt;exports.SfxUrlDialog=j;exports.Store=we;exports.UploadEngine=ke;exports.buildAuthHeaders=N;exports.createStore=_e;exports.exchangeSassKey=Ce;exports.getApiBase=Z;exports.getAuthUrl=ze;exports.getProviderSources=Se;exports.listFiles=Fe;exports.listNextPage=Te;exports.logout=Oe;exports.resolveAuth=$e;exports.searchProvider=Le;
3298
+ `,w._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),w._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),w);C([p.property({attribute:!1})],_.prototype,"config");C([p.state()],_.prototype,"_isOpen");C([p.state()],_.prototype,"_activeConnector");C([p.state()],_.prototype,"_showUrlDialog");C([p.state()],_.prototype,"_showCameraDialog");C([p.state()],_.prototype,"_showScreenCastDialog");C([p.state()],_.prototype,"_previewFileId");C([p.state()],_.prototype,"_previewDims");C([p.state()],_.prototype,"_fullscreenPreviewUrl");C([p.state()],_.prototype,"_fullscreenZoomed");C([p.state()],_.prototype,"_bodyDragOver");let pt=_;exports.AuthExpiredError=J;exports.CORE_SOURCES=M;exports.PublicEvents=x;exports.SfxActionsBar=$;exports.SfxCameraDialog=z;exports.SfxDropZone=b;exports.SfxFileItem=K;exports.SfxFileList=W;exports.SfxImportDivider=re;exports.SfxScreenCastDialog=P;exports.SfxSourcePills=X;exports.SfxSuccessCard=D;exports.SfxUploader=pt;exports.SfxUrlDialog=A;exports.Store=we;exports.UploadEngine=ke;exports.buildAuthHeaders=N;exports.createStore=_e;exports.exchangeSassKey=Ce;exports.getApiBase=Z;exports.getAuthUrl=ze;exports.getProviderSources=Se;exports.listFiles=Fe;exports.listNextPage=Le;exports.logout=Te;exports.resolveAuth=$e;exports.searchProvider=Re;