varJSZip=function(data,options){this.files={};this.root="";if(data){this.load(data,options)}};JSZip.signature={LOCAL_FILE_HEADER:"PK",CENTRAL_FILE_HEADER:"PK",CENTRAL_DIRECTORY_END:"PK",ZIP64_CENTRAL_DIRECTORY_LOCATOR:"PK",ZIP64_CENTRAL_DIRECTORY_END:"PK",DATA_DESCRIPTOR:"PK\b"};JSZip.defaults={base64:false,binary:false,dir:false,date:null,compression:null};JSZip.support={arraybuffer:function(){returntypeofArrayBuffer!=="undefined"&&typeofUint8Array!=="undefined"}(),nodebuffer:function(){returntypeofBuffer!=="undefined"}(),uint8array:function(){returntypeofUint8Array!=="undefined"}(),blob:function(){if(typeofArrayBuffer==="undefined"){returnfalse}varbuffer=newArrayBuffer(0);try{returnnewBlob([buffer],{type:"application/zip"}).size===0}catch(e){}try{varBlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;varbuilder=newBlobBuilder;builder.append(buffer);returnbuilder.getBlob("application/zip").size===0}catch(e){}returnfalse}()};JSZip.prototype=function(){vartextEncoder,textDecoder;if(JSZip.support.uint8array&&typeofTextEncoder==="function"&&typeofTextDecoder==="function"){textEncoder=newTextEncoder("utf-8");textDecoder=newTextDecoder("utf-8")}vargetRawData=function(file){if(file._datainstanceofJSZip.CompressedObject){file._data=file._data.getContent();file.options.binary=true;file.options.base64=false;if(JSZip.utils.getTypeOf(file._data)==="uint8array"){varcopy=file._data;file._data=newUint8Array(copy.length);if(copy.length!==0){file._data.set(copy,0)}}}returnfile._data};vargetBinaryData=function(file){varresult=getRawData(file),type=JSZip.utils.getTypeOf(result);if(type==="string"){if(!file.options.binary){if(textEncoder){returntextEncoder.encode(result)}if(JSZip.support.nodebuffer){returnnewBuffer(result,"utf-8")}}returnfile.asBinary()}returnresult};vardataToString=function(asUTF8){varresult=getRawData(this);if(result===null||typeofresult==="undefined"){return""}if(this.options.base64){result=JSZip.base64.decode(result)}if(asUTF8&&this.options.binary){result=JSZip.prototype.utf8decode(result)}else{result=JSZip.utils.transformTo("string",result)}if(!asUTF8&&!this.options.binary){result=JSZip.prototype.utf8encode(result)}returnresult};varZipObject=function(name,data,options){this.name=name;this._data=data;this.options=options};ZipObject.prototype={asText:function(){returndataToString.call(this,true)},asBinary:function(){returndataToString.call(this,false)},asNodeBuffer:function(){varresult=getBinaryData(this);returnJSZip.utils.transformTo("nodebuffer",result)},asUint8Array:function(){varresult=getBinaryData(this);returnJSZip.utils.transformTo("uint8array",result)},asArrayBuffer:function(){returnthis.asUint8Array().buffer}};vardecToHex=function(dec,bytes){varhex="",i;for(i=0;i<bytes;i++){hex+=String.fromCharCode(dec&255);dec=dec>>>8}returnhex};varextend=function(){varresult={},i,attr;for(i=0;i<arguments.length;i++){for(attrinarguments[i]){if(arguments[i].hasOwnProperty(attr)&&typeofresult[attr]==="undefined"){result[attr]=arguments[i][attr]}}}returnresult};varprepareFileAttrs=function(o){o=o||{};if(o.base64===true&&o.binary==null){o.binary=true}o=extend(o,JSZip.defaults);o.date=o.date||newDate;if(o.compression!==null)o.compression=o.compression.toUpperCase();returno};varfileAdd=function(name,data,o){varparent=parentFolder(name),dataType=JSZip.utils.getTypeOf(data);if(parent){folderAdd.call(this,parent)}o=prepareFileAttrs(o);if(o.dir||data===null||typeofdata==="undefined"){o.base64=false;o.binary=false;data=null}elseif(dataType==="string"){if(o.binary&&!o.base64){if(o.optimizedBinaryString!==true){data=JSZip.utils.string2binary(data)}}}else{o.base64=false;o.binary=true;if(!dataType&&!(datainstanceofJSZip.CompressedObject)){thrownewError("The data of '"+name+"' is in an unsupported format !")}if(dataType==="arraybuffer"){data=JSZip.utils.transformTo("uint8array",data)}}varobject=newZipObject(name,data,o);this.files[name]=object;returnobject};varparentFolder=function(path){if(path.slice(-1)=="/"
while("0123456789".indexOf(fmt[++i])>-1)o+=fmt[i];out.push({t:"D",v:o});break;case" ":out.push({t:c,v:c});++i;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxz".indexOf(c)===-1)throw"unrecognized character "+fmt[i]+" in "+fmt;out.push({t:"t",v:c});++i;break}}varbt=0,ss0=0,ssm;for(i=out.length-1,lst="t";i>=0;--i){switch(out[i].t){case"h":case"H":out[i].t=hr;lst="h";if(bt<1)bt=1;break;case"s":if(ssm=out[i].v.match(/\.0+$/))ss0=Math.max(ss0,ssm[0].length-1);if(bt<3)bt=3;case"d":case"y":case"M":case"e":lst=out[i].t;break;case"m":if(lst==="s"){out[i].t="M";if(bt<2)bt=2}break;case"X":if(out[i].v==="B2");break;case"Z":if(bt<1&&out[i].v.match(/[Hh]/))bt=1;if(bt<2&&out[i].v.match(/[Mm]/))bt=2;if(bt<3&&out[i].v.match(/[Ss]/))bt=3}}switch(bt){case0:break;case1:if(dt.u>=.5){dt.u=0;++dt.S}if(dt.S>=60){dt.S=0;++dt.M}if(dt.M>=60){dt.M=0;++dt.H}break;case2:if(dt.u>=.5){dt.u=0;++dt.S}if(dt.S>=60){dt.S=0;++dt.M}break}varnstr="",jj;for(i=0;i<out.length;++i){switch(out[i].t){case"t":case"T":case" ":case"D":break;case"X":deleteout[i];break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":out[i].v=write_date(out[i].t,out[i].v,dt,ss0);out[i].t="t";break;case"n":case"(":case"?":jj=i+1;while(out[jj]&&("?D".indexOf(out[jj].t)>-1||" t".indexOf(out[jj].t)>-1&&"?t".indexOf((out[jj+1]||{}).t)>-1&&(out[jj+1].t=="?"||out[jj+1].v=="/")||out[i].t=="("&&")n ".indexOf(out[jj].t)>-1||out[jj].t=="t"&&(out[jj].v=="/"||"$€".indexOf(out[jj].v)>-1||out[jj].v==" "&&(out[jj+1]||{}).t=="?"))){out[i].v+=out[jj].v;deleteout[jj];++jj}nstr+=out[i].v;i=jj-1;break;case"G":out[i].t="t";out[i].v=general_fmt(v,opts);break}}if(nstr){varostr=write_num(nstr[0]=="("?"(":"n",nstr,v<0&&nstr[0]=="-"?-v:v);jj=ostr.length-1;vardecpt=out.length;for(i=0;i<out.length;++i)if(out[i]&&out[i].v.indexOf(".")>-1){decpt=i;break}varlasti=out.length,vv;if(decpt===out.length&&!ostr.match(/E/)){for(i=out.length-1;i>=0;--i){if(!out[i]||"n?(".indexOf(out[i].t)===-1)continue;vv=out[i].v.split("");for(j=vv.length-1;j>=0;--j){if(jj>=0)vv[j]=ostr[jj--];elsevv[j]=""}out[i].v=vv.join("");out[i].t="t";lasti=i}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v}elseif(decpt!==out.length&&!ostr.match(/E/)){jj=ostr.indexOf(".")-1;for(i=decpt;i>=0;--i){if(!out[i]||"n?(".indexOf(out[i].t)===-1)continue;vv=out[i].v.split("");for(j=out[i].v.indexOf(".")>-1&&i==decpt?out[i].v.indexOf(".")-1:vv.length-1;j>=0;--j){if(jj>=0&&"0#".indexOf(vv[j])>-1)vv[j]=ostr[jj--];elsevv[j]=""}out[i].v=vv.join("");out[i].t="t";lasti=i}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v;jj=ostr.indexOf(".")+1;for(i=decpt;i<out.length;++i){if(!out[i]||"n?(".indexOf(out[i].t)===-1&&i!=decpt)continue;vv=out[i].v.split("");for(j=out[i].v.indexOf(".")>-1&&i==decpt?out[i].v.indexOf(".")+1:0;j<vv.length;++j){if(jj<ostr.length)vv[j]=ostr[jj++];elsevv[j]=""}out[i].v=vv.join("");out[i].t="t";lasti=i}}}for(i=0;i<out.length;++i)if(out[i]&&"n(?".indexOf(out[i].t)>-1){out[i].v=write_num(out[i].t,out[i].v,flen>1&&v<0&&i>0&&out[i-1].v=="-"?-v:v);out[i].t="t"}varretval="";for(i=0;i!=out.length;++i)if(out[i])retval+=out[i].v;returnretval}SSF._eval=eval_fmt;functionchoose_fmt(fmt,v,o){if(typeoffmt==="number")fmt=(o&&o.table?o.table:table_fmt)[fmt];if(typeoffmt==="string")fmt=split_fmt(fmt);varl=fmt.length;if(l<4&&fmt[l-1].indexOf("@")>-1)--l;switch(fmt.length){case1:fmt=fmt[0].indexOf("@")>-1?["General","General","General",fmt[0]]:[fmt[0],fmt[0],fmt[0],"@"];break;case2:fmt=fmt[1].indexOf("@")>-1?[fmt[0],fmt[0],fmt[0],fmt[1]]:[fmt[0],fmt[1],fmt[0],"@"];break;case3:fmt=fmt[2].indexOf("@")>-1?[fmt[0],fmt[1],fmt[0],fmt[2]]:[fmt[0],fmt[1],fmt[2],"@"];break;case4:break;default:throw"cannot find right format for |"+fmt+"|"}if(typeofv!=="number")return[fmt.length,fmt[3]];varff=v>0?fmt[0]:v<0?fmt[1]:fmt[2];if(fmt[0].match(/\[[=<>]/)||fmt[1].match(/\[[=<>]/)){varchk=function(v,rr,out){if(!rr)returnnull;varfound=false;varthresh=Number(rr[2]);switch(rr[1]){case"=":if(v==thresh)found=true;break;case">":if(v>thresh)found=true;break;case"<":if(v<thresh)fou
break;case"r4":case"r8":case"decimal":p[name]=parseFloat(text);break;case"filetime":case"date":p[name]=newDate(text);break;case"cy":case"error":p[name]=unescapexml(text);break;default:console.warn("Unexpected",x,type,toks)}}elseif(x.substr(0,2)==="</"){}elseif(opts.WTF)thrownewError(x)}});returnp}varCUST_PROPS_XML_ROOT=writextag("Properties",null,{xmlns:XMLNS.CUST_PROPS,"xmlns:vt":XMLNS.vt});functionwrite_cust_props(cp,opts){varo=[],p={};o.push(XML_HEADER);o.push(CUST_PROPS_XML_ROOT);if(!cp)returno.join("");varpid=1;keys(cp).forEach(function(k){++pid;o.push(writextag("property",write_vt(cp[k]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:pid,name:k}))});if(o.length>2){o.push("</Properties>");o[1]=o[1].replace("/>",">")}returno.join("")}varCS2CP={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969};varparse_rs=function(){vartregex=matchtag("t"),rpregex=matchtag("rPr");varparse_rpr=function(rpr,intro,outro){varfont={},cp=65001;(rpr.match(/<[^>]*>/g)||[]).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<condense":break;case"<extend":break;case"<shadow":case"<shadow/>":break;case"<charset":if(y.val=="1")break;cp=CS2CP[parseInt(y.val,10)];break;case"<outline":case"<outline/>":break;case"<rFont":font.name=y.val;break;case"<sz":font.sz=y.val;break;case"<strike":if(!y.val)break;case"<strike/>":font.strike=1;break;case"</strike>":break;case"<u":if(!y.val)break;case"<u/>":font.u=1;break;case"</u>":break;case"<b":if(!y.val)break;case"<b/>":font.b=1;break;case"</b>":break;case"<i":if(!y.val)break;case"<i/>":font.i=1;break;case"</i>":break;case"<color":if(y.rgb)font.color=y.rgb.substr(2,6);break;case"<family":font.family=y.val;break;case"<vertAlign":break;case"<scheme":break;default:if(y[0][2]!=="/")throw"Unrecognized rich format "+y[0]}});varstyle=[];if(font.b)style.push("font-weight: bold;");if(font.i)style.push("font-style: italic;");intro.push('<span style="'+style.join("")+'">');outro.push("</span>");returncp};functionparse_r(r){varterms=[[],"",[]];vart=r.match(tregex),cp=65001;if(!isval(t))return"";terms[1]=t[1];varrpr=r.match(rpregex);if(isval(rpr))cp=parse_rpr(rpr[1],terms[0],terms[2]);returnterms[0].join("")+terms[1].replace(/\r\n/g,"<br/>")+terms[2].join("")}returnfunction(rs){returnrs.replace(/<r>/g,"").split(/<\/r>/).map(parse_r).join("")}}();varparse_si=function(x,opts){varhtml=opts?opts.cellHTML:true;varz={};if(!x)returnnull;vary;if(x.charCodeAt(1)===116){z.t=utf8read(unescapexml(x.substr(x.indexOf(">")+1).split(/<\/t>/)[0]));z.r=x;if(html)z.h=z.t}elseif(y=x.match(/<r>/)){z.r=x;z.t=utf8read(unescapexml(x.replace(/<[^>]*>/gm,"")));if(html)z.h=parse_rs(x)}returnz};varparse_sst_xml=function(data,opts){vars=[];varsst=data.match(newRegExp("<sst([^>]*)>([\\s\\S]*)</sst>","m"));if(isval(sst)){s=sst[2].replace(/<(?:si|sstItem)>/g,"").split(/<\/(?:si|sstItem)>/).map(function(x){returnparse_si(x,opts)}).filter(function(x){returnx});sst=parsexmltag(sst[1]);s.Count=sst.count;s.Unique=sst.uniqueCount}returns};RELS.SST="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";varwrite_sst_xml=function(sst,opts){if(!opts.bookSST)return"";varo=[];o.push(XML_HEADER);o.push(writextag("sst",null,{xmlns:XMLNS.main[0],count:sst.Count,uniqueCount:sst.Unique}));sst.forEach(function(s){varsitag="<si>";if(s.r)sitag+=s.r;else{sitag+="<t";if(s.t.match(/^\s|\s$|[\t\n\r]/))sitag+=' xml:space="preserve"';sitag+=">";sitag+=escapexml(s.t);sitag+="</t>"}sitag+="</si>";o.push(sitag)});if(o.length>2){o.push("</sst>");o[1]=o[1].replace("/>",">")}returno.join("")};varparse_BrtBeginSst=function(data,length){return[data.read_shift(4),data.read_shift(4)]};varparse_sst_bin=function(data,opts){vars=[];varpass=false;recordhopper(data,function(val,R,RT){switch(R.n){case"BrtBeginSst":s.Count=val[0];s.Unique=val[1];break;case"BrtSSTItem":s.push(val);break;case"BrtEndSst":returntrue;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;default:if(
varevert_RE=evert(RecordEnum,"n");functionfix_opts(defaults){returnfunction(opts){defaults.forEach(function(d){if(typeofopts[d[0]]==="undefined")opts[d[0]]=d[1];if(d[2]==="n")opts[d[0]]=Number(opts[d[0]])})}}varfix_read_opts=fix_opts([["cellNF",false],["cellHTML",true],["cellFormula",true],["cellStyles",false],["sheetStubs",false],["sheetRows",0,"n"],["bookDeps",false],["bookSheets",false],["bookProps",false],["bookFiles",false],["bookVBA",false],["WTF",false]]);varfix_write_opts=fix_opts([["bookSST",false],["bookType","xlsx"],["WTF",false]]);functionsafe_parse_wbrels(wbrels,sheets){if(!wbrels)return0;try{wbrels=sheets.map(function(w){return[w.name,wbrels["!id"][w.id].Target]})}catch(e){returnnull}return!wbrels||wbrels.length===0?null:wbrels}functionsafe_parse_ws(zip,path,relsPath,sheet,sheetRels,sheets,opts){try{sheetRels[sheet]=parse_rels(getzipdata(zip,relsPath,true),path);sheets[sheet]=parse_ws(getzipdata(zip,path),path,opts,sheetRels[sheet])}catch(e){if(opts.WTF)throwe}}functionparse_zip(zip,opts){make_ssf(SSF);opts=opts||{};fix_read_opts(opts);reset_cp();varentries=keys(zip.files).filter(function(x){returnx.substr(-1)!="/"}).sort();vardir=parse_ct(getzipdata(zip,"[Content_Types].xml"),opts);varxlsb=false;varsheets,binname;if(dir.workbooks.length===0){binname="xl/workbook.xml";if(getzipdata(zip,binname,true))dir.workbooks.push(binname)}if(dir.workbooks.length===0){binname="xl/workbook.bin";if(!getzipfile(zip,binname,true))thrownewError("Could not find workbook");dir.workbooks.push(binname);xlsb=true}if(dir.workbooks[0].substr(-3)=="bin")xlsb=true;if(xlsb)set_cp(1200);if(!opts.bookSheets&&!opts.bookProps){strs=[];if(dir.sst)strs=parse_sst(getzipdata(zip,dir.sst.replace(/^\//,"")),dir.sst,opts);styles={};if(dir.style)styles=parse_sty(getzipdata(zip,dir.style.replace(/^\//,"")),dir.style,opts);themes={};if(opts.cellStyles&&dir.themes.length)themes=parse_theme(getzipdata(zip,dir.themes[0].replace(/^\//,""),true),dir.themes[0],opts)}varwb=parse_wb(getzipdata(zip,dir.workbooks[0].replace(/^\//,"")),dir.workbooks[0],opts);varprops={},propdata="";if(dir.coreprops.length!==0){propdata=getzipdata(zip,dir.coreprops[0].replace(/^\//,""),true);if(propdata)props=parse_core_props(propdata);if(dir.extprops.length!==0){propdata=getzipdata(zip,dir.extprops[0].replace(/^\//,""),true);if(propdata)parse_ext_props(propdata,props)}}varcustprops={};if(!opts.bookSheets||opts.bookProps){if(dir.custprops.length!==0){propdata=getzipdata(zip,dir.custprops[0].replace(/^\//,""),true);if(propdata)custprops=parse_cust_props(propdata,opts)}}varout={};if(opts.bookSheets||opts.bookProps){if(props.Worksheets&&props.SheetNames.length>0)sheets=props.SheetNames;elseif(wb.Sheets)sheets=wb.Sheets.map(function(x){returnx.name});if(opts.bookProps){out.Props=props;out.Custprops=custprops}if(typeofsheets!=="undefined")out.SheetNames=sheets;if(opts.bookSheets?out.SheetNames:opts.bookProps)returnout}sheets={};vardeps={};if(opts.bookDeps&&dir.calcchain)deps=parse_cc(getzipdata(zip,dir.calcchain.replace(/^\//,"")),dir.calcchain,opts);vari=0;varsheetRels={};varpath,relsPath;if(!props.Worksheets){varwbsheets=wb.Sheets;props.Worksheets=wbsheets.length;props.SheetNames=[];for(varj=0;j!=wbsheets.length;++j){props.SheetNames[j]=wbsheets[j].name}}varwbext=xlsb?"bin":"xml";varwbrelsfile="xl/_rels/workbook."+wbext+".rels";varwbrels=parse_rels(getzipdata(zip,wbrelsfile,true),wbrelsfile);if(wbrels)wbrels=safe_parse_wbrels(wbrels,wb.Sheets);varnmode=getzipdata(zip,"xl/worksheets/sheet.xml",true)?1:0;for(i=0;i!=props.Worksheets;++i){if(wbrels)path="xl/"+wbrels[i][1].replace(/[\/]?xl\//,"");else{path="xl/worksheets/sheet"+(i+1-nmode)+"."+wbext;path=path.replace(/sheet0\./,"sheet.")}relsPath=path.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels");safe_parse_ws(zip,path,relsPath,props.SheetNames[i],sheetRels,sheets,opts)}if(dir.comments)parse_comments(zip,dir.comments,sheets,sheetRels,opts);out={Directory:dir,Workbook:wb,Props:props,Custprops:custprops,Deps:deps,Sheets:sheets,SheetNames:props.SheetNames,Strings:strs,Styles:styles,Themes:themes,S