@sheetxl/sdk 0.4.20 → 0.4.22

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 (105) hide show
  1. package/browser/cjs/7IXJLhV4t0ot3XB5.cjs +7 -0
  2. package/browser/cjs/{CHIrWDL1wDd2pj7r.cjs → 88wgo6pjVpM9y5ul.cjs} +1 -1
  3. package/browser/cjs/{CgISg2QUFvnxelIg.cjs → B1FA-mZrhIhB8VoC.cjs} +1 -1
  4. package/browser/cjs/{HoZidg9qBDX62oNO.cjs → BFSSWIb-BPsXlS8k.cjs} +1 -1
  5. package/browser/cjs/{lTo12h7XrLmPRVhi.cjs → BG_fhZO0IruefQYx.cjs} +1 -1
  6. package/browser/cjs/{aBAvcAfOvtWy7o9B.cjs → BHMiYQTwGjWzRdGf.cjs} +1 -1
  7. package/browser/cjs/{We0naT5G_vQo6RkK.cjs → BSj9kpCBxyd5EZvX.cjs} +1 -1
  8. package/browser/cjs/{B8nuUUIsnE-6vbAQ.cjs → BYwSD92n1THKdj9V.cjs} +1 -1
  9. package/browser/cjs/{CW9IcRQqCCBSJ1g0.cjs → Bein9-S48RBhhxLW.cjs} +1 -1
  10. package/browser/cjs/{C4KbNJbRD0LfrFFV.cjs → CFE-vojYpMggdKVQ.cjs} +1 -1
  11. package/browser/cjs/{BTPJz0JSs5PWhtbO.cjs → CGslljb6hC8DcpsE.cjs} +1 -1
  12. package/browser/cjs/{gn5aPOY6C-poXjky.cjs → CV_Kse7BQ7sBx0S2.cjs} +1 -1
  13. package/browser/cjs/{BfMzZ_GULllzBk6l.cjs → CW7Kbm45TFbAZYO3.cjs} +1 -1
  14. package/browser/cjs/{ZJeHuklpnM-x2Uor.cjs → Cx69pnzjeLfQMYgm.cjs} +1 -1
  15. package/browser/cjs/{BVwLRpPOJOkPiLVI.cjs → D1ZVN_gmSiXwUeCX.cjs} +1 -1
  16. package/browser/cjs/D1uvbAWH1atUhVUP.cjs +53 -0
  17. package/browser/cjs/{BvS85P-7zLIudyqb.cjs → D2eWn6G2QvkYzR0D.cjs} +1 -1
  18. package/browser/cjs/{CYueUIoDZwYE9fRk.cjs → D3ZDdkSutmtUfAG2.cjs} +1 -1
  19. package/browser/cjs/{BTa_vDbaAzt6YXV1.cjs → DItG5mSJNZ40zltg.cjs} +1 -1
  20. package/browser/cjs/{XxdMKuC0y29VOQ05.cjs → DMROSNSDJaUVqfoW.cjs} +1 -1
  21. package/browser/cjs/{Bw07AlLqg6ZIoMRL.cjs → DWG2lOB7T0SRr5Ni.cjs} +1 -1
  22. package/browser/cjs/Dub6MS5nk4D_Iv7p.cjs +124 -0
  23. package/browser/cjs/{BHa5nV8AH6dlgs29.cjs → Ko4UgjHi20zmyEpu.cjs} +1 -1
  24. package/browser/cjs/{CxXM6xsDd2bFDSNd.cjs → OgnqbIZEb37S4Hcz.cjs} +1 -1
  25. package/browser/cjs/{BkFMWwFWaisNXSf2.cjs → SkNXytY6UX9i6WhY.cjs} +2 -2
  26. package/browser/cjs/{CFwigDisNJzRlbSY.cjs → ZyyHV9ugA--j9V3Q.cjs} +1 -1
  27. package/browser/cjs/index.cjs +2 -2
  28. package/browser/cjs/{D9SMcp02EIWqiYk0.cjs → rPn2U0Q2Eagh41Xd.cjs} +1 -1
  29. package/browser/esm/{DK_FQ6Q7AZUprApR.mjs → -z0NclKcw0SSbo2L.mjs} +7603 -8898
  30. package/browser/esm/{DuvsEieHOiBb-GPZ.mjs → 45xuwq8di_97VrOg.mjs} +1 -1
  31. package/browser/esm/{CDbE_dl8edWRC33Z.mjs → B5M_o8HB4RRWBd_Y.mjs} +1 -1
  32. package/browser/esm/{9tFMamEgahdtRDzr.mjs → BANL0IBU0th0Z0aE.mjs} +1 -1
  33. package/browser/esm/{DOK9VvFQyTAsf7SL.mjs → BE-hRu2cYg4ljCeu.mjs} +1 -1
  34. package/browser/esm/{BNS7zLc3zoynBPYO.mjs → BcSVj-rRzZCTKFUS.mjs} +6 -4
  35. package/browser/esm/{DIePzm-XT-alFdDB.mjs → BsPKTSv0eCvPH73D.mjs} +1 -1
  36. package/{node/esm/Bqc8bvJoWC0_qUKU.mjs → browser/esm/C1VWw92RN5017GH2.mjs} +1 -1
  37. package/{node/esm/iYqJLAQld4jtK1Be.mjs → browser/esm/C1m7sGNTYP1bb_Uu.mjs} +1 -1
  38. package/{node/esm/DdDDFLZKFx1DAkKM.mjs → browser/esm/CB1_HpaA6RdaxTgB.mjs} +1 -1
  39. package/browser/esm/{DV9p0Ai4HUPYjT-H.mjs → CESAJuxgB8SgHaC0.mjs} +2 -2
  40. package/browser/esm/{_q37vK_NIykwwqbg.mjs → CF-2-aQTgc-DoXzn.mjs} +1 -1
  41. package/{node/esm/CivKgcEQiXpDFLHE.mjs → browser/esm/CIOhVshLBBACTKw4.mjs} +1 -1
  42. package/{node/esm/DlNI2fuUSYxsUPt8.mjs → browser/esm/CMSKXl6rbx5miTNQ.mjs} +1 -1
  43. package/{node/esm/D3YTY3N6YHU69ymA.mjs → browser/esm/CiTlupx_cuXQySFz.mjs} +1 -1
  44. package/browser/esm/{DoIENSc8L0Rof6Kz.mjs → D3P3XCQVij2nAmi9.mjs} +46 -44
  45. package/{node/esm/bIOUtGNQ6YQktkYZ.mjs → browser/esm/D6IgoU0LlIv_Vb4m.mjs} +1 -1
  46. package/{node/esm/DaJrKgrSikJvUv0q.mjs → browser/esm/DDHWZD7Y6pihyVio.mjs} +1 -1
  47. package/browser/esm/{mxJXDPqwl0wNxd66.mjs → DEAxRkKlMDxHooJB.mjs} +1 -1
  48. package/browser/esm/{BcUYcXaMbk6W8AWk.mjs → DI52n-xcpb7jEqop.mjs} +1 -1
  49. package/{node/esm/DP9RiXAeb1fiRFpG.mjs → browser/esm/Dd2ZeNLusT_ZXcoE.mjs} +1 -1
  50. package/browser/esm/{fP2GLQ5W7VVbn5TA.mjs → E-RGQA1dKJwkkonk.mjs} +1 -1
  51. package/{node/esm/aF3uflTbayaEj07D.mjs → browser/esm/NvmvIR3jfjlY98jJ.mjs} +1 -1
  52. package/browser/esm/{BoB-LPOX1uKjZhKH.mjs → OABZjfPgUYHzd5rY.mjs} +1 -1
  53. package/browser/esm/{BNURhfAYTEVJWTYT.mjs → XxsAmmMnL6UJ_NtN.mjs} +1 -1
  54. package/browser/esm/{io70M3K8dlSe5V-4.mjs → ease-qEarwjnTOzw.mjs} +1 -1
  55. package/browser/esm/index.mjs +54 -82
  56. package/{node/esm/HTDFLMWuQb82Y-GF.mjs → browser/esm/pyVBYhEMGgaVvnd1.mjs} +1 -1
  57. package/licenses/dependencies.txt +0 -66
  58. package/node/esm/{9tFMamEgahdtRDzr.mjs → BANL0IBU0th0Z0aE.mjs} +1 -1
  59. package/node/esm/{DOK9VvFQyTAsf7SL.mjs → BE-hRu2cYg4ljCeu.mjs} +1 -1
  60. package/node/esm/{BpBhk74DpxGo00aZ.mjs → BFQWsItEwIA8MHSr.mjs} +1 -1
  61. package/{browser/esm/Bqc8bvJoWC0_qUKU.mjs → node/esm/C1VWw92RN5017GH2.mjs} +1 -1
  62. package/{browser/esm/iYqJLAQld4jtK1Be.mjs → node/esm/C1m7sGNTYP1bb_Uu.mjs} +1 -1
  63. package/node/esm/{B7ZcsKf8cxOEMq7p.mjs → C2cb5mfR_vAlX9Fe.mjs} +1 -1
  64. package/node/esm/{CDjHCv3dEEOY9Foy.mjs → C5pshc3Ik9rfVQTG.mjs} +1 -1
  65. package/{browser/esm/DdDDFLZKFx1DAkKM.mjs → node/esm/CB1_HpaA6RdaxTgB.mjs} +1 -1
  66. package/node/esm/{MrOJ8ENTixputV8_.mjs → CE5UUdZ8bidtZxVI.mjs} +362 -360
  67. package/{browser/esm/CivKgcEQiXpDFLHE.mjs → node/esm/CIOhVshLBBACTKw4.mjs} +1 -1
  68. package/{browser/esm/DlNI2fuUSYxsUPt8.mjs → node/esm/CMSKXl6rbx5miTNQ.mjs} +1 -1
  69. package/node/esm/{Tl8jbxaeK1y9aMPJ.mjs → CNmI4DKpe0t8gN4o.mjs} +1 -1
  70. package/node/esm/{BXc12GgwQ08R7S8e.mjs → CPs770aIZwPh6mF0.mjs} +1 -1
  71. package/node/esm/{rpVHlxg6GM8pJL5c.mjs → Cb6FcT6gppjhiDSw.mjs} +253 -251
  72. package/{browser/esm/D3YTY3N6YHU69ymA.mjs → node/esm/CiTlupx_cuXQySFz.mjs} +1 -1
  73. package/{browser/esm/bIOUtGNQ6YQktkYZ.mjs → node/esm/D6IgoU0LlIv_Vb4m.mjs} +1 -1
  74. package/{browser/esm/DaJrKgrSikJvUv0q.mjs → node/esm/DDHWZD7Y6pihyVio.mjs} +1 -1
  75. package/node/esm/{mxJXDPqwl0wNxd66.mjs → DEAxRkKlMDxHooJB.mjs} +1 -1
  76. package/{browser/esm/DP9RiXAeb1fiRFpG.mjs → node/esm/Dd2ZeNLusT_ZXcoE.mjs} +1 -1
  77. package/node/esm/{C6lX28OYg20N0MeO.mjs → DzsYVdrM0pVVPfdv.mjs} +1 -1
  78. package/{browser/esm/aF3uflTbayaEj07D.mjs → node/esm/NvmvIR3jfjlY98jJ.mjs} +1 -1
  79. package/node/esm/{BNURhfAYTEVJWTYT.mjs → XxsAmmMnL6UJ_NtN.mjs} +1 -1
  80. package/node/esm/{io70M3K8dlSe5V-4.mjs → ease-qEarwjnTOzw.mjs} +1 -1
  81. package/node/esm/index.mjs +12252 -13543
  82. package/{browser/esm/HTDFLMWuQb82Y-GF.mjs → node/esm/pyVBYhEMGgaVvnd1.mjs} +1 -1
  83. package/node/esm/{CHnRYVDwiNY7YZxQ.mjs → xlM5nOnBp3h54uCb.mjs} +1 -1
  84. package/package.json +4 -4
  85. package/browser/cjs/BRvrxzKBJ-g1N73t.cjs +0 -1501
  86. package/browser/cjs/Ba3X8U1ch1pBFv_a.cjs +0 -124
  87. package/browser/cjs/C2DyH3SwPIgmFosH.cjs +0 -7
  88. package/browser/cjs/CEW45o7VnarqfsgH.cjs +0 -6
  89. package/browser/cjs/CZ4_zpdkkZ0zH7aN.cjs +0 -6
  90. package/browser/cjs/CbYFnsibjJUHV0xm.cjs +0 -6
  91. package/browser/cjs/D_zdscoLJ72sNgWv.cjs +0 -32
  92. package/browser/cjs/mf_wa0ubPjGaRkSW.cjs +0 -13
  93. package/browser/cjs/wcsUsHAbDuK3rvVp.cjs +0 -60
  94. package/browser/esm/B0RFp5vlJWj9U4Wn.mjs +0 -29
  95. package/browser/esm/BikAM7lQn1NrVPNP.mjs +0 -21
  96. package/browser/esm/C0d1-jgvvUt3Bpg9.mjs +0 -472
  97. package/browser/esm/CqYcEZmhnI3bq0wV.mjs +0 -820
  98. package/browser/esm/DbvBy4EEBdPhE-8G.mjs +0 -24
  99. package/browser/esm/DhIglmQyhLXPjrbo.mjs +0 -1575
  100. package/node/esm/BI2k0XM8cAqRUH3e.mjs +0 -80
  101. package/node/esm/BPSX88j1UHZNFlgn.mjs +0 -14
  102. package/node/esm/BcQcJWzyihj46-gX.mjs +0 -454
  103. package/node/esm/C4d62D9fLTRjV7rI.mjs +0 -29
  104. package/node/esm/D_13otLly5j8n5Gg.mjs +0 -813
  105. package/node/esm/Dsf-AEKpZlzGOrcG.mjs +0 -16
