Lines Matching refs:if

37 var set_ansi = function(cp/*:number*/) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS…
58 if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2));
59 if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2));
60 if(c1 == 0xFEFF) return data.slice(1);
71if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200…
75 if(current_codepage === 1200) return String.fromCharCode(x);
97 if (isNaN(c2)) {
99 } else if (isNaN(c3)) {
111 if (c1 > 255)
115 if (c2 > 255)
119 if (c3 > 255)
123 if (isNaN(c2)) {
125 } else if (isNaN(c3)) {
143 if (e3 !== 64) {
148 if (e4 !== 64) {
157 if(typeof Buffer !== 'undefined') {
159 if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
165 if(typeof Buffer === 'undefined') return false;
167 if(!x) return false;
175 if(has_buf) return Buffer.alloc ? Buffer.alloc(len) : new Buffer(len);
182 if(has_buf) return Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : new Buffer(len);
188 if(has_buf) return Buffer_from(s, "binary");
193 if(typeof ArrayBuffer === 'undefined') return s2a(s);
200 if(Array.isArray(data)) return data.map(function(c) { return String.fromCharCode(c); }).join("");
205 if(typeof Uint8Array === 'undefined') throw new Error("Unsupported");
210 if(typeof ArrayBuffer == 'undefined') throw new Error("Unsupported");
211 if(data instanceof ArrayBuffer) return ab2a(new Uint8Array(data));
212 /*:: if(data instanceof ArrayBuffer) throw new Error("unreachable"); */
219 if(typeof Uint8Array !== "undefined") {
226 if(bufs[i] instanceof Uint8Array) o.set(bufs[i], maxlen);
227 else if(typeof bufs[i] == "string") o.set(new Uint8Array(s2a(bufs[i])), maxlen);
240 if(c < 0x80) o[widx++] = c;
241 else if(c < 0x800) {
244 } else if(c >= 0xD800 && c < 0xE000) {
256 if(widx > L) {
295 function pad0r(v/*:any*/,d/*:number*/)/*:string*/{if(v>p2_32||v<-p2_32) return pad0r1(v,d); var i =…
322 if(!t) t = {};
451 if((B - A) < 0.00000005) break;
456 if(Q > D) { if(Q_1 > D) { Q = Q_2; P = P_2; } else { Q = Q_1; P = P_1; } }
457 if(!mixed) return [0, sgn * P, Q];
462 if(v > 2958465 || v < 0) return null;
466 if(Math.abs(out.u) < 1e-6) out.u = 0;
467 if(opts && opts.date1904) date += 1462;
468 if(out.u > 0.9999) {
470 if(++time == 86400) { out.T = time = 0; ++date; ++out.D; }
472 if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;}
473 else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;}
475 if(date > 60) --date;
481 if(date < 60) dow = (dow + 6) % 7;
482 if(b2) dow = SSF_fix_hijri(d, dout);
496 if(date1904) epoch -= 1461*24*60*60*1000;
497 else if(v >= SSFbase1904) epoch += 24*60*60*1000;
509 if(o.indexOf("E") == -1) return o;
516 var o = SSF_strip_decimal(v.toFixed(12)); if(o.length <= w) return o;
517 o = v.toPrecision(10); if(o.length <= w) return o;
530 if(V >= -4 && V <= -1) o = v.toPrecision(10+V);
531 else if(Math.abs(V) <= 9) o = SSF_small_exp(v);
532 else if(V === 10) o = v.toFixed(10).substr(0,12);
556 if(v == null) return "";
557 if(v instanceof Date) return SSF_format(14, datenum_local(v, opts && opts.date1904), opts);
566 if(date < 60) dow = (dow + 6) % 7;
610if(fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') throw 'bad second fo…
611 if(val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length);
612 /*::if(!ss0) ss0 = 0; */
613 if(ss0 >= 2) tt = ss0 === 3 ? 1000 : 100;
616 if(ss >= 60*tt) ss = 0;
617 if(fmt === 's') return ss === 0 ? "0" : ""+ss/tt;
619 if(fmt === 'ss') return o.substr(0,2);
640 if(s.length <= w) return s;
660 if(fmt.match(/^#+0.0E\+0$/)) {
661 if(val == 0) return "0.0E+0";
662 else if(val < 0) return "-" + write_num_exp(fmt, -val);
663 var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E');
665 if(ee < 0) ee += period;
667 if(o.indexOf("e") === -1) {
669 if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee);
679if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.lengt…
680 if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e");
708 if (d < ('' + Math.round(_frac * dd)).length) return 0;
712 if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) {
718 if(val < 2147483647 && val > -2147483648) return ""+(val >= 0 ? (val|0) : (val-1|0));
722 if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
724 if(val >= 0) return write_num_flt('n', ffmt, val);
727 if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val);
728 if(fmt.indexOf('%') !== -1) return write_num_pct(type, fmt, val);
729 if(fmt.indexOf('E') !== -1) return write_num_exp(fmt, val);
730 if(fmt.charCodeAt(0) === 36) return "$"+write_num_flt(type,fmt.substr(fmt.charAt(1)==' '?2:1),val);
733 if(fmt.match(/^00+$/)) return sign + pad0r(aval,fmt.length);
734 if(fmt.match(/^[#?]+$/)) {
735 o = pad0r(val,0); if(o === "0") o = "";
738 if((r = fmt.match(frac1))) return write_num_f1(r, aval, sign);
739 if(fmt.match(/^#+0+$/)) return sign + pad0r(aval,fmt.length - fmt.indexOf("0"));
740 if((r = fmt.match(dec1))) {
745 if((r = fmt.match(/^(0*)\.(#*)$/))) {
748 if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify(pad0r(aval,0));
749 if((r = fmt.match(/^#,##0\.([#0]*0)$/))) {
752 if((r = fmt.match(/^#,#*,#0/))) return write_num_flt(type,fmt.replace(/^#,#*,/,""),val);
753 if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) {
758 if(fmt.match(phone)) {
763 if((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) {
768 if(oa.charAt(oa.length-1) == " ") oa = oa.substr(0,oa.length-1) + "0";
771 if(oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length-oa.length)) + oa;
775 if((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) {
780 if((r = fmt.match(/^[#0?]+$/))) {
782 if(fmt.length <= o.length) return o;
785 if((r = fmt.match(/^([#0?]+)\.([#0]+)$/))) {
791 if((r = fmt.match(/^00,000\.([#0]*0)$/))) {
818 if(fmt.match(/^#+0.0E\+0$/)) {
819 if(val == 0) return "0.0E+0";
820 else if(val < 0) return "-" + write_num_exp2(fmt, -val);
821 var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E');
823 if(ee < 0) ee += period;
825 if(!o.match(/[Ee]/)) {
827 if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee);
833if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.lengt…
834 if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e");
838 if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
840 if(val >= 0) return write_num_int('n', ffmt, val);
843 if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val);
844 if(fmt.indexOf('%') !== -1) return write_num_pct2(type, fmt, val);
845 if(fmt.indexOf('E') !== -1) return write_num_exp2(fmt, val);
846 if(fmt.charCodeAt(0) === 36) return "$"+write_num_int(type,fmt.substr(fmt.charAt(1)==' '?2:1),val);
849 if(fmt.match(/^00+$/)) return sign + pad0(aval,fmt.length);
850 if(fmt.match(/^[#?]+$/)) {
851 o = (""+val); if(val === 0) o = "";
854 if((r = fmt.match(frac1))) return write_num_f2(r, aval, sign);
855 if(fmt.match(/^#+0+$/)) return sign + pad0(aval,fmt.length - fmt.indexOf("0"));
856 if((r = fmt.match(dec1))) {
857 /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */
860 /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */
865 if((r = fmt.match(/^(0*)\.(#*)$/))) {
868 if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify((""+aval));
869 if((r = fmt.match(/^#,##0\.([#0]*0)$/))) {
872 if((r = fmt.match(/^#,#*,#0/))) return write_num_int(type,fmt.replace(/^#,#*,/,""),val);
873 if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) {
878 if(fmt.match(phone)) {
883 if((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) {
888 if(oa.charAt(oa.length-1) == " ") oa = oa.substr(0,oa.length-1) + "0";
891 if(oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length-oa.length)) + oa;
895 if((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) {
900 if((r = fmt.match(/^[#0?]+$/))) {
902 if(fmt.length <= o.length) return o;
905 if((r = fmt.match(/^([#0]+)\.([#0]+)$/))) {
911 if((r = fmt.match(/^00,000\.([#0]*0)$/))) {
919if(fmt.match(/\.[0#?]*$/)) return write_num_int(type, fmt.slice(0,fmt.lastIndexOf(".")), val) + ha…
939 if(in_str === true) throw new Error("Format |" + fmt + "| unterminated string ");
948 case 'G': if(SSF_isgeneral(fmt, i)) i+= 6; i++; break;
954 if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") return true;
960 if(fmt.substr(i, 3).toUpperCase() === "A/P") return true;
961 if(fmt.substr(i, 5).toUpperCase() === "AM/PM") return true;
962 if(fmt.substr(i, 5).toUpperCase() === "上午/下午") return true;
967 if(o.match(SSF_abstime)) return true;
975 case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break;
993 if(!SSF_isgeneral(fmt, i)) throw new Error('unrecognized character ' + c + ' in ' +fmt);
1004 if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") {
1005if(dt==null) { dt=SSF_parse_date_code(v, opts, fmt.charAt(i+1) === "2"); if(dt==null) return ""; }
1013 if(v < 0) return "";
1014 if(dt==null) { dt=SSF_parse_date_code(v, opts); if(dt==null) return ""; }
1016 if(c === 'm' && lst.toLowerCase() === 'h') c = 'M';
1017 if(c === 'h') c = hr;
1021 if(dt==null) dt=SSF_parse_date_code(v, opts);
1022if(fmt.substr(i, 3).toUpperCase() === "A/P") { if(dt!=null) q.v = dt.H >= 12 ? fmt.charAt(i+2) : c…
1023 …else if(fmt.substr(i,5).toUpperCase() === "AM/PM") { if(dt!=null) q.v = dt.H >= 12 ? "PM" : "AM"; …
1024 …else if(fmt.substr(i,5).toUpperCase() === "上午/下午") { if(dt!=null) q.v = dt.H >= 12 ? "下午" : "上午"; …
1026 if(dt==null && q.t === 'T') return "";
1031 if(o.slice(-1) !== ']') throw 'unterminated "[" block: |' + o + '|';
1032 if(o.match(SSF_abstime)) {
1033 if(dt==null) { dt=SSF_parse_date_code(v, opts); if(dt==null) return ""; }
1036 } else if(o.indexOf("$") > -1) {
1038 if(!fmt_is_date(fmt)) out[out.length] = {t:'t',v:o};
1043 if(dt != null) {
1054 case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; // **
1062if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized charac…
1071 case 'h': case 'H': out[i].t = hr; lst='h'; if(bt < 1) bt = 1; break;
1073 if((ssm=out[i].v.match(/\.0+$/))) ss0=Math.max(ss0,ssm[0].length-1);
1074 if(bt < 3) bt = 3;
1077 case 'm': if(lst === 's') { out[i].t = 'M'; if(bt < 2) bt = 2; } break;
1078 case 'X': /*if(out[i].v === "B2");*/
1081 if(bt < 1 && out[i].v.match(/[Hh]/)) bt = 1;
1082 if(bt < 2 && out[i].v.match(/[Mm]/)) bt = 2;
1083 if(bt < 3 && out[i].v.match(/[Ss]/)) bt = 3;
1090 /*::if(!dt) break;*/
1091 if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }
1092 if(dt.S >= 60) { dt.S = 0; ++dt.M; }
1093 if(dt.M >= 60) { dt.M = 0; ++dt.H; }
1096 /*::if(!dt) break;*/
1097 if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }
1098 if(dt.S >= 60) { dt.S = 0; ++dt.M; }
1109 /*::if(!dt) throw "unreachable"; */
1129 if(nstr.length > 0) {
1130 if(nstr.charCodeAt(0) == 40) /* '(' */ {
1136 if(myv < 0 && out[0] && out[0].t == 't') {
1143 …for(i=0; i < out.length; ++i) if(out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) …
1145 if(decpt === out.length && ostr.indexOf("E") === -1) {
1147 if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue;
1148if(jj>=out[i].v.length-1) { jj -= out[i].v.length; out[i].v = ostr.substr(jj+1, out[i].v.length); }
1149 else if(jj < 0) out[i].v = "";
1154 if(jj>=0 && lasti<out.length) out[lasti].v = ostr.substr(0,jj+1) + out[lasti].v;
1156 else if(decpt !== out.length && ostr.indexOf("E") === -1) {
1159 if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue;
1163if(jj>=0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + v…
1169 if(jj>=0 && lasti<out.length) out[lasti].v = ostr.substr(0,jj+1) + out[lasti].v;
1172 if(out[i] == null || ('n?('.indexOf(out[i].t) === -1 && i !== decpt)) continue;
1176 if(jj<ostr.length) vv += ostr.charAt(jj++);
1184 for(i=0; i<out.length; ++i) if(out[i] != null && 'n?'.indexOf(out[i].t)>-1) {
1190 for(i=0; i !== out.length; ++i) if(out[i] != null) retval += out[i].v;
1196 if(rr == null) return false;
1199 case "=": if(v == thresh) return true; break;
1200 case ">": if(v > thresh) return true; break;
1201 case "<": if(v < thresh) return true; break;
1202 case "<>": if(v != thresh) return true; break;
1203 case ">=": if(v >= thresh) return true; break;
1204 case "<=": if(v <= thresh) return true; break;
1211 if(l<4 && lat>-1) --l;
1212 if(fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|");
1213 if(typeof v !== "number") return [4, fmt.length === 4 || lat>-1?fmt[fmt.length-1]:"@"];
1221 if(fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l, ff];
1222 if(fmt[0].match(/\[[=<>]/) != null || fmt[1].match(/\[[=<>]/) != null) {
1230 if(o == null) o = {};
1234 if(fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF;
1238 if(fmt == 14 && o.dateNF) sfmt = o.dateNF;
1240if(sfmt == null) sfmt = (o.table && o.table[SSF_default_map[fmt]]) || table_fmt[SSF_default_map[fm…
1241 if(sfmt == null) sfmt = SSF_default_str[fmt] || "General";
1244 if(SSF_isgeneral(sfmt,0)) return SSF_general(v, o);
1245 if(v instanceof Date) v = datenum_local(v, o.date1904);
1247 if(SSF_isgeneral(f[1])) return SSF_general(v, o);
1248 if(v === true) v = "TRUE"; else if(v === false) v = "FALSE";
1249 else if(v === "" || v == null) return "";
1253 if(typeof idx != 'number') {
1255 /*::if(typeof idx != 'number') return 0x188; */
1257 /*::if(typeof idx != 'number') return 0x188; */
1258 if(table_fmt[i] == undefined) { if(idx < 0) idx = i; continue; }
1259 if(table_fmt[i] == fmt) { idx = i; break; }
1261 /*::if(typeof idx != 'number') return 0x188; */
1262 if(idx < 0) idx = 0x187;
1264 /*::if(typeof idx != 'number') return 0x188; */
1270 if(tbl[i] !== undefined) SSF_load(tbl[i], i);
1341 case 'm': if(H >= 0) M = v; else m = v; break;
1344 if(S >= 0 && M == -1 && m >= 0) { M = m; m = -1; }
1346 if(datestr.length == 7) datestr = "0" + datestr;
1347 if(datestr.length == 8) datestr = "20" + datestr;
1349 if(H == -1 && M == -1 && S == -1) return datestr;
1350 if(Y == -1 && m == -1 && d == -1) return timestr;
1470 if(c < 0x80) {
1472 } else if(c < 0x800) {
1475 } else if(c >= 0xD800 && c < 0xE000) {
1503 if((c = L[i].length - R[i].length)) return c;
1504 if(L[i] != R[i]) return L[i] < R[i] ? -1 : 1;
1509if(p.charAt(p.length - 1) == "/") return (p.slice(0,-1).indexOf("/") === -1) ? p : dirname(p.slice…
1515 if(p.charAt(p.length - 1) == "/") return filename(p.slice(0, -1));
1528 if(typeof date === "string") date = new Date(date);
1569 if(flags & 1) p.mtime = blob.read_shift(4);
1571 if(sz > 5) {
1572 if(flags & 2) p.atime = blob.read_shift(4);
1573 if(flags & 4) p.ctime = blob.read_shift(4);
1575 if(p.mtime) p.mt = new Date(p.mtime*1000);
1594 if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options);
1595 if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options);
1596 if(file.length < 512) throw new Error("CFB file size " + file.length + " < 512");
1616 case 0: if(mv[1] == 0) return parse_zip(file, options);
1622 if(ssz !== 512) { blob = /*::(*/file.slice(0,ssz)/*:: :any)*/; prep_blob(blob, 28 /* blob.l */); }
1630 if(mver === 3 && dir_cnt !== 0) throw new Error('# Directory Sectors: Expected 0 saw ' + dir_cnt);
1659 if(q<0) break;
1672 if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT";
1690 if(options && options.raw) o.raw = {header: header, sectors: sectors};
1696 if(blob[blob.l] == 0x50 && blob[blob.l + 1] == 0x4b) return [0, 0];
1718 case 0x09: if(mver != 3) throw new Error('Sector Shift: Expected 9 saw ' + shift); break;
1719 case 0x0c: if(mver != 4) throw new Error('Sector Shift: Expected 12 saw ' + shift); break;
1749 if(dad[i] === i) {
1750 if(L !== -1 /*NOSTREAM*/ && dad[L] !== L) dad[i] = dad[L];
1751 if(R !== -1 && dad[R] !== R) dad[i] = dad[R];
1753 if(C !== -1 /*NOSTREAM*/) dad[C] = i;
1754 if(L !== -1 && i != dad[i]) { dad[L] = dad[i]; if(q.lastIndexOf(L) < j) q.push(L); }
1755 if(R !== -1 && i != dad[i]) { dad[R] = dad[i]; if(q.lastIndexOf(R) < j) q.push(R); }
1757 for(i=1; i < pl; ++i) if(dad[i] === i) {
1758 if(R !== -1 /*NOSTREAM*/ && dad[R] !== R) dad[i] = dad[R];
1759 else if(L !== -1 && dad[L] !== L) dad[i] = dad[L];
1763 if(FI[i].type === 0 /* unknown */) continue;
1765 if(j != dad[j]) do {
1774 if(FI[i].type !== 2 /* stream */) FP[i] += "/";
1788 if(o.length === 0) return (new_buf(0)/*:any*/);
1796 if(idx === ENDOFCHAIN) {
1797 if(cnt !== 0) throw new Error("DIFAT chain shorter than expected");
1798 } else if(idx !== -1 /*FREESECT*/) {
1800 if(!sector) return;
1802 if((q = __readInt32LE(sector,i*4)) === ENDOFCHAIN) break;
1805 if(cnt >= 1) sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs);
1812 if(!chkd) chkd = [];
1820 if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
1821 if(!sectors[addr]) break;
1834 k = (i + dir_start); if(k >= sl) k-=sl;
1835 if(chkd[k]) continue;
1845 if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
1846 if(!sectors[addr]) break;
1848 if(seen[j]) break;
1879 if(ctime !== 0) o.ct = read_date(blob, blob.l-8);
1881 if(mtime !== 0) o.mt = read_date(blob, blob.l-8);
1884 if(o.size < 0 && o.start < 0) { o.size = o.type = 0; o.start = ENDOFCHAIN; o.name = ""; }
1885 if(o.type === 5) { /* root */
1887 if(nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData";
1889 } else if(o.size >= 4096 /* MSCSZ */) {
1891if(sector_list[o.start] === undefined) sector_list[o.start] = get_sector_list(sectors, o.start, se…
1896 if(o.size < 0) o.size = 0;
1897 else if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
1901 if(o.content) prep_blob(o.content, 0);
1918 if(!type) {
1919 if(has_buf && Buffer.isBuffer(blob)) type = "buffer";
1922 …case "file": /*:: if(typeof blob !== 'string') throw "Must pass a filename when type='file'"; */re…
1923 …case "base64": /*:: if(typeof blob !== 'string') throw "Must pass a base64-encoded binary string w…
1924 …case "binary": /*:: if(typeof blob !== 'string') throw "Must pass a binary string when type='file'…
1931 if(!cfb.FullPaths) cfb.FullPaths = [];
1932 if(!cfb.FileIndex) cfb.FileIndex = [];
1933 if(cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure");
1934 if(cfb.FullPaths.length === 0) {
1938 if(o.CLSID) cfb.FileIndex[0].clsid = o.CLSID;
1943 if(CFB.find(cfb, "/" + nm)) return;
1956 if(s) gc = true;
1961 if(isNaN(_file.R * _file.L * _file.C)) gc = true;
1962 if(_file.R > -1 && _file.L > -1 && _file.R == _file.L) gc = true;
1967 if(!gc && !f) return;
1975 if(cfb.FileIndex[i].type === 0) continue;
2012 if(i === 0) {
2016 } else if(nm.slice(-1) == "/") {
2017 for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==nm) break;
2019 for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==dirname(nm)) break;
2023 if(dirname(cfb.FullPaths[i+1]||"") == dirname(nm)) elt.R = i + 1;
2033 if(_opts.fileType == 'mad') return write_mad(cfb, _opts);
2043 if(!file.content) continue;
2045 if(flen > 0){
2046 if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6;
2084 if(L[1]) {
2092 if(w) { ++i; o.write_shift(-4, ENDOFCHAIN); }
2103 if(!file.content) continue;
2104 /*:: if(file.content == null) throw new Error("unreachable"); */
2106 if(flen < 0x1000) continue;
2115 if(!file.content) continue;
2116 /*:: if(file.content == null) throw new Error("unreachable"); */
2118 if(!flen || flen >= 0x1000) continue;
2125 if(!nm || nm.length === 0) {
2132 if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN;
2134 if(_nm.length > 32) {
2146 if(!file.clsid) for(j = 0; j < 4; ++j) o.write_shift(4, 0);
2156 /*:: if(!file.content) throw new Error("unreachable"); */
2157 if(file.size >= 0x1000) {
2159 if (has_buf && Buffer.isBuffer(file.content)) {
2171 /*:: if(!file.content) throw new Error("unreachable"); */
2172 if(file.size > 0 && file.size < 0x1000) {
2173 if (has_buf && Buffer.isBuffer(file.content)) {
2183 if (has_buf) {
2196 if(path.charCodeAt(0) === 47 /* "/" */) { k = true; path = UCFullPaths[0].slice(0, -1) + path; }
2200 if(w !== -1) return cfb.FileIndex[w];
2204 if(m) UCPath = UCPath.replace(chr1,'!');
2206if((m ? UCFullPaths[w].replace(chr1,'!') : UCFullPaths[w]).replace(chr0,'') == UCPath) return cfb.…
2207if((m ? UCPaths[w].replace(chr1,'!') : UCPaths[w]).replace(chr0,'') == UCPath) return cfb.FileInde…
2240 …/*:: if(typeof Buffer == 'undefined' || !Buffer.isBuffer(o) || !(o instanceof Buffer)) throw new E…
2256 case "buffer": if(has_buf) return Buffer.isBuffer(o) ? o : Buffer_from(o);
2268 if(InflRaw.bytesRead) _zlib = zlib;
2273 if(!_zlib) return _inflate(payload, usz);
2301 if(b <= 8) return rev >>> (8-b);
2303 if(b <= 16) return rev >>> (16-b);
2319 if(n < 8 - w) return v & f;
2321 if(n < 16 - w) return v & f;
2323 if(n < 24 - w) return v & f;
2330 if(w <= 5) buf[h] |= (v & 7) << w;
2363 if(L >= sz) return b;
2364 if(has_buf) {
2367 if(b.copy) b.copy(o);
2370 } else if(use_typed_arrays) {
2372 if(a.set) a.set(b);
2402 if(maxlen < w) maxlen = w;
2409 if(ccode != 0) ctree[i] = bl_count[ccode+16]++;
2416 if(cleni != 0) {
2428 if(!use_typed_arrays) {
2480 if(L < 10) {
2482 if(bl & 7) bl += 8 - (bl & 7);
2499 if((match = addrs[hash])) {
2501 if(match > boff) match -= 0x8000;
2502 if(match < boff) while(data[match + mlen] == data[boff + mlen] && mlen < 250) ++mlen;
2505 if(mlen > 2) {
2508 if(d <= 22) bl = write_bits_8(out, bl, bitswap8[d+1]>>1) - 1;
2516 if(len_eb > 0) {
2526 if(dst_eb > 0) {
2538 if(d <= 143) d = d + 48;
2552 if(data.length < 8) return write_stored(data, out);
2586 if(maxlen < w) maxlen = w;
2595 for(i = 0; i < L; ++i) if((ccode = clens[i]) != 0) ctree[i] = next_code[ccode]++;
2600 if(cleni != 0) {
2628 if(maxlen < ccode) maxlen = ccode;
2645 if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }
2660 if((header >>> 1) == 0) {
2662 if(boff & 7) boff += 8 - (boff&7);
2667 if(sz > 0) {
2668 if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }
2672 } else if((header >> 1) == 1) {
2681 if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }
2687 if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;
2688 else if(code == 256) break;
2691 var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;
2694 if(len_eb > 0) {
2706 if(dst_eb > 0) {
2712 if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt + 100); OL = outbuf.length; }
2717 if(usz) return [outbuf, (boff+7)>>>3];
2729 if(wrn) { if(typeof console !== 'undefined') console.error(msg); }
2774 if(EF && EF[0x0001]) {
2775 if((EF[0x0001]||{}).usz) usz = EF[0x0001].usz;
2776 if((EF[0x0001]||{}).csz) csz = EF[0x0001].csz;
2794 if(flags & 0x2041) throw new Error("Unsupported ZIP encryption");
2804 if(efsz) {
2806 if((ef[0x5455]||{}).mt) date = ef[0x5455].mt;
2807 if((ef[0x0001]||{}).usz) _usz = ef[0x0001].usz;
2808 if((ef[0x0001]||{}).csz) _csz = ef[0x0001].csz;
2809 if(EF) {
2810 if((EF[0x5455]||{}).mt) date = EF[0x5455].mt;
2811 if((EF[0x0001]||{}).usz) _usz = ef[0x0001].usz;
2812 if((EF[0x0001]||{}).csz) _csz = ef[0x0001].csz;
2829 if(flags & 8) {
2831 if(crc32 == 0x08074b50) { crc32 = blob.read_shift(4); wrn = true; }
2836 if(_csz != csz) warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz);
2837 if(_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz);
2839 …//if((crc32>>0) != (_crc32>>0)) warn_or_throw(wrn, "Bad CRC32 checksum: " + crc32 + " != " + _crc3…
2848 if(desc) flags |= 8;
2858 if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue;
2868 if(method == 8) outbuf = _deflateRawSync(outbuf);
2877 if(fi.mt) write_dos_date(o, fi.mt);
2898 if(flags & 8) {
2961 if(fi.ctype) return fi.ctype;
2964 if(m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]];
2966 if(fp) {
2968 if(m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]];
3004 if(encoded.charAt(0) == "\n") encoded = "=0D" + encoded.slice(1);
3010 if(str.length == 0) { o.push(""); continue; }
3014 if(tmp.charAt(end - 1) == "=") end --;
3015 else if(tmp.charAt(end - 2) == "=") end -= 2;
3016 else if(tmp.charAt(end - 3) == "=") end -= 3;
3019 if(i < str.length) tmp += "=";
3047 if(!line || line.match(/^\s*$/)) break;
3049 if(m) switch(m[1].toLowerCase()) {
3062 if(ctype) file.ctype = ctype;
3066if(a2s(file.slice(0,13)).toLowerCase() != "mime-version:") throw new Error("Unsupported MAD header…
3072 /* if root is not specified, scan for the common prefix */
3075 if(!/^Content-Location:/i.test(row)) continue;
3077 if(!root) root = row.slice(0, row.lastIndexOf("/") + 1);
3078 if(row.slice(0, root.length) == root) continue;
3082 if(row.slice(0,root.length) == root) break;
3087 if(!mboundary) throw new Error("MAD cannot find boundary");
3099 if(line !== boundary && line !== boundary + "--") continue;
3100 if(fcnt++) parse_mime(o, data.slice(start_di, di), root);
3123 if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue;
3139 for(var csl = 0; csl <= L; ++csl) if((cc=cstr.charCodeAt(csl)) >= 0x20 && cc < 0x80) ++dispcnt;
3161 if(!unsafe) init_cfb(cfb);
3163 if(!file) {
3165 if(name.slice(0, fpath.length) == fpath) fpath = name;
3167 if(fpath.slice(-1) != "/") fpath += "/";
3173 if(!unsafe) CFB.utils.cfb_gc(cfb);
3175 /*:: if(!file) throw new Error("unreachable"); */
3178 if(opts) {
3179 if(opts.CLSID) file.clsid = opts.CLSID;
3180 if(opts.mt) file.mt = opts.mt;
3181 if(opts.ct) file.ct = opts.ct;
3189 if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) {
3200 if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) {
3239 if(typeof data === "string") return s2ab(data);
3240 if(Array.isArray(data)) return a2u(data);
3246if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload,…
3247 if(typeof Deno !== 'undefined') {
3249 if(enc && typeof payload == "string") switch(enc) {
3259 if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
3260 if(typeof Blob !== 'undefined') {
3263if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fna…
3265 if(typeof saveAs !== 'undefined') return saveAs(blob, fname);
3266if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.…
3269 if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") {
3270if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObj…
3274 if(a.download != null) {
3275 /*:: if(document.body == null) throw new Error("unreachable"); */
3277 /*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a);
3278if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObj…
3284if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try {…
3287 if(Array.isArray(payload)) payload = a2s(payload);
3289 } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; }
3295 if(typeof _fs !== 'undefined') return _fs.readFileSync(path);
3296 if(typeof Deno !== 'undefined') return Deno.readFileSync(path);
3298if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try {…
3303 } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; }
3308 …for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i…
3314 for(var i = 0; i !== K.length; ++i) if(o[obj[K[i]][key]] == null) o[obj[K[i]][key]] = K[i];
3333 if(o[obj[K[i]]] == null) o[obj[K[i]]] = [];
3342 if(date1904) epoch -= 1462*24*60*60*1000;
3352 if (out.getTimezoneOffset() !== refoffset) {
3362 if(!m) throw new Error("|" + s + "| is not an ISO8601 Duration");
3364 if(!m[i]) continue;
3366 if(i > 3) time = true;
3375 if(!time) throw new Error("Unsupported ISO Duration Field: M");
3391 if(good_pd) {
3392 /*:: if(fixdate == null) fixdate = 0; */
3393 if(fixdate > 0) d.setTime(d.getTime() + d.getTimezoneOffset() * 60 * 1000);
3394 else if(fixdate < 0) d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000);
3397 if(str instanceof Date) return str;
3398 if(good_pd_date.getFullYear() == 1917 && !isNaN(d.getFullYear())) {
3400 if(str.indexOf("" + s) > -1) return d;
3405 if(str.indexOf("Z") > -1) out = new Date(out.getTime() - out.getTimezoneOffset() * 60 * 1000);
3410 if(has_buf && Buffer.isBuffer(arr)) {
3411 if(debomit && buf_utf16le) {
3413 if(arr[0] == 0xFF && arr[1] == 0xFE) return utf8write(arr.slice(2).toString("utf16le"));
3414if(arr[1] == 0xFE && arr[2] == 0xFF) return utf8write(utf16beread(arr.slice(2).toString("binary"))…
3419 if(typeof TextDecoder !== "undefined") try {
3420 if(debomit) {
3421if(arr[0] == 0xFF && arr[1] == 0xFE) return utf8write(new TextDecoder("utf-16le").decode(arr.slice…
3422if(arr[0] == 0xFE && arr[1] == 0xFF) return utf8write(new TextDecoder("utf-16be").decode(arr.slice…
3433 if(Array.isArray(arr)) arr = new Uint8Array(arr);
3443 if(typeof JSON != 'undefined' && !Array.isArray(o)) return JSON.parse(JSON.stringify(o));
3444 if(typeof o != 'object' || o == null) return o;
3445 if(o instanceof Date) return new Date(o.getTime());
3447 for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
3456 if(!isNaN(v)) return isFinite(v) ? v : NaN;
3457 if(!/\d/.test(s)) return v;
3460 if(!isNaN(v = Number(ss))) return v / wt;
3462 if(!isNaN(v = Number(ss))) return v / wt;
3471 if(!M[2]) return new Date(1899,11,30,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0);
3472 if(M[3]) {
3473if(M[4]) return new Date(1899,11,30,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(…
3476 …else if(M[5]) return new Date(1899,11,30, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] …
3484 if(M) return fuzzytime1(M);
3488 if(isNaN(d)) return n;
3489 if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
3491 if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
3492 } else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n;
3493 if(y < 0 || y > 8099 || s.match(/[^-0-9:,\/\\]/)) return n;
3500 if(safe_split_regex || typeof re == "string") return str.split(re);
3507 if(!data) return null;
3508 if(data.content && data.type) return cc2str(data.content, true);
3509 if(data.data) return debom(data.data);
3510 if(data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString('binary'));
3511 if(data.asBinary) return debom(data.asBinary());
3512if(data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.…
3517 if(!data) return null;
3518 if(data.data) return char_codes(data.data);
3519 if(data.asNodeBuffer && has_buf) return data.asNodeBuffer();
3520 if(data._data && data._data.getContent) {
3522 if(typeof o == "string") return char_codes(o);
3525 if(data.content && data.type) return data.content;
3538 if(f == n || g == n) return zip.files ? zip.files[k[i]] : zip.FileIndex[i];
3545 if(o == null) throw new Error("Cannot find file " + file + " in zip");
3550 if(!safe) return getdata(getzipfile(zip, file));
3551 if(!file) return null;
3556 if(!safe) return getdatastr(getzipfile(zip, file));
3557 if(!file) return null;
3562 if(!safe) return getdatabin(getzipfile(zip, file));
3563 if(!file) return null;
3569 …for(var i = 0; i < k.length; ++i) if(k[i].slice(-1) != '/') o.push(k[i].replace(/^Root Entry[\/]/,…
3574 if(zip.FullPaths) {
3575 if(typeof content == "string") {
3577 if(has_buf) res = Buffer_from(content);
3579 //else if(typeof TextEncoder !== "undefined") res = new TextEncoder().encode(content);
3600 if(path.charAt(0) == "/") return path.slice(1);
3602 if(base.slice(-1) != "/") result.pop(); // folder path
3606 if (step === '..') result.pop();
3607 else if (step !== '.') result.push(step);
3619 for(; eq !== tag.length; ++eq) if((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break;
3620 if(!skip_root) z[0] = tag.slice(0, eq);
3621 if(eq === tag.length) return z;
3623 if(m) for(i = 0; i != m.length; ++i) {
3625 for(c=0; c != cc.length; ++c) if(cc.charCodeAt(c) === 61) break;
3630 for(j=0;j!=q.length;++j) if(q.charCodeAt(j) === 58) break;
3631 if(j===q.length) {
3632 if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods
3634 if(!skip_LC) z[q.toLowerCase()] = v;
3638 if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods
3640 if(!skip_LC) z[k.toLowerCase()] = v;
3663if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCod…
3713 if (c < 128) { out += String.fromCharCode(c); continue; }
3715if (c>191 && c<224) { f = ((c & 31) << 6); f |= (d & 63); out += String.fromCharCode(f); continue;…
3717if (c < 240) { out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); continue…
3730 if((c=data.charCodeAt(i)) < 128) w = c;
3731 else if(c < 224) { w = (c&31)*64+(data.charCodeAt(i+1)&63); j=2; }
3732 else if(c < 240) { w=(c&15)*4096+(data.charCodeAt(i+1)&63)*64+(data.charCodeAt(i+2)&63); j=3; }
3737 if(ww !== 0) { out[k++] = ww&255; out[k++] = ww>>>8; ww = 0; }
3779 if(mtcache[t]) return mtcache[t];
3810 if(vt_cache[bt] !== undefined) return vt_cache[bt];
3819 if(matches.length != h.size) {
3820 if(opts.WTF) throw new Error("unexpected vector length " + matches.length + " != " + h.size);
3825 if(v) res.push({v:utf8read(v[2]), t:v[1]});
3836 …:string*/ { try { return d.toISOString().replace(/\.\d*/,""); } catch(e) { if(t) throw e; } return…
3842 if(xlsx) o = o.replace(/&quot;/g, "_x0022_");
3847 if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
3852if(has_buf &&/*::typeof Buffer !== "undefined" && d != null && d instanceof Buffer &&*/ Buffer.isB…
3853 if(typeof d === 'string') return d;
3855 if(typeof Uint8Array !== 'undefined' && d instanceof Uint8Array) return utf8read(a2s(ab2a(d)));
3901 if(e == 0x7ff) return m == 0 ? (s * Infinity) : NaN;
3902 if(e == 0) e = -1022;
3910 if(!isFinite(av)) { e = 0x7ff; m = isNaN(v) ? 0x6969 : 0; }
3911 else if(av == 0) e = m = 0;
3915 if((e <= -1023) && (!isFinite(m) || (m < Math.pow(2,52)))) { e = -1022; }
3923 …s> >*/)/*:RawBytes*/ { var x=[],w=10240; for(var i=0;i<bufs[0].length;++i) if(bufs[0][i]) for(var …
3927 var __utf16le = has_buf ? function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/)/*:string*/ { if
3955 if(has_buf/*:: && typeof Buffer !== 'undefined'*/) {
3956 …__lpstr = function lpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(…
3957 …__cpstr = function cpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(…
3958 …__lpwstr = function lpwstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || …
3959 …__lpp4 = function lpp4_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b …
3960 …__8lpp4 = function lpp4_8b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(…
3961 …__double = function double_(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(Buffer.isBuffer(b)/*::&& b i…
3975 if(typeof $cptable !== 'undefined') cpdoit();
3989if(has_buf && Buffer.isBuffer(this) && buf_utf16le) o = this.slice(this.l, this.l+2*size).toStrin…
3998if(typeof $cptable !== 'undefined') o = $cptable.utils.decode(current_codepage, this.slice(this.l,…
4008 …case 'lpp4': size = 4 + __readUInt32LE(this, this.l); o = __lpp4(this, this.l); if(size & 0x02) s…
4010 …case '8lpp4': size = 4 + __readUInt32LE(this, this.l); o = __8lpp4(this, this.l); if(size & 0x03)…
4022 if(this.lens && this.lens.indexOf(loc) !== -1) {
4033 if(typeof $cptable !== 'undefined') {
4040 if(this.lens && this.lens.indexOf(loc) !== -1) {
4055if(t === 'i' || ((this[this.l+3] & 0x80)===0)) { oI = ((size > 0) ? __readInt32LE : __readInt32BE)…
4058 if(t === 'f') {
4059 if(size == 8) oR = __double(this, this.l);
4075 if(f === 'dbcs') {
4076 /*:: if(typeof val !== 'string') throw new Error("unreachable"); */
4079 } else if(f === 'sbcs' || f == 'cpstr') {
4080 if(typeof $cptable !== 'undefined' && current_ansi == 874) {
4082 /*:: if(typeof val !== "string") throw new Error("unreachable"); */
4088 } else if(typeof $cptable !== 'undefined' && f == 'cpstr') {
4091if(cpp.length == val.length) for(i = 0; i < val.length; ++i) if(cpp[i] == 0 && val.charCodeAt(i) !…
4092if(cpp.length == 2 * val.length) for(i = 0; i < val.length; ++i) if(cpp[2*i] == 0 && cpp[2*i+1] ==…
4096 /*:: if(typeof val !== 'string') throw new Error("unreachable"); */
4098 /*:: if(typeof val !== 'string') throw new Error("unreachable"); */
4102 } else if(f === 'hex') {
4104 /*:: if(typeof val !== "string") throw new Error("unreachable"); */
4107 } else if(f === 'utf16le') {
4108 /*:: if(typeof val !== "string") throw new Error("unreachable"); */
4117 } else /*:: if(typeof val === 'number') */ switch(t) {
4122 case 8: size = 8; if(f === 'f') { write_double_le(this, val, this.l); break; }
4132 if(m !== hexstr) throw new Error(fld + 'Expected ' + hexstr + ' saw ' + m);
4153 if(!data) return;
4159 if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7);
4167 if(cb(d, R, RT)) return;
4183 if(!curbuf) return;
4185 if(curbuf.l) {
4186 if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; }
4187 if(curbuf.length > 0) bufs.push(curbuf);
4193 if(curbuf && (sz < (curbuf.length - curbuf.l))) return curbuf;
4203 …var push = function ba_push(buf) { endbuf(); curbuf = buf; if(curbuf.l == null) curbuf.l = curbuf.…
4210 if(isNaN(t)) return; // TODO: throw something here?
4211 if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0;
4213 if(length >= 0x80) ++l; if(length >= 0x4000) ++l; if(length >= 0x200000) ++l;
4215 if(t <= 0x7F) o.write_shift(1, t);
4221 if(length >= 0x80) { o.write_shift(1, (length & 0x7F)+0x80); length >>= 7; }
4224 if(/*:: length != null &&*/length > 0 && is_buf(payload)) ba.push(payload);
4229 if(tgt.s) {
4230 if(out.cRel) out.c += tgt.s.c;
4231 if(out.rRel) out.r += tgt.s.r;
4233 if(out.cRel) out.c += tgt.c;
4234 if(out.rRel) out.r += tgt.r;
4236 if(!opts || opts.biff < 12) {
4251 if(c.cRel && c.c < 0) { c = dup(c); while(c.c < 0) c.c += (biff > 8) ? 0x4000 : 0x100; }
4252if(c.rRel && c.r < 0) { c = dup(c); while(c.r < 0) c.r += (biff > 8) ? 0x100000 : ((biff > 5) ? 0x…
4254 if(!c.cRel && c.cRel != null) s = fix_col(s);
4255 if(!c.rRel && c.rRel != null) s = fix_row(s);
4260 if(r.s.r == 0 && !r.s.rRel) {
4261 if(r.e.r == (opts.biff >= 12 ? 0xFFFFF : (opts.biff >= 8 ? 0x10000 : 0x4000)) && !r.e.rRel) {
4265 if(r.s.c == 0 && !r.s.cRel) {
4266 if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
4278 function encode_col(col/*:number*/)/*:string*/ { if(col < 0) throw new Error("invalid column " + co…
4288 if(cc >= 48 && cc <= 57) R = 10 * R + (cc - 48);
4289 else if(cc >= 65 && cc <= 90) C = 26 * C + (cc - 64);
4302 if(idx == -1) return { s: decode_cell(range), e: decode_cell(range) };
4305 /*# if only one arg, it is assumed to be a Range. If 2 args, both are cell addresses */
4307 if(typeof ce === 'undefined' || typeof ce === 'number') {
4308 /*:: if(!(cs instanceof Range)) throw "unreachable"; */
4311 /*:: if((cs instanceof Range)) throw "unreachable"; */
4312 if(typeof cs !== 'string') cs = encode_cell((cs/*:any*/));
4313 if(typeof ce !== 'string') ce = encode_cell((ce/*:any*/));
4314 /*:: if(typeof cs !== 'string') throw "unreachable"; */
4315 /*:: if(typeof ce !== 'string') throw "unreachable"; */
4325 if(!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) throw new Error("empty sheet name");
4326 if (/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(sname)) return "'" + sname.replace(/'/g, "''") + "'";
4335 if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break;
4341 if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break;
4346 if(i === len || cc != 10) { o.e.c=o.s.c; o.e.r=o.s.r; return o; }
4350 if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break;
4356 if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break;
4365 if(cell.z != null) try { return (cell.w = SSF_format(cell.z, q ? datenum(v) : v)); } catch(e) { }
4370 if(cell == null || cell.t == null || cell.t == 'z') return "";
4371 if(cell.w !== undefined) return cell.w;
4372 if(cell.t == 'd' && !cell.z && o && o.dateNF) cell.z = o.dateNF;
4373 if(cell.t == "e") return BErr[cell.v] || cell.v;
4374 if(v == undefined) return safe_format_cell(cell, cell.v);
4387 if(DENSE != null && dense == null) dense = DENSE;
4390 if(ws && o.origin != null) {
4391 if(typeof o.origin == 'number') _R = o.origin;
4396 if(!ws["!ref"]) ws["!ref"] = "A1:A1";
4399 if(ws['!ref']) {
4405 if(_R == -1) range.e.r = _R = _range.e.r + 1;
4408 if(!data[R]) continue;
4409 if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
4411 if(typeof data[R][C] === 'undefined') continue;
4414 if(range.s.r > __R) range.s.r = __R;
4415 if(range.s.c > __C) range.s.c = __C;
4416 if(range.e.r < __R) range.e.r = __R;
4417 if(range.e.c < __C) range.e.c = __C;
4418if(data[R][C] && typeof data[R][C] === 'object' && !Array.isArray(data[R][C]) && !(data[R][C] inst…
4420 if(Array.isArray(cell.v)) { cell.f = data[R][C][1]; cell.v = cell.v[0]; }
4421 if(cell.v === null) {
4422 if(cell.f) cell.t = 'n';
4423 else if(o.nullError) { cell.t = 'e'; cell.v = 0; }
4424 else if(!o.sheetStubs) continue;
4427 else if(typeof cell.v === 'number') cell.t = 'n';
4428 else if(typeof cell.v === 'boolean') cell.t = 'b';
4429 else if(cell.v instanceof Date) {
4431 if(o.cellDates) { cell.t = 'd'; cell.w = SSF_format(cell.z, datenum(cell.v, o.date1904)); }
4436 if(dense) {
4437 if(!ws[__R]) ws[__R] = [];
4438 if(ws[__R][__C] && ws[__R][__C].z) cell.z = ws[__R][__C].z;
4442 if(ws[cell_ref] && ws[cell_ref].z) cell.z = ws[cell_ref].z;
4447 if(range.s.c < 10000000) ws['!ref'] = encode_range(range);
4456 if (!o) o = new_buf(4);
4467 var _null = false; if (o == null) { _null = true; o = new_buf(4 + 2 * data.length); }
4469 if (data.length > 0) o.write_shift(0, data, 'dbcs');
4484 if (!o) o = new_buf(4);
4497 if ((flags & 1) !== 0) { /* fRichStr */
4504 //if((flags & 2) !== 0) { /* fExtStr */
4512 var _null = false; if (o == null) { _null = true; o = new_buf(15 + 4 * str.t.length); }
4521 var _null = false; if (o == null) { _null = true; o = new_buf(23 + 4 * str.t.length); }
4538 if (o == null) o = new_buf(8);
4553 if(o == null) o = new_buf(4);
4569 var _null = false; if (o == null) { _null = true; o = new_buf(127); }
4571 if (data.length > 0) o.write_shift(0, data, 'dbcs');
4593 if (o == null) o = new_buf(4);
4595 if ((data == (data | 0)) && (data >= -(1 << 29)) && (data < (1 << 29))) { fInt = 1; }
4596 …else if ((d100 == (d100 | 0)) && (d100 >= -(1 << 29)) && (d100 < (1 << 29))) { fInt = 1; fX100 = 1…
4597 if (fInt) o.write_shift(-4, ((fX100 ? d100 : data) << 2) + (fX100 + 2));
4612 if (!o) o = new_buf(16);
4647 if(data.length - data.l < 8) throw "XLS Xnum Buffer underflow";
4673 if (icv) out.rgb = rgb2Hex(icv);
4676 /* if(!fValidRGB) throw new Error("invalid"); */
4681 if (nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768;
4686 if (!o) o = new_buf(8);
4687 if (!color || color.auto) { o.write_shift(4, 0); o.write_shift(4, 0); return o; }
4688 if (color.index != null) {
4691 } else if (color.theme != null) {
4699 if (nTS > 0) nTS *= 32767;
4700 else if (nTS < 0) nTS *= 32768;
4702 if (!color.rgb || color.theme != null) {
4708 if (typeof rgb == 'number') rgb = ("000000" + rgb.toString(16)).slice(-6);
4734 if (!o) o = new_buf(2);
4756 if (m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16));
5317 if(!data || !data.match) return ct;
5326 if(ct[ct2type[y.ContentType]] !== undefined) ct[ct2type[y.ContentType]].push(y.PartName);
5330 if(ct.xmlns !== XMLNS.CT) throw new Error("Unknown Namespace: " + ct.xmlns);
5344 if(!raw) {
5373 if(ct[w] && ct[w].length > 0) {
5414 if(!raw && o.length>2){ o[o.length] = ('</Types>'); o[1]=o[1].replace("/>",">"); }
5461 if (!data) return rels;
5462 if (currentFilePath.charAt(0) !== '/') {
5470 if (y[0] === '<Relationship') {
5471 …var rel = {}; rel.Type = y.Type; rel.Target = y.Target; rel.Id = y.Id; if(y.TargetMode) rel.Target…
5491 if(o.length>2){ o[o.length] = ('</Relationships>'); o[1]=o[1].replace("/>",">"); }
5496 if(!relobj) relobj = {};
5497 if(!rels['!id']) rels['!id'] = {};
5498 if(!rels['!idx']) rels['!idx'] = 1;
5499 if(rId < 0) for(rId = rels['!idx']; rels['!id']['rId' + rId]; ++rId){/* empty */}
5504 if(targetmode) relobj.TargetMode = targetmode;
5505 …else if([RELS.HLINK, RELS.XPATH, RELS.XMISS].indexOf(relobj.Type) > -1) relobj.TargetMode = "Exter…
5506 if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId);
5522if(FEtag.path == '/' && FEtag.type !== CT_ODS) throw new Error("This OpenDocument is not a spreads…
5529 default: if(opts && opts.WTF) throw Rn;
5609 if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
5610 if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
5617 if(p[f] != null || g == null || g === "") return;
5633 if(!cp && !opts.Props) return o.join("");
5635 if(cp) {
5636if(cp.CreatedDate != null) cp_doit("dcterms:created", typeof cp.CreatedDate === "string" ? cp.Crea…
5637if(cp.ModifiedDate != null) cp_doit("dcterms:modified", typeof cp.ModifiedDate === "string" ? cp.M…
5643 if(v === true) v = "1";
5644 else if(v === false) v = "0";
5645 else if(typeof v == "number") v = String(v);
5646 if(v != null) cp_doit(f[0], v, null, o, p);
5648 if(o.length>2){ o[o.length] = ('</cp:coreProperties>'); o[1]=o[1].replace("/>",">"); }
5674 if(typeof HP == "string") v = parseVector(HP, opts);
5678 if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) {
5720 var q = {}; if(!p) p = {};
5726 case "string": if(xml) p[f[1]] = unescapexml(xml); break;
5730 if(cur && cur.length > 0) q[f[1]] = cur[1];
5735 if(q.HeadingPairs && q.TitlesOfParts) load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts);
5742 if(!cp) cp = {};
5751 if(cp[f[1]] === undefined) return;
5757 if(v !== undefined) o[o.length] = (W(f[0], v));
5763 if(o.length>2){ o[o.length] = ('</Properties>'); o[1]=o[1].replace("/>",">"); }
5771 if(m) for(var i = 0; i != m.length; ++i) {
5778 default: if (x.indexOf('<vt:') === 0) {
5802 if(type.slice(-1) == '/') break;
5803 if(opts.WTF && typeof console !== 'undefined') console.warn('Unexpected', x, type, toks);
5805 } else if(x.slice(0,2) === "</") {/* empty */
5806 } else if(opts.WTF) throw new Error(x);
5817 if(!cp) return o.join("");
5826 if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }
5865 if(!evert_XLMLDPM) evert_XLMLDPM = evert(XLMLDocPropsMap);
5873 for(var i = 0; i < CORE_PROPS.length; ++i) if(CORE_PROPS[i][1] == m) return CORE_PROPS[i];
5874 for(i = 0; i < EXT_PROPS.length; ++i) if(EXT_PROPS[i][1] == m) return EXT_PROPS[i];
5877 if(Props[p[1]] == null) return;
5882 if(typeof m == 'number') m = String(m);
5883 else if(m === true || m === false) { m = m ? "1" : "0"; }
5884 else if(m instanceof Date) m = new Date(m).toISOString().replace(/\.\d*Z/,"");
5893 if(Props) keys(Props).forEach(function(k) {
5894 /*:: if(!Props) return; */
5895 if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
5896 for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
5897 for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
5898 for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
5902 if(typeof m == 'number') { t = "float"; m = String(m); }
5903 else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; }
5907 if(Custprops) keys(Custprops).forEach(function(k) {
5908 /*:: if(!Custprops) return; */
5909 if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
5910 if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
5913 if(typeof m == 'number') { t = "float"; m = String(m); }
5914 else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; }
5915 else if(m instanceof Date) { t = "dateTime.tz"; m = m.toISOString(); }
5934 if(w > 0) { l = l % Math.pow(2,32); h += w; }
5942 if(pad) while((blob.l - start) & 3) ++blob.l;
5949 if(pad) blob.l += (4 - ((str.length+1) & 3)) & 3;
5957 if(stringType === 0x1F /*VT_LPWSTR*/) return parse_lpwstr(blob);
5962 function parse_VtUnalignedString(blob, t/*:number*/) { if(!t) throw new Error("VtUnalignedString mu…
5971 if((blob.l - start) & 0x02) blob.l += 2;
5989 if(blob[blob.l] == 0x00 && blob[blob.l+1] == 0x00 && ((blob.l - start) & 0x02)) blob.l += 2;
6010 if(CodePage === 0x4B0 && (len % 2)) blob.l += 2;
6012 if(blob.l & 3) blob.l = (blob.l>>2+1)<<2;
6021 if((size & 3) > 0) blob.l += (4 - (size & 3)) & 3;
6039 if(type !== VT_VARIANT)
6040if(t !== type && VT_CUSTOM.indexOf(type)===-1 && !((type & 0xFFFE) == 0x101E && (t & 0xFFFE) == 0x…
6042 case 0x02 /*VT_I2*/: ret = blob.read_shift(2, 'i'); if(!opts.raw) blob.l += 2; return ret;
6067 …case 0x40 /*VT_FILETIME*/: /*:: if(typeof value !== "string" && !(value instanceof Date)) throw "u…
6070 /*:: if(typeof value !== "string") throw "unreachable"; */
6097 if(blob.l !== Props[i][1]) {
6099 if(i>0 && PIDSI) switch(PIDSI[Props[i-1][0]].t) {
6100 case 0x02 /*VT_I2*/: if(blob.l+2 === Props[i][1]) { blob.l+=2; fail = false; } break;
6101 case 0x50 /*VT_STRING*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break;
6102 …case 0x100C /*VT_VECTOR|VT_VARIANT*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false…
6104 if((!PIDSI||i==0) && blob.l <= Props[i][1]) { fail=false; blob.l = Props[i][1]; }
6105if(fail) throw new Error("Read Error: Expected address " + Props[i][1] + ' at ' + blob.l + ' :' + …
6107 if(PIDSI) {
6108 if(Props[i][0] == 0 && Props.length > i+1 && Props[i][1] == Props[i+1][1]) continue; // R9
6111if(piddsi.p === 'version') PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + Strin…
6112 if(piddsi.n == "CodePage") switch(PropH[piddsi.n]) {
6138 if(Props[i][0] === 0x1) {
6141 if(Dictionary !== -1) {
6147 } else if(Props[i][0] === 0) {
6148 if(CodePage === 0) { Dictionary = i; blob.l = Props[i+1][1]; continue; }
6178 case "object": if(val instanceof Date) return 0x40; break;
6193 if(!RE) {
6215 if(RE && !RE[entries[i][0]]) continue;
6216if(XLSPSSkip.indexOf(entries[i][0]) > -1 || PseudoPropsPairs.indexOf(entries[i][0]) > -1) continue;
6217 if(entries[i][1] == null) continue;
6220 if(RE) {
6223 if(pinfo.p == "version" && typeof val == "string") {
6224 /*:: if(typeof val !== "string") throw "unreachable"; */
6231 if(T == -1) { T = 0x1F; val = String(val); }
6253 if(!blob) return ({}/*:any*/);
6262if(CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) throw new Error("Bad PropertySet CL…
6264 if(NumSets !== 1 && NumSets !== 2) throw new Error("Unrecognized #Sets: " + NumSets);
6267if(NumSets === 1 && Offset0 !== blob.l) throw new Error("Length mismatch: " + Offset0 + " !== " + …
6268 else if(NumSets === 2) { FMTID1 = blob.read_shift(16); Offset1 = blob.read_shift(4); }
6276 if(NumSets === 1) return rval;
6277 if(Offset1 - blob.l == 2) blob.l += 2;
6278 if(blob.l !== Offset1) throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1);
6298 if(entries2) {
6308 function writezeroes(n, o) { if(!o) o=new_buf(n); for(var j=0; j<n; ++j) o.write_shift(1, 0); retur…
6313 if(target !== blob.l) throw new Error("Slurp error");
6318 function writebool(v/*:any*/, o) { if(!o) o=new_buf(2); o.write_shift(2, +!!v); return o; }
6321 function writeuint16(v/*:number*/, o) { if(!o) o=new_buf(2); o.write_shift(2, v); return o; }
6332 if(!o) o = new_buf(2);
6343 if(opts && opts.biff >= 8) current_codepage = 1200;
6344 if(!opts || opts.biff == 8 ) {
6346 if(fHighByte) { encoding = 'dbcs-cont'; }
6347 } else if(opts.biff == 12) {
6350 if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr';
6365 if(fRichSt) cRun = blob.read_shift(2);
6366 if(fExtSt) cbExtRst = blob.read_shift(4);
6369 if(fRichSt) blob.l += 4 * cRun; //TODO: parse this
6370 if(fExtSt) blob.l += cbExtRst; //TODO: parse this
6372 if(!fRichSt) { z.raw = "<t>" + z.t + "</t>"; z.r = z.t; }
6382 if(nfmts > 1) hdr.write_shift(2, nfmts);
6395 if(opts) {
6396 if(opts.biff >= 2 && opts.biff <= 5) return blob.read_shift(cch, 'cpstr');
6397 if(opts.biff >= 12) return blob.read_shift(cch, 'dbcs-cont');
6400 if(fHighByte===0) { retval = blob.read_shift(cch, 'sbcs-cont'); }
6408 if(cch === 0) { blob.l++; return ""; }
6413 if(opts.biff > 5) return parse_XLUnicodeString(blob, length, opts);
6415 if(cch === 0) { blob.l++; return ""; }
6420 if(!o) o = new_buf(3 + 2 * str.length);
6440 if(len > 24) {
6443 if(blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") extra = true;
6447 if(extra) blob.l += 24;
6457 if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker");
6459 if(sz === 0) return preamble + ansiPath.replace(/\\/g,"/");
6461 if(blob.read_shift(2) != 3) throw new Error("Bad FileMoniker");
6483 if(!o) o = new_buf(6 + str.length * 2);
6494 if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
6498 if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
6499 if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
6500 if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
6501 if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
6502 if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
6503 if(flags & 0x0020) guid = blob.read_shift(16);
6504 if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
6507 if(target && Loc) target+="#"+Loc;
6508 if(!target) target = "#" + Loc;
6509if((flags & 0x0002) && target.charAt(0) == "/" && target.charAt(1) != "/") target = "file://" + ta…
6511 if(guid) out.guid = guid;
6512 if(fileTime) out.time = fileTime;
6513 if(displayName) out.Tooltip = displayName;
6519 if(Target.slice(0,7) == "file://") Target = Target.slice(7);
6525 if(F == 0x1C) {
6528 } else if(F & 0x02) {
6535 if(F & 0x08) write_HyperlinkString(hashidx > -1 ? Target.slice(hashidx+1): "", out);
6567 if(!o) o = new_buf(6);
6607 if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb);
6621 if(!o) o = new_buf(8);
6702 if(blob.l != tgt) blob.l = tgt; //throw new Error("bad Object Ft-sequence");
6712 if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; }
6721 default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer);
6741 if(w > 4) out.write_shift(2, 0x7262);
6742 if(w > 6) out.write_shift(2, 0x07CD);
6743 if(w > 8) {
6755 if(length === 0) return 0x04b0;
6756 if((blob.read_shift(2))!==0x04b0){/* empty */}
6763 if(opts.enc) { blob.l += length; return ""; }
6774 if(b8) o.write_shift(1, 0);
6799 if(name.length === 0) name = "Sheet1";
6809 if(opts.biff >= 8) o.write_shift(1, 1);
6857 if(flags & 0x07) z.level = flags & 0x07;
6859 if(flags & 0x20) z.hidden = true;
6860 if(flags & 0x40) z.hpt = miyRw / 20;
6868 if(header.type != 0x08A3) throw new Error("Invalid Future Record " + header.type);
6886 if(!(opts && opts.biff == 2)) {
6890 if((opts && opts.biff == 2)) {
6920 if(opts && opts.biff >= 2 && opts.biff < 5) return {};
6926 if(view && view.RTL) f |= 0x40;
6963 if(!b5) o.write_shift(1, 1);
6983 if(opts.biffguess && opts.biff == 2) opts.biff = 5;
6986 if(opts.biff == 2) blob.l++;
6996 if(b8) o.write_shift(1, 1);
7010 if(!o) o = new_buf(b5 ? (3 + f.length) : (5 + 2 * f.length));
7013 if(!b5) o.write_shift(1, 1);
7016 if(out.l == null) out.l = out.length;
7054 if(blob.l !== target) throw new Error("MulRK read error");
7056 if(rkrecs.length != lastcol - col + 1) throw new Error("MulRK length mismatch");
7065 if(blob.l !== target) throw new Error("MulBlank read error");
7067 if(ixfes.length != lastcol - col + 1) throw new Error("MulBlank length mismatch");
7078 if(!opts.cellStyles) return o;
7126 if(!o) o = new_buf(b5 ? 16 : 20);
7128 if(data.style) {
7136 if(data.numFmtId > 0 && b5) f |= 0x0400;
7139 if(!b5) o.write_shift(4, 0);
7148 if(out[0] !== 0) out[0]--;
7149 if(out[1] !== 0) out[1]--;
7150 if(out[0] > 7 || out[1] > 7) throw new Error("Bad Gutters: " + out.join("|"));
7164 if(opts.biff == 2 || length == 9) ++blob.l;
7179 if(opts.biffguess && opts.biff == 2) opts.biff = 5;
7200 if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab];
7201 if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch);
7222 if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts);
7225 if(typeof body === "string") o.Name = body;
7237 if(!opts || opts.biff >= 5) {
7238 if(opts.biff != 5) blob.l += 2;
7240 if(opts.biff == 5) blob.l += 2;
7244 if(flags & 0x20) name = XLSLblBuiltIn[name.charCodeAt(0)];
7245 var npflen = target - blob.l; if(opts && opts.biff == 2) --npflen;
7259 if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);
7263 if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target);
7267 if(blob[blob.l + 1] == 0x03) blob[blob.l]++;
7274 if(opts.biff < 8) { blob.l += length; return; }
7313 if(opts.biff < 8) return;
7317 if(opts.biff < 8) blob.read_shift(1);
7343 if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts);
7395 if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6;
7405 if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record");
7409 if(texts.length >= (hdr ? cchText : 2*cchText)) break;
7411 if(texts.length !== cchText && texts.length !== cchText*2) {
7420 // if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText);
7422 // if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l);
7473 if(!o) o = new_buf(4);
7507 if(!opts.cellStyles) return parsenoop(blob, length);
7514 if(w == 2) blob.l += 2;
7516 if(opts.biff >= 5 || !opts.biff) o.level = (flags >> 8) & 0x7;
7526 if(col.hidden) f |= 1;
7537 if(length < 32) return o;
7548 if(opts.biff != 5) { blob.l += length; return def; }
7550 if((d & 0x10)) def.area = true;
7577 if(opts.biffguess && opts.biff == 5) opts.biff = 2;
7618 if(cch === 0) { blob.l++; return ""; }
7735 if(ft == 0x02) nrow = d.read_shift(2);
7737 if(ft != 0x02) nrow = d.read_shift(4);
7738 if(nrow > 1048576) nrow = 1e6;
7740 if(ft != 0x02) fpos = d.read_shift(2); // header length
7744 if(ft != 0x02) { // 20 reserved bytes
7747 …//if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + …
7750 if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]];
7755 if(l7) d.l += 36; // Level 7: 32 byte "Language driver name", 4 byte reserved
7766 if(ft != 0x02 && !l7) field.offset = d.read_shift(4);
7768 if(ft == 0x02) field.offset = d.read_shift(2);
7770 if(field.name.length) fields.push(field);
7771 if(ft != 0x02) d.l += l7 ? 13 : 14;
7774if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
7778 if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
7798 if(d[d.l] !== 0x0D) d.l = fpos-1;
7799 if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]);
7807 if(d[d.l] === 0x2A) {
7821 if(s.trim().length) out[R][C] = s.replace(/\s+$/,"");
7824 if(s.length === 8) out[R][C] = new Date(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8));
7836 if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
7842 if(s && s != ".") out[R][C] = +s || 0; break;
7850 case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; }
7854 if(fields[C].name === '_NullFlags') break;
7860if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + …
7861 if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows);
7868 if(!o.dateNF) o.dateNF = "yyyymmdd";
7883 } catch(e) { if(opts && opts.WTF) throw e; }
7891 if(+o.codepage >= 0) set_cp(+o.codepage);
7892 if(o.type == "string") throw new Error("Cannot write DBF to JS string");
7898 if(((cols[i]||{}).DBF||{}).name) { headers[i] = cols[i].DBF.name; ++hcnt; continue; }
7899 if(headers[i] == null) continue;
7901 if(typeof headers[i] === 'number') headers[i] = headers[i].toString(10);
7902if(typeof headers[i] !== 'string') throw new Error("DBF Invalid column name " + headers[i] + " |" …
7903 if(headers.indexOf(headers[i]) !== i) for(j=0; j<1024;++j)
7904 if(headers.indexOf(headers[i] + "_" + j) == -1) { headers[i] += "_" + j; break; }
7914 if(data[j][i] != null) col.push(data[j][i]);
7916 if(col.length == 0 || headers[i] == null) { coltypes[i] = '?'; continue; }
7919 /* TODO: check if L2 compat is desired */
7929 //if(guess == 'C') break;
7931 if(maxlen > 250) maxlen = 250;
7934 if(_guess == 'C') {
7935 if(cols[i].DBF.len > maxlen) maxlen = cols[i].DBF.len;
7937 if(guess == 'B' && _guess == 'N') {
7955 if(dbf_codepage_map[cp] != +o.codepage) {
7956 if(o.codepage) console.error("DBF Unsupported codepage " + current_codepage + ", using 1252");
7961 if(headers[i] == null) continue;
7985 if(headers[j] == null) continue;
7991 if(typeof data[i][j] == "number") _n = data[i][j].toFixed(coldecimals[j]||0);
7996 if(!data[i][j]) rout.write_shift(8, "00000000", "sbcs");
8066 if(+opts.codepage >= 0) set_cp(+opts.codepage);
8072 if(rstr.length > 0) switch(RT) {
8080 // NOTE: it is technically an error if d1904 >= 5 or < 0
8081 if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
8105 R = parseInt(record[rj].slice(1), 10)-1; if(!C_seen_X) C = 0;
8110 if(val.charAt(0) === '"') { val = val.slice(1,val.length - 1); cell_t = "s"; }
8111 else if(val === 'TRUE' || val === 'FALSE') { val = val === 'TRUE'; cell_t = "b"; }
8112 else if(!isNaN(fuzzynum(val))) {
8114if(next_cell_format !== null && fmt_is_date(next_cell_format) && opts.cellDates) { val = numdate(w…
8115 } else if(!isNaN(fuzzydate(val).getDate())) {
8117 if(!opts.cellDates) { cell_t = "n"; val = datenum(val, wb.Workbook.WBProps.date1904); }
8119if(typeof $cptable !== 'undefined' && typeof val == "string" && ((opts||{}).type != "string") && (…
8134 default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
8136 if(C_seen_K) {
8137 if(!arr[R][C]) arr[R][C] = { t: cell_t, v: val };
8139 if(next_cell_format) arr[R][C].z = next_cell_format;
8140if(opts.cellText !== false && next_cell_format) arr[R][C].w = SSF_format(arr[R][C].z, arr[R][C].v,…
8143 if(C_seen_S) {
8144 if(C_seen_E) throw new Error("SYLK shared formula cannot have own formula");
8146 if(!shrbase || !shrbase[1]) throw new Error("SYLK shared formula cannot find base");
8149 if(formula) {
8150 if(!arr[R][C]) arr[R][C] = { t: 'n', f: formula };
8179 if(!colinfo[C]) colinfo[C] = {};
8183 if(!rowinfo[R]) rowinfo[R] = {};
8184 if(Mval > 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); }
8185 else if(Mval === 0) rowinfo[R].hidden = true;
8189 default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
8191 if(F_seen < 1) next_cell_format = null; break;
8192 default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
8195 if(rowinfo.length > 0) sht['!rows'] = rowinfo;
8196 if(colinfo.length > 0) sht['!cols'] = colinfo;
8198 if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
8219 if(cell.f && !cell.F) o += ";E" + a1_to_rc(cell.f, {r:R, c:C}); break;
8231 if(col.hidden) rec += "0";
8233 if(typeof col.width == 'number' && !col.wpx) col.wpx = width2px(col.width);
8234 if(typeof col.wpx == 'number' && !col.wch) col.wch = px2char(col.wpx);
8235 if(typeof col.wch == 'number') rec += Math.round(col.wch);
8237 if(rec.charAt(rec.length - 1) != " ") out.push(rec);
8244 if(row.hidden) rec += "M0;";
8245 else if(row.hpt) rec += "M" + 20 * row.hpt + ";";
8246 else if(row.hpx) rec += "M" + 20 * px2pt(row.hpx) + ";";
8247 if(rec.length > 2) out.push(rec + "R" + (i+1));
8261 if(ws['!cols']) write_ws_cols_sylk(preamble, ws['!cols']);
8262 if(ws['!rows']) write_ws_rows_sylk(preamble, ws['!rows']);
8271 if(!cell || (cell.v == null && (!cell.f || cell.F))) continue;
8298 if (records[ri].trim() === 'BOT') { arr[++R] = []; C = 0; continue; }
8299 if (R < 0) continue;
8308 if (data === 'BOT') { arr[++R] = []; C = 0; continue; }
8309 else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data);
8312 if(data === 'TRUE') arr[R][C] = true;
8313 else if(data === 'FALSE') arr[R][C] = false;
8314 else if(!isNaN(fuzzynum(value))) arr[R][C] = fuzzynum(value);
8315 else if(!isNaN(fuzzydate(value).getDate())) arr[R][C] = parseDate(value);
8321 if(DIF_XL && data && data.match(/^=".*"$/)) data = data.slice(2, -1);
8325 if (data === 'EOD') break;
8327 if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
8354 if(cell == null) { p +=("1,0\r\n\"\"\r\n"); continue;}
8357 if(_DIF_XL) {
8358 if(cell.w != null) p +=("0," + cell.w + "\r\nV");
8359 else if(cell.v != null) p +=(make_value(cell.v, "V")); // TODO: should this call SSF_format?
8360 else if(cell.f != null && !cell.F) p +=(make_value_str("=" + cell.f));
8363 if(cell.v == null) p +=("1,0\r\n\"\"");
8374 if(!cell.w) cell.w = SSF_format(cell.z || table_fmt[14], datenum(parseDate(cell.v)));
8375 if(_DIF_XL) p +=(make_value(cell.w, "V"));
8401 if(record[0] !== 'cell') continue;
8403 if(arr.length <= addr.r) for(R = arr.length; R <= addr.r; ++R) if(!arr[R]) arr[R] = [];
8415 if(record[2] == 'vtf') arr[R][C] = [arr[R][C], _f];
8418 if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
8445 if(!ws || !ws['!ref']) return "";
8453 if(!cell || cell.v == null || cell.t === 'z') continue;
8458 if(!cell.f) { oo[2]='v'; oo[3]=cell.v; }
8495 if(o.raw) arr[R][C] = data;
8496 else if(data === ""){/* empty */}
8497 else if(data === 'TRUE') arr[R][C] = true;
8498 else if(data === 'FALSE') arr[R][C] = false;
8499 else if(!isNaN(fuzzynum(data))) arr[R][C] = fuzzynum(data);
8500 else if(!isNaN(fuzzydate(data).getDate())) arr[R][C] = parseDate(data);
8507 if(!f || f.length === 0) return arr;
8515 if(idx == -1) idx = lines[R].length; else idx++;
8526 if(o.sheetRows) arr = arr.slice(0, o.sheetRows);
8549 if((cc=str.charCodeAt(end)) == 0x22) instr = !instr;
8550 else if(!instr && cc in guess_seps) cnt[cc] = (cnt[cc]||0)+1;
8554 for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
8558 if ( !cc.length ) {
8560 for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
8573 if(DENSE != null && o.dense == null) o.dense = DENSE;
8577 if(str.slice(0,4) == "sep=") {
8579 if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
8583 else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
8588 else if(o && o.FS) sep = o.FS;
8594 var s = str.slice(start, end); if(s.slice(-1) == "\r") s = s.slice(0, -1);
8596 if(s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') s = s.slice(1,-1).replace(/""/g,'"');
8597 if(s.length === 0) cell.t = 'z';
8598 else if(o.raw) { cell.t = 's'; cell.v = s; }
8599 else if(s.trim().length === 0) { cell.t = 's'; cell.v = s; }
8600 else if(s.charCodeAt(0) == 0x3D) {
8601if(s.charCodeAt(1) == 0x22 && s.charCodeAt(s.length - 1) == 0x22) { cell.t = 's'; cell.v = s.slice…
8602 else if(fuzzyfmla(s)) { cell.t = 'n'; cell.f = s.slice(1); }
8604 else if(s == "TRUE") { cell.t = 'b'; cell.v = true; }
8605 else if(s == "FALSE") { cell.t = 'b'; cell.v = false; }
8606 …else if(!isNaN(v = fuzzynum(s))) { cell.t = 'n'; if(o.cellText !== false) cell.w = s; cell.v = v; }
8607 else if(!isNaN((v = fuzzydate(s)).getDate()) || _re && s.match(_re)) {
8610if(_re && s.match(_re)){ s=dateNF_fix(s, o.dateNF, (s.match(_re)||[])); k=1; v = parseDate(s, k); }
8611 if(o.cellDates) { cell.t = 'd'; cell.v = v; }
8613if(o.cellText !== false) cell.w = SSF_format(cell.z, cell.v instanceof Date ? datenum(cell.v):cell…
8614 if(!o.cellNF) delete cell.z;
8619 if(cell.t == 'z'){}
8620 else if(o.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = cell; }
8623 if(range.e.c < C) range.e.c = C;
8624 if(range.e.r < R) range.e.r = R;
8625 if(cc == sepcc) ++C; else { C = 0; ++R; if(o.sheetRows && o.sheetRows <= R) return true; }
8628 case 0x22: if(startcc === 0x22) instr = !instr; break;
8630 if(instr) break;
8631 if(str.charCodeAt(end+1) == 0x0a) ++end;
8633 case sepcc: case 0x0a: if(!instr && finish_cell()) break outer; break;
8636 if(end - start > 0) finish_cell();
8643 if(!(opts && opts.PRN)) return dsv_to_sheet_str(str, opts);
8644 if(opts.FS) return dsv_to_sheet_str(str, opts);
8645 if(str.slice(0,4) == "sep=") return dsv_to_sheet_str(str, opts);
8646if(str.indexOf("\t") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) return dsv_to_sheet_s…
8656 if(opts.codepage == 65001) str = d.toString('utf8'); // TODO: test if buf
8657 …else if(opts.codepage && typeof $cptable !== 'undefined') str = $cptable.utils.decode(opts.codepag…
8664 if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
8665 …else if(opts.type != 'string' && opts.type != 'buffer' && opts.codepage == 65001) str = utf8read(s…
8666 …else if((opts.type == 'binary') && typeof $cptable !== 'undefined' && opts.codepage) str = $cptab…
8667if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf…
8682 if(!cell || cell.v == null) { oo.push(" "); continue; }
8699 /* Excel defaults to SYLK but warns if data is not valid */
8708 if(!e.message.match(/SYLK bad record ID/) && OLD_WTF) throw e;
8715 if(!data) return;
8725 if(cb(d, R, RT)) return;
8740 if(!d) return d;
8742 if(DENSE != null && o.dense == null) o.dense = DENSE;
8749 if(d[4] == 0x51 && d[5] == 0x50 && d[6] == 0x57) return qpw_to_workbook_buf(d, opts);
8750 if(d[2] == 0x00) {
8751 if(d[3] == 0x08 || d[3] == 0x09) {
8752if(d.length >= 16 && d[14] == 0x05 && d[15] === 0x6c) throw new Error("Unsupported Works 3 for Mac…
8756 if(d[2] == 0x02) {
8761 if(val >= 0x1000) o.qpro = true;
8768 case 0xCC: if(val) next_n = val; break; /* SHEETNAMECS */
8772if((!o.qpro && !o.works || RT == 0x33) && val[1].v.charCodeAt(0) < 0x30) val[1].v = val[1].v.slice…
8773 if(o.works || o.works2) val[1].v = val[1].v.replace(/\r\n/g, "\n");
8779 if(RT == 0x0E && (val[2] & 0x70) == 0x70 && (val[2] & 0x0F) > 1 && (val[2] & 0x0F) < 15) {
8781 if(o.cellDates) { val[1].t = 'd'; val[1].v = numdate(val[1].v); }
8784 if(o.qpro) {
8785 if(val[3] > sidx) {
8796 if(tmpcell) {
8798 if(val[1].z != null) tmpcell.z = val[1].z;
8799 if(val[1].f != null) tmpcell.f = val[1].f;
8802 if(o.dense) {
8803 if(!s[val[0].r]) s[val[0].r] = [];
8810 } else if(d[2] == 0x1A || d[2] == 0x0E) {
8812 if(d[2] == 0x0E) { o.qpro = true; d.l = 0; }
8816 if(val[1].v.charCodeAt(0) < 0x30) val[1].v = val[1].v.slice(1);
8826 if(val[3] > sidx) {
8834 if(sheetRows > 0 && val[0].r >= sheetRows) break;
8835 if(o.dense) {
8836 if(!s[val[0].r]) s[val[0].r] = [];
8839 if(refguess.e.c < val[0].c) refguess.e.c = val[0].c;
8840 if(refguess.e.r < val[0].r) refguess.e.r = val[0].r;
8843 if(val[0x36b0]) realnames[val[0x36b0][0]] = val[0x36b0][1];
8846 realnames[val[0]] = val[1]; if(val[0] == sidx) n = val[1]; break;
8853 if(!realnames.length) return { SheetNames: snames, Sheets: sheets };
8856 for(var i = 0; i < realnames.length; ++i) if(sheets[snames[i]]) {
8868 if(+o.codepage >= 0) set_cp(+o.codepage);
8869 if(o.type == "string") throw new Error("Cannot write WK1 to JS string");
8881 if(R === range.s.r) cols[C] = encode_col(C);
8884 if(!cell || cell.t == "z") continue;
8886 if(cell.t == "n") {
8887if((cell.v|0)==cell.v && cell.v >= -32768 && cell.v <= 32767) write_biff_rec(ba, 0x0d, write_INTEG…
8902 if(+o.codepage >= 0) set_cp(+o.codepage);
8903 if(o.type == "string") throw new Error("Cannot write WK3 to JS string");
8908 …for(var i = 0, cnt = 0; i < wb.SheetNames.length; ++i) if((wb.Sheets[wb.SheetNames[i]] || {})["!re…
8913 if(!ws || !ws["!ref"]) continue;
8921 if(R === range.s.r) cols[C] = encode_col(C);
8924 if(!cell || cell.t == "z") continue;
8926 if(cell.t == "n") {
8958 if(!ws || !ws["!ref"]) continue;
8961 if(rows < range.e.r) rows = range.e.r;
8962 if(cols < range.e.c) cols = range.e.c;
8964 if(rows > 8191) rows = 8191;
8979 if(length == 8 && opts.qpro) {
8990 if(length == 12 && opts.qpro) blob.l += 2;
8993 if(length == 12 && opts.qpro) blob.l += 2;
8994 if(o.s.c == 0xFFFF) o.s.c = o.e.c = o.s.r = o.e.r = 0;
9008 if(opts.qpro && opts.vers != 0x5120) {
9013 } else if(opts.works) { // TODO: verify with more complex works3-4 examples
9027 if(opts.vers == 0x5120) {
9033 if(opts.qpro) blob.l++;
9055 if(opts.vers == 0x5120) {
9097 if(opts.qpro) blob.l = tgt;
9228 if(blob.l < blob.length) { console.error("WK1 premature formula end"); return; }
9248 if(cc < 0x20 && BinOpTab[cc]) {
9251 } else if(FuncTab[cc]) {
9253 if(argc == 69) argc = blob[blob.l++];
9254if(argc > out.length) { console.error("WK1 bad formula parse 0x" + cc.toString(16) + ":|" + out.jo…
9259 else if(cc <= 0x07) return console.error("WK1 invalid opcode " + cc.toString(16));
9260 else if(cc <= 0x18) return console.error("WK1 unsupported op " + cc.toString(16));
9261 else if(cc <= 0x1E) return console.error("WK1 invalid opcode " + cc.toString(16));
9262 else if(cc <= 0x73) return console.error("WK1 unsupported function opcode " + cc.toString(16));
9267 if(out.length == 1) o[1].f = "" + out[0];
9303 if(o[1].v & 0x1) {
9324 if(e == 0xFFFF) {
9325 if(v1 === 0 && v2 === 0xC0000000) { o[1].t = "e"; o[1].v = 0x0F; } // ERR -> #VALUE!
9326 else if(v1 === 0 && v2 === 0xD0000000) { o[1].t = "e"; o[1].v = 0x2A; } // NA -> #N/A
9339 if(v == 0) {
9346 if(v < 0) { s = 1; v = -v; }
9350 if((v2&0x80000000) == 0) { v/=2; ++e; v2 = v >>> 0; }
9395 if(len > length - 1) len = length - 1;
9401 if(!opts.qpro || length < 21) return;
9414 if(dt == 0x36b0) {
9633 if(DENSE != null && o.dense == null) o.dense = DENSE;
9645 if(p.read_shift(4) != 0x39575051) throw "Bad QPW9 BOF!";
9677 if(p.l + 2 < p.length) {
9682 if(!sname) sname = encode_col(sidx);
9687 if(range.s.c > 0xFF || range.s.r > 999999) break;
9688 if(range.e.c < range.s.c) range.e.c = range.s.c;
9689 if(range.e.r < range.s.r) range.e.r = range.s.r;
9696 if(range.e.c < C) range.e.c = C;
9697 if(range.s.c > C) range.s.c = C;
9699 if(range.s.r > R) range.s.r = R;
9701 if(range.e.r < R) range.e.r = R;
9706 if(range.s.r > R) range.s.r = R;
9707 if(range.e.r < R + cnt - 1) range.e.r = R + cnt - 1;
9711 if(flags & 0x80) p.l += 2;
9723 if(flags & 0x20) switch(flags & 0x1F) {
9729 if(!(!o.sheetStubs && cell.t == "z")) {
9730 if(Array.isArray(s)) {
9731 if(!s[R]) s[R] = [];
9737 if(flags & 0x20) switch(flags & 0x1F) {
9739 …case 3: cell = { t: "n", v: (cell.v + delta) & 0xFFFF }; if(cell.v > 0x7FFF) cell.v -= 0x10000; br…
9748 if(!(!o.sheetStubs && cell.t == "z")) {
9749 if(Array.isArray(s)) {
9750 if(!s[R]) s[R] = [];
9776 if(m) for(;i!=m.length; ++i) {
9788 if(!y.val) break;
9796 if(y.val == '1') break;
9802 if(!y.val) break;
9816 if(!y.val) break;
9824 if(!y.val) break;
9837 if(y.val == '0') break;
9845 if(y.val == '0') break;
9853 if(y.rgb) font.color = y.rgb.slice(2,8);
9874 if(y[0].charCodeAt(1) !== 47 && !pass) throw new Error('Unrecognized rich format ' + y[0]);
9886 if(!t) return {t:"s", v:""};
9890 if(rpr) o.s = parse_rpr(rpr[1]);
9906 if(font.u) style.push("text-decoration: underline;");
9907 if(font.uval) style.push("text-underline-style:" + font.uval + ";");
9908 if(font.sz) style.push("font-size:" + font.sz + "pt;");
9909 if(font.outline) style.push("text-effect: outline;");
9910 if(font.shadow) style.push("text-shadow: auto;");
9913 if(font.b) { intro.push("<b>"); outro.push("</b>"); }
9914 if(font.i) { intro.push("<i>"); outro.push("</i>"); }
9915 if(font.strike) { intro.push("<s>"); outro.push("</s>"); }
9918 if(align == "superscript" || align == "super") align = "sup";
9919 else if(align == "subscript") align = "sub";
9920 if(align != "") { intro.push("<" + align + ">"); outro.push("</" + align + ">"); }
9929 if(!r.v) return "";
9931 if(r.s) parse_rpr2(r.s, terms[0], terms[2]);
9947 if(!x) return { t: "" };
9951 if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) {
9954 if(html) z.h = escapehtml(z.t);
9957 else if((/*y = */x.match(sirregex))) {
9960 if(html) z.h = rs_to_html(parse_rs(z.r));
9973 if(!data) return s;
9976 if(sst) {
9980 if(o != null) s[s.length] = o;
9989 if(!opts.bookSST) return "";
9996 for(var i = 0; i != sst.length; ++i) { if(sst[i] == null) continue;
9999 if(s.r) sitag += s.r;
10002 if(!s.t) s.t = "";
10003 if(typeof s.t !== "string") s.t = String(s.t);
10004 if(s.t.match(straywsregex)) sitag += ' xml:space="preserve"';
10010 if(o.length>2){ o[o.length] = ('</sst>'); o[1]=o[1].replace("/>",">"); }
10037 if(R.T){}
10038 if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
10045 if(!o) o = new_buf(8);
10062 if(typeof $cptable !== 'undefined') return $cptable.utils.encode(current_ansi, str);
10073 /*:: if(length == null) return o; */
10074 if(length >= 4) blob.l += length - 4;
10099 if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end);
10141 if(blob.read_shift(4) != 0x04) throw new Error("Bad !Primary record");
10159 if(!valid) throw new Error("Encryption Flags/AlgID mismatch");
10194 if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch");
10232 if(vers.Minor != 2) throw new Error('unrecognized minor version code: ' + vers.Minor);
10233if(vers.Major > 4 || vers.Major < 2) throw new Error('unrecognized major version code: ' + vers.Ma…
10244if(vers.Major != 1 || vers.Minor != 1) throw 'unrecognized version code ' + vers.Major + ' : ' + v…
10283 if(Char & 0x40) XorKey ^= XorMatrix[CurrentElement];
10296 if((Index & 1) === 1) {
10330 /* If XorArray is set, use it; if O is not set, make changes in-place */
10331 if(!O) O = Data;
10332 if(!XorArray) XorArray = crypto_CreateXorArray_Method1(password);
10356 if(opts.password) o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password);
10358 if(out.valid) out.insitu = crypto_MakeXorDecryptor(opts.password);
10365 if(o.Info === 1) o.Data = parse_RC4Header(blob, length);
10371 if(o.Type) parse_FilePassHeader(blob, length-2, o);
10394 if (!rows)
10398 if (Array.isArray(ws))
10407 if (data.charCodeAt(0) == 32)
10409 if (data.length)
10414 if (payload.length) {
10416 if (cell.v == "TRUE" || cell.v == "FALSE") {
10419 } else if (!isNaN(fuzzynum(cell.v))) {
10421 if (o.cellText !== false)
10425 if (Array.isArray(ws))
10438 if (C > range.e.c)
10451 if (!ws["!ref"])
10463 if (!cell || cell.v == null && (!cell.f || cell.F)) {
10486 if(C === 0) return [0, 0, R];
10504 if(S !== 0) switch(h6|0) {
10518 if(tint === 0) return hex;
10520 if (tint < 0) hsl[2] = hsl[2] * (1 + tint);
10537if(delta > 0.005) for(MDW=MIN_MDW; MDW<MAX_MDW; ++MDW) if(Math.abs(collw - cycle_width(collw)) <= …
10546 if(guess > 0.5) guess--;
10547 if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; }
10553 if(coll.width) {
10557 } else if(coll.wpx) {
10561 } else if(typeof coll.wch == 'number') {
10566 if(coll.customWidth) delete coll.customWidth;
10605 if(y.diagonalUp) border.diagonalUp = parsexmlbool(y.diagonalUp);
10606 if(y.diagonalDown) border.diagonalDown = parsexmlbool(y.diagonalDown);
10660 default: if(opts && opts.WTF) {
10661 if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders');
10689 if(y.patternType) fill.patternType = y.patternType;
10695 if(!fill.bgColor) fill.bgColor = {};
10696 if(y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);
10697 if(y.theme) fill.bgColor.theme = parseInt(y.theme, 10);
10698 if(y.tint) fill.bgColor.tint = parseFloat(y.tint);
10700 if(y.rgb) fill.bgColor.rgb = y.rgb.slice(-6);
10706 if(!fill.fgColor) fill.fgColor = {};
10707 if(y.theme) fill.fgColor.theme = parseInt(y.theme, 10);
10708 if(y.tint) fill.fgColor.tint = parseFloat(y.tint);
10710 if(y.rgb != null) fill.fgColor.rgb = y.rgb.slice(-6);
10726 default: if(opts && opts.WTF) {
10727 if(!pass) throw new Error('unrecognized ' + y[0] + ' in fills');
10751 case '<name': if(y.val) font.name = utf8read(y.val); break;
10794 case '<sz': if(y.val) font.sz = +y.val; break;
10798 case '<vertAlign': if(y.val) font.vertAlign = y.val; break;
10802 case '<family': if(y.val) font.family = parseInt(y.val,10); break;
10806 case '<scheme': if(y.val) font.scheme = y.val; break;
10811 if(y.val == '1') break;
10817 if(!font.color) font.color = {};
10818 if(y.auto) font.color.auto = parsexmlbool(y.auto);
10820 if(y.rgb) font.color.rgb = y.rgb.slice(-6);
10821 else if(y.indexed) {
10824 if(font.color.index == 81) icv = XLSIcv[1];
10825 if(!icv) icv = XLSIcv[1]; //throw new Error(x); // note: 206 is valid
10827 } else if(y.theme) {
10829 if(y.tint) font.color.tint = parseFloat(y.tint);
10830 if(y.theme && themes.themeElements && themes.themeElements.clrScheme) {
10846 default: if(opts && opts.WTF) {
10847 if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts');
10859 if(!m) return;
10867 if(j>0) {
10868 if(j > 0x188) {
10869 for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break;
10876 default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts');
10884 …for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) o[o.length] = (writextag('numFmt',null,{numFmt…
10886 if(o.length === 1) return "";
10908 for(i = 0; i < cellXF_uint.length; ++i) if(xf[cellXF_uint[i]])
10910 for(i = 0; i < cellXF_bool.length; ++i) if(xf[cellXF_bool[i]])
10912 if(styles.NumberFmt && xf.numFmtId > 0x188) {
10913 …for(i = 0x188; i > 0x3c; --i) if(styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { xf.numFmt…
10921 if(y.vertical) alignment.vertical = y.vertical;
10922 if(y.horizontal) alignment.horizontal = y.horizontal;
10923 if(y.textRotation != null) alignment.textRotation = y.textRotation;
10924 if(y.indent) alignment.indent = y.indent;
10925 if(y.wrapText) alignment.wrapText = parsexmlbool(y.wrapText);
10943 default: if(opts && opts.WTF) {
10944 if(!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs');
10957 if(o.length === 2) return "";
10972 if(!data) return styles;
10978 if((t=data.match(numFmtRegex))) parse_numFmts(t, styles, opts);
10981 if((t=data.match(fontsRegex))) parse_fonts(t, styles, themes, opts);
10984 if((t=data.match(fillsRegex))) parse_fills(t, styles, themes, opts);
10987 if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
10993 if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
11009 if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w;
11014 if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w);
11019 if(o.length>2){ o[o.length] = ('</styleSheet>'); o[1]=o[1].replace("/>",">"); }
11029 if(!o) o = new_buf(6 + 4 * f.length);
11033 if(o.l == null) o.l = o.length;
11044 if(grbit.fItalic) out.italic = 1;
11045 if(grbit.fCondense) out.condense = 1;
11046 if(grbit.fExtend) out.extend = 1;
11047 if(grbit.fShadow) out.shadow = 1;
11048 if(grbit.fOutline) out.outline = 1;
11049 if(grbit.fStrikeout) out.strike = 1;
11052 if(bls === 0x02BC) out.bold = 1;
11061 if(underline != 0) out.underline = underline;
11064 if(family > 0) out.family = family;
11067 if(bCharSet > 0) out.charset = bCharSet;
11083 if(!o) o = new_buf(25+4*32);
11088 if(font.vertAlign == "superscript") sss = 1;
11089 else if(font.vertAlign == "subscript") sss = 2;
11097 if(font.scheme == "major") scheme = 1;
11098 if(font.scheme == "minor") scheme = 2;
11130 if(!o) o = new_buf(4*3 + 8*7 + 16*1);
11131 if(!rev_XLSBFillPTNames) rev_XLSBFillPTNames = (evert(XLSBFillPTNames)/*:any*/);
11133 if(fls == null) fls = 0x28;
11136 if(fls != 0x28) {
11168 if(!o) o = new_buf(16);
11186 if(!o) o = new_buf(10);
11196 if(!o) o = new_buf(51);
11208 if(!o) o = new_buf(12+4*10);
11243if(val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) {
11253 if(state[state.length - 1] == 0x0269 /* BrtBeginCellXFs */) {
11281 if(R.T > 0) state.push(RT);
11282 else if(R.T < 0) state.pop();
11283 …else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */)) throw new Error("…
11290 if(!NF) return;
11293 /*:: if(!NF) return; */
11294 for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) ++cnt;
11297 if(cnt == 0) return;
11300 /*:: if(!NF) return; */
11301 …for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, 0x002C /* BrtFmt */, write_Br…
11309 if(cnt == 0) return;
11325 if(cnt == 0) return;
11336 if(cnt == 0) return;
11464 if (y[0].charAt(1) === '/') {
11472 default: if(opts && opts.WTF) throw new Error('Unrecognized ' + y[0] + ' in clrScheme');
11501 if(!(t=data.match(m[1]))) throw new Error(m[0] + ' not found in themeElements');
11511 if(!data || data.length === 0) data = write_theme();
11517 if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme');
11524 if(opts && opts.themeXLSX) return opts.themeXLSX;
11525 if(Themes && typeof Themes.raw == "string") return Themes.raw;
11698 if(dwThemeVersion === 124226) return;
11699 if(!opts.cellStyles) { blob.l = end; return; }
11704 if(!themeXML) return;
11844 if (metatype == 1)
11846 else if (metatype == 0)
11865 if (R.T) {
11866 } else if (!pass || opts.WTF && state[state.length - 1] != 35)
11898 if (!data)
11921 if (out.Types[j].name == y.name)
11931 if (metatype == 1)
11933 else if (metatype == 0)
11962 if (!lastmeta)
11964 if (!lastmeta.offsets)
11969 if (!pass && (opts == null ? void 0 : opts.WTF))
11984 if(!data) return d;
11993 case '<c': delete y[0]; if(y.i) i = y.i; else y.i = i; d.push(y); break;
12010 if(flags & 0x2) out.l = '1';
12011 if(flags & 0x8) out.a = '1';
12025 if(R.T){/* empty */}
12026 else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
12036 //if(opts.WTF) throw "XLSX External Link";
12041 if(!data) return data;
12047 if(end) return;
12078 if(R.T){/* empty */}
12079 else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
12086 if(!data) return "??";
12116 if(_comments.length > 0) o.push(writextag("v:shapetype", [
12129 if(fillopts.type == "gradient") fillopts.angle = "-180";
12165 if(dense) {
12166 if(!sheet[r.r]) sheet[r.r] = [];
12169 if (!cell) {
12171 if(dense) sheet[r.r][r.c] = cell;
12174 if(range.s.r > r.r) range.s.r = r.r;
12175 if(range.e.r < r.r) range.e.r = r.r;
12176 if(range.s.c > r.c) range.s.c = r.c;
12177 if(range.e.c < r.c) range.e.c = r.c;
12179 if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded;
12182 if (!cell.c) cell.c = [];
12184 if(comment.h) o.h = comment.h;
12188 if(!threaded && cell.c[i].T) return;
12189 if(threaded && !cell.c[i].T) cell.c.splice(i, 1);
12191 if(threaded && people) for(i = 0; i < people.length; ++i) {
12192 if(o.a == people[i].id) { o.a = people[i].name || o.a; break; }
12201 if(data.match(/<(?:\w+:)?comments *\/>/)) return [];
12205 if(authtag && authtag[1]) authtag[1].split(/<\/\w*:?author>/).forEach(function(x) {
12206 if(x === "" || x.trim() === "") return;
12208 if(a) authors.push(a[1]);
12211 if(cmnttag && cmnttag[1]) cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x) {
12212 if(x === "" || x.trim() === "") return;
12214 if(!cm) return;
12218 if(opts.sheetRows && opts.sheetRows <= cell.r) return;
12222 if(rt.r == "<t></t>") rt.t = rt.h = "";
12224 if(opts.cellHTML) comment.h = rt.h;
12236 if(iauthor.indexOf(a) == -1) {
12240 if(w.T && w.ID && iauthor.indexOf("tc=" + w.ID) == -1) {
12245 if(iauthor.length == 0) { iauthor.push("SheetJ5"); o.push("<author>SheetJ5</author>"); }
12251 if(d[1][0] && d[1][0].T && d[1][0].ID) lastauthor = iauthor.indexOf("tc=" + d[1][0].ID);
12253 if(c.a) lastauthor = iauthor.indexOf(escapexml(c.a));
12254 if(c.T) ++tcnt;
12257 if(tcnt === 0) {
12273 if(o.length>2) { o[o.length] = ('</comments>'); o[1]=o[1].replace("/>",">"); }
12292 case '</threadedComment>': if(comment.t != null) out.push(comment); break;
12309 default: if(!pass && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in threaded comments');
12321 if(!c.T) { delete c.ID; return; }
12322 if(c.a && people.indexOf(c.a) == -1) people.push(c.a);
12327 if(idx == 0) rootid = tcopts.id;
12330if(c.a) tcopts.personId = "{54EE7950-7262-4200-6969-" + ("000000000000" + people.indexOf(c.a)).sli…
12361 default: if(!pass && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in threaded comments');
12394 if(o == null) o = new_buf(36);
12425 if(opts.sheetRows && c.rfx && opts.sheetRows <= c.rfx.r) break;
12426 if(!c.t) c.t = "";
12441 if(R.T){/* empty */}
12442 else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
12456 if(iauthor.indexOf(c.a) > -1) return;
12469 if(c.t && c.t.length > 0) write_record(ba, 0x027D /* BrtCommentText */, write_BrtCommentText(c));
12483 if (p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/))
12492 if (i == 0)
12495 if (newpath.slice(-1) !== "/")
12512 if($2.length == 0) rRel = true;
12513 else if($2.charAt(0) == "[") { rRel = true; $2 = $2.slice(1, -1); }
12515 if($3.length == 0) cRel = true;
12516 else if($3.charAt(0) == "[") { cRel = true; $3 = $3.slice(1, -1); }
12520 if(cRel) C += rcbase.c; else --C;
12521 if(rRel) R += rcbase.r; else --R;
12558 if(f.length == 1) return false;
12576 if(opts) {
12577 if(opts.biff >= 2 && opts.biff <= 5) return parse_RgceArea_BIFF2(blob, length, opts);
12578 else if(opts.biff == 12) w = 4;
12595 if(opts.biff < 8) return parse_RgceArea_BIFF2(blob, length, opts);
12604 if(opts && opts.biff >= 2 && opts.biff <= 5) return parse_RgceLoc_BIFF2(blob, length, opts);
12625 if(biff >= 2 && biff <= 5) return parse_RgceLocRel_BIFF2(blob, length, opts);
12630 if(rRel == 1) while(r > 0x7FFFF) r -= 0x100000;
12631 if(cRel == 1) while(cl > 0x1FFF) cl = cl - 0x4000;
12639 if(rRel == 1 && rl >= 0x2000) rl = rl - 0x4000;
12640 if(cRel == 1 && c >= 0x80) c = c - 0x100;
12656 if(opts) switch(opts.biff) {
12675 if(opts) switch(opts.biff) {
12783 if(opts && opts.biff == 5) blob.l += 12;
12816 if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0];
12841 if(biff == 12) switch(val[0]) {
12850 if(biff != 12) blob.l += 7; break;
12877 if(opts.biff == 12) {
12884 if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; }
12906 if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts);
12941 if(opts.biff < 8) blob.l--;
12942 if(opts.biff == 12) blob.l += 2;
12951 if(opts) switch(opts.biff) {
13172 if(opts.biff < 8) return parsenoop(blob, length);
13186 if(opts && opts.biff == 12) {
13200 //if(target !== blob.l && blob.l !== target - length) throw new Error(target + " != " + blob.l);
13201 if(length !== 0) o.push(parsenoop(blob, length));
13213 if(id === 0x18 || id === 0x19) R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]];
13214 if(!R || !R.f) { /*ptgs.push*/(parsenoop(blob, length)); }
13226 if(y) switch(y[0]) {
13229 /*:: if(typeof y[1] != 'string') throw "unreachable"; */
13258 if(s == -1 && e == -1) return start + ":" + end;
13259if(s > 0 && e > 0 && start.slice(0, s).toLowerCase() == end.slice(0, e).toLowerCase()) return star…
13265 if(!supbooks) return "SH33TJSERR0";
13266 if(opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) return supbooks.SheetNames[ixti];
13267 if(!supbooks.XTI) return "SH33TJSERR6";
13269 if(opts.biff < 8) {
13270 if(ixti > 10000) ixti-= 65536;
13271 if(ixti < 0) ixti = -ixti;
13274 if(!XTI) return "SH33TJSERR1";
13276 if(opts.biff > 8) switch(supbooks[XTI[0]][0]) {
13281 if(opts.SID != null) return supbooks.SheetNames[opts.SID];
13293 if(!supbooks[XTI[0]][0][3]) return "SH33TJSERR2";
13306 if(!formula[0] || !formula[0][0]) return "";
13331 if(last_sp >= 0) {
13342 if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]);
13392 if(!argc) argc = 0;
13396 if(func === 'User') func = args.shift();
13438 if(name && name.slice(0,6) == "_xlfn." && !opts.xlfn) name = name.slice(6);
13446 if(opts.biff <= 5) {
13447 if(bookidx < 0) bookidx = -bookidx;
13448 if(supbooks[bookidx]) externbook = supbooks[bookidx][nameidx];
13451 if(((supbooks[bookidx]||[])[0]||[])[0] == 0x3A01){/* empty */}
13452 else if(((supbooks[bookidx]||[])[0]||[])[0] == 0x0401){
13453 if(supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) {
13458 if(supbooks[bookidx] && supbooks[bookidx][nameidx]) o += supbooks[bookidx][nameidx].Name;
13459 else if(supbooks[0] && supbooks[0][nameidx]) o += supbooks[0][nameidx].Name;
13462 if(ixtidata[nameidx - 1]) o = ixtidata[nameidx - 1]; // TODO: confirm this is correct
13468 if(!externbook) externbook = {Name: "SH33TJSERRY"};
13474 if(last_sp >= 0) {
13487 if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]);
13502 if(supbooks.sharedf[encode_cell(c)]) {
13510 if(c.c < e2[0].s.c || c.c > e2[0].e.c) continue;
13511 if(c.r < e2[0].s.r || c.r > e2[0].e.r) continue;
13516 if(!fnd) stack.push(/*::String(*/f[1]/*::)*/);
13583 if(opts.biff != 3) if(last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) {
13601 if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]);
13607 if(stack.length > 1 && opts.WTF) throw new Error("bad formula stack");
13608 if(stack[0] == "TRUE") return true; if(stack[0] == "FALSE") return false;
13616 if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)];
13618 if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts);
13627 if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)];
13629 if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts);
13639 if(target !== blob.l) rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts);
13648 if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)];
13649 if(length !== cce + 2) rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts);
13656 if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n'];
13666 if(value == null) {
13675 } else if(typeof value == "number") return write_Xnum(value);
13683 if(opts.biff == 2) ++blob.l;
13686 if(opts.biff != 2) {
13688 if(opts.biff >= 5) {
13741 if((val | 0) == val && val < Math.pow(2,16) && val >= 0) {
13811 if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'");
13829 if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'");
13876 if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'");
13909 if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'");
13930 if(typeof val == "number") return write_XLSBFormulaNum(val);
13931 if(typeof val == "boolean") return write_XLSBFormulaBool(val);
13932if(/^#(DIV\/0!|GETTING_DATA|N\/A|NAME\?|NULL!|NUM!|REF!|VALUE!)$/.test(val)) return write_XLSBForm…
13933if(val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}…
13934if(val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}…
13935if(val.match(/^#REF!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]…
13936if(val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2…
13937if(val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2…
13938if(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!#REF!$/.test(val)) return wr…
13939 if(/^".*"$/.test(val)) return write_XLSBFormulaStr(val);
13940 if(/^[+-]\d+$/.test(val)) return write_XLSBFormulaNum(parseInt(val, 10));
15079 if(f.slice(0,3) == "of:") f = f.slice(3);
15081 if(f.charCodeAt(0) == 61) {
15083 if(f.charCodeAt(0) == 61) f = f.slice(1);
15122 if(rev) {
15123 if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
15126 if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
15130 if(sst[i].t === str) { sst.Count ++; return i; }
15133 if(rev) {
15134 if(browser_has_Map) {
15135 if(!rev.has(str)) rev.set(str, []);
15138 if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
15149 if(col.MDW) MDW = col.MDW;
15150 if(col.width != null) p.customWidth = 1;
15151 else if(col.wpx != null) wch = px2char(col.wpx);
15152 else if(col.wch != null) wch = col.wch;
15153 if(wch > -1) { p.width = char2width(wch); p.customWidth = 1; }
15154 else if(col.width != null) p.width = col.width;
15155 if(col.hidden) p.hidden = true;
15156 if(col.level != null) { p.outlineLevel = p.level = col.level; }
15161 if(!margins) return;
15163 if(mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5];
15164 if(margins.left == null) margins.left = defs[0];
15165 if(margins.right == null) margins.right = defs[1];
15166 if(margins.top == null) margins.top = defs[2];
15167 if(margins.bottom == null) margins.bottom = defs[3];
15168 if(margins.header == null) margins.header = defs[4];
15169 if(margins.footer == null) margins.footer = defs[5];
15175 if(z == null && opts.ssf) {
15176 for(; i < 0x188; ++i) if(opts.ssf[i] == null) {
15184 for(i = 0; i != len; ++i) if(styles[i].numFmtId === z) return i;
15198 if(opts.cellNF) p.z = table_fmt[fmtid];
15199 } catch(e) { if(opts.WTF) throw e; }
15200 if(p.t === 'z' && !opts.cellStyles) return;
15201 if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v);
15202 if((!opts || opts.cellText !== false) && p.t !== 'z') try {
15203 if(table_fmt[fmtid] == null) SSF__load(SSFImplicit[fmtid] || "General", fmtid);
15204 if(p.t === 'e') p.w = p.w || BErr[p.v];
15205 else if(fmtid === 0) {
15206 if(p.t === 'n') {
15207 if((p.v|0) === p.v) p.w = p.v.toString(10);
15210 else if(p.t === 'd') {
15212 if((dd|0) === dd) p.w = dd.toString(10);
15215 else if(p.v === undefined) return "";
15218 else if(p.t === 'd') p.w = SSF_format(fmtid,datenum(p.v),_ssfopts);
15220 } catch(e) { if(opts.WTF) throw e; }
15221 if(!opts.cellStyles) return;
15222 if(fillid != null) try {
15224 if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
15226 if(opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb;
15228 if (p.s.bgColor && p.s.bgColor.theme) {
15230 if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
15232 } catch(e) { if(opts.WTF && styles.Fills) throw e; }
15236 if(ws && ws['!ref']) {
15238if(range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws[…
15243 if(d.s.r<=d.e.r && d.s.c<=d.e.c && d.s.r>=0 && d.s.c>=0) ws["!ref"] = encode_range(d);
15258 if(!data) return data;
15259 if(!rels) rels = {'!id':{}};
15260 if(DENSE != null && opts.dense == null) opts.dense = DENSE;
15268 if(mtch) {
15275 if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
15276 …else if((sheetPr = data1.match(sheetprregex2))) parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1]||"", …
15280 if(ridx > 0) {
15282 if(ref) parse_ws_xml_dim(s, ref[1]);
15287 if(svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb);
15291 if(opts.cellStyles) {
15294 if(cols) parse_ws_xml_cols(columns, cols);
15298 if(mtch) parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles);
15302 if(afilter) s['!autofilter'] = parse_ws_xml_autofilter(afilter[0]);
15307 if(_merge) for(ridx = 0; ridx != _merge.length; ++ridx)
15312 if(hlink) parse_ws_xml_hlinks(s, hlink, rels);
15316 if(margins) s['!margins'] = parse_ws_xml_margins(parsexmltag(margins[0]));
15318if(!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) s["!ref"] = encode_…
15319 if(opts.sheetRows > 0 && s["!ref"]) {
15321 if(opts.sheetRows <= +tmpref.e.r) {
15323 if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r;
15324 if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r;
15325 if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c;
15326 if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c;
15331 if(columns.length > 0) s["!cols"] = columns;
15332 if(merges.length > 0) s["!merges"] = merges;
15337 if(merges.length === 0) return "";
15346 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
15347 if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
15355 if(opts.bookType !== 'xlsx' && wb.vbaraw) {
15357 try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {}
15362 if(ws && ws["!outline"]) {
15364 if(ws["!outline"].above) outlineprops.summaryBelow = 0;
15365 if(ws["!outline"].left) outlineprops.summaryRight = 0;
15369 if(!needed && !payload) return;
15384 sheetprot_deffalse.forEach(function(n) { if(sp[n] != null && sp[n]) o[n] = "1"; });
15385 sheetprot_deftrue.forEach(function(n) { if(sp[n] != null && !sp[n]) o[n] = "0"; });
15387if(sp.password) o.password = crypto_CreatePasswordVerifier_Method1(sp.password).toString(16).toUpp…
15395 if(!val.ref) return;
15397 if(rel) {
15399 if(val.location) val.Target += "#"+unescapexml(val.location);
15405 if(val.tooltip) { val.Tooltip = val.tooltip; delete val.tooltip; }
15409 if(dense) {
15410 if(!s[R]) s[R] = [];
15411 if(!s[R][C]) s[R][C] = {t:"z",v:undefined};
15414 if(!s[addr]) s[addr] = {t:"z",v:undefined};
15424 if(margin[k]) o[k] = parseFloat(margin[k]);
15437 if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden);
15439 if(coll.outlineLevel) coll.level = (+coll.outlineLevel || 0);
15441 if(!seencol && coll.width) { seencol = true; find_mdw_colw(coll.width); }
15449 if(!(col = cols[i])) continue;
15462 if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/);
15463 if(!wb.Workbook.Names) wb.Workbook.Names = [];
15466 if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); }
15469 if(name.Name != '_xlnm._FilterDatabase') continue;
15470 if(name.Sheet != idx) continue;
15473if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetN…
15481 if(!wb.Views) wb.Views = [{}];
15485 if(!wb.Views[i]) wb.Views[i] = {};
15487 if(+tag.zoomScale) wb.Views[i].zoom = +tag.zoomScale;
15489 if(tag.rightToLeft && parsexmlbool(tag.rightToLeft)) wb.Views[i].RTL = true;
15495if((((wb||{}).Workbook||{}).Views||[])[0]) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0…
15500 if(cell.c) ws['!comments'].push([ref, cell.c]);
15501if((cell.v === undefined || cell.t === "z" && !(opts||{}).sheetStubs) && typeof cell.f !== "string…
15504 if(cell.t !== "z") switch(cell.t) {
15509 if(opts && opts.cellDates) vv = parseDate(cell.v, -1).toISOString();
15515 if(typeof cell.z === 'undefined') cell.z = table_fmt[14];
15522 if(os !== 0) o.s = os;
15529 default: if(cell.v == null) { delete cell.t; break; }
15530 if(cell.v.length > 32767) throw new Error("Text length must not exceed 32767 characters");
15531 if(opts && opts.bookSST) {
15537 if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
15538 if(typeof cell.f == "string" && cell.f) {
15542 if(cell.l) {
15546 if(cell.D) o.cm = 1;
15570 if(xlen === 0) continue;
15576 if(/*x.charCodeAt(ri-1) != 47*/x[ri-1] != "/") { ++ri; break outa; }
15577 if(opts && opts.cellStyles) {
15581 if(opts.sheetRows && opts.sheetRows < tagr) continue;
15583 if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); }
15584 if(tag.hidden && parsexmlbool(tag.hidden)) { rowrite = true; rowobj.hidden = true; }
15585 if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; }
15586 if(rowrite) rows[tagr-1] = rowobj;
15591 if(rstarti >= ri) break;
15594 if(opts.sheetRows && opts.sheetRows < tagr) continue;
15595 if(guess.s.r > tagr - 1) guess.s.r = tagr - 1;
15596 if(guess.e.r < tagr - 1) guess.e.r = tagr - 1;
15598 if(opts && opts.cellStyles) {
15600 if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); }
15601 if(tag.hidden && parsexmlbool(tag.hidden)) { rowrite = true; rowobj.hidden = true; }
15602 if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; }
15603 if(rowrite) rows[tagr-1] = rowobj;
15608 …for(var rslice = 0; rslice != cells.length; ++rslice) if(cells[rslice].trim().charAt(0) != "<") br…
15612 if(x.length === 0) continue;
15615 if(cref != null && cref.length === 2) {
15618 if((cc=d.charCodeAt(i)-64) < 1 || cc > 26) break;
15624 for(i = 0; i != x.length; ++i) if(x.charCodeAt(i) === 62) break; ++i;
15626 if(!tag.r) tag.r = encode_cell({r:tagr-1, c:tagc});
15630if((cref=d.match(match_v))!= null && /*::cref != null && */cref[1] !== '') p.v=unescapexml(cref[1]…
15631 if(opts.cellFormula) {
15632 if((cref=d.match(match_f))!= null && /*::cref != null && */cref[1] !== '') {
15635 if(!opts.xlfn) p.f = _xlfn(p.f);
15636 if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="array"') > -1) {
15638 if(p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]);
15639 } else if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) {
15643 if(!opts.xlfn) ___f = _xlfn(___f);
15646 } else if((cref=d.match(/<f[^>]*\/>/))) {
15648if(sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2]/*[0].ref*/,…
15653 if(_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r)
15654 if(_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c)
15658 if(tag.t == null && p.v === undefined) {
15659 if(p.f || p.F) {
15661 } else if(!sheetStubs) continue;
15665 if(guess.s.c > tagc) guess.s.c = tagc;
15666 if(guess.e.c < tagc) guess.e.c = tagc;
15670 if(p.v == "" || p.v == null) {
15671 if(!sheetStubs) continue;
15676 if(typeof p.v == 'undefined') {
15677 if(!sheetStubs) continue;
15683 if(opts.cellHTML) p.h = sstr.h;
15689 if(opts.cellHTML) p.h = escapehtml(p.v);
15694 if(cref != null && (sstr = parse_si(cref[1]))) {
15696 if(opts.cellHTML) p.h = sstr.h;
15701 if(opts.cellDates) p.v = parseDate(p.v, 1);
15706 if(!opts || opts.cellText !== false) p.w = p.v;
15712 if(do_format && tag.s !== undefined) {
15714 if(cf != null) {
15715 if(cf.numFmtId != null) fmtid = cf.numFmtId;
15716 if(opts.cellStyles) {
15717 if(cf.fillId != null) fillid = cf.fillId;
15722if(opts.cellDates && do_format && p.t == 'n' && fmt_is_date(table_fmt[fmtid])) { p.t = 'd'; p.v = …
15723 if(tag.cm && opts.xlmeta) {
15725 if(cm && cm.type == 'XLDAPR') p.D = true;
15727 if(dense) {
15729 if(!s[_r.r]) s[_r.r] = [];
15734 if(rows.length > 0) s['!rows'] = rows;
15748 if(_cell === undefined) continue;
15749 if((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb)) != null) r.push(cell);
15751 if(r.length > 0 || (rows && rows[R])) {
15753 if(rows && rows[R]) {
15755 if(row.hidden) params.hidden = 1;
15757 if(row.hpx) height = px2pt(row.hpx);
15758 else if(row.hpt) height = row.hpt;
15759 if(height > -1) { params.ht = height; params.customHeight = 1; }
15760 if(row.level) { params.outlineLevel = row.level; }
15765 if(rows) for(; R < rows.length; ++R) {
15766 if(rows && rows[R]) {
15769 if(row.hidden) params.hidden = 1;
15771 if (row.hpx) height = px2pt(row.hpx);
15772 else if (row.hpt) height = row.hpt;
15773 if (height > -1) { params.ht = height; params.customHeight = 1; }
15774 if (row.level) { params.outlineLevel = row.level; }
15788 if(ws == null) ws = {};
15791 if(range.e.c > 0x3FFF || range.e.r > 0xFFFFF) {
15792 if(opts.WTF) throw new Error("Range " + ref + " exceeds format limit A1:XFD1048576");
15797 if(!rels) rels = {};
15808 if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, {
15814if(ws['!cols'] != null && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols']…
15818 if(ws['!ref'] != null) {
15820 if(rdata.length > 0) o[o.length] = (rdata);
15822 if(o.length>sidx+1) { o[o.length] = ('</sheetData>'); o[sidx]=o[sidx].replace("/>",">"); }
15826 if(ws['!protect']) o[o.length] = write_ws_xml_protection(ws['!protect']);
15831if(ws['!autofilter'] != null) o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx…
15837if(ws['!merges'] != null && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merg…
15844 if(/*::(*/ws['!links']/*::||[])*/.length > 0) {
15847 if(!l[1].Target) return;
15849 if(l[1].Target.charAt(0) != "#") {
15853 if((relc = l[1].Target.indexOf("#")) > -1) rel.location = escapexml(l[1].Target.slice(relc+1));
15854 if(l[1].Tooltip) rel.tooltip = escapexml(l[1].Tooltip);
15864 if(ws['!margins'] != null) o[o.length] = write_ws_xml_margins(ws['!margins']);
15873if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", …
15877 if(_drawing.length > 0) {
15883 if(ws['!comments'].length > 0) {
15897 if(o.length>1) { o[o.length] = ('</worksheet>'); o[1]=o[1].replace("/>",">"); }
15911 if(flags & 0x07) z.level = flags & 0x07;
15912 if(flags & 0x10) z.hidden = true;
15913 if(flags & 0x20) z.hpt = miyRw / 20;
15924 if(row.hpx) miyRw = px2pt(row.hpx) * 20;
15925 else if(row.hpt) miyRw = row.hpt * 20;
15931 if(row.level) flags |= row.level;
15932 if(row.hidden) flags |= 0x10;
15933 if(row.hpx || row.hpt) flags |= 0x20;
15944 if((range.s.c > ((i+1) << 10)) || (range.e.c < (i << 10))) continue;
15949 if(cell) { if(first < 0) first = j; last = j; }
15951 if(first < 0) continue;
15966 if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 0x0000 /* BrtRowHdr */, o);
15990 if(o == null) o = new_buf(84+4*str.length);
15992 if(outl) {
15993 if(outl.above) f &= ~0x40;
15994 if(outl.left) f &= ~0x80;
16011 if(o == null) o = new_buf(8);
16019 if(o == null) o = new_buf(4);
16030 if(o == null) o = new_buf(9);
16041 if(o == null) o = new_buf(5);
16054 if(o == null) o = new_buf(9);
16065 if(o == null) o = new_buf(8);
16081 if(o == null) o = new_buf(12);
16092 if(o == null) o = new_buf(8);
16105 if(o == null) o = new_buf(16);
16116 if(o == null) o = new_buf(12);
16129 if(o == null) o = new_buf(12);
16140 if(o == null) o = new_buf(8);
16161 if(o == null) o = new_buf(12 + 4 * cell.v.length);
16173 if(o == null) o = new_buf(8 + 4 * data.length);
16186 if(opts.cellFormula) {
16202 if(opts.cellFormula) {
16218 if(opts.cellFormula) {
16234 if(opts.cellFormula) {
16248 if(o == null) o = new_buf(4);
16263 if(tooltip) o.Tooltip = tooltip;
16288 if(opts.cellFormula) {
16300 if(opts.cellFormula) {
16311 if(o == null) o = new_buf(18);
16318 if(col.hidden) flags |= 0x01;
16319 if(typeof p.width == 'number') flags |= 0x02;
16320 if(col.level) flags |= (col.level << 8);
16333 if(o == null) o = new_buf(6*8);
16346 if(o == null) o = new_buf(30);
16348 if((((Workbook||{}).Views||[])[0]||{}).RTL) f |= 0x20;
16375 if(o == null) o = new_buf(16*4+2);
16377 o.write_shift(4, 1); // this record should not be written if no protection
16395 /*:: if(o == null) throw "unreachable"; */
16396 if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0);
16408 if(!data) return data;
16410 if(!rels) rels = {'!id':{}};
16411 if(DENSE != null && opts.dense == null) opts.dense = DENSE;
16432 if(!opts.supbooks) {
16434 if(wb.Names) for(var i = 0; i < wb.Names.length; ++i) supbooks[0][i+1] = wb.Names[i];
16445 if(end) return;
16451 if(opts.sheetRows && opts.sheetRows <= row.r) end=true;
16454 if(val.hidden || val.hpt || val.level != null) {
16455 if(val.hpt) val.hpx = pt2px(val.hpt);
16482 case 'e': p.v = val[1]; if(opts.cellText !== false) p.w = BErr[p.v]; break;
16486 if((cf = styles.CellXf[val[0].iStyleRef])) safe_format(p,cf.numFmtId,null,opts, themes, styles);
16488 if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; }
16490 if(opts.cellFormula) {
16494 if(row.r >= aii[0].s.r && row.r <= aii[0].e.r)
16495 if(C >= aii[0].s.c && C <= aii[0].e.c) {
16499 if(!af && val.length > 3) p.f = val[3];
16502 if(refguess.s.r > row.r) refguess.s.r = row.r;
16503 if(refguess.s.c > C) refguess.s.c = C;
16504 if(refguess.e.r < row.r) refguess.e.r = row.r;
16505 if(refguess.e.c < C) refguess.e.c = C;
16506 if(opts.cellDates && cf && p.t == 'n' && fmt_is_date(table_fmt[cf.numFmtId])) {
16507 …var _d = SSF_parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,…
16509 if(cm) {
16510 if(cm.type == 'XLDAPR') p.D = true;
16513 if(vm) vm = void 0;
16518 if(!opts.sheetStubs || pass) break;
16521 if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; }
16523 if(refguess.s.r > row.r) refguess.s.r = row.r;
16524 if(refguess.s.c > C) refguess.s.c = C;
16525 if(refguess.e.r < row.r) refguess.e.r = row.r;
16526 if(refguess.e.c < C) refguess.e.c = C;
16527 if(cm) {
16528 if(cm.type == 'XLDAPR') p.D = true;
16531 if(vm) vm = void 0;
16543 if(rel) {
16545 if(val.loc) val.Target += "#"+val.loc;
16547 } else if(val.relId == '') {
16551 if(opts.dense) {
16552 if(!s[R]) s[R] = [];
16553 if(!s[R][C]) s[R][C] = {t:'z',v:undefined};
16557 if(!s[addr]) s[addr] = {t:'z',v:undefined};
16564 if(!opts.cellFormula) break;
16571 if(!opts.cellFormula) break;
16579 if(!opts.cellStyles) break;
16582 if(!seencol) { seencol = true; find_mdw_colw(val.w/256); }
16596 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
16597 if(val.name) wb.Sheets[idx].CodeName = val.name;
16598 if(val.above || val.left) s['!outline'] = { above: val.above, left: val.left };
16602 if(!wb.Views) wb.Views = [{}];
16603 if(!wb.Views[0]) wb.Views[0] = {};
16604 if(val.RTL) wb.Views[0].RTL = true;
16678 if(RR.T){/* empty */}
16679 else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
16686if(!s["!ref"] && (refguess.s.r < 2000000 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || r…
16687 if(opts.sheetRows && s["!ref"]) {
16689 if(opts.sheetRows <= +tmpref.e.r) {
16691 if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r;
16692 if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r;
16693 if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c;
16694 if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c;
16699 if(merges.length > 0) s["!merges"] = merges;
16700 if(colinfo.length > 0) s["!cols"] = colinfo;
16701 if(rowinfo.length > 0) s["!rows"] = rowinfo;
16708 if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]);
16709 if(cell.v === undefined) return false;
16724 if(cell.l) ws['!links'].push([encode_cell(o), cell.l]);
16727 if(opts.bookSST) {
16730 if(last_seen) write_record(ba, 0x0012 /* BrtShortIsst */, write_BrtShortIsst(cell, o));
16734 if(last_seen) write_record(ba, 0x0011 /* BrtShortSt */, write_BrtShortSt(cell, o));
16740 if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) {
16741 if(last_seen) write_record(ba, 0x000D /* BrtShortRk */, write_BrtShortRk(cell, o));
16744 if(last_seen) write_record(ba, 0x0010 /* BrtShortReal */, write_BrtShortReal(cell, o));
16749 if(last_seen) write_record(ba, 0x000F /* BrtShortBool */, write_BrtShortBool(cell, o));
16754 if(last_seen) write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError(cell, o));
16758 if(last_seen) write_record(ba, 0x000C /* BrtShortBlank */, write_BrtShortBlank(cell, o));
16768 if(ws['!rows']) cap = Math.max(range.e.r, ws['!rows'].length - 1);
16775 if(R <= range.e.r) for(var C = range.s.c; C <= range.e.c; ++C) {
16777 if(R === range.s.r) cols[C] = encode_col(C);
16780 if(!cell) { last_seen = false; continue; }
16789 if(!ws || !ws['!merges']) return;
16796 if(!ws || !ws['!cols']) return;
16798 …ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 0x003C /* 'BrtColInfo' */, write_BrtCo…
16803 if(!ws || !ws['!ref']) return;
16812 if(!l[1].Target) return;
16820 if(ws['!comments'].length > 0) {
16828 if(!ws['!autofilter']) return;
16833 if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/);
16834 if(!wb.Workbook.Names) wb.Workbook.Names = [];
16837 if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); }
16840 if(name.Name != '_xlnm._FilterDatabase') continue;
16841 if(name.Sheet != idx) continue;
16844if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: formula_quote_s…
16874 if(!ws['!protect']) return;
16882 …var c/*:string*/ = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } cat…
16884 if(r.e.c > 0x3FFF || r.e.r > 0xFFFFF) {
16885if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:XFD104857…
16893if(wb.vbaraw || ws['!outline']) write_record(ba, 0x0093 /* BrtWsProp */, write_BrtWsProp(c, ws['!o…
16913 if(ws['!margins']) write_record(ba, 0x01DC /* BrtMargins */, write_BrtMargins(ws['!margins']));
16920 if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
16942 if(!q) return;
16957 if(!data) return csheet;
16973 if(refguess.e.r < R) refguess.e.r = R;
16976 if(C > 0) cs["!ref"] = encode_range(refguess);
16981 if(!data) return data;
16983 if(!rels) rels = {'!id':{}};
16989 if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
16992 if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1];
16994 if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
17004 // if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
17017 if(!data) return data;
17018 if(!rels) rels = {'!id':{}};
17029 if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
17030 if(val.name) wb.Sheets[idx].CodeName = val.name;
17053 if(R.T > 0) state.push(RT);
17054 else if(R.T < 0) state.pop();
17055 else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
17059 if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
17161 if(w[z[0]] == null) w[z[0]] = z[1];
17163 case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break;
17164 case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break;
17171 if(target[z[0]] == null) target[z[0]] = z[1];
17173 … case "bool": if(typeof target[z[0]] == "string") target[z[0]] = parsexmlbool(target[z[0]]); break;
17174 case "int": if(typeof target[z[0]] == "string") target[z[0]] = parseInt(target[z[0]], 10); break;
17191 if(!wb.Workbook) return "false";
17192 if(!wb.Workbook.WBProps) return "false";
17198 if(n.length > 31) { if(safe) return false; throw new Error("Sheet names cannot exceed 31 chars"); }
17201 if(n.indexOf(c) == -1) return;
17202 if(!safe) throw new Error("Sheet name cannot contain : \\ / ? * [ ]");
17210 for(var j = 0; j < i; ++j) if(n == N[j]) throw new Error("Duplicate Sheet Name: " + n);
17211 if(codes) {
17213 if(cn.charCodeAt(0) == 95 && cn.length > 22) throw new Error("Bad Code Name: Worksheet" + cn);
17218 if(!wb || !wb.SheetNames || !wb.Sheets) throw new Error("Invalid Workbook");
17219 if(!wb.SheetNames.length) throw new Error("Workbook is empty");
17225 if(!ws || !ws["!autofilter"]) return;
17227 if(!wb.Workbook) wb.Workbook = {};
17228 if(!wb.Workbook.Names) wb.Workbook.Names = [];
17229 …wb.Workbook.Names.forEach(function(dn) { if(dn.Name == "_xlnm._FilterDatabase" && dn.Sheet == i) D…
17231 if(DN) DN.Ref = nn;
17239 if(!data) throw new Error("Could not find file");
17250 if(x.match(wbnsregex)) xmlns = "xmlns" + x.match(/<(\w+):/)[1];
17268 if(y[w[0]] == null) return;
17275 if(y.codeName) wb.WBProps.CodeName = utf8read(y.codeName);
17322 if(y.comment) dname.Comment = y.comment;
17323 if(y.localSheetId) dname.Sheet = +y.localSheetId;
17324 if(parsexmlbool(y.hidden||"0")) dname.Hidden = true;
17385 default: if(!pass && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in workbook');
17389 if(XMLNS_main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
17411 if(wb.Workbook && wb.Workbook.WBProps) {
17413 /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
17414 if((wb.Workbook.WBProps[x[0]]/*:any*/) == null) return;
17415 if((wb.Workbook.WBProps[x[0]]/*:any*/) == x[1]) return;
17418 /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
17419if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete work…
17428 /* bookViews only written if first worksheet is hidden */
17429 if(sheets && sheets[0] && !!sheets[0].Hidden) {
17432 if(!sheets[i]) break;
17433 if(!sheets[i].Hidden) break;
17435 if(i == wb.SheetNames.length) i = 0;
17445 if(sheets[i]) switch(sheets[i].Hidden) {
17456 if(write_names) {
17458 if(wb.Workbook && wb.Workbook.Names) wb.Workbook.Names.forEach(function(n) {
17460 if(n.Comment) d.comment = n.Comment;
17461 if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
17462 if(n.Hidden) d.hidden = "1";
17463 if(!n.Ref) return;
17480 if(o.length>2){ o[o.length] = '</workbook>'; o[1]=o[1].replace("/>",">"); }
17493 if(!o) o = new_buf(127);
17507 if(strName.length > 0) o.CodeName = strName;
17526 if(!o) o = new_buf(72);
17528 if(data) {
17530 if(data.date1904) flags |= 0x01;
17531 if(data.filterPrivacy) flags |= 0x08;
17556 if(flags & 0x20) name = "_xlnm." + name;
17557 //if(0 /* fProc */) {
17565 if(itab < 0xFFFFFFF) out.Sheet = itab;
17566 if(comment) out.Comment = comment;
17573 if(XLSLblBuiltIn.indexOf(dname) > -1) { flags |= 0x20; dname = dname.slice(6); }
17583 if(name.Comment) arr.push(write_XLNullableWideString(name.Comment));
17590 // if macro (flags & 0x0F):
17605 if(!opts) opts = {};
17625 if(val.Sheet != null) opts.SID = val.Sheet;
17637 if(!supbooks[0].length) supbooks[0] = [RT, val];
17642 if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; }
17696 if(R.T){/* empty */}
17697 …else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */ && state[state.leng…
17722 if(!o) o = new_buf(127);
17733 if(!o) o = new_buf(29);
17747 /* required if hidden tab appears before visible tab */
17748 if(!wb.Workbook || !wb.Workbook.Sheets) return;
17752 if(!sheets[i] || !sheets[i].Hidden && vistab == -1) vistab = i;
17753 else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i;
17755 if(hidden > vistab) return;
17763 if(!wb.Workbook || !wb.Workbook.Names) return;
17765 if(name.Flags & 0x0e) return; // TODO: macro name write
17792 if(!o) o = new_buf(26);
17805 if(!o) o = new_buf(1);
17823 if((wb.Workbook||{}).Names) write_BRTNAMES(ba, wb);
17840 if(name.slice(-4)===".bin") return parse_wb_bin((data/*:any*/), opts);
17845if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17850if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17855if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17860if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, idx, rels, wb, themes, style…
17865 if(name.slice(-4)===".bin") return parse_sty_bin((data/*:any*/), themes, opts);
17870 if(name.slice(-4)===".bin") return parse_sst_bin((data/*:any*/), opts);
17875 if(name.slice(-4)===".bin") return parse_comments_bin((data/*:any*/), opts);
17880 if(name.slice(-4)===".bin") return parse_cc_bin((data/*:any*/), name, opts);
17885 if(name.slice(-4)===".bin") return parse_xlink_bin((data/*:any*/), rel, name, opts);
17890 if(name.slice(-4)===".bin") return parse_xlmeta_bin((data/*:any*/), name, opts);
17897 var z/*:any*/ = ([]/*:any*/); if(!skip_root) z[0] = words[0];
17898 if(words.length === 1) return z;
17900 if(m) for(i = 0; i != m.length; ++i) {
17902 /*:: if(!y || !y[2]) continue; */
17903 if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1);
17905 if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6);
17915 if(words.length === 1) return z;
17917 if(m) for(i = 0; i != m.length; ++i) {
17919 /*:: if(!y || !y[2]) continue; */
17920 if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1);
17922 if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6);
17937 if(fmt === "General") return SSF_general(value);
17955 if(cell.t === 'z') return;
17956 if(!o || o.cellText !== false) try {
17957 if(cell.t === 'e') { cell.w = cell.w || BErr[cell.v]; }
17958 else if(nf === "General") {
17959 if(cell.t === 'n') {
17960 if((cell.v|0) === cell.v) cell.w = cell.v.toString(10);
17966 } catch(e) { if(o.WTF) throw e; }
17969 if(o.cellNF) cell.z = z;
17970 if(o.cellDates && cell.t == 'n' && fmt_is_date(z)) {
17971 …var _d = SSF_parse_date_code(cell.v); if(_d) { cell.t = 'd'; cell.v = new Date(_d.y, _d.m-1,_d.d,_…
17973 } catch(e) { if(o.WTF) throw e; }
17977 if(opts.cellStyles) {
17978 if(stag.Interior) {
17980 if(I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern;
17991 if(sid === undefined && row) sid = row.StyleID;
17992 if(sid === undefined && csty) sid = csty.StyleID;
17994 if(styles[sid].nf) nf = styles[sid].nf;
17995 if(styles[sid].Interior) interiors.push(styles[sid].Interior);
17996 if(!styles[sid].Parent) break;
18009 if(xml.slice(-1) != "Z") xml += "Z";
18011 if(cell.v !== cell.v) cell.v = unescapexml(xml);
18012 else if(cell.v<60) cell.v = cell.v -1;
18013 if(!nf || nf == "General") nf = "yyyy-mm-dd";
18016 if(cell.v === undefined) cell.v=+xml;
18017 if(!cell.t) cell.t = 'n';
18019 case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
18021 if(xml == "" && ss == "") { cell.t = 'z'; }
18026 if(o.cellFormula !== false) {
18027 if(cell.Formula) {
18030 if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1);
18033 if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base);
18034 else if(cell.ArrayRange) {
18040 if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r)
18041 if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c)
18045 if(o.cellStyles) {
18047 if(!S.patternType && x.patternType) S.patternType = x.patternType;
18051 if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID;
18069 if(opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') {
18070 if(typeof $cptable !== 'undefined') str = $cptable.utils.decode(65001, char_codes(str));
18075if((opening.indexOf(">") & 1023) > Math.min((opening.indexOf(",") & 1023), (opening.indexOf(";")&1…
18076if(opening.indexOf("<?xml") == -1) ["html", "table", "head", "meta", "script", "style", "div"].for…
18077 if(ishtml) return html_to_workbook(str, opts);
18101 if(DENSE != null && opts.dense == null) opts.dense = DENSE;
18121 if(raw_Rn3 == "data") {
18122 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
18123 else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
18126 if(state[state.length-1][1]) break;
18127if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"…
18131 if(Rn[1]==='/'){
18132 if(comments.length > 0) cell.c = comments;
18133 if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== void 0) {
18134 if(opts.dense) {
18135 if(!cursheet[r]) cursheet[r] = [];
18139 if(cell.HRef) {
18141 if(cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip;
18144 if(cell.MergeAcross || cell.MergeDown) {
18147 if(cc > c || rr > r) merges.push({s:{c:c,r:r},e:{c:cc,r:rr}});
18149 if(!opts.sheetStubs) { if(cell.MergeAcross) c = cc + 1; else ++c; }
18150 else if(cell.MergeAcross || cell.MergeDown) {
18151 /*:: if(!cc) cc = 0; if(!rr) rr = 0; */
18154 if(cma > c || cmd > r) {
18155 if(opts.dense) {
18156 if(!cursheet[cmd]) cursheet[cmd] = [];
18167 if(cell.Index) c = +cell.Index - 1;
18168 if(c < refguess.s.c) refguess.s.c = c;
18169 if(c > refguess.e.c) refguess.e.c = c;
18170 if(Rn[0].slice(-2) === "/>") ++c;
18175 if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") {
18176 if(r < refguess.s.r) refguess.s.r = r;
18177 if(r > refguess.e.r) refguess.e.r = r;
18178 if(Rn[0].slice(-2) === "/>") {
18180 if(row.Index) r = +row.Index - 1;
18185 if(row.Index) r = +row.Index - 1;
18187 if(row.AutoFitHeight == "0" || row.Height) {
18191 if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; }
18195 if(Rn[1]==='/'){
18196 if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
18198 if(refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) {
18200 if(opts.sheetRows && opts.sheetRows <= refguess.e.r) {
18206 if(merges.length) cursheet["!merges"] = merges;
18207 if(cstys.length > 0) cursheet["!cols"] = cstys;
18208 if(rowinfo.length > 0) cursheet["!rows"] = rowinfo;
18225 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
18226 else if(Rn[0].slice(-2) == "/>") break;
18234 if(Rn[1]==='/') process_style_xlml(styles, stag, opts);
18240 if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf];
18241 for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(table_fmt[ssfidx] == stag.nf) break;
18242if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(table_fmt[ssfidx] == null) { …
18246 if(state[state.length-1][0] !== /*'Table'*/'table') break;
18247 if(Rn[1]==='/') break;
18249 if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; }
18250 if(csty.Width) csty.wpx = parseInt(csty.Width, 10);
18251 if(!seencol && csty.wpx > 10) {
18253 for(var _col = 0; _col < cstys.length; ++_col) if(cstys[_col]) process_col(cstys[_col]);
18255 if(seencol) process_col(csty);
18261 if(Rn[1]==='/') break;
18262 if(!Workbook.Names) Workbook.Names = [];
18268 if(Workbook.Sheets.length>0) _DefinedName.Sheet=Workbook.Sheets.length-1;
18269 /*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName);
18288 if(Rn[0].slice(-2) === "/>") break;
18289 else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index);
18293 if(!opts.cellStyles) break;
18318 if(Rn[0].slice(-2) === "/>") break;
18319 else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index));
18326 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
18331 if(Rn[1]==='/'){
18332 if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
18343 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
18344 else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
18354 if(Rn[1]==='/'){
18355 if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
18357 if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
18381 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
18382 else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
18389 if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts);
18391 if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts);
18426 /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
18488 if(Rn[0].slice(-2) === "/>"){/* empty */}
18489 else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) {
18496 if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
18497if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].header = +parsexmltag(Rn[0]).Margin;
18500 if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
18501if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].footer = +parsexmltag(Rn[0]).Margin;
18505 if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml');
18506 if(!isNaN(+pagemargins.Top)) cursheet['!margins'].top = +pagemargins.Top;
18507 if(!isNaN(+pagemargins.Left)) cursheet['!margins'].left = +pagemargins.Left;
18508 if(!isNaN(+pagemargins.Right)) cursheet['!margins'].right = +pagemargins.Right;
18509 if(!isNaN(+pagemargins.Bottom)) cursheet['!margins'].bottom = +pagemargins.Bottom;
18512 if(!Workbook.Views) Workbook.Views = [];
18513 if(!Workbook.Views[0]) Workbook.Views[0] = {};
18575 if(!cursheet["!outline"]) cursheet["!outline"] = {};
18582 if(!cursheet["!outline"]) cursheet["!outline"] = {};
18795 if(seen) break;
18797 if(Rn[3].match(/!\[CDATA/)) break;
18798 if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|");
18799 if(state[state.length-1][0]===/*'CustomDocumentProperties'*/'customdocumentproperties') {
18800 if(Rn[0].slice(-2) === "/>") break;
18801 else if(Rn[1]==="/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index));
18805 if(opts.WTF) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|");
18808 if(!opts.bookSheets && !opts.bookProps) out.Sheets = sheets;
18832 if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts));
18834 if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts));
18841if((((wb||{}).Workbook||{}).WBProps||{}).date1904) return '<ExcelWorkbook xmlns="urn:schemas-micro…
18859 if(!((wb||{}).Workbook||{}).Names) return "";
18860 /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
18865 if(n.Sheet != null) continue;
18866 if(n.Name.match(/^_xlfn\./)) continue;
18872 if(!ws) return "";
18873 if(!((wb||{}).Workbook||{}).Names) return "";
18874 /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
18879 if(n.Sheet != idx) continue;
18883 if(n.Name.match(/^_xlfn\./)) continue;
18890 if(!ws) return "";
18907 if(ws['!margins']) {
18909 if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header}));
18910 if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer}));
18933 if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) {
18935if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == …
18938 for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break;
18939 if(i == idx) o.push("<Selected/>");
18945 if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push("<DisplayRightToLeft/>");
18972 if(ws['!protect']) {
18974 if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True"));
18975 if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True"));
18976if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag(…
18977 …else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(…
18990 ].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); });
18993 if(o.length == 0) return "";
19005 if(!cell || (cell.v == undefined && cell.f == undefined)) return "";
19008 if(cell.f) attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr));
19009 if(cell.F && cell.F.slice(0, ref.length) == ref) {
19014 if(cell.l && cell.l.Target) {
19016 if(cell.l.Tooltip) attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip);
19019 if(ws['!merges']) {
19022 if(marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) continue;
19023 if(marr[mi].e.c > marr[mi].s.c) attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c;
19024 if(marr[mi].e.r > marr[mi].s.r) attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r;
19030 case 'z': if(!opts.sheetStubs) return ""; break;
19034 …case 'd': t = 'DateTime'; p = new Date(cell.v).toISOString(); if(cell.z == null) cell.z = cell.z |…
19044 if((cell.c||[]).length > 0) m += write_ws_xlml_comment(cell.c);
19050 if(row) {
19051 if(row.hpt && !row.hpx) row.hpx = pt2px(row.hpt);
19052 if(row.hpx) o += ' ss:AutoFitHeight="0" ss:Height="' + row.hpx + '"';
19053 if(row.hidden) o += ' ss:Hidden="1"';
19059 if(!ws['!ref']) return "";
19063 if(ws['!cols']) ws['!cols'].forEach(function(n, i) {
19068 if(w) k['ss:Width'] = width2px(p.width);
19069 if(n.hidden) k['ss:Hidden']="1";
19078 if(marr[mi].s.c > C) continue;
19079 if(marr[mi].s.r > R) continue;
19080 if(marr[mi].e.c < C) continue;
19081 if(marr[mi].e.r < R) continue;
19082 if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true;
19085 if(skip) continue;
19091 if(row.length > 2) o.push(row.join(""));
19101 if(t.length > 0) o.push("<Names>" + t + "</Names>");
19105 if(t.length > 0) o.push("<Table>" + t + "</Table>");
19110if(ws["!autofilter"]) o.push('<AutoFilter x:Range="' + a1_to_rc(fix_range(ws["!autofilter"].ref), …
19115 if(!opts) opts = {};
19116 if(!wb.SSF) wb.SSF = dup(table_fmt);
19117 if(wb.SSF) {
19147 /*:: if(o == null) return; */
19155 if(o.length - o.l <= 4) return v;
19158 if(m == 0 || m > 40) return v;
19161 if(o.length - o.l <= 4) return v;
19163 if(m !== 0x71b239f4) return v;
19167 if(m == 0 || m > 40) return v;
19184 if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
19199 if(nextrt == 0x0812 /* ContinueFrt */) start += 4;
19200 else if(nextrt == 0x0875 || nextrt == 0x087f) {
19212if(b.length < length) throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length …
19217 if(p.t === 'z') return;
19218 if(!p.XF) return;
19222 if(opts.cellNF) p.z = table_fmt[fmtid];
19223 } catch(e) { if(opts.WTF) throw e; }
19224 if(!opts || opts.cellText !== false) try {
19225 if(p.t === 'e') { p.w = p.w || BErr[p.v]; }
19226 else if(fmtid === 0 || fmtid == "General") {
19227 if(p.t === 'n') {
19228 if((p.v|0) === p.v) p.w = p.v.toString(10);
19234 } catch(e) { if(opts.WTF) throw e; }
19235 if(opts.cellDates && fmtid && p.t == 'n' && fmt_is_date(table_fmt[fmtid] || String(fmtid))) {
19236 …var _d = SSF_parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,…
19248 if(DENSE != null && options.dense == null) options.dense = DENSE;
19265 if(icv < 8) return XLSIcv[icv];
19266 if(icv < 64) return palette[icv-8] || XLSIcv[icv];
19271 if(!xfd || !xfd.patternType || !options || !options.cellStyles) return;
19275 if((t = rgb2Hex(get_rgb(xfd.icvFore)))) { line.s.fgColor = {rgb:t}; }
19276 if((t = rgb2Hex(get_rgb(xfd.icvBack)))) { line.s.bgColor = {rgb:t}; }
19279 if(file_depth > 1) return;
19280 if(options.sheetRows && cell.r >= options.sheetRows) return;
19281 if(options.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options);
19285 if(!range || !range.s || !range.e) range = {s:{r:0,c:0},e:{r:0,c:0}};
19286 if(cell.r < range.s.r) range.s.r = cell.r;
19287 if(cell.c < range.s.c) range.s.c = cell.c;
19288 if(cell.r + 1 > range.e.r) range.e.r = cell.r + 1;
19289 if(cell.c + 1 > range.e.c) range.e.c = cell.c + 1;
19290 if(options.cellFormula && line.f) {
19292 if(arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue;
19293 if(arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue;
19295 if(arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f;
19296 if(line.f) line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts);
19301 if(options.dense) {
19302 if(!out[cell.r]) out[cell.r] = [];
19321 if(options.password) opts.password = options.password;
19346 if(RecordType === 0 && last_RT === 0x000a /* EOF */) break;
19349 if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) break;
19351 //if(!R) console.log(blob.slice(blob.l, blob.l + length));
19352 if(R && R.f) {
19353 if(options.bookSheets) {
19354if(last_RT === 0x0085 /* BoundSheet8 */ && RecordType !== 0x0085 /* R.n !== 'BoundSheet8' */) brea…
19357 if(R.r === 2 || R.r == 12) {
19359if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt …
19360 if(R.r == 12){
19366 if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
19369if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
19372 /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
19376 if(!opts.enc) blob.l = 0;
19378 if(!options.password) throw new Error("File is password-protected");
19379 if(val.valid == null) throw new Error("Encryption scheme unsupported");
19380 if(!val.valid) throw new Error("Password is incorrect");
19406 if(val.fDialog) out["!type"] = "dialog";
19407 if(!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true;
19408 if(!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true;
19424 if(val.itab > 0) last_lbl.Sheet = val.itab - 1;
19426 if(!supbooks[0]) { supbooks[0] = []; supbooks[0].XTI = []; }
19428 if(val.Name == "_xlnm._FilterDatabase" && val.itab > 0)
19429 if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d')
19434 if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; }
19438 if(opts.biff < 8) break;
19439 if(last_lbl != null) last_lbl.Comment = val[1];
19442 …case 0x0013 /* Password */: if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); …
19448 if(--file_depth) break;
19449 if(range.e) {
19450 if(range.e.r > 0 && range.e.c > 0) {
19453 if(options.sheetRows && options.sheetRows <= range.e.r) {
19462 if(merges.length > 0) out["!merges"] = merges;
19463 if(objects.length > 0) out["!objects"] = objects;
19464 if(colinfo.length > 0) out["!cols"] = colinfo;
19465 if(rowinfo.length > 0) out["!rows"] = rowinfo;
19468 if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out;
19472 if(opts.biff === 8) opts.biff = {
19486if(val.BIFFVer == 0 && val.dt == 0x1000) { opts.biff = 5; seen_codepage = true; set_cp(opts.codepa…
19487 if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
19488 if(file_depth++) break;
19491if(opts.biff < 8 && !seen_codepage) { seen_codepage = true; set_cp(opts.codepage = options.codepag…
19493 if(opts.biff < 5 || val.BIFFVer == 0 && val.dt == 0x1000) {
19494 if(cur_sheet === "") cur_sheet = "Sheet1";
19502 if(val.dt == 0x20) out["!type"] = "chart";
19503 if(val.dt == 0x40) out["!type"] = "macro";
19512if(out["!type"] == "chart") if(options.dense ? (out[val.r]||[])[val.c]: out[encode_cell({c:val.c, …
19514 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19520 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19526 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19534 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19540 if(val.val == 'String') { last_formula = val; break; }
19543 if(options.cellFormula) {
19545 if(_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') {
19548if(sharedf[_fe]) temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts);
19552 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19558 if(last_formula) { /* technically always true */
19562 if(options.cellFormula) {
19565 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19575 if(options.cellFormula && cc) {
19576 if(!last_formula) break; /* technically unreachable */
19577 if(!_arraystart || !cc) break;
19583 if(!options.cellFormula) break;
19584 if(last_cell) {
19586 if(!last_formula) break; /* technically unreachable */
19594 if(sst[val.isst].h) temp_val.h = sst[val.isst].h;
19596 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19600 case 0x0201 /* Blank */: if(options.sheetStubs) {
19602 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19606 case 0x00be /* MulBlank */: if(options.sheetStubs) {
19610 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19619 if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
19625 if(file_depth === 1) range = val; /* TODO: stack */
19631 if(opts.biff == 4) {
19633 for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(table_fmt[b4idx] == val[1]) break;
19634 if(b4idx >= 163) SSF__load(val[1], BIFF2Fmt + 163);
19640 for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(table_fmt[b2idx] == val) break;
19641 if(b2idx >= 163) SSF__load(val, BIFF2Fmt + 163);
19654 if(cc) cc.l = val[1];
19661 if(cc && cc.l) cc.l.Tooltip = val[1];
19665 if(opts.biff <= 5 && opts.biff >= 2) break; /* TODO: BIFF5 */
19668 if(!cc) {
19669 if(options.dense) {
19670 if(!out[val[0].r]) out[val[0].r] = [];
19680 if(!cc.c) cc.c = [];
19686 if(!opts.cellStyles) break;
19689 if(!seencol) { seencol = true; find_mdw_colw(val.w/256); }
19695 if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; }
19696 if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; }
19697 if(val.hpt) {
19706 if(!out['!margins']) default_margins(out['!margins'] = {});
19710 if(!out['!margins']) default_margins(out['!margins'] = {});
19716 if(val.RTL) Workbook.Views[0].RTL = true;
19722 /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
19723 if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
19728 if(!R) console.error("Missing Info for XLS Record 0x" + RecordType.toString(16));
19733 if(!options.bookSheets) wb.Sheets=Sheets;
19734 if(!wb.SheetNames.length && Preamble["!ref"]) {
19737 if(wb.Sheets) wb.Sheets["Sheet1"] = Preamble;
19740if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] =…
19743 if(opts.enc) wb.Encryption = opts.enc;
19744 if(themes) wb.Themes = themes;
19746 if(country !== undefined) wb.Metadata.Country = country;
19747 if(supbooks.names.length > 0) Workbook.Names = supbooks.names;
19761 if(DSI && DSI.size > 0) try {
19764 } catch(e) {if(o.WTF) throw e;/* empty */}
19768 if(SI && SI.size > 0) try {
19770 for(var s in Summary) if(props[s] == null) props[s] = Summary[s];
19771 } catch(e) {if(o.WTF) throw e;/* empty */}
19773 if(props.HeadingPairs && props.TitlesOfParts) {
19783 if(wb.Props) {
19788 if(wb.Custprops) {
19791 …for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])…
19795if(XLSPSSkip.indexOf(CEntries[i][0]) > -1 || PseudoPropsPairs.indexOf(CEntries[i][0]) > -1) contin…
19796 if(CEntries[i][1] == null) continue;
19799if(SEntries.length) CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SE…
19800if(DSEntries.length || CEntries2.length) CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation…
19804 if(!options) options = {};
19807 if(options.codepage) set_ansi(options.codepage);
19809 if(cfb.FullPaths) {
19810 if(CFB.find(cfb, '/encryption')) throw new Error("File is password-protected");
19818 case 'array': if(!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb); break;
19826 if(CompObj) /*::CompObjP = */parse_compobj(CompObj);
19827 if(options.bookProps && !options.bookSheets) WorkbookP = ({}/*:any*/);
19828 else/*:: if(cfb instanceof CFBContainer) */ {
19830 if(WB && WB.content) WorkbookP = parse_workbook(WB.content, options);
19832 …else if((_data=CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(…
19834 …else if((_data=CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(…
19836 …else if((_data=CFB.find(cfb, 'MN0')) && _data.content) throw new Error("Unsupported Works 4 for Ma…
19838if(options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) WorkbookP.vbara…
19842 if(cfb.FullPaths) parse_xls_props(/*::((*/cfb/*:: :any):CFBContainer)*/, props, options);
19845 if(options.bookFiles) WorkbookP.cfb = cfb;
19858 case "xla": if(!o.bookType) o.bookType = "xla";
19865 if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb);
19867if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "str…
21206 if(isNaN(t)) return;
21211 if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload);
21216 if(len <= 8224) return write_biff_rec(ba, type, payload, len);
21218 if(isNaN(t)) return;
21238 if(!out) out = new_buf(7);
21263 if(cell.v != null) switch(cell.t) {
21266 if((v == (v|0)) && (v >= 0) && (v < 65536))
21283 if(range.e.c > 0xFF || range.e.r > 0x3FFF) {
21284if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384");
21292 if(R === range.s.r) cols[C] = encode_col(C);
21295 if(!cell) continue;
21305 if(DENSE != null && o.dense == null) o.dense = DENSE;
21308 for(var i=0;i<wb.SheetNames.length;++i) if(wb.SheetNames[i] == o.sheet) idx=i;
21309if(idx == 0 && !!o.sheet && wb.SheetNames[0] != o.sheet) throw new Error("Sheet not found: " + o.s…
21330 if(!NF) return;
21332 /*:: if(!NF) return; */
21333 …for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_biff_rec(ba, 0x041E /* Format */, write_…
21364 if(HL[1].Tooltip) write_biff_rec(ba, 0x0800 /* HLinkTooltip */, write_HLinkTooltip(HL));
21370 if(!cols) return;
21373 if(++cnt <= 256 && col) {
21381 if(cell.v == null && !cell.bf) {
21385 if(cell.bf) write_biff_rec(ba, 0x0006 /* Formula */, write_Formula(cell, R, C, opts, os));
21397 if(opts.bookSST) {
21418 if(range.e.c > 0xFF || range.e.r >= MAX_ROWS) {
21419if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384");
21442 if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
21447 if(b8) ws['!links'] = [];
21452 if(R === range.s.r) cols[C] = encode_col(C);
21455 if(!cell) continue;
21458 if(b8 && cell.l) ws['!links'].push([ref, cell.l]);
21459 if(b8 && cell.c) comments.push([ref, cell.c]);
21464 …// if(b8) comments.forEach(function(comment) { write_biff_rec(ba, 0x001c /* Note */, write_NoteSh(…
21466 if(b8) write_biff_rec(ba, 0x023e /* Window2 */, write_Window2((_WB.Views||[])[0]));
21468if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, 0x00e5 /* MergeCells */, write_MergeCells(…
21470 if(b8) write_ws_biff8_hlinks(ba, ws);
21474 if(b8) write_FEAT(ba, ws);
21488 if(opts.bookType == "xla") write_biff_rec(A, 0x0087 /* Addin */);
21491 if(b5) write_biff_rec(A, 0x00bf /* ToolbarHdr */);
21492 if(b5) write_biff_rec(A, 0x00c0 /* ToolbarEnd */);
21498 if(b8) write_biff_rec(A, 0x0161 /* DSF */, writeuint16(0));
21499 if(b8) write_biff_rec(A, 0x01c0 /* Excel9File */);
21501 if(b8 && wb.vbaraw) write_biff_rec(A, 0x00d3 /* ObProj */);
21503 if(b8 && wb.vbaraw) {
21514 if(b8) write_biff_rec(A, 0x01af /* Prot4Rev */, writebool(false));
21515 if(b8) write_biff_rec(A, 0x01bc /* Prot4RevPass */, writeuint16(0));
21521 if(b8) write_biff_rec(A, 0x01b7 /* RefreshAll */, writebool(false));
21528 if(b8) write_biff_rec(A, 0x0160 /* UsesELFs */, writebool(false));
21533 if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country());
21537 if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts));
21554 if(blen != b.length) throw new Error("BS8 " + blen + " != " + b.length);
21557 if(a.length) out.push(a);
21558 if(b.length) out.push(b);
21559 if(c.length) out.push(c);
21568 if(wb && !wb.SSF) {
21571 if(wb && wb.SSF) {
21584 if(!wb.Props) wb.Props = {};
21594 if(!ws || !ws["!ref"]) continue;
21596 if(range.e.c > 255) { // note: 255 is IV
21597if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] …
21611 if(DENSE != null && opts.dense == null) opts.dense = DENSE;
21615 if(!mtch) throw new Error("Invalid HTML: could not find <table>");
21625if(hd == "<tr") { ++R; if(opts.sheetRows && opts.sheetRows <= R) { --R; break; } C = 0; continue; }
21626 if(hd != "<td" && hd != "<th") continue;
21630 if(!cell.match(/<t[dh]/i)) continue;
21636 if(_merge.s.c == C && _merge.s.r < R && R <= _merge.e.r) { C = _merge.e.c + 1; midx = -1; }
21640 if((RS = +tag.rowspan)>1 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}});
21643 if(!m.length) { C += CS; continue; }
21645 if(range.s.r > R) range.s.r = R; if(range.e.r < R) range.e.r = R;
21646 if(range.s.c > C) range.s.c = C; if(range.e.c < C) range.e.c = C;
21647 if(!m.length) { C += CS; continue; }
21649 if(opts.raw || !m.trim().length || _t == 's'){}
21650 else if(m === 'TRUE') o = {t:'b', v:true};
21651 else if(m === 'FALSE') o = {t:'b', v:false};
21652 else if(!isNaN(fuzzynum(m))) o = {t:'n', v:fuzzynum(m)};
21653 else if(!isNaN(fuzzydate(m).getDate())) {
21655 if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/);
21658 if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o; }
21664 if(merges.length) ws["!merges"] = merges;
21674 if(M[j].s.r > R || M[j].s.c > C) continue;
21675 if(M[j].e.r < R || M[j].e.c < C) continue;
21676 if(M[j].s.r < R || M[j].s.c < C) { RS = -1; break; }
21679 if(RS < 0) continue;
21685 if(RS > 1) sp.rowspan = RS;
21686 if(CS > 1) sp.colspan = CS;
21687 if(o.editable) w = '<span contenteditable="true">' + w + '</span>';
21688 else if(cell) {
21690 if(cell.v != null) sp["data-v"] = cell.v;
21691 if(cell.z != null) sp["data-z"] = cell.z;
21692if(cell.l && (cell.l.Target || "#").charAt(0) != "#") w = '<a href="' + cell.l.Target +'">' + w + …
21706 if(!mtch || mtch.length == 0) throw new Error("Invalid HTML: could not find <table>");
21707 if(mtch.length == 1) {
21738 if(!rows) {
21744 if(DENSE != null) opts.dense = DENSE;
21746 if(opts.origin != null) {
21747 if(typeof opts.origin == 'number') or_R = opts.origin;
21756 if(ws["!ref"]) {
21762 if(or_R == -1) range.e.r = or_R = _range.e.r + 1;
21767 if(!ws["!cols"]) ws['!cols'] = [];
21770 if (is_dom_element_hidden(row)) {
21771 if (opts.display) continue;
21777 if (opts.display && is_dom_element_hidden(elt)) continue;
21782if(m.s.c == C + or_C && m.s.r < R + or_R && R + or_R <= m.e.r) { C = m.e.c+1 - or_C; midx = -1; }
21786if( ((RS = (+elt.getAttribute("rowspan") || 1)))>1 || CS>1) merges.push({s:{r:R + or_R,c:C + or_C}…
21789 if(v != null) {
21790 if(v.length == 0) o.t = _t || 'z';
21791 else if(opts.raw || v.trim().length == 0 || _t == "s"){}
21792 else if(v === 'TRUE') o = {t:'b', v:true};
21793 else if(v === 'FALSE') o = {t:'b', v:false};
21794 else if(!isNaN(fuzzynum(v))) o = {t:'n', v:fuzzynum(v)};
21795 else if(!isNaN(fuzzydate(v).getDate())) {
21797 if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/);
21801 if(o.z === undefined && z != null) o.z = z;
21805if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAtt…
21806 l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
21808if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
21809 if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
21811 if(range.e.c < C + or_C) range.e.c = C + or_C;
21816 if(merges.length) ws['!merges'] = (ws["!merges"] || []).concat(merges);
21819if(R >= sheetRows) ws['!fullref'] = encode_range((range.e.r = rows.length-_R+R-1 + or_R,range)); /…
21838 if(get_computed_style) display = get_computed_style(element).getPropertyValue('display');
21839 if(!display) display = element.style && element.style.display;
21846if(element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle …
21848 if(typeof getComputedStyle === 'function') return getComputedStyle;
21881 if(Rn[1]==='/') {
21883 if(NFtag['truncate-on-overflow'] == "false") {
21884 if(NF.match(/h/)) NF = NF.replace(/h+/, "[$&]");
21885 else if(NF.match(/m/)) NF = NF.replace(/m+/, "[$&]");
21886 else if(NF.match(/s/)) NF = NF.replace(/s+/, "[$&]");
21890 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
21898 if(Rn[1]==='/') {
21902 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
21914 if(Rn[1]==='/') {
21917 if(payload == "%" && NFtag[0] == '<number:percentage-style') NF += "%";
21919 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
21971 if(y["textual"]) NF += "mm";
21986 if(y["decimal-places"]) NF += "." + fill("0", +y["decimal-places"]);
22008 if(Rn[1]==='/') {
22012 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
22025 if(!+y["min-integer-digits"]) NF += "#";
22030 if(+y["denominator-value"]) NF += y["denominator-value"];
22036 if(Rn[1]==='/') {
22038 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
22057if(unescapexml(y["condition"]) == "value()>=0") NF = number_format_map[y["apply-style-name"]] + ";…
22063 if(Rn[1]==='/') break;
22067 if(parsexmlbool(y["grouping"])) tNF = commaify(fill("#", Math.max(0, 4 - tNF.length)) + tNF);
22068 if(+y["min-decimal-places"] || +y["decimal-places"]) tNF += ".";
22069 if(+y["min-decimal-places"]) tNF += fill("0", +y["min-decimal-places"] || 1);
22070if(+y["decimal-places"] - (+y["min-decimal-places"]||0)) tNF += fill("0", +y["decimal-places"] - (…
22076 if(Rn[1]==='/') {
22077if(etpos == 0) NF += '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""')…
22079 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
22090 if(DENSE != null && opts.dense == null) opts.dense = DENSE;
22122 if(Rn[1]==='/') {
22123 if(range.e.c >= range.s.c && range.e.r >= range.s.r) ws['!ref'] = encode_range(range);
22125 if(opts.sheetRows > 0 && opts.sheetRows <= range.e.r) {
22130 if(merges.length) ws['!merges'] = merges;
22131 if(rowinfo.length) ws["!rows"] = rowinfo;
22133 if(typeof JSON !== 'undefined') JSON.stringify(sheetag);
22138 else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
22149 if(Rn[1] === "/") --row_ol; else ++row_ol;
22152 if(Rn[1] === '/') { R+=rowpeat; rowpeat = 1; break; }
22154 if(rowtag['行号']) R = rowtag['行号'] - 1; else if(R == -1) R = 0;
22157 if(rowpeat < 10) for(i = 0; i < rowpeat; ++i) if(row_ol > 0) rowinfo[R + i] = {level: row_ol};
22160 if(Rn[1] !== '/') ++C;
22161 if(opts.sheetStubs) {
22162 if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = {t:'z'}; }
22168 if(Rn[0].charAt(Rn[0].length-2) === '/') {
22173if(ctag.formula && opts.cellFormula != false) q.f = ods_to_csf_formula(unescapexml(ctag.formula));
22174 if(ctag["style-name"] && styles[ctag["style-name"]]) q.z = styles[ctag["style-name"]];
22175 if((ctag['数据类型'] || ctag['value-type']) == "string") {
22177 if(opts.dense) {
22178 if(!ws[R]) ws[R] = [];
22185 } else if(Rn[1]!=='/') {
22190 if(C > range.e.c) range.e.c = C;
22191 if(C < range.s.c) range.s.c = C;
22192 if(R < range.s.r) range.s.r = R;
22193 if(rptR > range.e.r) range.e.r = rptR;
22197 if(ctag["style-name"] && styles[ctag["style-name"]]) q.z = styles[ctag["style-name"]];
22198 if(opts.cellFormula) {
22199 if(ctag.formula) ctag.formula = unescapexml(ctag.formula);
22200 if(ctag['number-matrix-columns-spanned'] && ctag['number-matrix-rows-spanned']) {
22207 if(ctag.formula) q.f = ods_to_csf_formula(ctag.formula);
22209 if(R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r)
22210 if(C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c)
22213 if(ctag['number-columns-spanned'] || ctag['number-rows-spanned']) {
22221 if(ctag['number-columns-repeated']) colpeat = parseInt(ctag['number-columns-repeated'], 10);
22230 if(!opts.cellDates) { q.t = 'n'; q.v = datenum(q.v, WB.WBProps.date1904) - baddate; }
22231 if(!q.z) q.z = 'm/d/yy'; break;
22233 if(opts.cellDates) { q.t = 'd'; q.v = numdate(q.v); }
22234 if(!q.z) q.z = 'HH:MM:SS'; break;
22237 if(q.t === 'string' || q.t === 'text' || !q.t) {
22239 if(ctag['string-value'] != null) { textp = unescapexml(ctag['string-value']); textR = []; }
22244 if(q.t === 's') {
22246 if(textR.length) q.R = textR;
22249 if(atag.Target) q.l = atag;
22250 if(comments.length > 0) { q.c = comments; comments = []; }
22251 if(textp && opts.cellText !== false) q.w = textp;
22252 if(isstub) { q.t = "z"; delete q.v; }
22253 if(!isstub || opts.sheetStubs) {
22254 if(!(opts.sheetRows && opts.sheetRows <= R)) {
22257 if(opts.dense) {
22258 if(!ws[R + rpt]) ws[R + rpt] = [];
22265 if(range.e.c <= C) range.e.c = C;
22285 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;}
22286 else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
22290 if(Rn[1]==='/'){
22291 if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;
22293 if(textR.length) /*::(*/comment/*:: :any)*/.R = textR;
22297 else if(Rn[0].charAt(Rn[0].length-2) !== '/') {state.push([Rn[3], false]);}
22303 if(Rn[1]==='/') { creator = str.slice(creatoridx,Rn.index); }
22324 if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;}
22325 else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], false]);
22341 if(Rn[1]==='/'){
22345 } else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
22357if(styletag["family"] == "table-cell" && number_format_map[styletag["data-style-name"]]) styles[st…
22388 if(Rn[0].slice(-2) === "/>") break;
22389 else if(Rn[1]==="/") switch(state[state.length-1][0]) {
22403 if(intable) nrange.Sheet = SheetNames.length;
22445 if(['master-styles'].indexOf(state[state.length-1][0]) > -1) break;
22446 if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) {
22454 if(Rn[1]==='/') break;
22573 if(Rn[1]!== '/') {
22575 if(!atag.href) break;
22577 if(atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) {
22580 } else if(atag.Target.match(/^\.\.[\\\/]/)) atag.Target = atag.Target.slice(3);
22602 default: if(opts.WTF) throw new Error(Rn);
22610 if(opts.bookSheets) delete /*::(*/out/*:: :any)*/.Sheets;
22616if(safegetzipfile(zip, 'META-INF/manifest.xml')) parse_manifest(getzipdata(zip, 'META-INF/manifest…
22620 if(!content) throw new Error("Missing content.xml in ODS / UOF file");
22622 if(safegetzipfile(zip, 'meta.xml')) wb.Props = parse_core_props(getzipdata(zip, 'meta.xml'));
22665 // TODO: find out if anyone actually read the spec. LO has some wild errors
22672 if(nf.indexOf(";") > -1) {
22677 if(nf == "@") { type = "text"; payload = "<number:text-content/>"; break j; }
22680 if(nf.indexOf(/\$/) > -1) { type = "currency"; }
22683 if(nf[i] == '"') {
22686 if(nf[i+1] == "*") {
22697if(t) { payload += writextag("number:fraction", null, {"number:min-integer-digits":0, "number:min-…
22698if((t=nf.match(/# (\?+)\/(\d+)/))) { payload += writextag("number:fraction", null, {"number:min-in…
22701if((t=nf.match(/(\d+)(|\.\d+)%/))) { type = "percentage"; payload += writextag("number:number", nu…
22705 if(["y","m","d"].indexOf(nf[0]) > -1) {
22736 if(!has_time) break j;
22739 if(nf.match(/^\[?[hms]/)) {
22740 if(type == "number") type = "time";
22741 if(nf.match(/\[/)) {
22752 if(nf[i+1] == ".") do { c += nf[i+1]; ++i; } while(nf[i+1] == "0");
22762if(nf.slice(i, i+3).toLowerCase() == "a/p") { payload += '<number:am-pm/>'; i += 2; break; } // No…
22763 if(nf.slice(i, i+5).toLowerCase() == "am/pm") { payload += '<number:am-pm/>'; i += 4; break; }
22771 if(nf.indexOf(/\$/) > -1) { type = "currency"; }
22774if(nf[0] == "$") { payload += '<number:currency-symbol number:language="en" number:country="US">$<…
22775 i = 0; if(nf[i] == '"') {
22777 if(nf[i+1] == "*") {
22788 if(!np || !np[0]) console.error("Could not find numeric part of " + nf);
22804 if(nf[i] == '"') {
22811 if(!payload) { console.error("Could not generate ODS number format for |" + nf + "|"); return ""; }
22817 if(!scoped.length) return "";
22846 if(ws["!cols"]) {
22861 if(marr[mi].s.c > C) continue;
22862 if(marr[mi].s.r > R) continue;
22863 if(marr[mi].e.c < C) continue;
22864 if(marr[mi].e.r < R) continue;
22865 if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true;
22870 if(skip) { o.push(covered_cell_xml); continue; }
22872 if(cell && cell.f) {
22874 if(cell.F) {
22875 if(cell.F.slice(0, ref.length) == ref) {
22882 if(!cell) { o.push(null_cell_xml); continue; }
22908 if(cell.l && cell.l.Target) {
22912 if(_tgt.charAt(0) != "#" && !_tgt.match(/^\w+:/)) _tgt = '../' + _tgt;
22915 if(nfs[cell.z]) ct["table:style-name"] = "ce" + nfs[cell.z].slice(1);
22920 if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, i));
22931 if(!ws) return;
22932 if(ws["!cols"]) {
22933 for(var C = 0; C < ws["!cols"].length; ++C) if(ws["!cols"][C]) {
22935 if(colobj.width == null && colobj.wpx == null && colobj.wch == null) continue;
22950 if(!ws) return;
22951 if(ws["!rows"]) {
22952 for(var R = 0; R < ws["!rows"].length; ++R) if(ws["!rows"][R]) {
22980 if(!ws) return;
22984 if(!c || !c.z || c.z.toLowerCase() == "general") continue;
22985 if(!nfs[c.z]) {
22987 if(out) { nfs[c.z] = "N" + nfi; ++nfi; o.push(out + "\n"); }
23050 if(opts.bookType == "fods") {
23059if(((wb.Workbook||{}).WBProps||{}).date1904) o.push(' <table:calculation-settings table:case-…
23061 if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, -1));
23064 if(opts.bookType == "fods") o.push('</office:document>');
23071 if(opts.bookType == "fods") return write_content_ods(wb, opts);
23116 if (typeof Uint8Array == "undefined")
23118 if (typeof Uint8Array.prototype.subarray == "undefined")
23120 if (typeof Buffer !== "undefined") {
23121 if (typeof Buffer.prototype.subarray == "undefined")
23123if ((typeof Buffer.from == "function" ? Buffer.from([72, 62]) : new Buffer([72, 62])) instanceof U…
23143 if (L == -1)
23148 if (body[L + j] != search[j])
23191 if (buf[l++] >= 128) {
23193 if (buf[l++] < 128)
23196 if (buf[l++] < 128)
23199 if (buf[l++] < 128)
23203 if (buf[l++] < 128)
23207 if (buf[l++] < 128)
23211 if (buf[l++] < 128)
23214 if (ptr)
23223 if (v > 127) {
23227 if (v <= 16383)
23232 if (v <= 2097151)
23237 if (v <= 268435455)
23242 if (v <= 34359738367)
23247 if (v <= 4398046511103)
23270 if (buf[l++] >= 128) {
23272 if (buf[l++] < 128)
23275 if (buf[l++] < 128)
23278 if (buf[l++] < 128)
23287 if (buf[l++] >= 128) {
23289 if (buf[l++] < 128)
23292 if (buf[l++] < 128)
23295 if (buf[l++] < 128)
23299 if (buf[l++] < 128)
23302 if (buf[l++] < 128)
23305 if (buf[l++] < 128)
23308 if (buf[l++] < 128)
23311 if (buf[l++] < 128)
23326 if (num == 0)
23358 if (out[num] == null)
23368 if (idx == 0)
23371 if (!item.data)
23374 if (item.type == 2)
23406 if ((_a = ai[3]) == null ? void 0 : _a[0])
23420 if (ia.merge != null)
23438 if (type != 0)
23445 if (tag == 0) {
23447 if (len < 60)
23452 if (c > 1)
23454 if (c > 2)
23456 if (c > 3)
23467 if (tag == 1) {
23473 if (tag == 2) {
23481 if (offset == 0)
23488 if (j < 0) {
23489 if (off == 0)
23494 if (length < off)
23497 if (off > 0) {
23507 if (length)
23510 if (chunks.length > 100)
23514 if (chunks.reduce(function(acc, u8) {
23523 if (Array.isArray(buf))
23534 if (l !== buf.length)
23548 if (c <= 60) {
23551 } else if (c <= 256) {
23554 } else if (c <= 65536) {
23557 } else if (c <= 16777216) {
23560 } else if (c <= 4294967296) {
23582 if (flags & (ver > 4 ? 8 : 4) && cell.t == "n" && ctype == 7) {
23584 if (dstyle == -1)
23591 if (auto) {
23592 if (d == 0) {
23596 if (d >= 604800)
23598 else if (d >= 86400)
23600 else if (d >= 3600)
23602 else if (d >= 60)
23604 else if (d >= 1)
23608 if (Math.floor(d) != d)
23610 else if (d % 60)
23612 else if (d % 3600)
23614 else if (d % 86400)
23616 else if (d % 604800)
23618 if (dmax < dmin)
23621 if (dmin == -1 || dmax == -1)
23624 if (dmin == 1) {
23626 if (dmax == 1) {
23634 if (dmin <= 2 && dmax >= 2) {
23636 if (dmax > 2) {
23643 if (dmin <= 4 && dmax >= 4) {
23645 if (dmax > 4) {
23652 if (dmin <= 8 && dmax >= 8) {
23654 if (dmax > 8) {
23659 if (dstyle == 0)
23664 if (dmin <= 16 && dmax >= 16) {
23666 if (dmax > 16) {
23671 if (dstyle == 0)
23676 if (dmax >= 32) {
23678 if (dmin < 32)
23680 if (dstyle == 0)
23687 if (dstyle == 0)
23696 if (flags & 2) {
23701 if (flags & 512) {
23706 if (flags & 16) {
23710 if (flags & 32) {
23714 if (flags & 64) {
23718 if (v > 1) {
23720 if (flags & 255) {
23721 if (zidx == -1)
23751 if (ridx > -1)
23760 if (zidx > -1)
23762 if (t == 7)
23772 if (fields & 1) {
23776 if (fields & 2) {
23780 if (fields & 4) {
23784 if (fields & 8) {
23788 if (fields & 16) {
23825 if (fields & 516096) {
23826 if (zidx == -1)
23830 if (zidx > -1)
23832 if (t == 7)
23855 if (isst == -1)
23887 if (isst == -1)
23928 if (orefidx == -1) {
23947 if (!le[1])
23960 if (mtype != 2001)
23984 if (((_d = (_c = pb[7]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) && type != 0) {
23987 …} else if (((_j = (_i = pb[4]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) && type != 1)…
23997 if (off < 65535)
24000 if (offsets.length != cnt)
24005 if (offsets.length >= 1)
24013 if ((_a = pb == null ? void 0 : pb[7]) == null ? void 0 : _a[0]) {
24014 if (varint_to_i32(pb[7][0].data) >>> 0)
24025 if (!acc[x.R])
24028 if (acc[x.R][C])
24041 if (range.e.r < 0)
24044 if (range.e.c < 0)
24050 if ((_a = store[4]) == null ? void 0 : _a[0])
24052 if ((_b = store[11]) == null ? void 0 : _b[0])
24054 if ((_c = store[17]) == null ? void 0 : _c[0])
24056 if ((_d = store[22]) == null ? void 0 : _d[0])
24064 if (mtype2 != 6002)
24070 if (res) {
24071 if (dense) {
24072 if (!ws[_R + R])
24084 if ((_e = store[13]) == null ? void 0 : _e[0]) {
24087 if (mtype != 6144)
24105 if (!(opts == null ? void 0 : opts.dense))
24112 if (mtype != 6001)
24128 if (mtype == 6e3)
24138 if ((_a = pb[2]) == null ? void 0 : _a[0])
24144 if (mtype == 2) {
24152 if (out.SheetNames.length == 0)
24161 if (p.match(/\.iwpv2/))
24165 if (!s.name.match(/\.iwa$/))
24167 if (s.content[0] == 98)
24186 if (!indices.length)
24188if (((_c = (_b = (_a = M == null ? void 0 : M[1]) == null ? void 0 : _a[0].meta) == null ? void 0 …
24191 if (!docroot)
24195 if (mtype == 1) {
24196 if (!docroot)
24203 if (!docroot)
24224 if (!((_a = tri[6]) == null ? void 0 : _a[0]) || !((_b = tri[7]) == null ? void 0 : _b[0]))
24227 if (tri[7][0].data.length < 2 * data.length) {
24232 if (tri[4][0].data.length < 2 * data.length) {
24241 if (data[C] == null) {
24263 if (data[C] instanceof Date) {
24299 if (!dependents.last)
24302 if (!dependents[i]) {
24315 if (fi.type != 2)
24317 if (!fi.name.match(/\.iwa/))
24319 if (fi.name.match(/OperationStorage/))
24335 if (!fi.name.match(/\.iwa/))
24337 if (fi.name.match(/OperationStorage/))
24341 if (ia.messages.some(function(mess) {
24352 if (!opts || !opts.numbers)
24357 if (docroot == null)
24360 if (sheetrefs.length > 1)
24363 if (idx >= 1) {
24374 if (!entry)
24386 if (!entry)
24406 if (deps[1].location == deps[newsheetref].location)
24429 if (deps[drawables[0]].location == deps[newsheetref].location)
24440 if ((_a = mm[3]) == null ? void 0 : _a[0])
24442 if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc2)
24447 if (!parent[6])
24482 if (deps[tiaref].location == deps[tmaref].location)
24501 if (tma[45]) {
24507 if (tma[70]) {
24515 if (!hsea[8])
24548 if (!tma[n])
24558 if (!((_a2 = store[n]) == null ? void 0 : _a2[0]))
24567 if (deps[oldref].location == deps[tmaref].location)
24571 if (deps[newref].location == deps[oldref].location)
24598 if ((_a3 = mm[3]) == null ? void 0 : _a3[0])
24600 if (((_b2 = mm[2]) == null ? void 0 : _b2[0]) && u8str(mm[2][0].data) == loc)
24605 if (!parent[6])
24630 if (deps[oldref].location == deps[tmaref].location) {
24634 if (deps[newref].location == deps[oldref].location)
24661 if ((_a2 = mm[3]) == null ? void 0 : _a2[0])
24663 if (((_b2 = mm[2]) == null ? void 0 : _b2[0]) && u8str(mm[2][0].data) == loc)
24668 if (!parent[6])
24691 if (!remap[oldtileref]) {
24721 if ((_a2 = mm[3]) == null ? void 0 : _a2[0])
24723 if (((_b2 = mm[2]) == null ? void 0 : _b2[0]) && u8str(mm[2][0].data) == loc)
24728 if (!parent[6])
24772 if (range.e.c > 999) {
24776 if (range.e.r > 999999) {
24780 if (trunc)
24798 if ((_a = base_bucket == null ? void 0 : base_bucket[2]) == null ? void 0 : _a[0])
24843 if ((_a = mm[3]) == null ? void 0 : _a[0])
24845 if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc)
24850 if (!parent[6])
24917 if ((_a = mm[3]) == null ? void 0 : _a[0])
24919 if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc)
24924 if (!parent[6])
24947 if (ws["!merges"]) {
24978 if ((_a = mm[3]) == null ? void 0 : _a[0])
24980 if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc)
24985 if (!parent[6])
25006 if (i == 0)
25027 if(opts[d[0]] === undefined) opts[d[0]] = d[1];
25028 if(d[2] === 'n') opts[d[0]] = Number(opts[d[0]]);
25070 if(RELS.WS.indexOf(n) > -1) return "sheet";
25071 if(RELS.CS && n == RELS.CS) return "chart";
25072 if(RELS.DS && n == RELS.DS) return "dialog";
25073 if(RELS.MS && n == RELS.MS) return "macro";
25077 if(!wbrels) return 0;
25079 …wbrels = sheets.map(function pwbr(w) { if(!w.id) w.id = w.strRelID; return [w.name, wbrels['!id'][…
25092 if(!_ws || !_ws['!drawel']) break;
25108 if(sheetRels && sheetRels[sheet]) keys(sheetRels[sheet]).forEach(function(n) {
25110 if(sheetRels[sheet][n].Type == RELS.CMNT) {
25113 if(!comments || !comments.length) return;
25116 if(sheetRels[sheet][n].Type == RELS.TCMNT) {
25121 if(tcomments && tcomments.length) sheet_insert_comments(_ws, tcomments, true, opts.people || []);
25122 } catch(e) { if(opts.WTF) throw e; }
25133 if(safegetzipfile(zip, 'META-INF/manifest.xml')) return parse_ods(zip, opts);
25135 if(safegetzipfile(zip, 'objectdata.xml')) return parse_ods(zip, opts);
25137 if(safegetzipfile(zip, 'Index/Document.iwa')) {
25138if(typeof Uint8Array == "undefined") throw new Error('NUMBERS file parsing requires Uint8Array sup…
25139 if(typeof parse_numbers_iwa != "undefined") {
25140 if(zip.FileIndex) return parse_numbers_iwa(zip, opts);
25147 if(!safegetzipfile(zip, '[Content_Types].xml')) {
25148 if(safegetzipfile(zip, 'index.xml.gz')) throw new Error('Unsupported NUMBERS 08 file');
25149 if(safegetzipfile(zip, 'index.xml')) throw new Error('Unsupported NUMBERS 09 file');
25151 if(index_zip) {
25154 if(typeof index_zip.content == "string") opts.type = "binary";
25156if(typeof Bun !== "undefined" && Buffer.isBuffer(index_zip.content)) return readSync(new Uint8Arra…
25166 if(dir.workbooks.length === 0) {
25168 if(getzipdata(zip,binname, true)) dir.workbooks.push(binname);
25170 if(dir.workbooks.length === 0) {
25172 if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook");
25176 if(dir.workbooks[0].slice(-3) == "bin") xlsb = true;
25180 if(!opts.bookSheets && !opts.bookProps) {
25182if(dir.sst) try { strs=parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); } ca…
25184if(opts.cellStyles && dir.themes.length) themes = parse_theme_xml(getzipstr(zip, dir.themes[0].rep…
25186if(dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes,…
25200 if(dir.coreprops.length) {
25202 if(propdata) props = parse_core_props(propdata);
25203 if(dir.extprops.length !== 0) {
25205 if(propdata) parse_ext_props(propdata, props, opts);
25210 if(!opts.bookSheets || opts.bookProps) {
25211 if (dir.custprops.length !== 0) {
25213 if(propdata) custprops = parse_cust_props(propdata, opts);
25218 if(opts.bookSheets || opts.bookProps) {
25219 if(wb.Sheets) sheets = wb.Sheets.map(function pluck(x){ return x.name; });
25220 else if(props.Worksheets && props.SheetNames.length > 0) sheets=props.SheetNames;
25221 if(opts.bookProps) { out.Props = props; out.Custprops = custprops; }
25222 if(opts.bookSheets && typeof sheets !== 'undefined') out.SheetNames = sheets;
25223 if(opts.bookSheets ? out.SheetNames : opts.bookProps) return out;
25228if(opts.bookDeps && dir.calcchain) deps=parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain))…
25246 if(!safegetzipfile(zip, wbrelsfile)) wbrelsfile = 'xl/_rels/workbook.' + wbext + '.rels';
25249 if((dir.metadata || []).length >= 1) {
25254 if((dir.people || []).length >= 1) {
25258 if(wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets);
25264 if(wbrels && wbrels[i]) {
25266 if(!safegetzipfile(zip, path)) path = wbrels[i][1];
25267 if(!safegetzipfile(zip, path)) path = wbrelsfile.replace(/_rels\/.*$/,"") + wbrels[i][1];
25274 if(opts && opts.sheets != null) switch(typeof opts.sheets) {
25275 case "number": if(i != opts.sheets) continue wsloop; break;
25276 …case "string": if(props.SheetNames[i].toLowerCase() != opts.sheets.toLowerCase()) continue wsloop;…
25277 default: if(Array.isArray && Array.isArray(opts.sheets)) {
25280 if(typeof opts.sheets[snj] == "number" && opts.sheets[snj] == i) snjseen=1;
25281if(typeof opts.sheets[snj] == "string" && opts.sheets[snj].toLowerCase() == props.SheetNames[i].to…
25283 if(!snjseen) continue wsloop;
25302 if(opts && opts.bookFiles) {
25303 if(zip.files) {
25316 if(opts && opts.bookVBA) {
25317 if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
25318 …else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.b…
25331 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25336 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25338if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "St…
25343 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25345 if(seds.length != 1 || seds[0] != "StrongEncryptionTransform")
25350 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25355 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25360 …data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missi…
25364if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.c…
25367if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.c…
25372 if(wb && !wb.SSF) {
25375 if(wb && wb.SSF) {
25383 if(browser_has_Map) opts.revStrings = new Map();
25395 if(!wb.Props) wb.Props = {};
25402 /*::if(!wb.Props) throw "unreachable"; */
25404 if(wb.Props && wb.Props.SheetNames){/* empty */}
25405 else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames;
25409 if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]);
25417 if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) {
25438 if(ws) {
25442 if(comments && comments.length > 0) {
25449 if(ws['!legacy']) {
25450if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comm…
25456 if(wsrels['!id'].rId1) zip_add_file(zip, get_rels_path(f), write_rels(wsrels));
25459 if(opts.Strings != null && opts.Strings.length > 0) {
25486 if(wb.vbaraw && vbafmt) {
25507 if(wb && !wb.SSF) {
25510 if(wb && wb.SSF) {
25518 if(browser_has_Map) opts.revStrings = new Map();
25530 if(!wb.Props) wb.Props = {};
25537 /*::if(!wb.Props) throw "unreachable"; */
25539 if(wb.Props && wb.Props.SheetNames){/* empty */}
25540 else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames;
25544 if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]);
25552 if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) {
25576 if(ws) {
25580 if(comments && comments.length > 0) {
25583 carr[1].forEach(function(c) { if(c.T == true) needtc = true; });
25585 if(needtc) {
25598 if(ws['!legacy']) {
25599if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comm…
25605 if(wsrels['!id'].rId1) zip_add_file(zip, get_rels_path(f), write_rels(wsrels));
25608 if(opts.Strings != null && opts.Strings.length > 0) {
25634 if(wb.vbaraw && vbafmt) {
25646 if(people.length > 1) {
25674 if(CFB.find(cfb, "EncryptedPackage")) return parse_xlsxcfb(cfb, opts);
25681 if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
25705 if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str);
25712 if(o.type == 'base64') d = Base64_decode(d);
25723 if(str) { o.type = "string"; return PRN.to_workbook(data, o); }
25730if(o.codepage && typeof $cptable === "undefined") console.error("Codepage tables are not loaded. …
25731if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Arr…
25732if(typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && !o.type) o.type = typeof Den…
25734 if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
25736 if(o.dateNF) _ssfopts.dateNF = o.dateNF;
25737 if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
25738if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); if(typeof Ui…
25739 if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); }
25740if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof …
25744 if(!vu.foo) {o=dup(o); o.type='array'; return readSync(ab2a(d), o);}
25747 …case 0xD0: if(n[1] === 0xCF && n[2] === 0x11 && n[3] === 0xE0 && n[4] === 0xA1 && n[5] === 0xB1 &&…
25748 case 0x09: if(n[1] <= 0x08) return parse_xlscfb(d, o); break;
25751if(n[1] === 0x49 && n[2] === 0x2a && n[3] === 0x00) throw new Error("TIFF Image File is not a spre…
25752 if(n[1] === 0x44) return read_wb_ID(d, o);
25754 …case 0x54: if(n[1] === 0x41 && n[2] === 0x42 && n[3] === 0x4C) return DIF.to_workbook(d, o); break;
25758 if(n[1] === 0xFE) { return read_utf16(d, o); }
25759 else if(n[1] === 0x00 && n[2] === 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o);
25762 if(n[1] === 0x00) {
25763 if(n[2] >= 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o);
25764 if(n[2] === 0x00 && (n[3] === 0x08 || n[3] === 0x09)) return WK_.to_workbook(d, o);
25768 …case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return rtf_to_workbook(d, o); break;
25770 …case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is …
25771 case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
25773 if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
25774 if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
25777if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d…
25819 if(o.compression) oopts.compression = 'DEFLATE';
25820 if(o.password) oopts.type = ftype;
25830 if(typeof Deno !== "undefined") {
25831 if(typeof out == "string") {
25832 if(o.type == "binary" || o.type == "base64") return out;
25837if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.p…
25839 if(o.type === "file") return write_dl(o.file, out);
25850 if(!bom) bom = "";
25858 if(has_buf) return Buffer_from(o, 'utf8');
25859 else if(typeof TextEncoder !== "undefined") return new TextEncoder().encode(o);
25873 if(has_buf) return Buffer_from(out, 'binary');
25900 if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
25901if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSyncXLSX(wb, o)/*:any*/); o.…
25909 if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
25910if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type…
25912 if(o.sheet) {
25913 if(typeof o.sheet == "number") idx = o.sheet;
25915 if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet));
25934 case 'biff2': if(!o.biff) o.biff = 2; /* falls through */
25935 case 'biff3': if(!o.biff) o.biff = 3; /* falls through */
25936 case 'biff4': if(!o.biff) o.biff = 4; return write_binary_type(write_biff_buf(wb, o), o);
25937 case 'biff5': if(!o.biff) o.biff = 5; /* falls through */
25940 case 'xls': if(!o.biff) o.biff = 8; return write_cfb_type(wb, o);
25952 if(o.bookType) return;
25961 if(ext.match(/^\.[a-z]+$/)) o.bookType = ext.slice(1);
25985 var _cb = cb; if(!(_cb instanceof Function)) _cb = (opts/*:any*/);
25999 if(header !== 1) {
26000if(Object.defineProperty) try { Object.defineProperty(row, '__rowNum__', {value:R, enumerable:fals…
26003 if(!dense || sheet[R]) for (var C = r.s.c; C <= r.e.c; ++C) {
26005 if(val === undefined || val.t === undefined) {
26006 if(defval === undefined) continue;
26007 if(hdr[C] != null) { row[hdr[C]] = defval; }
26012 case 'z': if(v == null) break; continue;
26017 if(hdr[C] != null) {
26018 if(v == null) {
26019 if(val.t == "e" && v === null) row[hdr[C]] = null;
26020 else if(defval !== undefined) row[hdr[C]] = defval;
26021 else if(raw && v === null) row[hdr[C]] = null;
26026 if(v != null) isempty = false;
26034 if(sheet == null || sheet["!ref"] == null) return [];
26039 if(o.header === 1) header = 1;
26040 else if(o.header === "A") header = 2;
26041 else if(Array.isArray(o.header)) header = 3;
26042 else if(o.header == null) header = 0;
26048 if(header > 0) offset = 0;
26056 if(dense && !sheet[R]) sheet[R] = [];
26060 if(((colinfo[C]||{}).hidden)) continue;
26068 if(val == null) val = {w: "__EMPTY", t: "s"};
26071 if(!counter) header_cnt[v] = 1;
26080 if ((rowinfo[R]||{}).hidden) continue;
26082if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) out[outi++] …
26093 if (!cols[C]) continue;
26095 if(val == null) txt = "";
26096 else if(val.v != null) {
26099 …for(var i = 0, cc = 0; i !== txt.length; ++i) if((cc = txt.charCodeAt(i)) === fs || cc === rs || c…
26100 if(txt == "ID") txt = '"ID"';
26101 } else if(val.f != null && !val.F) {
26103 txt = '=' + val.f; if(txt.indexOf(",") >= 0) txt = '"' + txt.replace(qreg, '""') + '"';
26108 if(o.blankrows === false && isempty) return null;
26115 if(sheet == null || sheet["!ref"] == null) return "";
26124 for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C);
26127 if ((rowinfo[R]||{}).hidden) continue;
26129 if(row == null) { continue; }
26130 if(o.strip) row = row.replace(endregex,"");
26131 if(row || (o.blankrows !== false)) out.push((w++ ? RS : "") + row);
26138 if(!opts) opts = {}; opts.FS = "\t"; opts.RS = "\n";
26140 if(typeof $cptable == 'undefined' || opts.type == 'string') return s;
26147 if(sheet == null || sheet["!ref"] == null) return [];
26158 if(x === undefined) continue;
26159 else if(x.F != null) {
26161 if(!x.f) continue;
26163 if(y.indexOf(":") == -1) y = y + ":" + y;
26165 if(x.f != null) val = x.f;
26166 else if(x.t == 'z') continue;
26167 else if(x.t == 'n' && x.v != null) val = "" + x.v;
26168 else if(x.t == 'b') val = x.v ? "TRUE" : "FALSE";
26169 else if(x.w !== undefined) val = "'" + x.w;
26170 else if(x.v === undefined) continue;
26171 else if(x.t == 's') val = "'" + x.v;
26182 if(DENSE != null && dense == null) dense = DENSE;
26186 if(ws && o.origin != null) {
26187 if(typeof o.origin == 'number') _R = o.origin;
26194 if(ws['!ref']) {
26198 if(_R == -1) { _R = _range.e.r + 1; range.e.r = _R + js.length - 1 + offset; }
26200 if(_R == -1) { _R = 0; range.e.r = js.length - 1 + offset; }
26205 if(dense && !ws[_R + R + offset]) ws[_R + R + offset] = [];
26206 if(dense) ROW = ws[_R + R + offset];
26208 if((C=hdr.indexOf(k)) == -1) hdr[C=hdr.length] = k;
26214 if(v && typeof v === 'object' && !(v instanceof Date)){
26217 if(typeof v == 'number') t = 'n';
26218 else if(typeof v == 'boolean') t = 'b';
26219 else if(typeof v == 'string') t = 's';
26220 else if(v instanceof Date) {
26222 if(!o.cellDates) { t = 'n'; v = datenum(v); }
26225 else if(v === null && o.nullError) { t = 'e'; v = 0; }
26226 if(!cell) {
26227 if(!dense) ws[ref] = cell = ({t:t, v:v}/*:any*/);
26232 if(z) cell.z = z;
26234 if(z) cell.z = z;
26240 if(dense && !ws[_R]) ws[_R] = [];
26241 if(offset) for(C = 0; C < hdr.length; ++C) {
26242 if(dense) ws[_R][C + _C] = {t:'s', v:hdr[C]};
26250 /* get cell, creating a stub if necessary */
26253 if(typeof R == "string") {
26255 if(Array.isArray(ws)) {
26257 if(!ws[RC.r]) ws[RC.r] = [];
26263 if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R));
26270 if(typeof sh == "number") {
26271 if(sh >= 0 && wb.SheetNames.length > sh) return sh;
26273 } else if(typeof sh == "string") {
26275 if(idx > -1) return idx;
26288if(!name) for(; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) =…
26289 if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets");
26290 if(roll && wb.SheetNames.indexOf(name) >= 0) {
26294 for(++i; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = root + i) == -1) break;
26297if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already e…
26306 if(!wb.Workbook) wb.Workbook = {};
26307 if(!wb.Workbook.Sheets) wb.Workbook.Sheets = [];
26311 if(!wb.Workbook.Sheets[idx]) wb.Workbook.Sheets[idx] = {};
26329 if(!target) {
26333 if(tooltip) cell.l.Tooltip = tooltip;
26341 if(!cell.c) cell.c = [];
26354 if(R == rng.s.r && C == rng.s.c) {
26356 if(dynamic) cell.D = true;
26360 if(wsr.s.r > rng.s.r) wsr.s.r = rng.s.r;
26361 if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c;
26362 if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r;
26363 if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c;
26414 if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; }
26423 for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C);
26427 if(!BOM) { BOM = true; return stream.push("\uFEFF"); }
26430 if ((rowinfo[R-1]||{}).hidden) continue;
26432 if(row != null) {
26433 if(o.strip) row = row.replace(endregex,"");
26434 if(row || (o.blankrows !== false)) return stream.push((w++ ? RS : "") + row);
26455 if(R > r.e.r) {
26456 if(!end) { end = true; stream.push("</table>" + footer); }
26471 if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; }
26476 if(o.header === 1) header = 1;
26477 else if(o.header === "A") header = 2;
26478 else if(Array.isArray(o.header)) header = 3;
26484 if(header > 0) offset = 0;
26491 if(dense && !sheet[R]) sheet[R] = [];
26495 if(((colinfo[C]||{}).hidden)) continue;
26503 if(val == null) val = {w: "__EMPTY", t: "s"};
26506 if(!counter) header_cnt[v] = 1;
26517 if ((rowinfo[R-1]||{}).hidden) continue;
26520 if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) {