@fileverse-dev/dsheet 2.1.5 → 3.0.1-yjs-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/{constants-yStXQJiK.js → constants-Cdz6oSCq.js} +5 -7
  2. package/dist/constants.js +1 -1
  3. package/dist/editor/components/api-key-modal/api-key-input.d.ts +5 -0
  4. package/dist/editor/components/api-key-modal/api-key-modal.d.ts +7 -0
  5. package/dist/editor/components/api-key-modal/rate-limit-info.d.ts +4 -0
  6. package/dist/editor/components/comments/comment-actions-dropdown.d.ts +19 -0
  7. package/dist/editor/components/comments/comment-cell-popup.d.ts +4 -0
  8. package/dist/editor/components/comments/comment-input.d.ts +4 -0
  9. package/dist/editor/components/comments/comment-item.d.ts +4 -0
  10. package/dist/editor/components/comments/comment-sidebar-empty.d.ts +4 -0
  11. package/dist/editor/components/comments/comment-sidebar.d.ts +4 -0
  12. package/dist/editor/components/comments/ens/ens-cache.d.ts +10 -0
  13. package/dist/editor/components/comments/ens/use-ens-status.d.ts +10 -0
  14. package/dist/editor/components/comments/use-comment-cell-popup.d.ts +12 -0
  15. package/dist/editor/components/comments/use-comment-permissions.d.ts +15 -0
  16. package/dist/editor/components/editor-workbook.d.ts +11 -17
  17. package/dist/editor/components/sidebar/editor-right-sidebar.d.ts +20 -0
  18. package/dist/editor/components/sidebar/right-sidebar.d.ts +14 -0
  19. package/dist/editor/components/sidebar/sidebar-context.d.ts +17 -0
  20. package/dist/editor/components/sidebar/sidebar-portal-registry.d.ts +20 -0
  21. package/dist/editor/components/sidebar/use-right-panels.d.ts +12 -0
  22. package/dist/editor/components/sidebars/conditional-format.d.ts +2 -0
  23. package/dist/editor/components/sidebars/data-verification.d.ts +2 -0
  24. package/dist/editor/components/sidebars/function/function-categories-logic.d.ts +11 -0
  25. package/dist/editor/components/sidebars/function/function-categories.d.ts +6 -0
  26. package/dist/editor/components/sidebars/function/function-metadata.d.ts +7 -0
  27. package/dist/editor/components/sidebars/function/functionList.d.ts +8 -0
  28. package/dist/editor/components/sidebars/function/types.d.ts +24 -0
  29. package/dist/editor/components/sidebars/function/use-functions.d.ts +20 -0
  30. package/dist/editor/components/sidebars/function-content.d.ts +8 -0
  31. package/dist/editor/components/sidebars/template-ui.d.ts +22 -0
  32. package/dist/editor/components/sidebars/templates.d.ts +9 -0
  33. package/dist/editor/components/smart-contract/error-toast.d.ts +11 -0
  34. package/dist/editor/components/smart-contract/modal/abi-input-section.d.ts +11 -0
  35. package/dist/editor/components/smart-contract/modal/contract-name-section.d.ts +13 -0
  36. package/dist/editor/components/smart-contract/modal/file-upload-section.d.ts +12 -0
  37. package/dist/editor/components/smart-contract/modal/import-section.d.ts +8 -0
  38. package/dist/editor/components/smart-contract/modal/modal-header.d.ts +17 -0
  39. package/dist/editor/components/smart-contract/smart-contract-list-item.d.ts +8 -0
  40. package/dist/editor/components/smart-contract/smart-contract-modal-ui.d.ts +33 -0
  41. package/dist/editor/components/smart-contract/smart-contract-modal.d.ts +12 -0
  42. package/dist/editor/components/smart-contract/smart-contract-reading-intro.d.ts +4 -0
  43. package/dist/editor/components/smart-contract/smart-contract-view-list.d.ts +6 -0
  44. package/dist/editor/components/smart-contract/use-address-validation.d.ts +5 -0
  45. package/dist/editor/components/smart-contract/use-modal-outside-click.d.ts +18 -0
  46. package/dist/editor/components/smart-contract/use-smart-contract-modal.d.ts +38 -0
  47. package/dist/editor/constants/shared-constants.d.ts +0 -2
  48. package/dist/editor/contexts/editor-context.d.ts +20 -5
  49. package/dist/editor/dsheet-editor.d.ts +1 -1
  50. package/dist/editor/hooks/live-query/use-live-query.d.ts +4 -2
  51. package/dist/editor/hooks/use-editor-data.d.ts +4 -2
  52. package/dist/editor/hooks/use-smart-contract.d.ts +26 -0
  53. package/dist/editor/hooks/use-xlsx-import-impl.d.ts +7 -1
  54. package/dist/editor/types/comments.d.ts +134 -0
  55. package/dist/editor/types/smart-contract.d.ts +88 -0
  56. package/dist/editor/types.d.ts +39 -32
  57. package/dist/editor/utils/after-update-cell.d.ts +13 -8
  58. package/dist/editor/utils/api-key-storage.d.ts +6 -0
  59. package/dist/editor/utils/api-keys-local-storage.d.ts +19 -0
  60. package/dist/editor/utils/cell-comment-marker.d.ts +30 -0
  61. package/dist/editor/utils/comment-key-utils.d.ts +7 -0
  62. package/dist/editor/utils/config-ydoc-update.d.ts +20 -0
  63. package/dist/editor/utils/csv-import.d.ts +3 -1
  64. package/dist/editor/utils/data-block-error-handler.d.ts +21 -0
  65. package/dist/editor/utils/datablock-error-utils.d.ts +1 -0
  66. package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
  67. package/dist/editor/utils/smart-contract/constants.d.ts +488 -0
  68. package/dist/editor/utils/smart-contract/error-helper.d.ts +20 -0
  69. package/dist/editor/utils/smart-contract/helpers.d.ts +4 -0
  70. package/dist/editor/utils/smart-contract/reading-utils.d.ts +34 -0
  71. package/dist/editor/utils/smart-contract/signature-utils.d.ts +9 -0
  72. package/dist/editor/utils/spreadsheet-import.d.ts +12 -0
  73. package/dist/executeStringFunction-B2qjYgmE.js +31914 -0
  74. package/dist/formula.js +1 -1
  75. package/dist/index-C7kCuqoG.js +54326 -0
  76. package/dist/index.d.ts +11 -1
  77. package/dist/index.es.js +54 -48
  78. package/dist/observability/publish-trace.d.ts +26 -0
  79. package/dist/sheet-engine/core/api/cell.d.ts +0 -20
  80. package/dist/sheet-engine/core/api/common.d.ts +2 -1
  81. package/dist/sheet-engine/core/api/index.d.ts +1 -0
  82. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +15 -0
  83. package/dist/sheet-engine/core/api/sheet.d.ts +5 -0
  84. package/dist/sheet-engine/core/context.d.ts +5 -0
  85. package/dist/sheet-engine/core/index.d.ts +1 -1
  86. package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +53 -0
  87. package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
  88. package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
  89. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +40 -0
  90. package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
  91. package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +17 -0
  92. package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +24 -0
  93. package/dist/sheet-engine/core/modules/formula.d.ts +26 -1
  94. package/dist/sheet-engine/core/modules/index.d.ts +3 -1
  95. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +23 -0
  96. package/dist/sheet-engine/core/theme.d.ts +67 -0
  97. package/dist/sheet-engine/core/types.d.ts +3 -0
  98. package/dist/sheet-engine/core/utils/border-config-utils.d.ts +10 -0
  99. package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +8 -0
  100. package/dist/sheet-engine/core/utils/range-format.d.ts +43 -0
  101. package/dist/sheet-engine/react/components/SheetOverlay/Icon.d.ts +5 -4
  102. package/dist/sheet-engine/react/components/SheetOverlay/LucideIcon.d.ts +4 -4
  103. package/dist/sheet-engine/react/components/SidebarPanelPortals/index.d.ts +17 -0
  104. package/dist/sheet-engine/react/components/Workbook/api.d.ts +8 -1
  105. package/dist/sheet-engine/react/components/Workbook/index.d.ts +11 -1
  106. package/dist/sheet-engine/react/components/index.d.ts +1 -0
  107. package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
  108. package/dist/style.css +1 -1
  109. package/dist/use-xlsx-import-impl-BQsXcyKJ.js +1551 -0
  110. package/dist/{xlsx-export-impl-DP_eK3zS.js → xlsx-export-impl-BBux0CIG.js} +1106 -1106
  111. package/package.json +6 -4
  112. package/dist/executeStringFunction-BkmJj04p.js +0 -27295
  113. package/dist/index-Drl8OuI3.js +0 -52659
  114. package/dist/sheet-engine/react/components/Toolbar/conditionalFormatPortal.d.ts +0 -7
  115. package/dist/sheet-engine/react/components/Toolbar/dataVerificationPortal.d.ts +0 -6
  116. package/dist/use-xlsx-import-impl-DC_BfAcT.js +0 -1527
