import{ah as s}from"./C6MRUCyE.js";const p=async(t,o)=>{if(!t.type.startsWith("image/")||!["png","jpeg","gif","webp"].includes(t.type.split("/")[1]))throw new Error("File is not an accepted image type");if(t.size>1024*1024)throw new Error("File exceeds the 1MiB size limit");const r=new URLSearchParams;o.projectID&&r.set("project_id",o.projectID),r.set("context",o.context),r.set("ext",t.type.split("/")[1]);const i=`image?${r.toString()}`,e=await s(i,{method:"POST",body:t,apiVersion:3});if(!(e!=null&&e.id)||typeof e.id!="string")throw new Error("Unexpected response from server");if(!(e!=null&&e.url)||typeof e.url!="string")throw new Error("Unexpected response from server");return e};export{p as u};