@fileverse-dev/dsheet 4.0.3 → 4.0.5

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 (41) hide show
  1. package/dist/{constants-Cdz6oSCq.js → constants-CRFfbkoQ.js} +1 -1
  2. package/dist/constants.js +1 -1
  3. package/dist/{crypto-constants-CqpCRs86.js → crypto-constants-ZTlAYRUf.js} +33 -22
  4. package/dist/editor/components/sidebar/use-right-panels.d.ts +1 -1
  5. package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
  6. package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -3
  7. package/dist/editor/utils/compact-committed-celldata.d.ts +11 -10
  8. package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
  9. package/dist/editor/utils/import-compaction.d.ts +25 -0
  10. package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
  11. package/dist/editor/utils/xlsx-import-pipeline.d.ts +28 -0
  12. package/dist/{executeStringFunction-BQvE7aeV.js → executeStringFunction-B6fhDKyN.js} +7014 -6490
  13. package/dist/formula.js +1 -1
  14. package/dist/{index-CeTa91qc.js → index-BqGOKo9u.js} +15445 -14688
  15. package/dist/index.es.js +22 -22
  16. package/dist/sheet-engine/core/api/common.d.ts +1 -0
  17. package/dist/sheet-engine/core/context.d.ts +3 -1
  18. package/dist/sheet-engine/core/index.d.ts +2 -2
  19. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +11 -0
  20. package/dist/sheet-engine/core/modules/formula.d.ts +27 -0
  21. package/dist/sheet-engine/core/modules/index.d.ts +3 -2
  22. package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
  23. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +2 -0
  24. package/dist/sheet-engine/core/settings.d.ts +2 -0
  25. package/dist/sheet-engine/core/types.d.ts +21 -0
  26. package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
  27. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -0
  28. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  29. package/dist/style.css +1 -1
  30. package/dist/{template-data-list-oP1s0Uxn.js → template-data-list-RKnVLsuf.js} +51 -50
  31. package/dist/use-xlsx-import-impl-Bddlxx23.js +1898 -0
  32. package/dist/worker/dsheet-worker-client.d.ts +14 -0
  33. package/dist/worker/dsheet-worker.d.ts +14 -0
  34. package/dist/xlsx-defined-names-DsWdNZw-.js +117 -0
  35. package/dist/xlsx-export-impl-DJiXCevi.js +831 -0
  36. package/dist/xlsx-hyperlink-inline-CTg4_gg1.js +2512 -0
  37. package/package.json +5 -4
  38. package/dist/use-xlsx-import-impl-BVsfV8ZV.js +0 -1572
  39. package/dist/xlsx-export-impl-Ber9FhFY.js +0 -3138
  40. package/dist/xlsx-hyperlink-inline-DzewAypN.js +0 -71
  41. package/dist/xlsx-image-utils-Cvg0qxRA.js +0 -126
