sheetjs/dist/xlsx.min.js

16 lines
421 KiB
JavaScript
Raw Normal View History

/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
var XLSX={};(function make_xlsx(XLSX){XLSX.version="0.10.0";var current_codepage=1200;if(typeof module!=="undefined"&&typeof require!=="undefined"){if(typeof cptable==="undefined")cptable=require("./dist/cpexcel.js")}function reset_cp(){set_cp(1200)}var set_cp=function(cp){current_codepage=cp};function char_codes(data){var o=[];for(var i=0,len=data.length;i<len;++i)o[i]=data.charCodeAt(i);return o}var debom=function(data){var c1=data.charCodeAt(0),c2=data.charCodeAt(1);if(c1==255&&c2==254)return data.substr(2);if(c1==254&&c2==255)return data.substr(2);if(c1==65279)return data.substr(1);return data};var _getchar=function _gc1(x){return String.fromCharCode(x)};if(typeof cptable!=="undefined"){set_cp=function(cp){current_codepage=cp};debom=function(data){if(data.charCodeAt(0)===255&&data.charCodeAt(1)===254){return cptable.utils.decode(1200,char_codes(data.substr(2)))}return data};_getchar=function _gc2(x){if(current_codepage===1200)return String.fromCharCode(x);return cptable.utils.decode(current_codepage,[x&255,x>>8])[0]}}var DENSE=null;var DIF_XL=true;var Base64=function make_b64(){var map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(input){var o="";var c1,c2,c3,e1,e2,e3,e4;for(var i=0;i<input.length;){c1=input.charCodeAt(i++);c2=input.charCodeAt(i++);c3=input.charCodeAt(i++);e1=c1>>2;e2=(c1&3)<<4|c2>>4;e3=(c2&15)<<2|c3>>6;e4=c3&63;if(isNaN(c2)){e3=e4=64}else if(isNaN(c3)){e4=64}o+=map.charAt(e1)+map.charAt(e2)+map.charAt(e3)+map.charAt(e4)}return o},decode:function b64_decode(input){var o="";var c1,c2,c3;var e1,e2,e3,e4;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var i=0;i<input.length;){e1=map.indexOf(input.charAt(i++));e2=map.indexOf(input.charAt(i++));e3=map.indexOf(input.charAt(i++));e4=map.indexOf(input.charAt(i++));c1=e1<<2|e2>>4;c2=(e2&15)<<4|e3>>2;c3=(e3&3)<<6|e4;o+=String.fromCharCode(c1);if(e3!=64){o+=String.fromCharCode(c2)}if(e4!=64){o+=String.fromCharCode(c3)}}return o}}}();var has_buf=typeof Buffer!=="undefined"&&typeof process!=="undefined"&&typeof process.versions!=="undefined"&&process.versions.node;function new_raw_buf(len){return new(has_buf?Buffer:Array)(len)}function s2a(s){if(has_buf)return new Buffer(s,"binary");return s.split("").map(function(x){return x.charCodeAt(0)&255})}var bconcat=function(bufs){return[].concat.apply([],bufs)};var chr0=/\u0000/g,chr1=/[\u0001-\u0006]/;var SSF={};var make_ssf=function make_ssf(SSF){SSF.version="0.9.2";function _strrev(x){var o="",i=x.length-1;while(i>=0)o+=x.charAt(i--);return o}function fill(c,l){var o="";while(o.length<l)o+=c;return o}function pad0(v,d){var t=""+v;return t.length>=d?t:fill("0",d-t.length)+t}function pad_(v,d){var t=""+v;return t.length>=d?t:fill(" ",d-t.length)+t}function rpad_(v,d){var t=""+v;return t.length>=d?t:t+fill(" ",d-t.length)}function pad0r1(v,d){var t=""+Math.round(v);return t.length>=d?t:fill("0",d-t.length)+t}function pad0r2(v,d){var t=""+v;return t.length>=d?t:fill("0",d-t.length)+t}var p2_32=Math.pow(2,32);function pad0r(v,d){if(v>p2_32||v<-p2_32)return pad0r1(v,d);var i=Math.round(v);return pad0r2(i,d)}function isgeneral(s,i){i=i||0;return s.length>=7+i&&(s.charCodeAt(i)|32)===103&&(s.charCodeAt(i+1)|32)===101&&(s.charCodeAt(i+2)|32)===110&&(s.charCodeAt(i+3)|32)===101&&(s.charCodeAt(i+4)|32)===114&&(s.charCodeAt(i+5)|32)===97&&(s.charCodeAt(i+6)|32)===108}var opts_fmt=[["date1904",0],["output",""],["WTF",false]];function fixopts(o){for(var y=0;y!=opts_fmt.length;++y)if(o[opts_fmt[y][0]]===undefined)o[opts_fmt[y][0]]=opts_fmt[y][1]}SSF.opts=opts_fmt;var days=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]];var months=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function init_table(t){t[0]="General";t[1]="0";t[2]="0.00";t[3]="#,##0";t[4]="#,##0.00";t[9]="0%";t[10]="0.00%";t[11]="0.00E+00
return[blob.read_shift(2,"u"),mver]}function check_shifts(blob,mver){var shift=9;blob.l+=2;switch(shift=blob.read_shift(2)){case 9:if(mver!=3)throw new Error("Sector Shift: Expected 9 saw "+shift);break;case 12:if(mver!=4)throw new Error("Sector Shift: Expected 12 saw "+shift);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+shift)}blob.chk("0600","Mini Sector Shift: ");blob.chk("000000000000","Reserved: ")}function sectorify(file,ssz){var nsectors=Math.ceil(file.length/ssz)-1;var sectors=new Array(nsectors);for(var i=1;i<nsectors;++i)sectors[i-1]=file.slice(i*ssz,(i+1)*ssz);sectors[nsectors-1]=file.slice(nsectors*ssz);return sectors}function build_full_paths(FI,FPD,FP,Paths){var i=0,L=0,R=0,C=0,j=0,pl=Paths.length;var dad=new Array(pl),q=new Array(pl);for(;i<pl;++i){dad[i]=q[i]=i;FP[i]=Paths[i]}for(;j<q.length;++j){i=q[j];L=FI[i].L;R=FI[i].R;C=FI[i].C;if(dad[i]===i){if(L!==-1&&dad[L]!==L)dad[i]=dad[L];if(R!==-1&&dad[R]!==R)dad[i]=dad[R]}if(C!==-1)dad[C]=i;if(L!==-1){dad[L]=dad[i];q.push(L)}if(R!==-1){dad[R]=dad[i];q.push(R)}}for(i=1;i!==pl;++i)if(dad[i]===i){if(R!==-1&&dad[R]!==R)dad[i]=dad[R];else if(L!==-1&&dad[L]!==L)dad[i]=dad[L]}for(i=1;i<pl;++i){if(FI[i].type===0)continue;j=dad[i];if(j===0)FP[i]=FP[0]+"/"+FP[i];else while(j!==0){FP[i]=FP[j]+"/"+FP[i];j=dad[j]}dad[i]=0}FP[0]+="/";for(i=1;i<pl;++i){if(FI[i].type!==2)FP[i]+="/";FPD[FP[i]]=FI[i]}}function make_find_path(FullPaths,Paths,FileIndex,files,root_name){var UCFullPaths=new Array(FullPaths.length);var UCPaths=new Array(Paths.length),i;for(i=0;i<FullPaths.length;++i)UCFullPaths[i]=FullPaths[i].toUpperCase().replace(chr0,"").replace(chr1,"!");for(i=0;i<Paths.length;++i)UCPaths[i]=Paths[i].toUpperCase().replace(chr0,"").replace(chr1,"!");return function find_path(path){var k;if(path.charCodeAt(0)===47){k=true;path=root_name+path}else k=path.indexOf("/")!==-1;var UCPath=path.toUpperCase().replace(chr0,"").replace(chr1,"!");var w=k===true?UCFullPaths.indexOf(UCPath):UCPaths.indexOf(UCPath);if(w===-1)return null;return k===true?FileIndex[w]:files[Paths[w]]}}function sleuth_fat(idx,cnt,sectors,ssz,fat_addrs){var q;if(idx===ENDOFCHAIN){if(cnt!==0)throw new Error("DIFAT chain shorter than expected")}else if(idx!==-1){var sector=sectors[idx],m=(ssz>>>2)-1;if(!sector)return;for(var i=0;i<m;++i){if((q=__readInt32LE(sector,i*4))===ENDOFCHAIN)break;fat_addrs.push(q)}sleuth_fat(__readInt32LE(sector,ssz-4),cnt-1,sectors,ssz,fat_addrs)}}function get_sector_list(sectors,start,fat_addrs,ssz,chkd){var sl=sectors.length;var buf,buf_chain;if(!chkd)chkd=new Array(sl);var modulus=ssz-1,j,jj;buf=[];buf_chain=[];for(j=start;j>=0;){chkd[j]=true;buf[buf.length]=j;buf_chain.push(sectors[j]);var addr=fat_addrs[Math.floor(j*4/ssz)];jj=j*4&modulus;if(ssz<4+jj)throw new Error("FAT boundary crossed: "+j+" 4 "+ssz);if(!sectors[addr])break;j=__readInt32LE(sectors[addr],jj)}return{nodes:buf,data:__toBuffer([buf_chain])}}function make_sector_list(sectors,dir_start,fat_addrs,ssz){var sl=sectors.length,sector_list=new Array(sl);var chkd=new Array(sl),buf,buf_chain;var modulus=ssz-1,i,j,k,jj;for(i=0;i<sl;++i){buf=[];k=i+dir_start;if(k>=sl)k-=sl;if(chkd[k]===true)continue;buf_chain=[];for(j=k;j>=0;){chkd[j]=true;buf[buf.length]=j;buf_chain.push(sectors[j]);var addr=fat_addrs[Math.floor(j*4/ssz)];jj=j*4&modulus;if(ssz<4+jj)throw new Error("FAT boundary crossed: "+j+" 4 "+ssz);if(!sectors[addr])break;j=__readInt32LE(sectors[addr],jj)}sector_list[k]={nodes:buf,data:__toBuffer([buf_chain])}}return sector_list}function read_directory(dir_start,sector_list,sectors,Paths,nmfs,files,FileIndex){var blob;var minifat_store=0,pl=Paths.length?2:0;var sector=sector_list[dir_start].data;var i=0,namelen=0,name,o,ctime,mtime;for(;i<sector.length;i+=128){blob=sector.slice(i,i+128);prep_blob(blob,64);namelen=blob.read_shift(2);if(namelen===0)continue;name=__utf16le(blob,0,namelen-pl);Paths.push(name);o={name:name,type:blob.read_shift(1),color:blob.read_shift(1),L:blob.read_shift(4,"i"),R:blob.read_shift(4,"i"),C:blob.read_shift(4,"i"),clsid:blob.read_shift(16),state:blob.read_shift(4,"i")};ctime=blob
}function write_XLWideString(data,o){var _null=false;if(o==null){_null=true;o=new_buf(4+2*data.length)}o.write_shift(4,data.length);if(data.length>0)o.write_shift(0,data,"dbcs");return _null?o.slice(0,o.l):o}function parse_StrRun(data,length){return{ich:data.read_shift(2),ifnt:data.read_shift(2)}}function write_StrRun(run,o){if(!o)o=new_buf(4);o.write_shift(2,run.ich||0);o.write_shift(2,run.ifnt||0);return o}function parse_RichStr(data,length){var start=data.l;var flags=data.read_shift(1);var str=parse_XLWideString(data);var rgsStrRun=[];var z={t:str,h:str};if((flags&1)!==0){var dwSizeStrRun=data.read_shift(4);for(var i=0;i!=dwSizeStrRun;++i)rgsStrRun.push(parse_StrRun(data));z.r=rgsStrRun}else z.r=[{ich:0,ifnt:0}];data.l=start+length;return z}function write_RichStr(str,o){var _null=false;if(o==null){_null=true;o=new_buf(15+4*str.t.length)}o.write_shift(1,0);write_XLWideString(str.t,o);return _null?o.slice(0,o.l):o}var parse_BrtCommentText=parse_RichStr;function write_BrtCommentText(str,o){var _null=false;if(o==null){_null=true;o=new_buf(23+4*str.t.length)}o.write_shift(1,1);write_XLWideString(str.t,o);o.write_shift(4,1);write_StrRun({ich:0,ifnt:0},o);return _null?o.slice(0,o.l):o}function parse_XLSBCell(data){var col=data.read_shift(4);var iStyleRef=data.read_shift(2);iStyleRef+=data.read_shift(1)<<16;var fPhShow=data.read_shift(1);return{c:col,iStyleRef:iStyleRef}}function write_XLSBCell(cell,o){if(o==null)o=new_buf(8);o.write_shift(-4,cell.c);o.write_shift(3,cell.iStyleRef||cell.s);o.write_shift(1,0);return o}var parse_XLSBCodeName=parse_XLWideString;var write_XLSBCodeName=write_XLWideString;function parse_XLNullableWideString(data){var cchCharacters=data.read_shift(4);return cchCharacters===0||cchCharacters===4294967295?"":data.read_shift(cchCharacters,"dbcs")}function write_XLNullableWideString(data,o){var _null=false;if(o==null){_null=true;o=new_buf(127)}o.write_shift(4,data.length>0?data.length:4294967295);if(data.length>0)o.write_shift(0,data,"dbcs");return _null?o.slice(0,o.l):o}var parse_XLNameWideString=parse_XLWideString;var write_XLNameWideString=write_XLWideString;var parse_RelID=parse_XLNullableWideString;var write_RelID=write_XLNullableWideString;function parse_RkNumber(data){var b=data.slice(data.l,data.l+4);var fX100=b[0]&1,fInt=b[0]&2;data.l+=4;b[0]&=252;var RK=fInt===0?__double([0,0,0,0,b[0],b[1],b[2],b[3]],0):__readInt32LE(b,0)>>2;return fX100?RK/100:RK}function write_RkNumber(data,o){if(o==null)o=new_buf(4);var fX100=0,fInt=0,d100=data*100;if(data==(data|0)&&data>=-(1<<29)&&data<1<<29){fInt=1}else if(d100==(d100|0)&&d100>=-(1<<29)&&d100<1<<29){fInt=1;fX100=1}if(fInt)o.write_shift(-4,((fX100?d100:data)<<2)+(fX100+2));else throw new Error("unsupported RkNumber "+data)}function parse_RfX(data){var cell={s:{},e:{}};cell.s.r=data.read_shift(4);cell.e.r=data.read_shift(4);cell.s.c=data.read_shift(4);cell.e.c=data.read_shift(4);return cell}function write_RfX(r,o){if(!o)o=new_buf(16);o.write_shift(4,r.s.r);o.write_shift(4,r.e.r);o.write_shift(4,r.s.c);o.write_shift(4,r.e.c);return o}var parse_UncheckedRfX=parse_RfX;var write_UncheckedRfX=write_RfX;function parse_Xnum(data,length){return data.read_shift(8,"f")}function write_Xnum(data,o){return(o||new_buf(8)).write_shift(8,data,"f")}var BErr={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"};var RBErr=evert_num(BErr);function parse_BrtColor(data,length){var out={};var d=data.read_shift(1);var fValidRGB=d&1;var xColorType=d>>>1;var index=data.read_shift(1);var nTS=data.read_shift(2,"i");var bR=data.read_shift(1);var bG=data.read_shift(1);var bB=data.read_shift(1);var bAlpha=data.read_shift(1);switch(xColorType){case 0:out.auto=1;break;case 1:out.index=index;var icv=XLSIcv[index];if(icv)out.rgb=icv[0].toString(16)+icv[1].toString(16)+icv[2].toString(16);break;case 2:out.rgb=bR.toString(16)+bG.toString(16)+bB.toString(16);break;case 3:out.theme=index;break}if(nTS!=0)out.tint=nTS>0?nTS/32767:nTS/32768;return out}function write_BrtColor(color,o){if(!o)o=new_buf(8);if(!color||color.auto){o.write_shift(
var Props=[],i=0;var CodePage=0;var Dictionary=-1,DictObj={};for(i=0;i!=NumProps;++i){var PropID=blob.read_shift(4);var Offset=blob.read_shift(4);Props[i]=[PropID,Offset+start_addr]}var PropH={};for(i=0;i!=NumProps;++i){if(blob.l!==Props[i][1]){var fail=true;if(i>0&&PIDSI)switch(PIDSI[Props[i-1][0]].t){case 2:if(blob.l+2===Props[i][1]){blob.l+=2;fail=false}break;case 80:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break;case 4108:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break}if(!PIDSI&&blob.l<=Props[i][1]){fail=false;blob.l=Props[i][1]}if(fail)throw new Error("Read Error: Expected address "+Props[i][1]+" at "+blob.l+" :"+i)}if(PIDSI){var piddsi=PIDSI[Props[i][0]];PropH[piddsi.n]=parse_TypedPropertyValue(blob,piddsi.t,{raw:true});if(piddsi.p==="version")PropH[piddsi.n]=String(PropH[piddsi.n]>>16)+"."+String(PropH[piddsi.n]&65535);if(piddsi.n=="CodePage")switch(PropH[piddsi.n]){case 0:PropH[piddsi.n]=1252;case 874:case 932:case 936:case 949:case 950:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 1e4:case 1200:case 1201:case 1252:case 65e3:case-536:case 65001:case-535:set_cp(CodePage=PropH[piddsi.n]);break;default:throw new Error("Unsupported CodePage: "+PropH[piddsi.n])}}else{if(Props[i][0]===1){CodePage=PropH.CodePage=parse_TypedPropertyValue(blob,VT_I2);set_cp(CodePage);if(Dictionary!==-1){var oldpos=blob.l;blob.l=Props[Dictionary][1];DictObj=parse_dictionary(blob,CodePage);blob.l=oldpos}}else if(Props[i][0]===0){if(CodePage===0){Dictionary=i;blob.l=Props[i+1][1];continue}DictObj=parse_dictionary(blob,CodePage)}else{var name=DictObj[Props[i][0]];var val;switch(blob[blob.l]){case 65:blob.l+=4;val=parse_BLOB(blob);break;case 30:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case 31:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case 3:blob.l+=4;val=blob.read_shift(4,"i");break;case 19:blob.l+=4;val=blob.read_shift(4);break;case 5:blob.l+=4;val=blob.read_shift(8,"f");break;case 11:blob.l+=4;val=parsebool(blob,4);break;case 64:blob.l+=4;val=parseDate(parse_FILETIME(blob));break;default:throw new Error("unparsed value: "+blob[blob.l])}PropH[name]=val}}}blob.l=start_addr+size;return PropH}function parse_PropertySetStream(file,PIDSI){var blob=file.content;prep_blob(blob,0);var NumSets,FMTID0,FMTID1,Offset0,Offset1=0;blob.chk("feff","Byte Order: ");var vers=blob.read_shift(2);var SystemIdentifier=blob.read_shift(4);blob.chk(CFB.utils.consts.HEADER_CLSID,"CLSID: ");NumSets=blob.read_shift(4);if(NumSets!==1&&NumSets!==2)throw new Error("Unrecognized #Sets: "+NumSets);FMTID0=blob.read_shift(16);Offset0=blob.read_shift(4);if(NumSets===1&&Offset0!==blob.l)throw new Error("Length mismatch: "+Offset0+" !== "+blob.l);else if(NumSets===2){FMTID1=blob.read_shift(16);Offset1=blob.read_shift(4)}var PSet0=parse_PropertySet(blob,PIDSI);var rval={SystemIdentifier:SystemIdentifier};for(var y in PSet0)rval[y]=PSet0[y];rval.FMTID=FMTID0;if(NumSets===1)return rval;if(blob.l!==Offset1)throw new Error("Length mismatch 2: "+blob.l+" !== "+Offset1);var PSet1;try{PSet1=parse_PropertySet(blob,null)}catch(e){}for(y in PSet1)rval[y]=PSet1[y];rval.FMTID=[FMTID0,FMTID1];return rval}function parsenoop2(blob,length){blob.read_shift(length);return null}function parslurp(blob,length,cb){var arr=[],target=blob.l+length;while(blob.l<target)arr.push(cb(blob,target-blob.l));if(target!==blob.l)throw new Error("Slurp error");return arr}function parsebool(blob,length){return blob.read_shift(length)===1}function parseuint16(blob){return blob.read_shift(2,"u")}function parseuint16a(blob,length){return parslurp(blob,length,parseuint16)}var parse_Boolean=parsebool;function parse_Bes(blob){var v=blob.read_shift(1),t=blob.read_shift(1);return t===1?v:v===1}function parse_ShortXLUnicodeString(blob,length,opts){var cch=blob.read_shift(opts&&opts.biff>=12?2:1);var width=1,encoding="sbcs-cont";var cp=current_codepage;if(opts&&opts.biff>=8)current_codepage=1200;if(!opts||opts.biff==8){var fHighByte=blob.read_shift(1);if(fHighByte){width=2;encoding="dbcs-cont"}}else if(opts.biff==12){width=2;encoding=
++blob.l;var num=parse_Xnum(blob,8);cell.t="n";cell.val=num;return cell}function parse_BIFF2INT(blob,length){var cell=parse_XLSCell(blob,6);++blob.l;var num=blob.read_shift(2);cell.t="n";cell.val=num;return cell}function parse_BIFF2STRING(blob,length){var cch=blob.read_shift(1);if(cch===0){blob.l++;return""}return blob.read_shift(cch,"sbcs-cont")}function parse_BIFF2FONTXTRA(blob,length){blob.l+=6;blob.l+=2;blob.l+=1;blob.l+=3;blob.l+=1;blob.l+=length-13}function parse_RString(blob,length,opts){var end=blob.l+length;var cell=parse_XLSCell(blob,6);var cch=blob.read_shift(2);var str=parse_XLUnicodeStringNoCch(blob,cch,opts);blob.l=end;cell.t="str";cell.val=str;return cell}var DBF=function(){var dbf_codepage_map={1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127,8:865,9:437,10:850,11:437,13:437,14:850,15:437,16:850,17:437,18:850,19:932,20:850,21:437,22:850,23:865,24:437,25:437,26:850,27:437,28:863,29:850,31:852,34:852,35:852,36:860,37:850,38:866,55:850,64:852,77:936,78:949,79:950,80:874,87:1252,88:1252,89:1252,255:16969};function dbf_to_aoa(buf,opts){var out=[];var d=new_raw_buf(1);switch(opts.type){case"base64":d=s2a(Base64.decode(buf));break;case"binary":d=s2a(buf);break;case"buffer":case"array":d=buf;break}prep_blob(d,0);var ft=d.read_shift(1);var memo=false;var vfp=false;switch(ft){case 2:case 3:break;case 48:vfp=true;memo=true;break;case 49:vfp=true;break;case 131:memo=true;break;case 139:memo=true;break;case 245:memo=true;break;default:throw new Error("DBF Unsupported Version: "+ft.toString(16))}var filedate=new Date,nrow=0,fpos=0;if(ft==2)nrow=d.read_shift(2);filedate=new Date(d.read_shift(1)+1900,d.read_shift(1)-1,d.read_shift(1));if(ft!=2)nrow=d.read_shift(4);if(ft!=2)fpos=d.read_shift(2);var rlen=d.read_shift(2);var flags=0,current_cp=1252;if(ft!=2){d.l+=16;flags=d.read_shift(1);if(d[d.l]!==0)current_cp=dbf_codepage_map[d[d.l]];d.l+=1;d.l+=2}var fields=[],field={};var hend=fpos-10-(vfp?264:0);while(ft==2?d.l<d.length&&d[d.l]!=13:d.l<hend){field={};field.name=cptable.utils.decode(current_cp,d.slice(d.l,d.l+10)).replace(/[\u0000\r\n].*$/g,"");d.l+=11;field.type=String.fromCharCode(d.read_shift(1));if(ft!=2)field.offset=d.read_shift(4);field.len=d.read_shift(1);if(ft==2)field.offset=d.read_shift(2);field.dec=d.read_shift(1);if(field.name.length)fields.push(field);if(ft!=2)d.l+=14;switch(field.type){case"C":break;case"D":break;case"F":break;case"I":break;case"L":break;case"M":break;case"N":break;case"T":break;case"Y":break;case"0":break;case"+":break;case"@":break;default:throw new Error("Unknown Field Type: "+field.type)}}if(d[d.l]!==13)d.l=fpos-1;else if(ft==2)d.l=521;if(ft!=2){if(d.read_shift(1)!==13)throw new Error("DBF Terminator not found "+d.l+" "+d[d.l]);d.l=fpos}var R=0,C=0;out[0]=[];for(C=0;C!=fields.length;++C)out[0][C]=fields[C].name;while(nrow-- >0){if(d[d.l]===42){d.l+=rlen;continue}++d.l;out[++R]=[];C=0;for(C=0;C!=fields.length;++C){var dd=d.slice(d.l,d.l+fields[C].len);d.l+=fields[C].len;prep_blob(dd,0);var s=cptable.utils.decode(current_cp,dd);switch(fields[C].type){case"C":out[R][C]=cptable.utils.decode(current_cp,dd);out[R][C]=out[R][C].trim();break;case"D":if(s.length===8)out[R][C]=new Date(+s.substr(0,4),+s.substr(4,2)-1,+s.substr(6,2));else out[R][C]=s;break;case"F":out[R][C]=parseFloat(s.trim());break;case"I":out[R][C]=dd.read_shift(4,"i");break;case"L":switch(s.toUpperCase()){case"Y":case"T":out[R][C]=true;break;case"N":case"F":out[R][C]=false;break;case" ":case"?":out[R][C]=false;break;default:throw new Error("DBF Unrecognized L:|"+s+"|")}break;case"M":if(!memo)throw new Error("DBF Unexpected MEMO for type "+ft.toString(16));out[R][C]="##MEMO##"+dd.read_shift(4);break;case"N":out[R][C]=+s.replace(/\u0000/g,"").trim();break;case"T":var day=dd.read_shift(4),ms=dd.read_shift(4);throw new Error(day+" | "+ms);case"Y":out[R][C]=dd.read(4,"i")/1e4;break;case"0":if(fields[C].name==="_NullFlags")break;default:throw new Error("DBF Uns
var Ror=function(Byte){return(Byte/2|Byte*128)&255};var XorRor=function(byte1,byte2){return Ror(byte1^byte2)};var CreateXorKey_Method1=function(Password){var XorKey=InitialCode[Password.length-1];var CurrentElement=104;for(var i=Password.length-1;i>=0;--i){var Char=Password[i];for(var j=0;j!=7;++j){if(Char&64)XorKey^=XorMatrix[CurrentElement];Char*=2;--CurrentElement}}return XorKey};return function(password){var Password=_JS2ANSI(password);var XorKey=CreateXorKey_Method1(Password);var Index=Password.length;var ObfuscationArray=new_raw_buf(16);for(var i=0;i!=16;++i)ObfuscationArray[i]=0;var Temp,PasswordLastChar,PadIndex;if((Index&1)===1){Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(PadArray[0],Temp);--Index;Temp=XorKey&255;PasswordLastChar=Password[Password.length-1];ObfuscationArray[Index]=XorRor(PasswordLastChar,Temp)}while(Index>0){--Index;Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(Password[Index],Temp);--Index;Temp=XorKey&255;ObfuscationArray[Index]=XorRor(Password[Index],Temp)}Index=15;PadIndex=15-Password.length;while(PadIndex>0){Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(PadArray[PadIndex],Temp);--Index;--PadIndex;Temp=XorKey&255;ObfuscationArray[Index]=XorRor(Password[Index],Temp);--Index;--PadIndex}return ObfuscationArray}}();var crypto_DecryptData_Method1=function(password,Data,XorArrayIndex,XorArray,O){if(!O)O=Data;if(!XorArray)XorArray=crypto_CreateXorArray_Method1(password);var Index,Value;for(Index=0;Index!=Data.length;++Index){Value=Data[Index];Value^=XorArray[XorArrayIndex];Value=(Value>>5|Value<<3)&255;O[Index]=Value;++XorArrayIndex}return[O,XorArrayIndex,XorArray]};var crypto_MakeXorDecryptor=function(password){var XorArrayIndex=0,XorArray=crypto_CreateXorArray_Method1(password);return function(Data){var O=crypto_DecryptData_Method1("",Data,XorArrayIndex,XorArray);XorArrayIndex=O[1];return O[0]}};function parse_XORObfuscation(blob,length,opts,out){var o={key:parseuint16(blob),verificationBytes:parseuint16(blob)};if(opts.password)o.verifier=crypto_CreatePasswordVerifier_Method1(opts.password);out.valid=o.verificationBytes===o.verifier;if(out.valid)out.insitu_decrypt=crypto_MakeXorDecryptor(opts.password);return o}function parse_FilePassHeader(blob,length,oo){var o=oo||{};o.Info=blob.read_shift(2);blob.l-=2;if(o.Info===1)o.Data=parse_RC4Header(blob,length);else o.Data=parse_RC4CryptoHeader(blob,length);return o}function parse_FilePass(blob,length,opts){var o={Type:blob.read_shift(2)};if(o.Type)parse_FilePassHeader(blob,length-2,o);else parse_XORObfuscation(blob,length-2,opts,o);return o}function hex2RGB(h){var o=h.substr(h[0]==="#"?1:0,6);return[parseInt(o.substr(0,2),16),parseInt(o.substr(2,2),16),parseInt(o.substr(4,2),16)]}function rgb2Hex(rgb){for(var i=0,o=1;i!=3;++i)o=o*256+(rgb[i]>255?255:rgb[i]<0?0:rgb[i]);return o.toString(16).toUpperCase().substr(1)}function rgb2HSL(rgb){var R=rgb[0]/255,G=rgb[1]/255,B=rgb[2]/255;var M=Math.max(R,G,B),m=Math.min(R,G,B),C=M-m;if(C===0)return[0,0,R];var H6=0,S=0,L2=M+m;S=C/(L2>1?2-L2:L2);switch(M){case R:H6=((G-B)/C+6)%6;break;case G:H6=(B-R)/C+2;break;case B:H6=(R-G)/C+4;break}return[H6/6,S,L2/2]}function hsl2RGB(hsl){var H=hsl[0],S=hsl[1],L=hsl[2];var C=S*2*(L<.5?L:1-L),m=L-C/2;var rgb=[m,m,m],h6=6*H;var X;if(S!==0)switch(h6|0){case 0:case 6:X=C*h6;rgb[0]+=C;rgb[1]+=X;break;case 1:X=C*(2-h6);rgb[0]+=X;rgb[1]+=C;break;case 2:X=C*(h6-2);rgb[1]+=C;rgb[2]+=X;break;case 3:X=C*(4-h6);rgb[1]+=X;rgb[2]+=C;break;case 4:X=C*(h6-4);rgb[2]+=C;rgb[0]+=X;break;case 5:X=C*(6-h6);rgb[2]+=X;rgb[0]+=C;break}for(var i=0;i!=3;++i)rgb[i]=Math.round(rgb[i]*255);return rgb}function rgb_tint(hex,tint){if(tint===0)return hex;var hsl=rgb2HSL(hex2RGB(hex));if(tint<0)hsl[2]=hsl[2]*(1+tint);else hsl[2]=1-(1-hsl[2])*(1-tint);return rgb2Hex(hsl2RGB(hsl))}var DEF_MDW=6,MAX_MDW=15,MIN_MDW=1,MDW=DEF_MDW;function width2px(width){return Math.floor((width+Math.round(128/MDW)/256)*MDW)}function px2char(px){return Math.floor((px-5)/MDW*100+.5)/100}function char2width(chr){return Math.round((chr*MDW+5)/MDW*256)/256}function px2char_(px){return((px-5)/MDW*100+.5)/100}function char2width_(chr){r
o[o.length]="<a:gsLst>";o[o.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>';o[o.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>';o[o.length]="</a:gsLst>";o[o.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>';o[o.length]="</a:gradFill>";o[o.length]="</a:bgFillStyleLst>";o[o.length]="</a:fmtScheme>";o[o.length]="</a:themeElements>";o[o.length]="<a:objectDefaults>";o[o.length]="<a:spDef>";o[o.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>';o[o.length]="</a:spDef>";o[o.length]="<a:lnDef>";o[o.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>';o[o.length]="</a:lnDef>";o[o.length]="</a:objectDefaults>";o[o.length]="<a:extraClrSchemeLst/>";o[o.length]="</a:theme>";return o.join("")}function parse_Theme(blob,length,opts){var dwThemeVersion=blob.read_shift(4);if(dwThemeVersion===124226)return;blob.l+=length-4}function parse_ColorTheme(blob,length){return blob.read_shift(4)}function parse_FullColorExt(blob,length){var o={};o.xclrType=blob.read_shift(2);o.nTintShade=blob.read_shift(2);switch(o.xclrType){case 0:blob.l+=4;break;case 1:o.xclrValue=parse_IcvXF(blob,4);break;case 2:o.xclrValue=parse_LongRGBA(blob,4);break;case 3:o.xclrValue=parse_ColorTheme(blob,4);break;case 4:blob.l+=4;break}blob.l+=8;return o}function parse_IcvXF(blob,length){return parsenoop(blob,length)}function parse_XFExtGradient(blob,length){return parsenoop(blob,length)}function parse_ExtProp(blob,length){var extType=blob.read_shift(2);var cb=blob.read_shift(2);var o=[extType];switch(extType){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:o[1]=parse_FullColorExt(blob,cb);break;case 6:o[1]=parse_XFExtGradient(blob,cb);break;case 14:case 15:o[1]=blob.read_shift(cb===5?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+extType+" "+cb)}return o}function parse_XFExt(blob,length){var end=blob.l+length;blob.l+=2;var ixfe=blob.read_shift(2);blob.l+=2;var cexts=blob.read_shift(2);var ext=[];while(cexts-- >0)ext.push(parse_ExtProp(blob,end-blob.l));return{ixfe:ixfe,ext:ext}}function update_xfext(xf,xfext){xfext.forEach(function(xfe){switch(xfe[0]){case 4:break;case 5:break;case 6:break;case 7:break;case 8:break;case 9:break;case 10:break;case 11:break;case 13:break;case 14:break;case 15:break}})}function parse_cc_xml(data,opts){var d=[];if(!data)return d;var l=0,i=1;(data.match(tagregex)||[]).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<?xml":break;case"<calcChain":case"<calcChain>":case"</calcChain>":break;case"<c":delete y[0];if(y.i)i=y.i;else y.i=i;d.push(y);break}});return d}function write_cc_xml(data,opts){}function parse_BrtCalcChainItem$(data,length){var out={};out.i=data.read_shift(4);var cell={};cell.r=data.read_shift(4);cell.c=data.read_shift(4);out.r=encode_cell(cell);var flags=data.read_shift(1);if(flags&2)out.l="1";if(flags&8)out.a="1";return out}function parse_cc_bin(data,opts){var out=[];var pass=false;recordhopper(data,function hopper_cc(val,R_n,RT){switch(RT){case 63:out.push(val);break;default:if((R_n||"").indexOf("Begin")>0){}else if((R_n||"").indexOf("End")>0){}else if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R_n)}});return out}function write_cc_bin(data,opts){}RELS.IMG="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";RELS.DRAW="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";function parse_drawing(data,rels){if(!data)return"??";var id=(data.match(/<c:chart [^>]*
f=formula[0][last_sp];var _left=true;switch(f[1][0]){case 4:_left=false;case 0:sp=fill(" ",f[1][1]);break;case 5:_left=false;case 1:sp=fill("\r",f[1][1]);break;default:sp="";if(opts.WTF)throw new Error("Unexpected PtgAttrSpaceType "+f[1][0])}stack.push((_left?sp:"")+stack.pop()+(_left?"":sp));last_sp=-1}}if(stack.length>1&&opts.WTF)throw new Error("bad formula stack");return stack[0]}function parse_XLSBParsedFormula(data,length,opts){var end=data.l+length;var cce=data.read_shift(4);var rgce=parse_Rgce(data,cce,opts);var cb=data.read_shift(4);var rgcb=cb>0?parse_RgbExtra(data,cb,rgce,opts):null;return[rgce,rgcb]}var parse_XLSBArrayParsedFormula=parse_XLSBParsedFormula;var parse_XLSBCellParsedFormula=parse_XLSBParsedFormula;var parse_XLSBNameParsedFormula=parse_XLSBParsedFormula;var parse_XLSBSharedParsedFormula=parse_XLSBParsedFormula;var PtgDataType={1:"REFERENCE",2:"VALUE",3:"ARRAY"};var Cetab={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE
p.t="s";p.v=p.v!=null?utf8read(p.v):"";if(opts.cellHTML)p.h=escapehtml(p.v);break;case"inlineStr":cref=d.match(isregex);p.t="s";if(cref!=null&&(sstr=parse_si(cref[1])))p.v=sstr.t;else p.v="";break;case"b":p.v=parsexmlbool(p.v);break;case"d":if(!opts.cellDates){p.v=datenum(parseDate(p.v));p.t="n"}break;case"e":if(!opts||opts.cellText!==false)p.w=p.v;p.v=RBErr[p.v];break}fmtid=fillid=0;if(do_format&&tag.s!==undefined){cf=styles.CellXf[tag.s];if(cf!=null){if(cf.numFmtId!=null)fmtid=cf.numFmtId;if(opts.cellStyles&&cf.fillId!=null)fillid=cf.fillId}}safe_format(p,fmtid,fillid,opts,themes,styles);if(opts.cellDates&&do_format&&p.t=="n"&&SSF.is_date(SSF._table[fmtid])){var _d=SSF.parse_date_code(p.v);if(_d){p.t="d";p.v=new Date(Date.UTC(_d.y,_d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u))}}if(dense){var _r=decode_cell(tag.r);if(!s[_r.r])s[_r.r]=[];s[_r.r][_r.c]=p}else s[tag.r]=p}}if(rows.length>0)s["!rows"]=rows}}();function write_ws_xml_data(ws,opts,idx,wb,rels){var o=[],r=[],range=safe_decode_range(ws["!ref"]),cell,ref,rr="",cols=[],R=0,C=0,rows=ws["!rows"];var dense=Array.isArray(ws);for(C=range.s.c;C<=range.e.c;++C)cols[C]=encode_col(C);for(R=range.s.r;R<=range.e.r;++R){r=[];rr=encode_row(R);for(C=range.s.c;C<=range.e.c;++C){ref=cols[C]+rr;var _cell=dense?(ws[R]||[])[C]:ws[ref];if(_cell===undefined)continue;if((cell=write_ws_xml_cell(_cell,ref,ws,opts,idx,wb))!=null)r.push(cell)}if(r.length>0){var params={r:rr};if(rows&&rows[R]){var row=rows[R];if(row.hidden)params.hidden=1;var height=-1;if(row.hpx)height=px2pt(row.hpx);else if(row.hpt)height=row.hpt;if(height>-1){params.ht=height;params.customHeight=1}}o[o.length]=writextag("row",r.join(""),params)}}return o.join("")}var WS_XML_ROOT=writextag("worksheet",null,{xmlns:XMLNS.main[0],"xmlns:r":XMLNS.r});function write_ws_xml(idx,opts,wb,rels){var o=[XML_HEADER,WS_XML_ROOT];var s=wb.SheetNames[idx],sidx=0,rdata="";var ws=wb.Sheets[s];if(ws==null)ws={};var ref=ws["!ref"];if(ref==null)ref="A1";if(!rels)rels={};ws["!comments"]=[];ws["!drawing"]=[];o[o.length]=writextag("sheetPr",null,{codeName:escapexml(wb.SheetNames[idx])});o[o.length]=writextag("dimension",null,{ref:ref});o[o.length]=write_ws_xml_sheetviews(ws,opts,idx,wb);if(opts.sheetFormat)o[o.length]=writextag("sheetFormatPr",null,{defaultRowHeight:opts.sheetFormat.defaultRowHeight||"16",baseColWidth:opts.sheetFormat.baseColWidth||"10"});if(ws["!cols"]!=null&&ws["!cols"].length>0)o[o.length]=write_ws_xml_cols(ws,ws["!cols"]);o[sidx=o.length]="<sheetData/>";ws["!links"]=[];if(ws["!ref"]!=null){rdata=write_ws_xml_data(ws,opts,idx,wb,rels);if(rdata.length>0)o[o.length]=rdata}if(o.length>sidx+1){o[o.length]="</sheetData>";o[sidx]=o[sidx].replace("/>",">")}if(ws["!protect"]!=null)o[o.length]=write_ws_xml_protection(ws["!protect"]);if(ws["!autofilter"]!=null)o[o.length]=write_ws_xml_autofilter(ws["!autofilter"]);if(ws["!merges"]!=null&&ws["!merges"].length>0)o[o.length]=write_ws_xml_merges(ws["!merges"]);var relc=-1,rel,rId=-1;if(ws["!links"].length>0){o[o.length]="<hyperlinks>";ws["!links"].forEach(function(l){if(!l[1].Target)return;rId=add_rels(rels,-1,escapexml(l[1].Target).replace(/#.*$/,""),RELS.HLINK);rel={ref:l[0],"r:id":"rId"+rId};if((relc=l[1].Target.indexOf("#"))>-1)rel.location=escapexml(l[1].Target.substr(relc+1));if(l[1].Tooltip)rel.tooltip=escapexml(l[1].Tooltip);o[o.length]=writextag("hyperlink",null,rel)});o[o.length]="</hyperlinks>"}delete ws["!links"];if(ws["!margins"]!=null)o[o.length]=write_ws_xml_margins(ws["!margins"]);var hfidx=o.length;o[o.length]="";if(ws["!drawing"].length>0){rId=add_rels(rels,-1,"../drawings/drawing"+(idx+1)+".xml",RELS.DRAW);ws["!drawing"].rid=rId;o[o.length]=writextag("drawing",null,{"r:id":"rId"+rId})}else delete ws["!drawing"];if(ws["!comments"].length>0){rId=add_rels(rels,-1,"../drawings/vmlDrawing"+(idx+1)+".vml",RELS.VML);o[o.length]=writextag("legacyDrawing",null,{"r:id":"rId"+rId});ws["!legacy"]=rId}if(o.length>2){o[o.length]="</worksheet>";o[1]=o[1].replace("/>",">")}return o.join("")}function parse_BrtRowHdr(data,length){var z={};var tgt=data.l+length;z.r=data.read_shift(4);data.l+=4;var miy
}function write_BrtFileVersion(data,o){if(!o)o=new_buf(127);for(var i=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;return o.length>o.l?o.slice(0,o.l):o}function write_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);var flags=120;o.write_shift(1,flags);return o.length>o.l?o.slice(0,o.l):o}function write_BOOKVIEWS(ba,wb,opts){if(!wb.Workbook||!wb.Workbook.Sheets)return;var sheets=wb.Workbook.Sheets;var i=0,vistab=-1,hidden=-1;for(;i<sheets.length;++i){if(!sheets[i]||!sheets[i].Hidden&&vistab==-1)vistab=i;else if(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")}function write_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);return o}function write_BrtFileRecover(data,o){if(!o)o=new_buf(1);o.write_shift(1,0);return o}function write_wb_bin(wb,opts){var ba=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");return ba.end()}function parse_wb(data,name,opts){if(name.slice(-4)===".bin")return parse_wb_bin(data,opts);return parse_wb_xml(data,opts)}function parse_ws(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")return parse_ws_bin(data,opts,rels,wb,themes,styles);return parse_ws_xml(data,opts,rels,wb,themes,styles)}function parse_cs(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")return parse_cs_bin(data,opts,rels,wb,themes,styles);return parse_cs_xml(data,opts,rels,wb,themes,styles)}function parse_ms(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")return parse_ms_bin(data,opts,rels,wb,themes,styles);return parse_ms_xml(data,opts,rels,wb,themes,styles)}function parse_ds(data,name,opts,rels,wb,themes,styles){if(name.slice(-4)===".bin")return parse_ds_bin(data,opts,rels,wb,themes,styles);return parse_ds_xml(data,opts,rels,wb,themes,styles)}function parse_sty(data,name,themes,opts){if(name.slice(-4)===".bin")return parse_sty_bin(data,themes,opts);return parse_sty_xml(data,themes,opts)}function parse_theme(data,name,opts){return parse_theme_xml(data,opts)}function parse_sst(data,name,opts){if(name.slice(-4)===".bin")return parse_sst_bin(data,opts);return parse_sst_xml(data,opts)}function parse_cmnt(data,name,opts){if(name.slice(-4)===".bin")return parse_comments_bin(data,opts);return parse_comments_xml(data,opts)}function parse_cc(data,name,opts){if(name.slice(-4)===".bin")return parse_cc_bin(data,opts);return parse_cc_xml(data,opts)}function write_wb(wb,name,opts){return(name.slice(-4)===".bin"?write_wb_bin:write_wb_xml)(wb,opts)}function write_ws(data,name,opts,wb,rels){return(name.slice(-4)===".bin"?write_ws_bin:write_ws_xml)(data,opts,wb,rels)}function write_cs(data,name,opts,wb,rels){return(name.slice(-4)===".bin"?write_cs_bin:write_cs_xml)(data,opts,wb,rels)}function write_sty(data,name,opts){return(name.slice(-4)===".bin"?write_sty_bin:write_sty_xml)(data,opts)}function write_sst(data,name,opts){return(name.slice(-4)===".bin"?write_sst_bin:write_sst_xml)(data,opts)}function write_cmnt(data,name,opts){return(name.slice(-4)===".bin"?write_comments_bin:write_comments_xml)(data,opts)}var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g;var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;var _chr=function(c){return String.fromCharCode(c)};function xlml_parsexmltag(tag,skip_root){var words=tag.split(/\s+/);var z=[];if(!skip_root)z[0]=words[0];if(words.length===1)return z;var m=tag.match(attregexg2),y,j,w,i;if(m)for(i=0;i!=m.length;++i){y=m[i].ma
var temp_val;var country;var cell_valid=true;var XFs=[];var palette=[];var Workbook={Sheets:[]},wsprops={};var get_rgb=function getrgb(icv){if(icv<8)return XLSIcv[icv];if(icv<64)return palette[icv-8]||XLSIcv[icv];return XLSIcv[icv]};var process_cell_style=function pcs(cell,line,options){var xfd=line.XF.data;if(!xfd||!xfd.patternType||!options||!options.cellStyles)return;line.s={};line.s.patternType=xfd.patternType;var t;if(t=rgb2Hex(get_rgb(xfd.icvFore))){line.s.fgColor={rgb:t}}if(t=rgb2Hex(get_rgb(xfd.icvBack))){line.s.bgColor={rgb:t}}};var addcell=function addcell(cell,line,options){if(file_depth>1)return;if(!cell_valid)return;if(options.cellStyles&&line.XF&&line.XF.data)process_cell_style(cell,line,options);lastcell=cell;last_cell=encode_cell(cell);if(range.s){if(cell.r<range.s.r)range.s.r=cell.r;if(cell.c<range.s.c)range.s.c=cell.c}if(range.e){if(cell.r+1>range.e.r)range.e.r=cell.r+1;if(cell.c+1>range.e.c)range.e.c=cell.c+1}if(options.cellFormula&&line.f){for(var afi=0;afi<array_formulae.length;++afi){if(array_formulae[afi][0].s.c>cell.c)continue;if(array_formulae[afi][0].s.r>cell.r)continue;if(array_formulae[afi][0].e.c<cell.c)continue;if(array_formulae[afi][0].e.r<cell.r)continue;line.F=encode_range(array_formulae[afi][0]);if(array_formulae[afi][0].s.c!=cell.c)delete line.f;if(array_formulae[afi][0].s.r!=cell.r)delete line.f;if(line.f)line.f=""+stringify_formula(array_formulae[afi][1],range,cell,supbooks,opts);break}}if(options.sheetRows&&lastcell.r>=options.sheetRows)cell_valid=false;else{if(options.dense){if(!out[cell.r])out[cell.r]=[];out[cell.r][cell.c]=line}else out[last_cell]=line}};var opts={enc:false,sbcch:0,snames:[],sharedf:shared_formulae,arrayf:array_formulae,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,cellStyles:!!options&&!!options.cellStyles,WTF:!!options&&!!options.wtf};if(options.password)opts.password=options.password;var mergecells=[];var objects=[];var colinfo=[],rowinfo=[];var defwidth=0,defheight=0;var seencol=false;var supbooks=[];supbooks.SheetNames=opts.snames;supbooks.sharedf=opts.sharedf;supbooks.arrayf=opts.arrayf;supbooks.names=[];supbooks.XTI=[];var last_Rn="";var file_depth=0;var BIFF2Fmt=0;var BIFF2FmtTable=[];var FilterDatabases=[];var last_lbl;opts.codepage=1200;set_cp(1200);while(blob.l<blob.length-1){var s=blob.l;var RecordType=blob.read_shift(2);if(RecordType===0&&last_Rn==="EOF")break;var length=blob.l===blob.length?0:blob.read_shift(2),y;var R=XLSRecordEnum[RecordType];if(R&&R.f){if(options.bookSheets){if(last_Rn==="BoundSheet8"&&R.n!=="BoundSheet8")break}last_Rn=R.n;if(R.r===2||R.r==12){var rt=blob.read_shift(2);length-=2;if(!opts.enc&&rt!==RecordType)throw"rt mismatch";if(R.r==12){blob.l+=10;length-=10}}var val;if(R.n==="EOF")val=R.f(blob,length,opts);else val=slurp(R,blob,length,opts);var Rn=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)throw new Error("File is password-protected");if(val.Type!==0)throw new Error("Encryption scheme unsupported");if(!val.valid)throw new Error("Password is incorrect");break;case"WriteAccess":opts.lastuser=val;break;case"FileSharing":break;case"CodePage":if(val===21010)val=1200;else if(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;cas
f:parsenoop},417:{n:"BrtRRConflict",f:parsenoop},418:{n:"BrtRRTQSIF",f:parsenoop},419:{n:"BrtRRFormat",f:parsenoop},420:{n:"BrtRREndFormat",f:parsenoop},421:{n:"BrtRRAutoFmt",f:parsenoop},422:{n:"BrtBeginUserShViews",f:parsenoop},423:{n:"BrtBeginUserShView",f:parsenoop},424:{n:"BrtEndUserShView",f:parsenoop},425:{n:"BrtEndUserShViews",f:parsenoop},426:{n:"BrtArrFmla",f:parse_BrtArrFmla},427:{n:"BrtShrFmla",f:parse_BrtShrFmla},428:{n:"BrtTable",f:parsenoop},429:{n:"BrtBeginExtConnections",f:parsenoop},430:{n:"BrtEndExtConnections",f:parsenoop},431:{n:"BrtBeginPCDCalcMems",f:parsenoop},432:{n:"BrtEndPCDCalcMems",f:parsenoop},433:{n:"BrtBeginPCDCalcMem",f:parsenoop},434:{n:"BrtEndPCDCalcMem",f:parsenoop},435:{n:"BrtBeginPCDHGLevels",f:parsenoop},436:{n:"BrtEndPCDHGLevels",f:parsenoop},437:{n:"BrtBeginPCDHGLevel",f:parsenoop},438:{n:"BrtEndPCDHGLevel",f:parsenoop},439:{n:"BrtBeginPCDHGLGroups",f:parsenoop},440:{n:"BrtEndPCDHGLGroups",f:parsenoop},441:{n:"BrtBeginPCDHGLGroup",f:parsenoop},442:{n:"BrtEndPCDHGLGroup",f:parsenoop},443:{n:"BrtBeginPCDHGLGMembers",f:parsenoop},444:{n:"BrtEndPCDHGLGMembers",f:parsenoop},445:{n:"BrtBeginPCDHGLGMember",f:parsenoop},446:{n:"BrtEndPCDHGLGMember",f:parsenoop},447:{n:"BrtBeginQSI",f:parsenoop},448:{n:"BrtEndQSI",f:parsenoop},449:{n:"BrtBeginQSIR",f:parsenoop},450:{n:"BrtEndQSIR",f:parsenoop},451:{n:"BrtBeginDeletedNames",f:parsenoop},452:{n:"BrtEndDeletedNames",f:parsenoop},453:{n:"BrtBeginDeletedName",f:parsenoop},454:{n:"BrtEndDeletedName",f:parsenoop},455:{n:"BrtBeginQSIFs",f:parsenoop},456:{n:"BrtEndQSIFs",f:parsenoop},457:{n:"BrtBeginQSIF",f:parsenoop},458:{n:"BrtEndQSIF",f:parsenoop},459:{n:"BrtBeginAutoSortScope",f:parsenoop},460:{n:"BrtEndAutoSortScope",f:parsenoop},461:{n:"BrtBeginConditionalFormatting",f:parsenoop},462:{n:"BrtEndConditionalFormatting",f:parsenoop},463:{n:"BrtBeginCFRule",f:parsenoop},464:{n:"BrtEndCFRule",f:parsenoop},465:{n:"BrtBeginIconSet",f:parsenoop},466:{n:"BrtEndIconSet",f:parsenoop},467:{n:"BrtBeginDatabar",f:parsenoop},468:{n:"BrtEndDatabar",f:parsenoop},469:{n:"BrtBeginColorScale",f:parsenoop},470:{n:"BrtEndColorScale",f:parsenoop},471:{n:"BrtCFVO",f:parsenoop},472:{n:"BrtExternValueMeta",f:parsenoop},473:{n:"BrtBeginColorPalette",f:parsenoop},474:{n:"BrtEndColorPalette",f:parsenoop},475:{n:"BrtIndexedColor",f:parsenoop},476:{n:"BrtMargins",f:parse_BrtMargins},477:{n:"BrtPrintOptions",f:parsenoop},478:{n:"BrtPageSetup",f:parsenoop},479:{n:"BrtBeginHeaderFooter",f:parsenoop},480:{n:"BrtEndHeaderFooter",f:parsenoop},481:{n:"BrtBeginSXCrtFormat",f:parsenoop},482:{n:"BrtEndSXCrtFormat",f:parsenoop},483:{n:"BrtBeginSXCrtFormats",f:parsenoop},484:{n:"BrtEndSXCrtFormats",f:parsenoop},485:{n:"BrtWsFmtInfo",f:parsenoop},486:{n:"BrtBeginMgs",f:parsenoop},487:{n:"BrtEndMGs",f:parsenoop},488:{n:"BrtBeginMGMaps",f:parsenoop},489:{n:"BrtEndMGMaps",f:parsenoop},490:{n:"BrtBeginMG",f:parsenoop},491:{n:"BrtEndMG",f:parsenoop},492:{n:"BrtBeginMap",f:parsenoop},493:{n:"BrtEndMap",f:parsenoop},494:{n:"BrtHLink",f:parse_BrtHLink},495:{n:"BrtBeginDCon",f:parsenoop},496:{n:"BrtEndDCon",f:parsenoop},497:{n:"BrtBeginDRefs",f:parsenoop},498:{n:"BrtEndDRefs",f:parsenoop},499:{n:"BrtDRef",f:parsenoop},500:{n:"BrtBeginScenMan",f:parsenoop},501:{n:"BrtEndScenMan",f:parsenoop},502:{n:"BrtBeginSct",f:parsenoop},503:{n:"BrtEndSct",f:parsenoop},504:{n:"BrtSlc",f:parsenoop},505:{n:"BrtBeginDXFs",f:parsenoop},506:{n:"BrtEndDXFs",f:parsenoop},507:{n:"BrtDXF",f:parsenoop},508:{n:"BrtBeginTableStyles",f:parsenoop},509:{n:"BrtEndTableStyles",f:parsenoop},510:{n:"BrtBeginTableStyle",f:parsenoop},511:{n:"BrtEndTableStyle",f:parsenoop},512:{n:"BrtTableStyleElement",f:parsenoop},513:{n:"BrtTableStyleClient",f:parsenoop},514:{n:"BrtBeginVolDeps",f:parsenoop},515:{n:"BrtEndVolDeps",f:parsenoop},516:{n:"BrtBeginVolType",f:parsenoop},517:{n:"BrtEndVolType",f:parsenoop},518:{n:"BrtBeginVolMain",f:parsenoop},519:{n:"BrtEndVolMain",f:parsenoop},520:{n:"BrtBeginVolTopic",f:parsenoop},521:{n:"BrtEndVolTopic",f:parsenoop},522:{n:"BrtVolSubtopic",f:parsenoop},523:{n:"BrtVolRef",f:parsenoop},524:{n:"BrtVo
4196:{n:"PlotGrowth",f:parse_PlotGrowth},4197:{n:"SIIndex",f:parse_SIIndex},4198:{n:"GelFrame",f:parse_GelFrame},4199:{n:"BopPopCustom",f:parse_BopPopCustom},4200:{n:"Fbi2",f:parse_Fbi2},0:{n:"Dimensions",f:parse_Dimensions},2:{n:"BIFF2INT",f:parse_BIFF2INT},5:{n:"BoolErr",f:parse_BoolErr},7:{n:"String",f:parse_BIFF2STRING},8:{n:"BIFF2ROW",f:parsenoop},11:{n:"Index",f:parse_Index},22:{n:"ExternCount",f:parsenoop},30:{n:"BIFF2FORMAT",f:parse_BIFF2Format},31:{n:"BIFF2FMTCNT",f:parsenoop},32:{n:"BIFF2COLINFO",f:parsenoop},33:{n:"Array",f:parse_Array},37:{n:"DefaultRowHeight",f:parse_DefaultRowHeight},50:{n:"BIFF2FONTXTRA",f:parse_BIFF2FONTXTRA},62:{n:"BIFF2WINDOW2",f:parsenoop},69:{n:"BIFF2FONTCLR",f:parsenoop},86:{n:"BIFF4FMTCNT",f:parsenoop},126:{n:"RK",f:parsenoop},127:{n:"ImData",f:parse_ImData},135:{n:"Addin",f:parsenoop},136:{n:"Edg",f:parsenoop},137:{n:"Pub",f:parsenoop},145:{n:"Sub",f:parsenoop},148:{n:"LHRecord",f:parsenoop},149:{n:"LHNGraph",f:parsenoop},150:{n:"Sound",f:parsenoop},169:{n:"CoordList",f:parsenoop},171:{n:"GCW",f:parsenoop},188:{n:"ShrFmla",f:parsenoop},194:{n:"AddMenu",f:parsenoop},195:{n:"DelMenu",f:parsenoop},214:{n:"RString",f:parse_RString},223:{n:"UDDesc",f:parsenoop},234:{n:"TabIdConf",f:parsenoop},354:{n:"XL5Modify",f:parsenoop},421:{n:"FileSharing2",f:parsenoop},521:{n:"BOF",f:parse_BOF},536:{n:"Lbl",f:parse_Lbl},547:{n:"ExternName",f:parse_ExternName},561:{n:"Font",f:parsenoop},1033:{n:"BOF",f:parse_BOF},2157:{n:"FeatInfo",f:parsenoop},2163:{n:"FeatInfo11",f:parsenoop},2177:{n:"SXAddl12",f:parsenoop},2240:{n:"AutoWebPub",f:parsenoop},2241:{n:"ListObj",f:parsenoop},2242:{n:"ListField",f:parsenoop},2243:{n:"ListDV",f:parsenoop},2244:{n:"ListCondFmt",f:parsenoop},2245:{n:"ListCF",f:parsenoop},2246:{n:"FMQry",f:parsenoop},2247:{n:"FMSQry",f:parsenoop},2248:{n:"PLV",f:parsenoop},2249:{n:"LnExt",f:parsenoop},2250:{n:"MkrExt",f:parsenoop},2251:{n:"CrtCoopt",f:parsenoop},67:{n:"BIFF2XF",f:parsenoop},579:{n:"BIFF3XF",f:parsenoop},1091:{n:"BIFF4XF",f:parsenoop},29282:{}};function write_biff_rec(ba,t,payload,length){var len=length||(payload||[]).length;var o=ba.next(4+len);o.write_shift(2,t);o.write_shift(2,len);if(len>0&&is_buf(payload))ba.push(payload)}function write_BOF(wb,o){if(o.bookType!="biff2")throw"unsupported BIFF version";var out=new_buf(4);out.write_shift(2,2);out.write_shift(2,16);return out}function write_BIFF2Cell(out,r,c){if(!out)out=new_buf(7);out.write_shift(2,r);out.write_shift(2,c);out.write_shift(1,0);out.write_shift(1,0);out.write_shift(1,0);return out}function write_BIFF2INT(r,c,val){var out=new_buf(9);write_BIFF2Cell(out,r,c);out.write_shift(2,val);return out}function write_BIFF2NUMBER(r,c,val){var out=new_buf(15);write_BIFF2Cell(out,r,c);out.write_shift(8,val,"f");return out}function write_BIFF2BERR(r,c,val,t){var out=new_buf(9);write_BIFF2Cell(out,r,c);if(t=="e"){out.write_shift(1,val);out.write_shift(1,1)}else{out.write_shift(1,val?1:0);out.write_shift(1,0)}return out}function write_BIFF2LABEL(r,c,val){var out=new_buf(8+2*val.length);write_BIFF2Cell(out,r,c);out.write_shift(1,val.length);out.write_shift(val.length,val,"sbcs");return out.l<out.length?out.slice(0,out.l):out}function write_ws_biff_cell(ba,cell,R,C,opts){if(cell.v!=null)switch(cell.t){case"d":case"n":var v=cell.t=="d"?datenum(cell.v):cell.v;if(v==(v|0)&&v>=0&&v<65536)write_biff_rec(ba,2,write_BIFF2INT(R,C,v));else write_biff_rec(ba,3,write_BIFF2NUMBER(R,C,v));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))}function write_biff_ws(ba,ws,idx,opts,wb){var dense=Array.isArray(ws);var range=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];for(var R=range.s.r;R<=range.e.r;++R){rr=encode_row(R);for(var C=range.s.c;C<=range.e.c;++C){if(R===range.s.r)cols[C]=encode_col(C);ref=cols[C]+rr;var cell=dense?ws[R][C]:ws[ref];if(!cell)continue;write_ws_biff_cell(ba,cell,R,C,opts)}}}function write_biff_buf(wb,opts){var o=opts||{};if(DENSE!=null&&o.dense==null)o.dense
styles:[],calcchains:[],vba:[],drawings:[],TODO:[],xmlns:""};fix_write_opts(opts=opts||{});var zip=new jszip;var f="",rId=0;opts.cellXfs=[];get_cell_style(opts.cellXfs,{},{revssf:{General:0}});if(!wb.Props)wb.Props={};f="docProps/core.xml";zip.file(f,write_core_props(wb.Props,opts));ct.coreprops.push(f);add_rels(opts.rels,2,f,RELS.CORE_PROPS);f="docProps/app.xml";if(wb.Props&&wb.Props.SheetNames){}else if(!wb.Workbook||!wb.Workbook.Sheets)wb.Props.SheetNames=wb.SheetNames;else wb.Props.SheetNames=wb.SheetNames.map(function(x,i){return[(wb.Workbook.Sheets[i]||{}).Hidden!=2,x]}).filter(function(x){return x[0]}).map(function(x){return x[1]});wb.Props.Worksheets=wb.Props.SheetNames.length;zip.file(f,write_ext_props(wb.Props,opts));ct.extprops.push(f);add_rels(opts.rels,3,f,RELS.EXT_PROPS);if(wb.Custprops!==wb.Props&&keys(wb.Custprops||{}).length>0){f="docProps/custom.xml";zip.file(f,write_cust_props(wb.Custprops,opts));ct.custprops.push(f);add_rels(opts.rels,4,f,RELS.CUST_PROPS)}f="xl/workbook."+wbext;zip.file(f,write_wb(wb,f,opts));ct.workbooks.push(f);add_rels(opts.rels,1,f,RELS.WB);for(rId=1;rId<=wb.SheetNames.length;++rId){var wsrels={"!id":{}};var ws=wb.Sheets[wb.SheetNames[rId-1]];var _type=(ws||{})["!type"]||"sheet";switch(_type){case"chart":default:f="xl/worksheets/sheet"+rId+"."+wbext;zip.file(f,write_ws(rId-1,f,opts,wb,wsrels));ct.sheets.push(f);add_rels(opts.wbrels,-1,"worksheets/sheet"+rId+"."+wbext,RELS.WS[0])}if(ws){var comments=ws["!comments"];if(comments&&comments.length>0){var cf="xl/comments"+rId+"."+wbext;zip.file(cf,write_cmnt(comments,cf,opts));ct.comments.push(cf);add_rels(wsrels,-1,"../comments"+rId+"."+wbext,RELS.CMNT)}if(ws["!legacy"]){zip.file("xl/drawings/vmlDrawing"+rId+".vml",write_comments_vml(rId,ws["!comments"]))}delete ws["!comments"];delete ws["!legacy"]}if(wsrels["!id"].rId1)zip.file(get_rels_path(f),write_rels(wsrels))}if(opts.Strings!=null&&opts.Strings.length>0){f="xl/sharedStrings."+wbext;zip.file(f,write_sst(opts.Strings,f,opts));ct.strs.push(f);add_rels(opts.wbrels,-1,"sharedStrings."+wbext,RELS.SST)}f="xl/theme/theme1.xml";zip.file(f,write_theme(wb.Themes,opts));ct.themes.push(f);add_rels(opts.wbrels,-1,"theme/theme1.xml",RELS.THEME);f="xl/styles."+wbext;zip.file(f,write_sty(wb,f,opts));ct.styles.push(f);add_rels(opts.wbrels,-1,"styles."+wbext,RELS.STY);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));delete opts.revssf;delete opts.ssf;return zip}function firstbyte(f,o){var x="";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:throw new Error("Unrecognized type "+(o?o.type:"undefined"))}return[x.charCodeAt(0),x.charCodeAt(1),x.charCodeAt(2),x.charCodeAt(3)]}function read_cfb(cfb,opts){if(cfb.find("EncryptedPackage"))return parse_xlsxcfb(cfb,opts);return parse_xlscfb(cfb,opts)}function read_zip(data,opts){var zip,d=data;var o=opts||{};if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";switch(o.type){case"base64":zip=new jszip(d,{base64:true});break;case"binary":case"array":zip=new jszip(d,{base64:false});break;case"buffer":zip=new jszip(d);break;default:throw new Error("Unrecognized type "+o.type)}return parse_zip(zip,o)}function read_utf16(data,o){var d=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)return parse_xlml(d,o);return PRN.to_workbook(d,o)}function readSync(data,opts){var zip,d=data,n=[0];var o=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]){case 208:return read_cfb(CFB.read(d,o),o);case 9:return parse_xlscfb(s2a(o.type==="base64"?Ba