@fileverse-dev/dsheet 4.0.2-a → 4.0.2-b

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