}returnres};exports.findCompression=function(compressionMethod){for(varmethodincompressions){if(!compressions.hasOwnProperty(method)){continue}if(compressions[method].magic===compressionMethod){returncompressions[method]}}returnnull};exports.isRegExp=function(object){returnObject.prototype.toString.call(object)==="[object RegExp]"}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){"use strict";varStringReader=_dereq_("./stringReader");varNodeBufferReader=_dereq_("./nodeBufferReader");varUint8ArrayReader=_dereq_("./uint8ArrayReader");varutils=_dereq_("./utils");varsig=_dereq_("./signature");varZipEntry=_dereq_("./zipEntry");varsupport=_dereq_("./support");varjszipProto=_dereq_("./object");functionZipEntries(data,loadOptions){this.files=[];this.loadOptions=loadOptions;if(data){this.load(data)}}ZipEntries.prototype={checkSignature:function(expectedSignature){varsignature=this.reader.readString(4);if(signature!==expectedSignature){thrownewError("Corrupted zip or bug : unexpected signature "+"("+utils.pretty(signature)+", expected "+utils.pretty(expectedSignature)+")")}},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2);this.diskWithCentralDirStart=this.reader.readInt(2);this.centralDirRecordsOnThisDisk=this.reader.readInt(2);this.centralDirRecords=this.reader.readInt(2);this.centralDirSize=this.reader.readInt(4);this.centralDirOffset=this.reader.readInt(4);this.zipCommentLength=this.reader.readInt(2);this.zipComment=this.reader.readString(this.zipCommentLength);this.zipComment=jszipProto.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8);this.versionMadeBy=this.reader.readString(2);this.versionNeeded=this.reader.readInt(2);this.diskNumber=this.reader.readInt(4);this.diskWithCentralDirStart=this.reader.readInt(4);this.centralDirRecordsOnThisDisk=this.reader.readInt(8);this.centralDirRecords=this.reader.readInt(8);this.centralDirSize=this.reader.readInt(8);this.centralDirOffset=this.reader.readInt(8);this.zip64ExtensibleData={};varextraDataSize=this.zip64EndOfCentralSize-44,index=0,extraFieldId,extraFieldLength,extraFieldValue;while(index<extraDataSize){extraFieldId=this.reader.readInt(2);extraFieldLength=this.reader.readInt(4);extraFieldValue=this.reader.readString(extraFieldLength);this.zip64ExtensibleData[extraFieldId]={id:extraFieldId,length:extraFieldLength,value:extraFieldValue}}},readBlockZip64EndOfCentralLocator:function(){this.diskWithZip64CentralDirStart=this.reader.readInt(4);this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8);this.disksCount=this.reader.readInt(4);if(this.disksCount>1){thrownewError("Multi-volumes zip are not supported")}},readLocalFiles:function(){vari,file;for(i=0;i<this.files.length;i++){file=this.files[i];this.reader.setIndex(file.localHeaderOffset);this.checkSignature(sig.LOCAL_FILE_HEADER);file.readLocalPart(this.reader);file.handleUTF8()}},readCentralDir:function(){varfile;this.reader.setIndex(this.centralDirOffset);while(this.reader.readString(4)===sig.CENTRAL_FILE_HEADER){file=newZipEntry({zip64:this.zip64},this.loadOptions);file.readCentralPart(this.reader);this.files.push(file)}},readEndOfCentral:function(){varoffset=this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);if(offset===-1){thrownewError("Corrupted zip : can't find end of central directory")}this.reader.setIndex(offset);this.checkSignature(sig.CENTRAL_DIRECTORY_END);this.readBlockEndOfCentral();if(this.diskNumber===utils.MAX_VALUE_16BITS||this.diskWithCentralDirStart===utils.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===utils.MAX_VALUE_16BITS||this.centralDirRecords===utils.MAX_VALUE_16BITS||this.centralDirSize===utils.MAX_VALUE_32BITS||this.centralDirOffset===utils.MAX_VALUE_32BITS){this.zip64=true;offset=this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);if(offset===-1){thrownewError("Corrupted zip : can't find the ZIP64 end of central directory locator")}this.reader.setIndex(offset);this.checkSignature(sig.ZIP64_CENTRAL_D
functiongfn3(v){varo=v.toFixed(11).replace(gnr1,".$1");if(o.length>(v<0?12:11))o=v.toPrecision(6);returno}functiongfn4(o){for(vari=0;i!=o.length;++i)if((o.charCodeAt(i)|32)===101)returno.replace(gnr4,".$1").replace(gnr5,"E").replace("e","E").replace(gnr6,"$10$2");returno}functiongfn5(o){returno.indexOf(".")>-1?o.replace(gnr2,"").replace(gnr1,".$1"):o}returnfunctiongeneral_fmt_num(v,opts){varV=Math.floor(Math.log(Math.abs(v))*Math.LOG10E),o;if(V>=-4&&V<=-1)o=v.toPrecision(10+V);elseif(Math.abs(V)<=9)o=gfn2(v);elseif(V===10)o=v.toFixed(10).substr(0,12);elseo=gfn3(v);returngfn5(gfn4(o))}}();SSF._general_num=general_fmt_num;functiongeneral_fmt(v,opts){switch(typeofv){case"string":returnv;case"boolean":returnv?"TRUE":"FALSE";case"number":return(v|0)===v?general_fmt_int(v,opts):general_fmt_num(v,opts)}thrownewError("unsupported value in General format: "+v)}SSF._general=general_fmt;functionfix_hijri(date,o){return0}functionparse_date_code(v,opts,b2){if(v>2958465||v<0)returnnull;vardate=v|0,time=Math.floor(86400*(v-date)),dow=0;vardout=[];varout={D:date,T:time,u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(out.u)<1e-6)out.u=0;fixopts(opts!=null?opts:opts=[]);if(opts.date1904)date+=1462;if(out.u>.999){out.u=0;if(++time==86400){time=0;++date}}if(date===60){dout=b2?[1317,10,29]:[1900,2,29];dow=3}elseif(date===0){dout=b2?[1317,8,29]:[1900,1,0];dow=6}else{if(date>60)--date;vard=newDate(1900,0,1);d.setDate(d.getDate()+date-1);dout=[d.getFullYear(),d.getMonth()+1,d.getDate()];dow=d.getDay();if(date<60)dow=(dow+6)%7;if(b2)dow=fix_hijri(d,dout)}out.y=dout[0];out.m=dout[1];out.d=dout[2];out.S=time%60;time=Math.floor(time/60);out.M=time%60;time=Math.floor(time/60);out.H=time;out.q=dow;returnout}SSF.parse_date_code=parse_date_code;functionwrite_date(type,fmt,val,ss0){varo="",ss=0,tt=0,y=val.y,out,outl=0;switch(type){case98:y=val.y+543;case121:switch(fmt.length){case1:case2:out=y%100;outl=2;break;default:out=y%1e4;outl=4;break}break;case109:switch(fmt.length){case1:case2:out=val.m;outl=fmt.length;break;case3:returnmonths[val.m-1][1];case5:returnmonths[val.m-1][0];default:returnmonths[val.m-1][2]}break;case100:switch(fmt.length){case1:case2:out=val.d;outl=fmt.length;break;case3:returndays[val.q][0];default:returndays[val.q][1]}break;case104:switch(fmt.length){case1:case2:out=1+(val.H+11)%12;outl=fmt.length;break;default:throw"bad hour format: "+fmt}break;case72:switch(fmt.length){case1:case2:out=val.H;outl=fmt.length;break;default:throw"bad hour format: "+fmt}break;case77:switch(fmt.length){case1:case2:out=val.M;outl=fmt.length;break;default:throw"bad minute format: "+fmt}break;case115:if(val.u===0)switch(fmt){case"s":case"ss":returnpad0(val.S,fmt.length);case".0":case".00":case".000":}switch(fmt){case"s":case"ss":case".0":case".00":case".000":if(ss0>=2)tt=ss0===3?1e3:100;elsett=ss0===1?10:1;ss=Math.round(tt*(val.S+val.u));if(ss>=60*tt)ss=0;if(fmt==="s")returnss===0?"0":""+ss/tt;o=pad0(ss,2+ss0);if(fmt==="ss")returno.substr(0,2);return"."+o.substr(2,fmt.length-1);default:throw"bad second format: "+fmt}case90:switch(fmt){case"[h]":case"[hh]":out=val.D*24+val.H;break;case"[m]":case"[mm]":out=(val.D*24+val.H)*60+val.M;break;case"[s]":case"[ss]":out=((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u);break;default:throw"bad abstime format: "+fmt}outl=fmt.length===3?1:2;break;case101:out=y;outl=1}if(outl>0)returnpad0(out,outl);elsereturn""}functioncommaify(s){if(s.length<=3)returns;varj=s.length%3,o=s.substr(0,j);for(;j!=s.length;j+=3)o+=(o.length>0?",":"")+s.substr(j,3);returno}varwrite_num=functionmake_write_num(){varpct1=/%/g;functionwrite_num_pct(type,fmt,val){varsfmt=fmt.replace(pct1,""),mul=fmt.length-sfmt.length;returnwrite_num(type,sfmt,val*Math.pow(10,2*mul))+fill("%",mul)}functionwrite_num_cm(type,fmt,val){varidx=fmt.length-1;while(fmt.charCodeAt(idx-1)===44)--idx;returnwrite_num(type,fmt.substr(0,idx),val/Math.pow(10,3*(fmt.length-idx)))}functionwrite_num_exp(fmt,val){varo;varidx=fmt.indexOf("E")-fmt.indexOf(".")-1;if(fmt.match(/^
module.exports=CFB}functionisval(x){returnx!==undefined&&x!==null}functionkeys(o){returnObject.keys(o)}functionevert_key(obj,key){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]][key]]=K[i];returno}functionevert(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]]]=K[i];returno}functionevert_num(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]]]=parseInt(K[i],10);returno}functionevert_arr(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i){if(o[obj[K[i]]]==null)o[obj[K[i]]]=[];o[obj[K[i]]].push(K[i])}returno}functiondatenum(v,date1904){varepoch=v.getTime();if(date1904)epoch+=1462*24*60*60*1e3;return(epoch+22091616e5)/(24*60*60*1e3)}functionnumdate(v){vardate=SSF.parse_date_code(v);varval=newDate;if(date==null)thrownewError("Bad Date Code: "+v);val.setUTCDate(date.d);val.setUTCMonth(date.m-1);val.setUTCFullYear(date.y);val.setUTCHours(date.H);val.setUTCMinutes(date.M);val.setUTCSeconds(date.S);returnval}functionparse_isodur(s){varsec=0,mt=0,time=false;varm=s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!m)thrownewError("|"+s+"| is not an ISO8601 Duration");for(vari=1;i!=m.length;++i){if(!m[i])continue;mt=1;if(i>3)time=true;switch(m[i].substr(m[i].length-1)){case"Y":thrownewError("Unsupported ISO Duration Field: "+m[i].substr(m[i].length-1));case"D":mt*=24;case"H":mt*=60;case"M":if(!time)thrownewError("Unsupported ISO Duration Field: M");elsemt*=60;case"S":break}sec+=mt*parseInt(m[i],10)}returnsec}vargood_pd_date=newDate("2017-02-19T19:06:09.000Z");vargood_pd=good_pd_date.getFullYear()==2017;functionparseDate(str){if(good_pd)returnnewDate(str);if(strinstanceofDate)returnstr;varn=str.match(/\d+/g)||["2017","2","19","0","0","0"];returnnewDate(Date.UTC(+n[0],+n[1]-1,+n[2],+n[3],+n[4],+n[5]))}functioncc2str(arr){varo="";for(vari=0;i!=arr.length;++i)o+=String.fromCharCode(arr[i]);returno}functionstr2cc(str){varo=[];for(vari=0;i!=str.length;++i)o.push(str.charCodeAt(i));returno}functiondup(o){if(typeofJSON!="undefined"&&!Array.isArray(o))returnJSON.parse(JSON.stringify(o));if(typeofo!="object"||o==null)returno;varout={};for(varkino)if(o.hasOwnProperty(k))out[k]=dup(o[k]);returnout}functionfill(c,l){varo="";while(o.length<l)o+=c;returno}functiongetdatastr(data){if(!data)returnnull;if(data.data)returndebom(data.data);if(data.asNodeBuffer&&has_buf)returndebom(data.asNodeBuffer().toString("binary"));if(data.asBinary)returndebom(data.asBinary());if(data._data&&data._data.getContent)returndebom(cc2str(Array.prototype.slice.call(data._data.getContent(),0)));returnnull}functiongetdatabin(data){if(!data)returnnull;if(data.data)returnchar_codes(data.data);if(data.asNodeBuffer&&has_buf)returndata.asNodeBuffer();if(data._data&&data._data.getContent){varo=data._data.getContent();if(typeofo=="string")returnstr2cc(o);returnArray.prototype.slice.call(o)}returnnull}functiongetdata(data){returndata&&data.name.slice(-4)===".bin"?getdatabin(data):getdatastr(data)}functionsafegetzipfile(zip,file){vark=keys(zip.files);varf=file.toLowerCase(),g=f.replace(/\//g,"\\");for(vari=0;i<k.length;++i){varn=k[i].toLowerCase();if(f==n||g==n)returnzip.files[k[i]]}returnnull}functiongetzipfile(zip,file){varo=safegetzipfile(zip,file);if(o==null)thrownewError("Cannot find file "+file+" in zip");returno}functiongetzipdata(zip,file,safe){if(!safe)returngetdata(getzipfile(zip,file));if(!file)returnnull;try{returngetzipdata(zip,file)}catch(e){returnnull}}functiongetzipstr(zip,file,safe){if(!safe)returngetdatastr(getzipfile(zip,file));if(!file)returnnull;try{returngetzipstr(zip,file)}catch(e){returnnull}}var_fs,jszip;if(typeofJSZip!=="undefined")jszip=JSZip;if(typeofexports!=="undefined"){if(typeofmodule!=="undefined"&&module.exports){if(typeofjszip==="undefined")jszip=require("./jszip.js");_fs=require("fs")}}functionresolve_path(path,base){varresult=base.split("/");if(base.slice(-1)!="/")result.pop();vartarget=path.split("/");while(target.length!==0){varstep=target.sh
break;case16:break;default:if((R_n||"").indexOf("Begin")>0){}elseif((R_n||"").indexOf("End")>0){}elseif(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R_n)}},opts);parse_wb_defaults(wb);Names["!names"]=NameList;wb.Names=Names;returnwb}functionwrite_BUNDLESHS(ba,wb,opts){write_record(ba,"BrtBeginBundleShs");for(varidx=0;idx!=wb.SheetNames.length;++idx){varviz=wb.Workbook&&wb.Workbook.Sheets&&wb.Workbook.Sheets[idx]&&wb.Workbook.Sheets[idx].Hidden||0;vard={Hidden:viz,iTabID:idx+1,strRelID:"rId"+(idx+1),name:wb.SheetNames[idx]};write_record(ba,"BrtBundleSh",write_BrtBundleSh(d))}write_record(ba,"BrtEndBundleShs")}functionwrite_BrtFileVersion(data,o){if(!o)o=new_buf(127);for(vari=0;i!=4;++i)o.write_shift(4,0);write_XLWideString("SheetJS",o);write_XLWideString(XLSX.version,o);write_XLWideString(XLSX.version,o);write_XLWideString("7262",o);o.length=o.l;returno.length>o.l?o.slice(0,o.l):o}functionwrite_BrtBookView(idx,o){if(!o)o=new_buf(29);o.write_shift(-4,0);o.write_shift(-4,460);o.write_shift(4,28800);o.write_shift(4,17600);o.write_shift(4,500);o.write_shift(4,idx);o.write_shift(4,idx);varflags=120;o.write_shift(1,flags);returno.length>o.l?o.slice(0,o.l):o}functionwrite_BOOKVIEWS(ba,wb,opts){if(!wb.Workbook||!wb.Workbook.Sheets)return;varsheets=wb.Workbook.Sheets;vari=0,vistab=-1,hidden=-1;for(;i<sheets.length;++i){if(!sheets[i]||!sheets[i].Hidden&&vistab==-1)vistab=i;elseif(sheets[i].Hidden==1&&hidden==-1)hidden=i}if(hidden>vistab)return;write_record(ba,"BrtBeginBookViews");write_record(ba,"BrtBookView",write_BrtBookView(vistab));write_record(ba,"BrtEndBookViews")}functionwrite_BrtCalcProp(data,o){if(!o)o=new_buf(26);o.write_shift(4,0);o.write_shift(4,1);o.write_shift(4,0);write_Xnum(0,o);o.write_shift(-4,1023);o.write_shift(1,51);o.write_shift(1,0);returno}functionwrite_BrtFileRecover(data,o){if(!o)o=new_buf(1);o.write_shift(1,0);returno}functionwrite_wb_bin(wb,opts){varba=buf_array();write_record(ba,"BrtBeginBook");write_record(ba,"BrtFileVersion",write_BrtFileVersion());write_record(ba,"BrtWbProp",write_BrtWbProp());write_BOOKVIEWS(ba,wb,opts);write_BUNDLESHS(ba,wb,opts);write_record(ba,"BrtEndBook");returnba.end()}functionparse_wb(data,name,opts){if(name.slice(-4)===".bin")returnparse_wb_bin(data,opts);returnparse_wb_xml(data,opts)}functionparse_ws(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")returnparse_ws_bin(data,opts,rels,wb,themes,styles);returnparse_ws_xml(data,opts,rels,wb,themes,styles)}functionparse_cs(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")returnparse_cs_bin(data,opts,rels,wb,themes,styles);returnparse_cs_xml(data,opts,rels,wb,themes,styles)}functionparse_ms(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")returnparse_ms_bin(data,opts,rels,wb,themes,styles);returnparse_ms_xml(data,opts,rels,wb,themes,styles)}functionparse_ds(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")returnparse_ds_bin(data,opts,rels,wb,themes,styles);returnparse_ds_xml(data,opts,rels,wb,themes,styles)}functionparse_sty(data,name,themes,opts){if(name.slice(-4)===".bin")returnparse_sty_bin(data,themes,opts);returnparse_sty_xml(data,themes,opts)}functionparse_theme(data,name,opts){returnparse_theme_xml(data,opts)}functionparse_sst(data,name,opts){if(name.slice(-4)===".bin")returnparse_sst_bin(data,opts);returnparse_sst_xml(data,opts)}functionparse_cmnt(data,name,opts){if(name.slice(-4)===".bin")returnparse_comments_bin(data,opts);returnparse_comments_xml(data,opts)}functionparse_cc(data,name,opts){if(name.slice(-4)===".bin")returnparse_cc_bin(data,opts);returnparse_cc_xml(data,opts)}functionwrite_wb(wb,name,opts){return(name.slice(-4)===".bin"?write_wb_bin:write_wb_xml)(wb,opts)}functionwrite_ws(data,name,opts,wb,rels){return(name.slice(-4)===".bin"?write_ws_bin:write_ws_xml)(data,opts,wb,rels)}functionwrite_cs(data,name,opts,wb,rels){return(name.slice(-4)===".bin"?write_cs_bin:write_cs_xml)(data,opts,wb,rels)}functionwrite_sty(data,name,opts){return(name.slice(-4)===".bin"?write_sty_bin:writ
if(R.n==="EOF")val=R.f(blob,length,opts);elseval=slurp(R,blob,length,opts);varRn=R.n;switch(Rn){case"Date1904":wb.opts.Date1904=val;break;case"WriteProtect":wb.opts.WriteProtect=true;break;case"FilePass":if(!opts.enc)blob.l=0;opts.enc=val;if(opts.WTF)console.error(val);if(!options.password)thrownewError("File is password-protected");if(val.Type!==0)thrownewError("Encryption scheme unsupported");if(!val.valid)thrownewError("Password is incorrect");break;case"WriteAccess":opts.lastuser=val;break;case"FileSharing":break;case"CodePage":if(val===21010)val=1200;elseif(val===32769)val=1252;opts.codepage=val;set_cp(val);break;case"RRTabId":opts.rrtabid=val;break;case"WinProtect":opts.winlocked=val;break;case"Template":break;case"RefreshAll":wb.opts.RefreshAll=val;break;case"BookBool":break;case"UsesELFs":break;case"MTRSettings":break;case"CalcCount":wb.opts.CalcCount=val;break;case"CalcDelta":wb.opts.CalcDelta=val;break;case"CalcIter":wb.opts.CalcIter=val;break;case"CalcMode":wb.opts.CalcMode=val;break;case"CalcPrecision":wb.opts.CalcPrecision=val;break;case"CalcSaveRecalc":wb.opts.CalcSaveRecalc=val;break;case"CalcRefMode":opts.CalcRefMode=val;break;case"Uncalced":break;case"ForceFullCalculation":wb.opts.FullCalc=val;break;case"WsBool":break;case"XF":XFs.push(val);break;case"ExtSST":break;case"BookExt":break;case"RichTextStream":break;case"BkHim":break;case"SupBook":supbooks[++sbc]=[val];sbci=0;break;case"ExternName":supbooks[sbc][++sbci]=val;break;case"Index":break;case"Lbl":supbooks[0][++sbcli]=val;break;case"ExternSheet":supbooks[sbc]=supbooks[sbc].concat(val);sbci+=val.length;break;case"Protect":out["!protect"]=val;break;case"Password":if(val!==0&&opts.WTF)console.error("Password verifier: "+val);break;case"Prot4Rev":case"Prot4RevPass":break;case"BoundSheet8":{Directory[val.pos]=val;opts.snames.push(val.name)}break;case"EOF":{if(--file_depth)break;if(range.e){if(range.e.r>0&&range.e.c>0){range.e.r--;range.e.c--;out["!ref"]=encode_range(range);range.e.r++;range.e.c++}if(mergecells.length>0)out["!merges"]=mergecells;if(objects.length>0)out["!objects"]=objects;if(colinfo.length>0)out["!cols"]=colinfo;if(rowinfo.length>0)out["!rows"]=rowinfo;Workbook.Sheets.push(wsprops)}if(cur_sheet==="")Preamble=out;elseSheets[cur_sheet]=out;out=options.dense?[]:{}}break;case"BOF":{if(opts.biff!==8){}elseif(RecordType===9)opts.biff=2;elseif(RecordType===521)opts.biff=3;elseif(RecordType===1033)opts.biff=4;elseif(val.BIFFVer===1280)opts.biff=5;elseif(val.BIFFVer===1536)opts.biff=8;elseif(val.BIFFVer===2)opts.biff=2;elseif(val.BIFFVer===7)opts.biff=2;if(file_depth++)break;cell_valid=true;out=options.dense?[]:{};if(opts.biff<5){if(cur_sheet==="")cur_sheet="Sheet1";range={s:{r:0,c:0},e:{r:0,c:0}};varfakebs8={pos:blob.l-length,name:cur_sheet};Directory[fakebs8.pos]=fakebs8;opts.snames.push(cur_sheet)}elsecur_sheet=(Directory[s]||{name:""}).name;if(val.dt==32)out["!type"]="chart";mergecells=[];objects=[];array_formulae=[];opts.arrayf=array_formulae;colinfo=[];rowinfo=[];defwidth=defheight=0;seencol=false;wsprops={Hidden:(Directory[s]||{hs:0}).hs,name:cur_sheet}}break;case"Number":case"BIFF2NUM":case"BIFF2INT":{if(out["!type"]=="chart")if(options.dense?(out[val.r]||[])[val.c]:out[encode_cell({c:val.c,r:val.r})])++val.c;temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:"n"};safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"BoolErr":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:val.t};safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"RK":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.rknum,t:"n"};safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulRk":{for(varj=val.c;j<=val.C;++j){varixfe=val.rkrec[j-val.c][0];temp_val={ixfe:ixfe,XF:XFs[ixfe],v:val.rkrec[j-val.c][1],t:"n"};safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:j,r:val.r},temp_val,options)}}break;case"Formula":{if(val.val=="String"){last_formula=val;break}temp_val={v:val.val,ixfe:val
}functionfix_row(cstr){returncstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}functionunfix_row(cstr){returncstr.replace(/\$(\d+)$/,"$1")}functiondecode_col(colstr){varc=unfix_col(colstr),d=0,i=0;for(;i!==c.length;++i)d=26*d+c.charCodeAt(i)-64;returnd-1}functionencode_col(col){vars="";for(++col;col;col=Math.floor((col-1)/26))s=String.fromCharCode((col-1)%26+65)+s;returns}functionfix_col(cstr){returncstr.replace(/^([A-Z])/,"$$$1")}functionunfix_col(cstr){returncstr.replace(/^\$([A-Z])/,"$1")}functionsplit_cell(cstr){returncstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}functiondecode_cell(cstr){varsplt=split_cell(cstr);return{c:decode_col(splt[0]),r:decode_row(splt[1])}}functionencode_cell(cell){returnencode_col(cell.c)+encode_row(cell.r)}functionfix_cell(cstr){returnfix_col(fix_row(cstr))}functionunfix_cell(cstr){returnunfix_col(unfix_row(cstr))}functiondecode_range(range){varx=range.split(":").map(decode_cell);return{s:x[0],e:x[x.length-1]}}functionencode_range(cs,ce){if(typeofce==="undefined"||typeofce==="number"){returnencode_range(cs.s,cs.e)}if(typeofcs!=="string")cs=encode_cell(cs);if(typeofce!=="string")ce=encode_cell(ce);returncs==ce?cs:cs+":"+ce}functionsafe_decode_range(range){varo={s:{c:0,r:0},e:{c:0,r:0}};varidx=0,i=0,cc=0;varlen=range.length;for(idx=0;i<len;++i){if((cc=range.charCodeAt(i)-64)<1||cc>26)break;idx=26*idx+cc}o.s.c=--idx;for(idx=0;i<len;++i){if((cc=range.charCodeAt(i)-48)<0||cc>9)break;idx=10*idx+cc}o.s.r=--idx;if(i===len||range.charCodeAt(++i)===58){o.e.c=o.s.c;o.e.r=o.s.r;returno}for(idx=0;i!=len;++i){if((cc=range.charCodeAt(i)-64)<1||cc>26)break;idx=26*idx+cc}o.e.c=--idx;for(idx=0;i!=len;++i){if((cc=range.charCodeAt(i)-48)<0||cc>9)break;idx=10*idx+cc}o.e.r=--idx;returno}functionsafe_format_cell(cell,v){varq=cell.t=="d"&&vinstanceofDate;if(cell.z!=null)try{returncell.w=SSF.format(cell.z,q?datenum(v):v)}catch(e){}try{returncell.w=SSF.format((cell.XF||{}).ifmt||(q?14:0),q?datenum(v):v)}catch(e){return""+v}}functionformat_cell(cell,v,o){if(cell==null||cell.t==null||cell.t=="z")return"";if(cell.w!==undefined)returncell.w;if(cell.t=="d"&&!cell.z&&o&&o.dateNF)cell.z=o.dateNF;if(v==undefined)returnsafe_format_cell(cell,cell.v,o);returnsafe_format_cell(cell,v,o)}functionsheet_to_json(sheet,opts){if(sheet==null||sheet["!ref"]==null)return[];varval={t:"n",v:0},header=0,offset=1,hdr=[],isempty=true,v=0,vv="";varr={s:{r:0,c:0},e:{r:0,c:0}};varo=opts!=null?opts:{};varraw=o.raw;vardefval=o.defval;varrange=o.range!=null?o.range:sheet["!ref"];if(o.header===1)header=1;elseif(o.header==="A")header=2;elseif(Array.isArray(o.header))header=3;switch(typeofrange){case"string":r=safe_decode_range(range);break;case"number":r=safe_decode_range(sheet["!ref"]);r.s.r=range;break;default:r=range}if(header>0)offset=0;varrr=encode_row(r.s.r);varcols=newArray(r.e.c-r.s.c+1);varout=newArray(r.e.r-r.s.r-offset+1);varouti=0,counter=0;vardense=Array.isArray(sheet);varR=r.s.r,C=0,CC=0;if(!sheet[R])sheet[R]=[];for(C=r.s.c;C<=r.e.c;++C){cols[C]=encode_col(C);val=dense?sheet[R][C]:sheet[cols[C]+rr];switch(header){case1:hdr[C]=C;break;case2:hdr[C]=cols[C];break;case3:hdr[C]=o.header[C-r.s.c];break;default:if(val==null)continue;vv=v=format_cell(val,null,o);counter=0;for(CC=0;CC<hdr.length;++CC)if(hdr[CC]==vv)vv=v+"_"+++counter;hdr[C]=vv}}varrow=header===1?[]:{};for(R=r.s.r+offset;R<=r.e.r;++R){rr=encode_row(R);isempty=true;if(header===1)row=[];else{row={};if(Object.defineProperty)try{Object.defineProperty(row,"__rowNum__",{value:R,enumerable:false})}catch(e){row.__rowNum__=R}elserow.__rowNum__=R}if(!dense||sheet[R])for(C=r.s.c;C<=r.e.c;++C){val=dense?sheet[R][C]:sheet[cols[C]+rr];if(val===undefined||val.t===undefined){if(defval===undefined)continue;if(hdr[C]!=null){row[hdr[C]]=defval;isempty=false}continue}v=val.v;switch(val.t){case"z":if(v==null)break;continue;case"e":continue;case"s":case"d":case"b":case"n":break;default:thrownewError("unrecognized type "+val.t)}if(hdr[C]!=null){if(v==null){if(defval!==undefined)row[hdr[C]]=defval;elseif(raw&&v===null)row[hdr[C