@@ -1,1572 +0,0 @@
1
- import { g as et } from "./executeStringFunction-BQvE7aeV.js";
2
- import * as Ge from "yjs";
3
- import { m as tt, y as rt, r as nt } from "./index-CeTa91qc.js";
4
- import { n as at } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
- import { toast as ze } from "@fileverse/ui";
6
- var Je = { exports: {} };
7
- (function(y) {
8
- var u = {}, g = function(w) {
9
- w.version = "0.11.2";
10
- function C(t) {
11
- for (var e = "", n = t.length - 1; n >= 0; ) e += t.charAt(n--);
12
- return e;
13
- }
14
- function S(t, e) {
15
- for (var n = ""; n.length < e; ) n += t;
16
- return n;
17
- }
18
- function F(t, e) {
19
- var n = "" + t;
20
- return n.length >= e ? n : S("0", e - n.length) + n;
21
- }
22
- function R(t, e) {
23
- var n = "" + t;
24
- return n.length >= e ? n : S(" ", e - n.length) + n;
25
- }
26
- function B(t, e) {
27
- var n = "" + t;
28
- return n.length >= e ? n : n + S(" ", e - n.length);
29
- }
30
- function ee(t, e) {
31
- var n = "" + Math.round(t);
32
- return n.length >= e ? n : S("0", e - n.length) + n;
33
- }
34
- function ke(t, e) {
35
- var n = "" + t;
36
- return n.length >= e ? n : S("0", e - n.length) + n;
37
- }
38
- var D = Math.pow(2, 32);
39
- function Z(t, e) {
40
- if (t > D || t < -D) return ee(t, e);
41
- var n = Math.round(t);
42
- return ke(n, e);
43
- }
44
- function le(t, e) {
45
- return e = e || 0, t.length >= 7 + e && (t.charCodeAt(e) | 32) === 103 && (t.charCodeAt(e + 1) | 32) === 101 && (t.charCodeAt(e + 2) | 32) === 110 && (t.charCodeAt(e + 3) | 32) === 101 && (t.charCodeAt(e + 4) | 32) === 114 && (t.charCodeAt(e + 5) | 32) === 97 && (t.charCodeAt(e + 6) | 32) === 108;
46
- }
47
- var Ee = [
48
- ["Sun", "Sunday"],
49
- ["Mon", "Monday"],
50
- ["Tue", "Tuesday"],
51
- ["Wed", "Wednesday"],
52
- ["Thu", "Thursday"],
53
- ["Fri", "Friday"],
54
- ["Sat", "Saturday"]
55
- ], _e = [
56
- ["J", "Jan", "January"],
57
- ["F", "Feb", "February"],
58
- ["M", "Mar", "March"],
59
- ["A", "Apr", "April"],
60
- ["M", "May", "May"],
61
- ["J", "Jun", "June"],
62
- ["J", "Jul", "July"],
63
- ["A", "Aug", "August"],
64
- ["S", "Sep", "September"],
65
- ["O", "Oct", "October"],
66
- ["N", "Nov", "November"],
67
- ["D", "Dec", "December"]
68
- ];
69
- function $e(t) {
70
- t[0] = "General", t[1] = "0", t[2] = "0.00", t[3] = "#,##0", t[4] = "#,##0.00", t[9] = "0%", t[10] = "0.00%", t[11] = "0.00E+00", t[12] = "# ?/?", t[13] = "# ??/??", t[14] = "m/d/yy", t[15] = "d-mmm-yy", t[16] = "d-mmm", t[17] = "mmm-yy", t[18] = "h:mm AM/PM", t[19] = "h:mm:ss AM/PM", t[20] = "h:mm", t[21] = "h:mm:ss", t[22] = "m/d/yy h:mm", t[37] = "#,##0 ;(#,##0)", t[38] = "#,##0 ;[Red](#,##0)", t[39] = "#,##0.00;(#,##0.00)", t[40] = "#,##0.00;[Red](#,##0.00)", t[45] = "mm:ss", t[46] = "[h]:mm:ss", t[47] = "mmss.0", t[48] = "##0.0E+0", t[49] = "@", t[56] = '"上午/下午 "hh"時"mm"分"ss"秒 "';
71
- }
72
- var ce = {};
73
- $e(ce);
74
- var J = [], M = 0;
75
- for (M = 5; M <= 8; ++M) J[M] = 32 + M;
76
- for (M = 23; M <= 26; ++M) J[M] = 0;
77
- for (M = 27; M <= 31; ++M) J[M] = 14;
78
- for (M = 50; M <= 58; ++M) J[M] = 14;
79
- for (M = 59; M <= 62; ++M) J[M] = M - 58;
80
- for (M = 67; M <= 68; ++M) J[M] = M - 58;
81
- for (M = 72; M <= 75; ++M) J[M] = M - 58;
82
- for (M = 67; M <= 68; ++M) J[M] = M - 57;
83
- for (M = 76; M <= 78; ++M) J[M] = M - 56;
84
- for (M = 79; M <= 81; ++M) J[M] = M - 34;
85
- var z = [];
86
- z[5] = z[63] = '"$"#,##0_);\\("$"#,##0\\)', z[6] = z[64] = '"$"#,##0_);[Red]\\("$"#,##0\\)', z[7] = z[65] = '"$"#,##0.00_);\\("$"#,##0.00\\)', z[8] = z[66] = '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', z[41] = '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', z[42] = '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', z[43] = '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', z[44] = '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';
87
- function ge(t, e, n) {
88
- for (var m = t < 0 ? -1 : 1, i = t * m, o = 0, r = 1, h = 0, x = 1, d = 0, _ = 0, A = Math.floor(i); d < e && (A = Math.floor(i), h = A * r + o, _ = A * d + x, !(i - A < 5e-8)); )
89
- i = 1 / (i - A), o = r, r = h, x = d, d = _;
90
- if (_ > e && (d > e ? (_ = x, h = o) : (_ = d, h = r)), !n) return [0, m * h, _];
91
- var P = Math.floor(m * h / _);
92
- return [P, m * h - P * _, _];
93
- }
94
- function de(t, e, n) {
95
- if (t > 2958465 || t < 0) return null;
96
- var m = t | 0, i = Math.floor(86400 * (t - m)), o = 0, r = [], h = { D: m, T: i, u: 86400 * (t - m) - i, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
97
- if (Math.abs(h.u) < 1e-6 && (h.u = 0), e && e.date1904 && (m += 1462), h.u > 0.9999 && (h.u = 0, ++i == 86400 && (h.T = i = 0, ++m, ++h.D)), m === 60)
98
- r = n ? [1317, 10, 29] : [1900, 2, 29], o = 3;
99
- else if (m === 0)
100
- r = n ? [1317, 8, 29] : [1900, 1, 0], o = 6;
101
- else {
102
- m > 60 && --m;
103
- var x = new Date(1900, 0, 1);
104
- x.setDate(x.getDate() + m - 1), r = [x.getFullYear(), x.getMonth() + 1, x.getDate()], o = x.getDay(), m < 60 && (o = (o + 6) % 7), n && (o = xe(x, r));
105
- }
106
- return h.y = r[0], h.m = r[1], h.d = r[2], h.S = i % 60, i = Math.floor(i / 60), h.M = i % 60, i = Math.floor(i / 60), h.H = i, h.q = o, h;
107
- }
108
- w.parse_date_code = de;
109
- var Ne = new Date(1899, 11, 31, 0, 0, 0), Re = Ne.getTime(), Le = new Date(1900, 2, 1, 0, 0, 0);
110
- function Te(t, e) {
111
- var n = t.getTime();
112
- return e ? n -= 1262304e5 : t >= Le && (n += 864e5), (n - (Re + (t.getTimezoneOffset() - Ne.getTimezoneOffset()) * 6e4)) / 864e5;
113
- }
114
- function He(t) {
115
- return t.toString(10);
116
- }
117
- w._general_int = He;
118
- var Fe = /* @__PURE__ */ function() {
119
- var e = /(?:\.0*|(\.\d*[1-9])0+)$/;
120
- function n(d) {
121
- return d.indexOf(".") == -1 ? d : d.replace(e, "$1");
122
- }
123
- var m = /(?:\.0*|(\.\d*[1-9])0+)[Ee]/, i = /(E[+-])(\d)$/;
124
- function o(d) {
125
- return d.indexOf("E") == -1 ? d : d.replace(m, "$1E").replace(i, "$10$2");
126
- }
127
- function r(d) {
128
- var _ = d < 0 ? 12 : 11, A = n(d.toFixed(12));
129
- return A.length <= _ || (A = d.toPrecision(10), A.length <= _) ? A : d.toExponential(5);
130
- }
131
- function h(d) {
132
- var _ = n(d.toFixed(11));
133
- return _.length > (d < 0 ? 12 : 11) || _ === "0" || _ === "-0" ? d.toPrecision(6) : _;
134
- }
135
- function x(d) {
136
- var _ = Math.floor(Math.log(Math.abs(d)) * Math.LOG10E), A;
137
- return _ >= -4 && _ <= -1 ? A = d.toPrecision(10 + _) : Math.abs(_) <= 9 ? A = r(d) : _ === 10 ? A = d.toFixed(10).substr(0, 12) : A = h(d), n(o(A.toUpperCase()));
138
- }
139
- return x;
140
- }();
141
- w._general_num = Fe;
142
- function Ae(t, e) {
143
- switch (typeof t) {
144
- case "string":
145
- return t;
146
- case "boolean":
147
- return t ? "TRUE" : "FALSE";
148
- case "number":
149
- return (t | 0) === t ? t.toString(10) : Fe(t);
150
- case "undefined":
151
- return "";
152
- case "object":
153
- if (t == null) return "";
154
- if (t instanceof Date) return te(14, Te(t, e && e.date1904), e);
155
- }
156
- throw new Error("unsupported value in General format: " + t);
157
- }
158
- w._general = Ae;
159
- function xe(t, e) {
160
- e[0] -= 581;
161
- var n = t.getDay();
162
- return t < 60 && (n = (n + 6) % 7), n;
163
- }
164
- function Ve(t, e, n, m) {
165
- var i = "", o = 0, r = 0, h = n.y, x, d = 0;
166
- switch (t) {
167
- case 98:
168
- h = n.y + 543;
169
- case 121:
170
- switch (e.length) {
171
- case 1:
172
- case 2:
173
- x = h % 100, d = 2;
174
- break;
175
- default:
176
- x = h % 1e4, d = 4;
177
- break;
178
- }
179
- break;
180
- case 109:
181
- switch (e.length) {
182
- case 1:
183
- case 2:
184
- x = n.m, d = e.length;
185
- break;
186
- case 3:
187
- return _e[n.m - 1][1];
188
- case 5:
189
- return _e[n.m - 1][0];
190
- default:
191
- return _e[n.m - 1][2];
192
- }
193
- break;
194
- case 100:
195
- switch (e.length) {
196
- case 1:
197
- case 2:
198
- x = n.d, d = e.length;
199
- break;
200
- case 3:
201
- return Ee[n.q][0];
202
- default:
203
- return Ee[n.q][1];
204
- }
205
- break;
206
- case 104:
207
- switch (e.length) {
208
- case 1:
209
- case 2:
210
- x = 1 + (n.H + 11) % 12, d = e.length;
211
- break;
212
- default:
213
- throw "bad hour format: " + e;
214
- }
215
- break;
216
- case 72:
217
- switch (e.length) {
218
- case 1:
219
- case 2:
220
- x = n.H, d = e.length;
221
- break;
222
- default:
223
- throw "bad hour format: " + e;
224
- }
225
- break;
226
- case 77:
227
- switch (e.length) {
228
- case 1:
229
- case 2:
230
- x = n.M, d = e.length;
231
- break;
232
- default:
233
- throw "bad minute format: " + e;
234
- }
235
- break;
236
- case 115:
237
- if (e != "s" && e != "ss" && e != ".0" && e != ".00" && e != ".000") throw "bad second format: " + e;
238
- return n.u === 0 && (e == "s" || e == "ss") ? F(n.S, e.length) : (m >= 2 ? r = m === 3 ? 1e3 : 100 : r = m === 1 ? 10 : 1, o = Math.round(r * (n.S + n.u)), o >= 60 * r && (o = 0), e === "s" ? o === 0 ? "0" : "" + o / r : (i = F(o, 2 + m), e === "ss" ? i.substr(0, 2) : "." + i.substr(2, e.length - 1)));
239
- case 90:
240
- switch (e) {
241
- case "[h]":
242
- case "[hh]":
243
- x = n.D * 24 + n.H;
244
- break;
245
- case "[m]":
246
- case "[mm]":
247
- x = (n.D * 24 + n.H) * 60 + n.M;
248
- break;
249
- case "[s]":
250
- case "[ss]":
251
- x = ((n.D * 24 + n.H) * 60 + n.M) * 60 + Math.round(n.S + n.u);
252
- break;
253
- default:
254
- throw "bad abstime format: " + e;
255
- }
256
- d = e.length === 3 ? 1 : 2;
257
- break;
258
- case 101:
259
- x = h, d = 1;
260
- break;
261
- }
262
- var _ = d > 0 ? F(x, d) : "";
263
- return _;
264
- }
265
- function oe(t) {
266
- var e = 3;
267
- if (t.length <= e) return t;
268
- for (var n = t.length % e, m = t.substr(0, n); n != t.length; n += e) m += (m.length > 0 ? "," : "") + t.substr(n, e);
269
- return m;
270
- }
271
- var ae = /* @__PURE__ */ function() {
272
- var e = /%/g;
273
- function n(f, a, c) {
274
- var k = a.replace(e, ""), l = a.length - k.length;
275
- return ae(f, k, c * Math.pow(10, 2 * l)) + S("%", l);
276
- }
277
- function m(f, a, c) {
278
- for (var k = a.length - 1; a.charCodeAt(k - 1) === 44; ) --k;
279
- return ae(f, a.substr(0, k), c / Math.pow(10, 3 * (a.length - k)));
280
- }
281
- function i(f, a) {
282
- var c, k = f.indexOf("E") - f.indexOf(".") - 1;
283
- if (f.match(/^#+0.0E\+0$/)) {
284
- if (a == 0) return "0.0E+0";
285
- if (a < 0) return "-" + i(f, -a);
286
- var l = f.indexOf(".");
287
- l === -1 && (l = f.indexOf("E"));
288
- var s = Math.floor(Math.log(a) * Math.LOG10E) % l;
289
- if (s < 0 && (s += l), c = (a / Math.pow(10, s)).toPrecision(k + 1 + (l + s) % l), c.indexOf("e") === -1) {
290
- var O = Math.floor(Math.log(a) * Math.LOG10E);
291
- for (c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (O - c.length + s) : c += "E+" + (O - s); c.substr(0, 2) === "0."; )
292
- c = c.charAt(0) + c.substr(2, l) + "." + c.substr(2 + l), c = c.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
293
- c = c.replace(/\+-/, "-");
294
- }
295
- c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(L, j, W, N) {
296
- return j + W + N.substr(0, (l + s) % l) + "." + N.substr(s) + "E";
297
- });
298
- } else c = a.toExponential(k);
299
- return f.match(/E\+00$/) && c.match(/e[+-]\d$/) && (c = c.substr(0, c.length - 1) + "0" + c.charAt(c.length - 1)), f.match(/E\-/) && c.match(/e\+/) && (c = c.replace(/e\+/, "e")), c.replace("e", "E");
300
- }
301
- var o = /# (\?+)( ?)\/( ?)(\d+)/;
302
- function r(f, a, c) {
303
- var k = parseInt(f[4], 10), l = Math.round(a * k), s = Math.floor(l / k), O = l - s * k, L = k;
304
- return c + (s === 0 ? "" : "" + s) + " " + (O === 0 ? S(" ", f[1].length + 1 + f[4].length) : R(O, f[1].length) + f[2] + "/" + f[3] + F(L, f[4].length));
305
- }
306
- function h(f, a, c) {
307
- return c + (a === 0 ? "" : "" + a) + S(" ", f[1].length + 2 + f[4].length);
308
- }
309
- var x = /^#*0*\.([0#]+)/, d = /\).*[0#]/, _ = /\(###\) ###\\?-####/;
310
- function A(f) {
311
- for (var a = "", c, k = 0; k != f.length; ++k) switch (c = f.charCodeAt(k)) {
312
- case 35:
313
- break;
314
- case 63:
315
- a += " ";
316
- break;
317
- case 48:
318
- a += "0";
319
- break;
320
- default:
321
- a += String.fromCharCode(c);
322
- }
323
- return a;
324
- }
325
- function P(f, a) {
326
- var c = Math.pow(10, a);
327
- return "" + Math.round(f * c) / c;
328
- }
329
- function U(f, a) {
330
- var c = f - Math.floor(f), k = Math.pow(10, a);
331
- return a < ("" + Math.round(c * k)).length ? 0 : Math.round(c * k);
332
- }
333
- function Y(f, a) {
334
- return a < ("" + Math.round((f - Math.floor(f)) * Math.pow(10, a))).length ? 1 : 0;
335
- }
336
- function E(f) {
337
- return f < 2147483647 && f > -2147483648 ? "" + (f >= 0 ? f | 0 : f - 1 | 0) : "" + Math.floor(f);
338
- }
339
- function $(f, a, c) {
340
- if (f.charCodeAt(0) === 40 && !a.match(d)) {
341
- var k = a.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
342
- return c >= 0 ? $("n", k, c) : "(" + $("n", k, -c) + ")";
343
- }
344
- if (a.charCodeAt(a.length - 1) === 44) return m(f, a, c);
345
- if (a.indexOf("%") !== -1) return n(f, a, c);
346
- if (a.indexOf("E") !== -1) return i(a, c);
347
- if (a.charCodeAt(0) === 36) return "$" + $(f, a.substr(a.charAt(1) == " " ? 2 : 1), c);
348
- var l, s, O, L, j = Math.abs(c), W = c < 0 ? "-" : "";
349
- if (a.match(/^00+$/)) return W + Z(j, a.length);
350
- if (a.match(/^[#?]+$/))
351
- return l = Z(c, 0), l === "0" && (l = ""), l.length > a.length ? l : A(a.substr(0, a.length - l.length)) + l;
352
- if (s = a.match(o)) return r(s, j, W);
353
- if (a.match(/^#+0+$/)) return W + Z(j, a.length - a.indexOf("0"));
354
- if (s = a.match(x))
355
- return l = P(c, s[1].length).replace(/^([^\.]+)$/, "$1." + A(s[1])).replace(/\.$/, "." + A(s[1])).replace(/\.(\d*)$/, function(q, pe) {
356
- return "." + pe + S("0", A(s[1]).length - pe.length);
357
- }), a.indexOf("0.") !== -1 ? l : l.replace(/^0\./, ".");
358
- if (a = a.replace(/^#+([0.])/, "$1"), s = a.match(/^(0*)\.(#*)$/))
359
- return W + P(j, s[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, s[1].length ? "0." : ".");
360
- if (s = a.match(/^#{1,3},##0(\.?)$/)) return W + oe(Z(j, 0));
361
- if (s = a.match(/^#,##0\.([#0]*0)$/))
362
- return c < 0 ? "-" + $(f, a, -c) : oe("" + (Math.floor(c) + Y(c, s[1].length))) + "." + F(U(c, s[1].length), s[1].length);
363
- if (s = a.match(/^#,#*,#0/)) return $(f, a.replace(/^#,#*,/, ""), c);
364
- if (s = a.match(/^([0#]+)(\\?-([0#]+))+$/))
365
- return l = C($(f, a.replace(/[\\-]/g, ""), c)), O = 0, C(C(a.replace(/\\/g, "")).replace(/[0#]/g, function(q) {
366
- return O < l.length ? l.charAt(O++) : q === "0" ? "0" : "";
367
- }));
368
- if (a.match(_))
369
- return l = $(f, "##########", c), "(" + l.substr(0, 3) + ") " + l.substr(3, 3) + "-" + l.substr(6);
370
- var N = "";
371
- if (s = a.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
372
- return O = Math.min(s[4].length, 7), L = ge(j, Math.pow(10, O) - 1, !1), l = "" + W, N = ae("n", s[1], L[1]), N.charAt(N.length - 1) == " " && (N = N.substr(0, N.length - 1) + "0"), l += N + s[2] + "/" + s[3], N = B(L[2], O), N.length < s[4].length && (N = A(s[4].substr(s[4].length - N.length)) + N), l += N, l;
373
- if (s = a.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
374
- return O = Math.min(Math.max(s[1].length, s[4].length), 7), L = ge(j, Math.pow(10, O) - 1, !0), W + (L[0] || (L[1] ? "" : "0")) + " " + (L[1] ? R(L[1], O) + s[2] + "/" + s[3] + B(L[2], O) : S(" ", 2 * O + 1 + s[2].length + s[3].length));
375
- if (s = a.match(/^[#0?]+$/))
376
- return l = Z(c, 0), a.length <= l.length ? l : A(a.substr(0, a.length - l.length)) + l;
377
- if (s = a.match(/^([#0?]+)\.([#0]+)$/)) {
378
- l = "" + c.toFixed(Math.min(s[2].length, 10)).replace(/([^0])0+$/, "$1"), O = l.indexOf(".");
379
- var be = a.indexOf(".") - O, Ce = a.length - l.length - be;
380
- return A(a.substr(0, be) + l + a.substr(a.length - Ce));
381
- }
382
- if (s = a.match(/^00,000\.([#0]*0)$/))
383
- return O = U(c, s[1].length), c < 0 ? "-" + $(f, a, -c) : oe(E(c)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(q) {
384
- return "00," + (q.length < 3 ? F(0, 3 - q.length) : "") + q;
385
- }) + "." + F(O, s[1].length);
386
- switch (a) {
387
- case "###,##0.00":
388
- return $(f, "#,##0.00", c);
389
- case "###,###":
390
- case "##,###":
391
- case "#,###":
392
- var me = oe(Z(j, 0));
393
- return me !== "0" ? W + me : "";
394
- case "###,###.00":
395
- return $(f, "###,##0.00", c).replace(/^0\./, ".");
396
- case "#,###.00":
397
- return $(f, "#,##0.00", c).replace(/^0\./, ".");
398
- }
399
- throw new Error("unsupported format |" + a + "|");
400
- }
401
- function G(f, a, c) {
402
- for (var k = a.length - 1; a.charCodeAt(k - 1) === 44; ) --k;
403
- return ae(f, a.substr(0, k), c / Math.pow(10, 3 * (a.length - k)));
404
- }
405
- function se(f, a, c) {
406
- var k = a.replace(e, ""), l = a.length - k.length;
407
- return ae(f, k, c * Math.pow(10, 2 * l)) + S("%", l);
408
- }
409
- function K(f, a) {
410
- var c, k = f.indexOf("E") - f.indexOf(".") - 1;
411
- if (f.match(/^#+0.0E\+0$/)) {
412
- if (a == 0) return "0.0E+0";
413
- if (a < 0) return "-" + K(f, -a);
414
- var l = f.indexOf(".");
415
- l === -1 && (l = f.indexOf("E"));
416
- var s = Math.floor(Math.log(a) * Math.LOG10E) % l;
417
- if (s < 0 && (s += l), c = (a / Math.pow(10, s)).toPrecision(k + 1 + (l + s) % l), !c.match(/[Ee]/)) {
418
- var O = Math.floor(Math.log(a) * Math.LOG10E);
419
- c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (O - c.length + s) : c += "E+" + (O - s), c = c.replace(/\+-/, "-");
420
- }
421
- c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(L, j, W, N) {
422
- return j + W + N.substr(0, (l + s) % l) + "." + N.substr(s) + "E";
423
- });
424
- } else c = a.toExponential(k);
425
- return f.match(/E\+00$/) && c.match(/e[+-]\d$/) && (c = c.substr(0, c.length - 1) + "0" + c.charAt(c.length - 1)), f.match(/E\-/) && c.match(/e\+/) && (c = c.replace(/e\+/, "e")), c.replace("e", "E");
426
- }
427
- function v(f, a, c) {
428
- if (f.charCodeAt(0) === 40 && !a.match(d)) {
429
- var k = a.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
430
- return c >= 0 ? v("n", k, c) : "(" + v("n", k, -c) + ")";
431
- }
432
- if (a.charCodeAt(a.length - 1) === 44) return G(f, a, c);
433
- if (a.indexOf("%") !== -1) return se(f, a, c);
434
- if (a.indexOf("E") !== -1) return K(a, c);
435
- if (a.charCodeAt(0) === 36) return "$" + v(f, a.substr(a.charAt(1) == " " ? 2 : 1), c);
436
- var l, s, O, L, j = Math.abs(c), W = c < 0 ? "-" : "";
437
- if (a.match(/^00+$/)) return W + F(j, a.length);
438
- if (a.match(/^[#?]+$/))
439
- return l = "" + c, c === 0 && (l = ""), l.length > a.length ? l : A(a.substr(0, a.length - l.length)) + l;
440
- if (s = a.match(o)) return h(s, j, W);
441
- if (a.match(/^#+0+$/)) return W + F(j, a.length - a.indexOf("0"));
442
- if (s = a.match(x))
443
- return l = ("" + c).replace(/^([^\.]+)$/, "$1." + A(s[1])).replace(/\.$/, "." + A(s[1])), l = l.replace(/\.(\d*)$/, function(q, pe) {
444
- return "." + pe + S("0", A(s[1]).length - pe.length);
445
- }), a.indexOf("0.") !== -1 ? l : l.replace(/^0\./, ".");
446
- if (a = a.replace(/^#+([0.])/, "$1"), s = a.match(/^(0*)\.(#*)$/))
447
- return W + ("" + j).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, s[1].length ? "0." : ".");
448
- if (s = a.match(/^#{1,3},##0(\.?)$/)) return W + oe("" + j);
449
- if (s = a.match(/^#,##0\.([#0]*0)$/))
450
- return c < 0 ? "-" + v(f, a, -c) : oe("" + c) + "." + S("0", s[1].length);
451
- if (s = a.match(/^#,#*,#0/)) return v(f, a.replace(/^#,#*,/, ""), c);
452
- if (s = a.match(/^([0#]+)(\\?-([0#]+))+$/))
453
- return l = C(v(f, a.replace(/[\\-]/g, ""), c)), O = 0, C(C(a.replace(/\\/g, "")).replace(/[0#]/g, function(q) {
454
- return O < l.length ? l.charAt(O++) : q === "0" ? "0" : "";
455
- }));
456
- if (a.match(_))
457
- return l = v(f, "##########", c), "(" + l.substr(0, 3) + ") " + l.substr(3, 3) + "-" + l.substr(6);
458
- var N = "";
459
- if (s = a.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
460
- return O = Math.min(s[4].length, 7), L = ge(j, Math.pow(10, O) - 1, !1), l = "" + W, N = ae("n", s[1], L[1]), N.charAt(N.length - 1) == " " && (N = N.substr(0, N.length - 1) + "0"), l += N + s[2] + "/" + s[3], N = B(L[2], O), N.length < s[4].length && (N = A(s[4].substr(s[4].length - N.length)) + N), l += N, l;
461
- if (s = a.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
462
- return O = Math.min(Math.max(s[1].length, s[4].length), 7), L = ge(j, Math.pow(10, O) - 1, !0), W + (L[0] || (L[1] ? "" : "0")) + " " + (L[1] ? R(L[1], O) + s[2] + "/" + s[3] + B(L[2], O) : S(" ", 2 * O + 1 + s[2].length + s[3].length));
463
- if (s = a.match(/^[#0?]+$/))
464
- return l = "" + c, a.length <= l.length ? l : A(a.substr(0, a.length - l.length)) + l;
465
- if (s = a.match(/^([#0]+)\.([#0]+)$/)) {
466
- l = "" + c.toFixed(Math.min(s[2].length, 10)).replace(/([^0])0+$/, "$1"), O = l.indexOf(".");
467
- var be = a.indexOf(".") - O, Ce = a.length - l.length - be;
468
- return A(a.substr(0, be) + l + a.substr(a.length - Ce));
469
- }
470
- if (s = a.match(/^00,000\.([#0]*0)$/))
471
- return c < 0 ? "-" + v(f, a, -c) : oe("" + c).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(q) {
472
- return "00," + (q.length < 3 ? F(0, 3 - q.length) : "") + q;
473
- }) + "." + F(0, s[1].length);
474
- switch (a) {
475
- case "###,###":
476
- case "##,###":
477
- case "#,###":
478
- var me = oe("" + j);
479
- return me !== "0" ? W + me : "";
480
- default:
481
- if (a.match(/\.[0#?]*$/)) return v(f, a.slice(0, a.lastIndexOf(".")), c) + A(a.slice(a.lastIndexOf(".")));
482
- }
483
- throw new Error("unsupported format |" + a + "|");
484
- }
485
- return function(a, c, k) {
486
- return (k | 0) === k ? v(a, c, k) : $(a, c, k);
487
- };
488
- }();
489
- function Oe(t) {
490
- for (var e = [], n = !1, m = 0, i = 0; m < t.length; ++m) switch (
491
- /*cc=*/
492
- t.charCodeAt(m)
493
- ) {
494
- case 34:
495
- n = !n;
496
- break;
497
- case 95:
498
- case 42:
499
- case 92:
500
- ++m;
501
- break;
502
- case 59:
503
- e[e.length] = t.substr(i, m - i), i = m + 1;
504
- }
505
- if (e[e.length] = t.substr(i), n === !0) throw new Error("Format |" + t + "| unterminated string ");
506
- return e;
507
- }
508
- w._split = Oe;
509
- var we = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
510
- function ye(t) {
511
- for (var e = 0, n = "", m = ""; e < t.length; )
512
- switch (n = t.charAt(e)) {
513
- case "G":
514
- le(t, e) && (e += 6), e++;
515
- break;
516
- case '"':
517
- for (
518
- ;
519
- /*cc=*/
520
- t.charCodeAt(++e) !== 34 && e < t.length;
521
- )
522
- ;
523
- ++e;
524
- break;
525
- case "\\":
526
- e += 2;
527
- break;
528
- case "_":
529
- e += 2;
530
- break;
531
- case "@":
532
- ++e;
533
- break;
534
- case "B":
535
- case "b":
536
- if (t.charAt(e + 1) === "1" || t.charAt(e + 1) === "2") return !0;
537
- case "M":
538
- case "D":
539
- case "Y":
540
- case "H":
541
- case "S":
542
- case "E":
543
- case "m":
544
- case "d":
545
- case "y":
546
- case "h":
547
- case "s":
548
- case "e":
549
- case "g":
550
- return !0;
551
- case "A":
552
- case "a":
553
- case "上":
554
- if (t.substr(e, 3).toUpperCase() === "A/P" || t.substr(e, 5).toUpperCase() === "AM/PM" || t.substr(e, 5).toUpperCase() === "上午/下午") return !0;
555
- ++e;
556
- break;
557
- case "[":
558
- for (m = n; t.charAt(e++) !== "]" && e < t.length; ) m += t.charAt(e);
559
- if (m.match(we)) return !0;
560
- break;
561
- case ".":
562
- case "0":
563
- case "#":
564
- for (; e < t.length && ("0#?.,E+-%".indexOf(n = t.charAt(++e)) > -1 || n == "\\" && t.charAt(e + 1) == "-" && "0#".indexOf(t.charAt(e + 2)) > -1); )
565
- ;
566
- break;
567
- case "?":
568
- for (; t.charAt(++e) === n; )
569
- ;
570
- break;
571
- case "*":
572
- ++e, (t.charAt(e) == " " || t.charAt(e) == "*") && ++e;
573
- break;
574
- case "(":
575
- case ")":
576
- ++e;
577
- break;
578
- case "1":
579
- case "2":
580
- case "3":
581
- case "4":
582
- case "5":
583
- case "6":
584
- case "7":
585
- case "8":
586
- case "9":
587
- for (; e < t.length && "0123456789".indexOf(t.charAt(++e)) > -1; )
588
- ;
589
- break;
590
- case " ":
591
- ++e;
592
- break;
593
- default:
594
- ++e;
595
- break;
596
- }
597
- return !1;
598
- }
599
- w.is_date = ye;
600
- function Me(t, e, n, m) {
601
- for (var i = [], o = "", r = 0, h = "", x = "t", d, _, A, P = "H"; r < t.length; )
602
- switch (h = t.charAt(r)) {
603
- case "G":
604
- if (!le(t, r)) throw new Error("unrecognized character " + h + " in " + t);
605
- i[i.length] = { t: "G", v: "General" }, r += 7;
606
- break;
607
- case '"':
608
- for (o = ""; (A = t.charCodeAt(++r)) !== 34 && r < t.length; ) o += String.fromCharCode(A);
609
- i[i.length] = { t: "t", v: o }, ++r;
610
- break;
611
- case "\\":
612
- var U = t.charAt(++r), Y = U === "(" || U === ")" ? U : "t";
613
- i[i.length] = { t: Y, v: U }, ++r;
614
- break;
615
- case "_":
616
- i[i.length] = { t: "t", v: " " }, r += 2;
617
- break;
618
- case "@":
619
- i[i.length] = { t: "T", v: e }, ++r;
620
- break;
621
- case "B":
622
- case "b":
623
- if (t.charAt(r + 1) === "1" || t.charAt(r + 1) === "2") {
624
- if (d == null && (d = de(e, n, t.charAt(r + 1) === "2"), d == null))
625
- return "";
626
- i[i.length] = { t: "X", v: t.substr(r, 2) }, x = h, r += 2;
627
- break;
628
- }
629
- case "M":
630
- case "D":
631
- case "Y":
632
- case "H":
633
- case "S":
634
- case "E":
635
- h = h.toLowerCase();
636
- case "m":
637
- case "d":
638
- case "y":
639
- case "h":
640
- case "s":
641
- case "e":
642
- case "g":
643
- if (e < 0 || d == null && (d = de(e, n), d == null))
644
- return "";
645
- for (o = h; ++r < t.length && t.charAt(r).toLowerCase() === h; ) o += h;
646
- h === "m" && x.toLowerCase() === "h" && (h = "M"), h === "h" && (h = P), i[i.length] = { t: h, v: o }, x = h;
647
- break;
648
- case "A":
649
- case "a":
650
- case "上":
651
- var E = { t: h, v: h };
652
- if (d == null && (d = de(e, n)), t.substr(r, 3).toUpperCase() === "A/P" ? (d != null && (E.v = d.H >= 12 ? "P" : "A"), E.t = "T", P = "h", r += 3) : t.substr(r, 5).toUpperCase() === "AM/PM" ? (d != null && (E.v = d.H >= 12 ? "PM" : "AM"), E.t = "T", r += 5, P = "h") : t.substr(r, 5).toUpperCase() === "上午/下午" ? (d != null && (E.v = d.H >= 12 ? "下午" : "上午"), E.t = "T", r += 5, P = "h") : (E.t = "t", ++r), d == null && E.t === "T") return "";
653
- i[i.length] = E, x = h;
654
- break;
655
- case "[":
656
- for (o = h; t.charAt(r++) !== "]" && r < t.length; ) o += t.charAt(r);
657
- if (o.slice(-1) !== "]") throw 'unterminated "[" block: |' + o + "|";
658
- if (o.match(we)) {
659
- if (d == null && (d = de(e, n), d == null))
660
- return "";
661
- i[i.length] = { t: "Z", v: o.toLowerCase() }, x = o.charAt(1);
662
- } else o.indexOf("$") > -1 && (o = (o.match(/\$([^-\[\]]*)/) || [])[1] || "$", ye(t) || (i[i.length] = { t: "t", v: o }));
663
- break;
664
- case ".":
665
- if (d != null) {
666
- for (o = h; ++r < t.length && (h = t.charAt(r)) === "0"; ) o += h;
667
- i[i.length] = { t: "s", v: o };
668
- break;
669
- }
670
- case "0":
671
- case "#":
672
- for (o = h; ++r < t.length && "0#?.,E+-%".indexOf(h = t.charAt(r)) > -1; ) o += h;
673
- i[i.length] = { t: "n", v: o };
674
- break;
675
- case "?":
676
- for (o = h; t.charAt(++r) === h; ) o += h;
677
- i[i.length] = { t: h, v: o }, x = h;
678
- break;
679
- case "*":
680
- ++r, (t.charAt(r) == " " || t.charAt(r) == "*") && ++r;
681
- break;
682
- case "(":
683
- case ")":
684
- i[i.length] = { t: m === 1 ? "t" : h, v: h }, ++r;
685
- break;
686
- case "1":
687
- case "2":
688
- case "3":
689
- case "4":
690
- case "5":
691
- case "6":
692
- case "7":
693
- case "8":
694
- case "9":
695
- for (o = h; r < t.length && "0123456789".indexOf(t.charAt(++r)) > -1; ) o += t.charAt(r);
696
- i[i.length] = { t: "D", v: o };
697
- break;
698
- case " ":
699
- i[i.length] = { t: h, v: h }, ++r;
700
- break;
701
- case "$":
702
- i[i.length] = { t: "t", v: "$" }, ++r;
703
- break;
704
- default:
705
- if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(h) === -1) throw new Error("unrecognized character " + h + " in " + t);
706
- i[i.length] = { t: "t", v: h }, ++r;
707
- break;
708
- }
709
- var $ = 0, G = 0, se;
710
- for (r = i.length - 1, x = "t"; r >= 0; --r)
711
- switch (i[r].t) {
712
- case "h":
713
- case "H":
714
- i[r].t = P, x = "h", $ < 1 && ($ = 1);
715
- break;
716
- case "s":
717
- (se = i[r].v.match(/\.0+$/)) && (G = Math.max(G, se[0].length - 1)), $ < 3 && ($ = 3);
718
- case "d":
719
- case "y":
720
- case "M":
721
- case "e":
722
- x = i[r].t;
723
- break;
724
- case "m":
725
- x === "s" && (i[r].t = "M", $ < 2 && ($ = 2));
726
- break;
727
- case "X":
728
- break;
729
- case "Z":
730
- $ < 1 && i[r].v.match(/[Hh]/) && ($ = 1), $ < 2 && i[r].v.match(/[Mm]/) && ($ = 2), $ < 3 && i[r].v.match(/[Ss]/) && ($ = 3);
731
- }
732
- switch ($) {
733
- case 0:
734
- break;
735
- case 1:
736
- d.u >= 0.5 && (d.u = 0, ++d.S), d.S >= 60 && (d.S = 0, ++d.M), d.M >= 60 && (d.M = 0, ++d.H);
737
- break;
738
- case 2:
739
- d.u >= 0.5 && (d.u = 0, ++d.S), d.S >= 60 && (d.S = 0, ++d.M);
740
- break;
741
- }
742
- var K = "", v;
743
- for (r = 0; r < i.length; ++r)
744
- switch (i[r].t) {
745
- case "t":
746
- case "T":
747
- case " ":
748
- case "D":
749
- break;
750
- case "X":
751
- i[r].v = "", i[r].t = ";";
752
- break;
753
- case "d":
754
- case "m":
755
- case "y":
756
- case "h":
757
- case "H":
758
- case "M":
759
- case "s":
760
- case "e":
761
- case "b":
762
- case "Z":
763
- i[r].v = Ve(i[r].t.charCodeAt(0), i[r].v, d, G), i[r].t = "t";
764
- break;
765
- case "n":
766
- case "?":
767
- for (v = r + 1; i[v] != null && ((h = i[v].t) === "?" || h === "D" || (h === " " || h === "t") && i[v + 1] != null && (i[v + 1].t === "?" || i[v + 1].t === "t" && i[v + 1].v === "/") || i[r].t === "(" && (h === " " || h === "n" || h === ")") || h === "t" && (i[v].v === "/" || i[v].v === " " && i[v + 1] != null && i[v + 1].t == "?")); )
768
- i[r].v += i[v].v, i[v] = { v: "", t: ";" }, ++v;
769
- K += i[r].v, r = v - 1;
770
- break;
771
- case "G":
772
- i[r].t = "t", i[r].v = Ae(e, n);
773
- break;
774
- }
775
- var f = "", a, c;
776
- if (K.length > 0) {
777
- K.charCodeAt(0) == 40 ? (a = e < 0 && K.charCodeAt(0) === 45 ? -e : e, c = ae("n", K, a)) : (a = e < 0 && m > 1 ? -e : e, c = ae("n", K, a), a < 0 && i[0] && i[0].t == "t" && (c = c.substr(1), i[0].v = "-" + i[0].v)), v = c.length - 1;
778
- var k = i.length;
779
- for (r = 0; r < i.length; ++r) if (i[r] != null && i[r].t != "t" && i[r].v.indexOf(".") > -1) {
780
- k = r;
781
- break;
782
- }
783
- var l = i.length;
784
- if (k === i.length && c.indexOf("E") === -1) {
785
- for (r = i.length - 1; r >= 0; --r)
786
- i[r] == null || "n?".indexOf(i[r].t) === -1 || (v >= i[r].v.length - 1 ? (v -= i[r].v.length, i[r].v = c.substr(v + 1, i[r].v.length)) : v < 0 ? i[r].v = "" : (i[r].v = c.substr(0, v + 1), v = -1), i[r].t = "t", l = r);
787
- v >= 0 && l < i.length && (i[l].v = c.substr(0, v + 1) + i[l].v);
788
- } else if (k !== i.length && c.indexOf("E") === -1) {
789
- for (v = c.indexOf(".") - 1, r = k; r >= 0; --r)
790
- if (!(i[r] == null || "n?".indexOf(i[r].t) === -1)) {
791
- for (_ = i[r].v.indexOf(".") > -1 && r === k ? i[r].v.indexOf(".") - 1 : i[r].v.length - 1, f = i[r].v.substr(_ + 1); _ >= 0; --_)
792
- v >= 0 && (i[r].v.charAt(_) === "0" || i[r].v.charAt(_) === "#") && (f = c.charAt(v--) + f);
793
- i[r].v = f, i[r].t = "t", l = r;
794
- }
795
- for (v >= 0 && l < i.length && (i[l].v = c.substr(0, v + 1) + i[l].v), v = c.indexOf(".") + 1, r = k; r < i.length; ++r)
796
- if (!(i[r] == null || "n?(".indexOf(i[r].t) === -1 && r !== k)) {
797
- for (_ = i[r].v.indexOf(".") > -1 && r === k ? i[r].v.indexOf(".") + 1 : 0, f = i[r].v.substr(0, _); _ < i[r].v.length; ++_)
798
- v < c.length && (f += c.charAt(v++));
799
- i[r].v = f, i[r].t = "t", l = r;
800
- }
801
- }
802
- }
803
- for (r = 0; r < i.length; ++r) i[r] != null && "n?".indexOf(i[r].t) > -1 && (a = m > 1 && e < 0 && r > 0 && i[r - 1].v === "-" ? -e : e, i[r].v = ae(i[r].t, i[r].v, a), i[r].t = "t");
804
- var s = "";
805
- for (r = 0; r !== i.length; ++r) i[r] != null && (s += i[r].v);
806
- return s;
807
- }
808
- w._eval = Me;
809
- var Se = /\[[=<>]/, ve = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
810
- function Q(t, e) {
811
- if (e == null) return !1;
812
- var n = parseFloat(e[2]);
813
- switch (e[1]) {
814
- case "=":
815
- if (t == n) return !0;
816
- break;
817
- case ">":
818
- if (t > n) return !0;
819
- break;
820
- case "<":
821
- if (t < n) return !0;
822
- break;
823
- case "<>":
824
- if (t != n) return !0;
825
- break;
826
- case ">=":
827
- if (t >= n) return !0;
828
- break;
829
- case "<=":
830
- if (t <= n) return !0;
831
- break;
832
- }
833
- return !1;
834
- }
835
- function ie(t, e) {
836
- var n = Oe(t), m = n.length, i = n[m - 1].indexOf("@");
837
- if (m < 4 && i > -1 && --m, n.length > 4) throw new Error("cannot find right format for |" + n.join("|") + "|");
838
- if (typeof e != "number") return [4, n.length === 4 || i > -1 ? n[n.length - 1] : "@"];
839
- switch (n.length) {
840
- case 1:
841
- n = i > -1 ? ["General", "General", "General", n[0]] : [n[0], n[0], n[0], "@"];
842
- break;
843
- case 2:
844
- n = i > -1 ? [n[0], n[0], n[0], n[1]] : [n[0], n[1], n[0], "@"];
845
- break;
846
- case 3:
847
- n = i > -1 ? [n[0], n[1], n[0], n[2]] : [n[0], n[1], n[2], "@"];
848
- break;
849
- }
850
- var o = e > 0 ? n[0] : e < 0 ? n[1] : n[2];
851
- if (n[0].indexOf("[") === -1 && n[1].indexOf("[") === -1) return [m, o];
852
- if (n[0].match(Se) != null || n[1].match(Se) != null) {
853
- var r = n[0].match(ve), h = n[1].match(ve);
854
- return Q(e, r) ? [m, n[0]] : Q(e, h) ? [m, n[1]] : [m, n[r != null && h != null ? 2 : 1]];
855
- }
856
- return [m, o];
857
- }
858
- function te(t, e, n) {
859
- n == null && (n = {});
860
- var m = "";
861
- switch (typeof t) {
862
- case "string":
863
- t == "m/d/yy" && n.dateNF ? m = n.dateNF : m = t;
864
- break;
865
- case "number":
866
- t == 14 && n.dateNF ? m = n.dateNF : m = (n.table != null ? n.table : ce)[t], m == null && (m = n.table && n.table[J[t]] || ce[J[t]]), m == null && (m = z[t] || "General");
867
- break;
868
- }
869
- if (le(m, 0)) return Ae(e, n);
870
- e instanceof Date && (e = Te(e, n.date1904));
871
- var i = ie(m, e);
872
- if (le(i[1])) return Ae(e, n);
873
- if (e === !0) e = "TRUE";
874
- else if (e === !1) e = "FALSE";
875
- else if (e === "" || e == null) return "";
876
- return Me(i[1], e, n, i[0]);
877
- }
878
- function he(t, e) {
879
- if (typeof e != "number") {
880
- e = +e || -1;
881
- for (var n = 0; n < 392; ++n) {
882
- if (ce[n] == null) {
883
- e < 0 && (e = n);
884
- continue;
885
- }
886
- if (ce[n] == t) {
887
- e = n;
888
- break;
889
- }
890
- }
891
- e < 0 && (e = 391);
892
- }
893
- return ce[e] = t, e;
894
- }
895
- w.load = he, w._table = ce, w.get_table = function() {
896
- return ce;
897
- }, w.load_table = function(e) {
898
- for (var n = 0; n != 392; ++n)
899
- e[n] !== void 0 && he(e[n], n);
900
- }, w.init_table = $e, w.format = te;
901
- };
902
- g(u), typeof DO_NOT_EXPORT_SSF > "u" && (y.exports = u);
903
- })(Je);
904
- var it = Je.exports;
905
- const De = /* @__PURE__ */ et(it), Be = [
906
- "228, 232, 237",
907
- // Light Gray
908
- "219, 233, 236",
909
- // White
910
- "244, 217, 227",
911
- // Pink
912
- "247, 229, 207",
913
- // Peach
914
- "217, 234, 244",
915
- // Blue
916
- "222, 239, 222",
917
- // Green
918
- "239, 239, 239",
919
- // Light Green
920
- "244, 230, 230",
921
- // Rose
922
- "247, 239, 217",
923
- // Yellow
924
- "230, 230, 244",
925
- // Purple
926
- "217, 244, 244",
927
- // Cyan
928
- "244, 239, 234"
929
- // Cream
930
- ], qe = Be[0], ct = [
931
- ["true", "false"],
932
- ["yes", "no"],
933
- ["1", "0"]
934
- ];
935
- function ot(y, u) {
936
- const g = y.toLowerCase(), p = u.toLowerCase();
937
- return ct.some(([w, C]) => g === w && p === C);
938
- }
939
- const lt = 200;
940
- function st() {
941
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `sheet-${Date.now()}-${Math.random().toString(36).slice(2)}`;
942
- }
943
- function ut(y, u) {
944
- if (!u.has(y)) return y;
945
- let g = 1, p = `${y} (${g})`;
946
- for (; u.has(p); )
947
- g += 1, p = `${y} (${g})`;
948
- return p;
949
- }
950
- function ht(y) {
951
- if (!Array.isArray(y) || y.length === 0) return null;
952
- const u = y.map((p) => String((p == null ? void 0 : p.v) ?? "")).join("");
953
- return u.trim() ? u : null;
954
- }
955
- function ft(y) {
956
- return y ? "TRUE" : "FALSE";
957
- }
958
- function gt(y) {
959
- let u = !1, g = 0;
960
- const p = () => {
961
- if (u) return !0;
962
- const C = y.current;
963
- if (!(C != null && C.getWorkbookContext) || !C.recalculateAllFormulas) return !1;
964
- const S = C.getWorkbookContext(), F = S == null ? void 0 : S.luckysheetfile;
965
- return !(F != null && F.length) || !F.some(
966
- (B) => Array.isArray(B.data) && B.data.length > 0
967
- ) ? !1 : (C.recalculateAllFormulas(), u = !0, !0);
968
- }, w = () => {
969
- var C, S;
970
- p() || (g += 1, g < lt ? requestAnimationFrame(w) : ((S = (C = y.current) == null ? void 0 : C.recalculateAllFormulas) == null || S.call(C), u = !0));
971
- };
972
- requestAnimationFrame(() => requestAnimationFrame(w));
973
- for (const C of [120, 400, 1200])
974
- window.setTimeout(() => {
975
- u || p();
976
- }, C);
977
- }
978
- function dt(y) {
979
- return y <= 0 ? qe : y > Be.length ? Array(y).fill(qe).join(", ") : Be.slice(0, y).join(", ");
980
- }
981
- function je(y) {
982
- const u = y.match(/^([A-Z]+)(\d+)$/i);
983
- if (!u) return null;
984
- const g = u[1].toUpperCase(), p = u[2];
985
- let w = 0;
986
- for (let F = 0; F < g.length; F++)
987
- w = w * 26 + (g.charCodeAt(F) - 64);
988
- const C = parseInt(p, 10) - 1, S = w - 1;
989
- return { row: C, col: S };
990
- }
991
- function bt(y, u) {
992
- const g = je(y);
993
- if (!g) return null;
994
- const { row: p, col: w } = g, C = `${p}_${w}`, S = Array.isArray(u.formulae) && u.formulae.length > 0 ? String(u.formulae[0]).replace(/^["']|["']$/g, "").replace(/["']/g, "") : "", F = S.split(",").map((le) => le.trim()).filter(Boolean);
995
- let R = u.type === "list" ? "dropdown" : u.type || "dropdown", B = S, ee = "";
996
- u.type === "list" && F.length === 2 && ot(F[0], F[1]) && (R = "checkbox", B = F[0], ee = F[1]);
997
- const ke = R === "checkbox" ? 1 : B ? B.split(",").length : 0, D = dt(ke || 1), Z = {
998
- type: R,
999
- type2: "",
1000
- rangeTxt: y,
1001
- value1: B,
1002
- value2: ee,
1003
- validity: "",
1004
- remote: !1,
1005
- prohibitInput: u.type === "list",
1006
- hintShow: !!u.showInputMessage,
1007
- hintValue: u.prompt ?? "",
1008
- color: D,
1009
- checked: !1
1010
- };
1011
- return { rowColKey: C, entry: Z };
1012
- }
1013
- function mt(y) {
1014
- const u = y.split(":"), g = je(u[0].trim());
1015
- if (!g) return null;
1016
- const p = u.length > 1 ? je(u[1].trim()) : g;
1017
- return p ? {
1018
- row: [Math.min(g.row, p.row), Math.max(g.row, p.row)],
1019
- column: [Math.min(g.col, p.col), Math.max(g.col, p.col)]
1020
- } : null;
1021
- }
1022
- function pt(y) {
1023
- return String(y || "").split(/[,\s]+/).map((u) => u.trim()).filter(Boolean).map((u) => mt(u)).filter(
1024
- (u) => !!u
1025
- );
1026
- }
1027
- function Xe(y) {
1028
- const u = pt(y);
1029
- return u.length ? u.map((g) => {
1030
- const [p, w] = g.row, [C, S] = g.column;
1031
- return {
1032
- left: 0,
1033
- width: 104,
1034
- top: 0,
1035
- height: 23,
1036
- left_move: 0,
1037
- width_move: 104,
1038
- top_move: 0,
1039
- height_move: 11999,
1040
- row: [p, w],
1041
- column: [C, S],
1042
- row_focus: p,
1043
- column_focus: C,
1044
- column_select: !0
1045
- };
1046
- }) : null;
1047
- }
1048
- function Ze(y) {
1049
- var S, F;
1050
- const u = {
1051
- textColor: "#000000",
1052
- cellColor: "#ffffff",
1053
- bold: !1,
1054
- italic: !1,
1055
- underline: !1,
1056
- strikethrough: !1
1057
- };
1058
- if (!y) return u;
1059
- const g = y.font, p = y.fill;
1060
- let w = u.textColor, C = u.cellColor;
1061
- if ((S = g == null ? void 0 : g.color) != null && S.argb) {
1062
- const R = g.color.argb;
1063
- w = "#" + (R.length >= 6 ? R.slice(-6) : R);
1064
- }
1065
- if ((p == null ? void 0 : p.type) === "pattern" && p.pattern === "solid" && ((F = p.fgColor) != null && F.argb)) {
1066
- const R = p.fgColor.argb;
1067
- C = "#" + (R.length >= 6 ? R.slice(-6) : R);
1068
- }
1069
- return {
1070
- textColor: w,
1071
- cellColor: C,
1072
- bold: !!(g != null && g.bold),
1073
- italic: !!(g != null && g.italic),
1074
- underline: !!(g != null && g.underline),
1075
- strikethrough: !1
1076
- };
1077
- }
1078
- function Qe(y) {
1079
- if (!y || typeof y != "string") return "";
1080
- const u = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&").replace(/^=/, ""), g = u.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*"((?:[^"]|"")*)"/i);
1081
- if (g) return (g[1] ?? "").replace(/""/g, '"');
1082
- const p = u.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*'([^']*)'/i);
1083
- return p ? p[1] ?? "" : "";
1084
- }
1085
- function Pe(y) {
1086
- if (!y || typeof y != "string") return "";
1087
- const u = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/^=/, ""), g = u.match(/"((?:[^"]|"")*)"/);
1088
- if (g) return (g[1] ?? "").replace(/""/g, '"');
1089
- const p = u.match(/'([^']*)'/);
1090
- return p ? p[1] ?? "" : "";
1091
- }
1092
- function wt(y) {
1093
- if (!y || typeof y != "string") return null;
1094
- const u = y.trim().toUpperCase(), g = Qe(y) || Pe(y);
1095
- return g ? u.includes("SEARCH(") ? u.includes("ISERROR(SEARCH(") || u.includes("NOTNUMBER(SEARCH(") ? { conditionName: "textDoesNotContain", conditionValue: [g] } : { conditionName: "textContains", conditionValue: [g] } : u.includes("LEFT(") ? { conditionName: "textStartsWith", conditionValue: [g] } : u.includes("RIGHT(") ? { conditionName: "textEndsWith", conditionValue: [g] } : u.includes("EXACT(") || u.includes('="') ? { conditionName: "textExactly", conditionValue: [g] } : null : null;
1096
- }
1097
- function yt(y, u, g) {
1098
- const p = (y || "").toLowerCase();
1099
- if (p === "cellis") {
1100
- const w = (u || "").toLowerCase();
1101
- return w === "greaterthan" ? { conditionName: "greaterThan", conditionValue: [] } : w === "greaterthanorequal" ? { conditionName: "greaterThanOrEqual", conditionValue: [] } : w === "lessthan" ? { conditionName: "lessThan", conditionValue: [] } : w === "lessthanorequal" ? { conditionName: "lessThanOrEqual", conditionValue: [] } : w === "equal" ? { conditionName: "equal", conditionValue: [] } : w === "notequal" ? { conditionName: "notEqual", conditionValue: [] } : w === "between" ? { conditionName: "between", conditionValue: [] } : w === "notbetween" ? { conditionName: "notBetween", conditionValue: [] } : null;
1102
- }
1103
- if (p === "containstext" || p === "notcontainstext" || p === "beginswith" || p === "endswith" || p === "containsblanks" || p === "notcontainsblanks") {
1104
- const w = (u ?? "").toLowerCase();
1105
- if (p === "containsblanks" || w === "containsblanks")
1106
- return { conditionName: "empty", conditionValue: [""] };
1107
- if (p === "notcontainsblanks" || w === "notcontainsblanks")
1108
- return { conditionName: "notEmpty", conditionValue: [""] };
1109
- if (p === "notcontainstext" || w === "notcontainstext" || w === "notcontains")
1110
- return { conditionName: "textDoesNotContain", conditionValue: [] };
1111
- if (p === "beginswith" || w === "beginswith")
1112
- return { conditionName: "textStartsWith", conditionValue: [] };
1113
- if (p === "endswith" || w === "endswith")
1114
- return { conditionName: "textEndsWith", conditionValue: [] };
1115
- if (w === "equal")
1116
- return { conditionName: "textExactly", conditionValue: [] };
1117
- const C = (g == null ? void 0 : g.text) ?? "";
1118
- return {
1119
- conditionName: "textContains",
1120
- conditionValue: C ? [C] : []
1121
- };
1122
- }
1123
- if (p === "duplicatevalues")
1124
- return { conditionName: "duplicateValue", conditionValue: ["0"] };
1125
- if (p === "uniquevalues")
1126
- return { conditionName: "duplicateValue", conditionValue: ["1"] };
1127
- if (p === "top10") {
1128
- const w = (g == null ? void 0 : g.rank) ?? 10;
1129
- return g != null && g.percent && (g != null && g.bottom) ? {
1130
- conditionName: "last10_percent",
1131
- conditionValue: [String(w)]
1132
- } : g != null && g.percent ? { conditionName: "top10_percent", conditionValue: [String(w)] } : g != null && g.bottom ? { conditionName: "last10", conditionValue: [String(w)] } : { conditionName: "top10", conditionValue: [String(w)] };
1133
- }
1134
- if (p === "aboveaverage")
1135
- return (g == null ? void 0 : g.aboveAverage) === !1 ? { conditionName: "belowAverage", conditionValue: [] } : { conditionName: "aboveAverage", conditionValue: [] };
1136
- if (p === "timeperiod") {
1137
- const w = ((g == null ? void 0 : g.timePeriod) ?? "").toLowerCase();
1138
- return w === "today" || w === "tomorrow" || w === "yesterday" ? {
1139
- conditionName: "dateIs",
1140
- conditionValue: [`preset:${w}`, "", "DD/MM/YYYY"]
1141
- } : w === "last7days" ? {
1142
- conditionName: "dateIs",
1143
- conditionValue: ["preset:pastWeek", "", "DD/MM/YYYY"]
1144
- } : w === "lastmonth" ? {
1145
- conditionName: "dateIs",
1146
- conditionValue: ["preset:pastMonth", "", "DD/MM/YYYY"]
1147
- } : w === "lastyear" ? {
1148
- conditionName: "dateIs",
1149
- conditionValue: ["preset:pastYear", "", "DD/MM/YYYY"]
1150
- } : null;
1151
- }
1152
- return null;
1153
- }
1154
- function kt(y, u) {
1155
- if (!u.type) return null;
1156
- let g = (u.text ?? "").trim();
1157
- const p = Array.isArray(u.formulae) && u.formulae[0] ? String(u.formulae[0]) : void 0, w = (u.type.toLowerCase() === "expression" || u.type.toLowerCase() === "customformula") && wt(p);
1158
- if (w) {
1159
- const B = Xe(y);
1160
- if (!B) return null;
1161
- const ee = Ze(u.style);
1162
- return {
1163
- type: "default",
1164
- cellrange: B,
1165
- format: {
1166
- textColor: ee.textColor,
1167
- cellColor: ee.cellColor,
1168
- bold: ee.bold,
1169
- italic: ee.italic,
1170
- underline: ee.underline,
1171
- strikethrough: ee.strikethrough
1172
- },
1173
- conditionName: w.conditionName,
1174
- conditionRange: [],
1175
- conditionValue: w.conditionValue
1176
- };
1177
- }
1178
- (u.type === "containsText" || u.type === "notContainsText" || u.type === "beginsWith" || u.type === "endsWith") && !g && (g = Qe(p), g || (g = Pe(p)));
1179
- const C = yt(u.type, u.operator, {
1180
- percent: u.percent,
1181
- bottom: u.bottom,
1182
- rank: u.rank,
1183
- aboveAverage: u.aboveAverage,
1184
- text: g || u.text,
1185
- timePeriod: u.timePeriod
1186
- });
1187
- if (!C) return null;
1188
- let S;
1189
- u.type === "cellIs" && Array.isArray(u.formulae) && u.formulae.length > 0 ? S = u.formulae.map((B) => String(B ?? "")) : C.conditionName === "empty" || C.conditionName === "notEmpty" ? S = [""] : u.type === "containsText" || u.type === "notContainsText" || u.type === "beginsWith" || u.type === "endsWith" ? S = g ? [g] : Pe(p) ? [Pe(p)] : [] : S = C.conditionValue.map(
1190
- (B) => B == null ? "" : String(B)
1191
- );
1192
- const F = Xe(y);
1193
- if (!F) return null;
1194
- const R = Ze(u.style);
1195
- return {
1196
- type: "default",
1197
- cellrange: F,
1198
- format: {
1199
- textColor: R.textColor,
1200
- cellColor: R.cellColor,
1201
- bold: R.bold,
1202
- italic: R.italic,
1203
- underline: R.underline,
1204
- strikethrough: R.strikethrough
1205
- },
1206
- conditionName: C.conditionName,
1207
- conditionRange: [],
1208
- conditionValue: S
1209
- };
1210
- }
1211
- async function vt({
1212
- sheetEditorRef: y,
1213
- ydocRef: u,
1214
- setForceSheetRender: g,
1215
- dsheetId: p,
1216
- currentDataRef: w,
1217
- updateDocumentTitle: C,
1218
- filterToastShown: S,
1219
- setFilterToastShown: F,
1220
- handleContentPortal: R
1221
- }, B, ee, ke, D) {
1222
- var ce, J;
1223
- const Z = B == null ? void 0 : B.target;
1224
- if (!((ce = Z == null ? void 0 : Z.files) != null && ce.length) && !ee)
1225
- return Promise.resolve();
1226
- const le = ((J = Z == null ? void 0 : Z.files) == null ? void 0 : J[0]) || ee, Ee = {}, _e = {};
1227
- let $e = !1;
1228
- return new Promise((M, z) => {
1229
- const ge = new FileReader();
1230
- ge.onerror = () => z(new Error("Failed to read file")), ge.onload = async (de) => {
1231
- var Ve, oe, ae, Oe;
1232
- if (!de.target) {
1233
- console.error("FileReader event target is null"), z(new Error("FileReader event target is null"));
1234
- return;
1235
- }
1236
- const Ne = de.target.result, [{ Workbook: Re }, Le, Te] = await Promise.all([
1237
- import("exceljs"),
1238
- // @ts-expect-error — luckyexcel ships without TypeScript types
1239
- import("luckyexcel"),
1240
- import("./xlsx-image-utils-Cvg0qxRA.js")
1241
- ]), He = Le.default.transformExcelToLucky, { extractImagesFromWorksheet: Fe, convertRawImagesToFortuneSheet: Ae } = Te, xe = new Re();
1242
- try {
1243
- await xe.xlsx.load(Ne);
1244
- const we = (Oe = (ae = (oe = (Ve = xe.model) == null ? void 0 : Ve.styles) == null ? void 0 : oe.fonts) == null ? void 0 : ae[0]) == null ? void 0 : Oe.size, ye = {}, Me = {}, Se = {}, ve = {};
1245
- xe.eachSheet((Q, ie) => {
1246
- var h, x, d;
1247
- const te = ie - 1, he = {}, t = Q.views;
1248
- if (t && t.length > 0) {
1249
- const _ = t[0];
1250
- if (_.state === "frozen") {
1251
- const A = _.xSplit || 0, P = _.ySplit || 0;
1252
- let U = null;
1253
- A > 0 && P > 0 ? U = "rangeBoth" : P > 0 ? U = "rangeRow" : A > 0 && (U = "rangeColumn"), U && (Me[te] = {
1254
- type: U,
1255
- range: {
1256
- row_focus: P - 1,
1257
- column_focus: A - 1
1258
- }
1259
- });
1260
- }
1261
- }
1262
- const e = {};
1263
- Q.eachRow({ includeEmpty: !1 }, (_, A) => {
1264
- _.eachCell({ includeEmpty: !1 }, (P, U) => {
1265
- var se, K, v;
1266
- const Y = `${A - 1}_${U - 1}`;
1267
- P.hyperlink && (he[Y] = [
1268
- {
1269
- linkType: "webpage",
1270
- linkAddress: P.hyperlink
1271
- }
1272
- ]);
1273
- const E = (se = P.style) == null ? void 0 : se.font, $ = (K = P.style) == null ? void 0 : K.fill, G = {};
1274
- if (E) {
1275
- E.bold && (G.bl = 1), E.italic && (G.it = 1), E.underline && (G.un = 1);
1276
- const f = E.size ?? we;
1277
- if (f && (G.fs = f), E.name && (G.ff = E.name), (v = E.color) != null && v.argb) {
1278
- const a = E.color.argb, c = "#" + a.substring(a.length - 6);
1279
- G.fc = c;
1280
- }
1281
- }
1282
- if (($ == null ? void 0 : $.type) === "pattern" && $.pattern === "solid" && $.fgColor && $.fgColor.argb) {
1283
- const f = $.fgColor.argb, a = "#" + f.substring(f.length - 6);
1284
- G.bg = a;
1285
- }
1286
- Object.keys(G).length > 0 && (e[Y] = G);
1287
- });
1288
- }), Object.keys(he).length > 0 && (ye[te] = he), Object.keys(e).length > 0 && (Se[te] = e);
1289
- const n = Fe(Q, xe);
1290
- n.length > 0 && (ve[te] = n);
1291
- const m = Q.tables;
1292
- m && Object.keys(m).length > 0 && ((h = D == null ? void 0 : D.onWarning) == null || h.call(
1293
- D,
1294
- "Tables are not fully supported. Table styles will not be applied."
1295
- ), D != null && D.suppressUiWarnings || ze({
1296
- title: "Tables are not fully supported",
1297
- description: "Table styles will not be applied",
1298
- variant: "warning",
1299
- showCloseButton: !0,
1300
- duration: 40 * 1e3
1301
- }));
1302
- const i = (x = Q.dataValidations) == null ? void 0 : x.model;
1303
- if (i && typeof i == "object") {
1304
- const _ = {};
1305
- for (const [A, P] of Object.entries(i)) {
1306
- const Y = bt(A, P);
1307
- Y && (_[Y.rowColKey] = Y.entry);
1308
- }
1309
- Object.keys(_).length > 0 && (Ee[te] = _);
1310
- }
1311
- const o = Q.conditionalFormattings;
1312
- if (Array.isArray(o) && o.length > 0) {
1313
- const _ = [];
1314
- for (const A of o) {
1315
- const P = A.ref, U = A.rules || [];
1316
- for (const Y of U) {
1317
- const E = Y;
1318
- console.log("[XLSX CF RAW]", {
1319
- ref: P,
1320
- type: E.type,
1321
- operator: E.operator,
1322
- formulae: E.formulae,
1323
- text: E.text,
1324
- timePeriod: E.timePeriod,
1325
- percent: E.percent,
1326
- bottom: E.bottom,
1327
- rank: E.rank,
1328
- aboveAverage: E.aboveAverage
1329
- });
1330
- const $ = E.type ? kt(P, E) : null;
1331
- $ ? console.log("[XLSX CF MAPPED] accepted", $) : console.log("[XLSX CF MAPPED] skipped", {
1332
- ref: P,
1333
- type: E.type,
1334
- operator: E.operator,
1335
- formulae: E.formulae,
1336
- text: E.text
1337
- }), $ && _.push($);
1338
- }
1339
- }
1340
- _.length > 0 && (_e[te] = _);
1341
- }
1342
- Q.autoFilter && ($e || ($e = !0, (d = D == null ? void 0 : D.onWarning) == null || d.call(
1343
- D,
1344
- "Filters are not supported in imported files."
1345
- )), S || (F(!0), D != null && D.suppressUiWarnings || ze({
1346
- title: "Filters are not supported in imported files",
1347
- variant: "warning",
1348
- showCloseButton: !0,
1349
- duration: 30 * 1e3
1350
- })));
1351
- }), He(
1352
- le,
1353
- function(Q) {
1354
- var i;
1355
- let ie = Q.sheets;
1356
- if (ie.forEach((o, r) => {
1357
- const h = Ee[r];
1358
- h && Object.keys(h).length > 0 && (o.dataVerification = h);
1359
- const x = _e[r];
1360
- o.luckysheet_conditionformat_save = Array.isArray(x) && x.length > 0 ? x : [];
1361
- }), !u.current) {
1362
- console.error("ydocRef.current is null");
1363
- return;
1364
- }
1365
- const te = u.current.getArray(p), he = Array.from(te), t = /* @__PURE__ */ new Map();
1366
- ie = ie.map((o, r) => {
1367
- var $, G, se, K, v, f, a, c, k, l, s, O, L, j, W, N, be, Ce, me, q, pe, We, Ue, Ie, Ye;
1368
- const h = ($ = o == null ? void 0 : o.celldata) == null ? void 0 : $[o.celldata.length - 1], x = (h == null ? void 0 : h.r) ?? 0, d = (h == null ? void 0 : h.c) ?? 0;
1369
- if (o.row = Math.max(x, 500), o.column = Math.max(d, 36), o.id || (o.id = ((G = D == null ? void 0 : D.generateSheetId) == null ? void 0 : G.call(D)) ?? ((se = y.current) == null ? void 0 : se.getSettings().generateSheetId()) ?? st()), Me[r] && (o.frozen = Me[r]), ye[r] && (o.hyperlink = {
1370
- ...o.hyperlink || {},
1371
- ...ye[r]
1372
- }), (K = o.config) != null && K.columnlen) {
1373
- const b = {};
1374
- Object.entries(o.config.columnlen).forEach(
1375
- ([V, T]) => {
1376
- const I = (Number(T) - 5) / 8 + 0.83;
1377
- b[V] = Math.round(I * 7 + 5);
1378
- }
1379
- ), o.config.columnlen = b;
1380
- }
1381
- const _ = Math.round(
1382
- Number(o.defaultColWidth) || 73
1383
- );
1384
- if ((v = o.config) != null && v.columnlen) {
1385
- const b = {};
1386
- Object.entries(o.config.columnlen).forEach(([V, T]) => {
1387
- Math.abs(Math.round(Number(T)) - _) > 1 && (b[V] = Number(T));
1388
- }), o.config.columnlen = b;
1389
- }
1390
- if ((f = o.config) != null && f.rowlen) {
1391
- const b = Math.round(
1392
- Number(o.defaultRowHeight) || 21
1393
- ), V = {};
1394
- Object.entries(o.config.rowlen).forEach(([T, I]) => {
1395
- Math.abs(Math.round(Number(I)) - b) > 1 && (V[T] = Number(I));
1396
- }), o.config.rowlen = V;
1397
- }
1398
- if ((a = o.config) != null && a.customHeight) {
1399
- const b = new Set(
1400
- Object.keys(o.config.rowlen || {})
1401
- ), V = {};
1402
- Object.entries(o.config.customHeight).forEach(
1403
- ([T, I]) => {
1404
- b.has(T) && Number(I) === 1 && (V[T] = 1);
1405
- }
1406
- ), o.config.customHeight = V;
1407
- }
1408
- if (ve[r]) {
1409
- const b = Number(o.defaultColWidth) || Number(
1410
- (l = (k = (c = y.current) == null ? void 0 : c.getSettings) == null ? void 0 : k.call(c)) == null ? void 0 : l.defaultColWidth
1411
- ) || 99, V = Number(o.defaultRowHeight) || Number(
1412
- (L = (O = (s = y.current) == null ? void 0 : s.getSettings) == null ? void 0 : O.call(s)) == null ? void 0 : L.defaultRowHeight
1413
- ) || 21;
1414
- o.images = Ae(
1415
- ve[r],
1416
- o,
1417
- b,
1418
- V
1419
- );
1420
- }
1421
- const A = ye[r], P = Se[r], U = [], Y = (b, V) => {
1422
- const T = `${b}_${V}`;
1423
- Y._seen == null && (Y._seen = /* @__PURE__ */ new Set());
1424
- const I = Y._seen;
1425
- I.has(T) || (I.add(T), U.push({ r: b, c: V, id: o.id }));
1426
- }, E = (j = o.config) != null && j.merge ? /* @__PURE__ */ new Map() : null;
1427
- if (o.celldata)
1428
- for (const b of o.celldata) {
1429
- const V = `${b.r}_${b.c}`;
1430
- if (E == null || E.set(
1431
- V,
1432
- b
1433
- ), b.v) {
1434
- if (b.v.f) {
1435
- const H = String(b.v.f);
1436
- H.startsWith("=") || (b.v.f = `=${H}`);
1437
- }
1438
- if (b.v.f && ((W = b.v.ct) == null ? void 0 : W.t) !== "d" && (b.v.ct = { ...b.v.ct ?? {}, t: "str" }, Y(b.r, b.c)), P != null && P[V]) {
1439
- const H = P[V];
1440
- if (!!(A != null && A[V])) {
1441
- const { fc: fe, un: ne, ...Ke } = H;
1442
- Object.assign(b.v, Ke);
1443
- } else
1444
- Object.assign(b.v, H);
1445
- }
1446
- if (A != null && A[V] && !b.v.f) {
1447
- const H = A[V][0];
1448
- H && at(
1449
- b.v,
1450
- H
1451
- );
1452
- }
1453
- const T = (N = b.v.ct) == null ? void 0 : N.fa, I = typeof T == "string" ? T.trim().toLowerCase() : "", re = I === "general" || ((be = b.v.ct) == null ? void 0 : be.t) === "g", ue = I === "@" || ((Ce = b.v.ct) == null ? void 0 : Ce.t) === "s";
1454
- if (T && !t.has(T) && t.set(T, De.is_date(T)), !b.v.f && T && t.get(T)) {
1455
- const H = typeof b.v.v == "string" ? parseFloat(b.v.v) : b.v.v;
1456
- if (typeof H == "number" && !isNaN(H))
1457
- try {
1458
- b.v.v = H, b.v.m = De.format(T, H), b.v.ct = { ...b.v.ct, t: "d" };
1459
- } catch {
1460
- }
1461
- } else if (!b.v.f && typeof b.v.v == "string" && !ue && !re) {
1462
- const H = b.v.v.trim();
1463
- if (/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/.test(
1464
- H
1465
- )) {
1466
- const fe = Number(H);
1467
- if (!isFinite(fe))
1468
- continue;
1469
- if (b.v.v = fe, b.v.ht == null && (b.v.ht = 2), !T)
1470
- b.v.m = String(fe);
1471
- else
1472
- try {
1473
- b.v.m = De.format(T, fe);
1474
- } catch {
1475
- }
1476
- }
1477
- } else !b.v.f && typeof b.v.v == "number" && isFinite(b.v.v) && ((me = b.v.ct) == null ? void 0 : me.t) !== "s" && ((q = b.v.ct) == null ? void 0 : q.t) !== "d" && b.v.ht == null && (b.v.ht = 2);
1478
- if (!b.v.f && (b.v.m === void 0 || b.v.m === null) && ((pe = b.v.ct) == null ? void 0 : pe.t) !== "d") {
1479
- const H = ht((We = b.v.ct) == null ? void 0 : We.s), X = b.v.v;
1480
- if (!(X == null || String(X).trim() === ""))
1481
- if (H != null)
1482
- b.v.m = H;
1483
- else if (typeof X == "boolean")
1484
- b.v.m = ft(X);
1485
- else if (typeof X == "number" && isFinite(X)) {
1486
- const ne = (Ue = b.v.ct) == null ? void 0 : Ue.fa;
1487
- if (typeof ne == "string" && ne && t.get(ne) === !1)
1488
- try {
1489
- b.v.m = De.format(ne, X);
1490
- } catch {
1491
- b.v.m = String(X);
1492
- }
1493
- else
1494
- b.v.m = String(X);
1495
- } else typeof X == "object" || (b.v.m = String(X));
1496
- }
1497
- }
1498
- }
1499
- if (Array.isArray(o.data)) {
1500
- const b = o.data;
1501
- for (let V = 0; V < b.length; V++) {
1502
- const T = b[V];
1503
- if (Array.isArray(T))
1504
- for (let I = 0; I < T.length; I++) {
1505
- const re = T[I];
1506
- if (!re || typeof re != "object" || !re.f) continue;
1507
- const ue = String(re.f);
1508
- ue.startsWith("=") || (re.f = `=${ue}`), ((Ie = re.ct) == null ? void 0 : Ie.t) !== "d" && (re.ct = { ...re.ct ?? {}, t: "str" }, Y(V, I));
1509
- }
1510
- }
1511
- }
1512
- if (o.calcChain = U, E && ((Ye = o.config) != null && Ye.merge) && o.celldata)
1513
- for (const b of Object.values(o.config.merge)) {
1514
- const { r: V, c: T, rs: I, cs: re } = b;
1515
- for (let ue = 0; ue < I; ue++)
1516
- for (let H = 0; H < re; H++) {
1517
- const X = `${V + ue}_${T + H}`, fe = ue === 0 && H === 0;
1518
- let ne = E.get(X);
1519
- ne ? (ne.v || (ne.v = {}), ne.v.mc = fe ? { r: V, c: T, rs: I, cs: re } : { r: V, c: T }) : (ne = {
1520
- r: V + ue,
1521
- c: T + H,
1522
- v: fe ? { mc: { r: V, c: T, rs: I, cs: re } } : { mc: { r: V, c: T } }
1523
- }, o.celldata.push(ne), E.set(X, ne));
1524
- }
1525
- }
1526
- return o;
1527
- }), console.log("[xlsx-import] parsed sheets data", {
1528
- fileName: le.name,
1529
- sheetCount: ie.length,
1530
- sheets: ie
1531
- });
1532
- let e;
1533
- if (ke === "merge-current-dsheet") {
1534
- const o = new Set(
1535
- he.map(
1536
- (r) => r instanceof Ge.Map ? r.get("name") : r.name
1537
- ).filter(Boolean)
1538
- );
1539
- ie.forEach((r) => {
1540
- const h = r.name ?? "", x = ut(h, o);
1541
- x !== h && (r.name = x), o.add(x);
1542
- }), e = [...he, ...ie];
1543
- } else
1544
- e = [...ie];
1545
- if (e = e.map((o, r) => (o.order = r, o)), u.current.transact(() => {
1546
- ke !== "merge-current-dsheet" && te.delete(0, te.length), e.forEach((o) => {
1547
- if (o instanceof Ge.Map) return;
1548
- const r = tt(o);
1549
- te.push([r()]);
1550
- });
1551
- }), u != null && u.current) {
1552
- const o = u.current.getArray(p), r = rt(o);
1553
- w.current = r, g((h) => h + 1);
1554
- }
1555
- setTimeout(() => {
1556
- R == null || R();
1557
- }, 200), D != null && D.headless || gt(y);
1558
- const m = nt((i = Q == null ? void 0 : Q.info) == null ? void 0 : i.name);
1559
- C == null || C(m), M();
1560
- }
1561
- );
1562
- } catch (we) {
1563
- console.error("Error loading the workbook", we), !(D != null && D.suppressUiWarnings) && typeof alert < "u" && alert(
1564
- "Error loading the workbook. Please ensure it is a valid .xlsx file."
1565
- ), z(we);
1566
- }
1567
- }, ge.readAsArrayBuffer(le);
1568
- });
1569
- }
1570
- export {
1571
- vt as runXlsxFileUpload
1572
- };