import r from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/regenerator";import{jsx as o}from"react/jsx-runtime";import{useState as i,useEffect as s}from"react";import{getFileExtension as m}from"../../../utils/fileExtension.js";import{TextViewer as a}from"../components/TextViewer.js";import{CsvViewer as f}from"../components/CsvViewer.js";import{PdfViewer as p}from"../components/PdfViewer.js";import{FILE_EXTENSIONS as c}from"../constants.js";import{getCsvData as l,getTextData as u,getXlsxData as x}from"../utils.js";var b,v,j=(t(b={},c.csv,f),t(b,c.json,a),t(b,c.txt,a),t(b,c.pdf,p),t(b,c.xlsx,f),b),h=(t(v={},c.csv,l),t(v,c.json,u),t(v,c.txt,u),t(v,c.xlsx,x),v),d=function(t){var a=t.fileUrl,f=t.fileName,p=m(f),c=i(""),l=e(c,2),u=l[0],x=l[1],b=i(!1),v=e(b,2),d=v[0],w=v[1],y=j[p],k=function(){var e=r(n.mark((function r(e,t){var o,i;return n.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=h[t]){r.next=3;break}return r.abrupt("return");case 3:return r.prev=3,w(!0),r.next=7,o(e);case 7:i=r.sent,x(i),r.next=14;break;case 11:r.prev=11,r.t0=r.catch(3),console.error(r.t0);case 14:return r.prev=14,w(!1),r.finish(14);case 17:case"end":return r.stop()}}),r,null,[[3,11,14,17]])})));return function(r,t){return e.apply(this,arguments)}}();return s((function(){a&&p&&k(a,p)}),[a,p]),s((function(){a||x("")}),[a]),{fileContent:o(y,{fileData:u,fileUrl:a,fileName:f}),isLoading:d}};export{d as useFileContent};
//# sourceMappingURL=useFileContent.js.map
