1 line
542 B
JavaScript
1 line
542 B
JavaScript
import{r as e}from"./client-Cs6K6NLD.js";function t(e){let t=e?.file_type;if(t===`pdf`||t===`image`||t===`audio`)return t;let n=(e?.image||``).toLowerCase();return/\.pdf($|\?)/.test(n)?`pdf`:/\.(mp3|wav|ogg|m4a|aac|flac|opus)($|\?)/.test(n)?`audio`:/\.(png|jpe?g|gif|webp|bmp|svg)($|\?)/.test(n)?`image`:``}function n(t){if(!t)return``;let n=t.toLowerCase();return n.startsWith(`http://`)||n.startsWith(`https://`)?t:t.startsWith(`/`)?e()+t:`${e()}/api/files/${t}`}function r(e){return e?e.split(`/`).pop()||e:``}export{t as n,n as r,r as t}; |