var l=Object.defineProperty;var c=(n,e,i)=>e in n?l(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var t=(n,e,i)=>c(n,typeof e!="symbol"?e+"":e,i);import{e as r}from"./extension-from-filename-O0XMuZye.js";import{bR as d}from"./main-D6SjkSWq.js";function p(n){const e={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",yaml:"text/yaml",yml:"text/yaml",log:"text/plain"},i=n.name?r(n.name):null;return n.type?n.type:i&&i in e?e[i]:"application/octet-stream"}class F{constructor(e,i){t(this,"id");t(this,"fingerprint");t(this,"name");t(this,"relativePath","");t(this,"size");t(this,"mime","");t(this,"extension","");t(this,"native");t(this,"lastModified");t(this,"cachedData");this.id=d(),this.name=e.name,this.size=e.size,this.mime=p(e),this.lastModified=e.lastModified,this.extension=r(e.name)||"bin",this.native=e,i=i||e.webkitRelativePath||"",i=i.replace(/^\/+/g,""),i&&i.split("/").length>1&&(this.relativePath=i),this.fingerprint=h({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise(e=>{this.cachedData&&e(this.cachedData);const i=new FileReader;i.addEventListener("load",()=>{this.cachedData=i.result,e(this.cachedData)}),this.extension==="json"?i.readAsText(this.native):i.readAsDataURL(this.native)})}}class v{constructor(e){t(this,"id");t(this,"fingerprint");t(this,"name");t(this,"relativePath","");t(this,"size");t(this,"mime","");t(this,"extension","");t(this,"native",null);t(this,"lastModified");this.id=d(),this.name=e.name,this.size=e.file_size??0,this.mime=e.mime,this.lastModified=e.updated_at||"",this.extension=e.extension||"bin",this.relativePath=e.path,this.fingerprint=h({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise((e,i)=>{i("UploadedFileFromEntry does not have file data")})}}function h({name:n,mime:e,size:i,relativePath:s,lastModified:o}){let a="be";return typeof n=="string"&&(a+=`-${m(n.toLowerCase())}`),e&&(a+=`-${e}`),typeof s=="string"&&(a+=`-${m(s.toLowerCase())}`),i!==void 0&&(a+=`-${i}`),o!==void 0&&(a+=`-${o}`),a}function f(n){return n.charCodeAt(0).toString(32)}function m(n){let e="";return n.replace(/[^A-Z0-9]/gi,i=>(e+=`-${f(i)}`,"/"))+e}export{F as U,v as a};
