"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/regenerator"),u=require("react/jsx-runtime"),a=require("react"),i=require("../../../utils/fileExtension.js"),s=require("../components/TextViewer.js"),l=require("../components/CsvViewer.js"),f=require("../components/PdfViewer.js"),o=require("../constants.js"),c=require("../utils.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d,x,p=E(e),N=E(t),S=E(r),I=E(n),v=(d={},S.default(d,o.FILE_EXTENSIONS.csv,l.CsvViewer),S.default(d,o.FILE_EXTENSIONS.json,s.TextViewer),S.default(d,o.FILE_EXTENSIONS.txt,s.TextViewer),S.default(d,o.FILE_EXTENSIONS.pdf,f.PdfViewer),S.default(d,o.FILE_EXTENSIONS.xlsx,l.CsvViewer),d),T=(x={},S.default(x,o.FILE_EXTENSIONS.csv,c.getCsvData),S.default(x,o.FILE_EXTENSIONS.json,c.getTextData),S.default(x,o.FILE_EXTENSIONS.txt,c.getTextData),S.default(x,o.FILE_EXTENSIONS.xlsx,c.getXlsxData),x);exports.useFileContent=function(e){var t=e.fileUrl,r=e.fileName,n=i.getFileExtension(r),s=a.useState(""),l=N.default(s,2),f=l[0],o=l[1],c=a.useState(!1),E=N.default(c,2),d=E[0],x=E[1],S=v[n],b=function(){var e=p.default(I.default.mark((function e(t,r){var n,u;return I.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=T[r]){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,x(!0),e.next=7,n(t);case 7:u=e.sent,o(u),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),console.error(e.t0);case 14:return e.prev=14,x(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,11,14,17]])})));return function(t,r){return e.apply(this,arguments)}}();return a.useEffect((function(){t&&n&&b(t,n)}),[t,n]),a.useEffect((function(){t||o("")}),[t]),{fileContent:u.jsx(S,{fileData:f,fileUrl:t,fileName:r}),isLoading:d}};
//# sourceMappingURL=useFileContent.js.map
