@fileverse-dev/dsheet 4.0.3 → 4.0.4

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