UNPKG

@caspingus/lt

Version:

A utility library of helpers and extensions useful when working with Learnosity APIs.

1,355 lines 1.34 MB
import { c as createExtension, L as LT } from "../../extensionsFactory-BHOEyOSK.js"; import { s as setObserver } from "../../dom-WlatGxUZ.js"; import { a as getDefaultExportFromCjs } from "../../_commonjsHelpers-DQNKXVTB.js"; import { d as debounce } from "../../debounce-CqEeJcMa.js"; /*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ var XLSX = {}; XLSX.version = "0.20.3"; var current_codepage = 1200, current_ansi = 1252, $cptable, VALID_ANSI = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4], CS2CP = { 0: 1252, /* ANSI */ 1: 65001, /* DEFAULT */ 2: 65001, /* SYMBOL */ 77: 1e4, /* MAC */ 128: 932, /* SHIFTJIS */ 129: 949, /* HANGUL */ 130: 1361, /* JOHAB */ 134: 936, /* GB2312 */ 136: 950, /* CHINESEBIG5 */ 161: 1253, /* GREEK */ 162: 1254, /* TURKISH */ 163: 1258, /* VIETNAMESE */ 177: 1255, /* HEBREW */ 178: 1256, /* ARABIC */ 186: 1257, /* BALTIC */ 204: 1251, /* RUSSIAN */ 222: 874, /* THAI */ 238: 1250, /* EASTEUROPE */ 255: 1252, /* OEM */ 69: 6969 /* MISC */ }, set_ansi = function(F) { VALID_ANSI.indexOf(F) != -1 && (current_ansi = CS2CP[0] = F); }; function reset_ansi() { set_ansi(1252); } var set_cp = function(F) { current_codepage = F, set_ansi(F); }; function reset_cp() { set_cp(1200), reset_ansi(); } function char_codes(F) { for (var x = [], w = 0, O = F.length; w < O; ++w) x[w] = F.charCodeAt(w); return x; } function utf16leread(F) { for (var x = [], w = 0; w < F.length >> 1; ++w) x[w] = String.fromCharCode(F.charCodeAt(2 * w) + (F.charCodeAt(2 * w + 1) << 8)); return x.join(""); } function utf16lereadu(F) { for (var x = [], w = 0; w < F.length >> 1; ++w) x[w] = String.fromCharCode(F[2 * w] + (F[2 * w + 1] << 8)); return x.join(""); } function utf16beread(F) { for (var x = [], w = 0; w < F.length >> 1; ++w) x[w] = String.fromCharCode(F.charCodeAt(2 * w + 1) + (F.charCodeAt(2 * w) << 8)); return x.join(""); } var debom = function(F) { var x = F.charCodeAt(0), w = F.charCodeAt(1); return x == 255 && w == 254 ? utf16leread(F.slice(2)) : x == 254 && w == 255 ? utf16beread(F.slice(2)) : x == 65279 ? F.slice(1) : F; }, _getchar = function(x) { return String.fromCharCode(x); }, _getansi = function(x) { return String.fromCharCode(x); }; function set_cptable(F) { $cptable = F, set_cp = function(x) { current_codepage = x, set_ansi(x); }, debom = function(x) { return x.charCodeAt(0) === 255 && x.charCodeAt(1) === 254 ? $cptable.utils.decode(1200, char_codes(x.slice(2))) : x; }, _getchar = function(w) { return current_codepage === 1200 ? String.fromCharCode(w) : $cptable.utils.decode(current_codepage, [w & 255, w >> 8])[0]; }, _getansi = function(w) { return $cptable.utils.decode(current_ansi, [w])[0]; }, cpdoit(); } var DENSE = null, Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function Base64_encode(F) { for (var x = "", w = 0, O = 0, D = 0, U = 0, W = 0, X = 0, G = 0, Y = 0; Y < F.length; ) w = F.charCodeAt(Y++), U = w >> 2, O = F.charCodeAt(Y++), W = (w & 3) << 4 | O >> 4, D = F.charCodeAt(Y++), X = (O & 15) << 2 | D >> 6, G = D & 63, isNaN(O) ? X = G = 64 : isNaN(D) && (G = 64), x += Base64_map.charAt(U) + Base64_map.charAt(W) + Base64_map.charAt(X) + Base64_map.charAt(G); return x; } function Base64_encode_pass(F) { for (var x = "", w = 0, O = 0, D = 0, U = 0, W = 0, X = 0, G = 0, Y = 0; Y < F.length; ) w = F.charCodeAt(Y++), w > 255 && (w = 95), U = w >> 2, O = F.charCodeAt(Y++), O > 255 && (O = 95), W = (w & 3) << 4 | O >> 4, D = F.charCodeAt(Y++), D > 255 && (D = 95), X = (O & 15) << 2 | D >> 6, G = D & 63, isNaN(O) ? X = G = 64 : isNaN(D) && (G = 64), x += Base64_map.charAt(U) + Base64_map.charAt(W) + Base64_map.charAt(X) + Base64_map.charAt(G); return x; } function Base64_encode_arr(F) { for (var x = "", w = 0, O = 0, D = 0, U = 0, W = 0, X = 0, G = 0, Y = 0; Y < F.length; ) w = F[Y++], U = w >> 2, O = F[Y++], W = (w & 3) << 4 | O >> 4, D = F[Y++], X = (O & 15) << 2 | D >> 6, G = D & 63, isNaN(O) ? X = G = 64 : isNaN(D) && (G = 64), x += Base64_map.charAt(U) + Base64_map.charAt(W) + Base64_map.charAt(X) + Base64_map.charAt(G); return x; } function Base64_decode(F) { var x = "", w = 0, O = 0, D = 0, U = 0, W = 0, X = 0, G = 0; if (F.slice(0, 5) == "data:") { var Y = F.slice(0, 1024).indexOf(";base64,"); Y > -1 && (F = F.slice(Y + 8)); } F = F.replace(/[^\w\+\/\=]/g, ""); for (var Y = 0; Y < F.length; ) U = Base64_map.indexOf(F.charAt(Y++)), W = Base64_map.indexOf(F.charAt(Y++)), w = U << 2 | W >> 4, x += String.fromCharCode(w), X = Base64_map.indexOf(F.charAt(Y++)), O = (W & 15) << 4 | X >> 2, X !== 64 && (x += String.fromCharCode(O)), G = Base64_map.indexOf(F.charAt(Y++)), D = (X & 3) << 6 | G, G !== 64 && (x += String.fromCharCode(D)); return x; } var has_buf = /* @__PURE__ */ function() { return typeof Buffer < "u" && typeof process < "u" && typeof process.versions < "u" && !!process.versions.node; }(), Buffer_from = /* @__PURE__ */ function() { if (typeof Buffer < "u") { var F = !Buffer.from; if (!F) try { Buffer.from("foo", "utf8"); } catch { F = !0; } return F ? function(x, w) { return w ? new Buffer(x, w) : new Buffer(x); } : Buffer.from.bind(Buffer); } return function() { }; }(), buf_utf16le = /* @__PURE__ */ function() { if (typeof Buffer > "u") return !1; var F = Buffer_from([65, 0]); if (!F) return !1; var x = F.toString("utf16le"); return x.length == 1; }(); function new_raw_buf(F) { return has_buf ? Buffer.alloc ? Buffer.alloc(F) : new Buffer(F) : typeof Uint8Array < "u" ? new Uint8Array(F) : new Array(F); } function new_unsafe_buf(F) { return has_buf ? Buffer.allocUnsafe ? Buffer.allocUnsafe(F) : new Buffer(F) : typeof Uint8Array < "u" ? new Uint8Array(F) : new Array(F); } var s2a = function(x) { return has_buf ? Buffer_from(x, "binary") : x.split("").map(function(w) { return w.charCodeAt(0) & 255; }); }; function s2ab(F) { if (typeof ArrayBuffer > "u") return s2a(F); for (var x = new ArrayBuffer(F.length), w = new Uint8Array(x), O = 0; O != F.length; ++O) w[O] = F.charCodeAt(O) & 255; return x; } function a2s(F) { if (Array.isArray(F)) return F.map(function(O) { return String.fromCharCode(O); }).join(""); for (var x = [], w = 0; w < F.length; ++w) x[w] = String.fromCharCode(F[w]); return x.join(""); } function a2u(F) { if (typeof Uint8Array > "u") throw new Error("Unsupported"); return new Uint8Array(F); } function ab2a(F) { if (typeof ArrayBuffer > "u") throw new Error("Unsupported"); if (F instanceof ArrayBuffer) return ab2a(new Uint8Array(F)); for (var x = new Array(F.length), w = 0; w < F.length; ++w) x[w] = F[w]; return x; } var bconcat = has_buf ? function(F) { return Buffer.concat(F.map(function(x) { return Buffer.isBuffer(x) ? x : Buffer_from(x); })); } : function(F) { if (typeof Uint8Array < "u") { var x = 0, w = 0; for (x = 0; x < F.length; ++x) w += F[x].length; var O = new Uint8Array(w), D = 0; for (x = 0, w = 0; x < F.length; w += D, ++x) D = F[x].length, F[x] instanceof Uint8Array ? O.set(F[x], w) : typeof F[x] == "string" ? O.set(new Uint8Array(s2a(F[x])), w) : O.set(new Uint8Array(F[x]), w); return O; } return [].concat.apply([], F.map(function(U) { return Array.isArray(U) ? U : [].slice.call(U); })); }; function utf8decode(F) { for (var x = [], w = 0, O = F.length + 250, D = new_raw_buf(F.length + 255), U = 0; U < F.length; ++U) { var W = F.charCodeAt(U); if (W < 128) D[w++] = W; else if (W < 2048) D[w++] = 192 | W >> 6 & 31, D[w++] = 128 | W & 63; else if (W >= 55296 && W < 57344) { W = (W & 1023) + 64; var X = F.charCodeAt(++U) & 1023; D[w++] = 240 | W >> 8 & 7, D[w++] = 128 | W >> 2 & 63, D[w++] = 128 | X >> 6 & 15 | (W & 3) << 4, D[w++] = 128 | X & 63; } else D[w++] = 224 | W >> 12 & 15, D[w++] = 128 | W >> 6 & 63, D[w++] = 128 | W & 63; w > O && (x.push(D.slice(0, w)), w = 0, D = new_raw_buf(65535), O = 65530); } return x.push(D.slice(0, w)), bconcat(x); } var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g; function _strrev(F) { for (var x = "", w = F.length - 1; w >= 0; ) x += F.charAt(w--); return x; } function pad0(F, x) { var w = "" + F; return w.length >= x ? w : fill("0", x - w.length) + w; } function pad_(F, x) { var w = "" + F; return w.length >= x ? w : fill(" ", x - w.length) + w; } function rpad_(F, x) { var w = "" + F; return w.length >= x ? w : w + fill(" ", x - w.length); } function pad0r1(F, x) { var w = "" + Math.round(F); return w.length >= x ? w : fill("0", x - w.length) + w; } function pad0r2(F, x) { var w = "" + F; return w.length >= x ? w : fill("0", x - w.length) + w; } var p2_32 = /* @__PURE__ */ Math.pow(2, 32); function pad0r(F, x) { if (F > p2_32 || F < -p2_32) return pad0r1(F, x); var w = Math.round(F); return pad0r2(w, x); } function SSF_isgeneral(F, x) { return x = x || 0, F.length >= 7 + x && (F.charCodeAt(x) | 32) === 103 && (F.charCodeAt(x + 1) | 32) === 101 && (F.charCodeAt(x + 2) | 32) === 110 && (F.charCodeAt(x + 3) | 32) === 101 && (F.charCodeAt(x + 4) | 32) === 114 && (F.charCodeAt(x + 5) | 32) === 97 && (F.charCodeAt(x + 6) | 32) === 108; } var days = [ ["Sun", "Sunday"], ["Mon", "Monday"], ["Tue", "Tuesday"], ["Wed", "Wednesday"], ["Thu", "Thursday"], ["Fri", "Friday"], ["Sat", "Saturday"] ], months = [ ["J", "Jan", "January"], ["F", "Feb", "February"], ["M", "Mar", "March"], ["A", "Apr", "April"], ["M", "May", "May"], ["J", "Jun", "June"], ["J", "Jul", "July"], ["A", "Aug", "August"], ["S", "Sep", "September"], ["O", "Oct", "October"], ["N", "Nov", "November"], ["D", "Dec", "December"] ]; function SSF_init_table(F) { return F || (F = {}), F[0] = "General", F[1] = "0", F[2] = "0.00", F[3] = "#,##0", F[4] = "#,##0.00", F[9] = "0%", F[10] = "0.00%", F[11] = "0.00E+00", F[12] = "# ?/?", F[13] = "# ??/??", F[14] = "m/d/yy", F[15] = "d-mmm-yy", F[16] = "d-mmm", F[17] = "mmm-yy", F[18] = "h:mm AM/PM", F[19] = "h:mm:ss AM/PM", F[20] = "h:mm", F[21] = "h:mm:ss", F[22] = "m/d/yy h:mm", F[37] = "#,##0 ;(#,##0)", F[38] = "#,##0 ;[Red](#,##0)", F[39] = "#,##0.00;(#,##0.00)", F[40] = "#,##0.00;[Red](#,##0.00)", F[45] = "mm:ss", F[46] = "[h]:mm:ss", F[47] = "mmss.0", F[48] = "##0.0E+0", F[49] = "@", F[56] = '"上午/下午 "hh"時"mm"分"ss"秒 "', F; } var table_fmt = { 0: "General", 1: "0", 2: "0.00", 3: "#,##0", 4: "#,##0.00", 9: "0%", 10: "0.00%", 11: "0.00E+00", 12: "# ?/?", 13: "# ??/??", 14: "m/d/yy", 15: "d-mmm-yy", 16: "d-mmm", 17: "mmm-yy", 18: "h:mm AM/PM", 19: "h:mm:ss AM/PM", 20: "h:mm", 21: "h:mm:ss", 22: "m/d/yy h:mm", 37: "#,##0 ;(#,##0)", 38: "#,##0 ;[Red](#,##0)", 39: "#,##0.00;(#,##0.00)", 40: "#,##0.00;[Red](#,##0.00)", 45: "mm:ss", 46: "[h]:mm:ss", 47: "mmss.0", 48: "##0.0E+0", 49: "@", 56: '"上午/下午 "hh"時"mm"分"ss"秒 "' }, SSF_default_map = { 5: 37, 6: 38, 7: 39, 8: 40, // 5 -> 37 ... 8 -> 40 23: 0, 24: 0, 25: 0, 26: 0, // 23 -> 0 ... 26 -> 0 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, // 27 -> 14 ... 31 -> 14 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, // 50 -> 14 ... 58 -> 14 55: 14, 56: 14, 57: 14, 58: 14, 59: 1, 60: 2, 61: 3, 62: 4, // 59 -> 1 ... 62 -> 4 67: 9, 68: 10, // 67 -> 9 ... 68 -> 10 69: 12, 70: 13, 71: 14, // 69 -> 12 ... 71 -> 14 72: 14, 73: 15, 74: 16, 75: 17, // 72 -> 14 ... 75 -> 17 76: 20, 77: 21, 78: 22, // 76 -> 20 ... 78 -> 22 79: 45, 80: 46, 81: 47, // 79 -> 45 ... 81 -> 47 82: 0 // 82 -> 0 ... 65536 -> 0 (omitted) }, SSF_default_str = { // 5 -- Currency, 0 decimal, black negative 5: '"$"#,##0_);\\("$"#,##0\\)', 63: '"$"#,##0_);\\("$"#,##0\\)', // 6 -- Currency, 0 decimal, red negative 6: '"$"#,##0_);[Red]\\("$"#,##0\\)', 64: '"$"#,##0_);[Red]\\("$"#,##0\\)', // 7 -- Currency, 2 decimal, black negative 7: '"$"#,##0.00_);\\("$"#,##0.00\\)', 65: '"$"#,##0.00_);\\("$"#,##0.00\\)', // 8 -- Currency, 2 decimal, red negative 8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', // 41 -- Accounting, 0 decimal, No Symbol 41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', // 42 -- Accounting, 0 decimal, $ Symbol 42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', // 43 -- Accounting, 2 decimal, No Symbol 43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', // 44 -- Accounting, 2 decimal, $ Symbol 44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)' }; function SSF_frac(F, x, w) { for (var O = F < 0 ? -1 : 1, D = F * O, U = 0, W = 1, X = 0, G = 1, Y = 0, K = 0, Z = Math.floor(D); Y < x && (Z = Math.floor(D), X = Z * W + U, K = Z * Y + G, !(D - Z < 5e-8)); ) D = 1 / (D - Z), U = W, W = X, G = Y, Y = K; if (K > x && (Y > x ? (K = G, X = U) : (K = Y, X = W)), !w) return [0, O * X, K]; var q = Math.floor(O * X / K); return [q, O * X - q * K, K]; } function SSF_normalize_xl_unsafe(F) { var x = F.toPrecision(16); if (x.indexOf("e") > -1) { var w = x.slice(0, x.indexOf("e")); return w = w.indexOf(".") > -1 ? w.slice(0, w.slice(0, 2) == "0." ? 17 : 16) : w.slice(0, 15) + fill("0", w.length - 15), w + x.slice(x.indexOf("e")); } var O = x.indexOf(".") > -1 ? x.slice(0, x.slice(0, 2) == "0." ? 17 : 16) : x.slice(0, 15) + fill("0", x.length - 15); return Number(O); } function SSF_parse_date_code(F, x, w) { if (F > 2958465 || F < 0) return null; F = SSF_normalize_xl_unsafe(F); var O = F | 0, D = Math.floor(86400 * (F - O)), U = 0, W = [], X = { D: O, T: D, u: 86400 * (F - O) - D, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 }; if (Math.abs(X.u) < 1e-6 && (X.u = 0), x && x.date1904 && (O += 1462), X.u > 0.9999 && (X.u = 0, ++D == 86400 && (X.T = D = 0, ++O, ++X.D)), O === 60) W = w ? [1317, 10, 29] : [1900, 2, 29], U = 3; else if (O === 0) W = w ? [1317, 8, 29] : [1900, 1, 0], U = 6; else { O > 60 && --O; var G = new Date(1900, 0, 1); G.setDate(G.getDate() + O - 1), W = [G.getFullYear(), G.getMonth() + 1, G.getDate()], U = G.getDay(), O < 60 && (U = (U + 6) % 7), w && (U = SSF_fix_hijri(G, W)); } return X.y = W[0], X.m = W[1], X.d = W[2], X.S = D % 60, D = Math.floor(D / 60), X.M = D % 60, D = Math.floor(D / 60), X.H = D, X.q = U, X; } function SSF_strip_decimal(F) { return F.indexOf(".") == -1 ? F : F.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1"); } function SSF_normalize_exp(F) { return F.indexOf("E") == -1 ? F : F.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2"); } function SSF_small_exp(F) { var x = F < 0 ? 12 : 11, w = SSF_strip_decimal(F.toFixed(12)); return w.length <= x || (w = F.toPrecision(10), w.length <= x) ? w : F.toExponential(5); } function SSF_large_exp(F) { var x = SSF_strip_decimal(F.toFixed(11)); return x.length > (F < 0 ? 12 : 11) || x === "0" || x === "-0" ? F.toPrecision(6) : x; } function SSF_general_num(F) { if (!isFinite(F)) return isNaN(F) ? "#NUM!" : "#DIV/0!"; var x = Math.floor(Math.log(Math.abs(F)) * Math.LOG10E), w; return x >= -4 && x <= -1 ? w = F.toPrecision(10 + x) : Math.abs(x) <= 9 ? w = SSF_small_exp(F) : x === 10 ? w = F.toFixed(10).substr(0, 12) : w = SSF_large_exp(F), SSF_strip_decimal(SSF_normalize_exp(w.toUpperCase())); } function SSF_general(F, x) { switch (typeof F) { case "string": return F; case "boolean": return F ? "TRUE" : "FALSE"; case "number": return (F | 0) === F ? F.toString(10) : SSF_general_num(F); case "undefined": return ""; case "object": if (F == null) return ""; if (F instanceof Date) return SSF_format(14, datenum(F, x && x.date1904), x); } throw new Error("unsupported value in General format: " + F); } function SSF_fix_hijri(F, x) { x[0] -= 581; var w = F.getDay(); return F < 60 && (w = (w + 6) % 7), w; } function SSF_write_date(F, x, w, O) { var D = "", U = 0, W = 0, X = w.y, G, Y = 0; switch (F) { case 98: X = w.y + 543; /* falls through */ case 121: switch (x.length) { case 1: case 2: G = X % 100, Y = 2; break; default: G = X % 1e4, Y = 4; break; } break; case 109: switch (x.length) { case 1: case 2: G = w.m, Y = x.length; break; case 3: return months[w.m - 1][1]; case 5: return months[w.m - 1][0]; default: return months[w.m - 1][2]; } break; case 100: switch (x.length) { case 1: case 2: G = w.d, Y = x.length; break; case 3: return days[w.q][0]; default: return days[w.q][1]; } break; case 104: switch (x.length) { case 1: case 2: G = 1 + (w.H + 11) % 12, Y = x.length; break; default: throw "bad hour format: " + x; } break; case 72: switch (x.length) { case 1: case 2: G = w.H, Y = x.length; break; default: throw "bad hour format: " + x; } break; case 77: switch (x.length) { case 1: case 2: G = w.M, Y = x.length; break; default: throw "bad minute format: " + x; } break; case 115: if (x != "s" && x != "ss" && x != ".0" && x != ".00" && x != ".000") throw "bad second format: " + x; return w.u === 0 && (x == "s" || x == "ss") ? pad0(w.S, x.length) : (O >= 2 ? W = O === 3 ? 1e3 : 100 : W = O === 1 ? 10 : 1, U = Math.round(W * (w.S + w.u)), U >= 60 * W && (U = 0), x === "s" ? U === 0 ? "0" : "" + U / W : (D = pad0(U, 2 + O), x === "ss" ? D.substr(0, 2) : "." + D.substr(2, x.length - 1))); case 90: switch (x) { case "[h]": case "[hh]": G = w.D * 24 + w.H; break; case "[m]": case "[mm]": G = (w.D * 24 + w.H) * 60 + w.M; break; case "[s]": case "[ss]": G = ((w.D * 24 + w.H) * 60 + w.M) * 60 + (O == 0 ? Math.round(w.S + w.u) : w.S); break; default: throw "bad abstime format: " + x; } Y = x.length === 3 ? 1 : 2; break; case 101: G = X, Y = 1; break; } var K = Y > 0 ? pad0(G, Y) : ""; return K; } function commaify(F) { var x = 3; if (F.length <= x) return F; for (var w = F.length % x, O = F.substr(0, w); w != F.length; w += x) O += (O.length > 0 ? "," : "") + F.substr(w, x); return O; } var pct1 = /%/g; function write_num_pct(F, x, w) { var O = x.replace(pct1, ""), D = x.length - O.length; return write_num(F, O, w * Math.pow(10, 2 * D)) + fill("%", D); } function write_num_cm(F, x, w) { for (var O = x.length - 1; x.charCodeAt(O - 1) === 44; ) --O; return write_num(F, x.substr(0, O), w / Math.pow(10, 3 * (x.length - O))); } function write_num_exp(F, x) { var w, O = F.indexOf("E") - F.indexOf(".") - 1; if (F.match(/^#+0.0E\+0$/)) { if (x == 0) return "0.0E+0"; if (x < 0) return "-" + write_num_exp(F, -x); var D = F.indexOf("."); D === -1 && (D = F.indexOf("E")); var U = Math.floor(Math.log(x) * Math.LOG10E) % D; if (U < 0 && (U += D), w = (x / Math.pow(10, U)).toPrecision(O + 1 + (D + U) % D), w.indexOf("e") === -1) { var W = Math.floor(Math.log(x) * Math.LOG10E); for (w.indexOf(".") === -1 ? w = w.charAt(0) + "." + w.substr(1) + "E+" + (W - w.length + U) : w += "E+" + (W - U); w.substr(0, 2) === "0."; ) w = w.charAt(0) + w.substr(2, D) + "." + w.substr(2 + D), w = w.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0."); w = w.replace(/\+-/, "-"); } w = w.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(X, G, Y, K) { return G + Y + K.substr(0, (D + U) % D) + "." + K.substr(U) + "E"; }); } else w = x.toExponential(O); return F.match(/E\+00$/) && w.match(/e[+-]\d$/) && (w = w.substr(0, w.length - 1) + "0" + w.charAt(w.length - 1)), F.match(/E\-/) && w.match(/e\+/) && (w = w.replace(/e\+/, "e")), w.replace("e", "E"); } var frac1 = /# (\?+)( ?)\/( ?)(\d+)/; function write_num_f1(F, x, w) { var O = parseInt(F[4], 10), D = Math.round(x * O), U = Math.floor(D / O), W = D - U * O, X = O; return w + (U === 0 ? "" : "" + U) + " " + (W === 0 ? fill(" ", F[1].length + 1 + F[4].length) : pad_(W, F[1].length) + F[2] + "/" + F[3] + pad0(X, F[4].length)); } function write_num_f2(F, x, w) { return w + (x === 0 ? "" : "" + x) + fill(" ", F[1].length + 2 + F[4].length); } var dec1 = /^#*0*\.([0#]+)/, closeparen = /\)[^)]*[0#]/, phone = /\(###\) ###\\?-####/; function hashq(F) { for (var x = "", w, O = 0; O != F.length; ++O) switch (w = F.charCodeAt(O)) { case 35: break; case 63: x += " "; break; case 48: x += "0"; break; default: x += String.fromCharCode(w); } return x; } function rnd(F, x) { var w = Math.pow(10, x); return "" + Math.round(F * w) / w; } function dec(F, x) { var w = F - Math.floor(F), O = Math.pow(10, x); return x < ("" + Math.round(w * O)).length ? 0 : Math.round(w * O); } function carry(F, x) { return x < ("" + Math.round((F - Math.floor(F)) * Math.pow(10, x))).length ? 1 : 0; } function flr(F) { return F < 2147483647 && F > -2147483648 ? "" + (F >= 0 ? F | 0 : F - 1 | 0) : "" + Math.floor(F); } function write_num_flt(F, x, w) { if (F.charCodeAt(0) === 40 && !x.match(closeparen)) { var O = x.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, ""); return w >= 0 ? write_num_flt("n", O, w) : "(" + write_num_flt("n", O, -w) + ")"; } if (x.charCodeAt(x.length - 1) === 44) return write_num_cm(F, x, w); if (x.indexOf("%") !== -1) return write_num_pct(F, x, w); if (x.indexOf("E") !== -1) return write_num_exp(x, w); if (x.charCodeAt(0) === 36) return "$" + write_num_flt(F, x.substr(x.charAt(1) == " " ? 2 : 1), w); var D, U, W, X, G = Math.abs(w), Y = w < 0 ? "-" : ""; if (x.match(/^00+$/)) return Y + pad0r(G, x.length); if (x.match(/^[#?]+$/)) return D = pad0r(w, 0), D === "0" && (D = ""), D.length > x.length ? D : hashq(x.substr(0, x.length - D.length)) + D; if (U = x.match(frac1)) return write_num_f1(U, G, Y); if (x.match(/^#+0+$/)) return Y + pad0r(G, x.length - x.indexOf("0")); if (U = x.match(dec1)) return D = rnd(w, U[1].length).replace(/^([^\.]+)$/, "$1." + hashq(U[1])).replace(/\.$/, "." + hashq(U[1])).replace(/\.(\d*)$/, function(ee, re) { return "." + re + fill("0", hashq( /*::(*/ U[1] ).length - re.length); }), x.indexOf("0.") !== -1 ? D : D.replace(/^0\./, "."); if (x = x.replace(/^#+([0.])/, "$1"), U = x.match(/^(0*)\.(#*)$/)) return Y + rnd(G, U[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, U[1].length ? "0." : "."); if (U = x.match(/^#{1,3},##0(\.?)$/)) return Y + commaify(pad0r(G, 0)); if (U = x.match(/^#,##0\.([#0]*0)$/)) return w < 0 ? "-" + write_num_flt(F, x, -w) : commaify("" + (Math.floor(w) + carry(w, U[1].length))) + "." + pad0(dec(w, U[1].length), U[1].length); if (U = x.match(/^#,#*,#0/)) return write_num_flt(F, x.replace(/^#,#*,/, ""), w); if (U = x.match(/^([0#]+)(\\?-([0#]+))+$/)) return D = _strrev(write_num_flt(F, x.replace(/[\\-]/g, ""), w)), W = 0, _strrev(_strrev(x.replace(/\\/g, "")).replace(/[0#]/g, function(ee) { return W < D.length ? D.charAt(W++) : ee === "0" ? "0" : ""; })); if (x.match(phone)) return D = write_num_flt(F, "##########", w), "(" + D.substr(0, 3) + ") " + D.substr(3, 3) + "-" + D.substr(6); var K = ""; if (U = x.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) return W = Math.min( /*::String(*/ U[4].length, 7 ), X = SSF_frac(G, Math.pow(10, W) - 1, !1), D = "" + Y, K = write_num( "n", /*::String(*/ U[1], X[1] ), K.charAt(K.length - 1) == " " && (K = K.substr(0, K.length - 1) + "0"), D += K + /*::String(*/ U[2] + "/" + /*::String(*/ U[3], K = rpad_(X[2], W), K.length < U[4].length && (K = hashq(U[4].substr(U[4].length - K.length)) + K), D += K, D; if (U = x.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) return W = Math.min(Math.max(U[1].length, U[4].length), 7), X = SSF_frac(G, Math.pow(10, W) - 1, !0), Y + (X[0] || (X[1] ? "" : "0")) + " " + (X[1] ? pad_(X[1], W) + U[2] + "/" + U[3] + rpad_(X[2], W) : fill(" ", 2 * W + 1 + U[2].length + U[3].length)); if (U = x.match(/^[#0?]+$/)) return D = pad0r(w, 0), x.length <= D.length ? D : hashq(x.substr(0, x.length - D.length)) + D; if (U = x.match(/^([#0?]+)\.([#0]+)$/)) { D = "" + w.toFixed(Math.min(U[2].length, 10)).replace(/([^0])0+$/, "$1"), W = D.indexOf("."); var Z = x.indexOf(".") - W, q = x.length - D.length - Z; return hashq(x.substr(0, Z) + D + x.substr(x.length - q)); } if (U = x.match(/^00,000\.([#0]*0)$/)) return W = dec(w, U[1].length), w < 0 ? "-" + write_num_flt(F, x, -w) : commaify(flr(w)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(ee) { return "00," + (ee.length < 3 ? pad0(0, 3 - ee.length) : "") + ee; }) + "." + pad0(W, U[1].length); switch (x) { case "###,##0.00": return write_num_flt(F, "#,##0.00", w); case "###,###": case "##,###": case "#,###": var J = commaify(pad0r(G, 0)); return J !== "0" ? Y + J : ""; case "###,###.00": return write_num_flt(F, "###,##0.00", w).replace(/^0\./, "."); case "#,###.00": return write_num_flt(F, "#,##0.00", w).replace(/^0\./, "."); } throw new Error("unsupported format |" + x + "|"); } function write_num_cm2(F, x, w) { for (var O = x.length - 1; x.charCodeAt(O - 1) === 44; ) --O; return write_num(F, x.substr(0, O), w / Math.pow(10, 3 * (x.length - O))); } function write_num_pct2(F, x, w) { var O = x.replace(pct1, ""), D = x.length - O.length; return write_num(F, O, w * Math.pow(10, 2 * D)) + fill("%", D); } function write_num_exp2(F, x) { var w, O = F.indexOf("E") - F.indexOf(".") - 1; if (F.match(/^#+0.0E\+0$/)) { if (x == 0) return "0.0E+0"; if (x < 0) return "-" + write_num_exp2(F, -x); var D = F.indexOf("."); D === -1 && (D = F.indexOf("E")); var U = Math.floor(Math.log(x) * Math.LOG10E) % D; if (U < 0 && (U += D), w = (x / Math.pow(10, U)).toPrecision(O + 1 + (D + U) % D), !w.match(/[Ee]/)) { var W = Math.floor(Math.log(x) * Math.LOG10E); w.indexOf(".") === -1 ? w = w.charAt(0) + "." + w.substr(1) + "E+" + (W - w.length + U) : w += "E+" + (W - U), w = w.replace(/\+-/, "-"); } w = w.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(X, G, Y, K) { return G + Y + K.substr(0, (D + U) % D) + "." + K.substr(U) + "E"; }); } else w = x.toExponential(O); return F.match(/E\+00$/) && w.match(/e[+-]\d$/) && (w = w.substr(0, w.length - 1) + "0" + w.charAt(w.length - 1)), F.match(/E\-/) && w.match(/e\+/) && (w = w.replace(/e\+/, "e")), w.replace("e", "E"); } function write_num_int(F, x, w) { if (F.charCodeAt(0) === 40 && !x.match(closeparen)) { var O = x.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, ""); return w >= 0 ? write_num_int("n", O, w) : "(" + write_num_int("n", O, -w) + ")"; } if (x.charCodeAt(x.length - 1) === 44) return write_num_cm2(F, x, w); if (x.indexOf("%") !== -1) return write_num_pct2(F, x, w); if (x.indexOf("E") !== -1) return write_num_exp2(x, w); if (x.charCodeAt(0) === 36) return "$" + write_num_int(F, x.substr(x.charAt(1) == " " ? 2 : 1), w); var D, U, W, X, G = Math.abs(w), Y = w < 0 ? "-" : ""; if (x.match(/^00+$/)) return Y + pad0(G, x.length); if (x.match(/^[#?]+$/)) return D = "" + w, w === 0 && (D = ""), D.length > x.length ? D : hashq(x.substr(0, x.length - D.length)) + D; if (U = x.match(frac1)) return write_num_f2(U, G, Y); if (x.match(/^#+0+$/)) return Y + pad0(G, x.length - x.indexOf("0")); if (U = x.match(dec1)) return D = ("" + w).replace(/^([^\.]+)$/, "$1." + hashq(U[1])).replace(/\.$/, "." + hashq(U[1])), D = D.replace(/\.(\d*)$/, function(ee, re) { return "." + re + fill("0", hashq(U[1]).length - re.length); }), x.indexOf("0.") !== -1 ? D : D.replace(/^0\./, "."); if (x = x.replace(/^#+([0.])/, "$1"), U = x.match(/^(0*)\.(#*)$/)) return Y + ("" + G).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, U[1].length ? "0." : "."); if (U = x.match(/^#{1,3},##0(\.?)$/)) return Y + commaify("" + G); if (U = x.match(/^#,##0\.([#0]*0)$/)) return w < 0 ? "-" + write_num_int(F, x, -w) : commaify("" + w) + "." + fill("0", U[1].length); if (U = x.match(/^#,#*,#0/)) return write_num_int(F, x.replace(/^#,#*,/, ""), w); if (U = x.match(/^([0#]+)(\\?-([0#]+))+$/)) return D = _strrev(write_num_int(F, x.replace(/[\\-]/g, ""), w)), W = 0, _strrev(_strrev(x.replace(/\\/g, "")).replace(/[0#]/g, function(ee) { return W < D.length ? D.charAt(W++) : ee === "0" ? "0" : ""; })); if (x.match(phone)) return D = write_num_int(F, "##########", w), "(" + D.substr(0, 3) + ") " + D.substr(3, 3) + "-" + D.substr(6); var K = ""; if (U = x.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) return W = Math.min( /*::String(*/ U[4].length, 7 ), X = SSF_frac(G, Math.pow(10, W) - 1, !1), D = "" + Y, K = write_num( "n", /*::String(*/ U[1], X[1] ), K.charAt(K.length - 1) == " " && (K = K.substr(0, K.length - 1) + "0"), D += K + /*::String(*/ U[2] + "/" + /*::String(*/ U[3], K = rpad_(X[2], W), K.length < U[4].length && (K = hashq(U[4].substr(U[4].length - K.length)) + K), D += K, D; if (U = x.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) return W = Math.min(Math.max(U[1].length, U[4].length), 7), X = SSF_frac(G, Math.pow(10, W) - 1, !0), Y + (X[0] || (X[1] ? "" : "0")) + " " + (X[1] ? pad_(X[1], W) + U[2] + "/" + U[3] + rpad_(X[2], W) : fill(" ", 2 * W + 1 + U[2].length + U[3].length)); if (U = x.match(/^[#0?]+$/)) return D = "" + w, x.length <= D.length ? D : hashq(x.substr(0, x.length - D.length)) + D; if (U = x.match(/^([#0]+)\.([#0]+)$/)) { D = "" + w.toFixed(Math.min(U[2].length, 10)).replace(/([^0])0+$/, "$1"), W = D.indexOf("."); var Z = x.indexOf(".") - W, q = x.length - D.length - Z; return hashq(x.substr(0, Z) + D + x.substr(x.length - q)); } if (U = x.match(/^00,000\.([#0]*0)$/)) return w < 0 ? "-" + write_num_int(F, x, -w) : commaify("" + w).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(ee) { return "00," + (ee.length < 3 ? pad0(0, 3 - ee.length) : "") + ee; }) + "." + pad0(0, U[1].length); switch (x) { case "###,###": case "##,###": case "#,###": var J = commaify("" + G); return J !== "0" ? Y + J : ""; default: if (x.match(/\.[0#?]*$/)) return write_num_int(F, x.slice(0, x.lastIndexOf(".")), w) + hashq(x.slice(x.lastIndexOf("."))); } throw new Error("unsupported format |" + x + "|"); } function write_num(F, x, w) { return (w | 0) === w ? write_num_int(F, x, w) : write_num_flt(F, x, w); } function SSF_split_fmt(F) { for (var x = [], w = !1, O = 0, D = 0; O < F.length; ++O) switch ( /*cc=*/ F.charCodeAt(O) ) { case 34: w = !w; break; case 95: case 42: case 92: ++O; break; case 59: x[x.length] = F.substr(D, O - D), D = O + 1; } if (x[x.length] = F.substr(D), w === !0) throw new Error("Format |" + F + "| unterminated string "); return x; } var SSF_abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/; function fmt_is_date(F) { for (var x = 0, w = "", O = ""; x < F.length; ) switch (w = F.charAt(x)) { case "G": SSF_isgeneral(F, x) && (x += 6), x++; break; case '"': for ( ; /*cc=*/ F.charCodeAt(++x) !== 34 && x < F.length; ) ; ++x; break; case "\\": x += 2; break; case "_": x += 2; break; case "@": ++x; break; case "B": case "b": if (F.charAt(x + 1) === "1" || F.charAt(x + 1) === "2") return !0; /* falls through */ case "M": case "D": case "Y": case "H": case "S": case "E": /* falls through */ case "m": case "d": case "y": case "h": case "s": case "e": case "g": return !0; case "A": case "a": case "上": if (F.substr(x, 3).toUpperCase() === "A/P" || F.substr(x, 5).toUpperCase() === "AM/PM" || F.substr(x, 5).toUpperCase() === "上午/下午") return !0; ++x; break; case "[": for (O = w; F.charAt(x++) !== "]" && x < F.length; ) O += F.charAt(x); if (O.match(SSF_abstime)) return !0; break; case ".": /* falls through */ case "0": case "#": for (; x < F.length && ("0#?.,E+-%".indexOf(w = F.charAt(++x)) > -1 || w == "\\" && F.charAt(x + 1) == "-" && "0#".indexOf(F.charAt(x + 2)) > -1); ) ; break; case "?": for (; F.charAt(++x) === w; ) ; break; case "*": ++x, (F.charAt(x) == " " || F.charAt(x) == "*") && ++x; break; case "(": case ")": ++x; break; case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": for (; x < F.length && "0123456789".indexOf(F.charAt(++x)) > -1; ) ; break; case " ": ++x; break; default: ++x; break; } return !1; } function eval_fmt(F, x, w, O) { for (var D = [], U = "", W = 0, X = "", G = "t", Y, K, Z, q = "H"; W < F.length; ) switch (X = F.charAt(W)) { case "G": if (!SSF_isgeneral(F, W)) throw new Error("unrecognized character " + X + " in " + F); D[D.length] = { t: "G", v: "General" }, W += 7; break; case '"': for (U = ""; (Z = F.charCodeAt(++W)) !== 34 && W < F.length; ) U += String.fromCharCode(Z); D[D.length] = { t: "t", v: U }, ++W; break; case "\\": var J = F.charAt(++W), ee = J === "(" || J === ")" ? J : "t"; D[D.length] = { t: ee, v: J }, ++W; break; case "_": D[D.length] = { t: "t", v: " " }, W += 2; break; case "@": D[D.length] = { t: "T", v: x }, ++W; break; case "B": case "b": if (F.charAt(W + 1) === "1" || F.charAt(W + 1) === "2") { if (Y == null && (Y = SSF_parse_date_code(x, w, F.charAt(W + 1) === "2"), Y == null)) return ""; D[D.length] = { t: "X", v: F.substr(W, 2) }, G = X, W += 2; break; } /* falls through */ case "M": case "D": case "Y": case "H": case "S": case "E": X = X.toLowerCase(); /* falls through */ case "m": case "d": case "y": case "h": case "s": case "e": case "g": if (x < 0 || Y == null && (Y = SSF_parse_date_code(x, w), Y == null)) return ""; for (U = X; ++W < F.length && F.charAt(W).toLowerCase() === X; ) U += X; X === "m" && G.toLowerCase() === "h" && (X = "M"), X === "h" && (X = q), D[D.length] = { t: X, v: U }, G = X; break; case "A": case "a": case "上": var re = { t: X, v: X }; if (Y == null && (Y = SSF_parse_date_code(x, w)), F.substr(W, 3).toUpperCase() === "A/P" ? (Y != null && (re.v = Y.H >= 12 ? F.charAt(W + 2) : X), re.t = "T", q = "h", W += 3) : F.substr(W, 5).toUpperCase() === "AM/PM" ? (Y != null && (re.v = Y.H >= 12 ? "PM" : "AM"), re.t = "T", W += 5, q = "h") : F.substr(W, 5).toUpperCase() === "上午/下午" ? (Y != null && (re.v = Y.H >= 12 ? "下午" : "上午"), re.t = "T", W += 5, q = "h") : (re.t = "t", ++W), Y == null && re.t === "T") return ""; D[D.length] = re, G = X; break; case "[": for (U = X; F.charAt(W++) !== "]" && W < F.length; ) U += F.charAt(W); if (U.slice(-1) !== "]") throw 'unterminated "[" block: |' + U + "|"; if (U.match(SSF_abstime)) { if (Y == null && (Y = SSF_parse_date_code(x, w), Y == null)) return ""; D[D.length] = { t: "Z", v: U.toLowerCase() }, G = U.charAt(1); } else U.indexOf("$") > -1 && (U = (U.match(/\$([^-\[\]]*)/) || [])[1] || "$", fmt_is_date(F) || (D[D.length] = { t: "t", v: U })); break; /* Numbers */ case ".": if (Y != null) { for (U = X; ++W < F.length && (X = F.charAt(W)) === "0"; ) U += X; D[D.length] = { t: "s", v: U }; break; } /* falls through */ case "0": case "#": for (U = X; ++W < F.length && "0#?.,E+-%".indexOf(X = F.charAt(W)) > -1; ) U += X; D[D.length] = { t: "n", v: U }; break; case "?": for (U = X; F.charAt(++W) === X; ) U += X; D[D.length] = { t: X, v: U }, G = X; break; case "*": ++W, (F.charAt(W) == " " || F.charAt(W) == "*") && ++W; break; // ** case "(": case ")": D[D.length] = { t: O === 1 ? "t" : X, v: X }, ++W; break; case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": for (U = X; W < F.length && "0123456789".indexOf(F.charAt(++W)) > -1; ) U += F.charAt(W); D[D.length] = { t: "D", v: U }; break; case " ": D[D.length] = { t: X, v: X }, ++W; break; case "$": D[D.length] = { t: "t", v: "$" }, ++W; break; default: if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(X) === -1) throw new Error("unrecognized character " + X + " in " + F); D[D.length] = { t: "t", v: X }, ++W; break; } var te = 0, Q = 0, oe; for (W = D.length - 1, G = "t"; W >= 0; --W) switch (D[W].t) { case "h": case "H": D[W].t = q, G = "h", te < 1 && (te = 1); break; case "s": (oe = D[W].v.match(/\.0+$/)) && (Q = Math.max(Q, oe[0].length - 1), te = 4), te < 3 && (te = 3); /* falls through */ case "d": case "y": case "e": G = D[W].t; break; case "M": G = D[W].t, te < 2 && (te = 2); break; case "m": G === "s" && (D[W].t = "M", te < 2 && (te = 2)); break; case "X": break; case "Z": te < 1 && D[W].v.match(/[Hh]/) && (te = 1), te < 2 && D[W].v.match(/[Mm]/) && (te = 2), te < 3 && D[W].v.match(/[Ss]/) && (te = 3); } var ne; switch (te) { case 0: break; case 1: case 2: case 3: Y.u >= 0.5 && (Y.u = 0, ++Y.S), Y.S >= 60 && (Y.S = 0, ++Y.M), Y.M >= 60 && (Y.M = 0, ++Y.H), Y.H >= 24 && (Y.H = 0, ++Y.D, ne = SSF_parse_date_code(Y.D), ne.u = Y.u, ne.S = Y.S, ne.M = Y.M, ne.H = Y.H, Y = ne); break; case 4: switch (Q) { case 1: Y.u = Math.round(Y.u * 10) / 10; break; case 2: Y.u = Math.round(Y.u * 100) / 100; break; case 3: Y.u = Math.round(Y.u * 1e3) / 1e3; break; } Y.u >= 1 && (Y.u = 0, ++Y.S), Y.S >= 60 && (Y.S = 0, ++Y.M), Y.M >= 60 && (Y.M = 0, ++Y.H), Y.H >= 24 && (Y.H = 0, ++Y.D, ne = SSF_parse_date_code(Y.D), ne.u = Y.u, ne.S = Y.S, ne.M = Y.M, ne.H = Y.H, Y = ne); break; } var le = "", Ee; for (W = 0; W < D.length; ++W) switch (D[W].t) { case "t": case "T": case " ": case "D": break; case "X": D[W].v = "", D[W].t = ";"; break; case "d": case "m": case "y": case "h": case "H": case "M": case "s": case "e": case "b": case "Z": D[W].v = SSF_write_date(D[W].t.charCodeAt(0), D[W].v, Y, Q), D[W].t = "t"; break; case "n": case "?": for (Ee = W + 1; D[Ee] != null && ((X = D[Ee].t) === "?" || X === "D" || (X === " " || X === "t") && D[Ee + 1] != null && (D[Ee + 1].t === "?" || D[Ee + 1].t === "t" && D[Ee + 1].v === "/") || D[W].t === "(" && (X === " " || X === "n" || X === ")") || X === "t" && (D[Ee].v === "/" || D[Ee].v === " " && D[Ee + 1] != null && D[Ee + 1].t == "?")); ) D[W].v += D[Ee].v, D[Ee] = { v: "", t: ";" }, ++Ee; le += D[W].v, W = Ee - 1; break; case "G": D[W].t = "t", D[W].v = SSF_general(x, w); break; } var Te = "", de, ae; if (le.length > 0) { le.charCodeAt(0) == 40 ? (de = x < 0 && le.charCodeAt(0) === 45 ? -x : x, ae = write_num("n", le, de)) : (de = x < 0 && O > 1 ? -x : x, ae = write_num("n", le, de), de < 0 && D[0] && D[0].t == "t" && (ae = ae.substr(1), D[0].v = "-" + D[0].v)), Ee = ae.length - 1; var se = D.length; for (W = 0; W < D.length; ++W) if (D[W] != null && D[W].t != "t" && D[W].v.indexOf(".") > -1) { se = W; break; } var ce = D.length; if (se === D.length && ae.indexOf("E") === -1) { for (W = D.length - 1; W >= 0; --W) D[W] == null || "n?".indexOf(D[W].t) === -1 || (Ee >= D[W].v.length - 1 ? (Ee -= D[W].v.length, D[W].v = ae.substr(Ee + 1, D[W].v.length)) : Ee < 0 ? D[W].v = "" : (D[W].v = ae.substr(0, Ee + 1), Ee = -1), D[W].t = "t", ce = W); Ee >= 0 && ce < D.length && (D[ce].v = ae.substr(0, Ee + 1) + D[ce].v); } else if (se !== D.length && ae.indexOf("E") === -1) { for (Ee = ae.indexOf(".") - 1, W = se; W >= 0; --W) if (!(D[W] == null || "n?".indexOf(D[W].t) === -1)) { for (K = D[W].v.indexOf(".") > -1 && W === se ? D[W].v.indexOf(".") - 1 : D[W].v.length - 1, Te = D[W].v.substr(K + 1); K >= 0; --K) Ee >= 0 && (D[W].v.charAt(K) === "0" || D[W].v.charAt(K) === "#") && (Te = ae.charAt(Ee--) + Te); D[W].v = Te, D[W].t = "t", ce = W; } for (Ee >= 0 && ce < D.length && (D[ce].v = ae.substr(0, Ee + 1) + D[ce].v), Ee = ae.indexOf(".") + 1, W = se; W < D.length; ++W) if (!(D[W] == null || "n?(".indexOf(D[W].t) === -1 && W !== se)) { for (K = D[W].v.indexOf(".") > -1 && W === se ? D[W].v.indexOf(".") + 1 : 0, Te = D[W].v.substr(0, K); K < D[W].v.length; ++K) Ee < ae.length && (Te += ae.charAt(Ee++)); D[W].v = Te, D[W].t = "t", ce = W; } } } for (W = 0; W < D.length; ++W) D[W] != null && "n?".indexOf(D[W].t) > -1 && (de = O > 1 && x < 0 && W > 0 && D[W - 1].v === "-" ? -x : x, D[W].v = write_num(D[W].t, D[W].v, de), D[W].t = "t"); var xe = ""; for (W = 0; W !== D.length; ++W) D[W] != null && (xe += D[W].v); return xe; } var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/; function chkcond(F, x) { if (x == null) return !1; var w = parseFloat(x[2]); switch (x[1]) { case "=": if (F == w) return !0; break; case ">": if (F > w) return !0; break; case "<": if (F < w) return !0; break; case "<>": if (F != w) return !0; break; case ">=": if (F >= w) return !0; break; case "<=": if (F <= w) return !0; break; } return !1; } function choose_fmt(F, x) { var w = SSF_split_fmt(F), O = w.length, D = w[O - 1].indexOf("@"); if (O < 4 && D > -1 && --O, w.length > 4) throw new Error("cannot find right format for |" + w.join("|") + "|"); if (typeof x != "number") return [4, w.length === 4 || D > -1 ? w[w.length - 1] : "@"]; switch (typeof x == "number" && !isFinite(x) && (x = 0), w.length) { case 1: w = D > -1 ? ["General", "General", "General", w[0]] : [w[0], w[0], w[0], "@"]; break; case 2: w = D > -1 ? [w[0], w[0], w[0], w[1]] : [w[0], w[1], w[0], "@"]; break; case 3: w = D > -1 ? [w[0], w[1], w[0], w[2]] : [w[0], w[1], w[2], "@"]; break; } var U = x > 0 ? w[0] : x < 0 ? w[1] : w[2]; if (w[0].indexOf("[") === -1 && w[1].indexOf("[") === -1) return [O, U]; if (w[0].match(/\[[=<>]/) != null || w[1].match(/\[[=<>]/) != null) { var W = w[0].match(cfregex2), X = w[1].match(cfregex2); return chkcond(x, W) ? [O, w[0]] : chkcond(x, X) ? [O, w[1]] : [O, w[W != null && X != null ? 2 : 1]]; } return [O, U]; } function SSF_format(F, x, w) { w == null && (w = {}); var O = ""; switch (typeof F) { case "string": F == "m/d/yy" && w.dateNF ? O = w.dateNF : O = F; break; case "number": F == 14 && w.dateNF ? O = w.dateNF : O = (w.table != null ? w.table : table_fmt)[F], O == null && (O = w.table && w.table[SSF_default_map[F]] || table_fmt[SSF_default_map[F]]), O == null && (O = SSF_default_str[F] || "General"); break; } if (SSF_isgeneral(O, 0)) return SSF_general(x, w); x instanceof Date && (x = datenum(x, w.date1904)); var D = choose_fmt(O, x); if (SSF_isgeneral(D[1])) return SSF_general(x, w); if (x === !0) x = "TRUE"; else if (x === !1) x = "FALSE"; else { if (x === "" || x == null) return ""; if (isNaN(x) && D[1].indexOf("0") > -1) return "#NUM!"; if (!isFinite(x) && D[1].indexOf("0") > -1) return "#DIV/0!"; } return eval_fmt(D[1], x, w, D[0]); } function SSF_load(F, x) { if (typeof x != "number") { x = +x || -1; for (var w = 0; w < 392; ++w) { if (table_fmt[w] == null) { x < 0 && (x = w); continue; } if (table_fmt[w] == F) { x = w; break; } } x < 0 && (x = 391); } return table_fmt[x] = F, x; } function SSF_load_table(F) { for (var x = 0; x != 392; ++x) F[x] !== void 0 && SSF_load(F[x], x); } function make_ssf() { table_fmt = SSF_init_table(); } var SSF = { format: SSF_format, load: SSF_load, _table: table_fmt, load_table: SSF_load_table, parse_date_code: SSF_parse_date_code, is_date: fmt_is_date, get_table: function() { return SSF._table = table_fmt; } }, SSFImplicit = { 5: '"$"#,##0_);\\("$"#,##0\\)', 6: '"$"#,##0_);[Red]\\("$"#,##0\\)', 7: '"$"#,##0.00_);\\("$"#,##0.00\\)', 8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 23: "General", 24: "General", 25: "General", 26: "General", 27: "m/d/yy", 28: "m/d/yy", 29: "m/d/yy", 30: "m/d/yy", 31: "m/d/yy", 32: "h:mm:ss", 33: "h:mm:ss", 34: "h:mm:ss", 35: "h:mm:ss", 36: "m/d/yy", 41: '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)', 42: '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)', 43: '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)', 44: '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)', 50: "m/d/yy", 51: "m/d/yy", 52: "m/d/yy", 53: "m/d/yy", 54: "m/d/yy", 55: "m/d/yy", 56: "m/d/yy", 57: "m/d/yy", 58: "m/d/yy", 59: "0", 60: "0.00", 61: "#,##0", 62: "#,##0.00", 63: '"$"#,##0_);\\("$"#,##0\\)', 64: '"$"#,##0_);[Red]\\("$"#,##0\\)', 65: '"$"#,##0.00_);\\("$"#,##0.00\\)', 66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 67: "0%", 68: "0.00%", 69: "# ?/?", 70: "# ??/??", 71: "m/d/yy", 72: "m/d/yy", 73: "d-mmm-yy", 74: "d-mmm", 75: "mmm-yy", 76: "h:mm", 77: "h:mm:ss", 78: "m/d/yy h:mm", 79: "mm:ss", 80: "[h]:mm:ss", 81: "mmss.0" }, dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g; function dateNF_regex(F) { var x = typeof F == "number" ? table_fmt[F] : F; return x = x.replace(dateNFregex, "(\\d+)"), dateNFregex.lastIndex = 0, new RegExp("^" + x + "$"); } function dateNF_fix(F, x, w) { var O = -1, D = -1, U = -1, W = -1, X = -1, G = -1; (x.match(dateNFregex) || []).forEach(function(Z, q) { var J = parseInt(w[q + 1], 10); switch (Z.toLowerCase().charAt(0)) { case "y": O = J; break; case "d": U = J; break; case "h": W = J; break; case "s": G = J; break; case "m": W >= 0 ? X = J : D = J; break; } }), dateNFregex.lastIndex = 0, G >= 0 && X == -1 && D >= 0 && (X = D, D = -1); var Y = ("" + (O >= 0 ? O : (/* @__PURE__ */ new Date()).getFullYear())).slice(-4) + "-" + ("00" + (D >= 1 ? D : 1)).slice(-2) + "-" + ("00" + (U >= 1 ? U : 1)).slice(-2); Y.length == 7 && (Y = "0" + Y), Y.length == 8 && (Y = "20" + Y); var K = ("00" + (W >= 0 ? W : 0)).slice(-2) + ":" + ("00" + (X >= 0 ? X : 0)).slice(-2) + ":" + ("00" + (G >= 0 ? G : 0)).slice(-2); return W == -1 && X == -1 && G == -1 ? Y : O == -1 && D == -1 && U == -1 ? K : Y + "T" + K; } var bad_formats = { "d.m": "d\\.m" // Issue #2571 Google Sheets writes invalid format 'd.m', correct format is 'd"."m' or 'd\\.m' }; function SSF__load(F, x) { return SSF_load(bad_formats[F] || F, x); } var CRC32 = /* @__PURE__ */ function() { var F = {}; F.version = "1.2.0"; function x() { for (var de = 0, ae = new Array(256), se = 0; se != 256; ++se) de = se, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, de = de & 1 ? -306674912 ^ de >>> 1 : de >>> 1, ae[se] = de; return typeof Int32Array < "u" ? new Int32Array(ae) : ae; } var w = x(); function O(de) { var ae = 0, se = 0, ce = 0, xe = typeof Int32Array < "u" ? new Int32Array(4096) : new Array(4096); for (ce = 0; ce != 256; ++ce) xe[ce] = de[ce]; for (ce = 0; ce != 256; ++ce) for (se = de[ce], ae = 256 + ce; ae < 4096; ae += 256) se = xe[ae] = se >>> 8 ^ de[se & 255]; var Ce = []; for (ce = 1; ce != 16; ++ce) Ce[ce - 1] = typeof Int32Array