varr=newDate;r.setTime(e*24*60*60*1e3+mr);if(r.getTimezoneOffset()!==pr){r.setTime(r.getTime()+(r.getTimezoneOffset()-pr)*6e4)}returnr}functiongr(e){varr=0,t=0,a=false;varn=e.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!n)thrownewError("|"+e+"| is not an ISO8601 Duration");for(vars=1;s!=n.length;++s){if(!n[s])continue;t=1;if(s>3)a=true;switch(n[s].slice(n[s].length-1)){case"Y":thrownewError("Unsupported ISO Duration Field: "+n[s].slice(n[s].length-1));case"D":t*=24;case"H":t*=60;case"M":if(!a)thrownewError("Unsupported ISO Duration Field: M");elset*=60;case"S":break;}r+=t*parseInt(n[s],10)}returnr}varbr=newDate("2017-02-19T19:06:09.000Z");varwr=isNaN(br.getFullYear())?newDate("2/19/17"):br;varkr=wr.getFullYear()==2017;functionyr(e,r){vart=newDate(e);if(kr){if(r>0)t.setTime(t.getTime()+t.getTimezoneOffset()*60*1e3);elseif(r<0)t.setTime(t.getTime()-t.getTimezoneOffset()*60*1e3);returnt}if(einstanceofDate)returne;if(wr.getFullYear()==1917&&!isNaN(t.getFullYear())){vara=t.getFullYear();if(e.indexOf(""+a)>-1)returnt;t.setFullYear(t.getFullYear()+100);returnt}varn=e.match(/\d+/g)||["2017","2","19","0","0","0"];vars=newDate(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);if(e.indexOf("Z")>-1)s=newDate(s.getTime()-s.getTimezoneOffset()*60*1e3);returns}functionxr(e,r){if(S&&Buffer.isBuffer(e)){if(r&&_){if(e[0]==255&&e[1]==254)returngt(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)returngt(h(e.slice(2).toString("binary")))}returne.toString("binary")}if(typeofTextDecoder!=="undefined")try{if(r){if(e[0]==255&&e[1]==254)returngt(newTextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)returngt(newTextDecoder("utf-16be").decode(e.slice(2)))}vart={"€":"","‚":"","ƒ":"","„":"","…":"","†":"","‡":"","ˆ":"","‰":"","Š":"","‹":"","Œ":"","Ž":"","‘":"","’":"","“":"","”":"","•":"","–":"","—":"","˜":"","™":"","š":"","›":"","œ":"","ž":"","Ÿ":""};if(Array.isArray(e))e=newUint8Array(e);returnnewTextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(e){returnt[e]||e})}catch(a){}varn=[];for(vars=0;s!=e.length;++s)n.push(String.fromCharCode(e[s]));returnn.join("")}functionSr(e){if(typeofJSON!="undefined"&&!Array.isArray(e))returnJSON.parse(JSON.stringify(e));if(typeofe!="object"||e==null)returne;if(einstanceofDate)returnnewDate(e.getTime());varr={};for(vartine)if(Object.prototype.hasOwnProperty.call(e,t))r[t]=Sr(e[t]);returnr}functionCr(e,r){vart="";while(t.length<r)t+=e;returnt}function_r(e){varr=Number(e);if(!isNaN(r))returnisFinite(r)?r:NaN;if(!/\d/.test(e))returnr;vart=1;vara=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){t*=100;return""});if(!isNaN(r=Number(a)))returnr/t;a=a.replace(/[(](.*)[)]/,function(e,r){t=-t;returnr});if(!isNaN(r=Number(a)))returnr/t;returnr}varAr=/^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))\s+([ap])m?$/;functionFr(e){if(!e[2])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),0,0,0);if(e[3]){if(e[4])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[4],parseFloat(e[3])*1e3);elsereturnnewDate(1899,11,30,e[7]=="p"?12:0,+e[1],+e[2],parseFloat(e[3])*1e3)}elseif(e[5])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[5],e[6]?parseFloat(e[6])*1e3:0);elsereturnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],0,0)}varEr=["january","february","march","april","may","june","july","august","september","october","november","december"];functionTr(e){varr=e.toLowerCase();vart=r.replace(/\s+/g," ").trim();vara=t.match(Ar);if(a)returnFr(a);varn=newDate(e),s=newDate(NaN);vari=n.getYear(),l=n.getMonth(),o=n.getDate();if(isNaN(o))returns;if(r.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){r=r.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");if(r.length>3&&Er.indexOf(r)==-1)returns}elseif(r.repl
varr="<office:document-styles "+At({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";returnfunctiont(){returnHr+r}}();functiongo(e,r){vart="number",a="",n={"style:name":r},s="",i=0;e=e.replace(/"[$]"/g,"$");e:{if(e.indexOf(";")>-1){console.error("Unsupported ODS Style Map exported. Using first branch of "+e);e=e.slice(0,e.indexOf(";"))}if(e=="@"){t="text";a="<number:text-content/>";breake}if(e.indexOf(/\$/)>-1){t="currency"}if(e[i]=='"'){s="";while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;if(e[i+1]=="*"){i++;a+="<number:fill-character>"+nt(s.replace(/""/g,'"'))+"</number:fill-character>"}else{a+="<number:text>"+nt(s.replace(/""/g,'"'))+"</number:text>"}e=e.slice(i+1);i=0}varl=e.match(/# (\?+)\/(\?+)/);if(l){a+=Ft("number:fraction",null,{"number:min-integer-digits":0,"number:min-numerator-digits":l[1].length,"number:max-denominator-value":Math.max(+l[1].replace(/./g,"9"),+l[2].replace(/./g,"9"))});breake}if(l=e.match(/# (\?+)\/(\d+)/)){a+=Ft("number:fraction",null,{"number:min-integer-digits":0,"number:min-numerator-digits":l[1].length,"number:denominator-value":+l[2]});breake}if(l=e.match(/(\d+)(|\.\d+)%/)){t="percentage";a+=Ft("number:number",null,{"number:decimal-places":l[2]&&l.length-1||0,"number:min-decimal-places":l[2]&&l.length-1||0,"number:min-integer-digits":l[1].length})+"<number:text>%</number:text>";breake}varo=false;if(["y","m","d"].indexOf(e[0])>-1){t="date";r:for(;i<e.length;++i)switch(s=e[i].toLowerCase()){case"h":;case"s":o=true;--i;breakr;case"m":t:for(varc=i+1;c<e.length;++c)switch(e[c]){case"y":;case"d":breakt;case"h":;case"s":o=true;--i;breakr;};case"y":;case"d":while((e[++i]||"").toLowerCase()==s[0])s+=s[0];--i;switch(s){case"y":;case"yy":a+="<number:year/>";break;case"yyy":;case"yyyy":a+='<number:year number:style="long"/>';break;case"mmmmm":console.error("ODS has no equivalent of format |mmmmm|");case"m":;case"mm":;case"mmm":;case"mmmm":a+='<number:month number:style="'+(s.length%2?"short":"long")+'" number:textual="'+(s.length>=3?"true":"false")+'"/>';break;case"d":;case"dd":a+='<number:day number:style="'+(s.length%2?"short":"long")+'"/>';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>"+nt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+nt(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>"+nt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+nt(s)+"</number:text>";break;case"a
vart=Sr(r||{});vara=jo(e,t);returnXo(a,t)}functionVo(e,r){vart=Sr(r||{});vara=Oo(e,t);returnXo(a,t)}functionXo(e,r){vart={};vara=S?"nodebuffer":typeofUint8Array!=="undefined"?"array":"string";if(r.compression)t.compression="DEFLATE";if(r.password)t.type=a;elseswitch(r.type){case"base64":t.type="base64";break;case"binary":t.type="string";break;case"string":thrownewError("'string' output type invalid for '"+r.bookType+"' files");case"buffer":;case"file":t.type=a;break;default:thrownewError("Unrecognized type "+r.type);}varn=e.FullPaths?er.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[t.type]||t.type,compression:!!r.compression}):e.generate(t);if(typeofDeno!=="undefined"){if(typeofn=="string"){if(r.type=="binary"||r.type=="base64")returnn;n=newUint8Array(T(n))}}if(r.password&&typeofencrypt_agile!=="undefined")returnUo(encrypt_agile(n,r.password),r);if(r.type==="file")returnnr(r.file,n);returnr.type=="string"?vt(n):n}functionGo(e,r){vart=r||{};vara=write_xlscfb(e,t);returnUo(a,t)}functionYo(e,r,t){if(!t)t="";vara=t+e;switch(r.type){case"base64":returnk(gt(a));case"binary":returngt(a);case"string":returne;case"file":returnnr(r.file,a,"utf8");case"buffer":{if(S)returnC(a,"utf8");elseif(typeofTextEncoder!=="undefined")return(newTextEncoder).encode(a);elsereturnYo(a,{type:"binary"}).split("").map(function(e){returne.charCodeAt(0)})};}thrownewError("Unrecognized type "+r.type)}functionJo(e,r){switch(r.type){case"base64":returny(e);case"binary":returne;case"string":returne;case"file":returnnr(r.file,e,"binary");case"buffer":{if(S)returnC(e,"binary");elsereturne.split("").map(function(e){returne.charCodeAt(0)})};}thrownewError("Unrecognized type "+r.type)}functionKo(e,r){switch(r.type){case"string":;case"base64":;case"binary":vart="";for(vara=0;a<e.length;++a)t+=String.fromCharCode(e[a]);returnr.type=="base64"?k(t):r.type=="string"?vt(t):t;case"file":returnnr(r.file,e);case"buffer":returne;default:thrownewError("Unrecognized type "+r.type);}}functionZo(e,r){c();Ll(e);vart=Sr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=Zo(e,t);t.type="array";returnT(a)}returnVo(e,t)}functionqo(e,r){c();Ll(e);vart=Sr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=qo(e,t);t.type="array";returnT(a)}varn=0;if(t.sheet){if(typeoft.sheet=="number")n=t.sheet;elsen=e.SheetNames.indexOf(t.sheet);if(!e.SheetNames[n])thrownewError("Sheet not found: "+t.sheet+" : "+typeoft.sheet)}switch(t.bookType||"xlsb"){case"xml":;case"xlml":returnYo(write_xlml(e,t),t);case"slk":;case"sylk":returnYo(Kn.from_sheet(e.Sheets[e.SheetNames[n]],t,e),t);case"htm":;case"html":returnYo(no(e.Sheets[e.SheetNames[n]],t),t);case"txt":returnJo(oc(e.Sheets[e.SheetNames[n]],t),t);case"csv":returnYo(lc(e.Sheets[e.SheetNames[n]],t),t,"\ufeff");case"dif":returnYo(Zn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"dbf":returnKo(Jn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"prn":returnYo(Qn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"rtf":returnYo(sheet_to_rtf(e.Sheets[e.SheetNames[n]],t),t);case"eth":returnYo(qn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"fods":returnYo(ko(e,t),t);case"wk1":returnKo(WK_.sheet_to_wk1(e.Sheets[e.SheetNames[n]],t),t);case"wk3":returnKo(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;returnKo(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;returnGo(e,t);case"xlsx":;case"xlsm":;case"xlam":;case"xlsb":;case"numbers":;case"ods":returnHo(e,t);default:thrownewError("Unrecognized bookType |"+t.bookType+"|");}}functionQo(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}functionec(e,r,t){vara=t||{};a.type="file";a.file=r;Qo(