open-grid 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/ExportProgressView-BYPw8osg.cjs +2 -0
  3. package/dist/ExportProgressView-Bt5-z7rE.js +2 -0
  4. package/dist/LcpMergeOrderer-CeP6C6G1.cjs +2 -0
  5. package/dist/LcpMergeOrderer-Ebwuir-r.js +2 -0
  6. package/dist/OpenGrid-Bh1NMOcm.cjs +98 -0
  7. package/dist/OpenGrid-CeXt04ho.js +98 -0
  8. package/dist/Registry-CrT46EAO.js +2 -0
  9. package/dist/Registry-DpHOpU5V.cjs +2 -0
  10. package/dist/XlsxChannel-CuOZ3LQz.js +2 -0
  11. package/dist/XlsxChannel-DQHLGend.cjs +2 -0
  12. package/dist/XlsxWorkbookWriter-DixuNGtw.cjs +3 -0
  13. package/dist/XlsxWorkbookWriter-VgbibI0Z.js +3 -0
  14. package/dist/fflate-Cs3txMgg.js +2 -0
  15. package/dist/fflate-G9RAFEgF.cjs +2 -0
  16. package/dist/index-1OXjJmct.js +2 -0
  17. package/dist/index-B5V7e4Xc.js +2 -0
  18. package/dist/index-DbKDox8y.cjs +2 -0
  19. package/dist/index-HaDoF1HM.cjs +2 -0
  20. package/dist/open-grid-react.cjs +1 -27
  21. package/dist/open-grid-react.js +1 -30
  22. package/dist/open-grid-vue.cjs +1 -31
  23. package/dist/open-grid-vue.js +1 -33
  24. package/dist/open-grid.cjs +6 -275
  25. package/dist/open-grid.js +6 -293
  26. package/dist/sinks-BCZFMGQJ.cjs +2 -0
  27. package/dist/sinks-qkBJ5bKn.js +2 -0
  28. package/dist/types/core/ExportManager.d.ts +1 -0
  29. package/dist/types/core/export/channels/XlsxChannel.d.ts +9 -1
  30. package/dist/types/core/export/channels/XlsxRichTextRun.d.ts +14 -0
  31. package/dist/types/core/export/channels/XlsxSheetXml.d.ts +19 -0
  32. package/dist/types/core/export/channels/XlsxStyleEntries.d.ts +80 -0
  33. package/dist/types/core/export/channels/XlsxStylesRegistry.d.ts +20 -0
  34. package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +7 -4
  35. package/dist/types/core/export/channels/XlsxXml.d.ts +6 -0
  36. package/dist/types/core/export/types.d.ts +63 -0
  37. package/dist/types/core/types.d.ts +24 -0
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/xlsx.min-CMvrM6b4.cjs +138 -0
  40. package/dist/xlsx.min-i_b-4PvU.js +138 -0
  41. package/package.json +2 -1
  42. package/dist/ExportProgressView-9Kt1SQxv.js +0 -48
  43. package/dist/ExportProgressView-B59uHIwt.cjs +0 -48
  44. package/dist/LcpMergeOrderer-BdUtV67j.js +0 -114
  45. package/dist/LcpMergeOrderer-C_ANVkGk.cjs +0 -113
  46. package/dist/OpenGrid-BUYQs1_w.cjs +0 -9806
  47. package/dist/OpenGrid-BmagF0yo.js +0 -9819
  48. package/dist/Registry-CPJYOqCn.js +0 -74
  49. package/dist/Registry-D74ZmdDz.cjs +0 -71
  50. package/dist/XlsxChannel-DOeHeP7h.cjs +0 -95
  51. package/dist/XlsxChannel-DdaiytFR.js +0 -95
  52. package/dist/XlsxWorkbookWriter-BTNtZ80J.js +0 -199
  53. package/dist/XlsxWorkbookWriter-_u5stfg4.cjs +0 -198
  54. package/dist/index-B9_g5Eg3.js +0 -481
  55. package/dist/index-CeJ-0-80.cjs +0 -260
  56. package/dist/index-CnyumyPV.cjs +0 -452
  57. package/dist/index-DnarQ4eR.js +0 -266
  58. package/dist/sinks-BWkWQexV.js +0 -149
  59. package/dist/sinks-DPK0VxYG.cjs +0 -143
  60. package/dist/xlsx.min-BQ1o3sB6.cjs +0 -11793
  61. package/dist/xlsx.min-Bbz2ZypC.js +0 -11794
