/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/picgo-plugin-simpletex@1.0.3/src/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
module.exports=e=>{const t=(e,t,r)=>({method:"POST",url:"https://server.simpletex.cn/api/latex_ocr",headers:{"Content-Type":"multipart/form-data","User-Agent":"PicGo",token:e},formData:{file:{value:r,options:{filename:t}}}}),r=async e=>{const r=require("copy-paste"),o=e.getConfig("picBed.simpletex");if(!o)throw new Error("Can't find uploader config");const a=o.Key,i=e.output;for(const o in i){let n=i[o].buffer;!n&&i[o].base64Image&&(n=Buffer.from(i[o].base64Image,"base64"));const s=t(a,i[o].fileName,n);try{let t=await e.Request.request(s);t=JSON.parse(t),e.log.info(t),t.status&&(delete i[o].base64Image,delete i[o].buffer,i[o].imgUrl="https://z1.ax1x.com/2023/09/21/pPI4I3j.png",r.copy(t.res.latex,(function(){console.log("latex copied to clipboard")})))}catch{throw e.emit("notification",{title:"上传失败",body:"上传失败"}),new Error("上传失败")}}return e},o=e=>{let t=e.getConfig("picBed.simpletex");return t||(t={}),[{name:"Key",type:"input",default:t.Key,required:!0,message:"API key",alias:"API key"}]};return{uploader:"simpletex",register:()=>{e.helper.uploader.register("simpletex",{handle:r,name:"simpletex",config:o})}}};
//# sourceMappingURL=/sm/dd62853b7ddb92504de2894729d5e905481e37749baf9c38612a55a537690e89.map