"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,r=require('./../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),i=require("react"),n=require("../../../utils/fileExtension.js"),u=require("../components/TextViewer.js"),a=require("../components/CsvViewer.js"),o=require("../components/PdfViewer.js"),E=require("../constants.js"),c=require("../utils.js"),l=((e={})[E.FILE_EXTENSIONS.csv]=a.CsvViewer,e[E.FILE_EXTENSIONS.json]=u.TextViewer,e[E.FILE_EXTENSIONS.txt]=u.TextViewer,e[E.FILE_EXTENSIONS.pdf]=o.PdfViewer,e[E.FILE_EXTENSIONS.xlsx]=a.CsvViewer,e),f=((t={})[E.FILE_EXTENSIONS.csv]=c.getCsvData,t[E.FILE_EXTENSIONS.json]=c.getTextData,t[E.FILE_EXTENSIONS.txt]=c.getTextData,t[E.FILE_EXTENSIONS.xlsx]=c.getXlsxData,t);exports.useFileContent=function(e){var t=e.fileUrl,u=e.fileName,a=n.getFileExtension(u),o=i.useState(""),E=o[0],c=o[1],N=i.useState(!1),S=N[0],x=N[1],I=l[a];return i.useEffect((function(){t&&a&&function(e,t){r.__awaiter(void 0,void 0,void 0,(function(){var s,i,n;return r.__generator(this,(function(r){switch(r.label){case 0:if(!(s=f[t]))return[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),x(!0),[4,s(e)];case 2:return i=r.sent(),c(i),[3,5];case 3:return n=r.sent(),console.error(n),[3,5];case 4:return x(!1),[7];case 5:return[2]}}))}))}(t,a)}),[t,a]),i.useEffect((function(){t||c("")}),[t]),{fileContent:s.jsx(I,{fileData:E,fileUrl:t,fileName:u}),isLoading:S}};
