var_l=[["activeTab",0,"int"],["autoFilterDateGrouping",true,"bool"],["firstSheet",0,"int"],["minimized",false,"bool"],["showHorizontalScroll",true,"bool"],["showSheetTabs",true,"bool"],["showVerticalScroll",true,"bool"],["tabRatio",600,"int"],["visibility","visible"]];varAl=[];varFl=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];functionEl(e,r){for(vart=0;t!=e.length;++t){vara=e[t];for(varn=0;n!=r.length;++n){vars=r[n];if(a[s[0]]==null)a[s[0]]=s[1];elseswitch(s[2]){case"bool":if(typeofa[s[0]]=="string")a[s[0]]=ct(a[s[0]]);break;case"int":if(typeofa[s[0]]=="string")a[s[0]]=parseInt(a[s[0]],10);break;}}}}functionTl(e,r){for(vart=0;t!=r.length;++t){vara=r[t];if(e[a[0]]==null)e[a[0]]=a[1];elseswitch(a[2]){case"bool":if(typeofe[a[0]]=="string")e[a[0]]=ct(e[a[0]]);break;case"int":if(typeofe[a[0]]=="string")e[a[0]]=parseInt(e[a[0]],10);break;}}}functionDl(e){Tl(e.WBProps,Cl);Tl(e.CalcPr,Fl);El(e.WBView,_l);El(e.Sheets,Al);Pi.date1904=ct(e.WBProps.date1904)}functionOl(e){if(!e.Workbook)return"false";if(!e.Workbook.WBProps)return"false";returnct(e.Workbook.WBProps.date1904)?"true":"false"}varMl="][*?/\\".split("");functionNl(e,r){if(e.length>31){if(r)returnfalse;thrownewError("Sheet names cannot exceed 31 chars")}vart=true;Ml.forEach(function(a){if(e.indexOf(a)==-1)return;if(!r)thrownewError("Sheet name cannot contain : \\ / ? * [ ]");t=false});returnt}functionPl(e,r,t){e.forEach(function(a,n){Nl(a);for(vars=0;s<n;++s)if(a==e[s])thrownewError("Duplicate Sheet Name: "+a);if(t){vari=r&&r[n]&&r[n].CodeName||a;if(i.charCodeAt(0)==95&&i.length>22)thrownewError("Bad Code Name: Worksheet"+i)}})}functionIl(e){if(!e||!e.SheetNames||!e.Sheets)thrownewError("Invalid Workbook");if(!e.SheetNames.length)thrownewError("Workbook is empty");varr=e.Workbook&&e.Workbook.Sheets||[];Pl(e.SheetNames,r,!!e.vbaraw);for(vart=0;t<e.SheetNames.length;++t)Wi(e.Sheets[e.SheetNames[t]],e.SheetNames[t],t);e.SheetNames.forEach(function(r,t){vara=e.Sheets[r];if(!a||!a["!autofilter"])return;varn;if(!e.Workbook)e.Workbook={};if(!e.Workbook.Names)e.Workbook.Names=[];e.Workbook.Names.forEach(function(e){if(e.Name=="_xlnm._FilterDatabase"&&e.Sheet==t)n=e});vars=za(r)+"!"+Ba(a["!autofilter"].ref);if(n)n.Ref=s;elsee.Workbook.Names.push({Name:"_xlnm._FilterDatabase",Sheet:t,Ref:s})})}varRl=/<\w+:workbook/;functionLl(e,r){if(!e)thrownewError("Could not find file");vart={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},Names:[],xmlns:""};vara=false,n="xmlns";vars={},i=0;e.replace(Xr,functionl(o,c){varf=Jr(o);switch(Kr(f[0])){case"<?xml":break;case"<workbook":if(o.match(Rl))n="xmlns"+o.match(/<(\w+):/)[1];t.xmlns=f[n];break;case"</workbook>":break;case"<fileVersion":deletef[0];t.AppVersion=f;break;case"<fileVersion/>":;case"</fileVersion>":break;case"<fileSharing":break;case"<fileSharing/>":break;case"<workbookPr":;case"<workbookPr/>":Cl.forEach(function(e){if(f[e[0]]==null)return;switch(e[2]){case"bool":t.WBProps[e[0]]=ct(f[e[0]]);break;case"int":t.WBProps[e[0]]=parseInt(f[e[0]],10);break;default:t.WBProps[e[0]]=f[e[0]];}});if(f.codeName)t.WBProps.CodeName=mt(f.codeName);break;case"</workbookPr>":break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews":;case"<bookViews>":;case"</bookViews>":break;case"<workbookView":;case"<workbookView/>":deletef[0];t.WBView.push(f);break;case"</workbookView>":break;case"<sheets":;case"<sheets>":;case"</sheets>":break;case"<sheet":switch(f.state){case"hidden":f.Hidden=1;break;case"veryHidden":f.Hidden=2;break;default:f.Hidden=0;}deletef.state;f.name=Qr(mt(f.name));deletef[0];t.Sheets.push(f);break;case"</sheet>":break;case"<functionGroups":;case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":;case"</externalReferences>":;case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames
break;case"ddd":;case"dddd":a+='<number:day-of-week number:style="'+(s.length%2?"short":"long")+'"/>';break;}break;case'"':while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+tt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+tt(s)+"</number:text>";break;default:console.error("unrecognized character "+s+" in ODF format "+e);}if(!o)breake;e=e.slice(i+1);i=0}if(e.match(/^\[?[hms]/)){if(t=="number")t="time";if(e.match(/\[/)){e=e.replace(/[\[\]]/g,"");n["number:truncate-on-overflow"]="false"}for(;i<e.length;++i)switch(s=e[i].toLowerCase()){case"h":;case"m":;case"s":while((e[++i]||"").toLowerCase()==s[0])s+=s[0];--i;switch(s){case"h":;case"hh":a+='<number:hours number:style="'+(s.length%2?"short":"long")+'"/>';break;case"m":;case"mm":a+='<number:minutes number:style="'+(s.length%2?"short":"long")+'"/>';break;case"s":;case"ss":if(e[i+1]==".")do{s+=e[i+1];++i}while(e[i+1]=="0");a+='<number:seconds number:style="'+(s.match("ss")?"long":"short")+'"'+(s.match(/\./)?' number:decimal-places="'+(s.match(/0+/)||[""])[0].length+'"':"")+"/>";break;}break;case'"':while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+tt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+tt(s)+"</number:text>";break;case"a":if(e.slice(i,i+3).toLowerCase()=="a/p"){a+="<number:am-pm/>";i+=2;break}if(e.slice(i,i+5).toLowerCase()=="am/pm"){a+="<number:am-pm/>";i+=4;break};default:console.error("unrecognized character "+s+" in ODF format "+e);}breake}if(e.indexOf(/\$/)>-1){t="currency"}if(e[0]=="$"){a+='<number:currency-symbol number:language="en" number:country="US">$</number:currency-symbol>';e=e.slice(1);i=0}i=0;if(e[i]=='"'){while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;if(e[i+1]=="*"){i++;a+="<number:fill-character>"+tt(s.replace(/""/g,'"'))+"</number:fill-character>"}else{a+="<number:text>"+tt(s.replace(/""/g,'"'))+"</number:text>"}e=e.slice(i+1);i=0}varf=e.match(/([#0][0#,]*)(\.[0#]*|)(E[+]?0*|)/i);if(!f||!f[0])console.error("Could not find numeric part of "+e);else{varu=f[1].replace(/,/g,"");a+="<number:"+(f[3]?"scientific-":"")+"number"+' number:min-integer-digits="'+(u.indexOf("0")==-1?"0":u.length-u.indexOf("0"))+'"'+(f[0].indexOf(",")>-1?' number:grouping="true"':"")+(f[2]&&' number:decimal-places="'+(f[2].length-1)+'"'||' number:decimal-places="0"')+(f[3]&&f[3].indexOf("+")>-1?' number:forced-exponent-sign="true"':"")+(f[3]?' number:min-exponent-digits="'+f[3].match(/0+/)[0].length+'"':"")+">"+"</number:"+(f[3]?"scientific-":"")+"number>";i=f.index+f[0].length}if(e[i]=='"'){s="";while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+tt(s.replace(/""/g,'"'))+"</number:text>"}}if(!a){console.error("Could not generate ODS number format for |"+e+"|");return""}return_t("number:"+t+"-style",a,n)}functionvo(e,r,t){vara=e.filter(function(e){returne.Sheet==(t==-1?null:t)});if(!a.length)return"";return" <table:named-expressions>\n"+a.map(function(e){varr=Mi(e.Ref);return" "+_t("table:named-range",null,{"table:name":e.Name,"table:cell-range-address":r,"table:base-cell-address":r.replace(/[\.]?[^\.]*$/,".$A$1")})}).join("\n")+"\n </table:named-expressions>\n"}vargo=function(){vare=function(e){returntt(e).replace(/ +/g,function(e){return'<text:s text:c="'+e.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")};varr=" <table:table-cell />\n";vart=" <table:covered-table-cell/>\n";vara=function(a,n,s,i,l){varo=[];o.push(' <table:table table:name="'+tt(n.SheetNames[s])+'" table:style-name="ta1">\n');varc=0,f=0,u=Ra(a["!ref"]||"A1");varh=a["!merges"]||[],d=0;varm=Array.isArray(a);if(a["!cols"]){for(f=0;f<=u.e.c;++f)o.push(" <table:table-column"+(a["!cols"][f]?' table:style-name="co'+a["!cols"][f].ods+'"':"")+"></table:table-column>\n")}varp="",v=a["!rows"]||[];for(c=0;c<u.s.r;++c){p=v[c]?' table:style-name="ro'+v[c].ods+'"':"";o.push(" <table:table-row"+p+"></table:table-row>\n")}for(;c<=u.e.r;++c){p=v[c]?' table:style-name="ro'+v[
returnXo(bo(e,t),t);case"wk1":returnYo(WK_.sheet_to_wk1(e.Sheets[e.SheetNames[n]],t),t);case"wk3":returnYo(WK_.book_to_wk3(e,t),t);case"biff2":if(!t.biff)t.biff=2;case"biff3":if(!t.biff)t.biff=3;case"biff4":if(!t.biff)t.biff=4;returnYo(write_biff_buf(e,t),t);case"biff5":if(!t.biff)t.biff=5;case"biff8":;case"xla":;case"xls":if(!t.biff)t.biff=8;returnVo(e,t);case"xlsx":;case"xlsm":;case"xlam":;case"xlsb":;case"numbers":;case"ods":returnUo(e,t);default:thrownewError("Unrecognized bookType |"+t.bookType+"|");}}functionZo(e){if(e.bookType)return;varr={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"};vart=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();if(t.match(/^\.[a-z]+$/))e.bookType=t.slice(1);e.bookType=r[e.bookType]||e.bookType}functionqo(e,r,t){vara=t||{};a.type="file";a.file=r;Zo(a);returnKo(e,a)}functionQo(e,r,t){vara=t||{};a.type="file";a.file=r;Zo(a);returnJo(e,a)}functionec(e,r,t,a){varn=t||{};n.type="file";n.file=e;Zo(n);n.type="buffer";vars=a;if(!(sinstanceofFunction))s=t;returnQe.writeFile(e,Ko(r,n),s)}functionrc(e,r,t,a,n,s,i,l){varo=Aa(t);varc=l.defval,f=l.raw||!Object.prototype.hasOwnProperty.call(l,"raw");varu=true;varh=n===1?[]:{};if(n!==1){if(Object.defineProperty)try{Object.defineProperty(h,"__rowNum__",{value:t,enumerable:false})}catch(d){h.__rowNum__=t}elseh.__rowNum__=t}if(!i||e[t])for(varm=r.s.c;m<=r.e.c;++m){varp=i?e[t][m]:e[a[m]+o];if(p===undefined||p.t===undefined){if(c===undefined)continue;if(s[m]!=null){h[s[m]]=c}continue}varv=p.v;switch(p.t){case"z":if(v==null)break;continue;case"e":v=v==0?null:void0;break;case"s":;case"d":;case"b":;case"n":break;default:thrownewError("unrecognized type "+p.t);}if(s[m]!=null){if(v==null){if(p.t=="e"&&v===null)h[s[m]]=null;elseif(c!==undefined)h[s[m]]=c;elseif(f&&v===null)h[s[m]]=null;elsecontinue}else{h[s[m]]=f&&(p.t!=="n"||p.t==="n"&&l.rawNumbers!==false)?v:Ua(p,v,l)}if(v!=null)u=false}}return{row:h,isempty:u}}functiontc(e,r){if(e==null||e["!ref"]==null)return[];vart={t:"n",v:0},a=0,n=1,s=[],i=0,l="";varo={s:{r:0,c:0},e:{r:0,c:0}};varc=r||{};varf=c.range!=null?c.range:e["!ref"];if(c.header===1)a=1;elseif(c.header==="A")a=2;elseif(Array.isArray(c.header))a=3;elseif(c.header==null)a=0;switch(typeoff){case"string":o=$a(f);break;case"number":o=$a(e["!ref"]);o.s.r=f;break;default:o=f;}if(a>0)n=0;varu=Aa(o.s.r);varh=[];vard=[];varm=0,p=0;varv=Array.isArray(e);varg=o.s.r,b=0;varw={};if(v&&!e[g])e[g]=[];vark=c.skipHidden&&e["!cols"]||[];vary=c.skipHidden&&e["!rows"]||[];for(b=o.s.c;b<=o.e.c;++b){if((k[b]||{}).hidden)continue;h[b]=Da(b);t=v?e[g][b]:e[h[b]+u];switch(a){case1:s[b]=b-o.s.c;break;case2:s[b]=h[b];break;case3:s[b]=c.header[b-o.s.c];break;default:if(t==null)t={w:"__EMPTY",t:"s"};l=i=Ua(t,null,c);p=w[i]||0;if(!p)w[i]=1;else{do{l=i+"_"+p++}while(w[l]);w[i]=p;w[l]=1}s[b]=l;}}for(g=o.s.r+n;g<=o.e.r;++g){if((y[g]||{}).hidden)continue;varx=rc(e,o,g,h,a,s,v,c);if(x.isempty===false||(a===1?c.blankrows!==false:!!c.blankrows))d[m++]=x.row}d.length=m;returnd}varac=/"/g;functionnc(e,r,t,a,n,s,i,l){varo=true;varc=[],f="",u=Aa(t);for(varh=r.s.c;h<=r.e.c;++h){if(!a[h])continue;vard=l.dense?(e[t]||[])[h]:e[a[h]+u];if(d==null)f="";elseif(d.v!=null){o=false;f=""+(l.rawNumbers&&d.t=="n"?d.v:Ua(d,null,l));for(varm=0,p=0;m!==f.length;++m)if((p=f.charCodeAt(m))===n||p===s||p===34||l.forceQuotes){f='"'+f.replace(ac,'""')+'"';break}if(f=="ID")f='"ID"'}elseif(d.f!=null&&!d.F){o=false;f="="+d.f;if(f.indexOf(",")>=0)f='"'+f.replace(ac,'""')+'"'}elsef="";c.push(f)}if(l.blankrows===false&&o)returnnull;returnc.join(i)}functionsc(e,r){vart=[];vara=r==null?{}:r;if(e==null||e["!ref"]==null)return"";varn=$a(e["!ref"]);vars=a.FS!==undefined?a.FS:",",i=s.charCodeAt(0);varl=a.RS!==undefined?a.RS:"\n",o=l.charCodeAt(0);varc=newRegExp((s=="|"?"\\|":s)+"+$");varf="",u=[];a.dense=Array.isArray(e);varh=a.skipHidden&&e["!cols"]||[];vard=a.skipHidden&&e["!rows"]||[];for(varm=n.s.c;m<=n.e.c;++m)if(!(h[m]||{}).hidden)u[m]=Da(m);varp=0;for(varv=n.s.r;v<=n.e.r;++v){if((d[v]||{}).hidden)continue;f=nc