}if(u=s.match(/^#,#*,#0/))returny(e,s.replace(/^#,#*,/,""),f);if(u=s.match(/^([0#]+)(\\?-([0#]+))+$/)){o=r(y(e,s.replace(/[\\-]/g,""),f));g=0;returnr(r(s.replace(/\\/g,"")).replace(/[0#]/g,function(e){returng<o.length?o.charAt(g++):e==="0"?"0":""}))}if(s.match(m)){o=y(e,"##########",f);return"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6)}varS="";if(u=s.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)){g=Math.min(u[4].length,7);E=p(w,Math.pow(10,g)-1,false);o=""+k;S=x("n",u[1],E[1]);if(S.charAt(S.length-1)==" ")S=S.substr(0,S.length-1)+"0";o+=S+u[2]+"/"+u[3];S=i(E[2],g);if(S.length<u[4].length)S=b(u[4].substr(u[4].length-S.length))+S;o+=S;returno}if(u=s.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)){g=Math.min(Math.max(u[1].length,u[4].length),7);E=p(w,Math.pow(10,g)-1,true);returnk+(E[0]||(E[1]?"":"0"))+" "+(E[1]?n(E[1],g)+u[2]+"/"+u[3]+i(E[2],g):t(" ",2*g+1+u[2].length+u[3].length))}if(u=s.match(/^[#0?]+$/)){o=""+f;if(s.length<=o.length)returno;returnb(s.substr(0,s.length-o.length))+o}if(u=s.match(/^([#0]+)\.([#0]+)$/)){o=""+f.toFixed(Math.min(u[2].length,10)).replace(/([^0])0+$/,"$1");g=o.indexOf(".");varI=s.indexOf(".")-g,A=s.length-o.length-I;returnb(s.substr(0,I)+o+s.substr(s.length-A))}if(u=s.match(/^00,000\.([#0]*0)$/)){returnf<0?"-"+y(e,s,-f):T(""+f).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(e){return"00,"+(e.length<3?a(0,3-e.length):"")+e})+"."+a(0,u[1].length)}switch(s){case"###,###":;case"##,###":;case"#,###":varR=T(""+w);returnR!=="0"?k+R:"";default:if(s.match(/\.[0#?]*$/))returny(e,s.slice(0,s.lastIndexOf(".")),f)+b(s.slice(s.lastIndexOf(".")));}thrownewError("unsupported format |"+s+"|")}returnfunctionI(e,r,t){return(t|0)===t?y(e,r,t):S(e,r,t)}}();functiony(e){varr=[];vart=false;for(vara=0,n=0;a<e.length;++a)switch(e.charCodeAt(a)){case34:t=!t;break;case95:;case42:;case92:++a;break;case59:r[r.length]=e.substr(n,a-n);n=a+1;}r[r.length]=e.substr(n);if(t===true)thrownewError("Format |"+e+"| unterminated string ");returnr}e._split=y;varI=/\[[HhMmSs]*\]/;functionA(e){varr=0,t="",a="";while(r<e.length){switch(t=e.charAt(r)){case"G":if(c(e,r))r+=6;r++;break;case'"':for(;e.charCodeAt(++r)!==34&&r<e.length;)++r;++r;break;case"\\":r+=2;break;case"_":r+=2;break;case"@":++r;break;case"B":;case"b":if(e.charAt(r+1)==="1"||e.charAt(r+1)==="2")returntrue;case"M":;case"D":;case"Y":;case"H":;case"S":;case"E":;case"m":;case"d":;case"y":;case"h":;case"s":;case"e":;case"g":returntrue;case"A":;case"a":if(e.substr(r,3).toUpperCase()==="A/P")returntrue;if(e.substr(r,5).toUpperCase()==="AM/PM")returntrue;++r;break;case"[":a=t;while(e.charAt(r++)!=="]"&&r<e.length)a+=e.charAt(r);if(a.match(I))returntrue;break;case".":;case"0":;case"#":while(r<e.length&&("0#?.,E+-%".indexOf(t=e.charAt(++r))>-1||t=="\\"&&e.charAt(r+1)=="-"&&"0#".indexOf(e.charAt(r+2))>-1)){}break;case"?":while(e.charAt(++r)===t){}break;case"*":++r;if(e.charAt(r)==" "||e.charAt(r)=="*")++r;break;case"(":;case")":++r;break;case"1":;case"2":;case"3":;case"4":;case"5":;case"6":;case"7":;case"8":;case"9":while(r<e.length&&"0123456789".indexOf(e.charAt(++r))>-1){}break;case" ":++r;break;default:++r;break;}}returnfalse}e.is_date=A;functionR(e,r,t,a){varn=[],i="",s=0,f="",l="t",o,u,h;vard="H";while(s<e.length){switch(f=e.charAt(s)){case"G":if(!c(e,s))thrownewError("unrecognized character "+f+" in "+e);n[n.length]={t:"G",v:"General"};s+=7;break;case'"':for(i="";(h=e.charCodeAt(++s))!==34&&s<e.length;)i+=String.fromCharCode(h);n[n.length]={t:"t",v:i};++s;break;case"\\":varv=e.charAt(++s),p=v==="("||v===")"?v:"t";n[n.length]={t:p,v:v};++s;break;case"_":n[n.length]={t:"t",v:" "};s+=2;break;case"@":n[n.length]={t:"T",v:r};++s;break;case"B":;case"b":if(e.charAt(s+1)==="1"||e.charAt(s+1)==="2"){if(o==null){o=m(r,t,e.charAt(s+1)==="2");if(o==null)return""}n[n.length]={t:"X",v:e.substr(s,2)};l=f;s+=2;break};case"M":;case"D":;case"Y":;case"H":;case"S":;case"E":f=f.toLowerCase();case"m":;case"d":;case"y":;case"h":;case"s":;case"e":;case"g":if(r<0)return"";if(o==null){o=m(r,t);if(o==null)return""}i=f;while(++s<e.length&&e.charAt(s).toLowerCase(
u=(a=c.charCodeAt(n+1))==34||a==39?1:0;f=c.slice(n+1+u,c.length-u);for(s=0;s!=o.length;++s)if(o.charCodeAt(s)===58)break;if(s===o.length){if(o.indexOf("_")>0)o=o.slice(0,o.indexOf("_"));t[o]=f}else{varh=(s===5&&o.slice(0,5)==="xmlns"?"xmlns":"")+o.slice(s+1);if(t[h]&&o.slice(s-3,s)=="ext")continue;t[h]=f}}returnt}functionTe(e){returne.replace(Ce,"<$1")}varxe={""":'"',"'":"'",">":">","<":"<","&":"&"};varye=G(xe);varIe=function(){vare=/&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g,r=/_x([\da-fA-F]{4})_/g;returnfunctiont(a){varn=a+"",i=n.indexOf("<![CDATA[");if(i==-1)returnn.replace(e,function(e,r){returnxe[e]||String.fromCharCode(parseInt(r,e.indexOf("x")>-1?16:10))||e}).replace(r,function(e,r){returnString.fromCharCode(parseInt(r,16))});vars=n.indexOf("]]>");returnt(n.slice(0,i))+n.slice(i+9,s)+t(n.slice(s+3))}}();varAe=/[&<>'"]/g,Re=/[\u0000-\u0008\u000b-\u001f]/g;functionDe(e){varr=e+"";returnr.replace(Ae,function(e){returnye[e]}).replace(Re,function(e){return"_x"+("000"+e.charCodeAt(0).toString(16)).slice(-4)+"_"})}functionFe(e){returnDe(e).replace(/ /g,"_x0020_")}varOe=/[\u0000-\u001f]/g;functionPe(e){varr=e+"";returnr.replace(Ae,function(e){returnye[e]}).replace(Oe,function(e){return"&#x"+("000"+e.charCodeAt(0).toString(16)).slice(-4)+";"})}functionNe(e){varr=e+"";returnr.replace(Ae,function(e){returnye[e]}).replace(Oe,function(e){return"&#x"+e.charCodeAt(0).toString(16).toUpperCase()+";"})}varLe=function(){vare=/&#(\d+);/g;functionr(e,r){returnString.fromCharCode(parseInt(r,10))}returnfunctiont(a){returna.replace(e,r)}}();varMe=function(){returnfunctione(r){returnr.replace(/(\r\n|[\r\n])/g," ")}}();functionUe(e){switch(e){case1:;casetrue:;case"1":;case"true":;case"TRUE":returntrue;default:returnfalse;}}varHe=functionCm(e){varr="",t=0,a=0,n=0,i=0,s=0,f=0;while(t<e.length){a=e.charCodeAt(t++);if(a<128){r+=String.fromCharCode(a);continue}n=e.charCodeAt(t++);if(a>191&&a<224){s=(a&31)<<6;s|=n&63;r+=String.fromCharCode(s);continue}i=e.charCodeAt(t++);if(a<240){r+=String.fromCharCode((a&15)<<12|(n&63)<<6|i&63);continue}s=e.charCodeAt(t++);f=((a&7)<<18|(n&63)<<12|(i&63)<<6|s&63)-65536;r+=String.fromCharCode(55296+(f>>>10&1023));r+=String.fromCharCode(56320+(f&1023))}returnr};varWe=function(e){varr=[],t=0,a=0,n=0;while(t<e.length){a=e.charCodeAt(t++);switch(true){casea<128:r.push(String.fromCharCode(a));break;casea<2048:r.push(String.fromCharCode(192+(a>>6)));r.push(String.fromCharCode(128+(a&63)));break;casea>=55296&&a<57344:a-=55296;n=e.charCodeAt(t++)-56320+(a<<10);r.push(String.fromCharCode(240+(n>>18&7)));r.push(String.fromCharCode(144+(n>>12&63)));r.push(String.fromCharCode(128+(n>>6&63)));r.push(String.fromCharCode(128+(n&63)));break;default:r.push(String.fromCharCode(224+(a>>12)));r.push(String.fromCharCode(128+(a>>6&63)));r.push(String.fromCharCode(128+(a&63)));}}returnr.join("")};if(E){varVe=functionBm(e){varr=newBuffer(2*e.length),t,a,n=1,i=0,s=0,f;for(a=0;a<e.length;a+=n){n=1;if((f=e.charCodeAt(a))<128)t=f;elseif(f<224){t=(f&31)*64+(e.charCodeAt(a+1)&63);n=2}elseif(f<240){t=(f&15)*4096+(e.charCodeAt(a+1)&63)*64+(e.charCodeAt(a+2)&63);n=3}else{n=4;t=(f&7)*262144+(e.charCodeAt(a+1)&63)*4096+(e.charCodeAt(a+2)&63)*64+(e.charCodeAt(a+3)&63);t-=65536;s=55296+(t>>>10&1023);t=56320+(t&1023)}if(s!==0){r[i++]=s&255;r[i++]=s>>>8;s=0}r[i++]=t%256;r[i++]=t>>>8}returnr.slice(0,i).toString("ucs2")};varze="foo bar bazâð£";if(He(ze)==Ve(ze))He=Ve;varXe=functionTm(e){returnBuffer(e,"binary").toString("utf8")};if(He(ze)==Xe(ze))He=Xe;We=function(e){returnnewBuffer(e,"utf8").toString("binary")}}varGe=function(){vare={};returnfunctionr(t,a){varn=t+"|"+(a||"");if(e[n])returne[n];returne[n]=newRegExp("<(?:\\w+:)?"+t+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?'+t+">",a||"")}}();varje=function(){vare=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(e){return[newRegExp("&"+e[0]+";","g"),e[1]]});returnfunctionr(t){vara=t.trim().replace(/\s+/g," ").r
links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],TODO:[],xmlns:""}}functionSa(e){varr=ka();if(!e||!e.match)returnr;vart={};(e.match(Se)||[]).forEach(function(e){vara=Be(e);switch(a[0].replace(_e,"<")){case"<?xml":break;case"<Types":r.xmlns=a["xmlns"+(a[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":t[a.Extension]=a.ContentType;break;case"<Override":if(r[ga[a.ContentType]]!==undefined)r[ga[a.ContentType]].push(a.PartName);break;}});if(r.xmlns!==ar.CT)thrownewError("Unknown Namespace: "+r.xmlns);r.calcchain=r.calcchains.length>0?r.calcchains[0]:"";r.sst=r.strs.length>0?r.strs[0]:"";r.style=r.styles.length>0?r.styles[0]:"";r.defaults=t;deleter.calcchains;returnr}var_a=er("Types",null,{xmlns:ar.CT,"xmlns:xsd":ar.xsd,"xmlns:xsi":ar.xsi});varCa=[["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels",wa.rels[0]]].map(function(e){returner("Default",null,{Extension:e[0],ContentType:e[1]})});functionBa(e,r){vart=[],a;t[t.length]=we;t[t.length]=_a;t=t.concat(Ca);varn=function(n){if(e[n]&&e[n].length>0){a=e[n][0];t[t.length]=er("Override",null,{PartName:(a[0]=="/"?"":"/")+a,ContentType:Ea[n][r.bookType||"xlsx"]})}};vari=function(a){(e[a]||[]).forEach(function(e){t[t.length]=er("Override",null,{PartName:(e[0]=="/"?"":"/")+e,ContentType:Ea[a][r.bookType||"xlsx"]})})};vars=function(r){(e[r]||[]).forEach(function(e){t[t.length]=er("Override",null,{PartName:(e[0]=="/"?"":"/")+e,ContentType:wa[r][0]})})};n("workbooks");i("sheets");i("charts");s("themes");["strs","styles"].forEach(n);["coreprops","extprops","custprops"].forEach(s);s("vba");s("comments");s("drawings");if(t.length>2){t[t.length]="</Types>";t[1]=t[1].replace("/>",">")}returnt.join("")}varTa={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};functionxa(e){varr=e.lastIndexOf("/");returne.slice(0,r+1)+"_rels/"+e.slice(r+1)+".rels"}functionya(e,r){if(!e)returne;if(r.charAt(0)!=="/"){r="/"+r}vart={};vara={};(e.match(Se)||[]).forEach(function(e){varn=Be(e);if(n[0]==="<Relationship"){vari={};i.Type=n.Type;i.Target=n.Target;i.Id=n.Id;i.TargetMode=n.TargetMode;vars=n.TargetMode==="External"?n.Target:Ee(n.Target,r);t[s]=i;a[n.Id]=i}});t["!id"]=a;returnt}ar.RELS="http://schemas.openxmlformats.org/package/2006/relationships";varIa=er("Relationships",null,{xmlns:ar.RELS});functionAa(e){varr=[we,Ia];z(e["!id"]).forEach(function(t){r[r.length]=er("Relationship",null,e["!id"][t])});if(r.length>2){r[r.length]="</Relationships>";r[1]=r[1].replace("/>",">")}returnr.join("")}functionRa(e,r,t,a,n){if(!n)n={};if(!e["!id"])e["!id"]={};if(r<0)for(r=1;e["!id"]["rId"+r];++r){}n.Id="rId"+r;n.Type=a;n.Target=t;if(n.Type==Ta.HLINK)n.TargetMode="External";if(e["!id"][n.Id])thrownewError("Cannot rewrite rId "+r);e["!id"][n.Id]=n;e[("/"+n.Target).replace("//","/")]=n;returnr}varDa="application/vnd.oasis.opendocument.spreadsheet";functionFa(e,r){vart=_v(e);vara;varn;while(a=Cv.exec(t))switch(a[3]){case"manifest":break;case"file-entry":n=Be(a[0],false);if(n.path=="/"&&n.type!==Da)thrownewError("This OpenDocument is not a spreadsheet");break;case"encryption-data":;case"algorithm":;case"start-key-generation":;case"key-derivation":thrownewError("Unsupported ODS Encryption");default:if(r&&r.WTF)throwa;}}functionOa(e){varr=[we];r.push('<manifest:manifestxmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.
r.revssf[e.SSF[65535]]=0;r.ssf=e.SSF}r.rels={};r.wbrels={};r.Strings=[];r.Strings.Count=0;r.Strings.Unique=0;vart=r.bookType=="xlsb"?"bin":"xml";vara=To.indexOf(r.bookType)>-1;varn=ka();Lp(r=r||{});vari=newge;vars="",f=0;r.cellXfs=[];Lu(r.cellXfs,{},{revssf:{General:0}});if(!e.Props)e.Props={};s="docProps/core.xml";i.file(s,Xa(e.Props,r));n.coreprops.push(s);Ra(r.rels,2,s,Ta.CORE_PROPS);s="docProps/app.xml";if(e.Props&&e.Props.SheetNames){}elseif(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{varl=[];for(varo=0;o<e.SheetNames.length;++o)if((e.Workbook.Sheets[o]||{}).Hidden!=2)l.push(e.SheetNames[o]);e.Props.SheetNames=l}e.Props.Worksheets=e.Props.SheetNames.length;i.file(s,Ya(e.Props,r));n.extprops.push(s);Ra(r.rels,3,s,Ta.EXT_PROPS);if(e.Custprops!==e.Props&&z(e.Custprops||{}).length>0){s="docProps/custom.xml";i.file(s,Ja(e.Custprops,r));n.custprops.push(s);Ra(r.rels,4,s,Ta.CUST_PROPS)}s="xl/workbook."+t;i.file(s,sv(e,s,r));n.workbooks.push(s);Ra(r.rels,1,s,Ta.WB);for(f=1;f<=e.SheetNames.length;++f){varc={"!id":{}};varu=e.Sheets[e.SheetNames[f-1]];varh=(u||{})["!type"]||"sheet";switch(h){case"chart":;default:s="xl/worksheets/sheet"+f+"."+t;i.file(s,fv(f-1,s,r,e,c));n.sheets.push(s);Ra(r.wbrels,-1,"worksheets/sheet"+f+"."+t,Ta.WS[0]);}if(u){vard=u["!comments"];if(d&&d.length>0){varv="xl/comments"+f+"."+t;i.file(v,uv(d,v,r));n.comments.push(v);Ra(c,-1,"../comments"+f+"."+t,Ta.CMNT)}if(u["!legacy"]){i.file("xl/drawings/vmlDrawing"+f+".vml",co(f,u["!comments"]))}deleteu["!comments"];deleteu["!legacy"]}if(c["!id"].rId1)i.file(xa(s),Aa(c))}if(r.Strings!=null&&r.Strings.length>0){s="xl/sharedStrings."+t;i.file(s,cv(r.Strings,s,r));n.strs.push(s);Ra(r.wbrels,-1,"sharedStrings."+t,Ta.SST)}s="xl/theme/theme1.xml";i.file(s,Yl(e.Themes,r));n.themes.push(s);Ra(r.wbrels,-1,"theme/theme1.xml",Ta.THEME);s="xl/styles."+t;i.file(s,ov(e,s,r));n.styles.push(s);Ra(r.wbrels,-1,"styles."+t,Ta.STY);if(e.vbaraw&&a){s="xl/vbaProject.bin";i.file(s,e.vbaraw);n.vba.push(s);Ra(r.wbrels,-1,"vbaProject.bin",Ta.VBA)}i.file("[Content_Types].xml",Ba(n,r));i.file("_rels/.rels",Aa(r.rels));i.file("xl/_rels/workbook."+t+".rels",Aa(r.wbrels));deleter.revssf;deleter.ssf;returni}functionGp(e,r){vart="";switch((r||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3]];case"base64":t=g.decode(e.slice(0,24));break;case"binary":t=e;break;case"array":return[e[0],e[1],e[2],e[3]];default:thrownewError("Unrecognized type "+(r&&r.type||"undefined"));}return[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]}functionjp(e,r){if(L.find(e,"EncryptedPackage"))returnzp(e,r);returnjv(e,r)}functionKp(e,r){vart,a=e;varn=r||{};if(!n.type)n.type=E&&Buffer.isBuffer(e)?"buffer":"base64";switch(n.type){case"base64":t=newge(a,{base64:true});break;case"binary":;case"array":t=newge(a,{base64:false});break;case"buffer":t=newge(a);break;default:thrownewError("Unrecognized type "+n.type);}returnVp(t,n)}functionYp(e,r){vart=0;e:while(t<e.length)switch(e.charCodeAt(t)){case10:;case13:;case32:++t;break;case60:returnTv(e.slice(t),r);default:breake;}returnXs.to_workbook(e,r)}function$p(e,r){vart="",a=Gp(e,r);switch(r.type){case"base64":t=g.decode(e);break;case"binary":t=e;break;case"buffer":t=e.toString("binary");break;case"array":t=ae(e);break;default:thrownewError("Unrecognized type "+r.type);}if(a[0]==239&&a[1]==187&&a[2]==191)t=He(t);returnYp(t,r)}functionZp(e,r){vart=e;if(r.type=="base64")t=g.decode(t);t=cptable.utils.decode(1200,t.slice(2),"str");r.type="binary";returnYp(t,r)}functionQp(e){return!e.match(/[^\x00-\x7F]/)?e:We(e)}functionJp(e,r,t,a){if(a){t.type="string";returnXs.to_workbook(e,t)}returnXs.to_workbook(r,t)}functionqp(e,r){c();if(typeofArrayBuffer!=="undefined"&&einstanceofArrayBuffer)returnqp(newUint8Array(e),r);vart=e,a=[0,0,0,0],n=false;vari=r||{};Fu={};if(i.dateNF)Fu.dateNF=i.dateNF;if(!i.type)i.type=E&&Buffer.isBuffer(e)?"buffer":"base64";if(i.type=="file"){i.type=E?"buffer":"binary";t=V(e)}if(i.type=="string"){n=true;i.type="binary";t=Qp(e)}if(i.type=="array"&&typ