}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
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){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){switch(typeofv){case"string":returnv;case"boolean":returnv?"TRUE":"FALSE";case"number":return(v|0)===v?general_fmt_int(v):general_fmt_num(v);case"undefined":return"";case"object":if(v==null)return""}thrownewError("unsupported value in General format: "+v)}SSF._general=general_fmt;functionfix_hijri(){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;
case"file":returnreadFileSync(blob,options);case"base64":returnparse(s2a(Base64.decode(blob)),options);case"binary":returnparse(s2a(blob),options)}returnparse(blob)}varMSSZ=64;varENDOFCHAIN=-2;varHEADER_SIGNATURE="d0cf11e0a1b11ae1";varHEADER_CLSID="00000000000000000000000000000000";varconsts={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,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}functionfuzzydate(s){varo=newDate(s),n=newDate(NaN);vary=o.getYear(),m=o.getMonth(),d=o.getDate();if(isNaN(d))returnn;if(y<0||y>8099)returnn;if((m>0||d>1)&&y!=101)returno;if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/))returno;if(!s.match(/[a-zA-Z]/))returno;returnn}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)}returnnu
}return{SheetNames:[],Sheets:{}}}return{to_workbook:dbf_to_workbook,to_sheet:dbf_to_sheet}}();varSYLK=function(){functionsylk_to_aoa(d,opts){switch(opts.type){case"base64":returnsylk_to_aoa_str(Base64.decode(d),opts);case"binary":returnsylk_to_aoa_str(d,opts);case"buffer":returnsylk_to_aoa_str(d.toString("binary"),opts);case"array":returnsylk_to_aoa_str(cc2str(d),opts)}thrownewError("Unrecognized type "+opts.type)}functionsylk_to_aoa_str(str,opts){varrecords=str.split(/[\n\r]+/),R=-1,C=-1,ri=0,rj=0,arr=[];varformats=[];varnext_cell_format=null;varsht={},rowinfo=[],colinfo=[],cw=[];varMval=0,j;for(;ri!==records.length;++ri){Mval=0;varrstr=records[ri].trim();varrecord=rstr.replace(/;;/g,"").split(";").map(function(x){returnx.replace(/\u0001/g,";")});varRT=record[0],val;if(rstr.length>0)switch(RT){case"ID":break;case"E":break;case"B":break;case"O":break;case"P":if(record[1].charAt(0)=="P")formats.push(rstr.substr(3).replace(/;;/g,";"));break;case"C":for(rj=1;rj<record.length;++rj)switch(record[rj].charAt(0)){case"X":C=parseInt(record[rj].substr(1))-1;break;case"Y":R=parseInt(record[rj].substr(1))-1;C=0;for(j=arr.length;j<=R;++j)arr[j]=[];break;case"K":val=record[rj].substr(1);if(val.charAt(0)==='"')val=val.substr(1,val.length-2);elseif(val==="TRUE")val=true;elseif(val==="FALSE")val=false;elseif(+val===+val){val=+val;if(next_cell_format!==null&&SSF.is_date(next_cell_format))val=numdate(val)}arr[R][C]=val;next_cell_format=null;break;case"E":formula=rc_to_a1(record[rj].substr(1),{r:R,c:C});arr[R][C]=[arr[R][C],formula];break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr)}break;case"F":varF_seen=0;for(rj=1;rj<record.length;++rj)switch(record[rj].charAt(0)){case"X":C=parseInt(record[rj].substr(1))-1;++F_seen;break;case"Y":R=parseInt(record[rj].substr(1))-1;for(j=arr.length;j<=R;++j)arr[j]=[];++F_seen;break;case"M":Mval=parseInt(record[rj].substr(1))/20;break;case"F":break;case"P":next_cell_format=formats[parseInt(record[rj].substr(1))];break;case"S":break;case"D":break;case"N":break;case"W":cw=record[rj].substr(1).split(" ");for(j=parseInt(cw[0],10);j<=parseInt(cw[1],10);++j){Mval=parseInt(cw[2],10);colinfo[j-1]=Mval==0?{hidden:true}:{wch:Mval};process_col(colinfo[j-1])}break;case"C":C=parseInt(record[rj].substr(1))-1;if(!colinfo[C])colinfo[C]={};break;case"R":R=parseInt(record[rj].substr(1))-1;if(!rowinfo[R])rowinfo[R]={};if(Mval>0){rowinfo[R].hpt=Mval;rowinfo[R].hpx=pt2px(Mval)}elseif(Mval==0)rowinfo[R].hidden=true;break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr)}if(F_seen<2)next_cell_format=null;break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr)}}if(rowinfo.length>0)sht["!rows"]=rowinfo;if(colinfo.length>0)sht["!cols"]=colinfo;arr[arr.length]=sht;returnarr}functionsylk_to_sheet(str,opts){varaoa=sylk_to_aoa(str,opts);varws=aoa.pop();varo=aoa_to_sheet(aoa,opts);keys(ws).forEach(function(k){o[k]=ws[k]});returno}functionsylk_to_workbook(str,opts){returnsheet_to_workbook(sylk_to_sheet(str,opts),opts)}functionwrite_ws_cell_sylk(cell,ws,R,C,opts){varo="C;Y"+(R+1)+";X"+(C+1)+";K";switch(cell.t){case"n":o+=cell.v||0;if(cell.f&&!cell.F)o+=";E"+a1_to_rc(cell.f,{r:R,c:C});break;case"b":o+=cell.v?"TRUE":"FALSE";break;case"e":o+=cell.w||cell.v;break;case"d":o+='"'+(cell.w||cell.v)+'"';break;case"s":o+='"'+cell.v.replace(/"/g,"")+'"';break}returno}functionwrite_ws_cols_sylk(out,cols){cols.forEach(function(col,i){varrec="F;W"+(i+1)+" "+(i+1)+" ";if(col.hidden)rec+="0";else{if(typeofcol.width=="number")col.wpx=width2px(col.width);if(typeofcol.wpx=="number")col.wch=px2char(col.wpx);if(typeofcol.wch=="number")rec+=Math.round(col.wch)}if(rec.charAt(rec.length-1)!=" ")out.push(rec)})}functionwrite_ws_rows_sylk(out,rows){rows.forEach(function(row,i){varrec="F;";if(row.hidden)rec+="M0;";elseif(row.hpt)rec+="M"+20*row.hpt+";";elseif(row.hpx)rec+="M"+20*px2pt(row.hpx)+";";if(rec.length>2)out.push(rec+"R"+(i+1))})}functionsheet_to_sylk(ws,opts){varpreamble=["ID;PWXL;N;E"],o=[];varr=decode_range(ws["!ref"]),cell;vardense=Array.isArray(ws);
}for(vari=0;i!=3;++i)rgb[i]=Math.round(rgb[i]*255);returnrgb}functionrgb_tint(hex,tint){if(tint===0)returnhex;varhsl=rgb2HSL(hex2RGB(hex));if(tint<0)hsl[2]=hsl[2]*(1+tint);elsehsl[2]=1-(1-hsl[2])*(1-tint);returnrgb2Hex(hsl2RGB(hsl))}varDEF_MDW=6,MAX_MDW=15,MIN_MDW=1,MDW=DEF_MDW;functionwidth2px(width){returnMath.floor((width+Math.round(128/MDW)/256)*MDW)}functionpx2char(px){returnMath.floor((px-5)/MDW*100+.5)/100}functionchar2width(chr){returnMath.round((chr*MDW+5)/MDW*256)/256}functionpx2char_(px){return((px-5)/MDW*100+.5)/100}functionchar2width_(chr){return(chr*MDW+5)/MDW*256/256}functioncycle_width(collw){returnchar2width(px2char(width2px(collw)))}functionfind_mdw_colw(collw){vardelta=Infinity,_MDW=MIN_MDW;for(MDW=MIN_MDW;MDW<MAX_MDW;++MDW)if(Math.abs(collw-cycle_width(collw))<=delta){delta=Math.abs(collw-cycle_width(collw));_MDW=MDW}MDW=_MDW}functionfind_mdw_wpx(wpx){vardelta=Infinity,guess=0,_MDW=MIN_MDW;for(MDW=MIN_MDW;MDW<MAX_MDW;++MDW){guess=char2width_(px2char_(wpx))*256;guess=guess%1;if(guess>.5)guess--;if(Math.abs(guess)<delta){delta=Math.abs(guess);_MDW=MDW}}MDW=_MDW}functionprocess_col(coll){if(coll.width){coll.wpx=width2px(coll.width);coll.wch=px2char(coll.wpx);coll.MDW=MDW}elseif(coll.wpx){coll.wch=px2char(coll.wpx);coll.width=char2width(coll.wch);coll.MDW=MDW}elseif(typeofcoll.wch=="number"){coll.width=char2width(coll.wch);coll.wpx=width2px(coll.width);coll.MDW=MDW}if(coll.customWidth)deletecoll.customWidth}varDEF_PPI=96,PPI=DEF_PPI;functionpx2pt(px){returnpx*96/PPI}functionpt2px(pt){returnpt*PPI/96}varXLMLPatternTypeMap={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};functionparse_borders(t,styles,themes,opts){styles.Borders=[];varborder={},sub_border={};t[0].match(tagregex).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":border={};if(y.diagonalUp){border.diagonalUp=y.diagonalUp}if(y.diagonalDown){border.diagonalDown=y.diagonalDown}styles.Borders.push(border);break;case"</border>":break;case"<left":case"<left/>":break;case"</left>":break;case"<right":case"<right/>":break;case"</right>":break;case"<top":case"<top/>":break;case"</top>":break;case"<bottom":case"<bottom/>":break;case"</bottom>":break;case"<diagonal":case"<diagonal/>":break;case"</diagonal>":break;case"<horizontal":case"<horizontal/>":break;case"</horizontal>":break;case"<vertical":case"<vertical/>":break;case"</vertical>":break;case"<start":case"<start/>":break;case"</start>":break;case"<end":case"<end/>":break;case"</end>":break;case"<color":case"<color/>":break;case"</color>":break;default:if(opts&&opts.WTF)thrownewError("unrecognized "+y[0]+" in borders")}})}functionparse_fills(t,styles,themes,opts){styles.Fills=[];varfill={};t[0].match(tagregex).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<fills":case"<fills>":case"</fills>":break;case"<fill>":break;case"</fill>":styles.Fills.push(fill);fill={};break;case"<gradientFill>":break;case"</gradientFill>":styles.Fills.push(fill);fill={};break;case"<patternFill":case"<patternFill>":if(y.patternType)fill.patternType=y.patternType;break;case"<patternFill/>":case"</patternFill>":break;case"<bgColor":if(!fill.bgColor)fill.bgColor={};if(y.indexed)fill.bgColor.indexed=parseInt(y.indexed,10);if(y.theme)fill.bgColor.theme=parseInt(y.theme,10);if(y.tint)fill.bgColor.tint=parseFloat(y.tint);if(y.rgb)fill.bgColor.rgb=y.rgb.slice(-6);break;case"<bgColor/>":case"</bgColor>":break;case"<fgColor":if(!fill.fgColor)fill.fgColor={};if(y.theme)fill.fgColor.theme=parseInt(y.theme,10);if(y.tint)fill.fgColor.tint=parseFloat(y.tint);if(y.rgb)fill.fgColor.rgb=y.rgb.slice(-6);break;case"<fgColor/>":case"</fgColor>":break;case"<stop":case"<stop/>":break;case"</stop>":brea
varout=[];varpass=false;recordhopper(data,functionhopper_cc(val,R_n,RT){switch(RT){case63:out.push(val);break;default:if((R_n||"").indexOf("Begin")>0){}elseif((R_n||"").indexOf("End")>0){}elseif(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R_n)}});returnout}functionwrite_cc_bin(data,opts){}RELS.IMG="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";RELS.DRAW="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";functionparse_drawing(data,rels){if(!data)return"??";varid=(data.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];returnrels["!id"][id].Target}var_shapeid=1024;functionwrite_comments_vml(rId,comments){varcsize=[21600,21600];varbbox=["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");varo=[writextag("xml",null,{"xmlns:v":XLMLNS.v,"xmlns:o":XLMLNS.o,"xmlns:x":XLMLNS.x,"xmlns:mv":XLMLNS.mv}).replace(/\/>/,">"),writextag("o:shapelayout",writextag("o:idmap",null,{"v:ext":"edit",data:rId}),{"v:ext":"edit"}),writextag("v:shapetype",[writextag("v:stroke",null,{joinstyle:"miter"}),writextag("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:csize.join(","),path:bbox})];while(_shapeid<rId*1e3)_shapeid+=1e3;comments.map(function(x){returndecode_cell(x[0])}).forEach(function(c,i){o=o.concat(["<v:shape"+wxt_helper({id:"_x0000_s"+++_shapeid,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10;visibility:hidden",fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",writextag("v:fill",writextag("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}),{color2:"#BEFF82",angle:"-180",type:"gradient"}),writextag("v:shadow",null,{on:"t",obscured:"t"}),writextag("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",writetag("x:Anchor",[c.c,0,c.r,0,c.c+3,100,c.r+5,100].join(",")),writetag("x:AutoFill","False"),writetag("x:Row",String(c.r)),writetag("x:Column",String(c.c)),"<x:Visible/>","</x:ClientData>","</v:shape>"])});o.push("</xml>");returno.join("")}RELS.CMNT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";functionparse_comments(zip,dirComments,sheets,sheetRels,opts){for(vari=0;i!=dirComments.length;++i){varcanonicalpath=dirComments[i];varcomments=parse_cmnt(getzipdata(zip,canonicalpath.replace(/^\//,""),true),canonicalpath,opts);if(!comments||!comments.length)continue;varsheetNames=keys(sheets);for(varj=0;j!=sheetNames.length;++j){varsheetName=sheetNames[j];varrels=sheetRels[sheetName];if(rels){varrel=rels[canonicalpath];if(rel)insertCommentsIntoSheet(sheetName,sheets[sheetName],comments)}}}}functioninsertCommentsIntoSheet(sheetName,sheet,comments){vardense=Array.isArray(sheet);varcell,r;comments.forEach(function(comment){if(dense){r=decode_cell(comment.ref);if(!sheet[r.r])sheet[r.r]=[];cell=sheet[r.r][r.c]}elsecell=sheet[comment.ref];if(!cell){cell={};if(dense)sheet[r.r][r.c]=cell;elsesheet[comment.ref]=cell;varrange=safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1");varthisCell=decode_cell(comment.ref);if(range.s.r>thisCell.r)range.s.r=thisCell.r;if(range.e.r<thisCell.r)range.e.r=thisCell.r;if(range.s.c>thisCell.c)range.s.c=thisCell.c;if(range.e.c<thisCell.c)range.e.c=thisCell.c;varencoded=encode_range(range);if(encoded!==sheet["!ref"])sheet["!ref"]=encoded}if(!cell.c)cell.c=[];varo={a:comment.author,t:comment.t,r:comment.r};if(comment.h)o.h=comment.h;cell.c.push(o)})}functionparse_comments_xml(data,opts){if(data.match(/<(?:\w+:)?comments *\/>/))return[];varauthors=[];varcommentList=[];varauthtag=data.match(/<(?:\w+:)?authors>([^\u2603]*)<\/(?:\w+:)?authors>/);if(authtag&&authtag[1])authtag[1].split(/<\/\w*:?author>/).forEach(function(x){if(x===""||x.trim()==="")return;vara=x.match(/<(?:\w+:)?author[^>]*>(.*)/);if(a)authors.push(a[1])});varcmnttag=data.match(/<(?:\w+:)?commentList>([^\u2603]*)<\/(?:\w+:)?commentList>/);if(cmnttag&&cmnttag[1])cmntt
return;case"b":case"e":write_biff_rec(ba,5,write_BIFF2BERR(R,C,cell.v,cell.t));return;case"s":case"str":write_biff_rec(ba,4,write_BIFF2LABEL(R,C,cell.v));return}write_biff_rec(ba,1,write_BIFF2Cell(null,R,C))}functionwrite_biff_ws(ba,ws,idx,opts,wb){vardense=Array.isArray(ws);varrange=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];for(varR=range.s.r;R<=range.e.r;++R){rr=encode_row(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_biff_cell(ba,cell,R,C,opts)}}}functionwrite_biff_buf(wb,opts){varo=opts||{};if(DENSE!=null&&o.dense==null)o.dense=DENSE;varba=buf_array();varidx=0;for(vari=0;i<wb.SheetNames.length;++i)if(wb.SheetNames[i]==o.sheet)idx=i;if(idx==0&&!!o.sheet&&wb.SheetNames[0]!=o.sheet)thrownewError("Sheet not found: "+o.sheet);write_biff_rec(ba,9,write_BOF(wb,o));write_biff_ws(ba,wb.Sheets[wb.SheetNames[idx]],idx,o,wb);write_biff_rec(ba,10);returnba.end()}varHTML_=function(){functionhtml_to_sheet(str,_opts){varopts=_opts||{};if(DENSE!=null&&opts.dense==null)opts.dense=DENSE;varws=opts.dense?[]:{};vari=str.indexOf("<table"),j=str.indexOf("</table");if(i==-1||j==-1)thrownewError("Invalid HTML: missing <table> / </table> pair");varrows=str.slice(i,j).split(/(:?<tr[^>]*>)/);varR=-1,C=0,RS=0,CS=0;varrange={s:{r:1e7,c:1e7},e:{r:0,c:0}};varmerges=[],midx=0;for(i=0;i<rows.length;++i){varrow=rows[i].trim();if(row.substr(0,3)=="<tr"){++R;C=0;continue}if(row.substr(0,3)!="<td")continue;varcells=row.split("</td>");for(j=0;j<cells.length;++j){varcell=cells[j].trim();if(cell.substr(0,3)!="<td")continue;varm=cell,cc=0;while(m.charAt(0)=="<"&&(cc=m.indexOf(">"))>-1)m=m.slice(cc+1);while(m.indexOf(">")>-1)m=m.slice(0,m.lastIndexOf("<"));vartag=parsexmltag(cell.slice(0,cell.indexOf(">")));CS=tag.colspan?+tag.colspan:1;if((RS=+tag.rowspan)>0||CS>1)merges.push({s:{r:R,c:C},e:{r:R+(RS||1)-1,c:C+CS-1}});if(!m.length){C+=CS;continue}m=unescapexml(m).replace(/[\r\n]/g,"");if(range.s.r>R)range.s.r=R;if(range.e.r<R)range.e.r=R;if(range.s.c>C)range.s.c=C;if(range.e.c<C)range.e.c=C;if(opts.dense){if(!ws[R])ws[R]=[];if(Number(m)==Number(m))ws[R][C]={t:"n",v:+m};elsews[R][C]={t:"s",v:m}}else{varcoord=encode_cell({r:R,c:C});if(Number(m)==Number(m))ws[coord]={t:"n",v:+m};elsews[coord]={t:"s",v:m}}C+=CS}}ws["!ref"]=encode_range(range);returnws}functionhtml_to_book(str,opts){returnsheet_to_workbook(html_to_sheet(str,opts),opts)}functionmake_html_row(ws,r,R,o){varM=ws["!merges"]||[];varoo=[];for(varC=r.s.c;C<=r.e.c;++C){varRS=0,CS=0;for(varj=0;j<M.length;++j){if(M[j].s.r>R||M[j].s.c>C)continue;if(M[j].e.r<R||M[j].e.c<C)continue;if(M[j].s.r<R||M[j].s.c<C){RS=-1;break}RS=M[j].e.r-M[j].s.r+1;CS=M[j].e.c-M[j].s.c+1;break}if(RS<0)continue;varcoord=encode_cell({r:R,c:C});varcell=o.dense?(ws[R]||[])[C]:ws[coord];if(!cell||cell.v==null){oo.push("<td></td>");continue}varw=cell.h||escapexml(cell.w||(format_cell(cell),cell.w)||"");varsp={};if(RS>1)sp.rowspan=RS;if(CS>1)sp.colspan=CS;oo.push(writextag("td",w,sp))}return"<tr>"+oo.join("")+"</tr>"}functionsheet_to_html(ws,opts){varo=[];varr=decode_range(ws["!ref"]);o.dense=Array.isArray(ws);for(varR=r.s.r;R<=r.e.r;++R)o.push(make_html_row(ws,r,R,o));return"<html><body><table>"+o.join("")+"</table></body></html>"}return{to_workbook:html_to_book,to_sheet:html_to_sheet,_row:make_html_row,from_sheet:sheet_to_html}}();functionparse_dom_table(table,_opts){varopts=_opts||{};if(DENSE!=null)opts.dense=DENSE;varws=opts.dense?[]:{};varrows=table.getElementsByTagName("tr");varrange={s:{r:0,c:0},e:{r:rows.length-1,c:0}};varmerges=[],midx=0;varR=0,_C=0,C=0,RS=0,CS=0;for(;R<rows.length;++R){varrow=rows[R];varelts=row.children;for(_C=C=0;_C<elts.length;++_C){varelt=elts[_C],v=elts[_C].innerText;for(midx=0;midx<merges.length;++midx){varm=merges[midx];if(m.s.c==C&&m.s.r<=R&&R<=m.e.r){C=m.e.c+1;midx=-1}}CS=+elt.getAttribute("colspan")||1;if((RS=+elt.getAttribute("rowspan"))>0||CS>1)merges.push({s:{r:R,c:C},e:{r:R+(RS||1)-1,c:C+CS-1}});varo={t:"s",v:v};if(v!=null
if(wb.vbaraw&&vbafmt){f="xl/vbaProject.bin";zip.file(f,wb.vbaraw);ct.vba.push(f);add_rels(opts.wbrels,-1,"vbaProject.bin",RELS.VBA)}zip.file("[Content_Types].xml",write_ct(ct,opts));zip.file("_rels/.rels",write_rels(opts.rels));zip.file("xl/_rels/workbook."+wbext+".rels",write_rels(opts.wbrels));deleteopts.revssf;deleteopts.ssf;returnzip}functionfirstbyte(f,o){varx="";switch((o||{}).type||"base64"){case"buffer":return[f[0],f[1],f[2],f[3]];case"base64":x=Base64.decode(f.substr(0,24));break;case"binary":x=f;break;case"array":return[f[0],f[1],f[2],f[3]];default:thrownewError("Unrecognized type "+(o?o.type:"undefined"))}return[x.charCodeAt(0),x.charCodeAt(1),x.charCodeAt(2),x.charCodeAt(3)]}functionread_cfb(cfb,opts){if(cfb.find("EncryptedPackage"))returnparse_xlsxcfb(cfb,opts);returnparse_xlscfb(cfb,opts)}functionread_zip(data,opts){varzip,d=data;varo=opts||{};if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";switch(o.type){case"base64":zip=newjszip(d,{base64:true});break;case"binary":case"array":zip=newjszip(d,{base64:false});break;case"buffer":zip=newjszip(d);break;default:thrownewError("Unrecognized type "+o.type)}returnparse_zip(zip,o)}functionread_utf16(data,o){vard=data;if(o.type=="base64")d=Base64.decode(d);d=cptable.utils.decode(1200,d.slice(2));o.type="binary";if(d.charCodeAt(0)==60)returnparse_xlml(d,o);returnPRN.to_workbook(d,o)}functionreadSync(data,opts){varzip,d=data,n=[0];varo=opts||{};_ssfopts={};if(o.dateNF)_ssfopts.dateNF=o.dateNF;if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";if(o.type=="file"){o.type="buffer";d=_fs.readFileSync(data)}switch((n=firstbyte(d,o))[0]){case208:returnread_cfb(CFB.read(d,o),o);case9:returnparse_xlscfb(s2a(o.type==="base64"?Base64.decode(d):d),o);case60:returnparse_xlml(d,o);case73:if(n[1]==68)returnread_wb_ID(d,o);break;case84:if(n[1]==65&&n[2]==66&&n[3]==76)returnDIF.to_workbook(d,o);break;case80:if(n[1]==75&&n[2]<32&&n[3]<32)returnread_zip(d,o);break;case239:returnn[3]==60?parse_xlml(d,o):PRN.to_workbook(d,o);case255:if(n[1]==254){returnread_utf16(d,o)}break;case0:if(n[1]==0&&n[2]>=2&&n[3]==0)returnWK_.to_workbook(d,o);break;case3:case131:case139:returnDBF.to_workbook(d,o)}if(n[2]<=12&&n[3]<=31)returnDBF.to_workbook(d,o);if(32>n[0]||n[0]>127)thrownewError("Unsupported file "+n.join("|"));returnPRN.to_workbook(d,o)}functionreadFileSync(filename,opts){varo=opts||{};o.type="file";returnreadSync(filename,o)}functionwrite_zip_type(wb,opts){varo=opts||{};varz=write_zip(wb,o);varoopts={};if(o.compression)oopts.compression="DEFLATE";switch(o.type){case"base64":oopts.type="base64";break;case"binary":oopts.type="string";break;case"buffer":case"file":oopts.type="nodebuffer";break;default:thrownewError("Unrecognized type "+o.type)}if(o.type==="file")return_fs.writeFileSync(o.file,z.generate(oopts));returnz.generate(oopts)}functionwrite_bstr_type(out,opts){switch(opts.type){case"base64":returnBase64.encode(out);case"binary":returnout;case"file":return_fs.writeFileSync(opts.file,out,"binary");case"buffer":{if(has_buf)returnnewBuffer(out,"utf8");elsereturnout.split("").map(function(c){returnc.charCodeAt(0)})}}thrownewError("Unrecognized type "+opts.type)}functionwrite_string_type(out,opts){switch(opts.type){case"base64":returnBase64.encode(out);case"binary":returnout;case"file":return_fs.writeFileSync(opts.file,out,"utf8");case"buffer":{if(has_buf)returnnewBuffer(out,"utf8");elsereturnout.split("").map(function(c){returnc.charCodeAt(0)})}}thrownewError("Unrecognized type "+opts.type)}functionwrite_binary_type(out,opts){switch(opts.type){case"base64":case"binary":varbstr="";for(vari=0;i<out.length;++i)bstr+=String.fromCharCode(out[i]);returnopts.type=="base64"?Base64.encode(bstr):bstr;case"file":return_fs.writeFileSync(opts.file,out);case"buffer":returnout;default:thrownewError("Unrecognized type "+opts.type)}}functionwriteSync(wb,opts){check_wb(wb);varo=opts||{};switch(o.bookType||"xlsb"){case"xml":case"xlml":returnwrite_string_type(write_xlml(wb,o),o);case"sl