@@ -1,1501 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.20
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let c=class{constructor(e){this._worker=null,this._nextId=1,this._pendingRequests=new Map,this._workerFactory=e}start(){if(typeof Worker>"u")throw new Error("Web Workers are not supported in this environment.");return this._worker||(this._worker=this._workerFactory(),this._worker.onmessage=e=>{const{id:n,result:t,error:r}=e.data,o=this._pendingRequests.get(n);if(o)if(this._pendingRequests.delete(n),r){const i=new Error(r.message);i.stack=r.stack,r.cause&&(i.cause=r.cause),o.reject(i)}else o.resolve(t)},this._worker.onerror=e=>{console.error("Worker error:",e),this._pendingRequests.forEach(n=>{n.reject(new Error(`Worker failed: ${e.message}`))}),this._pendingRequests.clear(),this._worker=null}),Promise.resolve()}execute(e){if(!this._worker)throw new Error("Worker is not initialized. Call start() first.");const n=this._nextId++;return new Promise((t,r)=>{this._pendingRequests.set(n,{resolve:t,reject:r}),this._worker.postMessage({id:n,params:e})})}terminate(){this._worker&&(this._worker.terminate(),this._worker=null)}};class u{constructor(n){this._onExecute=n}execute(n){return this._onExecute(n)}start(){return Promise.resolve()}terminate(){}}const s=`/**
7
- * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.4.20
8
- *
9
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
10
- * License: The license can be found at https://www.sheetxl.com/license.
11
- */
12
- const W = { Number: "n", String: "s", Boolean: "b", Error: "e", Null: "z" };
13
- var Re, ae, d;
14
- (ae = Re || (Re = {})).Orientation = { Column: "column", Row: "row" }, ae.Orientations = { ...ae.Orientation, Both: "both" }, ae.Direction = { Up: "up", Down: "down", Left: "left", Right: "right" }, ((e) => {
15
- e.Code = { Parse: 0, Null: 1, Div0: 2, Value: 3, Ref: 4, Name: 5, Num: 6, NA: 7, GettingData: 8, Spill: 9, Connect: 10, Blocked: 11, Unknown: 12, Field: 13, Calc: 14, Busy: 16, Python: 19, Timeout: 20 }, e.Label = { Parse: "#PARSE!", Null: "#NULL!", Div0: "#DIV/0!", Value: "#VALUE!", Ref: "#REF!", Name: "#NAME?", Num: "#NUM!", NA: "#N/A", GettingData: "#GETTING_DATA", Spill: "#SPILL!", Connect: "#CONNECT!", Blocked: "#BLOCKED!", Unknown: "#UNKNOWN!", Field: "#FIELD!", Calc: "#CALC!", Busy: "#BUSY!", Python: "#PYTHON!", Timeout: "#TIMEOUT!" };
16
- class t extends Error {
17
- constructor(c, m, fe, B) {
18
- super(fe, B), this._label = m, this._code = c, this.details = B;
19
- }
20
- static {
21
- this.code = e.Code.Unknown;
22
- }
23
- get isFormulaError() {
24
- return !0;
25
- }
26
- getLabel() {
27
- return this._label;
28
- }
29
- getCode() {
30
- return this._code;
31
- }
32
- equals(c) {
33
- return !!c && (this._code === c._code || this._code === c.code);
34
- }
35
- get [Symbol.toStringTag]() {
36
- return "[FormulaError]";
37
- }
38
- toString() {
39
- return this.message || this._label;
40
- }
41
- }
42
- e.Known = t;
43
- class r extends t {
44
- constructor(c, m) {
45
- super(e.Code.Parse, e.Label.Parse, c, m);
46
- }
47
- static {
48
- this.code = e.Code.Parse;
49
- }
50
- getDetails() {
51
- const c = this.details;
52
- return { line: c?.line ?? 1, column: c?.column ?? 1, offset: c?.offset ?? 0, length: c?.length ?? 0 };
53
- }
54
- }
55
- e.Parse = r;
56
- class n extends t {
57
- constructor(c, m) {
58
- super(e.Code.Null, e.Label.Null, c, m);
59
- }
60
- static {
61
- this.code = e.Code.Null;
62
- }
63
- }
64
- e.Null = n;
65
- class o extends t {
66
- constructor(c, m) {
67
- super(e.Code.Div0, e.Label.Div0, c, m);
68
- }
69
- static {
70
- this.code = e.Code.Div0;
71
- }
72
- }
73
- e.Div0 = o;
74
- class i extends t {
75
- constructor(c, m) {
76
- super(e.Code.Value, e.Label.Value, c, m);
77
- }
78
- static {
79
- this.code = e.Code.Value;
80
- }
81
- }
82
- e.Value = i;
83
- class a extends t {
84
- constructor(c, m) {
85
- super(e.Code.Ref, e.Label.Ref, c, m);
86
- }
87
- static {
88
- this.code = e.Code.Ref;
89
- }
90
- }
91
- e.Ref = a;
92
- class l extends t {
93
- constructor(c, m) {
94
- super(e.Code.Name, e.Label.Name, c, m);
95
- }
96
- static {
97
- this.code = e.Code.Name;
98
- }
99
- }
100
- e.Name = l;
101
- class u extends t {
102
- constructor(c, m) {
103
- super(e.Code.Num, e.Label.Num, c, m);
104
- }
105
- static {
106
- this.code = e.Code.Num;
107
- }
108
- }
109
- e.Num = u;
110
- class f extends t {
111
- constructor(c, m) {
112
- super(e.Code.NA, e.Label.NA, c, m);
113
- }
114
- static {
115
- this.code = e.Code.NA;
116
- }
117
- }
118
- e.NA = f;
119
- class h extends t {
120
- constructor(c, m) {
121
- super(e.Code.GettingData, e.Label.GettingData, c, m);
122
- }
123
- static {
124
- this.code = e.Code.GettingData;
125
- }
126
- }
127
- e.GettingData = h;
128
- class g extends t {
129
- constructor(c, m) {
130
- super(e.Code.Spill, e.Label.Spill, c, m);
131
- }
132
- static {
133
- this.code = e.Code.Spill;
134
- }
135
- }
136
- e.Spill = g;
137
- class p extends t {
138
- constructor(c, m) {
139
- super(e.Code.Connect, e.Label.Connect, c, m);
140
- }
141
- static {
142
- this.code = e.Code.Connect;
143
- }
144
- }
145
- e.Connect = p;
146
- class y extends t {
147
- constructor(c, m) {
148
- super(e.Code.Blocked, e.Label.Blocked, c, m);
149
- }
150
- static {
151
- this.code = e.Code.Blocked;
152
- }
153
- }
154
- e.Blocked = y;
155
- class T extends t {
156
- constructor(c, m) {
157
- super(e.Code.Unknown, e.Label.Unknown, c, m);
158
- }
159
- static {
160
- this.code = e.Code.Unknown;
161
- }
162
- }
163
- e.Unknown = T;
164
- class A extends t {
165
- constructor(c, m) {
166
- super(e.Code.Field, e.Label.Field, c, m);
167
- }
168
- static {
169
- this.code = e.Code.Field;
170
- }
171
- }
172
- e.Field = A;
173
- class D extends t {
174
- constructor(c, m) {
175
- super(e.Code.Calc, e.Label.Calc, c, m);
176
- }
177
- static {
178
- this.code = e.Code.Calc;
179
- }
180
- }
181
- e.Calc = D;
182
- class U extends t {
183
- constructor(c, m) {
184
- super(e.Code.Busy, e.Label.Busy, c, m);
185
- }
186
- static {
187
- this.code = e.Code.Busy;
188
- }
189
- }
190
- e.Busy = U;
191
- class I extends t {
192
- constructor(c, m) {
193
- super(e.Code.Python, e.Label.Python, c, m);
194
- }
195
- static {
196
- this.code = e.Code.Python;
197
- }
198
- }
199
- e.Python = I;
200
- class J extends t {
201
- constructor(c, m) {
202
- super(e.Code.Timeout, e.Label.Timeout, c, m);
203
- }
204
- static {
205
- this.code = e.Code.Timeout;
206
- }
207
- }
208
- e.Timeout = J;
209
- })(d || (d = {}));
210
- const _ = {};
211
- _[d.Code.Parse] = d.Parse, _[d.Code.Null] = d.Null, _[d.Code.Div0] = d.Div0, _[d.Code.Value] = d.Value, _[d.Code.Ref] = d.Ref, _[d.Code.Name] = d.Name, _[d.Code.Num] = d.Num, _[d.Code.NA] = d.NA, _[d.Code.GettingData] = d.GettingData, _[d.Code.Spill] = d.Spill, _[d.Code.Connect] = d.Connect, _[d.Code.Blocked] = d.Blocked, _[d.Code.Unknown] = d.Unknown, _[d.Code.Field] = d.Field, _[d.Code.Calc] = d.Calc, _[d.Code.Busy] = d.Busy, _[d.Code.Python] = d.Python, _[d.Code.Timeout] = d.Timeout;
212
- const et = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map(), ke = Object.keys(_);
213
- for (let e = 0; e < ke.length; e++) {
214
- const t = ke[e], r = _[t];
215
- tt.set(d.Label[t], r), rt.set(d.Code[t], r);
216
- const n = new r();
217
- et.set(n.getLabel(), n), Te.set(n.getCode(), n);
218
- }
219
- const Et = Te.get(d.Code.Unknown);
220
- var v;
221
- (v = d || (d = {})).BuiltIn = { Parse: new v.Parse(), Null: new v.Null(), Div0: new v.Div0(), Value: new v.Value(), Ref: new v.Ref(), Name: new v.Name(), Num: new v.Num(), NA: new v.NA(), GettingData: new v.GettingData(), Spill: new v.Spill(), Connect: new v.Connect(), Blocked: new v.Blocked(), Unknown: new v.Unknown(), Field: new v.Field(), Calc: new v.Calc(), Busy: new v.Busy(), Python: new v.Python(), Timeout: new v.Timeout() }, v.getBuiltInByLabel = (e) => et.get(e), v.newTypedError = (e, t, r) => {
222
- let n;
223
- return n = typeof e == "string" ? tt.get(e) : rt.get(e), n || (n = v.Unknown), new n(t, r);
224
- }, v.getBuiltInById = (e) => Te.get(e) || Et;
225
- /**
226
- * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.4.20
227
- *
228
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
229
- * License: The license can be found at https://www.sheetxl.com/license.
230
- */
231
- const S = { html: "text/html", plain: "text/plain", png: "image/png" }, St = Object.freeze({ left: 0, top: 0 }), xt = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ct = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
232
- Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Ct, EmptyRect: xt, EmptyTopLeft: St }, Symbol.toStringTag, { value: "Module" }));
233
- const j = { Column: "column", Row: "row" }, vt = Object.freeze({ colIndex: 0, rowIndex: 0 }), Tt = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), nt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, ot = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, _t = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Ot = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, Le = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, Ae = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, it = (e = j.Row, t = !1) => t ? e !== j.Column ? _t : Ot : e !== j.Column ? ot : nt, Me = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, Se = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, xe = (e, t) => !(!e || !t) && !(e.colStart > t.colEnd || t.colStart > e.colEnd) && !(e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), je = (e, t) => {
234
- if (e === t) return !0;
235
- if (!e || !t || e.length !== t.length) return !1;
236
- for (let r = 0; r < e.length; r++) if (!Se(e[r], t[r])) return !1;
237
- return !0;
238
- }, he = (e, t, r) => {
239
- if (!e && !t) return null;
240
- if (!e) return r ? t : { ...t };
241
- if (!t) return r ? e : { ...e };
242
- const n = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), i = Math.max(e.colEnd, t.colEnd), a = Math.max(e.rowEnd, t.rowEnd);
243
- let l = r;
244
- return l ? (l.colStart = n, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: n, rowStart: o, colEnd: i, rowEnd: a }, l;
245
- }, Pe = (e, t) => {
246
- if (!t || t.length === 0) return e;
247
- const r = { ...e };
248
- for (let n = 0; n < t.length; n++) {
249
- const o = t[n];
250
- xe(r, o) && (r.rowStart = Math.min(r.rowStart, o.rowStart), r.colStart = Math.min(r.colStart, o.colStart), r.rowEnd = Math.max(r.rowEnd, o.rowEnd), r.colEnd = Math.max(r.colEnd, o.colEnd));
251
- }
252
- return r;
253
- }, It = [null, null], Nt = (e, t, r) => {
254
- if (e[0].value === e[1].value) return t;
255
- };
256
- function Fe(e, t = 2, r, n = j.Row, o) {
257
- let i = [...e];
258
- if (t <= 0 || e.length <= 1) return i;
259
- let a = n === j.Column, l = 0, u = !1;
260
- do {
261
- const f = i.sort(it(a ? j.Row : j.Column));
262
- i = [], i.push(f[0]);
263
- const h = f.length;
264
- let g = 0, p = f[0], y = p.colStart, T = p.rowStart, A = p.colEnd, D = p.rowEnd;
265
- for (let U = 1; U < h; U++) {
266
- const I = f[U];
267
- let J = !1;
268
- if (J = a ? p && T === I.rowStart && D === I.rowEnd && A + 1 === I.colStart : p && y === I.colStart && A === I.colEnd && D + 1 === I.rowStart, J) {
269
- let E = { colStart: y, rowStart: T, colEnd: a ? I.colEnd : A, rowEnd: a ? D : I.rowEnd };
270
- if (p.value !== void 0 && (E.value = p.value), r) {
271
- const c = o ?? [null, null];
272
- c[0] = p, c[1] = I, E = r(c, E, n);
273
- }
274
- if (E) {
275
- i[g] = E, u = !0, p = E, y = p.colStart, T = p.rowStart, A = p.colEnd, D = p.rowEnd;
276
- continue;
277
- }
278
- }
279
- i[++g] = I, p = I, y = p.colStart, T = p.rowStart, A = p.colEnd, D = p.rowEnd;
280
- }
281
- l++, a = !a, l === 1 && (u = !0);
282
- } while (l < t && u && i.length > 1);
283
- return i;
284
- }
285
- Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: vt, EmptyRange: Tt, cellToRange: (e, t) => {
286
- if (!e) return null;
287
- let r = t;
288
- return r || (r = { ...e }, delete r.colIndex, delete r.rowIndex), r.colStart = e.colIndex ?? 0, r.rowStart = e.rowIndex ?? 0, r.colEnd = e.colIndex ?? 0, r.rowEnd = e.rowIndex ?? 0, r;
289
- }, columnFirstCellComparator: Le, columnFirstRangeComparator: nt, createCellComparator: (e = j.Row, t = !1) => t ? e !== j.Column ? (r, n) => r.rowIndex === n.rowIndex ? n.colIndex - r.colIndex : n.rowIndex - r.rowIndex : (r, n) => r.colIndex === n.colIndex ? n.rowIndex - r.rowIndex : n.colIndex - r.colIndex : e !== j.Column ? Ae : Le, createConflatingRanges: (e, t = !1) => {
290
- const r = [];
291
- let n, o, i = Number.MIN_SAFE_INTEGER, a = Number.MIN_SAFE_INTEGER;
292
- return { append: (l, u, f) => {
293
- let h = !0;
294
- const g = f !== void 0;
295
- if (g) {
296
- const T = e ? e(o, f, t) : o === f ? f : void 0;
297
- T === void 0 ? h = !1 : f = T;
298
- }
299
- if (h && u === a + 1 && l === i) return t ? n.rowEnd = u : n.colEnd = u, a = u, void (o = f);
300
- n && r.push(n);
301
- const p = t ? l : u, y = t ? u : l;
302
- n = { colStart: p, rowStart: y, colEnd: p, rowEnd: y }, g && (n.value = f), i = l, a = u, o = f;
303
- }, done: (l) => (n && (r.push(n), n = null), l ? Fe(r, 3, l === !0 ? Nt : l, t ? j.Column : j.Row, It) : r) };
304
- }, createRangeComparator: it, defaultRange: (e, t, r) => e ? r ? (r.colStart = e.colStart ?? t.colStart, r.rowStart = e.rowStart ?? t.rowStart, r.colEnd = e.colEnd ?? t.colEnd, r.rowEnd = e.rowEnd ?? t.rowEnd, r) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Pe, extendRangeToUnionRanges: (e, t) => {
305
- if (!t || t.length === 0) return e;
306
- let r = e, n = null;
307
- for (; !Se(r, n); ) n = r, r = Pe(n, t);
308
- return r;
309
- }, indexOfCoords: (e, t) => {
310
- const r = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
311
- for (let n = t.length - 1; n >= 0; n--) if (xe(r, t[n])) return n;
312
- return -1;
313
- }, intersectRanges: (e, t, r) => {
314
- if (!e) return r ? t : { ...t };
315
- if (!t) return r ? e : { ...e };
316
- if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
317
- const n = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), i = Math.min(e.colEnd, t.colEnd), a = Math.min(e.rowEnd, t.rowEnd);
318
- let l = r;
319
- return l ? (l.colStart = n, l.rowStart = o, l.colEnd = i, l.rowEnd = a) : l = { colStart: n, rowStart: o, colEnd: i, rowEnd: a }, l;
320
- }, isCellWithinRange: (e, t) => !(!e || !t) && !(e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd) && !(e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Me, isEqualRanges: Se, isEqualRangesArrays: je, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Me(e.cell, t.cell) && je(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd) && !(e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: xe, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !!e && !(typeof e.colStart != "number" || e.colStart < 0) && !(typeof e.colEnd != "number" || e.colEnd < e.colStart) && !(typeof e.rowStart != "number" || e.rowStart < 0) && !(typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: Fe, rowFirstCellComparator: Ae, rowFirstRangeComparator: ot, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, r = -e.colStart, n) => n ? (n.colStart = e.colStart + r, n.rowStart = e.rowStart + t, n.colEnd = e.colEnd + r, n.rowEnd = e.rowEnd + t, n) : { colStart: e.colStart + r, rowStart: e.rowStart + t, colEnd: e.colEnd + r, rowEnd: e.rowEnd + t }, unionRanges: he, unionRangesArrays: (e, t, r) => {
321
- if (!e || e.length === 0) return null;
322
- if (e.length === 1 && !t) return e[0];
323
- let n = e[0];
324
- for (let o = 1; o < e.length; o++) n = he(n, e[o], r);
325
- return t && (n = he(n, t, r)), n;
326
- } }, Symbol.toStringTag, { value: "Module" }));
327
- function Rt(e) {
328
- const t = Object.prototype.toString.call(e);
329
- return t === "[object RegExp]" || t === "[object Date]" || function(r) {
330
- return r.$$typeof === kt;
331
- }(e);
332
- }
333
- const kt = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
334
- function Lt(e) {
335
- return /* @__PURE__ */ function(t) {
336
- return !!t && typeof t == "object";
337
- }(e) && !Rt(e);
338
- }
339
- function ne(e, t) {
340
- return t.clone !== !1 && t.isMergeableObject(e) ? Y((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
341
- var r;
342
- }
343
- function At(e, t, r) {
344
- return e.concat(t).map(function(n) {
345
- return ne(n, r);
346
- });
347
- }
348
- function De(e) {
349
- return Object.keys(e).concat(function(t) {
350
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(r) {
351
- return Object.propertyIsEnumerable.call(t, r);
352
- }) : [];
353
- }(e));
354
- }
355
- function Ue(e, t) {
356
- try {
357
- return t in e;
358
- } catch {
359
- return !1;
360
- }
361
- }
362
- function Mt(e, t, r) {
363
- const n = {};
364
- return r.isMergeableObject(e) && De(e).forEach(function(o) {
365
- n[o] = ne(e[o], r);
366
- }), De(t).forEach(function(o) {
367
- (function(i, a) {
368
- return Ue(i, a) && !(Object.hasOwnProperty.call(i, a) && Object.propertyIsEnumerable.call(i, a));
369
- })(e, o) || (Ue(e, o) && r.isMergeableObject(t[o]) ? n[o] = function(i, a) {
370
- if (!a.customMerge) return Y;
371
- const l = a.customMerge(i);
372
- return typeof l == "function" ? l : Y;
373
- }(o, r)(e[o], t[o], r) : n[o] = ne(t[o], r));
374
- }), n;
375
- }
376
- function Y(e, t, r) {
377
- (r = r || {}).arrayMerge = r.arrayMerge || At, r.isMergeableObject = r.isMergeableObject || Lt, r.cloneUnlessOtherwiseSpecified = ne;
378
- const n = Array.isArray(t);
379
- return n === Array.isArray(e) ? n ? r.arrayMerge(e, t, r) : Mt(e, t, r) : ne(t, r);
380
- }
381
- Y.all = function(e, t) {
382
- if (!Array.isArray(e)) throw new Error("first argument should be an array");
383
- return e.reduce(function(r, n) {
384
- return Y(r, n, t);
385
- }, {});
386
- };
387
- const jt = Object.freeze([]), Pt = Object.freeze({}), Be = (e) => e, de = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
388
- let t = 16 * Math.random() | 0;
389
- return (e === "x" ? t : 3 & t | 8).toString(16);
390
- }), Ft = (e) => 1 * e, at = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((r, n) => r === t[n]), re = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, lt = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
391
- e[t] && typeof e[t] == "object" ? lt(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
392
- }), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !at(e, t)) || !!e.isEqual?.(t), st = (e, t, r = Dt) => {
393
- if (e == null || e === t) return null;
394
- if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return r(e, t) ? null : e;
395
- const n = Object.keys(e);
396
- if (n.length === 0) return null;
397
- let o = !1;
398
- for (let i = 0; i < n.length; i++) {
399
- const a = n[i];
400
- st(e[a], t?.[a], r) === null && (o = !0, delete e[a]);
401
- }
402
- return o && Object.keys(e).length === 0 ? null : void 0;
403
- }, $e = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), ze = (e) => e == null, Ke = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), Ve = !(typeof window > "u" || !window.document || !window.document.createElement), k = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, oe = () => {
404
- if (ct()) return k.Node;
405
- const e = globalThis.navigator !== void 0 && globalThis.navigator.userAgent ? globalThis.navigator.userAgent.toLowerCase() : "";
406
- return e ? /(win32|win64|windows|wince)/i.test(e) ? k.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? k.MacOS : /(iphone|ipad|ipod)/i.test(e) ? k.IOS : /android/.test(e) ? k.Android : /linux/.test(e) ? k.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? k.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? k.Firefox : k.Unknown : k.Unknown;
407
- };
408
- function ct() {
409
- return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
410
- }
411
- const qe = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ut = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: jt, EmptyObject: Pt, OSType: k, arrayMove: function(e, t, r) {
412
- const n = e.slice();
413
- return n.splice(r < 0 ? n.length + r : r, 0, n.splice(t, 1)[0]), n;
414
- }, asNumber: (e) => {
415
- const t = Ft(e);
416
- return Number.isFinite(t) ? t : 0;
417
- }, camelToPrettyCase: (e) => e.length === 1 ? e.toUpperCase() : e.replace(/([A-Z])/g, " $1").replace(/^./, function(t) {
418
- return t.toUpperCase();
419
- }).trim(), canUseDOM: Ve, cancelTimeout: (e) => {
420
- cancelAnimationFrame(e.id);
421
- }, castToString: (e) => e == null || e === void 0 ? "" : typeof e != "string" ? "" + e : e, cloneObject: (e) => ze(e) ? e : JSON.parse(JSON.stringify(e)), consoleWithNoSource: (...e) => new Promise((t) => {
422
- setTimeout(() => {
423
- Function("console.log.apply(console, arguments)").apply(null, e), t();
424
- });
425
- }), debounce: function(e, t = 300, r = !1) {
426
- let n, o, i, a, l = 0;
427
- function u() {
428
- let h = Date.now() - l;
429
- h < t && h >= 0 ? n = setTimeout(u, t - h) : (n = null, r || (a = e.apply(i, o), i = o = null));
430
- }
431
- t == null && (t = 100);
432
- const f = function() {
433
- i = globalThis, o = arguments, l = Date.now();
434
- var h = r && !n;
435
- return n || (n = setTimeout(u, t)), h && (a = e.apply(i, o), i = o = null), a;
436
- };
437
- return f.clear = function() {
438
- n && (clearTimeout(n), n = null);
439
- }, f.flush = function() {
440
- n && (a = e.apply(i, o), i = o = null, clearTimeout(n), n = null);
441
- }, f;
442
- }, deepEqual: function e(t, r) {
443
- if (t === r) return !0;
444
- if (t && r && typeof t == "object" && typeof r == "object") {
445
- if (t.constructor !== r.constructor) return !1;
446
- let n, o, i;
447
- if (Array.isArray(t)) {
448
- if (n = t.length, n != r.length) return !1;
449
- for (o = n; o-- !== 0; ) if (!e(t[o], r[o])) return !1;
450
- return !0;
451
- }
452
- if (t instanceof Map && r instanceof Map) {
453
- if (t.size !== r.size) return !1;
454
- for (o of t.entries()) if (!r.has(o[0])) return !1;
455
- for (o of t.entries()) if (!e(o[1], r.get(o[0]))) return !1;
456
- return !0;
457
- }
458
- if (t instanceof Set && r instanceof Set) {
459
- if (t.size !== r.size) return !1;
460
- for (o of t.entries()) if (!r.has(o[0])) return !1;
461
- return !0;
462
- }
463
- if (ArrayBuffer.isView(t) && ArrayBuffer.isView(r)) {
464
- if (n = t.length, n != r.length) return !1;
465
- for (o = n; o-- !== 0; ) if (t[o] !== r[o]) return !1;
466
- return !0;
467
- }
468
- if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
469
- if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
470
- if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
471
- if (i = Object.keys(t), n = i.length, n !== Object.keys(r).length) return !1;
472
- for (o = n; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, i[o])) return !1;
473
- for (o = n; o-- !== 0; ) {
474
- let a = i[o];
475
- if ((a !== "_owner" || !t.$$typeof) && !e(t[a], r[a])) return !1;
476
- }
477
- return !0;
478
- }
479
- return t != t && r != r;
480
- }, deepFreeze: function e(t) {
481
- return Object.freeze(t), Object.keys(t).forEach((r) => {
482
- typeof t[r] != "object" || t[r] === null || Object.isFrozen(t[r]) || e(t[r]);
483
- }), t;
484
- }, deepMerge: Y, diffValues: (e, t) => {
485
- const r = {}, n = Object.keys(t), o = n.length;
486
- for (let i = 0; i < o; i++) {
487
- const a = n[i];
488
- e[a] !== t[a] && (e[a] === void 0 ? r[a] = t[a] : r[a] = e[a]);
489
- }
490
- return Object.keys(r).length === 0 ? null : r;
491
- }, findEqualOrGreater: function(e, t, r = Be) {
492
- let n = 0, o = e.length - 1;
493
- for (; n <= o; ) {
494
- let i = Math.floor((n + o) / 2), a = r(e[i]);
495
- if (a === t) return i;
496
- a < t ? n = i + 1 : o = i - 1;
497
- }
498
- return n;
499
- }, findEqualOrLesser: function(e, t, r = Be) {
500
- let n = e.length - 1, o = 0;
501
- for (; n >= o; ) {
502
- let i = Math.floor((n + o) / 2), a = r(e[i]);
503
- if (a === t) return i;
504
- a > t ? n = i - 1 : o = i + 1;
505
- }
506
- return n;
507
- }, findNextStep: (e, t = !0, r = 15, n = 10, o = 400) => {
508
- const i = Math.max(e - n, 0) + (t ? 1 : -1);
509
- return Math.min(o, Math[t ? "ceil" : "floor"](i / r) * r + n);
510
- }, getDPI: () => {
511
- let e = 1;
512
- return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
513
- }, getFromPath: (e, t) => {
514
- const r = t.split(".");
515
- let n = e;
516
- for (let o = 0; o < r.length; o++) {
517
- const i = r[o];
518
- if (!n) return null;
519
- let a = n[i];
520
- if (typeof a == "function" && (a = a.bind(n)()), !a || !re(a)) return a;
521
- n = a;
522
- }
523
- return n ?? null;
524
- }, getOS: oe, hasFocus: qe, isDefined: (e) => e != null, isEmpty: (e) => e == null || e === "", isEqualArrays: at, isEqualBounds: (e, t) => e === t || !(e && !t || t && !e) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEqualObjectKeys: (e, t) => {
525
- if (e === t) return !0;
526
- if (e && !t || t && !e) return !1;
527
- const r = Object.keys(e);
528
- if (r.length !== Object.keys(t).length) return !1;
529
- for (let n = 0; n < r.length; n++) if (e[r[n]] !== t[r[n]]) return !1;
530
- return !0;
531
- }, isNode: ct, isNullOrUndefined: ze, isNumeric: (e) => {
532
- const t = 1 * e;
533
- return Number.isFinite(t) && typeof t == "number";
534
- }, isObject: re, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: Ke, mergeContentful: (...e) => {
535
- const t = e.length;
536
- if (t > 0 && e[t - 1] !== void 0 && !re(e[t - 1])) return e[t - 1];
537
- let r = e[0] || {};
538
- for (let n = 1; n < t; n++) r = Y(r, e[n] || {}, { arrayMerge: (o, i) => [...i] });
539
- return r;
540
- }, nextTick: (e) => {
541
- typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
542
- e();
543
- }) : (typeof setImmediate == "function" ? setImmediate : setTimeout)(() => {
544
- e();
545
- });
546
- }, openFileDialog: (e = "*.*") => new Promise((t, r) => {
547
- if (!Ve) return void r("Unable to open dialog with no dom.");
548
- const n = document.createElement("input");
549
- n.type = "file", n.accept = e;
550
- let o = null, i = !1;
551
- globalThis.addEventListener?.("focus", () => {
552
- setTimeout(() => {
553
- o || i || (i = !0, t(null));
554
- }, 1e3);
555
- }, { once: !0, passive: !0 }), n.onchange = () => {
556
- if (o = n.files[0], o) {
557
- if (i) return void console.warn("File open detected after faux cancel.", o);
558
- t(o);
559
- }
560
- }, n.autofocus = !0, n.click();
561
- }), rafThrottle: (e) => {
562
- let t, r = !1, n = function() {
563
- r = !1, e(t);
564
- };
565
- return function(o) {
566
- t = o, t && t.persist && t.persist(), r || (r = !0, requestAnimationFrame(n));
567
- };
568
- }, removeEmptyProperties: lt, removeEqualValues: st, removeListenerAll: (e) => {
569
- if (!e) return [];
570
- for (let t = 0; t < e.length; t++) e[t] && e[t]();
571
- return [];
572
- }, requestTimeout: (e, t) => {
573
- const r = $e(), n = { id: requestAnimationFrame(function o() {
574
- $e() - r >= t ? e.call(null) : n.id = requestAnimationFrame(o);
575
- }) };
576
- return n;
577
- }, roundAccurately: (e, t = 0) => {
578
- if (e == null || !isFinite(e)) return null;
579
- const r = 10 ** t;
580
- return Number(Math.round(e * r) / r);
581
- }, setToPath: (e, t, r) => {
582
- const n = t.split(".");
583
- let o = e;
584
- if (!o) throw new Error("Can not set path to a null path.");
585
- for (let i = 0; o && i < n.length - 1; i++) {
586
- const a = n[i];
587
- let l = o[a];
588
- if (l == null && (l = {}, o[a] = l), !re(l)) throw new Error("Can not set path to a non object path.");
589
- o = l;
590
- }
591
- if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !re(r)) throw new Error(\`Can not set path to \${r} that is not a a supported primitive.\`);
592
- return o[n[n.length - 1]] = r, e;
593
- }, splitNumber: (e) => {
594
- let t = Math.abs(e);
595
- if (isNaN(t) || !isFinite(e)) return null;
596
- let r = 0 | t, n = t - r, o = 0, i = 0, a = 1;
597
- if (n > 5e-8) for (; i < 8 && Math.abs(o / a - n) > 5e-8; ) i++, a *= 10, o = Math.round(n * a);
598
- return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(r + 1)), fpLength: i };
599
- }, subtractRect: (e, t, r = !1) => {
600
- if (!t) return [e];
601
- if (!Ke(e, t)) return [];
602
- const n = [];
603
- let o = e;
604
- const i = () => {
605
- t.top > o.top && t.top < o.bottom && (n.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
606
- }, a = () => {
607
- t.bottom > o.top && t.bottom < o.bottom && (n.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
608
- }, l = () => {
609
- t.right > o.left && t.right < o.right && (n.push({ ...o, left: t.right }), o = { ...o, right: t.right });
610
- }, u = () => {
611
- t.left > o.left && t.left < o.right && (n.push({ ...o, right: t.left }), o = { ...o, left: t.left });
612
- };
613
- return r ? (u(), l(), i(), a()) : (i(), a(), l(), u()), n;
614
- }, textToKey: (e) => e.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(), throttle: function(e, t) {
615
- let r = null;
616
- return (...n) => {
617
- const o = Date.now();
618
- (!r || o - r >= t) && (r = o, e(...n));
619
- };
620
- }, toSafeJSON: function e(t) {
621
- if (t === null || typeof t != "object") return t;
622
- if (typeof t.toJSON == "function") return t.toJSON();
623
- if (Array.isArray(t)) return t.map((n) => e(n));
624
- if (typeof t.toString == "function" && t.toString !== Object.prototype.toString) return t.toString();
625
- const r = {};
626
- for (const n in t) t.hasOwnProperty(n) && (r[n] = e(t[n]));
627
- return r;
628
- }, transpose: (e) => {
629
- if (!e) return e;
630
- const t = e.length, r = e[0].length, n = [];
631
- for (let o = 0; o < r; o++) n[o] = Array(t);
632
- for (let o = 0; o < t; o++) for (let i = 0; i < r; i++) n[i][o] = e[o][i];
633
- return n;
634
- }, uuidV4: de, validEnumValue: (e, t) => {
635
- if (!Object.values(e).includes(t)) throw new Error(\`Invalid type: \${t ?? "null"}. Must be one of: \${Object.values(t).join(", ")}.\`);
636
- }, whenFocus: async (e, t = !1) => new Promise((r) => {
637
- qe(e, t) ? r(!0) : e.addEventListener("focusin", () => {
638
- r(!0);
639
- }, { once: !0 }), e.focus();
640
- }) }, Symbol.toStringTag, { value: "Module" }));
641
- Object.freeze(Object.defineProperty({ __proto__: null, MESSAGE_ERROR_INVALID_ARG: (e) => \`Invalid argument: '\${e}'.\` }, Symbol.toStringTag, { value: "Module" }));
642
- const ut = (e) => {
643
- const t = new Uint8Array(e), r = t.byteLength;
644
- let n = "";
645
- for (let o = 0; o < r; o++) n += String.fromCharCode(t[o]);
646
- if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(n);
647
- if (typeof Buffer < "u") return Buffer.from(n, "binary").toString("base64");
648
- throw new Error("Unsupported environment");
649
- }, Ce = (e) => new Promise((t, r) => {
650
- if (e) if (typeof FileReader < "u") {
651
- const n = new FileReader();
652
- n.onload = () => {
653
- t(n.result);
654
- }, n.onerror = () => {
655
- r(n.error);
656
- }, n.readAsText(e);
657
- } else if (typeof Buffer < "u") {
658
- const n = (o) => Buffer.from(o).toString("utf-8");
659
- e.arrayBuffer().then((o) => {
660
- t(n(o));
661
- }).catch((o) => {
662
- r(o);
663
- });
664
- } else r(new Error("Unsupported environment"));
665
- else t("");
666
- });
667
- Object.freeze(Object.defineProperty({ __proto__: null, DEFAULT_MIME_TYPE: "*/*", arrayBufferToBase64: ut, base64ToArrayBuffer: (e) => {
668
- const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), r = t.length, n = new Uint8Array(r);
669
- for (let o = 0; o < r; o++) n[o] = t.charCodeAt(o);
670
- return n.buffer;
671
- }, blobToString: Ce }, Symbol.toStringTag, { value: "Module" }));
672
- const dt = "data:image/png;base64,", ft = "Unable to resolve image.", Ge = (e) => new Promise(async (t, r) => {
673
- let n = null;
674
- try {
675
- n = new Image(), n.src = e, n.addEventListener("load", function() {
676
- t({ width: n.naturalWidth, height: n.naturalHeight });
677
- }, { once: !0 }), n.addEventListener("error", function() {
678
- URL.revokeObjectURL(e), r("Invalid Image");
679
- }, { once: !0 }), await n.decode("sync");
680
- } catch {
681
- n?.src && URL.revokeObjectURL(n.src);
682
- }
683
- n || r(ft);
684
- }), we = "image/svg+xml";
685
- Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: dt, getImageDataUrl: (e, t = 1) => new Promise(async (r, n) => {
686
- let o = null;
687
- try {
688
- o = new Image(), o.src = e, o.addEventListener("load", function() {
689
- try {
690
- const i = document.createElement("canvas");
691
- i.width = o.naturalWidth, i.height = o.naturalHeight, i.getContext("2d").drawImage(o, 0, 0);
692
- const a = i.toDataURL("image/png", t);
693
- r({ elemImg: o, dataUrl: a });
694
- } catch (i) {
695
- URL.revokeObjectURL(e), n(i);
696
- }
697
- }, { once: !0 }), o.addEventListener("error", function() {
698
- URL.revokeObjectURL(e), n("Invalid Image");
699
- }, { once: !0 }), await o.decode("sync");
700
- } catch {
701
- o?.src && URL.revokeObjectURL(o.src);
702
- }
703
- o || n(ft);
704
- }), loadImageDetails: async (e, t = null) => {
705
- let r = null;
706
- const n = async () => {
707
- try {
708
- const i = t ?? "image/*", a = URL.createObjectURL(new Blob([e], { type: i })), l = await Ge(a);
709
- r = { mimeType: i, naturalDimensions: l, asUrl: a };
710
- } catch {
711
- }
712
- }, o = async () => {
713
- try {
714
- const i = new TextDecoder().decode(e), a = URL.createObjectURL(new Blob([i], { type: we })), l = await Ge(a);
715
- r = { mimeType: t ?? we, naturalDimensions: l, asUrl: a, asSVGText: i };
716
- } catch {
717
- }
718
- };
719
- if (t === we ? await o() : t.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw new Error("Failed to load image");
720
- return r;
721
- } }, Symbol.toStringTag, { value: "Module" }));
722
- var We, Ye;
723
- (Ye = We || (We = {})).resolveTypedUpdates = (e, t, r, n) => {
724
- if (e === null) return e;
725
- if (e === void 0) return n;
726
- let o = e;
727
- if (t?.shorthand) {
728
- const u = t?.shorthand(e, r);
729
- u !== void 0 && (o = u);
730
- }
731
- if (o !== null && t?.getSubType) {
732
- const u = t.getSubType(o);
733
- u && (t = u);
734
- }
735
- const i = t?.properties, a = t?.arrayType ?? !1;
736
- let l = o;
737
- if (t && t.merge && l && n) l = t.merge(l, n, r);
738
- else if (!a && i) {
739
- const u = Object.keys({ ...o, ...n });
740
- l = null;
741
- for (let f = 0; f < u.length; f++) {
742
- const h = u[f];
743
- let g, p = o[h];
744
- if (p !== void 0) {
745
- const y = i[h];
746
- g = y ? (0, Ye.resolveTypedUpdates)(p, y, r, n?.[h]) : p;
747
- } else g = n?.[h];
748
- g != null && (l = l ?? {}, l[h] = g);
749
- }
750
- }
751
- return l;
752
- };
753
- const Je = \`The Safari browser does not support advanced copy and paste.
754
- Copy and paste will be limited to within the browser tab.
755
-
756
- Please use Chrome or Edge if external copy and paste is required.\`, ye = \`You do not have permissions to access the clipboard.
757
- All copy and paste operations will be limited to the browser tab.\`, pt = { Safari: \`The Safari browser does not support advanced copy and paste.
758
- Copy and paste will be limited to within the browser tab.
759
-
760
- Please use Chrome or Edge if external copy and paste is required.\`, Perms: ye, PermsWrite: oe() === k.Safari ? Je : ye, PermsRead: oe() === k.Safari ? Je : ye }, ge = async () => new Promise((e) => {
761
- document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
762
- e();
763
- }, { once: !0 }), document.activeElement.focus?.();
764
- }), be = async (e, t, r) => {
765
- if (oe() === k.Safari) return await r(new Error(pt.Safari));
766
- try {
767
- const n = async (a) => {
768
- try {
769
- return await a();
770
- } catch (l) {
771
- if (l.message?.includes("Document is not focused")) return !1;
772
- throw l;
773
- }
774
- }, o = await globalThis?.navigator?.permissions?.query({ name: e, allowWithoutGesture: !0, allowWithoutSanitization: !0 });
775
- let i = !1;
776
- if (o.state === "prompt" && (i = await n(t)), i || o.state !== "granted" || (i = await t()), !i) return await r(new Error(o.state));
777
- } catch (n) {
778
- return n.message === "No valid data on clipboard" || n.name === "DataError" ? void 0 : await r(n);
779
- }
780
- }, mt = async (e) => {
781
- try {
782
- return await e.read({ unsanitized: [S.html] });
783
- } catch {
784
- }
785
- return await e.read();
786
- }, Bt = async (e, t) => {
787
- if (!e) return null;
788
- const r = await mt(e);
789
- let n = !1;
790
- for (let o = 0; !n && r && o < r.length; o++) if (n = r[o].types.includes(t), n)
791
- return await r[o].getType(t);
792
- return n ? void 0 : null;
793
- };
794
- if (!globalThis.ClipboardItem) {
795
- const e = (r, n) => new Blob([n], { type: r });
796
- class t {
797
- constructor(n, o) {
798
- this._items = {}, this._types = Object.keys(n);
799
- const i = {}, a = Object.keys(n);
800
- for (let l = 0; l < a.length; l++) {
801
- const u = a[l];
802
- let f = n[u];
803
- i[u] = typeof f == "string" ? e(u, f) : f;
804
- }
805
- this._items = i, this._presentationStyle = o?.presentationStyle ?? "unspecified";
806
- }
807
- get types() {
808
- return this._types;
809
- }
810
- getType(n) {
811
- return Promise.resolve(this._items[n]);
812
- }
813
- supports(n) {
814
- return !0;
815
- }
816
- }
817
- globalThis.ClipboardItem = t;
818
- }
819
- const ve = async (e, t = S.html) => new Promise(async (r, n) => {
820
- try {
821
- const o = await Bt(e, t);
822
- if (o) {
823
- const i = new FileReader();
824
- i.onload = () => {
825
- r(i.result);
826
- }, i.onerror = () => {
827
- r("");
828
- }, i.readAsText(o);
829
- } else r("");
830
- } catch (o) {
831
- n(o);
832
- }
833
- }), He = async (e, t = S.html) => {
834
- const r = await ve(e, t);
835
- if (!r) return null;
836
- let n = null;
837
- try {
838
- n = new DOMParser().parseFromString(r, S.html);
839
- } catch {
840
- console.warn("Can't parse html from clipboard.");
841
- }
842
- return n;
843
- }, $t = async (e) => {
844
- e && await e.writeText("");
845
- }, ie = "clipboard-uuid", Q = "web text/uuid", Xe = (e) => \`<div style="display:none" \${ie}="\${e}"/>\`, zt = (e, t) => {
846
- let r = null;
847
- try {
848
- const n = new DOMParser().parseFromString(t, S.html);
849
- n.body.firstElementChild.setAttribute(ie, e), r = n.getElementsByTagName("body")[0].innerHTML;
850
- } catch (n) {
851
- console.warn("Can't embed uuid.", n);
852
- }
853
- return r;
854
- }, Ze = (e, t) => {
855
- if (!t || !e) return !1;
856
- try {
857
- const r = t.querySelectorAll(\`[\${ie}="\${e}"]\`);
858
- if (r && r.length === 1) return !0;
859
- if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
860
- return !1;
861
- } catch {
862
- return !1;
863
- }
864
- };
865
- class Qe {
866
- constructor(t) {
867
- if (t?.nativeClipboard === void 0 || t?.nativeClipboard === !0) try {
868
- this._nativeClipboard = globalThis?.navigator.clipboard;
869
- } catch {
870
- t?.nativeClipboard === !0 && console.warn("NativeClipboard option set to true but no native clipboard available.");
871
- }
872
- else this._nativeClipboard = t?.nativeClipboard === !1 ? null : t?.nativeClipboard;
873
- this._disableCheckOnFocus = t?.disableCheckOnFocus ?? !1, this._init();
874
- }
875
- async _checkForChanges() {
876
- this._nativeClipboard && this._state && !this._disableCheckOnFocus && await be("clipboard-read", async () => {
877
- await ge();
878
- const t = await ve(this._nativeClipboard, Q);
879
- if (!this._state || t && t === this._state.uuid) return !0;
880
- const r = await He(this._nativeClipboard, S.html);
881
- return !this._state || (Ze(this._state.uuid, r) || this.clear(), !0);
882
- }, async (t) => {
883
- t?.message === "denied" || t.message?.includes("Document is not focused") || oe() === k.Safari || console.warn("Unable to detect clipboard changes: ", t);
884
- });
885
- }
886
- _init() {
887
- const t = this;
888
- this._listeners = /* @__PURE__ */ new Map(), this._listenersCapture = /* @__PURE__ */ new Map(), this._state = null, this._nativeClipboard && (this._onFocus = () => {
889
- t._checkForChanges();
890
- }, this._onBlur = () => {
891
- globalThis.addEventListener?.("focus", t._onFocus, { once: !0 });
892
- }, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (r) => {
893
- t._checkForChanges();
894
- }));
895
- }
896
- async read() {
897
- if (!this._nativeClipboard) return this._state?.items ?? null;
898
- const t = this;
899
- return await be("clipboard-read", async () => {
900
- if (await ge(), this._state?.uuid) {
901
- const r = await ve(this._nativeClipboard, Q);
902
- if (r && r === t._state.uuid) return !0;
903
- const n = await He(this._nativeClipboard, S.html);
904
- if (Ze(t._state?.uuid, n)) return !0;
905
- }
906
- return t._state = { items: await mt(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
907
- }, async (r) => {
908
- this.dispatchEvent(new Event("clipboarderrorread"));
909
- }), this._state?.items ?? [];
910
- }
911
- async write(t) {
912
- return this._write({ uuid: de(), items: t, ref: null });
913
- }
914
- async _write(t) {
915
- if (!this._nativeClipboard) return this._state = t, this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")), null;
916
- const r = this, n = [], o = t.uuid;
917
- let i = t.items ?? [];
918
- const a = () => {
919
- r._state = { uuid: o, ref: t.ref, items: n }, r.dispatchEvent(new Event("clipboardwrite")), r.dispatchEvent(new Event("clipboardchange"));
920
- };
921
- await be("clipboard-write", async () => {
922
- await ge(), o && i.length === 0 && (i.push(new ClipboardItem({ [Q]: new Blob([o], { type: Q }) })), i.push(new ClipboardItem({ [S.html]: new Blob([Xe(o)], { type: S.html }) })));
923
- for (let l = 0; l < Math.min(1, i.length); l++) {
924
- const u = i[l];
925
- let f = u.types.indexOf(S.html), h = null;
926
- if (f !== -1) {
927
- const y = await u.getType(S.html);
928
- h = await Ce(y), h && (h = zt(o, h));
929
- }
930
- if (!h && u.types.includes(S.plain)) {
931
- const y = await u.getType(S.plain);
932
- if (y) {
933
- let T = null;
934
- typeof y == "string" ? (console.warn("text as string", y), T = y) : T = await Ce(y), T && (h = \`<div \${ie}="\${o}">\${T}</div>\`);
935
- }
936
- }
937
- if (!h && u.types.includes(S.png)) {
938
- const y = await u.getType(S.png), T = ut(await y.arrayBuffer());
939
- h = \`<div \${ie}="\${o}"><img src="\${dt + T}"/></div>\`;
940
- }
941
- !h && o && (h = Xe(o));
942
- const g = new Blob([h ?? ""], { type: S.html }), p = {};
943
- for (let y = 0; y < u.types.length; y++) {
944
- const T = u.types[y];
945
- p[T] = y === f ? g : u.getType(T);
946
- }
947
- h && f === -1 && (p[S.html] = g), o && (p[Q] = new Blob([o], { type: Q })), n.push(new ClipboardItem(p));
948
- }
949
- try {
950
- n && n.length !== 0 ? await this._nativeClipboard.write(n) : await $t(this._nativeClipboard);
951
- } catch (l) {
952
- l.message?.includes("Document is not focused") || console.warn("Unable to write to native clipboard: ", l);
953
- }
954
- return a(), !0;
955
- }, async (l) => {
956
- this.dispatchEvent(new Event("clipboarderrorwrite")), a();
957
- });
958
- }
959
- async writeReference(t) {
960
- if (!t) return void this.clear();
961
- let r = null;
962
- const n = {};
963
- try {
964
- const i = await t.toText?.() ?? null;
965
- i && (n[S.plain] = new Blob([i ?? ""], { type: S.plain }));
966
- } catch (i) {
967
- r = i;
968
- }
969
- try {
970
- const i = await t.toHtml?.() ?? null;
971
- i && (n[S.html] = new Blob([i], { type: S.html }));
972
- } catch (i) {
973
- r = i, console.warn("export to html", i);
974
- }
975
- try {
976
- const i = await t.toImage?.() ?? null;
977
- i && (n[S.png] = i);
978
- } catch (i) {
979
- r = i, console.warn("export to png", i);
980
- }
981
- const o = this._write({ uuid: de(), ref: t, items: Object.keys(n).length > 0 ? [new ClipboardItem(n)] : null });
982
- if (r) throw r;
983
- return o;
984
- }
985
- clear(t = !1) {
986
- this._state && (this._state = null, t && this._write({ uuid: null, ref: null, items: null }), this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")));
987
- }
988
- async readReference() {
989
- return await this.read(), this._state?.ref ?? null;
990
- }
991
- readText() {
992
- return new Promise(async (t, r) => {
993
- const n = await this.read();
994
- let o = null;
995
- for (let a = 0; !o && n && a < n.length; a++) n[a].types.includes(S.plain) && (o = await n[a].getType(S.plain));
996
- if (!o) return void t("");
997
- const i = new FileReader();
998
- i.onload = () => {
999
- t(i.result);
1000
- }, i.readAsText(o), i.onerror = (a) => {
1001
- r(a);
1002
- };
1003
- });
1004
- }
1005
- async writeText(t) {
1006
- const r = [new ClipboardItem({ [S.plain]: new Blob([t], { type: S.plain }) })];
1007
- return this._write({ uuid: de(), items: r, ref: null });
1008
- }
1009
- addEventListener(t, r, n = {}) {
1010
- const o = n?.capture ? this._listenersCapture : this._listeners;
1011
- let i = o.get(t);
1012
- i || (i = /* @__PURE__ */ new Map(), o.set(t, i)), i.set(r, typeof n == "boolean" ? {} : n);
1013
- }
1014
- dispatchEvent(t) {
1015
- if (!t) return;
1016
- const r = (n) => {
1017
- const o = n.get(t.type);
1018
- o && o.forEach((i, a) => {
1019
- try {
1020
- typeof a == "function" ? a(t) : a.handleEvent && a.handleEvent(t), i.once && o.delete(a);
1021
- } catch (l) {
1022
- console.warn(l);
1023
- }
1024
- });
1025
- };
1026
- return r(this._listenersCapture), r(this._listeners), !0;
1027
- }
1028
- removeEventListener(t, r, n) {
1029
- const o = n?.capture ? this._listenersCapture : this._listeners, i = o.get(t);
1030
- i && (i.delete(r), i.size === 0 && o.delete(t));
1031
- }
1032
- close() {
1033
- globalThis.removeEventListener?.("focus", this._onFocus), globalThis.removeEventListener?.("blur", this._onBlur);
1034
- }
1035
- }
1036
- var Ee;
1037
- (Ee = Qe || (Qe = {})).ErrorMessages = pt, Ee.Global = new Ee();
1038
- const Kt = "__SHEETXL";
1039
- let ee = null, le = null;
1040
- async function Vt() {
1041
- if (ee)
1042
- return ee;
1043
- if (le) {
1044
- if (await le, !ee)
1045
- throw new Error("ESBuild initialization promise resolved, but instance is not available.");
1046
- return ee;
1047
- }
1048
- let e, t;
1049
- le = new Promise((r, n) => {
1050
- e = r, t = n;
1051
- });
1052
- try {
1053
- const { initialize: r } = await Promise.resolve().then(function() {
1054
- return rr;
1055
- });
1056
- return ee = await r(), e(), ee;
1057
- } catch (r) {
1058
- throw console.error("Failed to import or initialize esbuild:", r), le = null, t(r), r;
1059
- }
1060
- }
1061
- const qt = {
1062
- // ESBuild.TsconfigRaw =
1063
- compilerOptions: {
1064
- target: "esnext"
1065
- }
1066
- };
1067
- async function Gt(e, t, r = "/script.js", n = Kt) {
1068
- try {
1069
- const o = await Vt(), i = "@sheetxl/primitives", a = \`
1070
- export const FormulaContext = globalThis.\${n}?.FormulaContext;
1071
- export const ScalarType = globalThis.\${n}?.ScalarType;
1072
- export const Observable = globalThis.\${n}?.Observable;
1073
- export const IRange = globalThis.\${n}?.IRange;
1074
- export const FormulaError = globalThis.\${n}?.FormulaError;
1075
- // Add more exports as needed
1076
- \`, l = {
1077
- // ESBuild.Plugin = {
1078
- name: "sheetxl-esbuild-in-memory",
1079
- setup(f) {
1080
- const h = "sheetxl-" + (/* @__PURE__ */ new Date()).getTime();
1081
- f.onResolve({ filter: new RegExp(\`^(\${r.replace("/", "\\\\/")}|\${i})$\`) }, (g) => ({
1082
- path: g.path,
1083
- namespace: h
1084
- })), f.onResolve({ filter: /.*/ }, (g) => {
1085
- if (g.namespace !== h)
1086
- return console.warn(\`esbuild: Treating import "\${g.path}" as external.\`), { path: g.path, external: !0 };
1087
- }), f.onLoad({ filter: /.*/, namespace: h }, (g) => {
1088
- let p;
1089
- if (g.path === r)
1090
- p = t;
1091
- else if (g.path === i)
1092
- p = a;
1093
- else
1094
- return {
1095
- errors: [{ text: \`Cannot load unknown path in \${h}: \${g.path}\` }]
1096
- };
1097
- return {
1098
- contents: p,
1099
- loader: "ts"
1100
- // leave this as 'ts' so esbuild generates proper sourcemaps
1101
- };
1102
- });
1103
- }
1104
- }, u = await o.build({
1105
- entryPoints: [r],
1106
- // Use the virtual entry point
1107
- bundle: !0,
1108
- // IMPORTANT: Enable bundling
1109
- write: !1,
1110
- // IMPORTANT: Return result in memory
1111
- format: "esm",
1112
- // Output format
1113
- plugins: [l],
1114
- // TODO - later change to external and prepend when executing from ui
1115
- sourcemap: "inline",
1116
- // Generate separate source map string
1117
- tsconfigRaw: qt,
1118
- // Pass the mapped options
1119
- minify: !0,
1120
- // sourcemap: 'external', // Generate separate source map string
1121
- // Or use 'inline' if you prefer data URLs embedded in the code
1122
- // To suppress warnings about dynamic import() if esbuild complains:
1123
- // supported: { 'dynamic-import': true },
1124
- platform: "neutral"
1125
- // not really needed
1126
- });
1127
- if (u.outputFiles && u.outputFiles.length > 0)
1128
- return u.outputFiles[0].text;
1129
- throw u.errors && u.errors.length > 0 ? new Error(\`esbuild bundling failed: \${u.errors.map((f) => f.text).join(\`
1130
- \`)}\`) : new Error("esbuild did not produce an output file.");
1131
- } catch (o) {
1132
- throw console.error("esbuild bundling process failed:", o), o;
1133
- }
1134
- }
1135
- const Wt = \`
1136
- /**
1137
- * Represents the completion of an asynchronous operation
1138
- */
1139
- interface Promise<T> {
1140
- /**
1141
- * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
1142
- * resolved value cannot be modified from the callback.
1143
- * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
1144
- * @returns A Promise for the completion of the callback.
1145
- */
1146
- finally(onfinally?: (() => void) | undefined | null): Promise<T>;
1147
- }
1148
- \`, Yt = \`
1149
- interface FirstTest {
1150
- isTrue?: boolean;
1151
- }
1152
- \`, Jt = async () => Yt, ht = /* @__PURE__ */ new Map([
1153
- ["IReferenceRange", "r"],
1154
- ["IRange", "l"]
1155
- ]), wt = /* @__PURE__ */ new Map([
1156
- ["IWorkbook", "workbook"],
1157
- ["ISheet", "sheet"],
1158
- ["ICellRanges", "ranges"],
1159
- ["ICellRange", "range"],
1160
- ["IFormulaContext", "context"]
1161
- ]), _e = (e, t) => {
1162
- Array.from(t.keys()).forEach((n) => {
1163
- const o = t.get(n);
1164
- t.set(\`\${e}.\${n}\`, o);
1165
- });
1166
- }, Ht = /* @__PURE__ */ new Map([
1167
- ["Scalar", "*"],
1168
- ["FormulaError.Known", W.Error],
1169
- ["Date", "Date"],
1170
- ["JSON", "JSON"]
1171
- ]), Xt = /* @__PURE__ */ new Map([
1172
- // Repeating
1173
- ]), Oe = "SheetXL";
1174
- _e(Oe, ht);
1175
- _e(Oe, wt);
1176
- _e(Oe, Xt);
1177
- const Zt = /* @__PURE__ */ new Map([
1178
- ["Promise", () => ({ async: !0 })],
1179
- // ['PromiseLike', (): Partial<IFunction.ReturnTypeJSON> => {
1180
- // return { async: true };
1181
- // }],
1182
- ["Observable", () => ({ stream: !0 })]
1183
- ]);
1184
- let se = null;
1185
- async function Qt() {
1186
- if (se)
1187
- return se;
1188
- try {
1189
- return await (await Promise.resolve().then(function() {
1190
- return or;
1191
- })).initialize();
1192
- } catch (e) {
1193
- throw se = null, e;
1194
- } finally {
1195
- se = null;
1196
- }
1197
- }
1198
- async function er(e) {
1199
- const t = e?.source ?? null;
1200
- if (!t) return null;
1201
- const r = (e.disableBundle || e.declarationsOnly) ?? !1, n = [
1202
- Jt(),
1203
- //import('typescript'), // when bundled, but node check causes issues. We could bundle replace isNode but felt hacky
1204
- Qt()
1205
- ], o = await Promise.all(n), i = o[0], a = o[1];
1206
- let l = "", u = null;
1207
- const f = [], h = {
1208
- allowJs: !0,
1209
- declaration: !1,
1210
- sourceMap: !1,
1211
- // was true but now bundler will do this
1212
- inlineSourceMap: !1,
1213
- inlineSources: !1,
1214
- isolatedModules: !0,
1215
- preserveConstEnums: !1,
1216
- // types: ['WebWorker'],
1217
- module: 99,
1218
- //"esNext",
1219
- noResolve: !0,
1220
- emitDeclarationOnly: !1,
1221
- target: a.ScriptTarget.ES2020
1222
- // lib: ['webworker', 'es2020', 'esnext.asynciterable'], // Use the webworker lib instead of dom
1223
- }, g = "script", p = \`\${g}.ts\`, y = "lib.d.ts", T = "global.d.ts", A = {
1224
- [p]: t,
1225
- [y]: Wt,
1226
- [T]: i
1227
- }, D = {
1228
- getSourceFile: (s, w, L, P) => a.createSourceFile(s, A[s], a.ScriptTarget.Latest, !0),
1229
- fileExists: (s) => A[s] !== void 0,
1230
- readFile: (s) => A[s],
1231
- writeFile: (s, w) => {
1232
- A[s] = w;
1233
- },
1234
- // not used
1235
- getCurrentDirectory: () => "./",
1236
- getCanonicalFileName: (s) => s,
1237
- useCaseSensitiveFileNames: () => !0,
1238
- getDefaultLibFileName: (s) => y,
1239
- getNewLine: () => \`
1240
- \`
1241
- }, U = a.createProgram([p, T], h, D), I = U.getTypeChecker(), J = U.getSourceFile(p), E = U.emit();
1242
- E.diagnostics.length > 0 && console.warn(E.diagnostics), l = A[\`\${g}.js\`];
1243
- const c = (s, w, L, P) => {
1244
- if (!s) {
1245
- $(s, new Error(\`Type is not defined for '\${w?.name ?? "return"}'.\`));
1246
- return;
1247
- }
1248
- if (s.kind === a.SyntaxKind.NumberKeyword)
1249
- w.scalar = W.Number;
1250
- else if (s.kind === a.SyntaxKind.StringKeyword)
1251
- w.scalar = W.String;
1252
- else if (s.kind === a.SyntaxKind.BooleanKeyword)
1253
- w.scalar = W.Boolean;
1254
- else if (s.kind === a.SyntaxKind.UndefinedKeyword || s.kind === a.SyntaxKind.NullKeyword || s.kind === a.SyntaxKind.VoidKeyword) {
1255
- if (P) {
1256
- $(s, new Error(\`'undefined' is not a valid type for input: '\${s?.parent?.name?.escapedText}'.\`));
1257
- return;
1258
- }
1259
- w.scalar = W.Null;
1260
- } else if (s.kind === a.SyntaxKind.BigIntKeyword)
1261
- w.scalar = W.Number;
1262
- else if (s.kind === a.SyntaxKind.AnyKeyword)
1263
- w.scalar = W.Null;
1264
- else if (s.kind === a.SyntaxKind.ArrayType) {
1265
- const M = s.elementType;
1266
- if (!M) {
1267
- $(s, new Error(\`'Array' must be typed: '\${s?.parent?.name?.escapedText}'.\`));
1268
- return;
1269
- }
1270
- w.arrayDepth = (w.arrayDepth ?? 0) + 1, c(M, w, L, P);
1271
- } else if (s.kind !== a.SyntaxKind.TupleType) {
1272
- if (s.kind === a.SyntaxKind.TypeReference) {
1273
- const M = s.typeName?.getText?.() ?? null, K = ht.get(M);
1274
- let V = !1;
1275
- K && (w.range = K, V = !0);
1276
- const q = Ht.get(M);
1277
- if (q && (w.scalar = q), q !== void 0 && (V = !0), P) {
1278
- const R = wt.get(M);
1279
- if (R)
1280
- return R;
1281
- } else {
1282
- const R = Zt.get(M);
1283
- if (R) {
1284
- const b = { ...w, ...R() };
1285
- let N = 0;
1286
- if (b.async && N++, b.stream && N++, N > 1) {
1287
- $(s, new Error(\`'\${M}' cannot have multiple modifiers: '\${s?.parent?.name?.escapedText}'.\`));
1288
- return;
1289
- }
1290
- w = b, V = !0;
1291
- }
1292
- }
1293
- if (!V) {
1294
- $("node", new Error(\`'\${M}' is not a valid type: '\${s?.parent?.name?.escapedText}'.\`));
1295
- return;
1296
- }
1297
- const H = s.typeArguments;
1298
- if (H) {
1299
- if (H.length !== 1) {
1300
- $(s, new Error(\`'\${M}' must be typed with exactly 1 type: '\${s?.parent?.name?.escapedText}'.\`));
1301
- return;
1302
- }
1303
- c(H[0], w, L, P);
1304
- }
1305
- }
1306
- }
1307
- }, m = (s) => (a.getCombinedModifierFlags(s) & a.ModifierFlags.Export) !== 0, fe = (s) => (a.getCombinedModifierFlags(s) & a.ModifierFlags.Default) !== 0, B = [], $ = (s, w) => {
1308
- B.push(w);
1309
- };
1310
- if (a.forEachChild(J, (s) => {
1311
- if (m(s) && a.isFunctionDeclaration(s)) {
1312
- const w = {}, L = {
1313
- parameters: {}
1314
- }, P = s?.name?.getText();
1315
- try {
1316
- w.name = P;
1317
- const K = I.getSymbolAtLocation(s.name).getDocumentationComment(I);
1318
- if (K && K.length > 0 && K[0].text) {
1319
- let R = K[0].text;
1320
- R = R.replace(/[\\r\\n]+/g, "\\\\n").trim(), L.summary = R;
1321
- }
1322
- const V = {};
1323
- c(s.type, V, w, !1), w.returnType = V;
1324
- const q = {};
1325
- fe(s) && (q.default = !0, u = P), Object.keys(q).length > 0 && (w.behavior = q), w.parameters = [];
1326
- const H = /* @__PURE__ */ new Map();
1327
- for (let R = 0; R < s.parameters.length; R++) {
1328
- const b = s.parameters[R], N = {};
1329
- N.name = b.name?.getText();
1330
- const X = c(b.type, N, w, !0);
1331
- if (X) {
1332
- if (w.parameters.length !== 0) {
1333
- const F = s?.parent?.name?.getText();
1334
- $(s, new Error(\`'\${w.name}' contexts must be the first parameter: '\${F}'.\`));
1335
- return;
1336
- }
1337
- w.context = X;
1338
- continue;
1339
- }
1340
- const z = !((b.initializer === void 0 || b.initializer === null) && (b.questionToken === void 0 || b.questionToken === null));
1341
- let C;
1342
- if (z && (N.optional = !0, b.initializer))
1343
- try {
1344
- b.initializer.kind === a.SyntaxKind.StringLiteral ? C = b.initializer.text : b.initializer.kind === a.SyntaxKind.NumericLiteral ? C = parseFloat(b.initializer.text) : b.initializer.kind === a.SyntaxKind.TrueKeyword || b.initializer.kind === a.SyntaxKind.FalseKeyword ? C = b.initializer.kind === a.SyntaxKind.TrueKeyword : b.initializer.kind === a.SyntaxKind.NullKeyword ? C = null : b.initializer.kind === a.SyntaxKind.ObjectLiteralExpression || b.initializer.kind === a.SyntaxKind.ArrayLiteralExpression ? C = b.initializer.getText() : C = b.initializer.getText?.();
1345
- } catch (O) {
1346
- console.warn(\`Couldn't extract default value for parameter '\${N.name}'\`, O);
1347
- }
1348
- b.dotDotDotToken && (N.rest = !0), w.parameters.push(N);
1349
- const x = { description: "" };
1350
- L.parameters[N.name] = x;
1351
- const G = I.getSymbolAtLocation(b.name).getDocumentationComment(I);
1352
- G && G.length > 0 && G[0].text && (x.description = G[0].text), C !== void 0 && (x.defaultValue = C), H.set(N.name, N);
1353
- }
1354
- if (s.jsDoc && s.jsDoc.length > 0) {
1355
- const R = s.jsDoc;
1356
- for (let b = 0; b < R.length; b++) {
1357
- const N = R[b]?.tags;
1358
- if (N)
1359
- for (let X = 0; X < N.length; X++) {
1360
- const z = N[X];
1361
- let C = z?.tagName?.text;
1362
- if (!C) continue;
1363
- C = C.toLowerCase();
1364
- let x = z.comment;
1365
- const G = C === "hidden";
1366
- if (!(typeof x != "string" && !G) && (typeof x == "string" && (x = x.replace(/[\\r\\n]+/g, "\\\\n").trim()), !(!G && x && (x = x.split(/\\\\n/)[0], !x || x.length === 0)))) {
1367
- if (x && typeof x == "string") {
1368
- const O = /\\{@link(code|plain)?\\s+([^}|]+)(?:\\s*\\|\\s*([^}]+))?\\}/g;
1369
- let F, Z = x, te = [];
1370
- for (; (F = O.exec(x)) !== null; ) {
1371
- const [pe, me, gt, Ne] = F, bt = [gt.trim()];
1372
- Ne && bt.push(Ne.trim());
1373
- }
1374
- x = Z, te.length > 0 && C === "see" && (L.links || (L.links = []), L.links.push(...te));
1375
- }
1376
- if (C === "name") {
1377
- const O = x;
1378
- O !== P && (L.name = O);
1379
- } else if (C === "description") {
1380
- const O = x;
1381
- } else if (C === "summary") {
1382
- const O = x;
1383
- O && (L.summary = O);
1384
- } else if (C === "param") {
1385
- const O = z.name?.text, F = H.get(O);
1386
- if (!F) {
1387
- B.push(new Error(\`Parameter '\${O}' not found in function '\${P}'.\`));
1388
- continue;
1389
- }
1390
- if (z.typeExpression && z.typeExpression.type)
1391
- try {
1392
- const Z = z.typeExpression.type;
1393
- if (Z.kind === a.SyntaxKind.UnionType) {
1394
- const te = [];
1395
- F.enums = te, Z.types.forEach((pe) => {
1396
- if (pe.kind === a.SyntaxKind.LiteralType) {
1397
- const me = pe.literal.text;
1398
- me && te.push(me);
1399
- }
1400
- });
1401
- }
1402
- } catch (Z) {
1403
- console.warn("Error parsing JSDoc type expression:", Z);
1404
- }
1405
- } else if (C === "returns" || C === "return")
1406
- w.returnType.description = x;
1407
- else if (C === "category")
1408
- L.category = x;
1409
- else if (C === "hidden") {
1410
- let O = !0;
1411
- const F = x?.toLowerCase();
1412
- F === "false" ? O = !1 : F !== "true" && (O = x), O !== !1 && (L.hidden = O ?? !0);
1413
- }
1414
- }
1415
- }
1416
- }
1417
- }
1418
- Object.keys(w.returnType).length === 0 && delete w.returnType, f.push([w, L]);
1419
- } catch (M) {
1420
- $(s, new Error(\`'\${P}': \${M.message}\`));
1421
- }
1422
- }
1423
- }), B.length > 0)
1424
- throw console.warn(B), new Error("There were compilation errors.", { cause: B });
1425
- if (f.length === 0)
1426
- throw new Error("No exported functions.");
1427
- const yt = \`\${Ut.uuidV4()}-script\`;
1428
- try {
1429
- !r && B.length === 0 && (l = await Gt(a, l, g));
1430
- } catch {
1431
- console.warn("Error bundling script");
1432
- }
1433
- const Ie = {
1434
- functions: f,
1435
- commitId: yt,
1436
- source: t,
1437
- name: "Script",
1438
- language: "typescript",
1439
- // default
1440
- compiled: l
1441
- };
1442
- return u && (Ie.autoRun = u), Ie;
1443
- }
1444
- self.addEventListener("message", async (e) => {
1445
- const { id: t, params: r } = e.data;
1446
- try {
1447
- const n = await er(r);
1448
- self.postMessage({ id: t, result: n, error: null });
1449
- } catch (n) {
1450
- self.postMessage({
1451
- id: t,
1452
- result: null,
1453
- error: {
1454
- message: n.message,
1455
- stack: n.stack,
1456
- cause: n.cause
1457
- }
1458
- });
1459
- }
1460
- });
1461
- let ce = null;
1462
- async function tr() {
1463
- return ce || (ce = new Promise(async (e, t) => {
1464
- try {
1465
- const r = "0.20.2", n = \`https://esm.sh/esbuild-wasm@\${r}\`, o = \`https://esm.sh/esbuild-wasm@\${r}/esbuild.wasm\`, a = (await import(
1466
- /* webpackIgnore: true */
1467
- /* @vite-ignore */
1468
- n
1469
- )).default;
1470
- await a.initialize({
1471
- wasmURL: o,
1472
- // Provide the specific WASM URL
1473
- worker: !1
1474
- // Keep processing on the current thread
1475
- }), e(a);
1476
- } catch (r) {
1477
- console.error("Error initializing esbuild:", r), t(r);
1478
- }
1479
- }), ce);
1480
- }
1481
- var rr = /* @__PURE__ */ Object.freeze({
1482
- __proto__: null,
1483
- initialize: tr
1484
- });
1485
- let ue = null;
1486
- async function nr() {
1487
- return ue || (ue = new Promise(async (e, t) => {
1488
- let r = null;
1489
- try {
1490
- r = await import("https://esm.sh/typescript@5.7.2");
1491
- } catch (n) {
1492
- console.error("Error initializing Browser TypeScript module:", n);
1493
- }
1494
- r || console.log("use script fallback"), e(r);
1495
- }), ue);
1496
- }
1497
- var or = /* @__PURE__ */ Object.freeze({
1498
- __proto__: null,
1499
- initialize: nr
1500
- });
1501
- `,a=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",s],{type:"text/javascript;charset=utf-8"});function d(e){let n;try{if(n=a&&(self.URL||self.webkitURL).createObjectURL(a),!n)throw"";const t=new Worker(n,{type:"module",name:e?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(s),{type:"module",name:e?.name})}}const l=async()=>{const{compileModule:e}=await Promise.resolve().then(()=>require("./D_zdscoLJ72sNgWv.cjs")),n=new u(t=>e(t));return await n.start(),n};exports.createCompilerWorker=async function(){if(typeof process<"u"&&process.versions?.node&&typeof Worker>"u")return await l();if(typeof Worker<"u"){const e=new c(()=>new d);try{return await e.start(),e}catch(n){console.error("Failed to start TypescriptCompiler worker reverting to fallback:",n)}}return await l()};