functionfixopts(opts){vardefaults=[["cellNF",false],["cellHTML",true],["cellFormula",true],["sheetStubs",false],["sheetRows",0,"n"],["bookDeps",false],["bookSheets",false],["bookProps",false],["bookFiles",false],["WTF",false]];defaults.forEach(function(d){if(typeofopts[d[0]]==="undefined")opts[d[0]]=d[1];if(d[2]==="n")opts[d[0]]=Number(opts[d[0]])})}functionparseZip(zip,opts){opts=opts||{};fixopts(opts);reset_cp();varentries=Object.keys(zip.files);varkeys=entries.filter(function(x){returnx.substr(-1)!="/"}).sort();vardir=parseCT(getzipdata(zip,"[Content_Types].xml"));varxlsb=false;varsheets;if(dir.workbooks.length===0){varbinname="xl/workbook.bin";if(!getzipfile(zip,binname))thrownewError("Could not find workbook entry");dir.workbooks.push(binname);xlsb=true}if(!opts.bookSheets&&!opts.bookProps){strs={};if(dir.sst)strs=parse_sst(getzipdata(zip,dir.sst.replace(/^\//,"")),dir.sst,opts);styles={};if(dir.style)styles=parse_sty(getzipdata(zip,dir.style.replace(/^\//,"")),dir.style)}varwb=parse_wb(getzipdata(zip,dir.workbooks[0].replace(/^\//,"")),dir.workbooks[0],opts);varprops={},propdata="";try{propdata=dir.coreprops.length!==0?getzipdata(zip,dir.coreprops[0].replace(/^\//,"")):"";propdata+=dir.extprops.length!==0?getzipdata(zip,dir.extprops[0].replace(/^\//,"")):"";props=propdata!==""?parseProps(propdata):{}}catch(e){}varcustprops={};if(!opts.bookSheets||opts.bookProps){if(dir.custprops.length!==0){propdata=getzipdata(zip,dir.custprops[0].replace(/^\//,""),true);if(propdata)custprops=parseCustomProps(propdata)}}varout={};if(opts.bookSheets||opts.bookProps){if(props.Worksheets&&props.SheetNames.length>0)sheets=props.SheetNames;elseif(wb.Sheets)sheets=wb.Sheets.map(function(x){returnx.name});if(opts.bookProps){out.Props=props;out.Custprops=custprops}if(typeofsheets!=="undefined")out.SheetNames=sheets;if(opts.bookSheets?out.SheetNames:opts.bookProps)returnout}sheets={};vardeps={};if(opts.bookDeps&&dir.calcchain)deps=parseDeps(getzipdata(zip,dir.calcchain.replace(/^\//,"")));vari=0;varsheetRels={};varpath,relsPath;if(!props.Worksheets){varwbsheets=wb.Sheets;props.Worksheets=wbsheets.length;props.SheetNames=[];for(varj=0;j!=wbsheets.length;++j){props.SheetNames[j]=wbsheets[j].name}for(i=0;i!=props.Worksheets;++i){try{path="xl/worksheets/sheet"+(i+1)+(xlsb?".bin":".xml");relsPath=path.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels");sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip,path),path,opts);sheetRels[props.SheetNames[i]]=parseRels(getzipdata(zip,relsPath,true),path)}catch(e){if(opts.WTF)throwe}}}else{for(i=0;i!=props.Worksheets;++i){try{path="xl/worksheets/sheet"+(i+1)+(xlsb?".bin":".xml");relsPath=path.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels");sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip,path),path,opts);sheetRels[props.SheetNames[i]]=parseRels(getzipdata(zip,relsPath,true),path)}catch(e){if(opts.WTF)throwe}}}if(dir.comments)parse_comments(zip,dir.comments,sheets,sheetRels,opts);out={Directory:dir,Workbook:wb,Props:props,Custprops:custprops,Deps:deps,Sheets:sheets,SheetNames:props.SheetNames,Strings:strs,Styles:styles};if(opts.bookFiles){out.keys=keys,out.files=zip.files}returnout}functionreadSync(data,options){varzip,d=data;varo=options||{};switch(o.type||"base64"){case"file":if(typeofBuffer!=="undefined"){zip=newjszip(d=_fs.readFileSync(data));break}d=_fs.readFileSync(data).toString("base64");case"base64":zip=newjszip(d,{base64:true});break;case"binary":zip=newjszip(d,{base64:false});break}returnparseZip(zip,o)}functionreadFileSync(data,options){varo=options||{};o.type="file";returnreadSync(data,o)}XLSX.read=readSync;XLSX.readFile=readFileSync;XLSX.parseZip=parseZip;returnthis})(XLSX);var_chr=function(c){returnString.fromCharCode(c)};functionencode_col(col){vars="";for(++col;col;col=Math.floor((col-1)/26))s=_chr((col-1)%26+65)+s;returns}functionencode_row(row){return""+(row+1)}functionencode_cell(cell){returnencode_col(cell.c)+encode_row(cell.r)}functiondecode_col(c){vard=0,i=0;for(;i!==c.length;++i)d=26*d+c.charCodeAt(i)-64;returnd-1}functiondecod