@@ -1,198 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ENC = new TextEncoder(), DOS_DATE = 23585, DOS_TIME = 0;
4
- let CRC_TABLE;
5
- function crc32(t, s) {
6
- if (!CRC_TABLE) {
7
- CRC_TABLE = new Uint32Array(256);
8
- for (let o = 0; o < 256; o++) {
9
- let e = o;
10
- for (let i = 0; i < 8; i++) e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
11
- CRC_TABLE[o] = e >>> 0;
12
- }
13
- }
14
- let l = ~s >>> 0;
15
- for (let o = 0; o < t.length; o++) l = CRC_TABLE[(l ^ t[o]) & 255] ^ l >>> 8;
16
- return ~l >>> 0;
17
- }
18
- const S_DEFAULT = 0, S_HEADER = 1, S_STRIPE = 2, LEN_BASE = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], LEN_EXTRA = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], DIST_BASE = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], DIST_EXTRA = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], PIECE = 65536, HASH_BITS = 15;
19
- let LIT_CODE, LIT_LEN, LEN_IDX, DIST_IDX;
20
- function rev(t, s) {
21
- let l = 0;
22
- for (let o = 0; o < s; o++) l = l << 1 | t & 1, t >>= 1;
23
- return l;
24
- }
25
- function initTables() {
26
- if (LIT_CODE) return;
27
- const t = new Uint16Array(288), s = new Uint8Array(288);
28
- for (let e = 0; e < 288; e++) {
29
- let i, h;
30
- e < 144 ? (i = 48 + e, h = 8) : e < 256 ? (i = 400 + (e - 144), h = 9) : e < 280 ? (i = e - 256, h = 7) : (i = 192 + (e - 280), h = 8), t[e] = rev(i, h), s[e] = h;
31
- }
32
- const l = new Uint8Array(259);
33
- for (let e = 3; e <= 258; e++) {
34
- let i = 28;
35
- for (; LEN_BASE[i] > e; ) i--;
36
- l[e] = i;
37
- }
38
- const o = new Uint8Array(32769);
39
- for (let e = 1; e <= 32768; e++) {
40
- let i = 29;
41
- for (; DIST_BASE[i] > e; ) i--;
42
- o[e] = i;
43
- }
44
- LIT_LEN = s, LEN_IDX = l, DIST_IDX = o, LIT_CODE = t;
45
- }
46
- function deflateChunk(t, s) {
47
- if (t.length === 0) return new Uint8Array(0);
48
- if (s === 0) return storedBlocks(t);
49
- initTables();
50
- const l = LIT_CODE, o = LIT_LEN, e = LEN_IDX, i = DIST_IDX, h = s >= 6 ? 24 : s >= 3 ? 8 : 3;
51
- let u = new Uint8Array(Math.ceil(t.length * 1.2) + 64), w = 0, U = 0, b = 0;
52
- const d = (m, g) => {
53
- for (U |= m << b, b += g; b >= 8; ) u[w++] = U & 255, U >>>= 8, b -= 8;
54
- }, y = new Int32Array(1 << HASH_BITS), E = new Int32Array(PIECE);
55
- for (let m = 0; m < t.length; m += PIECE) {
56
- const g = Math.min(m + PIECE, t.length);
57
- if (w + (g - m) * 1.2 + 64 > u.length) {
58
- const x = new Uint8Array(Math.ceil(u.length * 1.5) + (g - m) * 2);
59
- x.set(u), u = x;
60
- }
61
- y.fill(-1), d(0, 1), d(1, 2);
62
- let a = m;
63
- for (; a < g; ) {
64
- let x = 0, f = 0;
65
- if (a + 2 < g) {
66
- const n = (t[a] << 10 ^ t[a + 1] << 5 ^ t[a + 2]) & (1 << HASH_BITS) - 1;
67
- let c = y[n], r = h;
68
- const I = Math.min(258, g - a);
69
- for (; c >= 0 && r-- > 0 && a - c <= 32768; ) {
70
- let p = 0;
71
- for (; p < I && t[c + p] === t[a + p]; ) p++;
72
- if (p > x && (x = p, f = a - c, p === I)) break;
73
- c = E[c - m];
74
- }
75
- E[a - m] = y[n], y[n] = a;
76
- }
77
- if (x >= 3) {
78
- const n = e[x], c = 257 + n;
79
- d(l[c], o[c]), LEN_EXTRA[n] > 0 && d(x - LEN_BASE[n], LEN_EXTRA[n]);
80
- const r = i[f];
81
- d(rev(r, 5), 5), DIST_EXTRA[r] > 0 && d(f - DIST_BASE[r], DIST_EXTRA[r]);
82
- const I = a + x;
83
- for (a++; a < I; ) {
84
- if (a + 2 < g) {
85
- const p = (t[a] << 10 ^ t[a + 1] << 5 ^ t[a + 2]) & (1 << HASH_BITS) - 1;
86
- E[a - m] = y[p], y[p] = a;
87
- }
88
- a++;
89
- }
90
- } else {
91
- const n = t[a];
92
- d(l[n], o[n]), a++;
93
- }
94
- }
95
- d(l[256], o[256]);
96
- }
97
- return d(0, 3), b > 0 && (u[w++] = U & 255, U = 0, b = 0), u[w++] = 0, u[w++] = 0, u[w++] = 255, u[w++] = 255, u.slice(0, w);
98
- }
99
- function storedBlocks(t) {
100
- const s = Math.ceil(t.length / 65535), l = new Uint8Array(t.length + s * 5);
101
- let o = 0;
102
- for (let e = 0; e < t.length; e += 65535) {
103
- const i = Math.min(65535, t.length - e);
104
- l[o++] = 0, l[o++] = i & 255, l[o++] = i >> 8, l[o++] = ~i & 255, l[o++] = ~i >> 8 & 255, l.set(t.subarray(e, e + i), o), o += i;
105
- }
106
- return l;
107
- }
108
- const DEFLATE_END = new Uint8Array([3, 0]);
109
- function xmlEscape(t) {
110
- return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F￾￿]/g, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
111
- }
112
- function colName(t) {
113
- let s = t + 1, l = "";
114
- for (; s > 0; ) {
115
- const o = (s - 1) % 26;
116
- l = String.fromCharCode(65 + o) + l, s = Math.floor((s - 1) / 26);
117
- }
118
- return l;
119
- }
120
- const XML_HEAD = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
121
- `, NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main", CONTENT_TYPES = XML_HEAD + '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>', ROOT_RELS = XML_HEAD + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>', WB_RELS = XML_HEAD + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>', STYLES = XML_HEAD + `<styleSheet xmlns="${NS}"><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="4"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD9E2F3"/><bgColor indexed="64"/></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFF5F7FA"/><bgColor indexed="64"/></patternFill></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="3"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="0" applyFill="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
122
- function workbookXml(t) {
123
- const s = xmlEscape(t.replace(/[[\]:*?/\\]/g, " ").slice(0, 31) || "Sheet1");
124
- return XML_HEAD + `<workbook xmlns="${NS}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${s}" sheetId="1" r:id="rId1"/></sheets></workbook>`;
125
- }
126
- function cellXml(t, s, l, o) {
127
- const e = s === S_DEFAULT ? "" : ` s="${s}"`;
128
- return l !== void 0 ? `<c r="${t}"${e} t="n"><v>${l}</v></c>` : o === "" ? `<c r="${t}"${e}/>` : `<c r="${t}"${e} t="inlineStr"><is><t xml:space="preserve">${xmlEscape(o)}</t></is></c>`;
129
- }
130
- class XlsxWorkbookWriter {
131
- constructor(s = {}) {
132
- this.opts = s;
133
- }
134
- async write(s, l) {
135
- const o = await this.openStream({ sheetName: s.sheetName, header: s.header, colWidthsPx: s.colWidthsPx }, l);
136
- return await o.appendRows(s.rows, s.merges), o.finish();
137
- }
138
- async openStream(s, l) {
139
- const o = this.opts.level ?? 6, e = [];
140
- let i = 0;
141
- const h = (f) => {
142
- e.push(f), i += f.length;
143
- }, u = async () => {
144
- for (; e.length > 0; ) await l.write(e.shift());
145
- }, w = [], U = (f) => {
146
- const n = ENC.encode(f), c = { nameBytes: n, offset: i, crc: 0, csize: 0, usize: 0 }, r = new DataView(new ArrayBuffer(30));
147
- return r.setUint32(0, 67324752, true), r.setUint16(4, 20, true), r.setUint16(6, 8, true), r.setUint16(8, 8, true), r.setUint16(10, DOS_TIME, true), r.setUint16(12, DOS_DATE, true), r.setUint16(26, n.length, true), h(new Uint8Array(r.buffer)), h(n), w.push(c), { push(I, p) {
148
- if (c.crc = crc32(I, c.crc), c.usize += I.length, c.usize > 4294967295 || i > 4294967295) throw new Error("xlsx too large (ZIP64 unsupported)");
149
- const T = deflateChunk(I, o);
150
- if (T.length > 0 && (c.csize += T.length, h(T)), p) {
151
- c.csize += DEFLATE_END.length, h(DEFLATE_END);
152
- const S = new DataView(new ArrayBuffer(16));
153
- S.setUint32(0, 134695760, true), S.setUint32(4, c.crc, true), S.setUint32(8, c.csize, true), S.setUint32(12, c.usize, true), h(new Uint8Array(S.buffer));
154
- }
155
- } };
156
- }, b = { end() {
157
- const f = i;
158
- for (const c of w) {
159
- const r = new DataView(new ArrayBuffer(46));
160
- r.setUint32(0, 33639248, true), r.setUint16(4, 20, true), r.setUint16(6, 20, true), r.setUint16(8, 8, true), r.setUint16(10, 8, true), r.setUint16(12, DOS_TIME, true), r.setUint16(14, DOS_DATE, true), r.setUint32(16, c.crc, true), r.setUint32(20, c.csize, true), r.setUint32(24, c.usize, true), r.setUint16(28, c.nameBytes.length, true), r.setUint32(42, c.offset, true), h(new Uint8Array(r.buffer)), h(c.nameBytes);
161
- }
162
- if (f > 4294967295 || i + 22 > 4294967295) throw new Error("xlsx too large (ZIP64 unsupported)");
163
- const n = new DataView(new ArrayBuffer(22));
164
- n.setUint32(0, 101010256, true), n.setUint16(8, w.length, true), n.setUint16(10, w.length, true), n.setUint32(12, i - f, true), n.setUint32(16, f, true), h(new Uint8Array(n.buffer));
165
- } }, d = async (f, n) => {
166
- U(f).push(ENC.encode(n), true), await u();
167
- };
168
- await d("[Content_Types].xml", CONTENT_TYPES), await d("_rels/.rels", ROOT_RELS), await d("xl/workbook.xml", workbookXml(s.sheetName)), await d("xl/_rels/workbook.xml.rels", WB_RELS), await d("xl/styles.xml", STYLES);
169
- const y = U("xl/worksheets/sheet1.xml"), E = s.header.length;
170
- let m = XML_HEAD + `<worksheet xmlns="${NS}">`;
171
- s.colWidthsPx.length > 0 && (m += "<cols>" + s.colWidthsPx.map((f, n) => `<col min="${n + 1}" max="${n + 1}" width="${Math.max(1, Math.round(f / 7 * 100) / 100)}" customWidth="1"/>`).join("") + "</cols>"), m += "<sheetData>";
172
- const g = E > 0 && s.includeHeader !== false;
173
- g && (m += '<row r="1">' + s.header.map((f, n) => cellXml(`${colName(n)}1`, S_HEADER, void 0, f)).join("") + "</row>"), y.push(ENC.encode(m), false), await u();
174
- let a = g ? 2 : 1;
175
- const x = [];
176
- return { appendRows: async (f, n) => {
177
- let c = "";
178
- for (const r of f) {
179
- const I = a % 2 === 1 ? S_STRIPE : S_DEFAULT;
180
- c += `<row r="${a}">`;
181
- for (let p = 0; p < r.length; p++) {
182
- const T = r[p];
183
- c += cellXml(`${colName(p)}${a}`, I, T.num, T.value);
184
- }
185
- c += "</row>", a++;
186
- }
187
- if (n) for (const r of n) x.push(r);
188
- c !== "" && y.push(ENC.encode(c), false), await u();
189
- }, finish: async () => {
190
- let f = "</sheetData>";
191
- return x.length > 0 && (f += `<mergeCells count="${x.length}">` + x.map((n) => `<mergeCell ref="${colName(n.c)}${n.r + 1}:${colName(n.c + n.cs - 1)}${n.r + n.rs}"/>`).join("") + "</mergeCells>"), f += "</worksheet>", y.push(ENC.encode(f), true), b.end(), await u(), i;
192
- }, abort: () => {
193
- e.length = 0;
194
- } };
195
- }
196
- }
197
- exports.XlsxWorkbookWriter = XlsxWorkbookWriter, exports.xmlEscape = xmlEscape;
198
- //# sourceMappingURL=XlsxWorkbookWriter-_u5stfg4.cjs.map
@@ -1,481 +0,0 @@
1
- import { T as $ } from "./Registry-CPJYOqCn.js";
2
- import { p as ne, c as I } from "./OpenGrid-BmagF0yo.js";
3
- function z(e) {
4
- return !!e && typeof e.ref == "string";
5
- }
6
- const N = 1;
7
- function re(e, t) {
8
- return JSON.stringify(e) === JSON.stringify(t);
9
- }
10
- function oe(e) {
11
- const t = (e == null ? void 0 : e.primary) ?? "#1976d2", n = (e == null ? void 0 : e.graphite) ?? "#3a3f45";
12
- return { rampFrom: (r) => r === "primary" ? t : n };
13
- }
14
- function se(e) {
15
- const t = [];
16
- for (const n of e) {
17
- const r = typeof n == "number" ? n : typeof n == "string" && n.trim() !== "" ? Number(n) : NaN;
18
- Number.isFinite(r) && t.push(r);
19
- }
20
- return t;
21
- }
22
- function ie(e) {
23
- const t = se(e), n = t.length;
24
- if (n === 0) return { count: 0, distinct: 0 };
25
- const r = [...t].sort((p, g) => p - g), s = r[0], o = r[n - 1], a = t.reduce((p, g) => p + g, 0) / n, c = t.reduce((p, g) => p + (g - a) ** 2, 0) / n, l = Math.sqrt(c), f = /* @__PURE__ */ new Map();
26
- for (const p of t) f.set(p, (f.get(p) ?? 0) + 1);
27
- const d = f.size;
28
- return { min: s, max: o, avg: a, stddev: l, count: n, distinct: d, rankOf: (p) => {
29
- let g = 0;
30
- for (const k of t) k > p && g++;
31
- return g + 1;
32
- }, rankAscOf: (p) => {
33
- let g = 0;
34
- for (const k of t) k < p && g++;
35
- return g + 1;
36
- }, percentileOf: (p) => {
37
- let g = 0;
38
- for (const k of t) k <= p && g++;
39
- return g / n;
40
- }, countOf: (p) => f.get(p) ?? 0 };
41
- }
42
- function Y(e) {
43
- const t = {};
44
- return e.min !== void 0 && (t.min = e.min), e.max !== void 0 && (t.max = e.max), e.avg !== void 0 && (t.avg = e.avg), e.stddev !== void 0 && (t.stddev = e.stddev), e.count !== void 0 && (t.count = e.count), e.distinct !== void 0 && (t.distinct = e.distinct), t;
45
- }
46
- function b(e) {
47
- return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
48
- }
49
- const h = 864e5;
50
- function w(e) {
51
- const t = new Date(e);
52
- return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
53
- }
54
- function L(e) {
55
- const t = w(e), n = new Date(t).getDay();
56
- return t - n * h;
57
- }
58
- const ae = { needs: [], test(e, t) {
59
- const n = b(t.value);
60
- if (!Number.isFinite(n)) return false;
61
- switch (e.op) {
62
- case ">":
63
- return n > e.a;
64
- case ">=":
65
- return n >= e.a;
66
- case "<":
67
- return n < e.a;
68
- case "<=":
69
- return n <= e.a;
70
- case "=":
71
- return n === e.a;
72
- case "!=":
73
- return n !== e.a;
74
- case "between":
75
- return e.b !== void 0 && n >= Math.min(e.a, e.b) && n <= Math.max(e.a, e.b);
76
- default:
77
- return false;
78
- }
79
- } }, ce = { needs: [], test(e, t) {
80
- const n = t.value == null ? "" : String(t.value);
81
- return e.ci === false ? n.includes(e.text) : n.toLowerCase().includes(e.text.toLowerCase());
82
- } }, ue = { needs: [], test(e, t, n, r) {
83
- const s = t.value, o = s instanceof Date ? s.getTime() : typeof s == "number" ? s : Date.parse(String(s));
84
- if (!Number.isFinite(o)) return false;
85
- const i = r.now, a = w(i);
86
- switch (e.rel) {
87
- case "today":
88
- return w(o) === a;
89
- case "yesterday":
90
- return w(o) === a - h;
91
- case "tomorrow":
92
- return w(o) === a + h;
93
- case "thisWeek": {
94
- const c = L(i);
95
- return o >= c && o < c + 7 * h;
96
- }
97
- case "lastWeek": {
98
- const c = L(i) - 7 * h;
99
- return o >= c && o < c + 7 * h;
100
- }
101
- case "thisMonth": {
102
- const c = new Date(i);
103
- return new Date(o).getFullYear() === c.getFullYear() && new Date(o).getMonth() === c.getMonth();
104
- }
105
- case "lastMonth": {
106
- const c = new Date(i.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
107
- return new Date(o).getFullYear() === l.getFullYear() && new Date(o).getMonth() === l.getMonth();
108
- }
109
- case "next7d":
110
- return o >= a && o < a + 7 * h;
111
- case "last7d":
112
- return o < a + h && o >= a - 6 * h;
113
- default:
114
- return false;
115
- }
116
- } }, le = { needs: ["rank"], test(e, t, n) {
117
- const r = b(t.value);
118
- return Number.isFinite(r) ? e.bottom ? n.rankAscOf ? n.rankAscOf(r) <= e.n : false : n.rankOf ? n.rankOf(r) <= e.n : false : false;
119
- } }, de = { needs: ["percentile"], test(e, t, n) {
120
- const r = b(t.value);
121
- if (!Number.isFinite(r) || !n.percentileOf) return false;
122
- const s = n.percentileOf(r);
123
- return e.bottom ? s <= e.pct / 100 : s >= 1 - e.pct / 100;
124
- } }, fe = { needs: ["avg"], test(e, t, n) {
125
- const r = b(t.value);
126
- return !Number.isFinite(r) || n.avg === void 0 ? false : e.below ? r < n.avg : r > n.avg;
127
- } }, me = { needs: ["avg", "stddev"], test(e, t, n) {
128
- const r = b(t.value);
129
- if (!Number.isFinite(r) || n.avg === void 0 || n.stddev === void 0) return false;
130
- const s = Math.abs(r - n.avg), o = e.k * n.stddev;
131
- return e.outside === false ? s <= o : s >= o;
132
- } }, pe = { needs: ["cardinality"], test(e, t, n) {
133
- const r = b(t.value);
134
- if (!Number.isFinite(r) || !n.countOf) return false;
135
- const s = n.countOf(r);
136
- return e.unique ? s === 1 : s > 1;
137
- } }, ge = { needs: [], test() {
138
- return false;
139
- } }, W = Object.freeze({ compare: ae, textContains: ce, dateOccurring: ue, topN: le, topNpct: de, aboveAvg: fe, stdBand: me, duplicate: pe, custom: ge });
140
- function q() {
141
- const e = new $({ spi: { name: "CFPredicate", version: "1" } });
142
- for (const [t, n] of Object.entries(W)) e.register(t, n, { origin: "builtin" });
143
- return e;
144
- }
145
- function U(e, t) {
146
- const n = e.scope;
147
- return !(n.columnId !== t.columnId || n.range && (t.rowIndex < n.range.startRow || t.rowIndex >= n.range.endRow) || n.rowState && n.rowState !== t.rowState);
148
- }
149
- function he(e) {
150
- return [...e].sort((t, n) => t.priority - n.priority || (t.id < n.id ? -1 : t.id > n.id ? 1 : 0));
151
- }
152
- function ye(e) {
153
- return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
154
- }
155
- function v(e) {
156
- return e < 0 ? 0 : e > 1 ? 1 : e;
157
- }
158
- function V(e, t, n) {
159
- const r = ye(t), s = Number.isFinite(r), o = !s || r === 0 ? 0 : r > 0 ? 1 : -1, i = n.min ?? 0, a = n.max ?? 0;
160
- if (e.kind === "bar") {
161
- if (!s) return { sign: 0 };
162
- const c = e.axis ?? "zero";
163
- let l, f = false;
164
- if (c === "zero") {
165
- const d = Math.max(Math.abs(i), Math.abs(a)) || 1, u = Math.abs(r) / d;
166
- l = v(u), e.clamp && u > 1 && (f = true);
167
- } else {
168
- const d = a - i || 1, u = (r - i) / d;
169
- l = v(u), e.clamp && (u < 0 || u > 1) && (f = true);
170
- }
171
- return { ratio: l, sign: o, value: r, clamped: f };
172
- }
173
- if (e.kind === "scale") {
174
- if (!s) return { sign: 0 };
175
- const c = e.mode ?? "discrete";
176
- let l;
177
- if (e.diverging) {
178
- const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (i + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
179
- if (r <= u) {
180
- const m = u - i || 1;
181
- l = 0.5 * v((r - i) / m);
182
- } else {
183
- const m = a - u || 1;
184
- l = 0.5 + 0.5 * v((r - u) / m);
185
- }
186
- } else {
187
- const u = a - i || 1;
188
- l = v((r - i) / u);
189
- }
190
- if (c === "continuous") return { ratio: l, sign: o, value: r };
191
- const f = e.diverging ? Math.max(3, Math.min(5, e.bands ?? 3)) : Math.max(2, Math.min(5, e.bands ?? 3)), d = Math.min(f - 1, Math.floor(l * f));
192
- return { ratio: l, bandIndex: d, bandCount: f, sign: o, value: r };
193
- }
194
- if (e.kind === "icon") {
195
- if (!s) return { sign: 0 };
196
- const c = e.steps ?? 3, l = a - i || 1, f = v((r - i) / l);
197
- let d = Math.min(c - 1, Math.floor(f * c));
198
- return e.reverse && (d = c - 1 - d), { bandIndex: d, bandCount: c, ratio: f, sign: o, value: r };
199
- }
200
- return s ? { sign: o, value: r } : { sign: o };
201
- }
202
- function be(e, t) {
203
- return e.get(t);
204
- }
205
- class H {
206
- constructor(t) {
207
- this.ruleTypes = t;
208
- }
209
- evaluate(t, n, r, s) {
210
- const o = he(t.filter((u) => U(u, n)));
211
- let i;
212
- const a = [], c = [];
213
- let l;
214
- for (const u of o) {
215
- const m = be(this.ruleTypes, u.when.type);
216
- if (!m) continue;
217
- let y = false;
218
- try {
219
- y = m.test(u.when, n, r, s);
220
- } catch {
221
- y = false;
222
- }
223
- if (!y) continue;
224
- const B = V(u.encode, n.value, r), p = { ruleId: u.id, conditionType: u.when.type, threshold: ve(u), inputValue: n.value, statsUsed: Y(r), priority: u.priority, wonOver: [] }, g = { ruleId: u.id, fired: true, encode: u.encode, datum: B, ...u.style !== void 0 ? { styleRef: u.style } : {}, lineage: p };
225
- if (u.encode.kind === "bar" || u.encode.kind === "scale" ? (i && c.push(i.ruleId), i = g) : a.push(g), u.stopIfTrue) {
226
- l = u.id;
227
- break;
228
- }
229
- }
230
- i && c.length && (i = { ...i, lineage: { ...i.lineage, wonOver: [...c] } });
231
- const f = i ?? a[0], d = { decorators: a };
232
- return i && (d.background = i), f && (d.winner = f), l !== void 0 && (d.stoppedAt = l), d;
233
- }
234
- }
235
- function ve(e) {
236
- const { type: t, ...n } = e.when;
237
- return n;
238
- }
239
- const D = "#f4f5f6";
240
- function A(e) {
241
- const t = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
242
- return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
243
- }
244
- function x(e, t, n) {
245
- const r = n < 0 ? 0 : n > 1 ? 1 : n;
246
- return { r: e.r + (t.r - e.r) * r, g: e.g + (t.g - e.g) * r, b: e.b + (t.b - e.b) * r };
247
- }
248
- function F(e) {
249
- return ne(e) ?? { r: 58, g: 63, b: 69 };
250
- }
251
- function ke(e) {
252
- return x({ r: 255, g: 255, b: 255 }, e, 0.08);
253
- }
254
- function R(e, t) {
255
- const n = F(e);
256
- return A(x(ke(n), n, t));
257
- }
258
- function E(e, t) {
259
- const n = Math.max(2, Math.min(5, Math.floor(t))), r = [];
260
- for (let s = 0; s < n; s++) r.push(R(e, n === 1 ? 0 : s / (n - 1)));
261
- return r;
262
- }
263
- function T(e, t, n, r = D) {
264
- const s = F(r);
265
- return n <= 0.5 ? A(x(F(e), s, n / 0.5)) : A(x(s, F(t), (n - 0.5) / 0.5));
266
- }
267
- function J(e, t, n, r = D) {
268
- const s = Math.max(3, Math.min(5, Math.floor(n))), o = [];
269
- for (let i = 0; i < s; i++) o.push(T(e, t, s === 1 ? 0.5 : i / (s - 1), r));
270
- return o;
271
- }
272
- const P = 4.5, O = "#111111", C = "#ffffff";
273
- class G {
274
- pickInk(t) {
275
- const n = I(O, t), r = I(C, t), s = r >= n, o = s ? C : O, i = s ? r : n;
276
- return i >= P ? { color: o, ratio: i } : { color: o, outline: true, outlineColor: s ? O : C, ratio: i };
277
- }
278
- }
279
- function we(e) {
280
- return Math.max(I(O, e), I(C, e)) >= P;
281
- }
282
- const K = new G(), _ = "#111111";
283
- function S(e) {
284
- return e === void 0 || !Number.isFinite(e) ? "—" : Number.isInteger(e) ? String(e) : String(Math.round(e * 1e3) / 1e3);
285
- }
286
- function j(e) {
287
- return e === void 0 ? "—" : `${Math.round(e * 100)}%`;
288
- }
289
- class Q {
290
- constructor() {
291
- this.kind = "bar";
292
- }
293
- encode(t, n, r) {
294
- const s = t.encode, o = t.datum;
295
- if (o.value === void 0) return { layer: "background", inkColor: _, ariaSummary: "값 없음" };
296
- const i = s.seed ?? (o.sign === -1 ? "graphite" : "primary"), a = n.rampFrom(i), l = (s.axis ?? "zero") === "zero" && o.sign === -1 ? "right" : "left", f = K.pickInk(a), d = o.ratio ?? 0, u = o.clamped ? " (범위 초과·클램프)" : "", m = s.log ? " (log)" : "", y = `값 ${S(o.value)}, 막대 ${j(d)}${o.sign === -1 ? " 음수" : ""}${u}${m}`;
297
- return { layer: "background", fill: { color: a, from: l, ratio: d }, inkColor: f.color, ...f.outline ? { inkOutline: true } : {}, ...o.clamped ? { clamped: true } : {}, ariaSummary: y };
298
- }
299
- }
300
- class X {
301
- constructor() {
302
- this.kind = "scale";
303
- }
304
- encode(t, n, r) {
305
- const s = t.encode, o = t.datum;
306
- if (o.value === void 0) return { layer: "background", inkColor: _, ariaSummary: "값 없음" };
307
- const i = s.mode ?? "discrete";
308
- let a, c = "";
309
- if (s.diverging) {
310
- const d = n.rampFrom("graphite"), u = n.rampFrom("primary");
311
- if (i === "continuous") a = T(d, u, o.ratio ?? 0.5);
312
- else {
313
- const m = J(d, u, o.bandCount ?? 3);
314
- a = m[o.bandIndex ?? 0] ?? m[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? m.length})`;
315
- }
316
- } else {
317
- const d = s.seed ?? "graphite", u = n.rampFrom(d);
318
- if (i === "continuous") a = R(u, o.ratio ?? 0);
319
- else {
320
- const m = E(u, o.bandCount ?? 3);
321
- a = m[o.bandIndex ?? 0] ?? m[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? m.length})`;
322
- }
323
- }
324
- const l = K.pickInk(a), f = `값 ${S(o.value)}, 히트맵 ${j(o.ratio)}${c}`;
325
- return { layer: "background", fill: { color: a, ratio: o.ratio ?? 0 }, inkColor: l.color, ...l.outline ? { inkOutline: true } : {}, ariaSummary: f };
326
- }
327
- }
328
- function Me(e, t) {
329
- return t <= 1 ? "circle" : e <= 0 ? "triangleDown" : e >= t - 1 ? "triangleUp" : "circle";
330
- }
331
- class Z {
332
- constructor() {
333
- this.kind = "icon";
334
- }
335
- encode(t, n, r) {
336
- const s = t.encode, o = t.datum;
337
- if (o.value === void 0) return { layer: "decorator", inkColor: _, ariaSummary: "값 없음" };
338
- const i = o.bandCount ?? s.steps ?? 3, a = o.bandIndex ?? 0, c = Me(a, i), l = E(n.rampFrom("graphite"), Math.max(2, i)), f = l[Math.min(l.length - 1, a)] ?? l[0], d = `cf-icon-${a}-of-${i}`, u = a <= 0 ? "하위" : a >= i - 1 ? "상위" : "중간", m = `값 ${S(o.value)}, ${u} 구간 ${a + 1}/${i} (${c})`;
339
- return { layer: "decorator", glyph: { role: d, tint: f, shape: c }, inkColor: f, ariaSummary: m };
340
- }
341
- }
342
- class ee {
343
- constructor() {
344
- this.kind = "sparkline";
345
- }
346
- encode(t, n, r) {
347
- const s = t.encode, o = t.datum;
348
- return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${s.chart ?? "line"} 스파크, 값 ${S(o.value)}` };
349
- }
350
- }
351
- function te() {
352
- const e = new $({ spi: { name: "CFEncoder", version: "1" } });
353
- return e.register("bar", new Q(), { origin: "builtin" }), e.register("scale", new X(), { origin: "builtin" }), e.register("icon", new Z(), { origin: "builtin" }), e.register("sparkline", new ee(), { origin: "builtin" }), e;
354
- }
355
- function Ie() {
356
- return new $({ spi: { name: "CFNamedStyle", version: "1" } });
357
- }
358
- function M(e) {
359
- return typeof e == "object" && e !== null;
360
- }
361
- class Ne {
362
- load(t, n) {
363
- const r = [], s = [], o = Array.isArray(t) ? t : M(t) && Array.isArray(t.rules) ? t.rules : [];
364
- for (const i of o) {
365
- if (!M(i)) {
366
- s.push({ ruleId: "?", reason: "malformed", detail: "not an object" });
367
- continue;
368
- }
369
- const a = typeof i.id == "string" ? i.id : "?", c = i.when, l = i.encode, f = i.scope;
370
- if (typeof i.v == "number" && i.v > N) {
371
- s.push({ ruleId: a, reason: "future-version", detail: `v${i.v} > ${N}` });
372
- continue;
373
- }
374
- if (!M(c) || typeof c.type != "string" || !M(l) || typeof l.kind != "string" || !M(f) || typeof f.columnId != "string") {
375
- s.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
376
- continue;
377
- }
378
- if (!n.types.has(c.type)) {
379
- s.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
380
- continue;
381
- }
382
- if (!n.encoders.has(l.kind)) {
383
- s.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
384
- continue;
385
- }
386
- const d = i.style;
387
- if (z(d) && !n.styles.has(d.ref)) {
388
- s.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
389
- continue;
390
- }
391
- r.push(i);
392
- }
393
- return { rules: r, skipped: s };
394
- }
395
- }
396
- function xe(e) {
397
- return JSON.stringify({ v: N, rules: e });
398
- }
399
- class Fe {
400
- constructor(t = []) {
401
- this.byColumn = /* @__PURE__ */ new Map(), this.all = [];
402
- for (const n of t) this.add(n);
403
- }
404
- add(t) {
405
- this.all.push(t);
406
- const n = this.byColumn.get(t.scope.columnId) ?? [];
407
- n.push(t), this.byColumn.set(t.scope.columnId, n);
408
- }
409
- rulesFor(t) {
410
- return this.byColumn.get(t) ?? [];
411
- }
412
- list() {
413
- return this.all;
414
- }
415
- }
416
- class Oe {
417
- constructor(t, n = te(), r = q(), s) {
418
- this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = s ?? new H(r);
419
- }
420
- get lineage() {
421
- return this;
422
- }
423
- paintFor(t, n, r, s, o) {
424
- const i = this.evaluator.evaluate(this.rules.rulesFor(t.columnId), t, n, o), a = [];
425
- if (i.background) {
426
- const c = this.encoders.get(i.background.encode.kind);
427
- c && a.push(c.encode(i.background, r, s));
428
- }
429
- for (const c of i.decorators) {
430
- const l = this.encoders.get(c.encode.kind);
431
- l && a.push(l.encode(c, r, s));
432
- }
433
- return a;
434
- }
435
- statsNeedsFor(t) {
436
- const n = /* @__PURE__ */ new Set();
437
- for (const r of this.rules.rulesFor(t)) {
438
- const s = this.ruleTypes.get(r.when.type);
439
- if (s) for (const o of s.needs) n.add(o);
440
- }
441
- return [...n].sort();
442
- }
443
- explain(t, n, r, s) {
444
- const o = this.evaluator.evaluate(n, t, r, s), i = [];
445
- o.background && i.push(o.background.lineage);
446
- for (const a of o.decorators) i.push(a.lineage);
447
- return i.sort((a, c) => a.priority - c.priority);
448
- }
449
- }
450
- export {
451
- P as AA_BODY,
452
- W as BUILTIN_PREDICATES,
453
- Q as BarEncoder,
454
- Oe as CFEngine,
455
- Fe as CFRuleStore,
456
- N as CF_SCHEMA_VERSION,
457
- H as DefaultCFEvaluator,
458
- Ne as DefaultCFRuleLoader,
459
- G as DefaultInkResolver,
460
- Z as IconEncoder,
461
- D as NEUTRAL_MIDPOINT,
462
- X as ScaleEncoder,
463
- ee as SparklineEncoder,
464
- re as cfRuleEquals,
465
- ie as computeColumnStats,
466
- V as computeDatum,
467
- te as createEncoderRegistry,
468
- Ie as createNamedStyleRegistry,
469
- q as createRuleTypeRegistry,
470
- J as divergingBands,
471
- T as divergingColor,
472
- z as isStyleRef,
473
- we as passesInkGate,
474
- U as scopeMatches,
475
- E as sequentialBands,
476
- R as sequentialColor,
477
- xe as serializeRules,
478
- Y as snapshotStats,
479
- oe as staticAppearanceView
480
- };
481
- //# sourceMappingURL=index-B9_g5Eg3.js.map