@@ -0,0 +1,1551 @@
1
+ import { g as Qe } from "./executeStringFunction-B2qjYgmE.js";
2
+ import * as Ke from "yjs";
3
+ import { m as et, y as tt, r as rt } from "./index-C7kCuqoG.js";
4
+ import { n as nt } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
+ import { toast as Ye } from "@fileverse/ui";
6
+ var Xe = { exports: {} };
7
+ (function(k) {
8
+ var s = {}, g = function(p) {
9
+ p.version = "0.11.2";
10
+ function v(t) {
11
+ for (var r = "", n = t.length - 1; n >= 0; ) r += t.charAt(n--);
12
+ return r;
13
+ }
14
+ function $(t, r) {
15
+ for (var n = ""; n.length < r; ) n += t;
16
+ return n;
17
+ }
18
+ function T(t, r) {
19
+ var n = "" + t;
20
+ return n.length >= r ? n : $("0", r - n.length) + n;
21
+ }
22
+ function D(t, r) {
23
+ var n = "" + t;
24
+ return n.length >= r ? n : $(" ", r - n.length) + n;
25
+ }
26
+ function I(t, r) {
27
+ var n = "" + t;
28
+ return n.length >= r ? n : n + $(" ", r - n.length);
29
+ }
30
+ function J(t, r) {
31
+ var n = "" + Math.round(t);
32
+ return n.length >= r ? n : $("0", r - n.length) + n;
33
+ }
34
+ function V(t, r) {
35
+ var n = "" + t;
36
+ return n.length >= r ? n : $("0", r - n.length) + n;
37
+ }
38
+ var ie = Math.pow(2, 32);
39
+ function re(t, r) {
40
+ if (t > ie || t < -ie) return J(t, r);
41
+ var n = Math.round(t);
42
+ return V(n, r);
43
+ }
44
+ function fe(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 Ce = [
48
+ ["Sun", "Sunday"],
49
+ ["Mon", "Monday"],
50
+ ["Tue", "Tuesday"],
51
+ ["Wed", "Wednesday"],
52
+ ["Thu", "Thursday"],
53
+ ["Fri", "Friday"],
54
+ ["Sat", "Saturday"]
55
+ ], Ae = [
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 ce = {};
73
+ Ee(ce);
74
+ var Q = [], M = 0;
75
+ for (M = 5; M <= 8; ++M) Q[M] = 32 + M;
76
+ for (M = 23; M <= 26; ++M) Q[M] = 0;
77
+ for (M = 27; M <= 31; ++M) Q[M] = 14;
78
+ for (M = 50; M <= 58; ++M) Q[M] = 14;
79
+ for (M = 59; M <= 62; ++M) Q[M] = M - 58;
80
+ for (M = 67; M <= 68; ++M) Q[M] = M - 58;
81
+ for (M = 72; M <= 75; ++M) Q[M] = M - 58;
82
+ for (M = 67; M <= 68; ++M) Q[M] = M - 57;
83
+ for (M = 76; M <= 78; ++M) Q[M] = M - 56;
84
+ for (M = 79; M <= 81; ++M) Q[M] = M - 34;
85
+ var G = [];
86
+ G[5] = G[63] = '"$"#,##0_);\\("$"#,##0\\)', G[6] = G[64] = '"$"#,##0_);[Red]\\("$"#,##0\\)', G[7] = G[65] = '"$"#,##0.00_);\\("$"#,##0.00\\)', G[8] = G[66] = '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', G[41] = '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', G[42] = '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', G[43] = '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', G[44] = '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';
87
+ function we(t, r, n) {
88
+ for (var m = t < 0 ? -1 : 1, e = t * m, b = 0, a = 1, f = 0, C = 1, u = 0, y = 0, _ = Math.floor(e); u < r && (_ = Math.floor(e), f = _ * a + b, y = _ * u + C, !(e - _ < 5e-8)); )
89
+ e = 1 / (e - _), b = a, a = f, C = u, u = y;
90
+ if (y > r && (u > r ? (y = C, f = b) : (y = u, f = a)), !n) return [0, m * f, y];
91
+ var H = Math.floor(m * f / y);
92
+ return [H, m * f - H * y, y];
93
+ }
94
+ function ye(t, r, n) {
95
+ if (t > 2958465 || t < 0) return null;
96
+ var m = t | 0, e = Math.floor(86400 * (t - m)), b = 0, a = [], f = { D: m, T: e, u: 86400 * (t - m) - e, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
97
+ if (Math.abs(f.u) < 1e-6 && (f.u = 0), r && r.date1904 && (m += 1462), f.u > 0.9999 && (f.u = 0, ++e == 86400 && (f.T = e = 0, ++m, ++f.D)), m === 60)
98
+ a = n ? [1317, 10, 29] : [1900, 2, 29], b = 3;
99
+ else if (m === 0)
100
+ a = n ? [1317, 8, 29] : [1900, 1, 0], b = 6;
101
+ else {
102
+ m > 60 && --m;
103
+ var C = new Date(1900, 0, 1);
104
+ C.setDate(C.getDate() + m - 1), a = [C.getFullYear(), C.getMonth() + 1, C.getDate()], b = C.getDay(), m < 60 && (b = (b + 6) % 7), n && (b = Fe(C, a));
105
+ }
106
+ return f.y = a[0], f.m = a[1], f.d = a[2], f.S = e % 60, e = Math.floor(e / 60), f.M = e % 60, e = Math.floor(e / 60), f.H = e, f.q = b, f;
107
+ }
108
+ p.parse_date_code = ye;
109
+ var Se = new Date(1899, 11, 31, 0, 0, 0), Re = Se.getTime(), Le = new Date(1900, 2, 1, 0, 0, 0);
110
+ function Ne(t, r) {
111
+ var n = t.getTime();
112
+ return r ? n -= 1262304e5 : t >= Le && (n += 864e5), (n - (Re + (t.getTimezoneOffset() - Se.getTimezoneOffset()) * 6e4)) / 864e5;
113
+ }
114
+ function He(t) {
115
+ return t.toString(10);
116
+ }
117
+ p._general_int = He;
118
+ var Te = /* @__PURE__ */ function() {
119
+ var r = /(?:\.0*|(\.\d*[1-9])0+)$/;
120
+ function n(u) {
121
+ return u.indexOf(".") == -1 ? u : u.replace(r, "$1");
122
+ }
123
+ var m = /(?:\.0*|(\.\d*[1-9])0+)[Ee]/, e = /(E[+-])(\d)$/;
124
+ function b(u) {
125
+ return u.indexOf("E") == -1 ? u : u.replace(m, "$1E").replace(e, "$10$2");
126
+ }
127
+ function a(u) {
128
+ var y = u < 0 ? 12 : 11, _ = n(u.toFixed(12));
129
+ return _.length <= y || (_ = u.toPrecision(10), _.length <= y) ? _ : u.toExponential(5);
130
+ }
131
+ function f(u) {
132
+ var y = n(u.toFixed(11));
133
+ return y.length > (u < 0 ? 12 : 11) || y === "0" || y === "-0" ? u.toPrecision(6) : y;
134
+ }
135
+ function C(u) {
136
+ var y = Math.floor(Math.log(Math.abs(u)) * Math.LOG10E), _;
137
+ return y >= -4 && y <= -1 ? _ = u.toPrecision(10 + y) : Math.abs(y) <= 9 ? _ = a(u) : y === 10 ? _ = u.toFixed(10).substr(0, 12) : _ = f(u), n(b(_.toUpperCase()));
138
+ }
139
+ return C;
140
+ }();
141
+ p._general_num = Te;
142
+ function ge(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) : Te(t);
150
+ case "undefined":
151
+ return "";
152
+ case "object":
153
+ if (t == null) return "";
154
+ if (t instanceof Date) return de(14, Ne(t, r && r.date1904), r);
155
+ }
156
+ throw new Error("unsupported value in General format: " + t);
157
+ }
158
+ p._general = ge;
159
+ function Fe(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, m) {
165
+ var e = "", b = 0, a = 0, f = n.y, C, u = 0;
166
+ switch (t) {
167
+ case 98:
168
+ f = n.y + 543;
169
+ case 121:
170
+ switch (r.length) {
171
+ case 1:
172
+ case 2:
173
+ C = f % 100, u = 2;
174
+ break;
175
+ default:
176
+ C = f % 1e4, u = 4;
177
+ break;
178
+ }
179
+ break;
180
+ case 109:
181
+ switch (r.length) {
182
+ case 1:
183
+ case 2:
184
+ C = n.m, u = r.length;
185
+ break;
186
+ case 3:
187
+ return Ae[n.m - 1][1];
188
+ case 5:
189
+ return Ae[n.m - 1][0];
190
+ default:
191
+ return Ae[n.m - 1][2];
192
+ }
193
+ break;
194
+ case 100:
195
+ switch (r.length) {
196
+ case 1:
197
+ case 2:
198
+ C = n.d, u = r.length;
199
+ break;
200
+ case 3:
201
+ return Ce[n.q][0];
202
+ default:
203
+ return Ce[n.q][1];
204
+ }
205
+ break;
206
+ case 104:
207
+ switch (r.length) {
208
+ case 1:
209
+ case 2:
210
+ C = 1 + (n.H + 11) % 12, u = 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
+ C = n.H, u = 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
+ C = n.M, u = 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") ? T(n.S, r.length) : (m >= 2 ? a = m === 3 ? 1e3 : 100 : a = m === 1 ? 10 : 1, b = Math.round(a * (n.S + n.u)), b >= 60 * a && (b = 0), r === "s" ? b === 0 ? "0" : "" + b / a : (e = T(b, 2 + m), r === "ss" ? e.substr(0, 2) : "." + e.substr(2, r.length - 1)));
239
+ case 90:
240
+ switch (r) {
241
+ case "[h]":
242
+ case "[hh]":
243
+ C = n.D * 24 + n.H;
244
+ break;
245
+ case "[m]":
246
+ case "[mm]":
247
+ C = (n.D * 24 + n.H) * 60 + n.M;
248
+ break;
249
+ case "[s]":
250
+ case "[ss]":
251
+ C = ((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
+ u = r.length === 3 ? 1 : 2;
257
+ break;
258
+ case 101:
259
+ C = f, u = 1;
260
+ break;
261
+ }
262
+ var y = u > 0 ? T(C, u) : "";
263
+ return y;
264
+ }
265
+ function oe(t) {
266
+ var r = 3;
267
+ if (t.length <= r) return t;
268
+ for (var n = t.length % r, m = t.substr(0, n); n != t.length; n += r) m += (m.length > 0 ? "," : "") + t.substr(n, r);
269
+ return m;
270
+ }
271
+ var ne = /* @__PURE__ */ function() {
272
+ var r = /%/g;
273
+ function n(h, i, c) {
274
+ var A = i.replace(r, ""), o = i.length - A.length;
275
+ return ne(h, A, c * Math.pow(10, 2 * o)) + $("%", o);
276
+ }
277
+ function m(h, i, c) {
278
+ for (var A = i.length - 1; i.charCodeAt(A - 1) === 44; ) --A;
279
+ return ne(h, i.substr(0, A), c / Math.pow(10, 3 * (i.length - A)));
280
+ }
281
+ function e(h, i) {
282
+ var c, A = h.indexOf("E") - h.indexOf(".") - 1;
283
+ if (h.match(/^#+0.0E\+0$/)) {
284
+ if (i == 0) return "0.0E+0";
285
+ if (i < 0) return "-" + e(h, -i);
286
+ var o = h.indexOf(".");
287
+ o === -1 && (o = h.indexOf("E"));
288
+ var l = Math.floor(Math.log(i) * Math.LOG10E) % o;
289
+ if (l < 0 && (l += o), c = (i / Math.pow(10, l)).toPrecision(A + 1 + (o + l) % o), c.indexOf("e") === -1) {
290
+ var E = Math.floor(Math.log(i) * Math.LOG10E);
291
+ for (c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (E - c.length + l) : c += "E+" + (E - l); c.substr(0, 2) === "0."; )
292
+ c = c.charAt(0) + c.substr(2, o) + "." + c.substr(2 + o), 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, (o + l) % o) + "." + N.substr(l) + "E";
297
+ });
298
+ } else c = i.toExponential(A);
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 b = /# (\?+)( ?)\/( ?)(\d+)/;
302
+ function a(h, i, c) {
303
+ var A = parseInt(h[4], 10), o = Math.round(i * A), l = Math.floor(o / A), E = o - l * A, L = A;
304
+ return c + (l === 0 ? "" : "" + l) + " " + (E === 0 ? $(" ", h[1].length + 1 + h[4].length) : D(E, h[1].length) + h[2] + "/" + h[3] + T(L, h[4].length));
305
+ }
306
+ function f(h, i, c) {
307
+ return c + (i === 0 ? "" : "" + i) + $(" ", h[1].length + 2 + h[4].length);
308
+ }
309
+ var C = /^#*0*\.([0#]+)/, u = /\).*[0#]/, y = /\(###\) ###\\?-####/;
310
+ function _(h) {
311
+ for (var i = "", c, A = 0; A != h.length; ++A) switch (c = h.charCodeAt(A)) {
312
+ case 35:
313
+ break;
314
+ case 63:
315
+ i += " ";
316
+ break;
317
+ case 48:
318
+ i += "0";
319
+ break;
320
+ default:
321
+ i += String.fromCharCode(c);
322
+ }
323
+ return i;
324
+ }
325
+ function H(h, i) {
326
+ var c = Math.pow(10, i);
327
+ return "" + Math.round(h * c) / c;
328
+ }
329
+ function U(h, i) {
330
+ var c = h - Math.floor(h), A = Math.pow(10, i);
331
+ return i < ("" + Math.round(c * A)).length ? 0 : Math.round(c * A);
332
+ }
333
+ function S(h, i) {
334
+ return i < ("" + Math.round((h - Math.floor(h)) * Math.pow(10, i))).length ? 1 : 0;
335
+ }
336
+ function R(h) {
337
+ return h < 2147483647 && h > -2147483648 ? "" + (h >= 0 ? h | 0 : h - 1 | 0) : "" + Math.floor(h);
338
+ }
339
+ function O(h, i, c) {
340
+ if (h.charCodeAt(0) === 40 && !i.match(u)) {
341
+ var A = i.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
342
+ return c >= 0 ? O("n", A, c) : "(" + O("n", A, -c) + ")";
343
+ }
344
+ if (i.charCodeAt(i.length - 1) === 44) return m(h, i, c);
345
+ if (i.indexOf("%") !== -1) return n(h, i, c);
346
+ if (i.indexOf("E") !== -1) return e(i, c);
347
+ if (i.charCodeAt(0) === 36) return "$" + O(h, i.substr(i.charAt(1) == " " ? 2 : 1), c);
348
+ var o, l, E, L, B = Math.abs(c), W = c < 0 ? "-" : "";
349
+ if (i.match(/^00+$/)) return W + re(B, i.length);
350
+ if (i.match(/^[#?]+$/))
351
+ return o = re(c, 0), o === "0" && (o = ""), o.length > i.length ? o : _(i.substr(0, i.length - o.length)) + o;
352
+ if (l = i.match(b)) return a(l, B, W);
353
+ if (i.match(/^#+0+$/)) return W + re(B, i.length - i.indexOf("0"));
354
+ if (l = i.match(C))
355
+ return o = H(c, l[1].length).replace(/^([^\.]+)$/, "$1." + _(l[1])).replace(/\.$/, "." + _(l[1])).replace(/\.(\d*)$/, function(z, pe) {
356
+ return "." + pe + $("0", _(l[1]).length - pe.length);
357
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
358
+ if (i = i.replace(/^#+([0.])/, "$1"), l = i.match(/^(0*)\.(#*)$/))
359
+ return W + H(B, l[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, l[1].length ? "0." : ".");
360
+ if (l = i.match(/^#{1,3},##0(\.?)$/)) return W + oe(re(B, 0));
361
+ if (l = i.match(/^#,##0\.([#0]*0)$/))
362
+ return c < 0 ? "-" + O(h, i, -c) : oe("" + (Math.floor(c) + S(c, l[1].length))) + "." + T(U(c, l[1].length), l[1].length);
363
+ if (l = i.match(/^#,#*,#0/)) return O(h, i.replace(/^#,#*,/, ""), c);
364
+ if (l = i.match(/^([0#]+)(\\?-([0#]+))+$/))
365
+ return o = v(O(h, i.replace(/[\\-]/g, ""), c)), E = 0, v(v(i.replace(/\\/g, "")).replace(/[0#]/g, function(z) {
366
+ return E < o.length ? o.charAt(E++) : z === "0" ? "0" : "";
367
+ }));
368
+ if (i.match(y))
369
+ return o = O(h, "##########", c), "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
370
+ var N = "";
371
+ if (l = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
372
+ return E = Math.min(l[4].length, 7), L = we(B, Math.pow(10, E) - 1, !1), o = "" + W, N = ne("n", l[1], L[1]), N.charAt(N.length - 1) == " " && (N = N.substr(0, N.length - 1) + "0"), o += N + l[2] + "/" + l[3], N = I(L[2], E), N.length < l[4].length && (N = _(l[4].substr(l[4].length - N.length)) + N), o += N, o;
373
+ if (l = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
374
+ return E = Math.min(Math.max(l[1].length, l[4].length), 7), L = we(B, Math.pow(10, E) - 1, !0), W + (L[0] || (L[1] ? "" : "0")) + " " + (L[1] ? D(L[1], E) + l[2] + "/" + l[3] + I(L[2], E) : $(" ", 2 * E + 1 + l[2].length + l[3].length));
375
+ if (l = i.match(/^[#0?]+$/))
376
+ return o = re(c, 0), i.length <= o.length ? o : _(i.substr(0, i.length - o.length)) + o;
377
+ if (l = i.match(/^([#0?]+)\.([#0]+)$/)) {
378
+ o = "" + c.toFixed(Math.min(l[2].length, 10)).replace(/([^0])0+$/, "$1"), E = o.indexOf(".");
379
+ var be = i.indexOf(".") - E, ve = i.length - o.length - be;
380
+ return _(i.substr(0, be) + o + i.substr(i.length - ve));
381
+ }
382
+ if (l = i.match(/^00,000\.([#0]*0)$/))
383
+ return E = U(c, l[1].length), c < 0 ? "-" + O(h, i, -c) : oe(R(c)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(z) {
384
+ return "00," + (z.length < 3 ? T(0, 3 - z.length) : "") + z;
385
+ }) + "." + T(E, l[1].length);
386
+ switch (i) {
387
+ case "###,##0.00":
388
+ return O(h, "#,##0.00", c);
389
+ case "###,###":
390
+ case "##,###":
391
+ case "#,###":
392
+ var me = oe(re(B, 0));
393
+ return me !== "0" ? W + me : "";
394
+ case "###,###.00":
395
+ return O(h, "###,##0.00", c).replace(/^0\./, ".");
396
+ case "#,###.00":
397
+ return O(h, "#,##0.00", c).replace(/^0\./, ".");
398
+ }
399
+ throw new Error("unsupported format |" + i + "|");
400
+ }
401
+ function se(h, i, c) {
402
+ for (var A = i.length - 1; i.charCodeAt(A - 1) === 44; ) --A;
403
+ return ne(h, i.substr(0, A), c / Math.pow(10, 3 * (i.length - A)));
404
+ }
405
+ function ue(h, i, c) {
406
+ var A = i.replace(r, ""), o = i.length - A.length;
407
+ return ne(h, A, c * Math.pow(10, 2 * o)) + $("%", o);
408
+ }
409
+ function Z(h, i) {
410
+ var c, A = h.indexOf("E") - h.indexOf(".") - 1;
411
+ if (h.match(/^#+0.0E\+0$/)) {
412
+ if (i == 0) return "0.0E+0";
413
+ if (i < 0) return "-" + Z(h, -i);
414
+ var o = h.indexOf(".");
415
+ o === -1 && (o = h.indexOf("E"));
416
+ var l = Math.floor(Math.log(i) * Math.LOG10E) % o;
417
+ if (l < 0 && (l += o), c = (i / Math.pow(10, l)).toPrecision(A + 1 + (o + l) % o), !c.match(/[Ee]/)) {
418
+ var E = Math.floor(Math.log(i) * Math.LOG10E);
419
+ c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (E - c.length + l) : c += "E+" + (E - l), c = c.replace(/\+-/, "-");
420
+ }
421
+ c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(L, B, W, N) {
422
+ return B + W + N.substr(0, (o + l) % o) + "." + N.substr(l) + "E";
423
+ });
424
+ } else c = i.toExponential(A);
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 x(h, i, c) {
428
+ if (h.charCodeAt(0) === 40 && !i.match(u)) {
429
+ var A = i.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
430
+ return c >= 0 ? x("n", A, c) : "(" + x("n", A, -c) + ")";
431
+ }
432
+ if (i.charCodeAt(i.length - 1) === 44) return se(h, i, c);
433
+ if (i.indexOf("%") !== -1) return ue(h, i, c);
434
+ if (i.indexOf("E") !== -1) return Z(i, c);
435
+ if (i.charCodeAt(0) === 36) return "$" + x(h, i.substr(i.charAt(1) == " " ? 2 : 1), c);
436
+ var o, l, E, L, B = Math.abs(c), W = c < 0 ? "-" : "";
437
+ if (i.match(/^00+$/)) return W + T(B, i.length);
438
+ if (i.match(/^[#?]+$/))
439
+ return o = "" + c, c === 0 && (o = ""), o.length > i.length ? o : _(i.substr(0, i.length - o.length)) + o;
440
+ if (l = i.match(b)) return f(l, B, W);
441
+ if (i.match(/^#+0+$/)) return W + T(B, i.length - i.indexOf("0"));
442
+ if (l = i.match(C))
443
+ return o = ("" + c).replace(/^([^\.]+)$/, "$1." + _(l[1])).replace(/\.$/, "." + _(l[1])), o = o.replace(/\.(\d*)$/, function(z, pe) {
444
+ return "." + pe + $("0", _(l[1]).length - pe.length);
445
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
446
+ if (i = i.replace(/^#+([0.])/, "$1"), l = i.match(/^(0*)\.(#*)$/))
447
+ return W + ("" + B).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, l[1].length ? "0." : ".");
448
+ if (l = i.match(/^#{1,3},##0(\.?)$/)) return W + oe("" + B);
449
+ if (l = i.match(/^#,##0\.([#0]*0)$/))
450
+ return c < 0 ? "-" + x(h, i, -c) : oe("" + c) + "." + $("0", l[1].length);
451
+ if (l = i.match(/^#,#*,#0/)) return x(h, i.replace(/^#,#*,/, ""), c);
452
+ if (l = i.match(/^([0#]+)(\\?-([0#]+))+$/))
453
+ return o = v(x(h, i.replace(/[\\-]/g, ""), c)), E = 0, v(v(i.replace(/\\/g, "")).replace(/[0#]/g, function(z) {
454
+ return E < o.length ? o.charAt(E++) : z === "0" ? "0" : "";
455
+ }));
456
+ if (i.match(y))
457
+ return o = x(h, "##########", c), "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
458
+ var N = "";
459
+ if (l = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
460
+ return E = Math.min(l[4].length, 7), L = we(B, Math.pow(10, E) - 1, !1), o = "" + W, N = ne("n", l[1], L[1]), N.charAt(N.length - 1) == " " && (N = N.substr(0, N.length - 1) + "0"), o += N + l[2] + "/" + l[3], N = I(L[2], E), N.length < l[4].length && (N = _(l[4].substr(l[4].length - N.length)) + N), o += N, o;
461
+ if (l = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
462
+ return E = Math.min(Math.max(l[1].length, l[4].length), 7), L = we(B, Math.pow(10, E) - 1, !0), W + (L[0] || (L[1] ? "" : "0")) + " " + (L[1] ? D(L[1], E) + l[2] + "/" + l[3] + I(L[2], E) : $(" ", 2 * E + 1 + l[2].length + l[3].length));
463
+ if (l = i.match(/^[#0?]+$/))
464
+ return o = "" + c, i.length <= o.length ? o : _(i.substr(0, i.length - o.length)) + o;
465
+ if (l = i.match(/^([#0]+)\.([#0]+)$/)) {
466
+ o = "" + c.toFixed(Math.min(l[2].length, 10)).replace(/([^0])0+$/, "$1"), E = o.indexOf(".");
467
+ var be = i.indexOf(".") - E, ve = i.length - o.length - be;
468
+ return _(i.substr(0, be) + o + i.substr(i.length - ve));
469
+ }
470
+ if (l = i.match(/^00,000\.([#0]*0)$/))
471
+ return c < 0 ? "-" + x(h, i, -c) : oe("" + c).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(z) {
472
+ return "00," + (z.length < 3 ? T(0, 3 - z.length) : "") + z;
473
+ }) + "." + T(0, l[1].length);
474
+ switch (i) {
475
+ case "###,###":
476
+ case "##,###":
477
+ case "#,###":
478
+ var me = oe("" + B);
479
+ return me !== "0" ? W + me : "";
480
+ default:
481
+ if (i.match(/\.[0#?]*$/)) return x(h, i.slice(0, i.lastIndexOf(".")), c) + _(i.slice(i.lastIndexOf(".")));
482
+ }
483
+ throw new Error("unsupported format |" + i + "|");
484
+ }
485
+ return function(i, c, A) {
486
+ return (A | 0) === A ? x(i, c, A) : O(i, c, A);
487
+ };
488
+ }();
489
+ function ke(t) {
490
+ for (var r = [], n = !1, m = 0, e = 0; m < t.length; ++m) switch (
491
+ /*cc=*/
492
+ t.charCodeAt(m)
493
+ ) {
494
+ case 34:
495
+ n = !n;
496
+ break;
497
+ case 95:
498
+ case 42:
499
+ case 92:
500
+ ++m;
501
+ break;
502
+ case 59:
503
+ r[r.length] = t.substr(e, m - e), e = m + 1;
504
+ }
505
+ if (r[r.length] = t.substr(e), n === !0) throw new Error("Format |" + t + "| unterminated string ");
506
+ return r;
507
+ }
508
+ p._split = ke;
509
+ var _e = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
510
+ function xe(t) {
511
+ for (var r = 0, n = "", m = ""; r < t.length; )
512
+ switch (n = t.charAt(r)) {
513
+ case "G":
514
+ fe(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 (m = n; t.charAt(r++) !== "]" && r < t.length; ) m += t.charAt(r);
559
+ if (m.match(_e)) 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 = xe;
600
+ function $e(t, r, n, m) {
601
+ for (var e = [], b = "", a = 0, f = "", C = "t", u, y, _, H = "H"; a < t.length; )
602
+ switch (f = t.charAt(a)) {
603
+ case "G":
604
+ if (!fe(t, a)) throw new Error("unrecognized character " + f + " in " + t);
605
+ e[e.length] = { t: "G", v: "General" }, a += 7;
606
+ break;
607
+ case '"':
608
+ for (b = ""; (_ = t.charCodeAt(++a)) !== 34 && a < t.length; ) b += String.fromCharCode(_);
609
+ e[e.length] = { t: "t", v: b }, ++a;
610
+ break;
611
+ case "\\":
612
+ var U = t.charAt(++a), S = U === "(" || U === ")" ? U : "t";
613
+ e[e.length] = { t: S, v: U }, ++a;
614
+ break;
615
+ case "_":
616
+ e[e.length] = { t: "t", v: " " }, a += 2;
617
+ break;
618
+ case "@":
619
+ e[e.length] = { t: "T", v: r }, ++a;
620
+ break;
621
+ case "B":
622
+ case "b":
623
+ if (t.charAt(a + 1) === "1" || t.charAt(a + 1) === "2") {
624
+ if (u == null && (u = ye(r, n, t.charAt(a + 1) === "2"), u == null))
625
+ return "";
626
+ e[e.length] = { t: "X", v: t.substr(a, 2) }, C = f, a += 2;
627
+ break;
628
+ }
629
+ case "M":
630
+ case "D":
631
+ case "Y":
632
+ case "H":
633
+ case "S":
634
+ case "E":
635
+ f = f.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 || u == null && (u = ye(r, n), u == null))
644
+ return "";
645
+ for (b = f; ++a < t.length && t.charAt(a).toLowerCase() === f; ) b += f;
646
+ f === "m" && C.toLowerCase() === "h" && (f = "M"), f === "h" && (f = H), e[e.length] = { t: f, v: b }, C = f;
647
+ break;
648
+ case "A":
649
+ case "a":
650
+ case "上":
651
+ var R = { t: f, v: f };
652
+ if (u == null && (u = ye(r, n)), t.substr(a, 3).toUpperCase() === "A/P" ? (u != null && (R.v = u.H >= 12 ? "P" : "A"), R.t = "T", H = "h", a += 3) : t.substr(a, 5).toUpperCase() === "AM/PM" ? (u != null && (R.v = u.H >= 12 ? "PM" : "AM"), R.t = "T", a += 5, H = "h") : t.substr(a, 5).toUpperCase() === "上午/下午" ? (u != null && (R.v = u.H >= 12 ? "下午" : "上午"), R.t = "T", a += 5, H = "h") : (R.t = "t", ++a), u == null && R.t === "T") return "";
653
+ e[e.length] = R, C = f;
654
+ break;
655
+ case "[":
656
+ for (b = f; t.charAt(a++) !== "]" && a < t.length; ) b += t.charAt(a);
657
+ if (b.slice(-1) !== "]") throw 'unterminated "[" block: |' + b + "|";
658
+ if (b.match(_e)) {
659
+ if (u == null && (u = ye(r, n), u == null))
660
+ return "";
661
+ e[e.length] = { t: "Z", v: b.toLowerCase() }, C = b.charAt(1);
662
+ } else b.indexOf("$") > -1 && (b = (b.match(/\$([^-\[\]]*)/) || [])[1] || "$", xe(t) || (e[e.length] = { t: "t", v: b }));
663
+ break;
664
+ case ".":
665
+ if (u != null) {
666
+ for (b = f; ++a < t.length && (f = t.charAt(a)) === "0"; ) b += f;
667
+ e[e.length] = { t: "s", v: b };
668
+ break;
669
+ }
670
+ case "0":
671
+ case "#":
672
+ for (b = f; ++a < t.length && "0#?.,E+-%".indexOf(f = t.charAt(a)) > -1; ) b += f;
673
+ e[e.length] = { t: "n", v: b };
674
+ break;
675
+ case "?":
676
+ for (b = f; t.charAt(++a) === f; ) b += f;
677
+ e[e.length] = { t: f, v: b }, C = f;
678
+ break;
679
+ case "*":
680
+ ++a, (t.charAt(a) == " " || t.charAt(a) == "*") && ++a;
681
+ break;
682
+ case "(":
683
+ case ")":
684
+ e[e.length] = { t: m === 1 ? "t" : f, v: f }, ++a;
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 (b = f; a < t.length && "0123456789".indexOf(t.charAt(++a)) > -1; ) b += t.charAt(a);
696
+ e[e.length] = { t: "D", v: b };
697
+ break;
698
+ case " ":
699
+ e[e.length] = { t: f, v: f }, ++a;
700
+ break;
701
+ case "$":
702
+ e[e.length] = { t: "t", v: "$" }, ++a;
703
+ break;
704
+ default:
705
+ if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f) === -1) throw new Error("unrecognized character " + f + " in " + t);
706
+ e[e.length] = { t: "t", v: f }, ++a;
707
+ break;
708
+ }
709
+ var O = 0, se = 0, ue;
710
+ for (a = e.length - 1, C = "t"; a >= 0; --a)
711
+ switch (e[a].t) {
712
+ case "h":
713
+ case "H":
714
+ e[a].t = H, C = "h", O < 1 && (O = 1);
715
+ break;
716
+ case "s":
717
+ (ue = e[a].v.match(/\.0+$/)) && (se = Math.max(se, ue[0].length - 1)), O < 3 && (O = 3);
718
+ case "d":
719
+ case "y":
720
+ case "M":
721
+ case "e":
722
+ C = e[a].t;
723
+ break;
724
+ case "m":
725
+ C === "s" && (e[a].t = "M", O < 2 && (O = 2));
726
+ break;
727
+ case "X":
728
+ break;
729
+ case "Z":
730
+ O < 1 && e[a].v.match(/[Hh]/) && (O = 1), O < 2 && e[a].v.match(/[Mm]/) && (O = 2), O < 3 && e[a].v.match(/[Ss]/) && (O = 3);
731
+ }
732
+ switch (O) {
733
+ case 0:
734
+ break;
735
+ case 1:
736
+ u.u >= 0.5 && (u.u = 0, ++u.S), u.S >= 60 && (u.S = 0, ++u.M), u.M >= 60 && (u.M = 0, ++u.H);
737
+ break;
738
+ case 2:
739
+ u.u >= 0.5 && (u.u = 0, ++u.S), u.S >= 60 && (u.S = 0, ++u.M);
740
+ break;
741
+ }
742
+ var Z = "", x;
743
+ for (a = 0; a < e.length; ++a)
744
+ switch (e[a].t) {
745
+ case "t":
746
+ case "T":
747
+ case " ":
748
+ case "D":
749
+ break;
750
+ case "X":
751
+ e[a].v = "", e[a].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
+ e[a].v = Ve(e[a].t.charCodeAt(0), e[a].v, u, se), e[a].t = "t";
764
+ break;
765
+ case "n":
766
+ case "?":
767
+ for (x = a + 1; e[x] != null && ((f = e[x].t) === "?" || f === "D" || (f === " " || f === "t") && e[x + 1] != null && (e[x + 1].t === "?" || e[x + 1].t === "t" && e[x + 1].v === "/") || e[a].t === "(" && (f === " " || f === "n" || f === ")") || f === "t" && (e[x].v === "/" || e[x].v === " " && e[x + 1] != null && e[x + 1].t == "?")); )
768
+ e[a].v += e[x].v, e[x] = { v: "", t: ";" }, ++x;
769
+ Z += e[a].v, a = x - 1;
770
+ break;
771
+ case "G":
772
+ e[a].t = "t", e[a].v = ge(r, n);
773
+ break;
774
+ }
775
+ var h = "", i, c;
776
+ if (Z.length > 0) {
777
+ Z.charCodeAt(0) == 40 ? (i = r < 0 && Z.charCodeAt(0) === 45 ? -r : r, c = ne("n", Z, i)) : (i = r < 0 && m > 1 ? -r : r, c = ne("n", Z, i), i < 0 && e[0] && e[0].t == "t" && (c = c.substr(1), e[0].v = "-" + e[0].v)), x = c.length - 1;
778
+ var A = e.length;
779
+ for (a = 0; a < e.length; ++a) if (e[a] != null && e[a].t != "t" && e[a].v.indexOf(".") > -1) {
780
+ A = a;
781
+ break;
782
+ }
783
+ var o = e.length;
784
+ if (A === e.length && c.indexOf("E") === -1) {
785
+ for (a = e.length - 1; a >= 0; --a)
786
+ e[a] == null || "n?".indexOf(e[a].t) === -1 || (x >= e[a].v.length - 1 ? (x -= e[a].v.length, e[a].v = c.substr(x + 1, e[a].v.length)) : x < 0 ? e[a].v = "" : (e[a].v = c.substr(0, x + 1), x = -1), e[a].t = "t", o = a);
787
+ x >= 0 && o < e.length && (e[o].v = c.substr(0, x + 1) + e[o].v);
788
+ } else if (A !== e.length && c.indexOf("E") === -1) {
789
+ for (x = c.indexOf(".") - 1, a = A; a >= 0; --a)
790
+ if (!(e[a] == null || "n?".indexOf(e[a].t) === -1)) {
791
+ for (y = e[a].v.indexOf(".") > -1 && a === A ? e[a].v.indexOf(".") - 1 : e[a].v.length - 1, h = e[a].v.substr(y + 1); y >= 0; --y)
792
+ x >= 0 && (e[a].v.charAt(y) === "0" || e[a].v.charAt(y) === "#") && (h = c.charAt(x--) + h);
793
+ e[a].v = h, e[a].t = "t", o = a;
794
+ }
795
+ for (x >= 0 && o < e.length && (e[o].v = c.substr(0, x + 1) + e[o].v), x = c.indexOf(".") + 1, a = A; a < e.length; ++a)
796
+ if (!(e[a] == null || "n?(".indexOf(e[a].t) === -1 && a !== A)) {
797
+ for (y = e[a].v.indexOf(".") > -1 && a === A ? e[a].v.indexOf(".") + 1 : 0, h = e[a].v.substr(0, y); y < e[a].v.length; ++y)
798
+ x < c.length && (h += c.charAt(x++));
799
+ e[a].v = h, e[a].t = "t", o = a;
800
+ }
801
+ }
802
+ }
803
+ for (a = 0; a < e.length; ++a) e[a] != null && "n?".indexOf(e[a].t) > -1 && (i = m > 1 && r < 0 && a > 0 && e[a - 1].v === "-" ? -r : r, e[a].v = ne(e[a].t, e[a].v, i), e[a].t = "t");
804
+ var l = "";
805
+ for (a = 0; a !== e.length; ++a) e[a] != null && (l += e[a].v);
806
+ return l;
807
+ }
808
+ p._eval = $e;
809
+ var Me = /\[[=<>]/, X = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
810
+ function ae(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 te(t, r) {
836
+ var n = ke(t), m = n.length, e = n[m - 1].indexOf("@");
837
+ if (m < 4 && e > -1 && --m, n.length > 4) throw new Error("cannot find right format for |" + n.join("|") + "|");
838
+ if (typeof r != "number") return [4, n.length === 4 || e > -1 ? n[n.length - 1] : "@"];
839
+ switch (n.length) {
840
+ case 1:
841
+ n = e > -1 ? ["General", "General", "General", n[0]] : [n[0], n[0], n[0], "@"];
842
+ break;
843
+ case 2:
844
+ n = e > -1 ? [n[0], n[0], n[0], n[1]] : [n[0], n[1], n[0], "@"];
845
+ break;
846
+ case 3:
847
+ n = e > -1 ? [n[0], n[1], n[0], n[2]] : [n[0], n[1], n[2], "@"];
848
+ break;
849
+ }
850
+ var b = r > 0 ? n[0] : r < 0 ? n[1] : n[2];
851
+ if (n[0].indexOf("[") === -1 && n[1].indexOf("[") === -1) return [m, b];
852
+ if (n[0].match(Me) != null || n[1].match(Me) != null) {
853
+ var a = n[0].match(X), f = n[1].match(X);
854
+ return ae(r, a) ? [m, n[0]] : ae(r, f) ? [m, n[1]] : [m, n[a != null && f != null ? 2 : 1]];
855
+ }
856
+ return [m, b];
857
+ }
858
+ function de(t, r, n) {
859
+ n == null && (n = {});
860
+ var m = "";
861
+ switch (typeof t) {
862
+ case "string":
863
+ t == "m/d/yy" && n.dateNF ? m = n.dateNF : m = t;
864
+ break;
865
+ case "number":
866
+ t == 14 && n.dateNF ? m = n.dateNF : m = (n.table != null ? n.table : ce)[t], m == null && (m = n.table && n.table[Q[t]] || ce[Q[t]]), m == null && (m = G[t] || "General");
867
+ break;
868
+ }
869
+ if (fe(m, 0)) return ge(r, n);
870
+ r instanceof Date && (r = Ne(r, n.date1904));
871
+ var e = te(m, r);
872
+ if (fe(e[1])) return ge(r, n);
873
+ if (r === !0) r = "TRUE";
874
+ else if (r === !1) r = "FALSE";
875
+ else if (r === "" || r == null) return "";
876
+ return $e(e[1], r, n, e[0]);
877
+ }
878
+ function le(t, r) {
879
+ if (typeof r != "number") {
880
+ r = +r || -1;
881
+ for (var n = 0; n < 392; ++n) {
882
+ if (ce[n] == null) {
883
+ r < 0 && (r = n);
884
+ continue;
885
+ }
886
+ if (ce[n] == t) {
887
+ r = n;
888
+ break;
889
+ }
890
+ }
891
+ r < 0 && (r = 391);
892
+ }
893
+ return ce[r] = t, r;
894
+ }
895
+ p.load = le, p._table = ce, p.get_table = function() {
896
+ return ce;
897
+ }, p.load_table = function(r) {
898
+ for (var n = 0; n != 392; ++n)
899
+ r[n] !== void 0 && le(r[n], n);
900
+ }, p.init_table = Ee, p.format = de;
901
+ };
902
+ g(s), typeof DO_NOT_EXPORT_SSF > "u" && (k.exports = s);
903
+ })(Xe);
904
+ var at = Xe.exports;
905
+ const Pe = /* @__PURE__ */ Qe(at), 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
+ ], Ge = je[0], it = [
931
+ ["true", "false"],
932
+ ["yes", "no"],
933
+ ["1", "0"]
934
+ ];
935
+ function ct(k, s) {
936
+ const g = k.toLowerCase(), w = s.toLowerCase();
937
+ return it.some(([p, v]) => g === p && w === v);
938
+ }
939
+ const ot = 200;
940
+ function lt() {
941
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `sheet-${Date.now()}-${Math.random().toString(36).slice(2)}`;
942
+ }
943
+ function st(k) {
944
+ if (!Array.isArray(k) || k.length === 0) return null;
945
+ const s = k.map((w) => String((w == null ? void 0 : w.v) ?? "")).join("");
946
+ return s.trim() ? s : null;
947
+ }
948
+ function ut(k) {
949
+ return k ? "TRUE" : "FALSE";
950
+ }
951
+ function ht(k) {
952
+ let s = !1, g = 0;
953
+ const w = () => {
954
+ if (s) return !0;
955
+ const v = k.current;
956
+ if (!(v != null && v.getWorkbookContext) || !v.recalculateAllFormulas) return !1;
957
+ const $ = v.getWorkbookContext(), T = $ == null ? void 0 : $.luckysheetfile;
958
+ return !(T != null && T.length) || !T.some(
959
+ (I) => Array.isArray(I.data) && I.data.length > 0
960
+ ) ? !1 : (v.recalculateAllFormulas(), s = !0, !0);
961
+ }, p = () => {
962
+ var v, $;
963
+ w() || (g += 1, g < ot ? requestAnimationFrame(p) : (($ = (v = k.current) == null ? void 0 : v.recalculateAllFormulas) == null || $.call(v), s = !0));
964
+ };
965
+ requestAnimationFrame(() => requestAnimationFrame(p));
966
+ for (const v of [120, 400, 1200])
967
+ window.setTimeout(() => {
968
+ s || w();
969
+ }, v);
970
+ }
971
+ function ft(k) {
972
+ return k <= 0 ? Ge : k > je.length ? Array(k).fill(Ge).join(", ") : je.slice(0, k).join(", ");
973
+ }
974
+ function Be(k) {
975
+ const s = k.match(/^([A-Z]+)(\d+)$/i);
976
+ if (!s) return null;
977
+ const g = s[1].toUpperCase(), w = s[2];
978
+ let p = 0;
979
+ for (let T = 0; T < g.length; T++)
980
+ p = p * 26 + (g.charCodeAt(T) - 64);
981
+ const v = parseInt(w, 10) - 1, $ = p - 1;
982
+ return { row: v, col: $ };
983
+ }
984
+ function gt(k, s) {
985
+ const g = Be(k);
986
+ if (!g) return null;
987
+ const { row: w, col: p } = g, v = `${w}_${p}`, $ = Array.isArray(s.formulae) && s.formulae.length > 0 ? String(s.formulae[0]).replace(/^["']|["']$/g, "").replace(/["']/g, "") : "", T = $.split(",").map((fe) => fe.trim()).filter(Boolean);
988
+ let D = s.type === "list" ? "dropdown" : s.type || "dropdown", I = $, J = "";
989
+ s.type === "list" && T.length === 2 && ct(T[0], T[1]) && (D = "checkbox", I = T[0], J = T[1]);
990
+ const V = D === "checkbox" ? 1 : I ? I.split(",").length : 0, ie = ft(V || 1), re = {
991
+ type: D,
992
+ type2: "",
993
+ rangeTxt: k,
994
+ value1: I,
995
+ value2: J,
996
+ validity: "",
997
+ remote: !1,
998
+ prohibitInput: s.type === "list",
999
+ hintShow: !!s.showInputMessage,
1000
+ hintValue: s.prompt ?? "",
1001
+ color: ie,
1002
+ checked: !1
1003
+ };
1004
+ return { rowColKey: v, entry: re };
1005
+ }
1006
+ function dt(k) {
1007
+ const s = k.split(":"), g = Be(s[0].trim());
1008
+ if (!g) return null;
1009
+ const w = s.length > 1 ? Be(s[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 bt(k) {
1016
+ return String(k || "").split(/[,\s]+/).map((s) => s.trim()).filter(Boolean).map((s) => dt(s)).filter(
1017
+ (s) => !!s
1018
+ );
1019
+ }
1020
+ function ze(k) {
1021
+ const s = bt(k);
1022
+ return s.length ? s.map((g) => {
1023
+ const [w, p] = g.row, [v, $] = 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: [v, $],
1035
+ row_focus: w,
1036
+ column_focus: v,
1037
+ column_select: !0
1038
+ };
1039
+ }) : null;
1040
+ }
1041
+ function qe(k) {
1042
+ var $, T;
1043
+ const s = {
1044
+ textColor: "#000000",
1045
+ cellColor: "#ffffff",
1046
+ bold: !1,
1047
+ italic: !1,
1048
+ underline: !1,
1049
+ strikethrough: !1
1050
+ };
1051
+ if (!k) return s;
1052
+ const g = k.font, w = k.fill;
1053
+ let p = s.textColor, v = s.cellColor;
1054
+ if (($ = g == null ? void 0 : g.color) != null && $.argb) {
1055
+ const D = g.color.argb;
1056
+ p = "#" + (D.length >= 6 ? D.slice(-6) : D);
1057
+ }
1058
+ if ((w == null ? void 0 : w.type) === "pattern" && w.pattern === "solid" && ((T = w.fgColor) != null && T.argb)) {
1059
+ const D = w.fgColor.argb;
1060
+ v = "#" + (D.length >= 6 ? D.slice(-6) : D);
1061
+ }
1062
+ return {
1063
+ textColor: p,
1064
+ cellColor: v,
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 Ze(k) {
1072
+ if (!k || typeof k != "string") return "";
1073
+ const s = k.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&").replace(/^=/, ""), g = s.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*"((?:[^"]|"")*)"/i);
1074
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1075
+ const w = s.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*'([^']*)'/i);
1076
+ return w ? w[1] ?? "" : "";
1077
+ }
1078
+ function De(k) {
1079
+ if (!k || typeof k != "string") return "";
1080
+ const s = k.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/^=/, ""), g = s.match(/"((?:[^"]|"")*)"/);
1081
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1082
+ const w = s.match(/'([^']*)'/);
1083
+ return w ? w[1] ?? "" : "";
1084
+ }
1085
+ function mt(k) {
1086
+ if (!k || typeof k != "string") return null;
1087
+ const s = k.trim().toUpperCase(), g = Ze(k) || De(k);
1088
+ return g ? s.includes("SEARCH(") ? s.includes("ISERROR(SEARCH(") || s.includes("NOTNUMBER(SEARCH(") ? { conditionName: "textDoesNotContain", conditionValue: [g] } : { conditionName: "textContains", conditionValue: [g] } : s.includes("LEFT(") ? { conditionName: "textStartsWith", conditionValue: [g] } : s.includes("RIGHT(") ? { conditionName: "textEndsWith", conditionValue: [g] } : s.includes("EXACT(") || s.includes('="') ? { conditionName: "textExactly", conditionValue: [g] } : null : null;
1089
+ }
1090
+ function pt(k, s, g) {
1091
+ const w = (k || "").toLowerCase();
1092
+ if (w === "cellis") {
1093
+ const p = (s || "").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 = (s ?? "").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 v = (g == null ? void 0 : g.text) ?? "";
1111
+ return {
1112
+ conditionName: "textContains",
1113
+ conditionValue: v ? [v] : []
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 wt(k, s) {
1148
+ if (!s.type) return null;
1149
+ let g = (s.text ?? "").trim();
1150
+ const w = Array.isArray(s.formulae) && s.formulae[0] ? String(s.formulae[0]) : void 0, p = (s.type.toLowerCase() === "expression" || s.type.toLowerCase() === "customformula") && mt(w);
1151
+ if (p) {
1152
+ const I = ze(k);
1153
+ if (!I) return null;
1154
+ const J = qe(s.style);
1155
+ return {
1156
+ type: "default",
1157
+ cellrange: I,
1158
+ format: {
1159
+ textColor: J.textColor,
1160
+ cellColor: J.cellColor,
1161
+ bold: J.bold,
1162
+ italic: J.italic,
1163
+ underline: J.underline,
1164
+ strikethrough: J.strikethrough
1165
+ },
1166
+ conditionName: p.conditionName,
1167
+ conditionRange: [],
1168
+ conditionValue: p.conditionValue
1169
+ };
1170
+ }
1171
+ (s.type === "containsText" || s.type === "notContainsText" || s.type === "beginsWith" || s.type === "endsWith") && !g && (g = Ze(w), g || (g = De(w)));
1172
+ const v = pt(s.type, s.operator, {
1173
+ percent: s.percent,
1174
+ bottom: s.bottom,
1175
+ rank: s.rank,
1176
+ aboveAverage: s.aboveAverage,
1177
+ text: g || s.text,
1178
+ timePeriod: s.timePeriod
1179
+ });
1180
+ if (!v) return null;
1181
+ let $;
1182
+ s.type === "cellIs" && Array.isArray(s.formulae) && s.formulae.length > 0 ? $ = s.formulae.map((I) => String(I ?? "")) : v.conditionName === "empty" || v.conditionName === "notEmpty" ? $ = [""] : s.type === "containsText" || s.type === "notContainsText" || s.type === "beginsWith" || s.type === "endsWith" ? $ = g ? [g] : De(w) ? [De(w)] : [] : $ = v.conditionValue.map(
1183
+ (I) => I == null ? "" : String(I)
1184
+ );
1185
+ const T = ze(k);
1186
+ if (!T) return null;
1187
+ const D = qe(s.style);
1188
+ return {
1189
+ type: "default",
1190
+ cellrange: T,
1191
+ format: {
1192
+ textColor: D.textColor,
1193
+ cellColor: D.cellColor,
1194
+ bold: D.bold,
1195
+ italic: D.italic,
1196
+ underline: D.underline,
1197
+ strikethrough: D.strikethrough
1198
+ },
1199
+ conditionName: v.conditionName,
1200
+ conditionRange: [],
1201
+ conditionValue: $
1202
+ };
1203
+ }
1204
+ async function xt({
1205
+ sheetEditorRef: k,
1206
+ ydocRef: s,
1207
+ setForceSheetRender: g,
1208
+ dsheetId: w,
1209
+ currentDataRef: p,
1210
+ updateDocumentTitle: v,
1211
+ filterToastShown: $,
1212
+ setFilterToastShown: T
1213
+ }, D, I, J, V) {
1214
+ var Ee, ce;
1215
+ const ie = D == null ? void 0 : D.target;
1216
+ if (!((Ee = ie == null ? void 0 : ie.files) != null && Ee.length) && !I)
1217
+ return Promise.resolve();
1218
+ const re = ((ce = ie == null ? void 0 : ie.files) == null ? void 0 : ce[0]) || I, fe = {}, Ce = {};
1219
+ let Ae = !1;
1220
+ return new Promise((Q, M) => {
1221
+ const G = new FileReader();
1222
+ G.onerror = () => M(new Error("Failed to read file")), G.onload = async (we) => {
1223
+ var Fe, Ve, oe, ne;
1224
+ if (!we.target) {
1225
+ console.error("FileReader event target is null"), M(new Error("FileReader event target is null"));
1226
+ return;
1227
+ }
1228
+ const ye = we.target.result, [{ Workbook: Se }, Re, Le] = await Promise.all([
1229
+ import("exceljs"),
1230
+ // @ts-expect-error — luckyexcel ships without TypeScript types
1231
+ import("luckyexcel"),
1232
+ import("./xlsx-image-utils-Cvg0qxRA.js")
1233
+ ]), Ne = Re.default.transformExcelToLucky, { extractImagesFromWorksheet: He, convertRawImagesToFortuneSheet: Te } = Le, ge = new Se();
1234
+ try {
1235
+ await ge.xlsx.load(ye);
1236
+ const ke = (ne = (oe = (Ve = (Fe = ge.model) == null ? void 0 : Fe.styles) == null ? void 0 : Ve.fonts) == null ? void 0 : oe[0]) == null ? void 0 : ne.size, _e = {}, xe = {}, $e = {}, Me = {};
1237
+ ge.eachSheet((X, ae) => {
1238
+ var a, f, C;
1239
+ const te = ae - 1, de = {}, le = X.views;
1240
+ if (le && le.length > 0) {
1241
+ const u = le[0];
1242
+ if (u.state === "frozen") {
1243
+ const y = u.xSplit || 0, _ = u.ySplit || 0;
1244
+ let H = null;
1245
+ y > 0 && _ > 0 ? H = "rangeBoth" : _ > 0 ? H = "rangeRow" : y > 0 && (H = "rangeColumn"), H && (xe[te] = {
1246
+ type: H,
1247
+ range: {
1248
+ row_focus: _ - 1,
1249
+ column_focus: y - 1
1250
+ }
1251
+ });
1252
+ }
1253
+ }
1254
+ const t = {};
1255
+ X.eachRow({ includeEmpty: !1 }, (u, y) => {
1256
+ u.eachCell({ includeEmpty: !1 }, (_, H) => {
1257
+ var se, ue, Z;
1258
+ const U = `${y - 1}_${H - 1}`;
1259
+ _.hyperlink && (de[U] = [
1260
+ {
1261
+ linkType: "webpage",
1262
+ linkAddress: _.hyperlink
1263
+ }
1264
+ ]);
1265
+ const S = (se = _.style) == null ? void 0 : se.font, R = (ue = _.style) == null ? void 0 : ue.fill, O = {};
1266
+ if (S) {
1267
+ S.bold && (O.bl = 1), S.italic && (O.it = 1), S.underline && (O.un = 1);
1268
+ const x = S.size ?? ke;
1269
+ if (x && (O.fs = x), S.name && (O.ff = S.name), (Z = S.color) != null && Z.argb) {
1270
+ const h = S.color.argb, i = "#" + h.substring(h.length - 6);
1271
+ O.fc = i;
1272
+ }
1273
+ }
1274
+ if ((R == null ? void 0 : R.type) === "pattern" && R.pattern === "solid" && R.fgColor && R.fgColor.argb) {
1275
+ const x = R.fgColor.argb, h = "#" + x.substring(x.length - 6);
1276
+ O.bg = h;
1277
+ }
1278
+ Object.keys(O).length > 0 && (t[U] = O);
1279
+ });
1280
+ }), Object.keys(de).length > 0 && (_e[te] = de), Object.keys(t).length > 0 && ($e[te] = t);
1281
+ const r = He(X, ge);
1282
+ r.length > 0 && (Me[te] = r);
1283
+ const n = X.tables;
1284
+ n && Object.keys(n).length > 0 && ((a = V == null ? void 0 : V.onWarning) == null || a.call(
1285
+ V,
1286
+ "Tables are not fully supported. Table styles will not be applied."
1287
+ ), V != null && V.suppressUiWarnings || Ye({
1288
+ title: "Tables are not fully supported",
1289
+ description: "Table styles will not be applied",
1290
+ variant: "warning",
1291
+ showCloseButton: !0,
1292
+ duration: 40 * 1e3
1293
+ }));
1294
+ const m = (f = X.dataValidations) == null ? void 0 : f.model;
1295
+ if (m && typeof m == "object") {
1296
+ const u = {};
1297
+ for (const [y, _] of Object.entries(m)) {
1298
+ const U = gt(y, _);
1299
+ U && (u[U.rowColKey] = U.entry);
1300
+ }
1301
+ Object.keys(u).length > 0 && (fe[te] = u);
1302
+ }
1303
+ const e = X.conditionalFormattings;
1304
+ if (Array.isArray(e) && e.length > 0) {
1305
+ const u = [];
1306
+ for (const y of e) {
1307
+ const _ = y.ref, H = y.rules || [];
1308
+ for (const U of H) {
1309
+ const S = U;
1310
+ console.log("[XLSX CF RAW]", {
1311
+ ref: _,
1312
+ type: S.type,
1313
+ operator: S.operator,
1314
+ formulae: S.formulae,
1315
+ text: S.text,
1316
+ timePeriod: S.timePeriod,
1317
+ percent: S.percent,
1318
+ bottom: S.bottom,
1319
+ rank: S.rank,
1320
+ aboveAverage: S.aboveAverage
1321
+ });
1322
+ const R = S.type ? wt(_, S) : null;
1323
+ R ? console.log("[XLSX CF MAPPED] accepted", R) : console.log("[XLSX CF MAPPED] skipped", {
1324
+ ref: _,
1325
+ type: S.type,
1326
+ operator: S.operator,
1327
+ formulae: S.formulae,
1328
+ text: S.text
1329
+ }), R && u.push(R);
1330
+ }
1331
+ }
1332
+ u.length > 0 && (Ce[te] = u);
1333
+ }
1334
+ X.autoFilter && (Ae || (Ae = !0, (C = V == null ? void 0 : V.onWarning) == null || C.call(
1335
+ V,
1336
+ "Filters are not supported in imported files."
1337
+ )), $ || (T(!0), V != null && V.suppressUiWarnings || Ye({
1338
+ title: "Filters are not supported in imported files",
1339
+ variant: "warning",
1340
+ showCloseButton: !0,
1341
+ duration: 30 * 1e3
1342
+ })));
1343
+ }), Ne(
1344
+ re,
1345
+ function(X) {
1346
+ var m;
1347
+ let ae = X.sheets;
1348
+ if (ae.forEach((e, b) => {
1349
+ const a = fe[b];
1350
+ a && Object.keys(a).length > 0 && (e.dataVerification = a);
1351
+ const f = Ce[b];
1352
+ e.luckysheet_conditionformat_save = Array.isArray(f) && f.length > 0 ? f : [];
1353
+ }), !s.current) {
1354
+ console.error("ydocRef.current is null");
1355
+ return;
1356
+ }
1357
+ const te = s.current.getArray(w), de = Array.from(te), le = /* @__PURE__ */ new Map();
1358
+ ae = ae.map((e, b) => {
1359
+ var R, O, se, ue, Z, x, h, i, c, A, o, l, E, L, B, W, N, be, ve, me, z, pe, We, Ie, Ue;
1360
+ const a = (R = e == null ? void 0 : e.celldata) == null ? void 0 : R[e.celldata.length - 1], f = (a == null ? void 0 : a.r) ?? 0, C = (a == null ? void 0 : a.c) ?? 0;
1361
+ if (e.row = Math.max(f, 500), e.column = Math.max(C, 36), e.id || (e.id = ((O = V == null ? void 0 : V.generateSheetId) == null ? void 0 : O.call(V)) ?? ((se = k.current) == null ? void 0 : se.getSettings().generateSheetId()) ?? lt()), xe[b] && (e.frozen = xe[b]), _e[b] && (e.hyperlink = {
1362
+ ...e.hyperlink || {},
1363
+ ..._e[b]
1364
+ }), (ue = e.config) != null && ue.columnlen) {
1365
+ const d = {};
1366
+ Object.entries(e.config.columnlen).forEach(
1367
+ ([P, F]) => {
1368
+ const Y = (Number(F) - 5) / 8 + 0.83;
1369
+ d[P] = Math.round(Y * 7 + 5);
1370
+ }
1371
+ ), e.config.columnlen = d;
1372
+ }
1373
+ const u = Math.round(
1374
+ Number(e.defaultColWidth) || 73
1375
+ );
1376
+ if ((Z = e.config) != null && Z.columnlen) {
1377
+ const d = {};
1378
+ Object.entries(e.config.columnlen).forEach(([P, F]) => {
1379
+ Math.abs(Math.round(Number(F)) - u) > 1 && (d[P] = Number(F));
1380
+ }), e.config.columnlen = d;
1381
+ }
1382
+ if ((x = e.config) != null && x.rowlen) {
1383
+ const d = Math.round(
1384
+ Number(e.defaultRowHeight) || 21
1385
+ ), P = {};
1386
+ Object.entries(e.config.rowlen).forEach(([F, Y]) => {
1387
+ Math.abs(Math.round(Number(Y)) - d) > 1 && (P[F] = Number(Y));
1388
+ }), e.config.rowlen = P;
1389
+ }
1390
+ if ((h = e.config) != null && h.customHeight) {
1391
+ const d = new Set(
1392
+ Object.keys(e.config.rowlen || {})
1393
+ ), P = {};
1394
+ Object.entries(e.config.customHeight).forEach(
1395
+ ([F, Y]) => {
1396
+ d.has(F) && Number(Y) === 1 && (P[F] = 1);
1397
+ }
1398
+ ), e.config.customHeight = P;
1399
+ }
1400
+ if (Me[b]) {
1401
+ const d = Number(e.defaultColWidth) || Number(
1402
+ (A = (c = (i = k.current) == null ? void 0 : i.getSettings) == null ? void 0 : c.call(i)) == null ? void 0 : A.defaultColWidth
1403
+ ) || 99, P = Number(e.defaultRowHeight) || Number(
1404
+ (E = (l = (o = k.current) == null ? void 0 : o.getSettings) == null ? void 0 : l.call(o)) == null ? void 0 : E.defaultRowHeight
1405
+ ) || 21;
1406
+ e.images = Te(
1407
+ Me[b],
1408
+ e,
1409
+ d,
1410
+ P
1411
+ );
1412
+ }
1413
+ const y = _e[b], _ = $e[b], H = [], U = (d, P) => {
1414
+ const F = `${d}_${P}`;
1415
+ U._seen == null && (U._seen = /* @__PURE__ */ new Set());
1416
+ const Y = U._seen;
1417
+ Y.has(F) || (Y.add(F), H.push({ r: d, c: P, id: e.id }));
1418
+ }, S = (L = e.config) != null && L.merge ? /* @__PURE__ */ new Map() : null;
1419
+ if (e.celldata)
1420
+ for (const d of e.celldata) {
1421
+ const P = `${d.r}_${d.c}`;
1422
+ if (S == null || S.set(
1423
+ P,
1424
+ d
1425
+ ), d.v) {
1426
+ if (d.v.f) {
1427
+ const j = String(d.v.f);
1428
+ j.startsWith("=") || (d.v.f = `=${j}`);
1429
+ }
1430
+ if (d.v.f && ((B = d.v.ct) == null ? void 0 : B.t) !== "d" && (d.v.ct = { ...d.v.ct ?? {}, t: "str" }, U(d.r, d.c)), _ != null && _[P]) {
1431
+ const j = _[P];
1432
+ if (!!(y != null && y[P])) {
1433
+ const { fc: ee, un: Oe, ...Je } = j;
1434
+ Object.assign(d.v, Je);
1435
+ } else
1436
+ Object.assign(d.v, j);
1437
+ }
1438
+ if (y != null && y[P] && !d.v.f) {
1439
+ const j = y[P][0];
1440
+ j && nt(
1441
+ d.v,
1442
+ j
1443
+ );
1444
+ }
1445
+ const F = (W = d.v.ct) == null ? void 0 : W.fa, Y = typeof F == "string" ? F.trim().toLowerCase() : "", K = Y === "general" || ((N = d.v.ct) == null ? void 0 : N.t) === "g", he = Y === "@" || ((be = d.v.ct) == null ? void 0 : be.t) === "s";
1446
+ if (F && !le.has(F) && le.set(F, Pe.is_date(F)), !d.v.f && F && le.get(F)) {
1447
+ const j = typeof d.v.v == "string" ? parseFloat(d.v.v) : d.v.v;
1448
+ if (typeof j == "number" && !isNaN(j))
1449
+ try {
1450
+ d.v.v = j, d.v.m = Pe.format(F, j), d.v.ct = { ...d.v.ct, t: "d" };
1451
+ } catch {
1452
+ }
1453
+ } else if (!d.v.f && typeof d.v.v == "string" && !he && !K) {
1454
+ const j = d.v.v.trim();
1455
+ if (/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/.test(
1456
+ j
1457
+ )) {
1458
+ const ee = Number(j);
1459
+ if (!isFinite(ee))
1460
+ continue;
1461
+ if (d.v.v = ee, d.v.ht == null && (d.v.ht = 2), !F)
1462
+ d.v.m = String(ee);
1463
+ else
1464
+ try {
1465
+ d.v.m = Pe.format(F, ee);
1466
+ } catch {
1467
+ }
1468
+ }
1469
+ } else !d.v.f && typeof d.v.v == "number" && isFinite(d.v.v) && ((ve = d.v.ct) == null ? void 0 : ve.t) !== "s" && ((me = d.v.ct) == null ? void 0 : me.t) !== "d" && d.v.ht == null && (d.v.ht = 2);
1470
+ if (!d.v.f && (d.v.m === void 0 || d.v.m === null) && ((z = d.v.ct) == null ? void 0 : z.t) !== "d") {
1471
+ const j = st((pe = d.v.ct) == null ? void 0 : pe.s), q = d.v.v;
1472
+ if (!(q == null || String(q).trim() === ""))
1473
+ if (j != null)
1474
+ d.v.m = j;
1475
+ else if (typeof q == "boolean")
1476
+ d.v.m = ut(q);
1477
+ else if (typeof q == "number" && isFinite(q)) {
1478
+ const Oe = (We = d.v.ct) == null ? void 0 : We.fa;
1479
+ if (typeof Oe == "string" && Oe && le.get(Oe) === !1)
1480
+ try {
1481
+ d.v.m = Pe.format(Oe, q);
1482
+ } catch {
1483
+ d.v.m = String(q);
1484
+ }
1485
+ else
1486
+ d.v.m = String(q);
1487
+ } else typeof q == "object" || (d.v.m = String(q));
1488
+ }
1489
+ }
1490
+ }
1491
+ if (Array.isArray(e.data)) {
1492
+ const d = e.data;
1493
+ for (let P = 0; P < d.length; P++) {
1494
+ const F = d[P];
1495
+ if (Array.isArray(F))
1496
+ for (let Y = 0; Y < F.length; Y++) {
1497
+ const K = F[Y];
1498
+ if (!K || typeof K != "object" || !K.f) continue;
1499
+ const he = String(K.f);
1500
+ he.startsWith("=") || (K.f = `=${he}`), ((Ie = K.ct) == null ? void 0 : Ie.t) !== "d" && (K.ct = { ...K.ct ?? {}, t: "str" }, U(P, Y));
1501
+ }
1502
+ }
1503
+ }
1504
+ if (e.calcChain = H, S && ((Ue = e.config) != null && Ue.merge) && e.celldata)
1505
+ for (const d of Object.values(e.config.merge)) {
1506
+ const { r: P, c: F, rs: Y, cs: K } = d;
1507
+ for (let he = 0; he < Y; he++)
1508
+ for (let j = 0; j < K; j++) {
1509
+ const q = `${P + he}_${F + j}`;
1510
+ if (he !== 0 || j !== 0) continue;
1511
+ let ee = S.get(q);
1512
+ ee ? (ee.v || (ee.v = {}), ee.v.mc = { r: P, c: F, rs: Y, cs: K }) : (ee = {
1513
+ r: P + he,
1514
+ c: F + j,
1515
+ v: { mc: { r: P, c: F, rs: Y, cs: K } }
1516
+ }, e.celldata.push(ee), S.set(q, ee));
1517
+ }
1518
+ }
1519
+ return e;
1520
+ }), console.log("[xlsx-import] parsed sheets data", {
1521
+ fileName: re.name,
1522
+ sheetCount: ae.length,
1523
+ sheets: ae
1524
+ });
1525
+ let t;
1526
+ if (J === "merge-current-dsheet" ? t = [...de, ...ae] : t = [...ae], t = t.map((e, b) => (e.order = b, e)), s.current.transact(() => {
1527
+ J !== "merge-current-dsheet" && te.delete(0, te.length), t.forEach((e) => {
1528
+ if (e instanceof Ke.Map) return;
1529
+ const b = et(e);
1530
+ te.push([b()]);
1531
+ });
1532
+ }), s != null && s.current) {
1533
+ const e = s.current.getArray(w), b = tt(e);
1534
+ p.current = b, g((a) => a + 1);
1535
+ }
1536
+ V != null && V.headless || ht(k);
1537
+ const n = rt((m = X == null ? void 0 : X.info) == null ? void 0 : m.name);
1538
+ v == null || v(n), Q();
1539
+ }
1540
+ );
1541
+ } catch (ke) {
1542
+ console.error("Error loading the workbook", ke), !(V != null && V.suppressUiWarnings) && typeof alert < "u" && alert(
1543
+ "Error loading the workbook. Please ensure it is a valid .xlsx file."
1544
+ ), M(ke);
1545
+ }
1546
+ }, G.readAsArrayBuffer(re);
1547
+ });
1548
+ }
1549
+ export {
1550
+ xt as runXlsxFileUpload
1551
+ };