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