@scaleflex/uploader 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";const s=require("lit"),c=require("lit/decorators.js"),S=require("lit/directives/unsafe-svg.js"),z=require("lit/directives/unsafe-html.js");class $e{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(i=>i(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function $(n,e,t){const i=n.getState().files,r=i.get(e);if(!r)return;const o=new Map(i);o.set(e,{...r,...t}),n.setState({files:o})}function O(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function be(n,e){const t=n.getState().files;if(!t.has(e))return;const i=new Map(t);i.delete(e),n.setState({files:i})}function Se(){return new $e({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 De{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 Fe(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!i&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(i)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",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))});const a=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),a.append("info[files[]]",JSON.stringify(l)),a.append("files[]",n.file,n.name)}return t.timeout=6e4,t.send(a),{abort(){i=!0,t.abort()}}}function je(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(i)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",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))}),!n.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const a={files_urls:[{url:n.remoteUrl,name:n.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(a)),{abort(){i=!0,t.abort()}}}function J(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function I(n){return n.replace(/\/+$/,"")}const Me={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Me[n]??n}function Le(n,e){const t=I(n),i=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(i)}`}async function Oe(n,e,t,i=""){const r=I(n),o=i?`/${i}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${o}`,{method:"GET",headers:J(t),credentials:"same-origin"});if(l.status===401)throw new Q;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Be(n,e,t){const i=I(n),r=await fetch(`${i}/${t}`,{method:"GET",headers:J(e),credentials:"same-origin"});if(r.status===401)throw new Q;if(!r.ok){const o=await r.json().catch(()=>null);throw new Error((o==null?void 0:o.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function Re(n,e,t,i){const r=I(n),o=Y(e),a=i?`q=${encodeURIComponent(t)}&${i}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${o}/list?${a}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Te(n,e,t,i,r,o=!1){const a=I(n),l=Y(e),d=o?`${a}/search/${l}/get/${i}`:`${a}/${l}/get/${i}`,p=o?{Accept:"application/json","Content-Type":"application/json"}:J(t),h=await fetch(d,{method:"POST",headers:p,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new Q;if(!h.ok){const u=await h.json().catch(()=>null);throw new Error((u==null?void 0:u.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function Ae(n,e,t){const i=I(n),r=Y(e),o=await fetch(`${i}/${r}/logout`,{method:"GET",headers:J(t),credentials:"same-origin"});return o.ok?o.json():{ok:!1,revoked:!1}}function Ie(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class Q extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function He(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let i=!1,r=null;const a=`${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 d=!t.token;return Te(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:a,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},d).then(p=>{if(i)return;const u=`${Ie(t.companionUrl)}/api/${p.token}`;try{r=new WebSocket(u)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=f=>{var x,b,v;if(!i)try{const _=JSON.parse(f.data);switch(_.action){case"progress":{const k=_.payload,P=k.bytesUploaded??0,H=k.bytesTotal??(t.size||1);e.onProgress(P,H);break}case"success":{const k=_.payload;if(r==null||r.close(),(x=k.response)!=null&&x.responseText)try{const P=JSON.parse(k.response.responseText);if(P.status==="success"){e.onComplete(P);return}e.onError(new Error(P.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const k=_.payload;let P=((b=k.error)==null?void 0:b.message)||"Upload failed";if((v=k.response)!=null&&v.responseText)try{const H=JSON.parse(k.response.responseText);P=H.hint||H.msg||H.message||P}catch{}e.onError(new Error(P));break}}}catch{}},r.onerror=()=>{i||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(p=>{i||e.onError(p instanceof Error?p:new Error(String(p)))}),{abort(){if(i=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class Ee{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 i of e.values())i.status==="idle"?($(this.store,i.id,{status:"queued"}),t=!0):i.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"||($(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")&&$(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||!me(t.status)||(this.abortUpload(e),$(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())me(t.status)&&(this.abortUpload(t.id),$(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,i=this.activeUploads.size,r=t-i;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){$(this.store,e.id,{status:"uploading",error:null});let t=0,i=Date.now(),r=0;const o={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:d=>this.handleComplete(e.id,d),onError:d=>this.handleError(e.id,d)},a=(d,p)=>{const h=Date.now(),u=(h-i)/1e3;if(u>0){const x=(d-t)/u;r=r===0?x:.3*x+.7*r}t=d,i=h;const f=p>0?d/p*100:0;$(this.store,e.id,{progress:f,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=He(e,{...o,onProgress:a}):e.remoteUrl?l=je(e,o):l=Fe(e,{...o,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),$(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const i=this.store.getState().files.get(e);if(!i)return;const{retryConfig:r}=this.store.getState().queueConfig,o=i.retryCount+1;if(o<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,i.retryCount),r.maxDelay);$(this.store,e,{status:"retrying",error:t.message,retryCount:o});const l=setTimeout(()=>{this.retryTimers.delete(e),$(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else $(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var i;(i=this.activeUploads.get(e))==null||i.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,i=0,r=0;for(const o of e.values())(o.status==="queued"||o.status==="uploading"||o.status==="retrying"||o.status==="complete"||o.status==="failed")&&(t+=o.size,i+=o.status==="complete"?o.size:o.bytesUploaded),o.status==="uploading"&&(r+=o.speed);this.store.setState({totalBytes:t,totalBytesUploaded:i,totalSpeed:r,totalProgress:t>0?i/t*100:0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(i=>i.status==="queued"||i.status==="uploading"||i.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function me(n){return n==="queued"||n==="uploading"||n==="retrying"}function ee(n){return`https://api.filerobot.com/${n}`}async function Ue(n,e){const t=`${ee(n)}/key/${encodeURIComponent(e)}`,i=new AbortController,r=setTimeout(()=>i.abort(),3e4);try{const o=await fetch(t,{signal:i.signal});if(clearTimeout(r),!o.ok)throw new Error(`SASS key exchange failed (HTTP ${o.status})`);const a=await o.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(o){throw clearTimeout(r),o instanceof DOMException&&o.name==="AbortError"?new Error("SASS key exchange timed out"):o}}function G(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 Pe(n){const e=ee(n.container);if(n.mode==="security-template"){const t=await Ue(n.container,n.securityTemplateId);return{apiBase:e,headers:G(n,t),sassKey:t}}return{apiBase:e,headers:G(n)}}const g={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 qe=0;function B(){return`file-${Date.now()}-${++qe}`}function R(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),i=n/Math.pow(1024,t);return`${t===0?i:i.toFixed(1)} ${e[t]}`}function ie(n){if(!isFinite(n)||n<=0)return"0s";const e=Math.round(n);if(e<60)return`${e}s`;const t=Math.floor(e/60),i=e%60;return i>0?`${t}m ${i}s`:`${t}m`}function q(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 Ye(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ve={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 Ne(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ve[e]||""}function Xe(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const i=URL.createObjectURL(n);let r=!1;const o=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i)};t.addEventListener("seeked",()=>{try{const a=document.createElement("canvas");a.width=t.videoWidth||320,a.height=t.videoHeight||240;const l=a.getContext("2d");if(l){l.drawImage(t,0,0,a.width,a.height),a.toBlob(d=>{r||(r=!0,e(d?URL.createObjectURL(d):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i))},"image/jpeg",.7);return}}catch{}o()},{once:!0}),t.addEventListener("error",()=>o(),{once:!0}),setTimeout(()=>o(),5e3),t.src=i,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function oe(n,e,t){var i,r;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 o=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(o+=a.size);if(o>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let o=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&o++;if(o>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const o=e.allowedFileTypes,a="."+(((i=n.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(!o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type not allowed"}if(e.blockedFileTypes!=null){const o=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type is blocked"}return null}function We(n,e,t){return oe(n,e,t)}function we(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const ye={"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 ze(n){return n.filter(e=>e in ye).map(e=>ye[e])}var Ge=Object.defineProperty,Ke=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&Ge(e,t,r),r};const Ze='<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"/>',Je='<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"/>',Qe='<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"/>',et='<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"/>',T=[{id:"device",label:"My Device",icon:Ze,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Je,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:Qe,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:et,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=T}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
1
+ "use strict";const s=require("lit"),c=require("lit/decorators.js"),U=require("lit/directives/unsafe-svg.js"),D=require("lit/directives/unsafe-html.js");class Se{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(i=>i(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function S(n,e,t){const i=n.getState().files,r=i.get(e);if(!r)return;const o=new Map(i);o.set(e,{...r,...t}),n.setState({files:o})}function T(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function me(n,e){const t=n.getState().files;if(!t.has(e))return;const i=new Map(t);i.delete(e),n.setState({files:i})}function Ee(){return new Se({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 Fe{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 je(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!i&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(i)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.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))});const a=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),a.append("info[files[]]",JSON.stringify(l)),a.append("files[]",n.file,n.name)}return t.timeout=6e4,t.send(a),{abort(){i=!0,t.abort()}}}function Me(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(i)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.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))}),!n.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const a={files_urls:[{url:n.remoteUrl,name:n.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(a)),{abort(){i=!0,t.abort()}}}function Q(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function H(n){return n.replace(/\/+$/,"")}const Oe={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Oe[n]??n}function Le(n,e){const t=H(n),i=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(i)}`}async function Te(n,e,t,i=""){const r=H(n),o=i?`/${i}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${o}`,{method:"GET",headers:Q(t),credentials:"same-origin"});if(l.status===401)throw new ee;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Be(n,e,t){const i=H(n),r=await fetch(`${i}/${t}`,{method:"GET",headers:Q(e),credentials:"same-origin"});if(r.status===401)throw new ee;if(!r.ok){const o=await r.json().catch(()=>null);throw new Error((o==null?void 0:o.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function Re(n,e,t,i){const r=H(n),o=Y(e),a=i?`q=${encodeURIComponent(t)}&${i}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${o}/list?${a}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Ae(n,e,t,i,r,o=!1){const a=H(n),l=Y(e),d=o?`${a}/search/${l}/get/${i}`:`${a}/${l}/get/${i}`,p=o?{Accept:"application/json","Content-Type":"application/json"}:Q(t),h=await fetch(d,{method:"POST",headers:p,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new ee;if(!h.ok){const u=await h.json().catch(()=>null);throw new Error((u==null?void 0:u.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function Ie(n,e,t){const i=H(n),r=Y(e),o=await fetch(`${i}/${r}/logout`,{method:"GET",headers:Q(t),credentials:"same-origin"});return o.ok?o.json():{ok:!1,revoked:!1}}function He(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class ee extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function qe(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let i=!1,r=null;const a=`${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 d=!t.token;return Ae(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:a,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},d).then(p=>{if(i)return;const u=`${He(t.companionUrl)}/api/${p.token}`;try{r=new WebSocket(u)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=x=>{var f,v,w;if(!i)try{const b=JSON.parse(x.data);switch(b.action){case"progress":{const m=b.payload,y=m.bytesUploaded??0,E=m.bytesTotal??(t.size||1);e.onProgress(y,E);break}case"success":{const m=b.payload;if(r==null||r.close(),(f=m.response)!=null&&f.responseText)try{const y=JSON.parse(m.response.responseText);if(y.status==="success"){e.onComplete(y);return}e.onError(new Error(y.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const m=b.payload;let y=((v=m.error)==null?void 0:v.message)||"Upload failed";if((w=m.response)!=null&&w.responseText)try{const E=JSON.parse(m.response.responseText);y=E.hint||E.msg||E.message||y}catch{}e.onError(new Error(y));break}}}catch{}},r.onerror=()=>{i||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(p=>{i||e.onError(p instanceof Error?p:new Error(String(p)))}),{abort(){if(i=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class Ue{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 i of e.values())i.status==="idle"?(S(this.store,i.id,{status:"queued"}),t=!0):i.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"||(S(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")&&S(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||!we(t.status)||(this.abortUpload(e),S(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())we(t.status)&&(this.abortUpload(t.id),S(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,i=this.activeUploads.size,r=t-i;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){S(this.store,e.id,{status:"uploading",error:null});let t=0,i=Date.now(),r=0;const o={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:d=>this.handleComplete(e.id,d),onError:d=>this.handleError(e.id,d)},a=(d,p)=>{const h=Date.now(),u=(h-i)/1e3;if(u>0){const f=(d-t)/u;r=r===0?f:.3*f+.7*r}t=d,i=h;const x=p>0?Math.min(d/p*100,100):0;S(this.store,e.id,{progress:x,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=qe(e,{...o,onProgress:a}):e.remoteUrl?l=Me(e,o):l=je(e,{...o,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),S(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const i=this.store.getState().files.get(e);if(!i)return;const{retryConfig:r}=this.store.getState().queueConfig,o=i.retryCount+1;if(o<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,i.retryCount),r.maxDelay);S(this.store,e,{status:"retrying",error:t.message,retryCount:o});const l=setTimeout(()=>{this.retryTimers.delete(e),S(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else S(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var i;(i=this.activeUploads.get(e))==null||i.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,i=0,r=0;for(const o of e.values())(o.status==="queued"||o.status==="uploading"||o.status==="retrying"||o.status==="complete"||o.status==="failed")&&(t+=o.size,i+=o.status==="complete"?o.size:o.bytesUploaded),o.status==="uploading"&&(r+=o.speed);this.store.setState({totalBytes:t,totalBytesUploaded:i,totalSpeed:r,totalProgress:t>0?Math.min(i/t*100,100):0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(i=>i.status==="queued"||i.status==="uploading"||i.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function we(n){return n==="queued"||n==="uploading"||n==="retrying"}function te(n){return`https://api.filerobot.com/${n}`}async function Pe(n,e){const t=`${te(n)}/key/${encodeURIComponent(e)}`,i=new AbortController,r=setTimeout(()=>i.abort(),3e4);try{const o=await fetch(t,{signal:i.signal});if(clearTimeout(r),!o.ok)throw new Error(`SASS key exchange failed (HTTP ${o.status})`);const a=await o.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(o){throw clearTimeout(r),o instanceof DOMException&&o.name==="AbortError"?new Error("SASS key exchange timed out"):o}}function K(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 ze(n){const e=te(n.container);if(n.mode==="security-template"){const t=await Pe(n.container,n.securityTemplateId);return{apiBase:e,headers:K(n,t),sassKey:t}}return{apiBase:e,headers:K(n)}}const g={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 Ye=0;function B(){return`file-${Date.now()}-${++Ye}`}function R(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),i=n/Math.pow(1024,t);return`${t===0?i:i.toFixed(1)} ${e[t]}`}function ie(n){if(!isFinite(n)||n<=0)return"0s";const e=Math.round(n);if(e<60)return`${e}s`;const t=Math.floor(e/60),i=e%60;return i>0?`${t}m ${i}s`:`${t}m`}function q(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 Ve(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ne={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 Xe(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ne[e]||""}function We(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const i=URL.createObjectURL(n);let r=!1;const o=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i)};t.addEventListener("seeked",()=>{try{const a=document.createElement("canvas");a.width=t.videoWidth||320,a.height=t.videoHeight||240;const l=a.getContext("2d");if(l){l.drawImage(t,0,0,a.width,a.height),a.toBlob(d=>{r||(r=!0,e(d?URL.createObjectURL(d):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i))},"image/jpeg",.7);return}}catch{}o()},{once:!0}),t.addEventListener("error",()=>o(),{once:!0}),setTimeout(()=>o(),5e3),t.src=i,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function oe(n,e,t){var i,r;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 o=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(o+=a.size);if(o>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let o=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&o++;if(o>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const o=e.allowedFileTypes,a="."+(((i=n.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(!o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type not allowed"}if(e.blockedFileTypes!=null){const o=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type is blocked"}return null}function Ge(n,e,t){return oe(n,e,t)}function ye(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const _e={"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 De(n){return n.filter(e=>e in _e).map(e=>_e[e])}var Ke=Object.defineProperty,Ze=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&Ke(e,t,r),r};const Je='<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"/>',Qe='<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"/>',et='<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"/>',tt='<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"/>',A=[{id:"device",label:"My Device",icon:Je,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Qe,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:et,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:tt,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=A}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
2
2
  ${this.sources.map(e=>s.html`
3
3
  <button @click=${()=>this._handleClick(e)}>
4
- ${e.brandHtml?z.unsafeHTML(e.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
4
+ ${e.brandHtml?D.unsafeHTML(e.brandHtml):s.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
  `)}
@@ -77,13 +77,13 @@
77
77
  stroke: none;
78
78
  stroke-width: 0;
79
79
  }
80
- `;let K=le;Ke([c.property({type:Array})],K.prototype,"sources");var tt=Object.defineProperty,U=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&tt(e,t,r),r};const _e=3,de=class de extends s.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=_e,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 i;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const i=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-i.left}px`,this._rippleEl.style.top=`${e.clientY-i.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,i=Array.from(t.files??[]);i.length>0&&this._emitFiles(i),t.value=""},this._onPaste=e=>{var r;if(!this.isConnected||this.offsetWidth===0)return;const t=(r=e.clipboardData)==null?void 0:r.items;if(!t)return;const i=[];for(const o of t)if(o.kind==="file"){const a=o.getAsFile();a&&i.push(a)}i.length>0&&(e.preventDefault(),this._emitFiles(i))},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 u,f;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(f=this.shadowRoot)==null?void 0:f.querySelector(".more-dropdown");if(!e||!t)return;const i=e.getBoundingClientRect(),r=8,o=t.scrollHeight,a=t.offsetWidth,l=i.top,d=window.innerHeight-i.bottom;l>=o+r||l>d?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${i.top-o-r}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${i.bottom+r}px`);let h=i.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}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=_e}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()}updated(e){e.has("sourcesLayout")&&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 s.html`
80
+ `;let Z=le;Ze([c.property({type:Array})],Z.prototype,"sources");var rt=Object.defineProperty,z=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&rt(e,t,r),r};const ke=3,de=class de extends s.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=ke,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 i;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const i=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-i.left}px`,this._rippleEl.style.top=`${e.clientY-i.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,i=Array.from(t.files??[]);i.length>0&&this._emitFiles(i),t.value=""},this._onPaste=e=>{var r;if(!this.isConnected||this.offsetWidth===0)return;const t=(r=e.clipboardData)==null?void 0:r.items;if(!t)return;const i=[];for(const o of t)if(o.kind==="file"){const a=o.getAsFile();a&&i.push(a)}i.length>0&&(e.preventDefault(),this._emitFiles(i))},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 u,x;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(x=this.shadowRoot)==null?void 0:x.querySelector(".more-dropdown");if(!e||!t)return;const i=e.getBoundingClientRect(),r=8,o=t.scrollHeight,a=t.offsetWidth,l=i.top,d=window.innerHeight-i.bottom;l>=o+r||l>d?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${i.top-o-r}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${i.bottom+r}px`);let h=i.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}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=ke}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()}updated(e){e.has("sourcesLayout")&&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 s.html`
81
81
  <button
82
82
  class="src-pill"
83
83
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
84
84
  >
85
- ${e.brandHtml?z.unsafeHTML(e.brandHtml):s.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
86
- ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
85
+ ${e.brandHtml?D.unsafeHTML(e.brandHtml):s.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
86
+ ${s.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>
@@ -93,8 +93,8 @@
93
93
  aria-label=${e.label}
94
94
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
95
95
  >
96
- ${e.brandHtml?s.html`<span class="card-ico">${z.unsafeHTML(e.brandHtml)}</span>`:s.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
97
- ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
96
+ ${e.brandHtml?s.html`<span class="card-ico">${D.unsafeHTML(e.brandHtml)}</span>`:s.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
97
+ ${s.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>
@@ -114,7 +114,7 @@
114
114
  ${e.map(t=>s.html`
115
115
  <button class="more-item" @click=${i=>this._onMoreItemClick(t,i)}>
116
116
  <div class="more-item-ico">
117
- ${t.brandHtml?z.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${S.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${S.unsafeSVG(t.icon)}</svg>`}
117
+ ${t.brandHtml?D.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
118
118
  </div>
119
119
  ${t.label}
120
120
  </button>
@@ -131,7 +131,7 @@
131
131
  ${e.map(t=>s.html`
132
132
  <button class="more-item" @click=${i=>this._onMoreItemClick(t,i)}>
133
133
  <div class="more-item-ico">
134
- ${t.brandHtml?z.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${S.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${S.unsafeSVG(t.icon)}</svg>`}
134
+ ${t.brandHtml?D.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${U.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${U.unsafeSVG(t.icon)}</svg>`}
135
135
  </div>
136
136
  ${t.label}
137
137
  </button>
@@ -194,7 +194,7 @@
194
194
  aria-label=${r.label}
195
195
  @click=${o=>{o.stopPropagation(),this._onSourceIconClick(r)}}
196
196
  >
197
- ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
197
+ ${r.brandHtml?D.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${U.unsafeSVG(r.icon)}</svg>`}
198
198
  </button>
199
199
  `)}
200
200
  </div>
@@ -990,7 +990,7 @@
990
990
  animation: none;
991
991
  }
992
992
  }
993
- `;let y=de;U([c.property({type:Boolean,reflect:!0})],y.prototype,"compact");U([c.property({type:Boolean,attribute:"external-drag-over"})],y.prototype,"externalDragOver");U([c.property({type:String})],y.prototype,"accept");U([c.property({type:Array})],y.prototype,"sources");U([c.property({type:String,attribute:"sources-layout"})],y.prototype,"sourcesLayout");U([c.state()],y.prototype,"_dragOver");U([c.state()],y.prototype,"_moreOpen");U([c.state()],y.prototype,"_visiblePills");U([c.query(".ripple")],y.prototype,"_rippleEl");U([c.query('input[type="file"]')],y.prototype,"fileInput");const pe=class pe extends s.LitElement{render(){return s.html`
993
+ `;let C=de;z([c.property({type:Boolean,reflect:!0})],C.prototype,"compact");z([c.property({type:Boolean,attribute:"external-drag-over"})],C.prototype,"externalDragOver");z([c.property({type:String})],C.prototype,"accept");z([c.property({type:Array})],C.prototype,"sources");z([c.property({type:String,attribute:"sources-layout"})],C.prototype,"sourcesLayout");z([c.state()],C.prototype,"_dragOver");z([c.state()],C.prototype,"_moreOpen");z([c.state()],C.prototype,"_visiblePills");z([c.query(".ripple")],C.prototype,"_rippleEl");z([c.query('input[type="file"]')],C.prototype,"fileInput");const pe=class pe extends s.LitElement{render(){return s.html`
994
994
  <div class="line"></div>
995
995
  <div class="label">or import from</div>
996
996
  <div class="line"></div>
@@ -1016,7 +1016,7 @@
1016
1016
  letter-spacing: 1px;
1017
1017
  white-space: nowrap;
1018
1018
  }
1019
- `;let se=pe;var rt=Object.defineProperty,V=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&rt(e,t,r),r};const ce=class ce extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._outsideClickHandler=e=>{const t=e.composedPath(),i=this.renderRoot.querySelector(".drop-tile-more-wrap");i&&!t.includes(i)&&(this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0))}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,i=Array.from(t.files??[]);i.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:i},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const i=this.renderRoot.querySelector('input[type="file"]');i==null||i.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)):document.removeEventListener("click",this._outsideClickHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0)}_onMoreSourceClick(e,t){this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),i=this.sources.slice(3);return s.html`
1019
+ `;let se=pe;var it=Object.defineProperty,V=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&it(e,t,r),r};const ce=class ce extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._outsideClickHandler=e=>{const t=e.composedPath(),i=this.renderRoot.querySelector(".drop-tile-more-wrap");i&&!t.includes(i)&&(this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0))}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,i=Array.from(t.files??[]);i.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:i},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const i=this.renderRoot.querySelector('input[type="file"]');i==null||i.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)):document.removeEventListener("click",this._outsideClickHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0)}_onMoreSourceClick(e,t){this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),i=this.sources.slice(3);return s.html`
1020
1020
  <div class="drop-tile" @click=${this._onDropTileClick}>
1021
1021
  <div class="drop-tile-rings">
1022
1022
  <div class="drop-tile-ring"></div>
@@ -1039,7 +1039,7 @@
1039
1039
  title=${r.label}
1040
1040
  @click=${o=>this._onSourceClick(o,r)}
1041
1041
  >
1042
- ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
1042
+ ${r.brandHtml?D.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${U.unsafeSVG(r.icon)}</svg>`}
1043
1043
  </button>
1044
1044
  `)}
1045
1045
  ${i.length>0?s.html`
@@ -1053,7 +1053,7 @@
1053
1053
  @click=${o=>this._onMoreSourceClick(o,r)}
1054
1054
  >
1055
1055
  <span class="more-dropdown-ico" style=${r.iconColor&&!r.brandHtml?`color:${r.iconColor}`:""}>
1056
- ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
1056
+ ${r.brandHtml?D.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${U.unsafeSVG(r.icon)}</svg>`}
1057
1057
  </span>
1058
1058
  ${r.label}
1059
1059
  </button>
@@ -1093,10 +1093,10 @@
1093
1093
  }
1094
1094
 
1095
1095
  :host::-webkit-scrollbar-thumb {
1096
- background: rgba(0, 0, 0, 0.15);
1097
- border-radius: var(--sfx-scrollbar-radius, 6px);
1098
- border-left: var(--sfx-scrollbar-inset, 3px) solid transparent;
1099
- border-right: var(--sfx-scrollbar-inset, 3px) solid transparent;
1096
+ background-color: rgba(0, 0, 0, 0.15);
1097
+ border-radius: 6px;
1098
+ border-left: var(--sfx-scrollbar-inset-left, 3px) solid transparent;
1099
+ border-right: var(--sfx-scrollbar-inset-right, 3px) solid transparent;
1100
1100
  background-clip: padding-box;
1101
1101
  }
1102
1102
 
@@ -1104,7 +1104,7 @@
1104
1104
  display: grid;
1105
1105
  grid-template-columns: repeat(auto-fill, minmax(var(--sfx-up-grid-min, max(24%, 140px)), 1fr));
1106
1106
  gap: 12px;
1107
- padding: 2px 16px 16px 16px;
1107
+ padding: 0 12px 16px 16px;
1108
1108
  }
1109
1109
 
1110
1110
  @media (max-width: 480px) {
@@ -1129,6 +1129,8 @@
1129
1129
  padding: 16px 12px;
1130
1130
  position: relative;
1131
1131
  z-index: 1;
1132
+ min-height: 0;
1133
+ overflow: hidden;
1132
1134
  }
1133
1135
 
1134
1136
  .drop-tile:hover {
@@ -1137,8 +1139,8 @@
1137
1139
  }
1138
1140
 
1139
1141
  .drop-tile-rings {
1140
- width: 72px;
1141
- height: 72px;
1142
+ width: clamp(48px, 8vw, 72px);
1143
+ height: clamp(48px, 8vw, 72px);
1142
1144
  position: relative;
1143
1145
  display: flex;
1144
1146
  align-items: center;
@@ -1167,8 +1169,8 @@
1167
1169
  }
1168
1170
 
1169
1171
  .drop-tile-core {
1170
- width: 40px;
1171
- height: 40px;
1172
+ width: clamp(28px, 5vw, 40px);
1173
+ height: clamp(28px, 5vw, 40px);
1172
1174
  border-radius: 50%;
1173
1175
  background: var(--sfx-up-primary-bg, #eff6ff);
1174
1176
  color: var(--sfx-up-primary, #2563eb);
@@ -1370,7 +1372,7 @@
1370
1372
  input[type="file"] {
1371
1373
  display: none;
1372
1374
  }
1373
- `;let D=ce;V([c.property({attribute:!1})],D.prototype,"files");V([c.property({type:Boolean})],D.prototype,"showDropTile");V([c.property({attribute:!1})],D.prototype,"sources");V([c.property({type:String})],D.prototype,"accept");V([c.state()],D.prototype,"_moreOpen");var it=Object.defineProperty,ot=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&it(e,t,r),r};const fe=class fe extends s.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 s.nothing;const t=q(e),i=e.status==="complete",r=e.status==="uploading",o=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=Ye(e.name),d=["tile",i?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1375
+ `;let F=ce;V([c.property({attribute:!1})],F.prototype,"files");V([c.property({type:Boolean})],F.prototype,"showDropTile");V([c.property({attribute:!1})],F.prototype,"sources");V([c.property({type:String})],F.prototype,"accept");V([c.state()],F.prototype,"_moreOpen");var ot=Object.defineProperty,st=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ot(e,t,r),r};const fe=class fe extends s.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 s.nothing;const t=q(e),i=e.status==="complete",r=e.status==="uploading",o=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=Ve(e.name),d=["tile",i?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1374
1376
  <div class=${d} tabindex="0">
1375
1377
  <!-- Preview area -->
1376
1378
  <div class="preview">
@@ -1417,8 +1419,8 @@
1417
1419
  <!-- Error / rejected badge -->
1418
1420
  ${(o||a)&&e.error?s.html`<div class="error-badge" title=${e.error}>${e.error}</div>`:s.nothing}
1419
1421
 
1420
- <!-- Video duration badge -->
1421
- ${e.duration!=null&&e.duration>0?s.html`<div class="duration-badge">${this._formatDuration(e.duration)}</div>`:s.nothing}
1422
+ <!-- Video duration badge (hidden when error badge is shown to avoid overlap) -->
1423
+ ${!(o||a)&&e.duration!=null&&e.duration>0?s.html`<div class="duration-badge">${this._formatDuration(e.duration)}</div>`:s.nothing}
1422
1424
  </div>
1423
1425
 
1424
1426
  <!-- Action buttons -->
@@ -1755,19 +1757,22 @@
1755
1757
  /* --- Error / rejected state --- */
1756
1758
  .error-badge {
1757
1759
  position: absolute;
1758
- bottom: 28px;
1760
+ bottom: 6px;
1759
1761
  left: 6px;
1760
1762
  right: 6px;
1761
- font-size: 12px;
1762
- font-weight: 600;
1763
+ font-size: 11px;
1764
+ font-weight: 500;
1765
+ line-height: 1.3;
1763
1766
  color: #fff;
1764
- background: var(--sfx-up-error, #dc2626);
1765
- border-radius: 4px;
1766
- padding: 3px 6px;
1767
+ background: color-mix(in srgb, var(--sfx-up-error, #dc2626) 85%, transparent);
1768
+ border-radius: 6px;
1769
+ padding: 4px 8px;
1767
1770
  text-align: center;
1768
- white-space: nowrap;
1771
+ display: -webkit-box;
1772
+ -webkit-line-clamp: 2;
1773
+ line-clamp: 2;
1774
+ -webkit-box-orient: vertical;
1769
1775
  overflow: hidden;
1770
- text-overflow: ellipsis;
1771
1776
  }
1772
1777
 
1773
1778
  .tile.rejected {
@@ -1818,7 +1823,7 @@
1818
1823
  .tile { animation: none; }
1819
1824
  .spin-ring { animation: none; }
1820
1825
  }
1821
- `;let Z=fe;ot([c.property({attribute:!1})],Z.prototype,"file");const N=s.css`
1826
+ `;let J=fe;st([c.property({attribute:!1})],J.prototype,"file");const N=s.css`
1822
1827
  .btn,
1823
1828
  .btn-ghost,
1824
1829
  .btn-primary,
@@ -1892,27 +1897,52 @@
1892
1897
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1893
1898
  outline-offset: 2px;
1894
1899
  }
1895
- `;var st=Object.defineProperty,te=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&st(e,t,r),r};const ke=7,he=class he extends s.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,ke),t=this.thumbnails.length-ke;return s.html`
1900
+ `;var at=Object.defineProperty,W=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&at(e,t,r),r};const Ce=7,he=class he extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done",this.failedFiles=[]}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}_retryFile(e){this.dispatchEvent(new CustomEvent("file-retry",{bubbles:!0,composed:!0,detail:{fileId:e}}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}_close(){this.dispatchEvent(new CustomEvent("close-uploader",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,Ce),t=this.thumbnails.length-Ce,i=this.fileCount>0,r=this.failedFiles.length>0,o=r&&!i;return s.html`
1901
+ <button class="close-btn" title="Close" @click=${this._close}>
1902
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
1903
+ </button>
1896
1904
  <div class="card" role="status" aria-live="polite">
1897
- <div class="icon">
1898
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1899
- <polyline points="20 6 9 17 4 12" />
1900
- </svg>
1905
+ <div class="icon ${o?"error":r?"warning":""}">
1906
+ ${o?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1907
+ <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>
1908
+ </svg>`:r?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1909
+ <path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/>
1910
+ </svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1911
+ <polyline points="20 6 9 17 4 12" />
1912
+ </svg>`}
1901
1913
  </div>
1902
- <div class="title">Uploaded successfully!</div>
1903
- <div class="subtitle">All files are ready for use</div>
1914
+ <div class="title">${o?"Upload failed":r?"Partially uploaded":"Uploaded successfully!"}</div>
1915
+ <div class="subtitle">${o?`${this.failedFiles.length===1?"File":"Files"} could not be uploaded`:r?`${this.fileCount} ${this.fileCount===1?"file":"files"} uploaded, ${this.failedFiles.length} failed`:"All files are ready for use"}</div>
1904
1916
 
1905
1917
  ${e.length>0?s.html`
1906
1918
  <div class="thumbs">
1907
- ${e.map(i=>s.html`<img class="thumb" src=${i} alt="" />`)}
1919
+ ${e.map(a=>s.html`<img class="thumb" src=${a} alt="" />`)}
1908
1920
  ${t>0?s.html`<div class="thumb-more">+${t}</div>`:s.nothing}
1909
1921
  </div>
1910
1922
  `:s.nothing}
1911
1923
 
1912
- <div class="summary">${this.fileCount} ${this.fileCount===1?"file":"files"} · ${R(this.totalSize)} uploaded</div>
1924
+ ${i?s.html`<div class="summary">${this.fileCount} ${this.fileCount===1?"file":"files"} · ${R(this.totalSize)} uploaded</div>`:s.nothing}
1925
+
1926
+ ${r?s.html`
1927
+ <div class="failed-list">
1928
+ ${this.failedFiles.map(a=>s.html`
1929
+ <div class="failed-item">
1930
+ <svg class="failed-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label="Error"><title>Error</title><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
1931
+ <div class="failed-info">
1932
+ <div class="failed-name">${a.name}</div>
1933
+ <div class="failed-reason">${a.error}</div>
1934
+ </div>
1935
+ <button class="failed-retry" title="Retry" @click=${()=>this._retryFile(a.id)}>
1936
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg>
1937
+ </button>
1938
+ </div>
1939
+ `)}
1940
+ </div>
1941
+ `:s.nothing}
1913
1942
 
1914
1943
  <div class="actions">
1915
1944
  <button class="btn-ghost" @click=${this._uploadMore}>Upload more</button>
1945
+ ${r?s.html`<button class="btn-retry-all" @click=${this._retryAll}>Retry all (${this.failedFiles.length})</button>`:s.nothing}
1916
1946
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
1917
1947
  </div>
1918
1948
  </div>
@@ -1922,7 +1952,9 @@
1922
1952
  flex: 1;
1923
1953
  justify-content: center;
1924
1954
  align-items: center;
1925
- padding-bottom: 24px;
1955
+ padding: 24px 0;
1956
+ position: relative;
1957
+ overflow-y: auto;
1926
1958
  }
1927
1959
 
1928
1960
  .card {
@@ -1952,6 +1984,16 @@
1952
1984
  height: 30px;
1953
1985
  }
1954
1986
 
1987
+ .icon.error {
1988
+ background: #fef2f2;
1989
+ color: #ef4444;
1990
+ }
1991
+
1992
+ .icon.warning {
1993
+ background: #fffbeb;
1994
+ color: #f59e0b;
1995
+ }
1996
+
1955
1997
  .title {
1956
1998
  font-size: 20px;
1957
1999
  font-weight: 700;
@@ -2024,6 +2066,136 @@
2024
2066
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.38);
2025
2067
  }
2026
2068
 
2069
+ /* --- Failed files list --- */
2070
+ .failed-list {
2071
+ width: 100%;
2072
+ max-width: 400px;
2073
+ max-height: 200px;
2074
+ margin-bottom: 20px;
2075
+ border-radius: 8px;
2076
+ border: 1px solid var(--sfx-up-border, #e8eaed);
2077
+ overflow-y: auto;
2078
+ overflow-x: hidden;
2079
+ scrollbar-width: thin;
2080
+ scrollbar-color: rgba(0,0,0,0.15) transparent;
2081
+ }
2082
+
2083
+ .failed-list::-webkit-scrollbar {
2084
+ width: 6px;
2085
+ }
2086
+
2087
+ .failed-list::-webkit-scrollbar-track {
2088
+ background: transparent;
2089
+ margin: 6px 0;
2090
+ }
2091
+
2092
+ .failed-list::-webkit-scrollbar-thumb {
2093
+ background: rgba(0,0,0,0.15);
2094
+ border-radius: 3px;
2095
+ }
2096
+
2097
+ .failed-list::-webkit-scrollbar-thumb:hover {
2098
+ background: rgba(0,0,0,0.25);
2099
+ }
2100
+
2101
+ .failed-item {
2102
+ display: flex;
2103
+ align-items: center;
2104
+ gap: 8px;
2105
+ padding: 8px 12px;
2106
+ text-align: left;
2107
+ border-bottom: 1px solid var(--sfx-up-border, #f1f5f9);
2108
+ margin-right: 8px;
2109
+ }
2110
+
2111
+ .failed-item:last-child {
2112
+ border-bottom: none;
2113
+ }
2114
+
2115
+ .failed-icon {
2116
+ width: 16px;
2117
+ height: 16px;
2118
+ flex-shrink: 0;
2119
+ color: #ef4444;
2120
+ margin-top: 1px;
2121
+ }
2122
+
2123
+ .failed-info {
2124
+ flex: 1;
2125
+ min-width: 0;
2126
+ }
2127
+
2128
+ .failed-name {
2129
+ font-size: 12px;
2130
+ font-weight: 500;
2131
+ color: var(--sfx-up-text, #1e293b);
2132
+ white-space: nowrap;
2133
+ overflow: hidden;
2134
+ text-overflow: ellipsis;
2135
+ }
2136
+
2137
+ .failed-reason {
2138
+ font-size: 11px;
2139
+ color: var(--sfx-up-text-muted, #94a3b8);
2140
+ line-height: 1.4;
2141
+ }
2142
+
2143
+ .failed-retry {
2144
+ width: 24px;
2145
+ height: 24px;
2146
+ border: none;
2147
+ background: none;
2148
+ color: var(--sfx-up-primary, #2563eb);
2149
+ cursor: pointer;
2150
+ padding: 4px;
2151
+ flex-shrink: 0;
2152
+ display: flex;
2153
+ align-items: center;
2154
+ justify-content: center;
2155
+ border-radius: 4px;
2156
+ margin-top: -2px;
2157
+ }
2158
+
2159
+ .failed-retry svg { width: 14px; height: 14px; }
2160
+
2161
+ .failed-retry:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-primary-hover, #1d4ed8); }
2162
+
2163
+ .close-btn {
2164
+ position: absolute;
2165
+ top: 12px;
2166
+ right: 12px;
2167
+ width: 28px;
2168
+ height: 28px;
2169
+ border: none;
2170
+ background: none;
2171
+ color: var(--sfx-up-text-muted, #94a3b8);
2172
+ cursor: pointer;
2173
+ display: flex;
2174
+ align-items: center;
2175
+ justify-content: center;
2176
+ border-radius: 6px;
2177
+ padding: 0;
2178
+ }
2179
+
2180
+ .close-btn svg { width: 16px; height: 16px; }
2181
+
2182
+ .close-btn:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-text, #1e293b); }
2183
+
2184
+ .btn-retry-all {
2185
+ padding: 8px 18px;
2186
+ border-radius: 8px;
2187
+ font-size: 13px;
2188
+ font-weight: 500;
2189
+ border: 1px solid var(--sfx-up-primary, #2563eb);
2190
+ background: #fff;
2191
+ color: var(--sfx-up-primary, #2563eb);
2192
+ cursor: pointer;
2193
+ }
2194
+
2195
+ .btn-retry-all:hover {
2196
+ background: var(--sfx-up-primary-bg, #eff6ff);
2197
+ }
2198
+
2027
2199
  @keyframes fadeUp {
2028
2200
  from {
2029
2201
  opacity: 0;
@@ -2053,7 +2225,7 @@
2053
2225
  .card { animation: none; }
2054
2226
  .icon { animation: none; }
2055
2227
  }
2056
- `];let j=he;te([c.property({type:Number})],j.prototype,"fileCount");te([c.property({type:Number})],j.prototype,"totalSize");te([c.property({type:Array})],j.prototype,"thumbnails");te([c.property({type:String})],j.prototype,"primaryLabel");var at=Object.defineProperty,L=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&at(e,t,r),r};const ue=class ue extends s.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 s.html`
2228
+ `];let j=he;W([c.property({type:Number})],j.prototype,"fileCount");W([c.property({type:Number})],j.prototype,"totalSize");W([c.property({type:Array})],j.prototype,"thumbnails");W([c.property({type:String})],j.prototype,"primaryLabel");W([c.property({type:Array})],j.prototype,"failedFiles");var nt=Object.defineProperty,L=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&nt(e,t,r),r};const ue=class ue extends s.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 s.html`
2057
2229
  ${e?s.html`
2058
2230
  <div class="progress-row">
2059
2231
  <div class="progress-track" role="progressbar" aria-valuenow=${Math.round(this.uploadProgress)} aria-valuemin="0" aria-valuemax="100" aria-label="Upload progress">
@@ -2275,7 +2447,7 @@
2275
2447
  :host { animation: none; }
2276
2448
  .btn-spin { animation: none; }
2277
2449
  }
2278
- `];let E=ue;L([c.property({type:String})],E.prototype,"uploadState");L([c.property({type:Number})],E.prototype,"fileCount");L([c.property({type:Number})],E.prototype,"totalSize");L([c.property({type:Number})],E.prototype,"failedCount");L([c.property({type:Boolean})],E.prototype,"showFillMetadata");L([c.property({type:Number})],E.prototype,"completedCount");L([c.property({type:Number})],E.prototype,"uploadProgress");const nt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ae(n,e){return t=>{if(t.key!=="Tab")return;const i=n();if(!i)return;const r=i.querySelector(e);if(!r)return;const o=Array.from(r.querySelectorAll(nt));if(o.length===0)return;const a=o[0],l=o[o.length-1],d=i.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var lt=Object.defineProperty,ne=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&lt(e,t,r),r};const xe=class xe extends s.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=ae(()=>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("/"),i=t[t.length-1];if(i){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=i)}}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 i=new URL(e).pathname.split("/");t=i[i.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 s.html`
2450
+ `];let P=ue;L([c.property({type:String})],P.prototype,"uploadState");L([c.property({type:Number})],P.prototype,"fileCount");L([c.property({type:Number})],P.prototype,"totalSize");L([c.property({type:Number})],P.prototype,"failedCount");L([c.property({type:Boolean})],P.prototype,"showFillMetadata");L([c.property({type:Number})],P.prototype,"completedCount");L([c.property({type:Number})],P.prototype,"uploadProgress");const lt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ae(n,e){return t=>{if(t.key!=="Tab")return;const i=n();if(!i)return;const r=i.querySelector(e);if(!r)return;const o=Array.from(r.querySelectorAll(lt));if(o.length===0)return;const a=o[0],l=o[o.length-1],d=i.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var dt=Object.defineProperty,ne=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&dt(e,t,r),r};const xe=class xe extends s.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=ae(()=>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("/"),i=t[t.length-1];if(i){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=i)}}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 i=new URL(e).pathname.split("/");t=i[i.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 s.html`
2279
2451
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2280
2452
  <div class="card">
2281
2453
  <div class="head">
@@ -2492,7 +2664,7 @@
2492
2664
  outline: none;
2493
2665
  }
2494
2666
 
2495
- `];let A=xe;ne([c.state()],A.prototype,"_url");ne([c.state()],A.prototype,"_name");ne([c.state()],A.prototype,"_error");var dt=Object.defineProperty,re=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&dt(e,t,r),r};const ge=class ge extends s.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=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,o;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(o=this.shadowRoot)==null?void 0:o.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(a=>{a&&(this._captured=a,this._previewUrl=URL.createObjectURL(a),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 s.html`
2667
+ `];let I=xe;ne([c.state()],I.prototype,"_url");ne([c.state()],I.prototype,"_name");ne([c.state()],I.prototype,"_error");var pt=Object.defineProperty,re=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&pt(e,t,r),r};const ge=class ge extends s.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=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,o;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(o=this.shadowRoot)==null?void 0:o.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(a=>{a&&(this._captured=a,this._previewUrl=URL.createObjectURL(a),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 s.html`
2496
2668
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2497
2669
  <div class="card">
2498
2670
  <div class="head">
@@ -2602,7 +2774,7 @@
2602
2774
 
2603
2775
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2604
2776
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2605
- `];let M=ge;re([c.state()],M.prototype,"_stream");re([c.state()],M.prototype,"_error");re([c.state()],M.prototype,"_captured");re([c.state()],M.prototype,"_previewUrl");var pt=Object.defineProperty,W=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&pt(e,t,r),r};const ve=class ve extends s.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=ae(()=>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 i=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:i}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var o;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(o=this._stream)==null||o.getTracks().forEach(a=>a.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(i=>i.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2777
+ `];let O=ge;re([c.state()],O.prototype,"_stream");re([c.state()],O.prototype,"_error");re([c.state()],O.prototype,"_captured");re([c.state()],O.prototype,"_previewUrl");var ct=Object.defineProperty,G=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ct(e,t,r),r};const ve=class ve extends s.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=ae(()=>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 i=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:i}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var o;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(o=this._stream)==null||o.getTracks().forEach(a=>a.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(i=>i.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2606
2778
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2607
2779
  <div class="card">
2608
2780
  <div class="head">
@@ -2746,13 +2918,15 @@
2746
2918
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2747
2919
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2748
2920
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
2749
- `];let F=ve;W([c.state()],F.prototype,"_stream");W([c.state()],F.prototype,"_recording");W([c.state()],F.prototype,"_error");W([c.state()],F.prototype,"_recordedBlob");W([c.state()],F.prototype,"_previewUrl");var ct=Object.defineProperty,w=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ct(e,t,r),r};const Ce=new Set(["unsplash"]);var C;const m=(C=class extends s.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._fullscreenVideoFile=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._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=T,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,o;const t=this._mergedSources.find(a=>a.id===e);if(t!=null&&t.onActivate){try{t.onActivate(this)}catch(a){console.error(`[sfx-uploader] onActivate for custom source "${e}" threw:`,a)}return}if(e==="device"){const a=this.shadowRoot.querySelector("sfx-drop-zone");a==null||a.browse();return}if(e==="url"){this._showUrlDialog=!0;return}if(e==="camera"){this._showCameraDialog=!0;return}if(e==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(r=this.config)==null?void 0:r.connectors)==null?void 0:o.providers)??[]).includes(e)){if(Ce.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-BM-foEWT.cjs"));customElements.define("sfx-search-provider-browser",l)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:l}=await Promise.resolve().then(()=>require("./provider-browser-DajdSDoL.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,f;this._showUrlDialog=!1;const{url:t,name:i}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,o=Ne(i),a=o.startsWith("image/"),l=this._store.getState(),d=oe({name:i,size:0,type:o},l.restrictions,l.files);if(d){const x={id:B(),status:"rejected",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};O(this._store,x),this._dispatchPublic(g.FILE_REJECTED,{file:x,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,x,d);return}const p={id:B(),status:"idle",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:a?t:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};O(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(f=r==null?void 0:r.onFileAdded)==null||f.call(r,p),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 i,r,o;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(o=(r=(i=this.config)==null?void 0:i.callbacks)==null?void 0:r.onFilePreview)==null||o.call(r,t))},this._onFillMetadata=()=>{var t,i,r;const e=[...this._store.getState().files.values()].filter(o=>C._MODIFIABLE_STATUSES.has(o.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onFillMetadata)==null||r.call(i,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 i,r,o;const e=(i=this.config)==null?void 0:i.callbacks;(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(o=e==null?void 0:e.onFileRemoved)==null||o.call(e,a);this._revokeVideoBlobUrls();for(const a of this._rejectedTimers.values())clearTimeout(a);this._rejectedTimers.clear(),this._dimCache.clear(),this._previewFileId=null,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{var r;const e=this.shadowRoot.querySelector("sfx-drop-zone");if(e){e.browse();return}const t=this.shadowRoot.querySelector("sfx-file-list"),i=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');i==null||i.click()},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 i,r,o;const t=(i=this.config)==null?void 0:i.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=oe({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:B(),status:"rejected",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};O(this._store,h),this._dispatchPublic(g.FILE_REJECTED,{file:h,reason:d}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,h,d);continue}const p={id:B(),status:"idle",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};O(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,p)}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(g.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,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{})},this._onModalDismiss=()=>{var e,t,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillDismiss=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},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 i;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,i;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((i=this.config)==null?void 0:i.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,i=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+i,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],i=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(i)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+i,this._fsPanY=this._fsPanStartY+r,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=Se(),this._storeCtrl=new De(this,this._store)}open(){var e,t,i;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||i.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,i,r;this._isOpen&&(this._isOpen=!1,((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onClose)==null||r.call(i),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,o,a,l,d;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(p=>p.status==="idle"||p.status==="queued");if((o=(r=this.config)==null?void 0:r.callbacks)!=null&&o.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll())}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const i=this._store.getState().files,r=new Map(i);let o=!1;for(const a of e){const l=i.get(a.id);l&&(r.set(a.id,{...l,...a}),o=!0)}o&&this._store.setState({files:r})}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,i){const r=this._store.getState().files,o=r.get(e);if(!o||!C._MODIFIABLE_STATUSES.has(o.status))return;const a=new Map(r);a.set(e,{...o,meta:t!=null?{...o.meta,...t}:o.meta,tags:i??o.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,i=new Map(t);let r=!1;for(const{fileId:o,meta:a,tags:l}of e){const d=t.get(o);!d||!C._MODIFIABLE_STATUSES.has(d.status)||(i.set(o,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:i})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,i=this._store.getState().files.get(t);i?this._getImageDimensions(i).then(r=>{this._previewFileId===t&&(this._previewDims=r?`${r.w} × ${r.h}`:"—")}):this._previewDims="—"}this._updateFloatingPortal()}_injectFloatStyles(){if(document.querySelector("style[data-sfx-upload-float-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-upload-float-styles",""),e.textContent=`
2750
- [data-sfx-upload-float] .upload-float { position:fixed; bottom:24px; right:24px; z-index:10000; width:320px; border-radius:12px; background:#fff; box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06); overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxFloatIn .3s ease both; }
2921
+ `];let M=ve;G([c.state()],M.prototype,"_stream");G([c.state()],M.prototype,"_recording");G([c.state()],M.prototype,"_error");G([c.state()],M.prototype,"_recordedBlob");G([c.state()],M.prototype,"_previewUrl");var ft=Object.defineProperty,k=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ft(e,t,r),r};const $e=new Set(["unsplash"]);var $;const _=($=class extends s.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._fullscreenVideoFile=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._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=A,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._closeOnCompleteTimer=null,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,o;const t=this._mergedSources.find(a=>a.id===e);if(t!=null&&t.onActivate){try{t.onActivate(this)}catch(a){console.error(`[sfx-uploader] onActivate for custom source "${e}" threw:`,a)}return}if(e==="device"){const a=this.shadowRoot.querySelector("sfx-drop-zone");a==null||a.browse();return}if(e==="url"){this._showUrlDialog=!0;return}if(e==="camera"){this._showCameraDialog=!0;return}if(e==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(r=this.config)==null?void 0:r.connectors)==null?void 0:o.providers)??[]).includes(e)){if($e.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-C0yqcOmH.cjs"));customElements.define("sfx-search-provider-browser",l)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:l}=await Promise.resolve().then(()=>require("./provider-browser-YA7MCWl4.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,x;this._showUrlDialog=!1;const{url:t,name:i}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,o=Xe(i),a=o.startsWith("image/"),l=this._store.getState(),d=oe({name:i,size:0,type:o},l.restrictions,l.files);if(d){const f={id:B(),status:"rejected",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,f,d);return}const p={id:B(),status:"idle",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:a?t:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(x=r==null?void 0:r.onFileAdded)==null||x.call(r,p),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 i,r,o;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(o=(r=(i=this.config)==null?void 0:i.callbacks)==null?void 0:r.onFilePreview)==null||o.call(r,t))},this._onFillMetadata=()=>{var t,i,r;const e=[...this._store.getState().files.values()].filter(o=>$._MODIFIABLE_STATUSES.has(o.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onFillMetadata)==null||r.call(i,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 i,r,o;const e=(i=this.config)==null?void 0:i.callbacks;this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(o=e==null?void 0:e.onFileRemoved)==null||o.call(e,a);this._revokeVideoBlobUrls();for(const a of this._rejectedTimers.values())clearTimeout(a);this._rejectedTimers.clear(),this._dimCache.clear(),this._previewFileId=null,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{var r;const e=this.shadowRoot.querySelector("sfx-drop-zone");if(e){e.browse();return}const t=this.shadowRoot.querySelector("sfx-file-list"),i=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');i==null||i.click()},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 i,r,o;const t=(i=this.config)==null?void 0:i.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=oe({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:B(),status:"rejected",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};T(this._store,h),this._dispatchPublic(g.FILE_REJECTED,{file:h,reason:d}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,h,d);continue}const p={id:B(),status:"idle",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};T(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,p)}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,i,r,o;this._dispatchPublic(g.COMPLETE_ACTION,{}),(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCompleteAction)==null||i.call(t),((r=this.config)==null?void 0:r.mode)==="modal"?this.close():((o=this.config)==null?void 0:o.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{})},this._onSuccessCardClose=()=>{var e,t,i,r;((e=this.config)==null?void 0:e.mode)==="inline"?(this._dispatchPublic(g.COMPLETE_ACTION,{}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCompleteAction)==null||r.call(i),this._onClearAll()):this._onModalDismiss()},this._onModalDismiss=()=>{var e,t,i,r;this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCancel)==null||r.call(i),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillExpand=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},this._onPillDismiss=()=>{var e,t,i,r;this._isMinimized=!1,this._isPillExpanded=!1,this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCancel)==null||r.call(i),this._dispatchPublic(g.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 i;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,i;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((i=this.config)==null?void 0:i.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,i=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+i,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],i=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(i)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+i,this._fsPanY=this._fsPanStartY+r,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=Ee(),this._storeCtrl=new Fe(this,this._store)}open(){var e,t,i;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||i.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,i,r;this._isOpen&&(this._isOpen=!1,this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onClose)==null||r.call(i),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,o,a,l,d,p,h;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(u=>u.status==="idle"||u.status==="queued");if((o=(r=this.config)==null?void 0:r.callbacks)!=null&&o.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll(),(p=this.config)!=null&&p.minimizeOnUpload&&((h=this.config)==null?void 0:h.mode)!=="inline"&&(this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()))}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const i=this._store.getState().files,r=new Map(i);let o=!1;for(const a of e){const l=i.get(a.id);l&&(r.set(a.id,{...l,...a}),o=!0)}o&&this._store.setState({files:r})}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,i){const r=this._store.getState().files,o=r.get(e);if(!o||!$._MODIFIABLE_STATUSES.has(o.status))return;const a=new Map(r);a.set(e,{...o,meta:t!=null?{...o.meta,...t}:o.meta,tags:i??o.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,i=new Map(t);let r=!1;for(const{fileId:o,meta:a,tags:l}of e){const d=t.get(o);!d||!$._MODIFIABLE_STATUSES.has(d.status)||(i.set(o,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:i})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,i=this._store.getState().files.get(t);i?this._getImageDimensions(i).then(r=>{this._previewFileId===t&&(this._previewDims=r?`${r.w} × ${r.h}`:"—")}):this._previewDims="—"}this._updateFloatingPortal()}_injectFloatStyles(){if(document.querySelector("style[data-sfx-upload-float-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-upload-float-styles",""),e.textContent=`
2922
+ [data-sfx-upload-float] .upload-float { position:fixed; bottom:24px; right:24px; z-index:10000; width:470px; border-radius:12px; background:#fff; box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06); overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxFloatIn .3s ease both; }
2751
2923
  [data-sfx-upload-float] .float-header { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border-bottom:1px solid #e8edf5; }
2752
2924
  [data-sfx-upload-float] .float-header-left { display:flex; align-items:center; gap:8px; }
2753
2925
  [data-sfx-upload-float] .float-icon { width:28px; height:28px; border-radius:6px; background:#eff6ff; color:#2563eb; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2754
2926
  [data-sfx-upload-float] .float-icon svg { width:14px; height:14px; }
2755
2927
  [data-sfx-upload-float] .float-icon.done { background:#f0fdf4; color:#22c55e; }
2928
+ [data-sfx-upload-float] .float-icon.warn { background:#fffbeb; color:#f59e0b; }
2929
+ [data-sfx-upload-float] .float-icon.error { background:#fef2f2; color:#ef4444; }
2756
2930
  [data-sfx-upload-float] .float-title { font-size:13px; font-weight:600; color:#1e293b; }
2757
2931
  [data-sfx-upload-float] .float-subtitle { font-size:11px; color:#94a3b8; }
2758
2932
  [data-sfx-upload-float] .float-actions { display:flex; gap:4px; }
@@ -2764,27 +2938,40 @@
2764
2938
  [data-sfx-upload-float] .float-progress-label { font-size:12px; color:#475569; }
2765
2939
  [data-sfx-upload-float] .float-progress-pct { font-size:12px; font-weight:600; color:#2563eb; }
2766
2940
  [data-sfx-upload-float] .float-progress-pct.done { color:#22c55e; }
2941
+ [data-sfx-upload-float] .float-progress-pct.warn { color:#f59e0b; }
2942
+ [data-sfx-upload-float] .float-progress-pct.error { color:#ef4444; }
2767
2943
  [data-sfx-upload-float] .float-bar { height:4px; background:#e8edf5; border-radius:2px; overflow:hidden; }
2768
2944
  [data-sfx-upload-float] .float-bar-fill { height:100%; background:#2563eb; border-radius:2px; transition:width .3s ease; }
2769
2945
  [data-sfx-upload-float] .float-bar-fill.done { background:#22c55e; }
2946
+ [data-sfx-upload-float] .float-bar-fill.warn { background:#f59e0b; }
2947
+ [data-sfx-upload-float] .float-bar-fill.error { background:#ef4444; }
2770
2948
  [data-sfx-upload-float] .float-items { max-height:200px; overflow-y:auto; }
2771
- [data-sfx-upload-float] .float-item { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid #f1f5f9; }
2949
+ [data-sfx-upload-float] .float-item { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid #f1f5f9; overflow:hidden; }
2772
2950
  [data-sfx-upload-float] .float-item:last-child { border-bottom:none; }
2773
2951
  [data-sfx-upload-float] .float-item-thumb { width:32px; height:32px; border-radius:6px; background:#f8fafc; display:flex; align-items:center; justify-content:center; color:#94a3b8; flex-shrink:0; }
2774
2952
  [data-sfx-upload-float] .float-item-thumb svg { width:16px; height:16px; }
2775
- [data-sfx-upload-float] .float-item-info { flex:1; min-width:0; }
2953
+ [data-sfx-upload-float] .float-item-info { flex:1; min-width:0; overflow:hidden; }
2776
2954
  [data-sfx-upload-float] .float-item-name { font-size:12px; font-weight:500; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
2777
2955
  [data-sfx-upload-float] .float-item-size { font-size:11px; color:#94a3b8; }
2778
2956
  [data-sfx-upload-float] .float-item-done { width:18px; height:18px; border-radius:50%; background:#f0fdf4; color:#22c55e; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2779
2957
  [data-sfx-upload-float] .float-item-done svg { width:12px; height:12px; }
2780
2958
  [data-sfx-upload-float] .float-item-spinner { width:16px; height:16px; border:2px solid #e8edf5; border-top-color:#2563eb; border-radius:50%; animation:sfxSpin .8s linear infinite; flex-shrink:0; }
2781
- [data-sfx-upload-float] .float-item-error { color:#ef4444; width:16px; height:16px; flex-shrink:0; }
2782
- [data-sfx-upload-float] .float-collapsed { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; width:320px; border-radius:12px; }
2959
+ [data-sfx-upload-float] .float-item-status { display:flex; flex-direction:row; align-items:center; gap:4px; flex-shrink:0; }
2960
+ [data-sfx-upload-float] .float-item-error-wrap { position:relative; display:flex; align-items:center; flex-shrink:0; }
2961
+ [data-sfx-upload-float] .float-item-error-icon { width:16px; height:16px; color:#ef4444; flex-shrink:0; cursor:pointer; }
2962
+ [data-sfx-upload-float] .float-item-tooltip { display:none; position:absolute; right:calc(100% + 8px); top:50%; transform:translateY(-50%); background:#fff; color:#1e293b; font-size:11px; padding:6px 10px; border-radius:6px; white-space:nowrap; pointer-events:none; z-index:10; box-shadow:0 2px 12px rgba(0,0,0,0.12),0 1px 4px rgba(0,0,0,0.08); }
2963
+ [data-sfx-upload-float] .float-item-error-wrap:hover .float-item-tooltip { display:block; }
2964
+ [data-sfx-upload-float] .float-item-retry { width:24px; height:24px; border:none; background:none; color:#2563eb; cursor:pointer; padding:4px; flex-shrink:0; display:flex; align-items:center; justify-content:center; border-radius:4px; }
2965
+ [data-sfx-upload-float] .float-item-retry svg { width:14px; height:14px; }
2966
+ [data-sfx-upload-float] .float-item-retry:hover { background:#f1f5f9; color:#1d4ed8; }
2967
+ [data-sfx-upload-float] .float-collapsed { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; width:470px; border-radius:12px; }
2783
2968
  [data-sfx-upload-float] .float-collapsed-left { display:flex; align-items:center; gap:8px; }
2784
2969
  [data-sfx-upload-float] .float-collapsed-spinner { width:18px; height:18px; border:2.5px solid #e8edf5; border-top-color:#2563eb; border-radius:50%; animation:sfxSpin .8s linear infinite; flex-shrink:0; }
2785
2970
  [data-sfx-upload-float] .float-collapsed-icon { width:18px; height:18px; flex-shrink:0; }
2786
2971
  [data-sfx-upload-float] .float-collapsed-icon svg { width:18px; height:18px; }
2787
2972
  [data-sfx-upload-float] .float-collapsed-icon.done { color:#22c55e; }
2973
+ [data-sfx-upload-float] .float-collapsed-icon.warn { color:#f59e0b; }
2974
+ [data-sfx-upload-float] .float-collapsed-icon.error { color:#ef4444; }
2788
2975
  [data-sfx-upload-float] .float-collapsed-text { font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; }
2789
2976
  [data-sfx-upload-float] .float-collapsed-pct { font-size:13px; font-weight:600; color:#2563eb; }
2790
2977
  [data-sfx-upload-float] .float-collapsed-actions { display:flex; gap:4px; }
@@ -2793,7 +2980,7 @@
2793
2980
  [data-sfx-upload-float] .float-collapsed-actions button svg { width:14px; height:14px; }
2794
2981
  @keyframes sfxFloatIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
2795
2982
  @keyframes sfxSpin { to{transform:rotate(360deg)} }
2796
- `,document.head.appendChild(e)}_updateFloatingPortal(){const e=[...this._storeCtrl.state.files.values()];this._isMinimized&&e.length>0?(this._injectFloatStyles(),this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-upload-float",""),document.body.appendChild(this._portalContainer)),s.render(this._renderFloatingPill(e),this._portalContainer)):this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t,i,r;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null,(t=this._portalContainer)==null||t.remove(),this._portalContainer=null,document.querySelector("[data-sfx-upload-float]")||(i=document.querySelector("style[data-sfx-upload-float-styles]"))==null||i.remove(),this._revokeVideoBlobUrls();for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear();for(const o of this._store.getState().files.values())o.previewUrl&&URL.revokeObjectURL(o.previewUrl);(r=this._engine)==null||r.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 i=this._store.getState().queueConfig;t.queueConfig={...i,concurrency:e.concurrency}}if(e.autoProceed!=null){const i=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...i,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 r,o;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=ee(t.container),this._authHeaders=G(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const i=++this._authResolveId;try{const a=await Pe(t);if(i!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(o=this._engine)==null||o.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(i!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new Ee(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 r,o,a,l,d,p,h;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const i=(r=this.config)==null?void 0:r.callbacks;for(const[u,f]of e.files){const x=t.files.get(u);if(x){if(x.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(o=i==null?void 0:i.onUploadComplete)==null||o.call(i,f,f.response));break;case"error":case"failed":{const b=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:b}),(a=i==null?void 0:i.onUploadError)==null||a.call(i,f,b);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=i==null?void 0:i.onUploadRetry)==null||l.call(i,f,f.retryCount);break}f.status==="uploading"&&x.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=i==null?void 0:i.onUploadProgress)==null||d.call(i,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const u=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:u}),(p=i==null?void 0:i.onTotalProgress)==null||p.call(i,e.totalProgress,e.totalSpeed,u)}if(t.isUploading&&!e.isUploading){const u=[...e.files.values()];if(!u.some(x=>x.status==="cancelled")){const x=u.filter(v=>v.status==="complete"),b=u.filter(v=>v.status==="failed"||v.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:x,failed:b}),(h=i==null?void 0:i.onAllComplete)==null||h.call(i,x,b)}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=T,this._cachedSources;const t=e.providers.length>0?ze(e.providers):[],i=e.customSources??[],r=T.filter(p=>p.id==="device"||p.id==="url"),o=T.filter(p=>p.id!=="device"&&p.id!=="url"),a=new Set,l=[];for(const p of[...r,...t,...o,...i])if(!a.has(p.id)){if(C._RESERVED_IDS.has(p.id)&&p.onActivate){console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);continue}a.add(p.id),l.push(p)}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 i=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>i.has(r.status))&&t.some(r=>r.status==="complete")?"complete":"ready"}_processIncomingFiles(e){var i,r,o,a;const t=(i=this.config)==null?void 0:i.callbacks;for(const l of e){const d=this._store.getState(),p=We(l,d.restrictions,d.files);if(p){const f={id:B(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};O(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:p}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,p);const x=(o=this.config)==null?void 0:o.rejectedFileAutoRemoveDelay,b=x===!1||x===0?0:x??4e3;if(b>0){const v=f.id,_=setTimeout(()=>{this._rejectedTimers.delete(v);const k=this._store.getState().files.get(v);k&&k.status==="rejected"&&be(this._store,v)},b);this._rejectedTimers.set(v,_)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const u={id:B(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:h,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};if(O(this._store,u),this._dispatchPublic(g.FILE_ADDED,{file:u}),(a=t==null?void 0:t.onFileAdded)==null||a.call(t,u),l.type.startsWith("video/")){Xe(l).then(x=>{if(!x)return;const b=this._store.getState(),v=b.files.get(u.id);if(v){const _=new Map(b.files);_.set(u.id,{...v,previewUrl:x}),this._store.setState({files:_})}else URL.revokeObjectURL(x)});const f=document.createElement("video");f.preload="metadata",f.src=URL.createObjectURL(l),f.onerror=()=>{URL.revokeObjectURL(f.src)},f.onloadedmetadata=()=>{const x=f.duration;if(URL.revokeObjectURL(f.src),!isFinite(x))return;const b=this._store.getState(),v=b.files.get(u.id);if(v){const _=new Map(b.files);_.set(u.id,{...v,duration:x}),this._store.setState({files:_})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var o,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const i={...t};if((this._fullscreenPreviewUrl&&this._fullscreenPreviewUrl===t.previewUrl||this._fullscreenVideoFile&&this._fullscreenVideoFile===t.file)&&(this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null),t.previewUrl&&URL.revokeObjectURL(t.previewUrl),t.file){const p=this._videoBlobUrls.get(t.file);p&&(URL.revokeObjectURL(p),this._videoBlobUrls.delete(t.file))}(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((o=this._engine)==null||o.cancelFile(e)),be(this._store,e),this._dimCache.delete(e);const r=this._rejectedTimers.get(e);if(r&&(clearTimeout(r),this._rejectedTimers.delete(e)),this._previewFileId===e){const p=[...this._store.getState().files.values()];this._previewFileId=p.length>0?p[0].id:null}this._dispatchPublic(g.FILE_REMOVED,{file:i}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,i)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
2983
+ `,document.head.appendChild(e)}_updateFloatingPortal(){const e=[...this._storeCtrl.state.files.values()];this._isMinimized&&e.length>0?(this._injectFloatStyles(),this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-upload-float",""),document.body.appendChild(this._portalContainer)),s.render(this._renderFloatingPill(e),this._portalContainer)):this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t,i,r;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null,(t=this._portalContainer)==null||t.remove(),this._portalContainer=null,document.querySelector("[data-sfx-upload-float]")||(i=document.querySelector("style[data-sfx-upload-float-styles]"))==null||i.remove(),this._revokeVideoBlobUrls();for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear(),this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null);for(const o of this._store.getState().files.values())o.previewUrl&&URL.revokeObjectURL(o.previewUrl);(r=this._engine)==null||r.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 i=this._store.getState().queueConfig;t.queueConfig={...i,concurrency:e.concurrency}}if(e.autoProceed!=null){const i=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...i,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 r,o;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=te(t.container),this._authHeaders=K(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const i=++this._authResolveId;try{const a=await ze(t);if(i!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(o=this._engine)==null||o.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(i!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new Ue(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 r,o,a,l,d,p,h,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const i=(r=this.config)==null?void 0:r.callbacks;for(const[x,f]of e.files){const v=t.files.get(x);if(v){if(v.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(o=i==null?void 0:i.onUploadComplete)==null||o.call(i,f,f.response));break;case"error":case"failed":{const w=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:w}),(a=i==null?void 0:i.onUploadError)==null||a.call(i,f,w);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=i==null?void 0:i.onUploadRetry)==null||l.call(i,f,f.retryCount);break}f.status==="uploading"&&v.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=i==null?void 0:i.onUploadProgress)==null||d.call(i,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const x=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:x}),(p=i==null?void 0:i.onTotalProgress)==null||p.call(i,e.totalProgress,e.totalSpeed,x)}if(t.isUploading&&!e.isUploading){const x=[...e.files.values()];if(!x.some(v=>v.status==="cancelled")){const v=x.filter(m=>m.status==="complete"),w=x.filter(m=>m.status==="failed"||m.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:v,failed:w}),(h=i==null?void 0:i.onAllComplete)==null||h.call(i,v,w);const b=(u=this.config)==null?void 0:u.closeOnComplete;if(b){const m=typeof b=="number"?b:1500;this._closeOnCompleteTimer=setTimeout(()=>{var y,E,be;this._closeOnCompleteTimer=null,this._phase==="complete"&&(this._dispatchPublic(g.COMPLETE_ACTION,{}),(be=(E=(y=this.config)==null?void 0:y.callbacks)==null?void 0:E.onCompleteAction)==null||be.call(E),this.close())},m)}}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=A,this._cachedSources;const t=e.providers.length>0?De(e.providers):[],i=e.customSources??[],r=A.filter(p=>p.id==="device"||p.id==="url"),o=A.filter(p=>p.id!=="device"&&p.id!=="url"),a=new Set,l=[];for(const p of[...r,...t,...o,...i])if(!a.has(p.id)){if($._RESERVED_IDS.has(p.id)&&p.onActivate){console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);continue}a.add(p.id),l.push(p)}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 i=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>i.has(r.status))&&t.some(r=>r.status==="complete"||r.status==="failed")?"complete":"ready"}_processIncomingFiles(e){var i,r,o,a;const t=(i=this.config)==null?void 0:i.callbacks;for(const l of e){const d=this._store.getState(),p=Ge(l,d.restrictions,d.files);if(p){const x=l.type.startsWith("image/")?URL.createObjectURL(l):null,f={id:B(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:x,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:p}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,p);const v=(o=this.config)==null?void 0:o.rejectedFileAutoRemoveDelay,w=v===!1||v===0||v===void 0?0:v;if(w>0){const b=f.id,m=setTimeout(()=>{this._rejectedTimers.delete(b);const y=this._store.getState().files.get(b);y&&y.status==="rejected"&&me(this._store,b)},w);this._rejectedTimers.set(b,m)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const u={id:B(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:h,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};if(T(this._store,u),this._dispatchPublic(g.FILE_ADDED,{file:u}),(a=t==null?void 0:t.onFileAdded)==null||a.call(t,u),l.type.startsWith("video/")){We(l).then(f=>{if(!f)return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,previewUrl:f}),this._store.setState({files:b})}else URL.revokeObjectURL(f)});const x=document.createElement("video");x.preload="metadata",x.src=URL.createObjectURL(l),x.onerror=()=>{URL.revokeObjectURL(x.src)},x.onloadedmetadata=()=>{const f=x.duration;if(URL.revokeObjectURL(x.src),!isFinite(f))return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,duration:f}),this._store.setState({files:b})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var o,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const i={...t};if((this._fullscreenPreviewUrl&&this._fullscreenPreviewUrl===t.previewUrl||this._fullscreenVideoFile&&this._fullscreenVideoFile===t.file)&&(this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null),t.previewUrl&&URL.revokeObjectURL(t.previewUrl),t.file){const p=this._videoBlobUrls.get(t.file);p&&(URL.revokeObjectURL(p),this._videoBlobUrls.delete(t.file))}(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((o=this._engine)==null||o.cancelFile(e)),me(this._store,e),this._dimCache.delete(e);const r=this._rejectedTimers.get(e);if(r&&(clearTimeout(r),this._rejectedTimers.delete(e)),this._previewFileId===e){const p=[...this._store.getState().files.values()];this._previewFileId=p.length>0?p[0].id:null}this._dispatchPublic(g.FILE_REMOVED,{file:i}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,i)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
2797
2984
  ${this._isOpen&&!this._isMinimized?s.html`
2798
2985
  <div class="modal-backdrop" @click=${this._onModalBackdropClick}>
2799
2986
  <div class="modal-card">
@@ -2807,7 +2994,7 @@
2807
2994
  ${this._renderHeader()}
2808
2995
  ${this._renderBody()}
2809
2996
  </div>
2810
- `}_renderHeader(){var a,l;if(this._phase==="complete")return s.nothing;if(this._phase==="uploading"){const d=this._storeCtrl.state,p=[...d.files.values()],h=p.filter(f=>f.status==="complete").length,u=d.totalSpeed>0?(d.totalBytes-d.totalBytesUploaded)/d.totalSpeed:0;return s.html`
2997
+ `}_renderHeader(){var a,l;if(this._phase==="complete")return s.nothing;if(this._phase==="uploading"){const d=this._storeCtrl.state,p=[...d.files.values()],h=p.filter(x=>x.status==="complete").length,u=d.totalSpeed>0?(d.totalBytes-d.totalBytesUploaded)/d.totalSpeed:0;return s.html`
2811
2998
  <div class="header upload-header">
2812
2999
  <div class="float-header-left">
2813
3000
  <div class="float-icon">
@@ -2842,7 +3029,7 @@
2842
3029
  <div class="header-title">Upload Files</div>
2843
3030
  ${o}
2844
3031
  </div>
2845
- `}_getImageDimensions(e){return e.previewUrl?this._dimCache.has(e.id)?Promise.resolve(this._dimCache.get(e.id)):new Promise(t=>{const i=new Image;i.onload=()=>{const r={w:i.naturalWidth,h:i.naturalHeight};this._dimCache.set(e.id,r),t(r)},i.onerror=()=>{this._dimCache.set(e.id,null),t(null)},i.src=e.previewUrl}):Promise.resolve(null)}_renderUploadOverlay(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=e.filter(a=>a.status==="complete").length,o=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return s.html`
3032
+ `}_getImageDimensions(e){return e.previewUrl?this._dimCache.has(e.id)?Promise.resolve(this._dimCache.get(e.id)):new Promise(t=>{const i=new Image;i.onload=()=>{const r={w:i.naturalWidth,h:i.naturalHeight};this._dimCache.set(e.id,r),t(r)},i.onerror=()=>{this._dimCache.set(e.id,null),t(null)},i.src=e.previewUrl}):Promise.resolve(null)}_renderUploadOverlay(e){var a;const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=e.filter(l=>l.status==="complete").length,o=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return s.html`
2846
3033
  <div class="upload-overlay">
2847
3034
  <div class="upload-overlay-spinner"></div>
2848
3035
  <div class="upload-overlay-percent">${i}%</div>
@@ -2851,20 +3038,23 @@
2851
3038
  <div class="upload-overlay-bar">
2852
3039
  <div class="upload-overlay-bar-fill" style="width:${i}%"></div>
2853
3040
  </div>
2854
- <button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>
3041
+ ${(a=this.config)!=null&&a.minimizeOnUpload?s.html`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>`:s.nothing}
2855
3042
  </div>
2856
- `}_renderFloatingPill(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=this._phase==="complete",o=e.filter(l=>l.status==="complete").length,a=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return this._isPillExpanded===!1?s.html`
3043
+ `}_renderFloatingPill(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=this._phase==="complete",o=e.filter(d=>d.status==="complete").length,a=e.filter(d=>d.status==="failed").length,l=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return this._isPillExpanded===!1?s.html`
2857
3044
  <div class="upload-float float-collapsed">
2858
3045
  <div class="float-collapsed-left">
2859
- ${r?s.html`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:s.html`<div class="float-collapsed-spinner"></div>`}
2860
- <span class="float-collapsed-text">${r?"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</span>
3046
+ ${r?a>0?o>0?s.html`<div class="float-collapsed-icon warn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>`:s.html`<div class="float-collapsed-icon error"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg></div>`:s.html`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:s.html`<div class="float-collapsed-spinner"></div>`}
3047
+ <span class="float-collapsed-text">${r?a>0?o>0?"Partially uploaded":"Upload failed":"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</span>
2861
3048
  ${r?s.nothing:s.html`<span class="float-collapsed-pct">${i}%</span>`}
2862
3049
  </div>
2863
3050
  <div class="float-collapsed-actions">
3051
+ <button title="Open uploader" @click=${this._onPillExpand}>
3052
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
3053
+ </button>
2864
3054
  <button title="Expand" @click=${this._onPillClick}>
2865
3055
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="18 15 12 9 6 15"/></svg>
2866
3056
  </button>
2867
- <button title="Dismiss" @click=${this._onPillDismiss}>
3057
+ <button title="Close" @click=${this._onPillDismiss}>
2868
3058
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
2869
3059
  </button>
2870
3060
  </div>
@@ -2873,19 +3063,22 @@
2873
3063
  <div class="upload-float">
2874
3064
  <div class="float-header">
2875
3065
  <div class="float-header-left">
2876
- <div class="float-icon ${r?"done":""}">
2877
- ${r?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
3066
+ <div class="float-icon ${r?a>0?o>0?"warn":"error":"done":""}">
3067
+ ${r?a>0?o>0?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
2878
3068
  </div>
2879
3069
  <div>
2880
- <div class="float-title">${r?"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</div>
2881
- <div class="float-subtitle">${r?`${o} ${o===1?"file":"files"} uploaded`:`${o} of ${e.length}${a>0?` · ~${ie(a)} left`:""}`}</div>
3070
+ <div class="float-title">${r?a>0?o>0?"Partially uploaded":"Upload failed":"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</div>
3071
+ <div class="float-subtitle">${r?`${o} ${o===1?"file":"files"} uploaded${a>0?`, ${a} failed`:""}`:`${o} of ${e.length}${l>0?` · ~${ie(l)} left`:""}`}</div>
2882
3072
  </div>
2883
3073
  </div>
2884
3074
  <div class="float-actions">
3075
+ <button title="Expand" @click=${this._onPillExpand}>
3076
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
3077
+ </button>
2885
3078
  <button title="Collapse" @click=${this._onPillClick}>
2886
3079
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="6 9 12 15 18 9"/></svg>
2887
3080
  </button>
2888
- <button title="Dismiss" @click=${this._onPillDismiss}>
3081
+ <button title="Close" @click=${this._onPillDismiss}>
2889
3082
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
2890
3083
  </button>
2891
3084
  </div>
@@ -2893,25 +3086,32 @@
2893
3086
  <div class="float-progress">
2894
3087
  <div class="float-progress-top">
2895
3088
  <span class="float-progress-label">Overall progress</span>
2896
- <span class="float-progress-pct ${r?"done":""}">${r?"Done":`${i}%`}</span>
3089
+ <span class="float-progress-pct ${r?a>0?o>0?"warn":"error":"done":""}">${r?"Done":`${i}%`}</span>
2897
3090
  </div>
2898
- <div class="float-bar"><div class="float-bar-fill ${r?"done":""}" style="width:${r?100:i}%"></div></div>
3091
+ <div class="float-bar"><div class="float-bar-fill ${r?a>0?o>0?"warn":"error":"done":""}" style="width:${r?100:i}%"></div></div>
2899
3092
  </div>
2900
3093
  <div class="float-items">
2901
- ${e.map(l=>s.html`
3094
+ ${e.map(d=>{const p=d.status==="failed"||d.status==="error";return s.html`
2902
3095
  <div class="float-item">
2903
- <div class="float-item-thumb">
2904
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>
3096
+ <div class="float-item-thumb" style=${d.previewUrl?`background-image:url(${d.previewUrl});background-size:cover;background-position:center`:""}>
3097
+ ${d.previewUrl?s.nothing:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`}
2905
3098
  </div>
2906
3099
  <div class="float-item-info">
2907
- <div class="float-item-name">${l.name}</div>
2908
- <div class="float-item-size">${R(l.size)}</div>
3100
+ <div class="float-item-name">${d.name}</div>
3101
+ <div class="float-item-size">${R(d.size)}</div>
2909
3102
  </div>
2910
3103
  <div class="float-item-status">
2911
- ${l.status==="complete"?s.html`<div class="float-item-done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:l.status==="failed"||l.status==="error"?s.html`<svg class="float-item-error" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`:s.html`<div class="float-item-spinner"></div>`}
3104
+ ${d.status==="complete"?s.html`<div class="float-item-done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:p?s.html`
3105
+ <div class="float-item-error-wrap">
3106
+ <svg class="float-item-error-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
3107
+ <span class="float-item-tooltip">${d.error||"Upload failed"}</span>
3108
+ </div>
3109
+ <button class="float-item-retry" @click=${()=>{var h;this._ensureEngine(),(h=this._engine)==null||h.retryFile(d.id)}}>
3110
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg>
3111
+ </button>`:s.html`<div class="float-item-spinner"></div>`}
2912
3112
  </div>
2913
3113
  </div>
2914
- `)}
3114
+ `})}
2915
3115
  </div>
2916
3116
  </div>
2917
3117
  `}_renderPreviewLayout(e){var l;if(e.length===0)return s.nothing;const t=e.find(d=>d.id===this._previewFileId)??e[0],i=((l=t.name.split(".").pop())==null?void 0:l.toUpperCase())||"",r=new Date(t.addedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),o=this._store.getState().targetFolder,a=e.reduce((d,p)=>d+(p.size||0),0);return s.html`
@@ -2925,8 +3125,7 @@
2925
3125
  .files=${e}
2926
3126
  .showDropTile=${!0}
2927
3127
  .sources=${this._mergedSources}
2928
- .accept=${we(this._storeCtrl.state.restrictions)}
2929
- @files-selected=${this._onFilesSelected}
3128
+ .accept=${ye(this._storeCtrl.state.restrictions)}
2930
3129
  @source-click=${this._onDropTileSourceClick}
2931
3130
  ></sfx-file-list>
2932
3131
  </div>
@@ -3016,7 +3215,7 @@
3016
3215
  </div>
3017
3216
  </div>
3018
3217
  </div>
3019
- `}_renderDocTypeIcon(e){switch(e){case"pdf":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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>`}}_navigatePreview(e,t){var o;const r=e.findIndex(a=>a.id===this._previewFileId)+t;if(r>=0&&r<e.length){const a=(o=this.shadowRoot)==null?void 0:o.querySelector(".preview-image[controls]");a&&(a.pause(),a.removeAttribute("src"),a.load()),this._previewFileId=e[r].id}}_renderBody(){var a,l,d;const e=this._storeCtrl.state,t=[...e.files.values()],i=this._phase,r=we(e.restrictions),o=t.length>0;return s.html`
3218
+ `}_renderDocTypeIcon(e){switch(e){case"pdf":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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 s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" 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>`}}_navigatePreview(e,t){var o;const r=e.findIndex(a=>a.id===this._previewFileId)+t;if(r>=0&&r<e.length){const a=(o=this.shadowRoot)==null?void 0:o.querySelector(".preview-image[controls]");a&&(a.pause(),a.removeAttribute("src"),a.load()),this._previewFileId=e[r].id}}_renderBody(){var a,l,d;const e=this._storeCtrl.state,t=[...e.files.values()],i=this._phase,r=ye(e.restrictions),o=t.length>0;return s.html`
3020
3219
  <div class="content"
3021
3220
  @files-selected=${this._onFilesSelected}
3022
3221
  @source-click=${this._onSourceClick}
@@ -3051,6 +3250,10 @@
3051
3250
  .fileCount=${t.filter(p=>p.status==="complete").length}
3052
3251
  .totalSize=${t.filter(p=>p.status==="complete").reduce((p,h)=>p+(h.size||0),0)}
3053
3252
  .thumbnails=${t.filter(p=>p.status==="complete"&&p.previewUrl).map(p=>p.previewUrl)}
3253
+ .failedFiles=${t.filter(p=>p.status==="failed").map(p=>({id:p.id,name:p.name,error:p.error||"Upload failed"}))}
3254
+ @close-uploader=${this._onSuccessCardClose}
3255
+ @file-retry=${this._onFileRetry}
3256
+ @retry-all=${this._onRetryAll}
3054
3257
  ></sfx-success-card>
3055
3258
  `:i==="uploading"?this._renderUploadOverlay(t):s.html`
3056
3259
  ${o?s.nothing:s.html`<sfx-drop-zone
@@ -3068,7 +3271,6 @@
3068
3271
  .showDropTile=${!0}
3069
3272
  .sources=${this._mergedSources}
3070
3273
  .accept=${r}
3071
- @files-selected=${this._onFilesSelected}
3072
3274
  @source-click=${this._onDropTileSourceClick}
3073
3275
  ></sfx-file-list>
3074
3276
  `:s.nothing}
@@ -3093,7 +3295,7 @@
3093
3295
  ${this._activeConnector&&((d=this.config)!=null&&d.connectors)?s.html`
3094
3296
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
3095
3297
  <div class="connector-modal">
3096
- ${Ce.has(this._activeConnector)?s.html`
3298
+ ${$e.has(this._activeConnector)?s.html`
3097
3299
  <sfx-search-provider-browser
3098
3300
  .provider=${this._activeConnector}
3099
3301
  .companionUrl=${this.config.connectors.companionUrl}
@@ -3152,7 +3354,7 @@
3152
3354
  </div>
3153
3355
  `:s.nothing}
3154
3356
  </div>
3155
- `}_navigateFs(e){const t=[...this._store.getState().files.values()].filter(o=>o.previewUrl||o.type.startsWith("video/")&&o.file),i=t.findIndex(o=>o.id===this._previewFileId);if(i===-1)return;const r=i+e;if(r>=0&&r<t.length){const o=t[r];this._fullscreenPreviewUrl=o.previewUrl,this._fullscreenVideoFile=o.type.startsWith("video/")&&o.file?o.file:null,this._previewFileId=o.id,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0}}_getVideoBlobUrl(e){let t=this._videoBlobUrls.get(e);return t||(t=URL.createObjectURL(e),this._videoBlobUrls.set(e,t)),t}_revokeVideoBlobUrls(){for(const e of this._videoBlobUrls.values())URL.revokeObjectURL(e);this._videoBlobUrls.clear()}},C.styles=s.css`
3357
+ `}_navigateFs(e){const t=[...this._store.getState().files.values()].filter(o=>o.previewUrl||o.type.startsWith("video/")&&o.file),i=t.findIndex(o=>o.id===this._previewFileId);if(i===-1)return;const r=i+e;if(r>=0&&r<t.length){const o=t[r];this._fullscreenPreviewUrl=o.previewUrl,this._fullscreenVideoFile=o.type.startsWith("video/")&&o.file?o.file:null,this._previewFileId=o.id,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0}}_getVideoBlobUrl(e){let t=this._videoBlobUrls.get(e);return t||(t=URL.createObjectURL(e),this._videoBlobUrls.set(e,t)),t}_revokeVideoBlobUrls(){for(const e of this._videoBlobUrls.values())URL.revokeObjectURL(e);this._videoBlobUrls.clear()}},$.styles=s.css`
3156
3358
  :host {
3157
3359
  display: block;
3158
3360
  font-family: var(--sfx-up-font, 'Inter', system-ui, -apple-system, sans-serif);
@@ -3176,9 +3378,6 @@
3176
3378
  --sfx-up-shadow: var(--shadow, rgba(0, 0, 0, 0.1));
3177
3379
  --sfx-up-surface: var(--card, #f8fafc);
3178
3380
  --sfx-up-backdrop: rgba(0, 0, 0, 0.45);
3179
- --sfx-up-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
3180
- --sfx-up-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
3181
- --sfx-up-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
3182
3381
  --sfx-up-ring: var(--ring, oklch(0.578 0.198 268.129 / 0.7));
3183
3382
  --sfx-up-max-height: 88vh;
3184
3383
  }
@@ -3377,7 +3576,7 @@
3377
3576
  align-items: stretch;
3378
3577
  overflow: hidden;
3379
3578
  gap: 0;
3380
- padding: 0 8px 0 8px;
3579
+ padding: 0 0 0 8px;
3381
3580
  animation: bodyReveal 0.35s ease both;
3382
3581
  }
3383
3582
 
@@ -3421,6 +3620,7 @@
3421
3620
  flex-direction: column;
3422
3621
  overflow: hidden;
3423
3622
  height: 100%;
3623
+ min-height: var(--sfx-up-min-height, 660px);
3424
3624
  max-height: var(--sfx-up-max-height, 88vh);
3425
3625
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
3426
3626
  transition: box-shadow 0.25s ease;
@@ -3451,24 +3651,18 @@
3451
3651
  }
3452
3652
 
3453
3653
  .preview-layout .file-grid-side::after {
3454
- content: '';
3455
- position: absolute;
3456
- top: 0;
3457
- bottom: 0;
3458
- right: 14px;
3459
- width: 1px;
3460
- background: var(--sfx-up-border, #e8edf5);
3461
- pointer-events: none;
3462
- z-index: 3;
3654
+ display: none;
3463
3655
  }
3464
3656
 
3465
3657
  .preview-layout sfx-file-list {
3466
- padding-right: 16px;
3658
+ padding-right: 6px;
3467
3659
  --sfx-scrollbar-w: 14px;
3468
- --sfx-scrollbar-inset: 4px;
3469
- --sfx-scrollbar-radius: 7px;
3660
+ --sfx-scrollbar-inset-left: 2px;
3661
+ --sfx-scrollbar-inset-right: 6px;
3470
3662
  }
3471
3663
 
3664
+ /* NOTE: scrollbar border-radius is hardcoded to 6px in sfx-file-list */
3665
+
3472
3666
  .file-grid-header {
3473
3667
  display: flex;
3474
3668
  align-items: center;
@@ -3752,6 +3946,7 @@
3752
3946
  flex: 1;
3753
3947
  gap: 8px;
3754
3948
  padding: 32px 24px;
3949
+ position: relative;
3755
3950
  animation: fadeUp 0.3s ease both;
3756
3951
  }
3757
3952
 
@@ -3856,7 +4051,7 @@
3856
4051
  bottom: 24px;
3857
4052
  right: 24px;
3858
4053
  z-index: 10000;
3859
- width: 320px;
4054
+ width: 470px;
3860
4055
  border-radius: 12px;
3861
4056
  background: var(--sfx-up-bg, #fff);
3862
4057
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
@@ -3898,6 +4093,11 @@
3898
4093
  color: #22c55e;
3899
4094
  }
3900
4095
 
4096
+ .float-icon.error {
4097
+ background: #fef2f2;
4098
+ color: #ef4444;
4099
+ }
4100
+
3901
4101
  .float-title {
3902
4102
  font-size: 13px;
3903
4103
  font-weight: 600;
@@ -3959,9 +4159,9 @@
3959
4159
  color: var(--sfx-up-primary, #2563eb);
3960
4160
  }
3961
4161
 
3962
- .float-progress-pct.done {
3963
- color: #22c55e;
3964
- }
4162
+ .float-progress-pct.done { color: #22c55e; }
4163
+ .float-progress-pct.warn { color: #f59e0b; }
4164
+ .float-progress-pct.error { color: #ef4444; }
3965
4165
 
3966
4166
  .float-bar {
3967
4167
  height: 4px;
@@ -3977,13 +4177,14 @@
3977
4177
  transition: width 0.3s ease;
3978
4178
  }
3979
4179
 
3980
- .float-bar-fill.done {
3981
- background: #22c55e;
3982
- }
4180
+ .float-bar-fill.done { background: #22c55e; }
4181
+ .float-bar-fill.warn { background: #f59e0b; }
4182
+ .float-bar-fill.error { background: #ef4444; }
3983
4183
 
3984
4184
  .float-items {
3985
4185
  max-height: 200px;
3986
4186
  overflow-y: auto;
4187
+ overflow-x: hidden;
3987
4188
  scrollbar-width: thin;
3988
4189
  scrollbar-color: rgba(0,0,0,0.1) transparent;
3989
4190
  }
@@ -3994,6 +4195,7 @@
3994
4195
  gap: 10px;
3995
4196
  padding: 8px 14px;
3996
4197
  border-bottom: 1px solid #f1f5f9;
4198
+ overflow: hidden;
3997
4199
  }
3998
4200
 
3999
4201
  .float-item:last-child { border-bottom: none; }
@@ -4012,7 +4214,7 @@
4012
4214
 
4013
4215
  .float-item-thumb svg { width: 16px; height: 16px; }
4014
4216
 
4015
- .float-item-info { flex: 1; min-width: 0; }
4217
+ .float-item-info { flex: 1; min-width: 0; overflow: hidden; }
4016
4218
 
4017
4219
  .float-item-name {
4018
4220
  font-size: 12px;
@@ -4052,13 +4254,69 @@
4052
4254
  flex-shrink: 0;
4053
4255
  }
4054
4256
 
4055
- .float-item-error {
4056
- color: #ef4444;
4257
+ .float-item-error-wrap {
4258
+ position: relative;
4259
+ display: flex;
4260
+ align-items: center;
4261
+ flex-shrink: 0;
4262
+ }
4263
+
4264
+ .float-item-error-icon {
4057
4265
  width: 16px;
4058
4266
  height: 16px;
4267
+ color: #ef4444;
4268
+ flex-shrink: 0;
4269
+ cursor: pointer;
4270
+ }
4271
+
4272
+ .float-item-tooltip {
4273
+ display: none;
4274
+ position: absolute;
4275
+ right: calc(100% + 8px);
4276
+ top: 50%;
4277
+ transform: translateY(-50%);
4278
+ background: #fff;
4279
+ color: #1e293b;
4280
+ font-size: 11px;
4281
+ padding: 6px 10px;
4282
+ border-radius: 6px;
4283
+ white-space: nowrap;
4284
+ pointer-events: none;
4285
+ z-index: 10;
4286
+ box-shadow: 0 2px 12px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
4287
+ }
4288
+
4289
+ .float-item-error-wrap:hover .float-item-tooltip {
4290
+ display: block;
4291
+ }
4292
+
4293
+ .float-item-status {
4294
+ display: flex;
4295
+ flex-direction: row;
4296
+ align-items: center;
4297
+ gap: 4px;
4298
+ flex-shrink: 0;
4299
+ }
4300
+
4301
+ .float-item-retry {
4302
+ width: 24px;
4303
+ height: 24px;
4304
+ border: none;
4305
+ background: none;
4306
+ color: var(--sfx-up-primary, #2563eb);
4307
+ cursor: pointer;
4308
+ padding: 4px;
4059
4309
  flex-shrink: 0;
4310
+ display: flex;
4311
+ align-items: center;
4312
+ justify-content: center;
4313
+ border-radius: 4px;
4060
4314
  }
4061
4315
 
4316
+ .float-item-retry svg { width: 16px; height: 16px; }
4317
+
4318
+ .float-item-retry:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-primary-hover, #1d4ed8); }
4319
+
4062
4320
  @keyframes floatSlideIn {
4063
4321
  from { opacity: 0; transform: translateY(20px); }
4064
4322
  to { opacity: 1; transform: translateY(0); }
@@ -4250,14 +4508,13 @@
4250
4508
  /* --- Responsive: Tablet (≤ 768px) --- */
4251
4509
  @media (max-width: 768px) {
4252
4510
  .modal-backdrop { padding: 12px; }
4253
- .modal-card { border-radius: 12px; max-height: 92vh; }
4511
+ .modal-card { border-radius: 12px; max-height: 92vh; min-height: auto; }
4254
4512
  .header { padding: 12px 16px; }
4255
4513
  .header-icon { width: 28px; height: 28px; margin-right: 10px; }
4256
4514
  .header-icon svg { width: 14px; height: 14px; }
4257
4515
  .header-title { font-size: 14px; }
4258
4516
  .body { padding: 16px; }
4259
- .body.has-files { padding: 0 8px; padding-bottom: 12px; }
4260
- .asset-count { padding: 16px; }
4517
+ .body.has-files { padding: 0 0 12px 8px; }
4261
4518
 
4262
4519
  .preview-layout { flex-direction: column; }
4263
4520
  .preview-layout .file-grid-side {
@@ -4271,7 +4528,7 @@
4271
4528
 
4272
4529
  .preview-topbar { padding: 8px 0; }
4273
4530
 
4274
- .inline { border-radius: 12px; }
4531
+ .inline { border-radius: 12px; min-height: auto; }
4275
4532
 
4276
4533
  .connector-modal-backdrop { padding: 8px; }
4277
4534
  .connector-modal {
@@ -4295,8 +4552,7 @@
4295
4552
  .header-icon { width: 26px; height: 26px; margin-right: 8px; }
4296
4553
  .header-title { font-size: 14px; }
4297
4554
  .body { padding: 12px; }
4298
- .body.has-files { padding: 0 8px; padding-bottom: 8px; }
4299
- .asset-count { padding: 16px; }
4555
+ .body.has-files { padding: 0 0 8px 8px; }
4300
4556
 
4301
4557
  .preview-layout .file-grid-side { max-height: 100px; }
4302
4558
  .preview-panel { padding: 0 0 12px; }
@@ -4310,8 +4566,13 @@
4310
4566
  .connector-modal {
4311
4567
  border-radius: 0;
4312
4568
  height: 100vh;
4313
- max-height: none;
4314
4569
  min-height: auto;
4315
4570
  }
4316
4571
  }
4317
- `,C._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),C._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),C);w([c.property({attribute:!1})],m.prototype,"config");w([c.state()],m.prototype,"_isOpen");w([c.state()],m.prototype,"_activeConnector");w([c.state()],m.prototype,"_showUrlDialog");w([c.state()],m.prototype,"_showCameraDialog");w([c.state()],m.prototype,"_showScreenCastDialog");w([c.state()],m.prototype,"_previewFileId");w([c.state()],m.prototype,"_previewDims");w([c.state()],m.prototype,"_fullscreenPreviewUrl");w([c.state()],m.prototype,"_fullscreenVideoFile");w([c.state()],m.prototype,"_fullscreenZoomed");w([c.state()],m.prototype,"_bodyDragOver");w([c.state()],m.prototype,"_isMinimized");w([c.state()],m.prototype,"_isPillExpanded");let ft=m;exports.AuthExpiredError=Q;exports.CORE_SOURCES=T;exports.PublicEvents=g;exports.SfxActionsBar=E;exports.SfxCameraDialog=M;exports.SfxDropZone=y;exports.SfxFileItem=Z;exports.SfxFileList=D;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=F;exports.SfxSourcePills=K;exports.SfxSuccessCard=j;exports.SfxUploader=ft;exports.SfxUrlDialog=A;exports.Store=$e;exports.UploadEngine=Ee;exports.buildAuthHeaders=G;exports.createStore=Se;exports.exchangeSassKey=Ue;exports.getApiBase=ee;exports.getAuthUrl=Le;exports.getProviderSources=ze;exports.listFiles=Oe;exports.listNextPage=Be;exports.logout=Ae;exports.resolveAuth=Pe;exports.searchProvider=Re;
4572
+
4573
+ /* --- Responsive: Landscape / short viewports --- */
4574
+ @media (max-height: 700px) {
4575
+ .modal-card { min-height: auto; }
4576
+ .inline { min-height: auto; }
4577
+ }
4578
+ `,$._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),$._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),$);k([c.property({attribute:!1})],_.prototype,"config");k([c.state()],_.prototype,"_isOpen");k([c.state()],_.prototype,"_activeConnector");k([c.state()],_.prototype,"_showUrlDialog");k([c.state()],_.prototype,"_showCameraDialog");k([c.state()],_.prototype,"_showScreenCastDialog");k([c.state()],_.prototype,"_previewFileId");k([c.state()],_.prototype,"_previewDims");k([c.state()],_.prototype,"_fullscreenPreviewUrl");k([c.state()],_.prototype,"_fullscreenVideoFile");k([c.state()],_.prototype,"_fullscreenZoomed");k([c.state()],_.prototype,"_bodyDragOver");k([c.state()],_.prototype,"_isMinimized");k([c.state()],_.prototype,"_isPillExpanded");let ht=_;exports.AuthExpiredError=ee;exports.CORE_SOURCES=A;exports.PublicEvents=g;exports.SfxActionsBar=P;exports.SfxCameraDialog=O;exports.SfxDropZone=C;exports.SfxFileItem=J;exports.SfxFileList=F;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=M;exports.SfxSourcePills=Z;exports.SfxSuccessCard=j;exports.SfxUploader=ht;exports.SfxUrlDialog=I;exports.Store=Se;exports.UploadEngine=Ue;exports.buildAuthHeaders=K;exports.createStore=Ee;exports.exchangeSassKey=Pe;exports.getApiBase=te;exports.getAuthUrl=Le;exports.getProviderSources=De;exports.listFiles=Te;exports.listNextPage=Be;exports.logout=Ie;exports.resolveAuth=ze;exports.searchProvider=Re;