@redoper1/xlsx-js-style
Version:
SheetJS Spreadsheet Community Edition plus Basic Cell Styles forked from gitbrent/xlsx-js-style
3 lines • 561 kB
JavaScript
/* xlsx-js-style 1.2.4 @ 2024-11-24T20:00:00.443Z */
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
var $cptable,XLSX={version:"0.20.3",style_version:"1.2.4"},current_codepage=1200,current_ansi=1252,VALID_ANSI=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],CS2CP={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},set_ansi=function(e){-1!=VALID_ANSI.indexOf(e)&&(current_ansi=CS2CP[0]=e)};function reset_ansi(){set_ansi(1252)}var set_cp=function(e){current_codepage=e,set_ansi(e)};function reset_cp(){set_cp(1200),reset_ansi()}function char_codes(e){for(var t=[],r=0,a=e.length;r<a;++r)t[r]=e.charCodeAt(r);return t}function utf16leread(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r)+(e.charCodeAt(2*r+1)<<8));return t.join("")}function utf16lereadu(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e[2*r]+(e[2*r+1]<<8));return t.join("")}function utf16beread(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r+1)+(e.charCodeAt(2*r)<<8));return t.join("")}var debom=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1);return 255==t&&254==r?utf16leread(e.slice(2)):254==t&&255==r?utf16beread(e.slice(2)):65279==t?e.slice(1):e},_getchar=function(e){return String.fromCharCode(e)},_getansi=function(e){return String.fromCharCode(e)};function set_cptable(e){$cptable=e,set_cp=function(e){current_codepage=e,set_ansi(e)},debom=function(e){return 255===e.charCodeAt(0)&&254===e.charCodeAt(1)?$cptable.utils.decode(1200,char_codes(e.slice(2))):e},_getchar=function(e){return 1200===current_codepage?String.fromCharCode(e):$cptable.utils.decode(current_codepage,[255&e,e>>8])[0]},_getansi=function(e){return $cptable.utils.decode(current_ansi,[e])[0]},cpdoit()}var DENSE=null,DIF_XL=!0,Base64_map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Base64_encode(e){for(var t="",r=0,a=0,n=0,s=0,i=0,o=0,l=0,c=0;c<e.length;)s=(r=e.charCodeAt(c++))>>2,i=(3&r)<<4|(a=e.charCodeAt(c++))>>4,o=(15&a)<<2|(n=e.charCodeAt(c++))>>6,l=63&n,isNaN(a)?o=l=64:isNaN(n)&&(l=64),t+=Base64_map.charAt(s)+Base64_map.charAt(i)+Base64_map.charAt(o)+Base64_map.charAt(l);return t}function Base64_encode_pass(e){for(var t="",r=0,a=0,n=0,s=0,i=0,o=0,l=0,c=0;c<e.length;)(r=e.charCodeAt(c++))>255&&(r=95),s=r>>2,(a=e.charCodeAt(c++))>255&&(a=95),i=(3&r)<<4|a>>4,(n=e.charCodeAt(c++))>255&&(n=95),o=(15&a)<<2|n>>6,l=63&n,isNaN(a)?o=l=64:isNaN(n)&&(l=64),t+=Base64_map.charAt(s)+Base64_map.charAt(i)+Base64_map.charAt(o)+Base64_map.charAt(l);return t}function Base64_encode_arr(e){for(var t="",r=0,a=0,n=0,s=0,i=0,o=0,l=0,c=0;c<e.length;)s=(r=e[c++])>>2,i=(3&r)<<4|(a=e[c++])>>4,o=(15&a)<<2|(n=e[c++])>>6,l=63&n,isNaN(a)?o=l=64:isNaN(n)&&(l=64),t+=Base64_map.charAt(s)+Base64_map.charAt(i)+Base64_map.charAt(o)+Base64_map.charAt(l);return t}function Base64_decode(e){var t="",r=0,a=0,n=0,s=0,i=0,o=0;"data:"==e.slice(0,5)&&((l=e.slice(0,1024).indexOf(";base64,"))>-1&&(e=e.slice(l+8)));e=e.replace(/[^\w\+\/\=]/g,"");for(var l=0;l<e.length;)r=Base64_map.indexOf(e.charAt(l++))<<2|(s=Base64_map.indexOf(e.charAt(l++)))>>4,t+=String.fromCharCode(r),a=(15&s)<<4|(i=Base64_map.indexOf(e.charAt(l++)))>>2,64!==i&&(t+=String.fromCharCode(a)),n=(3&i)<<6|(o=Base64_map.indexOf(e.charAt(l++))),64!==o&&(t+=String.fromCharCode(n));return t}var has_buf="undefined"!=typeof Buffer&&"undefined"!=typeof process&&void 0!==process.versions&&!!process.versions.node,Buffer_from=function(){if("undefined"!=typeof Buffer){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(t){e=!0}return e?function(e,t){return t?new Buffer(e,t):new Buffer(e)}:Buffer.from.bind(Buffer)}return function(){}}(),buf_utf16le=function(){if("undefined"==typeof Buffer)return!1;var e=Buffer_from([65,0]);return!!e&&1==e.toString("utf16le").length}();function new_raw_buf(e){return has_buf?Buffer.alloc?Buffer.alloc(e):new Buffer(e):"undefined"!=typeof Uint8Array?new Uint8Array(e):new Array(e)}function new_unsafe_buf(e){return has_buf?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):"undefined"!=typeof Uint8Array?new Uint8Array(e):new Array(e)}var s2a=function(e){return has_buf?Buffer_from(e,"binary"):e.split("").map((function(e){return 255&e.charCodeAt(0)}))};function s2ab(e){if("undefined"==typeof ArrayBuffer)return s2a(e);for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),a=0;a!=e.length;++a)r[a]=255&e.charCodeAt(a);return t}function a2s(e){if(Array.isArray(e))return e.map((function(e){return String.fromCharCode(e)})).join("");for(var t=[],r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}function a2u(e){if("undefined"==typeof Uint8Array)throw new Error("Unsupported");return new Uint8Array(e)}function ab2a(e){if("undefined"==typeof ArrayBuffer)throw new Error("Unsupported");if(e instanceof ArrayBuffer)return ab2a(new Uint8Array(e));for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t}var bconcat=has_buf?function(e){return Buffer.concat(e.map((function(e){return Buffer.isBuffer(e)?e:Buffer_from(e)})))}:function(e){if("undefined"!=typeof Uint8Array){var t=0,r=0;for(t=0;t<e.length;++t)r+=e[t].length;var a=new Uint8Array(r),n=0;for(t=0,r=0;t<e.length;r+=n,++t)n=e[t].length,e[t]instanceof Uint8Array?a.set(e[t],r):"string"==typeof e[t]?a.set(new Uint8Array(s2a(e[t])),r):a.set(new Uint8Array(e[t]),r);return a}return[].concat.apply([],e.map((function(e){return Array.isArray(e)?e:[].slice.call(e)})))};function utf8decode(e){for(var t=[],r=0,a=e.length+250,n=new_raw_buf(e.length+255),s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i<128)n[r++]=i;else if(i<2048)n[r++]=192|i>>6&31,n[r++]=128|63&i;else if(i>=55296&&i<57344){i=64+(1023&i);var o=1023&e.charCodeAt(++s);n[r++]=240|i>>8&7,n[r++]=128|i>>2&63,n[r++]=128|o>>6&15|(3&i)<<4,n[r++]=128|63&o}else n[r++]=224|i>>12&15,n[r++]=128|i>>6&63,n[r++]=128|63&i;r>a&&(t.push(n.slice(0,r)),r=0,n=new_raw_buf(65535),a=65530)}return t.push(n.slice(0,r)),bconcat(t)}var chr0=/\u0000/g,chr1=/[\u0001-\u0006]/g;function _strrev(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function pad0(e,t){var r=""+e;return r.length>=t?r:fill("0",t-r.length)+r}function pad_(e,t){var r=""+e;return r.length>=t?r:fill(" ",t-r.length)+r}function rpad_(e,t){var r=""+e;return r.length>=t?r:r+fill(" ",t-r.length)}function pad0r1(e,t){var r=""+Math.round(e);return r.length>=t?r:fill("0",t-r.length)+r}function pad0r2(e,t){var r=""+e;return r.length>=t?r:fill("0",t-r.length)+r}var p2_32=Math.pow(2,32);function pad0r(e,t){return e>p2_32||e<-p2_32?pad0r1(e,t):pad0r2(Math.round(e),t)}function SSF_isgeneral(e,t){return t=t||0,e.length>=7+t&&103==(32|e.charCodeAt(t))&&101==(32|e.charCodeAt(t+1))&&110==(32|e.charCodeAt(t+2))&&101==(32|e.charCodeAt(t+3))&&114==(32|e.charCodeAt(t+4))&&97==(32|e.charCodeAt(t+5))&&108==(32|e.charCodeAt(t+6))}var days=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],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 SSF_init_table(e){return e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',e}var table_fmt={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},SSF_default_map={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},SSF_default_str={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function SSF_frac(e,t,r){for(var a=e<0?-1:1,n=e*a,s=0,i=1,o=0,l=1,c=0,f=0,u=Math.floor(n);c<t&&(o=(u=Math.floor(n))*i+s,f=u*c+l,!(n-u<5e-8));)n=1/(n-u),s=i,i=o,l=c,c=f;if(f>t&&(c>t?(f=l,o=s):(f=c,o=i)),!r)return[0,a*o,f];var h=Math.floor(a*o/f);return[h,a*o-h*f,f]}function SSF_normalize_xl_unsafe(e){var t=e.toPrecision(16);if(t.indexOf("e")>-1){var r=t.slice(0,t.indexOf("e"));return(r=r.indexOf(".")>-1?r.slice(0,"0."==r.slice(0,2)?17:16):r.slice(0,15)+fill("0",r.length-15))+t.slice(t.indexOf("e"))}var a=t.indexOf(".")>-1?t.slice(0,"0."==t.slice(0,2)?17:16):t.slice(0,15)+fill("0",t.length-15);return Number(a)}function SSF_parse_date_code(e,t,r){if(e>2958465||e<0)return null;var a=0|(e=SSF_normalize_xl_unsafe(e)),n=Math.floor(86400*(e-a)),s=0,i=[],o={D:a,T:n,u:86400*(e-a)-n,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(o.u)<1e-6&&(o.u=0),t&&t.date1904&&(a+=1462),o.u>.9999&&(o.u=0,86400==++n&&(o.T=n=0,++a,++o.D)),60===a)i=r?[1317,10,29]:[1900,2,29],s=3;else if(0===a)i=r?[1317,8,29]:[1900,1,0],s=6;else{a>60&&--a;var l=new Date(1900,0,1);l.setDate(l.getDate()+a-1),i=[l.getFullYear(),l.getMonth()+1,l.getDate()],s=l.getDay(),a<60&&(s=(s+6)%7),r&&(s=SSF_fix_hijri(l,i))}return o.y=i[0],o.m=i[1],o.d=i[2],o.S=n%60,n=Math.floor(n/60),o.M=n%60,n=Math.floor(n/60),o.H=n,o.q=s,o}function SSF_strip_decimal(e){return-1==e.indexOf(".")?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function SSF_normalize_exp(e){return-1==e.indexOf("E")?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function SSF_small_exp(e){var t=e<0?12:11,r=SSF_strip_decimal(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10)).length<=t?r:e.toExponential(5)}function SSF_large_exp(e){var t=SSF_strip_decimal(e.toFixed(11));return t.length>(e<0?12:11)||"0"===t||"-0"===t?e.toPrecision(6):t}function SSF_general_num(e){if(!isFinite(e))return isNaN(e)?"#NUM!":"#DIV/0!";var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E);return SSF_strip_decimal(SSF_normalize_exp((t>=-4&&t<=-1?e.toPrecision(10+t):Math.abs(t)<=9?SSF_small_exp(e):10===t?e.toFixed(10).substr(0,12):SSF_large_exp(e)).toUpperCase()))}function SSF_general(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(0|e)===e?e.toString(10):SSF_general_num(e);case"undefined":return"";case"object":if(null==e)return"";if(e instanceof Date)return SSF_format(14,datenum(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function SSF_fix_hijri(e,t){t[0]-=581;var r=e.getDay();return e<60&&(r=(r+6)%7),r}function SSF_write_date(e,t,r,a){var n,s="",i=0,o=0,l=r.y,c=0;switch(e){case 98:l=r.y+543;case 121:switch(t.length){case 1:case 2:n=l%100,c=2;break;default:n=l%1e4,c=4}break;case 109:switch(t.length){case 1:case 2:n=r.m,c=t.length;break;case 3:return months[r.m-1][1];case 5:return months[r.m-1][0];default:return months[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:n=r.d,c=t.length;break;case 3:return days[r.q][0];default:return days[r.q][1]}break;case 104:switch(t.length){case 1:case 2:n=1+(r.H+11)%12,c=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:n=r.H,c=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:n=r.M,c=t.length;break;default:throw"bad minute format: "+t}break;case 115:if("s"!=t&&"ss"!=t&&".0"!=t&&".00"!=t&&".000"!=t)throw"bad second format: "+t;return 0!==r.u||"s"!=t&&"ss"!=t?(o=a>=2?3===a?1e3:100:1===a?10:1,(i=Math.round(o*(r.S+r.u)))>=60*o&&(i=0),"s"===t?0===i?"0":""+i/o:(s=pad0(i,2+a),"ss"===t?s.substr(0,2):"."+s.substr(2,t.length-1))):pad0(r.S,t.length);case 90:switch(t){case"[h]":case"[hh]":n=24*r.D+r.H;break;case"[m]":case"[mm]":n=60*(24*r.D+r.H)+r.M;break;case"[s]":case"[ss]":n=60*(60*(24*r.D+r.H)+r.M)+(0==a?Math.round(r.S+r.u):r.S);break;default:throw"bad abstime format: "+t}c=3===t.length?1:2;break;case 101:n=l,c=1}return c>0?pad0(n,c):""}function commaify(e){if(e.length<=3)return e;for(var t=e.length%3,r=e.substr(0,t);t!=e.length;t+=3)r+=(r.length>0?",":"")+e.substr(t,3);return r}var pct1=/%/g;function write_num_pct(e,t,r){var a=t.replace(pct1,""),n=t.length-a.length;return write_num(e,a,r*Math.pow(10,2*n))+fill("%",n)}function write_num_cm(e,t,r){for(var a=t.length-1;44===t.charCodeAt(a-1);)--a;return write_num(e,t.substr(0,a),r/Math.pow(10,3*(t.length-a)))}function write_num_exp(e,t){var r,a=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(0==t)return"0.0E+0";if(t<0)return"-"+write_num_exp(e,-t);var n=e.indexOf(".");-1===n&&(n=e.indexOf("E"));var s=Math.floor(Math.log(t)*Math.LOG10E)%n;if(s<0&&(s+=n),-1===(r=(t/Math.pow(10,s)).toPrecision(a+1+(n+s)%n)).indexOf("e")){var i=Math.floor(Math.log(t)*Math.LOG10E);for(-1===r.indexOf(".")?r=r.charAt(0)+"."+r.substr(1)+"E+"+(i-r.length+s):r+="E+"+(i-s);"0."===r.substr(0,2);)r=(r=r.charAt(0)+r.substr(2,n)+"."+r.substr(2+n)).replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,(function(e,t,r,a){return t+r+a.substr(0,(n+s)%n)+"."+a.substr(s)+"E"}))}else r=t.toExponential(a);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var frac1=/# (\?+)( ?)\/( ?)(\d+)/;function write_num_f1(e,t,r){var a=parseInt(e[4],10),n=Math.round(t*a),s=Math.floor(n/a),i=n-s*a,o=a;return r+(0===s?"":""+s)+" "+(0===i?fill(" ",e[1].length+1+e[4].length):pad_(i,e[1].length)+e[2]+"/"+e[3]+pad0(o,e[4].length))}function write_num_f2(e,t,r){return r+(0===t?"":""+t)+fill(" ",e[1].length+2+e[4].length)}var dec1=/^#*0*\.([0#]+)/,closeparen=/\)[^)]*[0#]/,phone=/\(###\) ###\\?-####/;function hashq(e){for(var t,r="",a=0;a!=e.length;++a)switch(t=e.charCodeAt(a)){case 35:break;case 63:r+=" ";break;case 48:r+="0";break;default:r+=String.fromCharCode(t)}return r}function rnd(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function dec(e,t){var r=e-Math.floor(e),a=Math.pow(10,t);return t<(""+Math.round(r*a)).length?0:Math.round(r*a)}function carry(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function flr(e){return e<2147483647&&e>-2147483648?""+(e>=0?0|e:e-1|0):""+Math.floor(e)}function write_num_flt(e,t,r){if(40===e.charCodeAt(0)&&!t.match(closeparen)){var a=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?write_num_flt("n",a,r):"("+write_num_flt("n",a,-r)+")"}if(44===t.charCodeAt(t.length-1))return write_num_cm(e,t,r);if(-1!==t.indexOf("%"))return write_num_pct(e,t,r);if(-1!==t.indexOf("E"))return write_num_exp(t,r);if(36===t.charCodeAt(0))return"$"+write_num_flt(e,t.substr(" "==t.charAt(1)?2:1),r);var n,s,i,o,l=Math.abs(r),c=r<0?"-":"";if(t.match(/^00+$/))return c+pad0r(l,t.length);if(t.match(/^[#?]+$/))return"0"===(n=pad0r(r,0))&&(n=""),n.length>t.length?n:hashq(t.substr(0,t.length-n.length))+n;if(s=t.match(frac1))return write_num_f1(s,l,c);if(t.match(/^#+0+$/))return c+pad0r(l,t.length-t.indexOf("0"));if(s=t.match(dec1))return n=rnd(r,s[1].length).replace(/^([^\.]+)$/,"$1."+hashq(s[1])).replace(/\.$/,"."+hashq(s[1])).replace(/\.(\d*)$/,(function(e,t){return"."+t+fill("0",hashq(s[1]).length-t.length)})),-1!==t.indexOf("0.")?n:n.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return c+rnd(l,s[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return c+commaify(pad0r(l,0));if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+write_num_flt(e,t,-r):commaify(""+(Math.floor(r)+carry(r,s[1].length)))+"."+pad0(dec(r,s[1].length),s[1].length);if(s=t.match(/^#,#*,#0/))return write_num_flt(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_strrev(write_num_flt(e,t.replace(/[\\-]/g,""),r)),i=0,_strrev(_strrev(t.replace(/\\/g,"")).replace(/[0#]/g,(function(e){return i<n.length?n.charAt(i++):"0"===e?"0":""})));if(t.match(phone))return"("+(n=write_num_flt(e,"##########",r)).substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(s[4].length,7),o=SSF_frac(l,Math.pow(10,i)-1,!1),n=""+c," "==(f=write_num("n",s[1],o[1])).charAt(f.length-1)&&(f=f.substr(0,f.length-1)+"0"),n+=f+s[2]+"/"+s[3],(f=rpad_(o[2],i)).length<s[4].length&&(f=hashq(s[4].substr(s[4].length-f.length))+f),n+=f;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(Math.max(s[1].length,s[4].length),7),c+((o=SSF_frac(l,Math.pow(10,i)-1,!0))[0]||(o[1]?"":"0"))+" "+(o[1]?pad_(o[1],i)+s[2]+"/"+s[3]+rpad_(o[2],i):fill(" ",2*i+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return n=pad0r(r,0),t.length<=n.length?n:hashq(t.substr(0,t.length-n.length))+n;if(s=t.match(/^([#0?]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),i=n.indexOf(".");var u=t.indexOf(".")-i,h=t.length-n.length-u;return hashq(t.substr(0,u)+n+t.substr(t.length-h))}if(s=t.match(/^00,000\.([#0]*0)$/))return i=dec(r,s[1].length),r<0?"-"+write_num_flt(e,t,-r):commaify(flr(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,(function(e){return"00,"+(e.length<3?pad0(0,3-e.length):"")+e}))+"."+pad0(i,s[1].length);switch(t){case"###,##0.00":return write_num_flt(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var _=commaify(pad0r(l,0));return"0"!==_?c+_:"";case"###,###.00":return write_num_flt(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return write_num_flt(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function write_num_cm2(e,t,r){for(var a=t.length-1;44===t.charCodeAt(a-1);)--a;return write_num(e,t.substr(0,a),r/Math.pow(10,3*(t.length-a)))}function write_num_pct2(e,t,r){var a=t.replace(pct1,""),n=t.length-a.length;return write_num(e,a,r*Math.pow(10,2*n))+fill("%",n)}function write_num_exp2(e,t){var r,a=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(0==t)return"0.0E+0";if(t<0)return"-"+write_num_exp2(e,-t);var n=e.indexOf(".");-1===n&&(n=e.indexOf("E"));var s=Math.floor(Math.log(t)*Math.LOG10E)%n;if(s<0&&(s+=n),!(r=(t/Math.pow(10,s)).toPrecision(a+1+(n+s)%n)).match(/[Ee]/)){var i=Math.floor(Math.log(t)*Math.LOG10E);-1===r.indexOf(".")?r=r.charAt(0)+"."+r.substr(1)+"E+"+(i-r.length+s):r+="E+"+(i-s),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,(function(e,t,r,a){return t+r+a.substr(0,(n+s)%n)+"."+a.substr(s)+"E"}))}else r=t.toExponential(a);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function write_num_int(e,t,r){if(40===e.charCodeAt(0)&&!t.match(closeparen)){var a=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?write_num_int("n",a,r):"("+write_num_int("n",a,-r)+")"}if(44===t.charCodeAt(t.length-1))return write_num_cm2(e,t,r);if(-1!==t.indexOf("%"))return write_num_pct2(e,t,r);if(-1!==t.indexOf("E"))return write_num_exp2(t,r);if(36===t.charCodeAt(0))return"$"+write_num_int(e,t.substr(" "==t.charAt(1)?2:1),r);var n,s,i,o,l=Math.abs(r),c=r<0?"-":"";if(t.match(/^00+$/))return c+pad0(l,t.length);if(t.match(/^[#?]+$/))return n=""+r,0===r&&(n=""),n.length>t.length?n:hashq(t.substr(0,t.length-n.length))+n;if(s=t.match(frac1))return write_num_f2(s,l,c);if(t.match(/^#+0+$/))return c+pad0(l,t.length-t.indexOf("0"));if(s=t.match(dec1))return n=(n=(""+r).replace(/^([^\.]+)$/,"$1."+hashq(s[1])).replace(/\.$/,"."+hashq(s[1]))).replace(/\.(\d*)$/,(function(e,t){return"."+t+fill("0",hashq(s[1]).length-t.length)})),-1!==t.indexOf("0.")?n:n.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),s=t.match(/^(0*)\.(#*)$/))return c+(""+l).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,s[1].length?"0.":".");if(s=t.match(/^#{1,3},##0(\.?)$/))return c+commaify(""+l);if(s=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+write_num_int(e,t,-r):commaify(""+r)+"."+fill("0",s[1].length);if(s=t.match(/^#,#*,#0/))return write_num_int(e,t.replace(/^#,#*,/,""),r);if(s=t.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_strrev(write_num_int(e,t.replace(/[\\-]/g,""),r)),i=0,_strrev(_strrev(t.replace(/\\/g,"")).replace(/[0#]/g,(function(e){return i<n.length?n.charAt(i++):"0"===e?"0":""})));if(t.match(phone))return"("+(n=write_num_int(e,"##########",r)).substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(s=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(s[4].length,7),o=SSF_frac(l,Math.pow(10,i)-1,!1),n=""+c," "==(f=write_num("n",s[1],o[1])).charAt(f.length-1)&&(f=f.substr(0,f.length-1)+"0"),n+=f+s[2]+"/"+s[3],(f=rpad_(o[2],i)).length<s[4].length&&(f=hashq(s[4].substr(s[4].length-f.length))+f),n+=f;if(s=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return i=Math.min(Math.max(s[1].length,s[4].length),7),c+((o=SSF_frac(l,Math.pow(10,i)-1,!0))[0]||(o[1]?"":"0"))+" "+(o[1]?pad_(o[1],i)+s[2]+"/"+s[3]+rpad_(o[2],i):fill(" ",2*i+1+s[2].length+s[3].length));if(s=t.match(/^[#0?]+$/))return n=""+r,t.length<=n.length?n:hashq(t.substr(0,t.length-n.length))+n;if(s=t.match(/^([#0]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(s[2].length,10)).replace(/([^0])0+$/,"$1"),i=n.indexOf(".");var u=t.indexOf(".")-i,h=t.length-n.length-u;return hashq(t.substr(0,u)+n+t.substr(t.length-h))}if(s=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+write_num_int(e,t,-r):commaify(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,(function(e){return"00,"+(e.length<3?pad0(0,3-e.length):"")+e}))+"."+pad0(0,s[1].length);switch(t){case"###,###":case"##,###":case"#,###":var _=commaify(""+l);return"0"!==_?c+_:"";default:if(t.match(/\.[0#?]*$/))return write_num_int(e,t.slice(0,t.lastIndexOf(".")),r)+hashq(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function write_num(e,t,r){return(0|r)===r?write_num_int(e,t,r):write_num_flt(e,t,r)}function SSF_split_fmt(e){for(var t=[],r=!1,a=0,n=0;a<e.length;++a)switch(e.charCodeAt(a)){case 34:r=!r;break;case 95:case 42:case 92:++a;break;case 59:t[t.length]=e.substr(n,a-n),n=a+1}if(t[t.length]=e.substr(n),!0===r)throw new Error("Format |"+e+"| unterminated string ");return t}var SSF_abstime=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function fmt_is_date(e){for(var t=0,r="",a="";t<e.length;)switch(r=e.charAt(t)){case"G":SSF_isgeneral(e,t)&&(t+=6),t++;break;case'"':for(;34!==e.charCodeAt(++t)&&t<e.length;);++t;break;case"\\":case"_":t+=2;break;case"@":++t;break;case"B":case"b":if("1"===e.charAt(t+1)||"2"===e.charAt(t+1))return!0;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":return!0;case"A":case"a":case"上":if("A/P"===e.substr(t,3).toUpperCase())return!0;if("AM/PM"===e.substr(t,5).toUpperCase())return!0;if("上午/下午"===e.substr(t,5).toUpperCase())return!0;++t;break;case"[":for(a=r;"]"!==e.charAt(t++)&&t<e.length;)a+=e.charAt(t);if(a.match(SSF_abstime))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(r=e.charAt(++t))>-1||"\\"==r&&"-"==e.charAt(t+1)&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===r;);break;case"*":++t," "!=e.charAt(t)&&"*"!=e.charAt(t)||++t;break;case"(":case")":++t;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;t<e.length&&"0123456789".indexOf(e.charAt(++t))>-1;);break;default:++t}return!1}function eval_fmt(e,t,r,a){for(var n,s,i,o=[],l="",c=0,f="",u="t",h="H";c<e.length;)switch(f=e.charAt(c)){case"G":if(!SSF_isgeneral(e,c))throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"G",v:"General"},c+=7;break;case'"':for(l="";34!==(i=e.charCodeAt(++c))&&c<e.length;)l+=String.fromCharCode(i);o[o.length]={t:"t",v:l},++c;break;case"\\":var _=e.charAt(++c),d="("===_||")"===_?_:"t";o[o.length]={t:d,v:_},++c;break;case"_":o[o.length]={t:"t",v:" "},c+=2;break;case"@":o[o.length]={t:"T",v:t},++c;break;case"B":case"b":if("1"===e.charAt(c+1)||"2"===e.charAt(c+1)){if(null==n&&null==(n=SSF_parse_date_code(t,r,"2"===e.charAt(c+1))))return"";o[o.length]={t:"X",v:e.substr(c,2)},u=f,c+=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(t<0)return"";if(null==n&&null==(n=SSF_parse_date_code(t,r)))return"";for(l=f;++c<e.length&&e.charAt(c).toLowerCase()===f;)l+=f;"m"===f&&"h"===u.toLowerCase()&&(f="M"),"h"===f&&(f=h),o[o.length]={t:f,v:l},u=f;break;case"A":case"a":case"上":var p={t:f,v:f};if(null==n&&(n=SSF_parse_date_code(t,r)),"A/P"===e.substr(c,3).toUpperCase()?(null!=n&&(p.v=n.H>=12?e.charAt(c+2):f),p.t="T",h="h",c+=3):"AM/PM"===e.substr(c,5).toUpperCase()?(null!=n&&(p.v=n.H>=12?"PM":"AM"),p.t="T",c+=5,h="h"):"上午/下午"===e.substr(c,5).toUpperCase()?(null!=n&&(p.v=n.H>=12?"下午":"上午"),p.t="T",c+=5,h="h"):(p.t="t",++c),null==n&&"T"===p.t)return"";o[o.length]=p,u=f;break;case"[":for(l=f;"]"!==e.charAt(c++)&&c<e.length;)l+=e.charAt(c);if("]"!==l.slice(-1))throw'unterminated "[" block: |'+l+"|";if(l.match(SSF_abstime)){if(null==n&&null==(n=SSF_parse_date_code(t,r)))return"";o[o.length]={t:"Z",v:l.toLowerCase()},u=l.charAt(1)}else l.indexOf("$")>-1&&(l=(l.match(/\$([^-\[\]]*)/)||[])[1]||"$",fmt_is_date(e)||(o[o.length]={t:"t",v:l}));break;case".":if(null!=n){for(l=f;++c<e.length&&"0"===(f=e.charAt(c));)l+=f;o[o.length]={t:"s",v:l};break}case"0":case"#":for(l=f;++c<e.length&&"0#?.,E+-%".indexOf(f=e.charAt(c))>-1;)l+=f;o[o.length]={t:"n",v:l};break;case"?":for(l=f;e.charAt(++c)===f;)l+=f;o[o.length]={t:f,v:l},u=f;break;case"*":++c," "!=e.charAt(c)&&"*"!=e.charAt(c)||++c;break;case"(":case")":o[o.length]={t:1===a?"t":f,v:f},++c;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(l=f;c<e.length&&"0123456789".indexOf(e.charAt(++c))>-1;)l+=e.charAt(c);o[o.length]={t:"D",v:l};break;case" ":o[o.length]={t:f,v:f},++c;break;case"$":o[o.length]={t:"t",v:"$"},++c;break;default:if(-1===",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f))throw new Error("unrecognized character "+f+" in "+e);o[o.length]={t:"t",v:f},++c}var m,w,g=0,b=0;for(c=o.length-1,u="t";c>=0;--c)switch(o[c].t){case"h":case"H":o[c].t=h,u="h",g<1&&(g=1);break;case"s":(m=o[c].v.match(/\.0+$/))&&(b=Math.max(b,m[0].length-1),g=4),g<3&&(g=3);case"d":case"y":case"e":u=o[c].t;break;case"M":u=o[c].t,g<2&&(g=2);break;case"m":"s"===u&&(o[c].t="M",g<2&&(g=2));break;case"X":break;case"Z":g<1&&o[c].v.match(/[Hh]/)&&(g=1),g<2&&o[c].v.match(/[Mm]/)&&(g=2),g<3&&o[c].v.match(/[Ss]/)&&(g=3)}switch(g){case 0:break;case 1:case 2:case 3:n.u>=.5&&(n.u=0,++n.S),n.S>=60&&(n.S=0,++n.M),n.M>=60&&(n.M=0,++n.H),n.H>=24&&(n.H=0,++n.D,(w=SSF_parse_date_code(n.D)).u=n.u,w.S=n.S,w.M=n.M,w.H=n.H,n=w);break;case 4:switch(b){case 1:n.u=Math.round(10*n.u)/10;break;case 2:n.u=Math.round(100*n.u)/100;break;case 3:n.u=Math.round(1e3*n.u)/1e3}n.u>=1&&(n.u=0,++n.S),n.S>=60&&(n.S=0,++n.M),n.M>=60&&(n.M=0,++n.H),n.H>=24&&(n.H=0,++n.D,(w=SSF_parse_date_code(n.D)).u=n.u,w.S=n.S,w.M=n.M,w.H=n.H,n=w)}var v,S="";for(c=0;c<o.length;++c)switch(o[c].t){case"t":case"T":case" ":case"D":break;case"X":o[c].v="",o[c].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":o[c].v=SSF_write_date(o[c].t.charCodeAt(0),o[c].v,n,b),o[c].t="t";break;case"n":case"?":for(v=c+1;null!=o[v]&&("?"===(f=o[v].t)||"D"===f||(" "===f||"t"===f)&&null!=o[v+1]&&("?"===o[v+1].t||"t"===o[v+1].t&&"/"===o[v+1].v)||"("===o[c].t&&(" "===f||"n"===f||")"===f)||"t"===f&&("/"===o[v].v||" "===o[v].v&&null!=o[v+1]&&"?"==o[v+1].t));)o[c].v+=o[v].v,o[v]={v:"",t:";"},++v;S+=o[c].v,c=v-1;break;case"G":o[c].t="t",o[c].v=SSF_general(t,r)}var x,T,E="";if(S.length>0){40==S.charCodeAt(0)?(x=t<0&&45===S.charCodeAt(0)?-t:t,T=write_num("n",S,x)):(T=write_num("n",S,x=t<0&&a>1?-t:t),x<0&&o[0]&&"t"==o[0].t&&(T=T.substr(1),o[0].v="-"+o[0].v)),v=T.length-1;var y=o.length;for(c=0;c<o.length;++c)if(null!=o[c]&&"t"!=o[c].t&&o[c].v.indexOf(".")>-1){y=c;break}var k=o.length;if(y===o.length&&-1===T.indexOf("E")){for(c=o.length-1;c>=0;--c)null!=o[c]&&-1!=="n?".indexOf(o[c].t)&&(v>=o[c].v.length-1?(v-=o[c].v.length,o[c].v=T.substr(v+1,o[c].v.length)):v<0?o[c].v="":(o[c].v=T.substr(0,v+1),v=-1),o[c].t="t",k=c);v>=0&&k<o.length&&(o[k].v=T.substr(0,v+1)+o[k].v)}else if(y!==o.length&&-1===T.indexOf("E")){for(v=T.indexOf(".")-1,c=y;c>=0;--c)if(null!=o[c]&&-1!=="n?".indexOf(o[c].t)){for(s=o[c].v.indexOf(".")>-1&&c===y?o[c].v.indexOf(".")-1:o[c].v.length-1,E=o[c].v.substr(s+1);s>=0;--s)v>=0&&("0"===o[c].v.charAt(s)||"#"===o[c].v.charAt(s))&&(E=T.charAt(v--)+E);o[c].v=E,o[c].t="t",k=c}for(v>=0&&k<o.length&&(o[k].v=T.substr(0,v+1)+o[k].v),v=T.indexOf(".")+1,c=y;c<o.length;++c)if(null!=o[c]&&(-1!=="n?(".indexOf(o[c].t)||c===y)){for(s=o[c].v.indexOf(".")>-1&&c===y?o[c].v.indexOf(".")+1:0,E=o[c].v.substr(0,s);s<o[c].v.length;++s)v<T.length&&(E+=T.charAt(v++));o[c].v=E,o[c].t="t",k=c}}}for(c=0;c<o.length;++c)null!=o[c]&&"n?".indexOf(o[c].t)>-1&&(x=a>1&&t<0&&c>0&&"-"===o[c-1].v?-t:t,o[c].v=write_num(o[c].t,o[c].v,x),o[c].t="t");var A="";for(c=0;c!==o.length;++c)null!=o[c]&&(A+=o[c].v);return A}var cfregex2=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function chkcond(e,t){if(null==t)return!1;var r=parseFloat(t[2]);switch(t[1]){case"=":if(e==r)return!0;break;case">":if(e>r)return!0;break;case"<":if(e<r)return!0;break;case"<>":if(e!=r)return!0;break;case">=":if(e>=r)return!0;break;case"<=":if(e<=r)return!0}return!1}function choose_fmt(e,t){var r=SSF_split_fmt(e),a=r.length,n=r[a-1].indexOf("@");if(a<4&&n>-1&&--a,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if("number"!=typeof t)return[4,4===r.length||n>-1?r[r.length-1]:"@"];switch("number"!=typeof t||isFinite(t)||(t=0),r.length){case 1:r=n>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=n>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=n>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"]}var s=t>0?r[0]:t<0?r[1]:r[2];if(-1===r[0].indexOf("[")&&-1===r[1].indexOf("["))return[a,s];if(null!=r[0].match(/\[[=<>]/)||null!=r[1].match(/\[[=<>]/)){var i=r[0].match(cfregex2),o=r[1].match(cfregex2);return chkcond(t,i)?[a,r[0]]:chkcond(t,o)?[a,r[1]]:[a,r[null!=i&&null!=o?2:1]]}return[a,s]}function SSF_format(e,t,r){null==r&&(r={});var a="";switch(typeof e){case"string":a="m/d/yy"==e&&r.dateNF?r.dateNF:e;break;case"number":null==(a=14==e&&r.dateNF?r.dateNF:(null!=r.table?r.table:table_fmt)[e])&&(a=r.table&&r.table[SSF_default_map[e]]||table_fmt[SSF_default_map[e]]),null==a&&(a=SSF_default_str[e]||"General")}if(SSF_isgeneral(a,0))return SSF_general(t,r);t instanceof Date&&(t=datenum(t,r.date1904));var n=choose_fmt(a,t);if(SSF_isgeneral(n[1]))return SSF_general(t,r);if(!0===t)t="TRUE";else if(!1===t)t="FALSE";else{if(""===t||null==t)return"";if(isNaN(t)&&n[1].indexOf("0")>-1)return"#NUM!";if(!isFinite(t)&&n[1].indexOf("0")>-1)return"#DIV/0!"}return eval_fmt(n[1],t,r,n[0])}function SSF_load(e,t){if("number"!=typeof t){t=+t||-1;for(var r=0;r<392;++r)if(null!=table_fmt[r]){if(table_fmt[r]==e){t=r;break}}else t<0&&(t=r);t<0&&(t=391)}return table_fmt[t]=e,t}function SSF_load_table(e){for(var t=0;392!=t;++t)void 0!==e[t]&&SSF_load(e[t],t)}function make_ssf(){table_fmt=SSF_init_table()}var SSF={format:SSF_format,load:SSF_load,_table:table_fmt,load_table:SSF_load_table,parse_date_code:SSF_parse_date_code,is_date:fmt_is_date,get_table:function(){return SSF._table=table_fmt}},SSFImplicit={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},dateNFregex=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function dateNF_regex(e){var t="number"==typeof e?table_fmt[e]:e;return t=t.replace(dateNFregex,"(\\d+)"),dateNFregex.lastIndex=0,new RegExp("^"+t+"$")}function dateNF_fix(e,t,r){var a=-1,n=-1,s=-1,i=-1,o=-1,l=-1;(t.match(dateNFregex)||[]).forEach((function(e,t){var c=parseInt(r[t+1],10);switch(e.toLowerCase().charAt(0)){case"y":a=c;break;case"d":s=c;break;case"h":i=c;break;case"s":l=c;break;case"m":i>=0?o=c:n=c}})),dateNFregex.lastIndex=0,l>=0&&-1==o&&n>=0&&(o=n,n=-1);var c=(""+(a>=0?a:(new Date).getFullYear())).slice(-4)+"-"+("00"+(n>=1?n:1)).slice(-2)+"-"+("00"+(s>=1?s:1)).slice(-2);7==c.length&&(c="0"+c),8==c.length&&(c="20"+c);var f=("00"+(i>=0?i:0)).slice(-2)+":"+("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2);return-1==i&&-1==o&&-1==l?c:-1==a&&-1==n&&-1==s?f:c+"T"+f}var bad_formats={"d.m":"d\\.m"};function SSF__load(e,t){return SSF_load(bad_formats[e]||e,t)}var _fs,CRC32=function(){var e={};e.version="1.2.0";var t=function(){for(var e=0,t=new Array(256),r=0;256!=r;++r)e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=r)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1,t[r]=e;return"undefined"!=typeof Int32Array?new Int32Array(t):t}();var r=function(e){var t=0,r=0,a=0,n="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(a=0;256!=a;++a)n[a]=e[a];for(a=0;256!=a;++a)for(r=e[a],t=256+a;t<4096;t+=256)r=n[t]=r>>>8^e[255&r];var s=[];for(a=1;16!=a;++a)s[a-1]="undefined"!=typeof Int32Array&&"function"==typeof n.subarray?n.subarray(256*a,256*a+256):n.slice(256*a,256*a+256);return s}(t),a=r[0],n=r[1],s=r[2],i=r[3],o=r[4],l=r[5],c=r[6],f=r[7],u=r[8],h=r[9],_=r[10],d=r[11],p=r[12],m=r[13],w=r[14];return e.table=t,e.bstr=function(e,r){for(var a=~r,n=0,s=e.length;n<s;)a=a>>>8^t[255&(a^e.charCodeAt(n++))];return~a},e.buf=function(e,r){for(var g=~r,b=e.length-15,v=0;v<b;)g=w[e[v++]^255&g]^m[e[v++]^g>>8&255]^p[e[v++]^g>>16&255]^d[e[v++]^g>>>24]^_[e[v++]]^h[e[v++]]^u[e[v++]]^f[e[v++]]^c[e[v++]]^l[e[v++]]^o[e[v++]]^i[e[v++]]^s[e[v++]]^n[e[v++]]^a[e[v++]]^t[e[v++]];for(b+=15;v<b;)g=g>>>8^t[255&(g^e[v++])];return~g},e.str=function(e,r){for(var a=~r,n=0,s=e.length,i=0,o=0;n<s;)(i=e.charCodeAt(n++))<128?a=a>>>8^t[255&(a^i)]:i<2048?a=(a=a>>>8^t[255&(a^(192|i>>6&31))])>>>8^t[255&(a^(128|63&i))]:i>=55296&&i<57344?(i=64+(1023&i),o=1023&e.charCodeAt(n++),a=(a=(a=(a=a>>>8^t[255&(a^(240|i>>8&7))])>>>8^t[255&(a^(128|i>>2&63))])>>>8^t[255&(a^(128|o>>6&15|(3&i)<<4))])>>>8^t[255&(a^(128|63&o))]):a=(a=(a=a>>>8^t[255&(a^(224|i>>12&15))])>>>8^t[255&(a^(128|i>>6&63))])>>>8^t[255&(a^(128|63&i))];return~a},e}(),CFB=function(){var e,t={};function r(e){if("/"==e.charAt(e.length-1))return-1===e.slice(0,-1).indexOf("/")?e:r(e.slice(0,-1));var t=e.lastIndexOf("/");return-1===t?e:e.slice(0,t+1)}function a(e){if("/"==e.charAt(e.length-1))return a(e.slice(0,-1));var t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}function n(e,t){"string"==typeof t&&(t=new Date(t));var r=t.getHours();r=(r=r<<6|t.getMinutes())<<5|t.getSeconds()>>>1,e.write_shift(2,r);var a=t.getFullYear()-1980;a=(a=a<<4|t.getMonth()+1)<<5|t.getDate(),e.write_shift(2,a)}function s(e){prep_blob(e,0);for(var t={},r=0;e.l<=e.length-4;){var a=e.read_shift(2),n=e.read_shift(2),s=e.l+n,i={};switch(a){case 21589:1&(r=e.read_shift(1))&&(i.mtime=e.read_shift(4)),n>5&&(2&r&&(i.atime=e.read_shift(4)),4&r&&(i.ctime=e.read_shift(4))),i.mtime&&(i.mt=new Date(1e3*i.mtime));break;case 1:var o=e.read_shift(4),l=e.read_shift(4);i.usz=l*Math.pow(2,32)+o,o=e.read_shift(4),l=e.read_shift(4),i.csz=l*Math.pow(2,32)+o}e.l=s,t[a]=i}return t}function i(){return e||(e=_fs)}function o(e,t){if(80==e[0]&&75==e[1])return ne(e,t);if(109==(32|e[0])&&105==(32|e[1]))return function(e,t){if("mime-version:"!=x(e.slice(0,13)).toLowerCase())throw new Error("Unsupported MAD header");var r=t&&t.root||"",a=(has_buf&&Buffer.isBuffer(e)?e.toString("binary"):x(e)).split("\r\n"),n=0,s="";for(n=0;n<a.length;++n)if(s=a[n],/^Content-Location:/i.test(s)&&(s=s.slice(s.indexOf("file")),r||(r=s.slice(0,s.lastIndexOf("/")+1)),s.slice(0,r.length)!=r))for(;r.length>0&&(r=(r=r.slice(0,r.length-1)).slice(0,r.lastIndexOf("/")+1),s.slice(0,r.length)!=r););var i=(a[1]||"").match(/boundary="(.*?)"/);if(!i)throw new Error("MAD cannot find boundary");var o="--"+(i[1]||""),l=[],c=[],f={FileIndex:l,FullPaths:c};h(f);var u,_=0;for(n=0;n<a.length;++n){var d=a[n];d!==o&&d!==o+"--"||(_++&&fe(f,a.slice(u,n),r),u=n)}return f}(e,t);if(e.length<512)throw new Error("CFB file size "+e.length+" < 512");var r,a,n,s,i,o,_=512,d=[],p=e.slice(0,512);prep_blob(p,0);var m=function(e){if(80==e[e.l]&&75==e[e.l+1])return[0,0];e.chk(g,"Header Signature: "),e.l+=16;var t=e.read_shift(2,"u");return[e.read_shift(2,"u"),t]}(p);switch(r=m[0]){case 3:_=512;break;case 4:_=4096;break;case 0:if(0==m[1])return ne(e,t);default:throw new Error("Major Version: Expected 3 or 4 saw "+r)}512!==_&&prep_blob(p=e.slice(0,_),28);var b=e.slice(0,_);!function(e,t){var r=9;switch(e.l+=2,r=e.read_shift(2)){case 9:if(3!=t)throw new Error("Sector Shift: Expected 9 saw "+r);break;case 12:if(4!=t)throw new Error("Sector Shift: Expected 12 saw "+r);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+r)}e.chk("0600","Mini Sector Shift: "),e.chk("000000000000","Reserved: ")}(p,r);var v=p.read_shift(4,"i");if(3===r&&0!==v)throw new Error("# Directory Sectors: Expected 0 saw "+v);p.l+=4,s=p.read_shift(4,"i"),p.l+=4,p.chk("00100000","Mini Stream Cutoff Size: "),i=p.read_shift(4,"i"),a=p.read_shift(4,"i"),o=p.read_shift(4,"i"),n=p.read_shift(4,"i");for(var S=-1,T=0;T<109&&!((S=p.read_shift(4,"i"))<0);++T)d[T]=S;var E=function(e,t){for(var r=Math.ceil(e.length/t)-1,a=[],n=1;n<r;++n)a[n-1]=e.slice(n*t,(n+1)*t);return a[r-1]=e.slice(r*t),a}(e,_);c(o,n,E,_,d);var y=function(e,t,r,a){var n=e.length,s=[],i=[],o=[],l=[],c=a-1,f=0,u=0,h=0,_=0;for(f=0;f<n;++f)if(o=[],(h=f+t)>=n&&(h-=n),!i[h]){l=[];var d=[];for(u=h;u>=0;){d[u]=!0,i[u]=!0,o[o.length]=u,l.push(e[u]);var p=r[Math.floor(4*u/a)];if(a<4+(_=4*u&c))throw new Error("FAT boundary crossed: "+u+" 4 "+a);if(!e[p])break;if(d[u=__readInt32LE(e[p],_)])break}s[h]={nodes:o,data:__toBuffer([l])}}return s}(E,s,d,_);s<y.length&&(y[s].name="!Directory"),a>0&&i!==w&&(y[i].name="!MiniFAT"),y[d[0]].name="!FAT",y.fat_addrs=d,y.ssz=_;var k=[],A=[],C=[];!function(e,t,r,a,n,s,i,o){for(var c,h=0,_=a.length?2:0,d=t[e].data,p=0,m=0;p<d.length;p+=128){var g=d.slice(p,p+128);prep_blob(g,64),m=g.read_shift(2),c=__utf16le(g,0,m-_),a.push(c);var b={name:c,type:g.read_shift(1),color:g.read_shift(1),L:g.read_shift(4,"i"),R:g.read_shift(4,"i"),C:g.read_shift(4,"i"),clsid:g.read_shift(16),state:g.read_shift(4,"i"),start:0,size:0};0!==g.read_shift(2)+g.read_shift(2)+g.read_shift(2)+g.read_shift(2)&&(b.ct=u(g,g.l-8)),0!==g.read_shift(2)+g.read_shift(2)+g.read_shift(2)+g.read_shift(2)&&(b.mt=u(g,g.l-8)),b.start=g.read_shift(4,"i"),b.size=g.read_shift(4,"i"),b.size<0&&b.start<0&&(b.size=b.type=0,b.start=w,b.name=""),5===b.type?(h=b.start,n>0&&h!==w&&(t[h].name="!StreamData")):b.size>=4096?(b.storage="fat",void 0===t[b.start]&&(t[b.start]=f(r,b.start,t.fat_addrs,t.ssz)),t[b.start].name=b.name,b.content=t[b.start].data.slice(0,b.size)):(b.storage="minifat",b.size<0?b.size=0:h!==w&&b.start!==w&&t[h]&&(b.content=l(b,t[h].data,(t[o]||{}).data))),b.content&&prep_blob(b.content,0),s[c]=b,i.push(b)}}(s,y,E,k,a,{},A,i),function(e,t,r){for(var a=0,n=0,s=0,i=0,o=0,l=r.length,c=[],f=[];a<l;++a)c[a]=f[a]=a,t[a]=r[a];for(;o<f.length;++o)n=e[a=f[o]].L,s=e[a].R,i=e[a].C,c[a]===a&&(-1!==n&&c[n]!==n&&(c[a]=c[n]),-1!==s&&c[s]!==s&&(c[a]=c[s])),-1!==i&&(c[i]=a),-1!==n&&a!=c[a]&&(c[n]=c[a],f.lastIndexOf(n)<o&&f.push(n)),-1!==s&&a!=c[a]&&(c[s]=c[a],f.lastIndexOf(s)<o&&f.push(s));for(a=1;a<l;++a)c[a]===a&&(-1!==s&&c[s]!==s?c[a]=c[s]:-1!==n&&c[n]!==n&&(c[a]=c[n]));for(a=1;a<l;++a)if(0!==e[a].type){if((o=a)!=c[o])do{o=c[o],t[a]=t[o]+"/"+t[a]}while(0!==o&&-1!==c[o]&&o!=c[o]);c[a]=-1}for(t[0]+="/",a=1;a<l;++a)2!==e[a].type&&(t[a]+="/")}(A,C,k),k.shift();var F={FileIndex:A,FullPaths:C};return t&&t.raw&&(F.raw={header:b,sectors:E}),F}function l(e,t,r){for(var a=e.start,n=e.size,s=[],i=a;r&&n>0&&i>=0;)s.push(t.slice(i*m,i*m+m)),n-=m,i=__readInt32LE(r,4*i);return 0===s.length?new_buf(0):bconcat(s).slice(0,e.size)}function c(e,t,r,a,n){var s=w;if(e===w){if(0!==t)throw new Error("DIFAT chain shorter than expected")}else if(-1!==e){var i=r[e],o=(a>>>2)-1;if(!i)return;for(var l=0;l<o&&(s=__readInt32LE(i,4*l))!==w;++l)n.push(s);t>=1&&c(__readInt32LE(i,a-4),t-1,r,a,n)}}function f(e,t,r,a,n){var s=[],i=[];n||(n=[]);var o=a-1,l=0,c=0;for(l=t;l>=0;){n[l]=!0,s[s.length]=l,i.push(e[l]);var f=r[Math.floor(4*l/a)];if(a<4+(c=4*l&o))throw new Error("FAT boundary crossed: "+l+" 4 "+a);if(!e[f])break;l=__readInt32LE(e[f],c)}return{nodes:s,data:__toBuffer([i])}}function u(e,t){return new Date(1e3*(__readUInt32LE(e,t+4)/1e7*Math.pow(2,32)+__readUInt32LE(e,t)/1e7-11644473600))}function h(e,t){var r=t||{},a=r.root||"Root Entry";if(e.FullPaths||(e.FullPaths=[]),e.FileIndex||(e.FileIndex=[]),e.FullPaths.length!==e.FileIndex.length)throw new Error("inconsistent CFB structure");0===e.FullPaths.length&&(e.FullPaths[0]=a+"/",e.FileIndex[0]={name:a,type:5}),r.CLSID&&(e.FileIndex[0].clsid=r.CLSID),function(e){var t="Sh33tJ5";if(CFB.find(e,"/"+t))return;var r=new_buf(4);r[0]=55,r[1]=r[3]=50,r[2]=54,e.FileIndex.push({name:t,type:2,content:r,size:4,L:69,R:69,C:69}),e.FullPaths.push(e.FullPaths[0]+t),_(e)}(e)}function _(e,t){h(e);for(var n=!1,s=!1,i=e.FullPaths.length-1;i>=0;--i){var o=e.FileIndex[i];switch(o.type){case 0:s?n=!0:(e.FileIndex.pop(),e.FullPaths.pop());break;case 1:case 2:case 5:s=!0,isNaN(o.R*o.L*o.C)&&(n=!0),o.R>-1&&o.L>-1&&o.R==o.L&&(n=!0);break;default:n=!0}}if(n||t){var l=new Date(1987,1,19),c=0,f=Object.create?Object.create(null):{},u=[];for(i=0;i<e.FullPaths.length;++i)f[e.FullPaths[i]]=!0,0!==e.FileIndex[i].type&&u.push([e.FullPaths[i],e.FileIndex[i]]);for(i=0;i<u.length;++i){var _=r(u[i][0]);for(s=f[_];!s;){for(;r(_)&&!f[r(_)];)_=r(_);u.push([_,{name:a(_).replace("/",""),type:1,clsid:v,ct:l,mt:l,content:null}]),f[_]=!0,s=f[_=r(u[i][0])]}}for(u.sort((function(e,t){return function(e,t){for(var r=e.split("/"),a=t.split("/"),n=0,s=0,i=Math.min(r.length,a.length);n<i;++n){if(s=r[n].length-a[n].length)return s;if(r[n]!=a[n])return r[n]<a[n]?-1:1}return r.length-a.length}(e[0],t[0])})),e.FullPaths=[],e.FileIndex=[],i=0;i<u.length;++i)e.FullPaths[i]=u[i][0],e.FileIndex[i]=u[i][1];for(i=0;i<u.length;++i){var d=e.FileIndex[i],p=e.FullPaths[i];if(d.name=a(p).replace("/",""),d.L=d.R=d.C=-(d.color=1),d.size=d.content?d.content.length:0,d.start=0,d.clsid=d.clsid||v,0===i)d.C=u.length>1?1:-1,d.size=0,d.type=5;else if("/"==p.slice(-1)){for(c=i+1;c<u.length&&r(e.FullPaths[c])!=p;++c);for(d.C=c>=u.length?-1:c,c=i+1;c<u.length&&r(e.FullPaths[c])!=r(p);++c);d.R=c>=u.length?-1:c,d.type=1}else r(e.FullPaths[i+1]||"")==r(p)&&(d.R=i+1),d.type=2}}}function d(e,t){var r=t||{};if("mad"==r.fileType)return function(e,t){for(var r=t||{},a=r.boundary||"SheetJS",n=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+(a="------="+a).slice(2)+'"',"","",""],s=e.FullPaths[0],i=s,o=e.FileIndex[0],l=1;l<e.FullPaths.length;++l)if(i=e.FullPaths[l].slice(s.length),(o=e.FileIndex[l]).size&&o.content&&"Sh33tJ5"!=i){i=i.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,(function(e){return"_x"+e.charCodeAt(0).toString(16)+"_"})).replace(/[\u0080-\uFFFF]/g,(function(e){return"_u"+e.charCodeAt(0).toString(16)+"_"}));for(var c=o.content,f=has_buf&&Buffer.isBuffer(c)?c.toString("binary"):x(c),u=0,h=Math.min(1024,f.length),_=0,d=0;d<=h;++d)(_=f.charCodeAt(d))>=32&&_<128&&++u;var p=u>=4*h/5;n.push(a),n.push("Content-Location: "+(r.root||"file:///C:/SheetJS/")+i),n.push("Content-Transfer-Encoding: "+(p?"quoted-printable":"base64")),n.push("Content-Type: "+oe(o,i)),n.push(""),n.push(p?ce(f):le(f))}return n.push(a+"--\r\n"),n.join("\r\n")}(e,r);if(_(e),"zip"===r.fileType)return function(e,t){var r=t||{},a=[],s=[],i=new_buf(1),o=r.compression?8:0,l=0;0;var c=0,f=0,u=0,h=0,_=e.FullPaths[0],d=_,p=e.FileIndex[0],m=[],w=0;for(c=1;c<e.FullPaths.length;++c)if(d=e.FullPaths[c].slice(_.length),(p=e.FileIndex[c]).size&&p.content&&(!Array.isArray(p.content)||0!=p.content.length)&&"Sh33tJ5"!=d){var g=u,b=new_buf(d.length);for(f=0;f<d.length;++f)b.write_shift(1,127&d.charCodeAt(f));b=b.slice(0,b.l),m[h]="string"==typeof p.content?CRC32.bstr(p.content,0):CRC32.buf(p.content,0);var v="string"==typeof p.content?s2a(p.content):p.content;8==o&&(v=T(v)),(i=new_buf(30)).write_shift(4,67324752),i.write_shift(2,20),i.write_shift(2,l),i.write_shift(2,o),p.mt?n(i,p.mt):i.write_shift(4,0),i.write_shift(-4,8&l?0:m[h]),i.write_shift(4,8&l?0:v.length),i.write_shift(4,8&l?0:p.content.length),i.write_shift(2,b.length),i.write_shift(2,0),u+=i.length,a.push(i),u+=b.length,a.push(b),u+=v.length,a.push(v),8&l&&((i=new_buf(12)).write_shift(-4,m[h]),i.write_shift(4,v.length),i.write_shift(4,p.content.length),u+=i.l,a.push(i)),(i=new_buf(46)).write_shift(4,33639248),i.write_shift(2,0),i.write_shift(2,20),i.write_shift(2,l),i.write_shift(2,o),i.write_shift(4,0),i.write_shift(-4,m[h]),i.write_shift(4,v.length),i.write_shift(4,p.content.length),i.write_shift(2,b.length),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(4,0),i.write_shift(4,g),w+=i.l,s.push(i),w+=b.length,s.push(b),++h}return i=new_buf(22),i.write_shift(4,101010256),i.write_shift(2,0),i.write_shift(2,0),i.write_shift(2,h),i.write_shift(2,h),i.write_shift(4,w),i.write_shift(4,u),i.write_shift(2,0),bconcat([bconcat(a),bconcat(s),i])}(e,r);var a=function(e){for(var t=0,r=0,a=0;a<e.FileIndex.length;++a){var n=e.FileIndex[a];if(n.content){var s=n.content.length;s>0&&(s<4096?t+=s+63>>6:r+=s+511>>9)}}for(var i=e.FullPaths.length+3>>2,o=t+127>>7,l=(t+7>>3)+r+i+o,c=l+127>>7,f=c<=109?0:Math.ceil((c-109)/127);l+c+f+127>>7>c;)f=++c<=109?0:Math.ceil((c-109)/127);var u=[1,f,c,o,i,r,t,0];return e.FileIndex[0].size=t<<6,u[7]=(e.FileIndex[0].start=u[0]+u[1]+u[2]+u[3]+u[4]+u[5])+(u[6]+7>>3),u}(e),s=new_buf(a[7]<<9),i=0,o=0;for(i=0;i<8;++i)s.write_shift(1,b[i]);for(i=0;i<8;++i)s.write_shift(2,0);for(s.write_shift(2,62),s.write_shift(2,3),s.write_shift(2,65534),s.write_shift(2,9),s.write_shift(2,6),i=0;i<3;++i)s.write_shift(2,0);for(s.write_shift(4,0),s.write_shift(4,a[2]),s.write_shift(4,a[0]+a[1]+a[2]+a[3]-1),s.write_shift(4,0),s.write_shift(4,4096),s.write_shift(4,a[3]?a[0]+a[1]+a[2]-1:w),s.write_shift(4,a[3]),s.write_shift(-4,a[1]?a[0]-1:w),s.write_shift(4,a[1]),i=0;i<109;++i)s.write_shift(-4,i<a[2]?a[1]+i:-1);if(a[1])for(o=0;o<a[1];++o){for(;i<236+127*o;++i)s.write_shift(-4,i<a[2]?a[1]+i:-1);s.write_shift(-4,o===a[1]-1?w:o+1)}var l=function(e){for(o+=e;i<o-1;++i)s.write_shift(-4,i+1);e&&(++i,s.write_shift(-4,w))};for(o=i=0,o+=a[1];i<o;++i)s.write_shift(-4,S.DIFSECT);for(o+=a[2];i<o;++i)s.write_shift(-4,S.FATSECT);l(a[3]),l(a[4]);for(var c=0,f=0,u=e.FileIndex[0];c<e.FileIndex.length;++c)(u=e.FileIndex[c]).content&&((f=u.content.length)<4096||(u.start=o,l(f+511>>9)));for(l(a[6]+7>>3);511&s.l;)s.write_shift(-4,S.ENDOFCHAIN);for(o=i=0,c=0;c<e.FileIndex.length;++c)(u=e.FileIndex[c]).content&&(!(f=u.content.length)||f>=4096||(u.start=o,l(f+63>>6)));for(;511&s.l;)s.write_shift(-4,S.ENDOFCHAIN);for(i=0;i<a[4]<<2;++i){var h=e.FullPaths[i];if(h&&0!==h.length){u=e.FileIndex[i],0===i&&(u.start=u.size?u.start-1:w);var d=0===i&&r.root||u.name;if(d.length>31&&(console.error("Name "+d+" will be truncated to "+d.slice(0,31)),d=d.slice(0,31)),f=2*(d.length+1),s.write_shift(64,d,"utf16le"),s.write_shift(2,f),s.write_shift(1,u.type),s.write_shift(1,u.color),s.write_shift(-4,u.L),s.write_shift(-4,u.R),s.write_shift(-4,u.C),u.clsid)s.write_shift(16,u.clsid,"hex");else for(c=0;c<4;++c)s.write_shift(4,0);s.write_shift(4,u.state||0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,0),s.write_shift(4,u.start),s.write_shift(4,u.size),s.write_shift(4,0)}else{for(c=0;c<17;++c)s.write_shift(4,0);for(c=0;c<3;++c)s.write_shift(4,-1);for(c=0;c<12;++c)s.write_shift(4,0)}}for(i=1;i<e.FileIndex.length;++i)if((u=e.FileIndex[i]).size>=4096)if(s.l=u.start+1<<9,has_buf&&Buffer.isBuffer(u.content))u.content.copy(s,s.l,0,u.size),s.l+=u.size+511&-512;else{for(c=0;c<u.size;++c)s.write_shift(1,u.content[c]);for(;511&c;++c)s.write_shift(1,0)}for(i=1;i<e.FileIndex.length;++i)if((u=e.FileIndex[i]).size>0&&u.size<4096)if(has_buf&&Buffer.isBuffer(u.content))u.content.copy(s,s.l,0,u.size),s.l+=u.size+6