}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
o=v.toPrecision(10);if(o.length<=w)returno;returnv.toExponential(5)}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);case"undefined":return"";case"object":if(v==null)return""}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/Ma
ENDOFCHAIN:ENDOFCHAIN,FREESECT:-1,HEADER_SIGNATURE:HEADER_SIGNATURE,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:HEADER_CLSID,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};exports.read=readSync;exports.parse=parse;exports.utils={ReadShift:ReadShift,CheckField:CheckField,prep_blob:prep_blob,bconcat:bconcat,consts:consts};returnexports}();if(typeofrequire!=="undefined"&&typeofmodule!=="undefined"&&typeofDO_NOT_EXPORT_CFB==="undefined"){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)retu
if(flags&16)displayName=parse_HyperlinkString(blob,end-blob.l);if(flags&128)targetFrameName=parse_HyperlinkString(blob,end-blob.l);if((flags&257)===257)moniker=parse_HyperlinkString(blob,end-blob.l);if((flags&257)===1)oleMoniker=parse_HyperlinkMoniker(blob,end-blob.l);if(flags&8)location=parse_HyperlinkString(blob,end-blob.l);if(flags&32)guid=blob.read_shift(16);if(flags&64)fileTime=parse_FILETIME(blob,8);blob.l=end;vartarget=targetFrameName||moniker||oleMoniker;if(location)target+="#"+location;return{Target:target}};functionparse_LongRGBA(blob,length){varr=blob.read_shift(1),g=blob.read_shift(1),b=blob.read_shift(1),a=blob.read_shift(1);return[r,g,b,a]}functionparse_LongRGB(blob,length){varx=parse_LongRGBA(blob,length);x[3]=0;returnx}functionparse_XLSCell(blob,length){varrw=blob.read_shift(2);varcol=blob.read_shift(2);varixfe=blob.read_shift(2);return{r:rw,c:col,ixfe:ixfe}}functionparse_frtHeader(blob){varrt=blob.read_shift(2);varflags=blob.read_shift(2);blob.l+=8;return{type:rt,flags:flags}}functionparse_OptXLUnicodeString(blob,length,opts){returnlength===0?"":parse_XLUnicodeString2(blob,length,opts)}varHIDEOBJENUM=["SHOWALL","SHOWPLACEHOLDER","HIDEALL"];varparse_HideObjEnum=parseuint16;functionparse_XTI(blob,length){variSupBook=blob.read_shift(2),itabFirst=blob.read_shift(2,"i"),itabLast=blob.read_shift(2,"i");return[iSupBook,itabFirst,itabLast]}functionparse_RkRec(blob,length){varixfe=blob.read_shift(2);varRK=parse_RkNumber(blob);return[ixfe,RK]}functionparse_AddinUdf(blob,length,opts){blob.l+=4;length-=4;varl=blob.l+length;varudfName=parse_ShortXLUnicodeString(blob,length,opts);varcb=blob.read_shift(2);l-=blob.l;if(cb!==l)thrownewError("Malformed AddinUdf: padding = "+l+" != "+cb);blob.l+=cb;returnudfName}functionparse_Ref8U(blob,length){varrwFirst=blob.read_shift(2);varrwLast=blob.read_shift(2);varcolFirst=blob.read_shift(2);varcolLast=blob.read_shift(2);return{s:{c:colFirst,r:rwFirst},e:{c:colLast,r:rwLast}}}functionparse_RefU(blob,length){varrwFirst=blob.read_shift(2);varrwLast=blob.read_shift(2);varcolFirst=blob.read_shift(1);varcolLast=blob.read_shift(1);return{s:{c:colFirst,r:rwFirst},e:{c:colLast,r:rwLast}}}varparse_Ref=parse_RefU;functionparse_FtCmo(blob,length){blob.l+=4;varot=blob.read_shift(2);varid=blob.read_shift(2);varflags=blob.read_shift(2);blob.l+=12;return[id,ot,flags]}functionparse_FtNts(blob,length){varout={};blob.l+=4;blob.l+=16;out.fSharedNote=blob.read_shift(2);blob.l+=4;returnout}functionparse_FtCf(blob,length){varout={};blob.l+=4;blob.cf=blob.read_shift(2);returnout}varFtTab={21:parse_FtCmo,19:parsenoop,18:function(blob,length){blob.l+=12},17:function(blob,length){blob.l+=8},16:parsenoop,15:parsenoop,13:parse_FtNts,12:function(blob,length){blob.l+=24},11:function(blob,length){blob.l+=10},10:function(blob,length){blob.l+=16},9:parsenoop,8:function(blob,length){blob.l+=6},7:parse_FtCf,6:function(blob,length){blob.l+=6},4:parsenoop,0:function(blob,length){blob.l+=4}};functionparse_FtArray(blob,length,ot){vars=blob.l;varfts=[];while(blob.l<s+length){varft=blob.read_shift(2);blob.l-=2;try{fts.push(FtTab[ft](blob,s+length-blob.l))}catch(e){blob.l=s+length;returnfts}}if(blob.l!=s+length)blob.l=s+length;returnfts}varparse_FontIndex=parseuint16;functionparse_BOF(blob,length){varo={BIFFVer:0,dt:0};o.BIFFVer=blob.read_shift(2);length-=2;if(length>=2){o.dt=blob.read_shift(2);blob.l-=2}switch(o.BIFFVer){case1536:case1280:case2:case7:break;default:if(length>6)thrownewError("Unexpected BIFF Ver "+o.BIFFVer)}blob.read_shift(length);returno}functionparse_InterfaceHdr(blob,length){if(length===0)return1200;varq;if((q=blob.read_shift(2))!==1200){}return1200}functionparse_WriteAccess(blob,length,opts){if(opts.enc){blob.l+=length;return""}varl=blob.l;varUserName=parse_XLUnicodeString(blob,0,opts);blob.read_shift(length+l-blob.l);returnUserName}functionparse_BoundSheet8(blob,length,opts){varpos=blob.read_shift(4);varhidden=blob.read_shift(1)&3;vardt=blob.read_shift(1);switch(dt){case0:dt="Worksheet";break;case1:dt="Macrosheet";break;
}return{to_workbook:sylk_to_workbook,to_sheet:sylk_to_sheet,from_sheet:sheet_to_sylk}}();varDIF=function(){functiondif_to_aoa(d,opts){switch(opts.type){case"base64":returndif_to_aoa_str(Base64.decode(d),opts);case"binary":returndif_to_aoa_str(d,opts);case"buffer":returndif_to_aoa_str(d.toString("binary"),opts);case"array":returndif_to_aoa_str(cc2str(d),opts)}thrownewError("Unrecognized type "+opts.type)}functiondif_to_aoa_str(str,opts){varrecords=str.split("\n"),R=-1,C=-1,ri=0,arr=[];for(;ri!==records.length;++ri){if(records[ri].trim()==="BOT"){arr[++R]=[];C=0;continue}if(R<0)continue;varmetadata=records[ri].trim().split(",");vartype=metadata[0],value=metadata[1];++ri;vardata=records[ri].trim();switch(+type){case-1:if(data==="BOT"){arr[++R]=[];C=0;continue}elseif(data!=="EOD")thrownewError("Unrecognized DIF special command "+data);break;case0:if(data==="TRUE")arr[R][C]=true;elseif(data==="FALSE")arr[R][C]=false;elseif(+value==+value)arr[R][C]=+value;elseif(!isNaN(newDate(value).getDate()))arr[R][C]=parseDate(value);elsearr[R][C]=value;++C;break;case1:data=data.substr(1,data.length-2);arr[R][C++]=data!==""?data:null;break}if(data==="EOD")break}returnarr}functiondif_to_sheet(str,opts){returnaoa_to_sheet(dif_to_aoa(str,opts),opts)}functiondif_to_workbook(str,opts){returnsheet_to_workbook(dif_to_sheet(str,opts),opts)}varsheet_to_dif=function(){varpush_field=functionpf(o,topic,v,n,s){o.push(topic);o.push(v+","+n);o.push('"'+s.replace(/"/g,'""')+'"')};varpush_value=functionpo(o,type,v,s){o.push(type+","+v);o.push(type==1?'"'+s.replace(/"/g,'""')+'"':s)};returnfunctionsheet_to_dif(ws,opts){varo=[];varr=decode_range(ws["!ref"]),cell;vardense=Array.isArray(ws);push_field(o,"TABLE",0,1,"sheetjs");push_field(o,"VECTORS",0,r.e.r-r.s.r+1,"");push_field(o,"TUPLES",0,r.e.c-r.s.c+1,"");push_field(o,"DATA",0,0,"");for(varR=r.s.r;R<=r.e.r;++R){push_value(o,-1,0,"BOT");for(varC=r.s.c;C<=r.e.c;++C){varcoord=encode_cell({r:R,c:C});cell=dense?(ws[R]||[])[C]:ws[coord];if(!cell){push_value(o,1,0,"");continue}switch(cell.t){case"n":varval=DIF_XL?cell.w:cell.v;if(!val&&cell.v!=null)val=cell.v;if(val==null){if(DIF_XL&&cell.f&&!cell.F)push_value(o,1,0,"="+cell.f);elsepush_value(o,1,0,"")}elsepush_value(o,0,val,"V");break;case"b":push_value(o,0,cell.v?1:0,cell.v?"TRUE":"FALSE");break;case"s":push_value(o,1,0,!DIF_XL||isNaN(cell.v)?cell.v:'="'+cell.v+'"');break;case"d":if(!cell.w)cell.w=SSF.format(cell.z||SSF._table[14],datenum(parseDate(cell.v)));if(DIF_XL)push_value(o,0,cell.w,"V");elsepush_value(o,1,0,cell.w);break;default:push_value(o,1,0,"")}}}push_value(o,-1,0,"EOD");varRS="\r\n";varoo=o.join(RS);returnoo}}();return{to_workbook:dif_to_workbook,to_sheet:dif_to_sheet,from_sheet:sheet_to_dif}}();varPRN=function(){functionset_text_arr(data,arr,R,C){if(data==="TRUE")arr[R][C]=true;elseif(data==="FALSE")arr[R][C]=false;elseif(data===""){}elseif(+data==+data)arr[R][C]=+data;elsearr[R][C]=data}functionprn_to_aoa_str(f,opts){vararr=[];if(!f||f.length===0)returnarr;varlines=f.split(/[\r\n]/);varL=lines.length-1;while(L>=0&&lines[L].length===0)--L;varstart=10,idx=0;varR=0;for(;R<=L;++R){idx=lines[R].indexOf(" ");if(idx==-1)idx=lines[R].length;elseidx++;start=Math.max(start,idx)}for(R=0;R<=L;++R){arr[R]=[];varC=0;set_text_arr(lines[R].slice(0,start).trim(),arr,R,C);for(C=1;C<=(lines[R].length-start)/10+1;++C)set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C)}returnarr}functiondsv_to_sheet_str(str,opts){varo=opts||{};varsep="";if(DENSE!=null&&o.dense==null)o.dense=DENSE;varws=o.dense?[]:{};varrange={s:{c:0,r:0},e:{c:0,r:0}};if(str.substr(0,4)=="sep="&&str.charCodeAt(5)==10){sep=str.charAt(4);str=str.substr(6)}if(str.substr(0,1024).indexOf("\t")==-1)sep=",";elsesep="\t";varR=0,C=0,v=0;varstart=0,end=0,sepcc=sep.charCodeAt(0),instr=false,cc=0;str=str.replace(/\r\n/g,"\n");for(;end<str.length;++end)switch(cc=str.charCodeAt(end)){case34:instr=!instr;break;casesepcc:case10:if(instr)break;vars=str.slice(start,end);varcell={};if(s.charCodeAt(0)==61){cell.t="n";cell.f=
break;case"<scheme":if(y.val)font.scheme=y.val;break;case"<scheme/>":case"</scheme>":break;case"<charset":if(y.val=="1")break;y.codepage=CS2CP[parseInt(y.val,10)];break;case"<color":if(!font.color)font.color={};if(y.theme)font.color.theme=y.theme;if(y.tint)font.color.tint=y.tint;if(y.theme&&themes.themeElements&&themes.themeElements.clrScheme){font.color.rgb=rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb,font.color.tint||0)}if(y.rgb)font.color.rgb=y.rgb;break;case"<color/>":case"</color>":break;default:if(opts&&opts.WTF)thrownewError("unrecognized "+y[0]+" in fonts")}})}functionparse_numFmts(t,styles,opts){styles.NumberFmt=[];vark=keys(SSF._table);for(vari=0;i<k.length;++i)styles.NumberFmt[k[i]]=SSF._table[k[i]];varm=t[0].match(tagregex);if(!m)return;for(i=0;i<m.length;++i){vary=parsexmltag(m[i]);switch(y[0]){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{varf=unescapexml(utf8read(y.formatCode)),j=parseInt(y.numFmtId,10);styles.NumberFmt[j]=f;if(j>0)SSF.load(f,j)}break;case"</numFmt>":break;default:if(opts.WTF)thrownewError("unrecognized "+y[0]+" in numFmts")}}}functionwrite_numFmts(NF,opts){varo=["<numFmts>"];[[5,8],[23,26],[41,44],[50,392]].forEach(function(r){for(vari=r[0];i<=r[1];++i)if(NF[i]!=null)o[o.length]=writextag("numFmt",null,{numFmtId:i,formatCode:escapexml(NF[i])})});if(o.length===1)return"";o[o.length]="</numFmts>";o[0]=writextag("numFmts",null,{count:o.length-2}).replace("/>",">");returno.join("")}functionparse_cellXfs(t,styles,opts){styles.CellXf=[];varxf;t[0].match(tagregex).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":xf=y;deletexf[0];if(xf.numFmtId)xf.numFmtId=parseInt(xf.numFmtId,10);if(xf.fillId)xf.fillId=parseInt(xf.fillId,10);styles.CellXf.push(xf);break;case"</xf>":break;case"<alignment":case"<alignment/>":varalignment={};if(y.vertical)alignment.vertical=y.vertical;if(y.horizontal)alignment.horizontal=y.horizontal;if(y.textRotation!=null)alignment.textRotation=y.textRotation;if(y.indent)alignment.indent=y.indent;if(y.wrapText)alignment.wrapText=y.wrapText;xf.alignment=alignment;break;case"</alignment>":break;case"<protection":case"</protection>":case"<protection/>":break;case"<extLst":case"</extLst>":break;case"<ext":break;default:if(opts.WTF)thrownewError("unrecognized "+y[0]+" in cellXfs")}})}functionwrite_cellXfs(cellXfs){varo=[];o[o.length]=writextag("cellXfs",null);cellXfs.forEach(function(c){o[o.length]=writextag("xf",null,c)});o[o.length]="</cellXfs>";if(o.length===2)return"";o[0]=writextag("cellXfs",null,{count:o.length-2}).replace("/>",">");returno.join("")}varparse_sty_xml=functionmake_pstyx(){varnumFmtRegex=/<numFmts([^>]*)>.*<\/numFmts>/;varcellXfRegex=/<cellXfs([^>]*)>.*<\/cellXfs>/;varfillsRegex=/<fills([^>]*)>.*<\/fills>/;varfontsRegex=/<fonts([^>]*)>.*<\/fonts>/;varbordersRegex=/<borders([^>]*)>.*<\/borders>/;returnfunctionparse_sty_xml(data,themes,opts){varstyles={};if(!data)returnstyles;vart;if(t=data.match(numFmtRegex))parse_numFmts(t,styles,opts);if(t=data.match(fontsRegex))parse_fonts(t,styles,themes,opts);if(t=data.match(fillsRegex))parse_fills(t,styles,themes,opts);if(t=data.match(bordersRegex))parse_borders(t,styles,themes,opts);if(t=data.match(cellXfRegex))parse_cellXfs(t,styles,opts);returnstyles}}();varSTYLES_XML_ROOT=writextag("styleSheet",null,{xmlns:XMLNS.main[0],"xmlns:vt":XMLNS.vt});RELS.STY="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";functionwrite_sty_xml(wb,opts){varo=[XML_HEADER,STYLES_XML_ROOT],w;if(wb.SSF&&(w=write_numFmts(wb.SSF))!=null)o[o.length]=w;o[o.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>';o[o.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>';o[o.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>';o[o.length]='<cellStyl
};if(!seencol){seencol=true;find_mdw_colw(val.w/256)}process_col(colinfo[val.e+1])}break;case161:s["!autofilter"]={ref:encode_range(val)};break;case476:s["!margins"]=val;break;case175:case644:case625:case562:case396:case1112:case1146:case471:case1050:case649:case1105:case49:case589:case607:case564:case1055:case168:case174:case1180:case499:case64:case1053:case550:case171:case167:case1177:case169:case1181:case551:case552:case661:case639:case478:case151:case537:case477:case536:case1103:case680:case1104:case1024:case152:case663:case535:case678:case504:case1043:case428:case170:case50:case2070:case485:case1045:case147:break;case35:pass=true;break;case36:pass=false;break;case37:break;case38: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);deleteopts.supbooks;deleteopts["!row"];if(!s["!ref"]&&(refguess.s.r<2e6||ref&&(ref.e.r>0||ref.e.c>0||ref.s.r>0||ref.s.c>0)))s["!ref"]=encode_range(ref||refguess);if(opts.sheetRows&&s["!ref"]){vartmpref=safe_decode_range(s["!ref"]);if(opts.sheetRows<+tmpref.e.r){tmpref.e.r=opts.sheetRows-1;if(tmpref.e.r>refguess.e.r)tmpref.e.r=refguess.e.r;if(tmpref.e.r<tmpref.s.r)tmpref.s.r=tmpref.e.r;if(tmpref.e.c>refguess.e.c)tmpref.e.c=refguess.e.c;if(tmpref.e.c<tmpref.s.c)tmpref.s.c=tmpref.e.c;s["!fullref"]=s["!ref"];s["!ref"]=encode_range(tmpref)}}if(mergecells.length>0)s["!merges"]=mergecells;if(colinfo.length>0)s["!cols"]=colinfo;if(rowinfo.length>0)s["!rows"]=rowinfo;returns}functionwrite_ws_bin_cell(ba,cell,R,C,opts,ws){if(cell.v===undefined)return"";varvv="";varolddate=null;switch(cell.t){case"b":vv=cell.v?"1":"0";break;case"d":cell.z=cell.z||SSF._table[14];olddate=cell.v;cell.v=datenum(cell.v);cell.t="n";break;case"n":case"e":vv=""+cell.v;break;default:vv=cell.v;break}varo={r:R,c:C};if(cell.l)ws["!links"].push([encode_cell(o),cell.l]);if(cell.c)ws["!comments"].push([encode_cell(o),cell.c]);switch(cell.t){case"s":case"str":if(opts.bookSST){vv=get_sst_id(opts.Strings,cell.v);o.t="s";o.v=vv;write_record(ba,"BrtCellIsst",write_BrtCellIsst(cell,o))}else{o.t="str";write_record(ba,"BrtCellSt",write_BrtCellSt(cell,o))}return;case"n":if(cell.v==(cell.v|0)&&cell.v>-1e3&&cell.v<1e3)write_record(ba,"BrtCellRk",write_BrtCellRk(cell,o));elsewrite_record(ba,"BrtCellReal",write_BrtCellReal(cell,o));if(olddate){cell.t="d";cell.v=olddate}return;case"b":o.t="b";write_record(ba,"BrtCellBool",write_BrtCellBool(cell,o));return;case"e":o.t="e";break}write_record(ba,"BrtCellBlank",write_BrtCellBlank(cell,o))}functionwrite_CELLTABLE(ba,ws,idx,opts,wb){varrange=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];write_record(ba,"BrtBeginSheetData");vardense=Array.isArray(ws);for(varR=range.s.r;R<=range.e.r;++R){rr=encode_row(R);write_row_header(ba,ws,range,R);for(varC=range.s.c;C<=range.e.c;++C){if(R===range.s.r)cols[C]=encode_col(C);ref=cols[C]+rr;varcell=dense?(ws[R]||[])[C]:ws[ref];if(!cell)continue;write_ws_bin_cell(ba,cell,R,C,opts,ws)}}write_record(ba,"BrtEndSheetData")}functionwrite_MERGECELLS(ba,ws){if(!ws||!ws["!merges"])return;write_record(ba,"BrtBeginMergeCells",write_BrtBeginMergeCells(ws["!merges"].length));ws["!merges"].forEach(function(m){write_record(ba,"BrtMergeCell",write_BrtMergeCell(m))});write_record(ba,"BrtEndMergeCells")}functionwrite_COLINFOS(ba,ws,idx,opts,wb){if(!ws||!ws["!cols"])return;write_record(ba,"BrtBeginColInfos");ws["!cols"].forEach(function(m,i){if(m)write_record(ba,"BrtColInfo",write_BrtColInfo(i,m))});write_record(ba,"BrtEndColInfos")}functionwrite_HLINKS(ba,ws,rels){ws["!links"].forEach(function(l){if(!l[1].Target)return;varrId=add_rels(rels,-1,l[1].Target.replace(/#.*$/,""),RELS.HLINK);write_record(ba,"BrtHLink",write_BrtHLink(l,rId))});deletews["!links"]}functionwrite_LEGACYDRAWING(ba,ws,idx,rels){if(ws["!comments"].length>0){varrId=add_rels(rels,-1,"../drawings/vmlDrawing"+(idx+1)+".vml",RELS.VML);write_record(ba,"BrtLegacyDrawing",write_RelID("rId"+rId));ws["!legacy"]=rId}}functionwr