@noeldemartin/utils 0.7.3 → 0.8.0

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 (234) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/fluent/FluentArray.d.ts +48 -0
  3. package/dist/fluent/FluentArray.js +48 -0
  4. package/dist/fluent/FluentArray.js.map +1 -0
  5. package/dist/fluent/FluentObject.d.ts +16 -0
  6. package/dist/fluent/FluentObject.js +45 -0
  7. package/dist/fluent/FluentObject.js.map +1 -0
  8. package/dist/fluent/FluentString.d.ts +21 -0
  9. package/dist/fluent/FluentString.js +28 -0
  10. package/dist/fluent/FluentString.js.map +1 -0
  11. package/dist/fluent/facade.d.ts +17 -0
  12. package/dist/fluent/facade.js +45 -0
  13. package/dist/fluent/facade.js.map +1 -0
  14. package/dist/fluent/index.d.ts +29 -0
  15. package/dist/fluent/index.js +41 -0
  16. package/dist/fluent/index.js.map +1 -0
  17. package/dist/fluent/invade.d.ts +6 -0
  18. package/dist/fluent/invade.js +8 -0
  19. package/dist/fluent/invade.js.map +1 -0
  20. package/dist/fluent/lazyFacade.d.ts +16 -0
  21. package/dist/fluent/lazyFacade.js +67 -0
  22. package/dist/fluent/lazyFacade.js.map +1 -0
  23. package/dist/fluent/noop.d.ts +4 -0
  24. package/dist/fluent/noop.js +6 -0
  25. package/dist/fluent/noop.js.map +1 -0
  26. package/dist/fluent/required.d.ts +5 -0
  27. package/dist/fluent/required.js +32 -0
  28. package/dist/fluent/required.js.map +1 -0
  29. package/dist/fluent/tap.d.ts +7 -0
  30. package/dist/fluent/tap.js +22 -0
  31. package/dist/fluent/tap.js.map +1 -0
  32. package/dist/fluent/value.d.ts +5 -0
  33. package/dist/fluent/value.js +8 -0
  34. package/dist/fluent/value.js.map +1 -0
  35. package/dist/fluent/when.d.ts +6 -0
  36. package/dist/fluent/when.js +11 -0
  37. package/dist/fluent/when.js.map +1 -0
  38. package/dist/helpers/InMemoryStorageService.d.ts +8 -0
  39. package/dist/helpers/InMemoryStorageService.js +16 -0
  40. package/dist/helpers/InMemoryStorageService.js.map +1 -0
  41. package/dist/helpers/IndexedDBMap.d.ts +17 -0
  42. package/dist/helpers/IndexedDBMap.js +52 -0
  43. package/dist/helpers/IndexedDBMap.js.map +1 -0
  44. package/dist/helpers/JSError.d.ts +14 -0
  45. package/dist/helpers/JSError.js +14 -0
  46. package/dist/helpers/JSError.js.map +1 -0
  47. package/dist/helpers/ListenersManager.d.ts +15 -0
  48. package/dist/helpers/ListenersManager.js +23 -0
  49. package/dist/helpers/ListenersManager.js.map +1 -0
  50. package/dist/helpers/MagicObject.d.ts +29 -0
  51. package/dist/helpers/MagicObject.js +77 -0
  52. package/dist/helpers/MagicObject.js.map +1 -0
  53. package/dist/helpers/ObjectsMap.d.ts +28 -0
  54. package/dist/helpers/ObjectsMap.js +86 -0
  55. package/dist/helpers/ObjectsMap.js.map +1 -0
  56. package/dist/helpers/PromisedValue.d.ts +32 -0
  57. package/dist/helpers/PromisedValue.js +68 -0
  58. package/dist/helpers/PromisedValue.js.map +1 -0
  59. package/dist/helpers/Semaphore.d.ts +14 -0
  60. package/dist/helpers/Semaphore.js +45 -0
  61. package/dist/helpers/Semaphore.js.map +1 -0
  62. package/dist/helpers/Storage.d.ts +17 -0
  63. package/dist/helpers/Storage.js +39 -0
  64. package/dist/helpers/Storage.js.map +1 -0
  65. package/dist/helpers/array_helpers.d.ts +57 -0
  66. package/dist/helpers/array_helpers.js +208 -0
  67. package/dist/helpers/array_helpers.js.map +1 -0
  68. package/dist/helpers/boolean_helpers.d.ts +4 -0
  69. package/dist/helpers/boolean_helpers.js +10 -0
  70. package/dist/helpers/boolean_helpers.js.map +1 -0
  71. package/dist/helpers/caching_helpers.d.ts +17 -0
  72. package/dist/helpers/caching_helpers.js +55 -0
  73. package/dist/helpers/caching_helpers.js.map +1 -0
  74. package/dist/helpers/chaos_helpers.d.ts +6 -0
  75. package/dist/helpers/chaos_helpers.js +11 -0
  76. package/dist/helpers/chaos_helpers.js.map +1 -0
  77. package/dist/helpers/date_helpers.d.ts +4 -0
  78. package/dist/helpers/date_helpers.js +15 -0
  79. package/dist/helpers/date_helpers.js.map +1 -0
  80. package/dist/helpers/deprecated.d.ts +24 -0
  81. package/dist/helpers/env.d.ts +9 -0
  82. package/dist/helpers/env.js +42 -0
  83. package/dist/helpers/env.js.map +1 -0
  84. package/dist/helpers/error_helpers.d.ts +12 -0
  85. package/dist/helpers/error_helpers.js +20 -0
  86. package/dist/helpers/error_helpers.js.map +1 -0
  87. package/dist/helpers/escape_helpers.d.ts +5 -0
  88. package/dist/helpers/escape_helpers.js +11 -0
  89. package/dist/helpers/escape_helpers.js.map +1 -0
  90. package/dist/helpers/file_helpers.d.ts +4 -0
  91. package/dist/helpers/file_helpers.js +16 -0
  92. package/dist/helpers/file_helpers.js.map +1 -0
  93. package/dist/helpers/format_helpers.d.ts +7 -0
  94. package/dist/helpers/format_helpers.js +28 -0
  95. package/dist/helpers/format_helpers.js.map +1 -0
  96. package/dist/helpers/hash_helpers.d.ts +4 -0
  97. package/dist/helpers/hash_helpers.js +156 -0
  98. package/dist/helpers/hash_helpers.js.map +1 -0
  99. package/dist/helpers/identity_helpers.d.ts +5 -0
  100. package/dist/helpers/identity_helpers.js +15 -0
  101. package/dist/helpers/identity_helpers.js.map +1 -0
  102. package/dist/helpers/location_helpers.d.ts +8 -0
  103. package/dist/helpers/location_helpers.js +37 -0
  104. package/dist/helpers/location_helpers.js.map +1 -0
  105. package/dist/helpers/logical_helpers.d.ts +4 -0
  106. package/dist/helpers/logical_helpers.js +13 -0
  107. package/dist/helpers/logical_helpers.js.map +1 -0
  108. package/dist/helpers/math_helpers.d.ts +5 -0
  109. package/dist/helpers/math_helpers.js +12 -0
  110. package/dist/helpers/math_helpers.js.map +1 -0
  111. package/dist/helpers/mixin_helpers.d.ts +20 -0
  112. package/dist/helpers/mixin_helpers.js +43 -0
  113. package/dist/helpers/mixin_helpers.js.map +1 -0
  114. package/dist/helpers/network_helpers.d.ts +4 -0
  115. package/dist/helpers/network_helpers.js +8 -0
  116. package/dist/helpers/network_helpers.js.map +1 -0
  117. package/dist/helpers/object_helpers.d.ts +58 -0
  118. package/dist/helpers/object_helpers.js +179 -0
  119. package/dist/helpers/object_helpers.js.map +1 -0
  120. package/dist/helpers/promise_helpers.d.ts +10 -0
  121. package/dist/helpers/promise_helpers.js +25 -0
  122. package/dist/helpers/promise_helpers.js.map +1 -0
  123. package/dist/helpers/replacements-scope.js +21 -0
  124. package/dist/helpers/replacements-scope.js.map +1 -0
  125. package/dist/helpers/replacements.d.ts +5 -0
  126. package/dist/helpers/replacements.js +34 -0
  127. package/dist/helpers/replacements.js.map +1 -0
  128. package/dist/helpers/runtime_helpers.d.ts +4 -0
  129. package/dist/helpers/runtime_helpers.js +8 -0
  130. package/dist/helpers/runtime_helpers.js.map +1 -0
  131. package/dist/helpers/string_helpers.d.ts +17 -0
  132. package/dist/helpers/string_helpers.js +42 -0
  133. package/dist/helpers/string_helpers.js.map +1 -0
  134. package/dist/helpers/time_constants.d.ts +15 -0
  135. package/dist/helpers/time_constants.js +17 -0
  136. package/dist/helpers/time_constants.js.map +1 -0
  137. package/dist/helpers/time_helpers.d.ts +24 -0
  138. package/dist/helpers/time_helpers.js +57 -0
  139. package/dist/helpers/time_helpers.js.map +1 -0
  140. package/dist/helpers/url_helpers.d.ts +24 -0
  141. package/dist/helpers/url_helpers.js +90 -0
  142. package/dist/helpers/url_helpers.js.map +1 -0
  143. package/dist/helpers/value_helpers.d.ts +7 -0
  144. package/dist/helpers/value_helpers.js +11 -0
  145. package/dist/helpers/value_helpers.js.map +1 -0
  146. package/dist/index.d.ts +53 -0
  147. package/dist/index.js +49 -0
  148. package/dist/types/arrays.d.ts +12 -0
  149. package/dist/types/classes.d.ts +12 -0
  150. package/dist/types/helpers.d.ts +36 -0
  151. package/dist/types/helpers.js +6 -0
  152. package/dist/types/helpers.js.map +1 -0
  153. package/dist/types/objects.d.ts +8 -0
  154. package/package.json +38 -52
  155. package/src/fluent/FluentArray.test.ts +2 -9
  156. package/src/fluent/FluentArray.ts +6 -5
  157. package/src/fluent/FluentObject.ts +2 -4
  158. package/src/fluent/FluentString.test.ts +1 -8
  159. package/src/fluent/FluentString.ts +0 -2
  160. package/src/fluent/facade.test.ts +16 -4
  161. package/src/fluent/facade.ts +6 -4
  162. package/src/fluent/index.test.ts +3 -8
  163. package/src/fluent/index.ts +3 -3
  164. package/src/fluent/invade.test.ts +1 -5
  165. package/src/fluent/invade.ts +1 -1
  166. package/src/fluent/lazyFacade.test.ts +191 -0
  167. package/src/fluent/lazyFacade.ts +115 -0
  168. package/src/fluent/required.test.ts +1 -5
  169. package/src/fluent/required.ts +2 -4
  170. package/src/fluent/tap.test.ts +2 -9
  171. package/src/fluent/tap.ts +4 -3
  172. package/src/fluent/value.test.ts +1 -4
  173. package/src/fluent/when.test.ts +1 -6
  174. package/src/fluent/when.ts +2 -2
  175. package/src/helpers/InMemoryStorageService.ts +13 -0
  176. package/src/helpers/IndexedDBMap.ts +0 -2
  177. package/src/helpers/JSError.test.ts +1 -6
  178. package/src/helpers/JSError.ts +0 -2
  179. package/src/helpers/ListenersManager.test.ts +3 -7
  180. package/src/helpers/ListenersManager.ts +2 -4
  181. package/src/helpers/MagicObject.test.ts +14 -8
  182. package/src/helpers/MagicObject.ts +12 -3
  183. package/src/helpers/ObjectsMap.test.ts +1 -3
  184. package/src/helpers/ObjectsMap.ts +1 -5
  185. package/src/helpers/PromisedValue.test.ts +1 -3
  186. package/src/helpers/PromisedValue.ts +5 -6
  187. package/src/helpers/Semaphore.test.ts +6 -10
  188. package/src/helpers/Semaphore.ts +0 -2
  189. package/src/helpers/Storage.test.ts +47 -0
  190. package/src/helpers/Storage.ts +11 -19
  191. package/src/helpers/array_helpers.test.ts +127 -38
  192. package/src/helpers/array_helpers.ts +137 -78
  193. package/src/helpers/caching_helpers.test.ts +1 -3
  194. package/src/helpers/caching_helpers.ts +2 -2
  195. package/src/helpers/date_helpers.test.ts +1 -4
  196. package/src/helpers/date_helpers.ts +1 -1
  197. package/src/helpers/env.ts +5 -1
  198. package/src/helpers/error_helpers.test.ts +9 -8
  199. package/src/helpers/error_helpers.ts +11 -11
  200. package/src/helpers/format_helpers.test.ts +2 -4
  201. package/src/helpers/hash_helpers.test.ts +1 -4
  202. package/src/helpers/hash_helpers.ts +3 -3
  203. package/src/helpers/identity_helpers.test.ts +1 -3
  204. package/src/helpers/index.ts +3 -0
  205. package/src/helpers/logical_helpers.test.ts +1 -3
  206. package/src/helpers/logical_helpers.ts +1 -1
  207. package/src/helpers/math_helpers.test.ts +1 -3
  208. package/src/helpers/mixin_helpers.stubs.ts +1 -13
  209. package/src/helpers/mixin_helpers.test.ts +2 -7
  210. package/src/helpers/mixin_helpers.ts +6 -9
  211. package/src/helpers/object_helpers.test.ts +32 -19
  212. package/src/helpers/object_helpers.ts +43 -21
  213. package/src/helpers/promise_helpers.test.ts +1 -4
  214. package/src/helpers/promise_helpers.ts +9 -9
  215. package/src/helpers/replacements-scope.ts +15 -0
  216. package/src/helpers/replacements.test.ts +23 -0
  217. package/src/helpers/replacements.ts +52 -0
  218. package/src/helpers/runtime_helpers.ts +3 -3
  219. package/src/helpers/string_helpers.test.ts +3 -5
  220. package/src/helpers/time_constants.ts +13 -0
  221. package/src/helpers/time_helpers.ts +35 -0
  222. package/src/helpers/url_helpers.test.ts +12 -4
  223. package/src/helpers/url_helpers.ts +9 -15
  224. package/src/helpers/value_helpers.test.ts +12 -0
  225. package/src/helpers/value_helpers.ts +6 -0
  226. package/src/types/arrays.test.ts +1 -4
  227. package/src/types/classes.ts +1 -0
  228. package/src/types/helpers.test.ts +1 -6
  229. package/src/types/helpers.ts +6 -5
  230. package/src/types/objects.test.ts +1 -4
  231. package/src/types/objects.ts +3 -3
  232. package/dist/noeldemartin-utils.d.ts +0 -901
  233. package/dist/noeldemartin-utils.js +0 -1473
  234. package/dist/noeldemartin-utils.js.map +0 -1
@@ -1,1473 +0,0 @@
1
- var st = Object.defineProperty;
2
- var it = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var a = (e, t, n) => it(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { openDB as ct } from "idb";
5
- function ut(e) {
6
- return typeof e == "function" ? e() : e;
7
- }
8
- function ye(e, t, ...n) {
9
- ut(e) || p(t, ...n);
10
- }
11
- function pe(e) {
12
- try {
13
- return e(), null;
14
- } catch (t) {
15
- return t;
16
- }
17
- }
18
- function p(e = "Something went wrong", ...t) {
19
- const n = typeof e == "string" ? Error : e;
20
- throw new n(...typeof e == "string" ? [e] : t);
21
- }
22
- const j = "items";
23
- class me {
24
- constructor(t) {
25
- a(this, "db", null);
26
- a(this, "namespace");
27
- this.namespace = t;
28
- }
29
- async has(t) {
30
- return await (await this.getConnection()).get(j, t) !== void 0;
31
- }
32
- async get(t) {
33
- return (await this.getConnection()).get(j, t);
34
- }
35
- async require(t) {
36
- return await this.get(t) ?? p(`Missing required '${t}' IndexedDBMap value`);
37
- }
38
- async set(t, n) {
39
- await (await this.getConnection()).put(j, n, t);
40
- }
41
- async delete(t) {
42
- await (await this.getConnection()).delete(j, t);
43
- }
44
- async clear() {
45
- await (await this.getConnection()).clear(j);
46
- }
47
- close() {
48
- this.db && (this.db.close(), this.db = null);
49
- }
50
- async getConnection() {
51
- return this.db = this.db ?? await this.connect(), this.db;
52
- }
53
- async connect() {
54
- const t = `${this.namespace}-map`;
55
- return await ct(t, 1, {
56
- upgrade(r) {
57
- r.objectStoreNames.contains(j) || r.createObjectStore(j);
58
- },
59
- blocked: () => p(`Could not open '${t}' IndexedDB`)
60
- });
61
- }
62
- }
63
- function at() {
64
- return typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : window;
65
- }
66
- const ft = at().Error;
67
- class ge extends ft {
68
- constructor(t, n) {
69
- super(t, n), this.name = new.target.name === "JSError" ? "Error" : new.target.name, Object.setPrototypeOf(this, new.target.prototype);
70
- }
71
- }
72
- function lt(e, t) {
73
- return e == null && t == null ? [e === null ? 1 : 0, t === null ? 1 : 0] : [e ?? null, t ?? null];
74
- }
75
- function C(e, t) {
76
- const [n, r] = lt(e, t);
77
- return n > r ? 1 : r > n ? -1 : 0;
78
- }
79
- function ht(e, t) {
80
- return e === t ? !0 : !m(e) || !m(t) ? !1 : e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : Object.keys(e).length !== Object.keys(t).length ? !1 : !Object.keys(e).some((n) => !ht(e[n], t[n]));
81
- }
82
- function $(e, ...t) {
83
- const [n, ...r] = t;
84
- if (!n)
85
- return e;
86
- if (m(e) && m(n))
87
- for (const o of mt(n)) {
88
- if (!m(n[o])) {
89
- Object.assign(e, { [o]: n[o] });
90
- continue;
91
- }
92
- e[o] ?? (e[o] = {}), m(e[o]) && $(e[o], n[o]);
93
- }
94
- return $(e, ...r);
95
- }
96
- function I(e, t) {
97
- let n = e;
98
- const r = t.split(".");
99
- for (const o of r) {
100
- if (Array.isArray(n)) {
101
- n = n[Number(o)];
102
- continue;
103
- }
104
- if (!m(n))
105
- return;
106
- n = n[o];
107
- }
108
- return n;
109
- }
110
- function be(e, t, n) {
111
- let r = e;
112
- const o = t.split("."), s = o.pop();
113
- if (s) {
114
- for (const i of o) {
115
- if (!m(r))
116
- return;
117
- r = r[i];
118
- }
119
- r[s] = n;
120
- }
121
- }
122
- function we(e) {
123
- const t = /* @__PURE__ */ new Set();
124
- let r = (e.constructor === Object.constructor ? e : e.constructor).prototype;
125
- for (; r.constructor !== Object; )
126
- Object.getOwnPropertyNames(r).forEach((o) => t.add(o)), r = Object.getPrototypeOf(r);
127
- return t.delete("constructor"), Array.from(t);
128
- }
129
- function je(e) {
130
- return Object.entries(e).reduce(
131
- (t, [n, r]) => (t[r] = n, t),
132
- {}
133
- );
134
- }
135
- const Pe = Array.isArray.bind(Array);
136
- function _e(e) {
137
- return "prototype" in e;
138
- }
139
- function ve(e) {
140
- return e == null ? !0 : Array.isArray(e) || typeof e == "string" ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
141
- }
142
- function Ie(e, t) {
143
- return e instanceof t;
144
- }
145
- function dt(e) {
146
- return typeof (e == null ? void 0 : e[Symbol.iterator]) == "function";
147
- }
148
- function m(e) {
149
- return typeof e == "object" && e !== null;
150
- }
151
- function Te(e) {
152
- return m(e) && Object.getPrototypeOf(e) === Object.prototype;
153
- }
154
- function yt(e) {
155
- return typeof e == "string" || e instanceof String;
156
- }
157
- function Ae(e) {
158
- return typeof e > "u" || e === null;
159
- }
160
- function Ee(e, t, n) {
161
- const r = e[t];
162
- e[t] = (...o) => (n(...o), r.call(e, ...o));
163
- }
164
- function pt(e) {
165
- e = { ...e };
166
- for (const t in e)
167
- bt(e, t) && (e[t] = pt(e[t]));
168
- return e;
169
- }
170
- const Me = Object.entries.bind(Object), Oe = Object.fromEntries.bind(Object), Re = Object.values.bind(Object), mt = Object.keys.bind(Object);
171
- function gt(e, t) {
172
- return Object.prototype.hasOwnProperty.call(e, t);
173
- }
174
- function Ce(e, t) {
175
- return e.reduce(
176
- (n, r) => (n[r[t]] = r, n),
177
- {}
178
- );
179
- }
180
- function Se(e, t) {
181
- const n = {}, r = Array.isArray(t) ? t : [t];
182
- for (const o of r)
183
- o in e && (n[o] = e[o]);
184
- return n;
185
- }
186
- function bt(e, t) {
187
- let n;
188
- return gt(e, t) && m(n = e[t]) && n.constructor === Object;
189
- }
190
- function wt(e, t) {
191
- const n = e[t];
192
- return delete e[t], n;
193
- }
194
- function H(e, t) {
195
- if (typeof t == "function") {
196
- const o = t, s = {};
197
- for (const [i, c] of Object.entries(e))
198
- o(c) || (s[i] = c);
199
- return s;
200
- }
201
- const n = { ...e }, r = Array.isArray(t) ? t : [t];
202
- for (const o of r)
203
- delete n[o];
204
- return n;
205
- }
206
- function Le(e) {
207
- return H(e, (t) => t == null);
208
- }
209
- function xe(e, t, n) {
210
- e.prototype[t] = n;
211
- }
212
- function N(e) {
213
- return String(e);
214
- }
215
- function Ne(e) {
216
- return e instanceof Error ? e : new Error(N(e));
217
- }
218
- function jt(e) {
219
- e.splice(0, e.length);
220
- }
221
- function Pt(e, t, n) {
222
- const r = e.slice(0), o = [], s = n ? (i, c) => c.findIndex((u) => n(i, u)) : (i, c) => c.indexOf(i);
223
- for (const i of t) {
224
- const c = s(i, r);
225
- c !== -1 ? r.splice(c, 1) : o.push(i);
226
- }
227
- return { added: o, removed: r };
228
- }
229
- function qe(e, t) {
230
- const n = [];
231
- for (let r = 0; r < e.length; r += t)
232
- n.push(e.slice(r, r + t));
233
- return n;
234
- }
235
- function De(e, t) {
236
- return e.length !== t.length ? !1 : !e.some((n, r) => t[r] !== n);
237
- }
238
- function G(e, t) {
239
- return t ? e.filter(t) : e.filter((n) => !!n);
240
- }
241
- function _t(e, t) {
242
- for (const n of e)
243
- if (t(n))
244
- return n;
245
- return null;
246
- }
247
- function vt(e, t) {
248
- return [...e.entries()].flatMap(([n, r]) => t(r, n));
249
- }
250
- function We(e, t, n) {
251
- return [...e.slice(0, n + 1), t, ...e.slice(n + 1)];
252
- }
253
- function It(e, t) {
254
- const n = typeof t == "string" ? (r) => N(r[t]) : t;
255
- return e.reduce(
256
- (r, o) => {
257
- var s;
258
- return (r[s = n(o)] ?? (r[s] = [])).push(o), r;
259
- },
260
- {}
261
- );
262
- }
263
- function Tt(e) {
264
- return e.length === 0;
265
- }
266
- function At(e, t) {
267
- return e.map((n) => n[t]);
268
- }
269
- function Et(e, t) {
270
- const n = e[t];
271
- return e.splice(t, 1), n;
272
- }
273
- function Mt(e) {
274
- return e.length === 0 ? null : e[Math.floor(Math.random() * e.length)];
275
- }
276
- function Ot(e, t) {
277
- const n = e.slice(0), r = [];
278
- for (; n.length > 0 && r.length < t; ) {
279
- const o = Math.floor(Math.random() * n.length);
280
- r.push(n[o]), n.splice(o, 1);
281
- }
282
- return r;
283
- }
284
- function v(e, t) {
285
- const n = e.indexOf(t);
286
- return n === -1 ? !1 : (e.splice(n, 1), !0);
287
- }
288
- function Rt(e, t) {
289
- return e.splice(Number(t), 1).length > 0;
290
- }
291
- function Ct(e, t, n) {
292
- const r = e.indexOf(t);
293
- return r === -1 ? !1 : (e[r] = n, !0);
294
- }
295
- function St(e, t, n) {
296
- n = t === "asc" || t === "desc" ? t : n;
297
- const r = {}, o = (c) => {
298
- switch (typeof c) {
299
- case "string":
300
- return "";
301
- case "number":
302
- return Number.MIN_SAFE_INTEGER;
303
- case "boolean":
304
- return !1;
305
- default:
306
- return null;
307
- }
308
- }, s = (c, u) => {
309
- if (!(u in r)) {
310
- const y = I(
311
- e.find(
312
- (b) => I(b, u) !== void 0 && I(b, u) !== null
313
- ),
314
- u
315
- );
316
- r[u] = o(y);
317
- }
318
- return I(c, u) ?? r[u];
319
- }, i = () => {
320
- const c = n === "desc" ? (u) => (y, b) => C(s(b, u), s(y, u)) : (u) => (y, b) => C(s(y, u), s(b, u));
321
- switch (typeof t) {
322
- case "function":
323
- return t;
324
- case "string":
325
- return t === "asc" ? void 0 : t === "desc" ? (u, y) => C(y, u) : c(t);
326
- case "object": {
327
- const u = t.map((y) => c(y));
328
- return (y, b) => {
329
- for (const ot of u) {
330
- const U = ot(y, b);
331
- if (U !== 0) return U;
332
- }
333
- return 0;
334
- };
335
- }
336
- }
337
- };
338
- return e.slice(0).sort(i());
339
- }
340
- function Fe(e, t, n) {
341
- [e[t], e[n]] = [e[n], e[t]];
342
- }
343
- function Lt(e, t) {
344
- return t ? Object.values(
345
- e.reduce(
346
- (n, r) => {
347
- const o = t(r);
348
- return n[o] = n[o] ?? r, n;
349
- },
350
- {}
351
- )
352
- ) : [...new Set(e)];
353
- }
354
- function Ue(e, t, n) {
355
- return e.find((r) => {
356
- const o = r[t], s = typeof o == "function" ? o.call(r) : o;
357
- return n ? s === n : !!s;
358
- });
359
- }
360
- function xt(e, t, n) {
361
- return e.filter((r) => {
362
- const o = r[t], s = typeof o == "function" ? o.call(r) : o;
363
- return n ? s === n : !!s;
364
- });
365
- }
366
- function Nt(e, t) {
367
- return Array.isArray(t) ? G(e, (n) => t.indexOf(n) === -1) : qt(e, e.indexOf(t));
368
- }
369
- function qt(e, t) {
370
- return J(e, [t]);
371
- }
372
- function J(e, t) {
373
- return e.map((n, r) => [n, r]).filter(([n, r]) => !t.includes(r)).map(([n]) => n);
374
- }
375
- function $e(...e) {
376
- var r;
377
- const t = [], n = ((r = e[0]) == null ? void 0 : r.length) ?? 0;
378
- for (let o = 0; o < n; o++) t.push(e.map((s) => s[o]));
379
- return t;
380
- }
381
- function q(e, t = !1) {
382
- return Array.isArray(e) || dt(e) && !yt(e) ? Array.from(e) : t && e == null ? [] : [e];
383
- }
384
- function Ke(e) {
385
- return Array.from({ length: e }, (t, n) => n);
386
- }
387
- class Ve {
388
- constructor() {
389
- a(this, "listeners", []);
390
- }
391
- add(t) {
392
- return this.listeners.push(t), () => this.remove(t);
393
- }
394
- remove(t) {
395
- v(this.listeners, t);
396
- }
397
- async emit(t, ...n) {
398
- for (const r of this.listeners) {
399
- const o = r[t];
400
- typeof o == "function" && await (o == null ? void 0 : o.call(r, ...n));
401
- }
402
- }
403
- }
404
- class K {
405
- static isConjuring() {
406
- return this.__conjuring;
407
- }
408
- static isMagicReady() {
409
- return this.__reservedProperties.has(this);
410
- }
411
- static prepareMagic() {
412
- this.__conjuring = !0, this.__reservedProperties.set(this, new Set(Object.getOwnPropertyNames(new this()))), this.__conjuring = !1;
413
- }
414
- static isReservedProperty(t) {
415
- var n;
416
- return !!((n = this.__reservedProperties.get(this)) != null && n.has(t));
417
- }
418
- constructor(...t) {
419
- if (!this.static().isConjuring())
420
- return this.static().isMagicReady() || this.static().prepareMagic(), this._proxy = this.createProxy(), this.initialize(...t), this._proxy.instance;
421
- }
422
- static(t) {
423
- const n = this.constructor;
424
- return t ? n[t] : n;
425
- }
426
- reserveProperty(t) {
427
- Object.assign(this, { [t]: null });
428
- }
429
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
430
- initialize(...t) {
431
- }
432
- __get(t) {
433
- return Reflect.get(this._proxy.target, t);
434
- }
435
- __set(t, n) {
436
- Reflect.set(this._proxy.target, t, n);
437
- }
438
- __delete(t) {
439
- Reflect.deleteProperty(this._proxy.target, t);
440
- }
441
- createProxy() {
442
- const t = this.static();
443
- return {
444
- target: this,
445
- instance: new Proxy(this, {
446
- get(n, r, o) {
447
- return typeof r != "string" || r in n || t.isReservedProperty(r) ? Reflect.get(n, r, o) : n.__get(r);
448
- },
449
- set(n, r, o, s) {
450
- return typeof r != "string" || r in n || t.isReservedProperty(r) ? Reflect.set(n, r, o, s) : (n.__set(r, o), !0);
451
- },
452
- deleteProperty(n, r) {
453
- return typeof r != "string" || r in n || t.isReservedProperty(r) ? Reflect.deleteProperty(n, r) : (n.__delete(r), !0);
454
- }
455
- })
456
- };
457
- }
458
- }
459
- a(K, "__conjuring"), a(K, "__reservedProperties", /* @__PURE__ */ new WeakMap());
460
- class D {
461
- constructor(t) {
462
- a(this, "keysToItems");
463
- a(this, "itemsToKeys");
464
- a(this, "getKey");
465
- this.keysToItems = /* @__PURE__ */ new Map(), this.itemsToKeys = /* @__PURE__ */ new WeakMap(), this.getKey = t ?? ((n) => N(n));
466
- }
467
- /* eslint-enable max-len */
468
- static createFromArray(t, n) {
469
- const r = typeof n == "string" ? (s) => s[n] : n, o = new D(r);
470
- for (const s of t)
471
- o.add(s);
472
- return o;
473
- }
474
- *[Symbol.iterator]() {
475
- yield* this.keysToItems;
476
- }
477
- get size() {
478
- return this.keysToItems.size;
479
- }
480
- items() {
481
- return this.keysToItems.values();
482
- }
483
- keys() {
484
- return this.keysToItems.keys();
485
- }
486
- entries() {
487
- return this.keysToItems.entries();
488
- }
489
- add(t) {
490
- const n = this.getKey(t);
491
- this.keysToItems.set(n, t), this.itemsToKeys.set(t, n);
492
- }
493
- require(t) {
494
- return this.keysToItems.get(t) ?? p(`Couldn't find item with '${t}' key`);
495
- }
496
- get(t) {
497
- return this.keysToItems.get(t);
498
- }
499
- getKeys() {
500
- return [...this.keysToItems.keys()];
501
- }
502
- getItems() {
503
- return [...this.keysToItems.values()];
504
- }
505
- hasKey(t) {
506
- return this.keysToItems.has(t);
507
- }
508
- hasItem(t) {
509
- return this.itemsToKeys.has(t);
510
- }
511
- delete(t) {
512
- const n = this.itemsToKeys.get(t);
513
- n && (this.itemsToKeys.delete(t), this.keysToItems.delete(n));
514
- }
515
- filter(t) {
516
- const n = this.constructor.createFromArray([], this.getKey);
517
- for (const [r, o] of this.entries())
518
- t(o, r) && n.add(o);
519
- return n;
520
- }
521
- clear() {
522
- this.itemsToKeys = /* @__PURE__ */ new WeakMap(), this.keysToItems.clear();
523
- }
524
- clone() {
525
- const t = this.constructor, n = new t(this.getKey);
526
- n.keysToItems = new Map(this.keysToItems), n.itemsToKeys = /* @__PURE__ */ new WeakMap();
527
- for (const [r, o] of n.keysToItems.entries())
528
- n.itemsToKeys.set(o, r);
529
- return n;
530
- }
531
- }
532
- class A {
533
- constructor() {
534
- a(this, "resolveListeners", []);
535
- a(this, "rejectListeners", []);
536
- a(this, "resetListeners", []);
537
- this.setPromiseValues();
538
- }
539
- static from(t) {
540
- const n = new A();
541
- return t.then(n.resolve.bind(n)).catch(n.reject.bind(n)), n;
542
- }
543
- get value() {
544
- return this._value || null;
545
- }
546
- isResolved() {
547
- return "_value" in this;
548
- }
549
- then(t, n) {
550
- return this.promise.then(t, n);
551
- }
552
- catch(t) {
553
- return this.promise.catch(t);
554
- }
555
- finally(t) {
556
- return this.promise.finally(t);
557
- }
558
- resolve(t) {
559
- this.isResolved() && this.reset(), this._value = t, this._resolve(t), this.resolveListeners.forEach((n) => n(t));
560
- }
561
- reject(t) {
562
- this.isResolved() && this.reset(), delete this._value, this._reject(t), this.rejectListeners.forEach((n) => n(t));
563
- }
564
- onResolve(t) {
565
- return this.resolveListeners.push(t), () => v(this.resolveListeners, t);
566
- }
567
- onReject(t) {
568
- return this.rejectListeners.push(t), () => v(this.rejectListeners, t);
569
- }
570
- onReset(t) {
571
- return this.resetListeners.push(t), () => v(this.resetListeners, t);
572
- }
573
- reset() {
574
- this.setPromiseValues(), this.rejectListeners.forEach((t) => t());
575
- }
576
- setPromiseValues() {
577
- this.promise = new Promise((t, n) => {
578
- this._resolve = t, this._reject = n;
579
- });
580
- }
581
- }
582
- class Be {
583
- constructor(t = 1) {
584
- a(this, "count");
585
- a(this, "listeners");
586
- this.count = t, this.listeners = /* @__PURE__ */ new Set();
587
- }
588
- acquire() {
589
- return this.count === 0 ? this.waitAvailable().then(() => this.acquire()) : (this.count = Math.max(this.count - 1, 0), Promise.resolve());
590
- }
591
- release() {
592
- this.count++, this.notifyAvailable();
593
- }
594
- isAvailable() {
595
- return this.count !== 0;
596
- }
597
- async run(t) {
598
- await this.acquire();
599
- try {
600
- return await t();
601
- } finally {
602
- this.release();
603
- }
604
- }
605
- async waitAvailable() {
606
- for (; !this.isAvailable(); )
607
- await new Promise((t) => {
608
- const n = () => {
609
- this.listeners.delete(n), t(null);
610
- };
611
- this.listeners.add(n);
612
- });
613
- }
614
- notifyAvailable() {
615
- this.listeners.forEach((t) => t());
616
- }
617
- }
618
- const V = {}, T = class T {
619
- static get instance() {
620
- return this._instance = this._instance ?? new T();
621
- }
622
- constructor() {
623
- }
624
- set(t, n) {
625
- typeof n > "u" && (n = "__undefined__"), localStorage.setItem(t, JSON.stringify(n));
626
- }
627
- get(t, n = null) {
628
- const r = localStorage.getItem(t);
629
- if (r === null) return n;
630
- if (r !== "__undefined__")
631
- return JSON.parse(r);
632
- }
633
- require(t) {
634
- const n = this.get(t, V);
635
- if (n === V) throw new Error(`Failed getting required key from local storage: '${t}'`);
636
- return n;
637
- }
638
- has(t) {
639
- return localStorage.getItem(t) !== null;
640
- }
641
- remove(t) {
642
- localStorage.removeItem(t);
643
- }
644
- pull(t, n = null) {
645
- if (!this.has(t)) return n;
646
- const r = this.get(t);
647
- return this.remove(t), r;
648
- }
649
- };
650
- a(T, "_instance");
651
- let L = T;
652
- const ze = L.instance;
653
- function He(e) {
654
- return !(!e || ["0", "false"].includes(e));
655
- }
656
- const P = {}, g = {}, _ = {};
657
- function Ge(e, t) {
658
- return g[e] = g[e] ?? A.from(t()), g[e];
659
- }
660
- function Je(e, t) {
661
- return P[e] = P[e] ?? t(), P[e];
662
- }
663
- function Qe(e) {
664
- const t = {};
665
- return (...n) => "result" in t ? t.result : t.result = e(...n);
666
- }
667
- function Ze(e, t, n) {
668
- var r, o;
669
- return (r = _[e]) != null && r.has(t) || Dt(e, t, n()), ((o = _[e]) == null ? void 0 : o.get(t)) ?? p();
670
- }
671
- function Xe(e) {
672
- return Promise.resolve(g[e] ?? null);
673
- }
674
- function Ye(e) {
675
- return P[e] ?? null;
676
- }
677
- function ke(e, t) {
678
- var n;
679
- return ((n = _[e]) == null ? void 0 : n.get(t)) ?? null;
680
- }
681
- function tn(e) {
682
- q(e ?? Object.keys(g)).forEach((n) => delete g[n]);
683
- }
684
- function en(e) {
685
- q(e ?? Object.keys(P)).forEach((n) => delete P[n]);
686
- }
687
- function nn(e, t) {
688
- var n;
689
- (n = _[e]) == null || n.delete(t);
690
- }
691
- function rn(e, t) {
692
- var n;
693
- g[e] = g[e] ?? new A(), (n = g[e]) == null || n.resolve(t);
694
- }
695
- function on(e, t) {
696
- P[e] = t;
697
- }
698
- function Dt(e, t, n) {
699
- (_[e] ?? (_[e] = /* @__PURE__ */ new WeakMap())).set(t, n);
700
- }
701
- function sn(e, t) {
702
- const n = typeof t == "number", r = n ? e : 0;
703
- return t = n ? t : e ?? Number.MAX_SAFE_INTEGER, Math.round(Math.random() * (t - r) + r);
704
- }
705
- function cn(e) {
706
- if (!e) return null;
707
- try {
708
- const t = new Date(e), n = t.getTime();
709
- return isNaN(n) || n === 0 ? null : t;
710
- } catch {
711
- return null;
712
- }
713
- }
714
- let x = null;
715
- function Q() {
716
- return typeof globalThis == "object" && ("Cypress" in globalThis || typeof globalThis.top == "object" && globalThis.top && "Cypress" in globalThis.top) ? "e2e" : typeof process == "object" && process.env.VITEST ? "unit" : null;
717
- }
718
- function un(e) {
719
- x = e;
720
- }
721
- function E() {
722
- var e;
723
- if (x !== null)
724
- return x;
725
- if (Q())
726
- return "testing";
727
- if (typeof process == "object" && ((e = process.env) != null && e.NODE_ENV))
728
- return process.env.NODE_ENV;
729
- try {
730
- return __AEROGEL_ENV__ ?? null;
731
- } catch {
732
- return null;
733
- }
734
- }
735
- function an() {
736
- return E() === "development";
737
- }
738
- function fn(e) {
739
- return E() !== "testing" ? !1 : !e || e === Q();
740
- }
741
- function ln() {
742
- return E() === "production";
743
- }
744
- function hn() {
745
- const e = E();
746
- return e === "development" || e === "testing";
747
- }
748
- function dn(e) {
749
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
750
- }
751
- function yn(e) {
752
- return e.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&");
753
- }
754
- function pn(e, t, n) {
755
- const r = window.URL.createObjectURL(new Blob([t], { type: n })), o = document.createElement("a");
756
- o.style.display = "none", o.href = r, o.download = e, document.body.appendChild(o), o.click(), window.URL.revokeObjectURL(r), document.body.removeChild(o);
757
- }
758
- function mn(e, t = {}) {
759
- const n = e.split(`
760
- `), r = t.indent ?? 0;
761
- let o = 0, s = "";
762
- for (const i of n) {
763
- const c = i.trim(), u = c.length === 0;
764
- if (s.length === 0) {
765
- if (u)
766
- continue;
767
- o = i.indexOf(c[0] ?? ""), s += `${" ".repeat(r)}${c}
768
- `;
769
- continue;
770
- }
771
- if (u) {
772
- s += `
773
- `;
774
- continue;
775
- }
776
- const y = i.indexOf(c[0] ?? "");
777
- s += `${" ".repeat(r + y - o)}${c}
778
- `;
779
- }
780
- return s.trimEnd();
781
- }
782
- function gn(e) {
783
- return Kt(e);
784
- }
785
- function S(e, t) {
786
- let n = e[0], r = e[1], o = e[2], s = e[3];
787
- n = f(n, r, o, s, t[0], 7, -680876936), s = f(s, n, r, o, t[1], 12, -389564586), o = f(o, s, n, r, t[2], 17, 606105819), r = f(r, o, s, n, t[3], 22, -1044525330), n = f(n, r, o, s, t[4], 7, -176418897), s = f(s, n, r, o, t[5], 12, 1200080426), o = f(o, s, n, r, t[6], 17, -1473231341), r = f(r, o, s, n, t[7], 22, -45705983), n = f(n, r, o, s, t[8], 7, 1770035416), s = f(s, n, r, o, t[9], 12, -1958414417), o = f(o, s, n, r, t[10], 17, -42063), r = f(r, o, s, n, t[11], 22, -1990404162), n = f(n, r, o, s, t[12], 7, 1804603682), s = f(s, n, r, o, t[13], 12, -40341101), o = f(o, s, n, r, t[14], 17, -1502002290), r = f(r, o, s, n, t[15], 22, 1236535329), n = l(n, r, o, s, t[1], 5, -165796510), s = l(s, n, r, o, t[6], 9, -1069501632), o = l(o, s, n, r, t[11], 14, 643717713), r = l(r, o, s, n, t[0], 20, -373897302), n = l(n, r, o, s, t[5], 5, -701558691), s = l(s, n, r, o, t[10], 9, 38016083), o = l(o, s, n, r, t[15], 14, -660478335), r = l(r, o, s, n, t[4], 20, -405537848), n = l(n, r, o, s, t[9], 5, 568446438), s = l(s, n, r, o, t[14], 9, -1019803690), o = l(o, s, n, r, t[3], 14, -187363961), r = l(r, o, s, n, t[8], 20, 1163531501), n = l(n, r, o, s, t[13], 5, -1444681467), s = l(s, n, r, o, t[2], 9, -51403784), o = l(o, s, n, r, t[7], 14, 1735328473), r = l(r, o, s, n, t[12], 20, -1926607734), n = h(n, r, o, s, t[5], 4, -378558), s = h(s, n, r, o, t[8], 11, -2022574463), o = h(o, s, n, r, t[11], 16, 1839030562), r = h(r, o, s, n, t[14], 23, -35309556), n = h(n, r, o, s, t[1], 4, -1530992060), s = h(s, n, r, o, t[4], 11, 1272893353), o = h(o, s, n, r, t[7], 16, -155497632), r = h(r, o, s, n, t[10], 23, -1094730640), n = h(n, r, o, s, t[13], 4, 681279174), s = h(s, n, r, o, t[0], 11, -358537222), o = h(o, s, n, r, t[3], 16, -722521979), r = h(r, o, s, n, t[6], 23, 76029189), n = h(n, r, o, s, t[9], 4, -640364487), s = h(s, n, r, o, t[12], 11, -421815835), o = h(o, s, n, r, t[15], 16, 530742520), r = h(r, o, s, n, t[2], 23, -995338651), n = d(n, r, o, s, t[0], 6, -198630844), s = d(s, n, r, o, t[7], 10, 1126891415), o = d(o, s, n, r, t[14], 15, -1416354905), r = d(r, o, s, n, t[5], 21, -57434055), n = d(n, r, o, s, t[12], 6, 1700485571), s = d(s, n, r, o, t[3], 10, -1894986606), o = d(o, s, n, r, t[10], 15, -1051523), r = d(r, o, s, n, t[1], 21, -2054922799), n = d(n, r, o, s, t[8], 6, 1873313359), s = d(s, n, r, o, t[15], 10, -30611744), o = d(o, s, n, r, t[6], 15, -1560198380), r = d(r, o, s, n, t[13], 21, 1309151649), n = d(n, r, o, s, t[4], 6, -145523070), s = d(s, n, r, o, t[11], 10, -1120210379), o = d(o, s, n, r, t[2], 15, 718787259), r = d(r, o, s, n, t[9], 21, -343485551), e[0] = w(n, e[0]), e[1] = w(r, e[1]), e[2] = w(o, e[2]), e[3] = w(s, e[3]);
788
- }
789
- function M(e, t, n, r, o, s) {
790
- return t = w(w(t, e), w(r, s)), w(t << o | t >>> 32 - o, n);
791
- }
792
- function f(e, t, n, r, o, s, i) {
793
- return M(t & n | ~t & r, e, t, o, s, i);
794
- }
795
- function l(e, t, n, r, o, s, i) {
796
- return M(t & r | n & ~r, e, t, o, s, i);
797
- }
798
- function h(e, t, n, r, o, s, i) {
799
- return M(t ^ n ^ r, e, t, o, s, i);
800
- }
801
- function d(e, t, n, r, o, s, i) {
802
- return M(n ^ (t | ~r), e, t, o, s, i);
803
- }
804
- function Wt(e) {
805
- const t = e.length, n = [1732584193, -271733879, -1732584194, 271733878];
806
- let r;
807
- for (r = 64; r <= e.length; r += 64)
808
- S(n, Ft(e.substring(r - 64, r)));
809
- e = e.substring(r - 64);
810
- const o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
811
- for (r = 0; r < e.length; r++) o[r >> 2] |= e.charCodeAt(r) << (r % 4 << 3);
812
- if (o[r >> 2] |= 128 << (r % 4 << 3), r > 55)
813
- for (S(n, o), r = 0; r < 16; r++) o[r] = 0;
814
- return o[14] = t * 8, S(n, o), n;
815
- }
816
- function Ft(e) {
817
- let t;
818
- const n = [];
819
- for (t = 0; t < 64; t += 4)
820
- n[t >> 2] = e.charCodeAt(t) + (e.charCodeAt(t + 1) << 8) + (e.charCodeAt(t + 2) << 16) + (e.charCodeAt(t + 3) << 24);
821
- return n;
822
- }
823
- const B = "0123456789abcdef".split("");
824
- function Ut(e) {
825
- let t = "", n = 0;
826
- for (; n < 4; n++) t += B[e >> n * 8 + 4 & 15] + B[e >> n * 8 & 15];
827
- return t;
828
- }
829
- function $t(e) {
830
- for (let t = 0; t < e.length; t++) e[t] = Ut(e[t]);
831
- return e.join("");
832
- }
833
- function w(e, t) {
834
- return e + t & 4294967295;
835
- }
836
- function Kt(e) {
837
- return $t(Wt(e));
838
- }
839
- function Z(e) {
840
- const t = e;
841
- return (t ^ Math.random() * 16 >> t / 4).toString(16);
842
- }
843
- function bn(e = 9) {
844
- return (10 ** (e - 1)).toString().replace(/[01]/g, Z);
845
- }
846
- function wn() {
847
- return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, Z);
848
- }
849
- function Vt(e = {}) {
850
- const t = typeof e == "number" ? e : (e.milliseconds || e.ms || 0) + (e.seconds || 0) * 1e3;
851
- return new Promise((n) => setTimeout(n, t));
852
- }
853
- function jn() {
854
- return new Promise((e) => requestAnimationFrame(() => e()));
855
- }
856
- function Pn(e, t) {
857
- let n;
858
- const r = (...o) => {
859
- r.cancel(), n = setTimeout(() => e(...o), t);
860
- };
861
- return r.cancel = () => clearTimeout(n), r;
862
- }
863
- async function _n() {
864
- await new Promise(() => {
865
- });
866
- }
867
- function vn(e) {
868
- if (typeof e != "string") return !1;
869
- const t = new Date(e);
870
- return !isNaN(t.getTime());
871
- }
872
- function z(e, t = !1) {
873
- return typeof e > "u" ? z(Date.now(), t) : typeof e == "number" ? (e = e / 1e3, t ? Math.round(e) : e) : z(e.getTime(), t);
874
- }
875
- async function X(e) {
876
- for (; location.href !== e; )
877
- await Vt({ ms: 1 });
878
- }
879
- function In(e) {
880
- return Bt()[e];
881
- }
882
- function Bt() {
883
- const e = new URL(location.href), t = {};
884
- return e.searchParams.forEach((n, r) => t[r] = n), t;
885
- }
886
- function Tn(e) {
887
- return new URL(location.href).searchParams.has(e);
888
- }
889
- async function An(e) {
890
- const t = Object.entries(e).reduce((n, [r, o]) => (o ? n.searchParams.set(r, o) : n.searchParams.delete(r), n), new URL(location.href));
891
- history.pushState(null, document.title, t.href), await X(t.href);
892
- }
893
- async function En(e) {
894
- const t = e.reduce((n, r) => (n.searchParams.delete(r), n), new URL(location.href));
895
- history.pushState(null, document.title, t.href), await X(t.href);
896
- }
897
- function Mn(e, t, n) {
898
- return Math.max(Math.min(e, n), t);
899
- }
900
- function On(e, t = 0) {
901
- const n = 10 ** t;
902
- return Math.round(e * n) / n;
903
- }
904
- const zt = Object.getPrototypeOf(Object);
905
- function Ht(e, t) {
906
- class n extends e {
907
- constructor(...o) {
908
- super(...o);
909
- for (const s of t) {
910
- const i = new s(...o);
911
- Object.assign(this, i);
912
- }
913
- return this;
914
- }
915
- }
916
- return a(n, "__mixins", t), Jt(n, t), n;
917
- }
918
- function Gt(e, t) {
919
- if (t === Object) return;
920
- let n = t;
921
- do {
922
- const r = H(Object.getOwnPropertyDescriptors(n.prototype), [
923
- "constructor"
924
- ]);
925
- for (const [o, s] of Object.entries(r))
926
- Object.defineProperty(e.prototype, o, s);
927
- n = Object.getPrototypeOf(n);
928
- } while (n !== zt);
929
- }
930
- function Jt(e, t = []) {
931
- for (const n of t)
932
- Gt(e, n);
933
- }
934
- function Qt(e, t = []) {
935
- const n = Array.isArray(e) ? Object : e, r = Array.isArray(e) ? e : t;
936
- return Ht(n, r);
937
- }
938
- function Rn(...e) {
939
- return Qt(...e);
940
- }
941
- function Cn(e, t) {
942
- var n, r;
943
- return ((e == null ? void 0 : e.__mixins) ?? ((r = (n = e == null ? void 0 : e.__proto__) == null ? void 0 : n.constructor) == null ? void 0 : r.__mixins) ?? []).includes(t);
944
- }
945
- function Sn(e) {
946
- return Math.floor(e.status / 100) === 2;
947
- }
948
- async function Ln(e, t) {
949
- for (const n of e) {
950
- const r = await t(n);
951
- if (r)
952
- return r;
953
- }
954
- return null;
955
- }
956
- function xn(e) {
957
- return "then" in e;
958
- }
959
- function Nn(e, t = null) {
960
- return typeof e != "function" ? e.catch(() => t) : async (...n) => {
961
- try {
962
- return await e(...n);
963
- } catch {
964
- return t ?? null;
965
- }
966
- };
967
- }
968
- function qn(e) {
969
- var t;
970
- return ((t = e[0]) == null ? void 0 : t.toUpperCase()) + e.slice(1);
971
- }
972
- function Dn(e, t = 300, n = "...") {
973
- return e.length < t ? e : e.substring(0, t - n.length) + n;
974
- }
975
- function Wn(e, t) {
976
- return e.match(t);
977
- }
978
- function Fn(e, t) {
979
- return e.matchAll(t);
980
- }
981
- function Zt(e) {
982
- return e.split("").reverse().join("");
983
- }
984
- function W(e) {
985
- return e.split(/_|-|\s|(?=[A-Z])/);
986
- }
987
- function Xt(e) {
988
- const [t, ...n] = W(e);
989
- return (t ?? "").toLowerCase() + n.map((r) => r.slice(0, 1).toUpperCase() + r.slice(1).toLowerCase()).join("");
990
- }
991
- function Yt(e, t = "-") {
992
- return e = e.normalize("NFD").replace(/[֊־᐀‐‑‒–—―⸗⸚⸺⸻~〜〰゠︱︲﹘﹣-(){}><[\]]/g, " ").replace(/[\u0300-\u036f]/g, "").replace(/[\u3000-\u303f]/g, "").replace(/['".,#!$%/\\^&*;:=`@+?]/g, "").toLowerCase().trim().replace(/\s+/g, t), t.length > 0 && (e = e.replace(new RegExp(`${t}+`, "g"), t)), e;
993
- }
994
- function kt(e) {
995
- return W(e).map((n) => n.slice(0, 1).toUpperCase() + n.slice(1).toLowerCase()).join("");
996
- }
997
- function te(e) {
998
- return W(e).map((n) => n.slice(0, 1).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
999
- }
1000
- function Un(e) {
1001
- return e.trim();
1002
- }
1003
- function $n(e) {
1004
- return Y(e) ?? p(`Failed getting parent directory from '${e}'`);
1005
- }
1006
- function Kn(e) {
1007
- return ne(e) ?? p(`Failed getting directory name from '${e}'`);
1008
- }
1009
- function Vn(e) {
1010
- return k(e) ?? p(`Failed parsing url from '${e}'`);
1011
- }
1012
- function ee(...e) {
1013
- let t = e.shift();
1014
- for (; e.length > 0; ) {
1015
- const n = e.shift();
1016
- n.startsWith("/") ? t = F(t) + n : n.match(/^[\w-]+:\/\//) ? t = n : t.endsWith("/") ? t += n : t += "/" + n;
1017
- }
1018
- return t;
1019
- }
1020
- function Bn(...e) {
1021
- const t = ee(...e);
1022
- return t.endsWith("/") ? t : t + "/";
1023
- }
1024
- function F(e) {
1025
- const t = e.indexOf("://") + 3, n = e.substr(t).indexOf("/");
1026
- return n !== -1 ? e.substring(0, t + n) : e;
1027
- }
1028
- function Y(e) {
1029
- if (e.endsWith("/") && (e = e.substring(0, e.length - 1)), F(e) === e) return null;
1030
- const t = e.lastIndexOf("/");
1031
- return t !== -1 ? e.substr(0, t + 1) : null;
1032
- }
1033
- function ne(e) {
1034
- e.endsWith("/") || (e = Y(e) ?? e + "/");
1035
- const t = e.slice(0, -1);
1036
- return F(e) === t ? null : re(t);
1037
- }
1038
- function re(e) {
1039
- const t = e.lastIndexOf("/");
1040
- return (t !== -1 ? e.slice(t + 1) : "").replace(/#.*$/, "").replace(/\?.*$/, "");
1041
- }
1042
- function k(e) {
1043
- const t = e.trim().match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/);
1044
- if (!t) return null;
1045
- const n = t[4] || "", [r, o] = n.indexOf(":") === -1 ? [n] : n.split(":");
1046
- return {
1047
- protocol: t[2] || void 0,
1048
- domain: r || void 0,
1049
- port: o || void 0,
1050
- path: t[5] || void 0,
1051
- query: t[7] || void 0,
1052
- fragment: t[9] || void 0
1053
- };
1054
- }
1055
- function oe(e, t) {
1056
- const n = k(e);
1057
- if (!n) return e;
1058
- for (const [r, o] of Object.entries(n))
1059
- n[r] = t[r] !== !1 && o || "";
1060
- return [
1061
- n.protocol ? `${n.protocol}://` : "",
1062
- n.domain ?? "",
1063
- n.port ? `:${n.port}` : "",
1064
- n.path ?? "",
1065
- n.query ? `?${n.query}` : "",
1066
- n.fragment ? `#${n.fragment}` : ""
1067
- ].join("");
1068
- }
1069
- function zn(e) {
1070
- return oe(e, {
1071
- protocol: !0,
1072
- domain: !0,
1073
- port: !0,
1074
- path: !0,
1075
- query: !1,
1076
- fragment: !1
1077
- });
1078
- }
1079
- function Hn(e) {
1080
- try {
1081
- return new URL(e.trim()).toString();
1082
- } catch {
1083
- return null;
1084
- }
1085
- }
1086
- function tt(e, t) {
1087
- const n = e.prototype;
1088
- for (const [r, o] of Object.entries(t))
1089
- n[r] = function(...s) {
1090
- var c;
1091
- const i = o(this.value, ...s);
1092
- return (c = this.chain) == null ? void 0 : c.call(this, i);
1093
- };
1094
- }
1095
- function et(e, t) {
1096
- const n = e.prototype, r = Object.getOwnPropertyDescriptors(t.prototype);
1097
- for (const [o, s] of Object.entries(r))
1098
- if (!(o in n)) {
1099
- if (typeof s.value != "function") {
1100
- Object.defineProperty(n, o, {
1101
- get() {
1102
- return this.chain(this.value[o]);
1103
- }
1104
- });
1105
- continue;
1106
- }
1107
- n[o] = function(...i) {
1108
- var u;
1109
- const c = s.value.call(this.value, ...i);
1110
- return (u = this.chain) == null ? void 0 : u.call(this, c);
1111
- };
1112
- }
1113
- }
1114
- class nt {
1115
- constructor(t) {
1116
- this.value = t;
1117
- }
1118
- static isPrimitive(t) {
1119
- return this.prototype.isPrimitive(t);
1120
- }
1121
- create(t) {
1122
- const n = this.constructor;
1123
- return new n(t);
1124
- }
1125
- chain(t) {
1126
- return this.isPrimitive(t) ? this.create(t) : t;
1127
- }
1128
- }
1129
- const se = {
1130
- clear: jt,
1131
- diff: Pt,
1132
- filter: G,
1133
- first: _t,
1134
- flatMap: vt,
1135
- groupBy: It,
1136
- isEmpty: Tt,
1137
- project: At,
1138
- randomItem: Mt,
1139
- randomItems: Ot,
1140
- remove: v,
1141
- removeIndex: Rt,
1142
- replace: Ct,
1143
- sorted: St,
1144
- unique: Lt,
1145
- where: xt,
1146
- without: Nt,
1147
- withoutIndexes: J
1148
- };
1149
- class O extends nt {
1150
- static create(t = []) {
1151
- const { prototype: n } = this;
1152
- return n.create(t);
1153
- }
1154
- *[Symbol.iterator]() {
1155
- yield* this.value;
1156
- }
1157
- get(t) {
1158
- return this.value[t];
1159
- }
1160
- toArray() {
1161
- return this.value.slice(0);
1162
- }
1163
- isPrimitive(t) {
1164
- return Array.isArray(t);
1165
- }
1166
- }
1167
- tt(O, se);
1168
- et(O, Array);
1169
- const ie = {
1170
- reverse: Zt,
1171
- toCamelCase: Xt,
1172
- toSlug: Yt,
1173
- toStudlyCase: kt,
1174
- toTitleCase: te
1175
- };
1176
- class R extends nt {
1177
- static create(t = "") {
1178
- const { prototype: n } = this;
1179
- return n.create(t);
1180
- }
1181
- toString() {
1182
- return this.value;
1183
- }
1184
- isPrimitive(t) {
1185
- return typeof t == "string";
1186
- }
1187
- }
1188
- tt(R, ie);
1189
- et(R, String);
1190
- const rt = [];
1191
- function Gn(e) {
1192
- let t = null;
1193
- function n() {
1194
- try {
1195
- return e();
1196
- } catch {
1197
- return new e();
1198
- }
1199
- }
1200
- function r(s) {
1201
- return t = s, s;
1202
- }
1203
- const o = {
1204
- setInstance: r,
1205
- newInstance: n,
1206
- requireInstance: () => t ?? r(n()),
1207
- reset: () => r(n())
1208
- };
1209
- return rt.forEach((s) => s(o)), new Proxy(o, {
1210
- get: (s, i, c) => {
1211
- const u = i !== "constructor" && i in o ? o : o.requireInstance();
1212
- return Reflect.get(u, i, c);
1213
- },
1214
- set: (s, i, c) => Reflect.set(o.requireInstance(), i, c)
1215
- });
1216
- }
1217
- function Jn(e) {
1218
- rt.push(e);
1219
- }
1220
- function ce(e) {
1221
- return typeof e == "object" && e !== null && "requireInstance" in e;
1222
- }
1223
- function Qn(e) {
1224
- return ce(e) ? e.requireInstance() : e;
1225
- }
1226
- function ue(e) {
1227
- const t = new Proxy(e, {
1228
- get(n, r, o) {
1229
- const s = Reflect.get(n, r, o);
1230
- return typeof s != "function" ? s : (...i) => (s.call(n, ...i), t);
1231
- }
1232
- });
1233
- return t;
1234
- }
1235
- function Zn(e, t) {
1236
- if (!t) return ue(e);
1237
- const n = t(e);
1238
- return n instanceof Promise ? n.then(() => e) : e;
1239
- }
1240
- function Xn() {
1241
- }
1242
- class ae {
1243
- constructor(t, n) {
1244
- this.errorMessage = t, this.getValue = n;
1245
- }
1246
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1247
- get(t, n, r) {
1248
- const o = this.getValue() ?? p(this.errorMessage), s = Reflect.get(o, n, r);
1249
- return typeof s == "function" ? s.bind(o) : s;
1250
- }
1251
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1252
- set(t, n, r, o) {
1253
- const s = this.getValue() ?? p(this.errorMessage);
1254
- return Reflect.set(s, n, r, o);
1255
- }
1256
- getPrototypeOf() {
1257
- const t = this.getValue() ?? p(this.errorMessage);
1258
- return Object.getPrototypeOf(t);
1259
- }
1260
- }
1261
- function Yn(e, t) {
1262
- return t ?? (t = "Required value is missing"), typeof e == "function" ? new Proxy({}, new ae(t, e)) : e ?? p(t);
1263
- }
1264
- function kn(e) {
1265
- return typeof e == "function" ? e() : e;
1266
- }
1267
- function tr(e, t) {
1268
- const n = typeof t == "function" ? t(e) : !!t;
1269
- return new Proxy(e, {
1270
- get(r, o, s) {
1271
- return n ? Reflect.get(r, o, s) : () => {
1272
- };
1273
- }
1274
- });
1275
- }
1276
- function er(e, t) {
1277
- return e;
1278
- }
1279
- const fe = [O, R];
1280
- function nr(e = "") {
1281
- return R.create(e);
1282
- }
1283
- function le(e = []) {
1284
- return O.create(q(e));
1285
- }
1286
- function rr(e = [], t) {
1287
- if (!Array.isArray(e) || typeof e[0] != "string") return D.createFromArray(e, t);
1288
- const n = t;
1289
- return e.reduce(
1290
- (r, o) => (r[o] = n(o), r),
1291
- {}
1292
- );
1293
- }
1294
- function or(e, t) {
1295
- return Array.isArray(e) ? Et(e, t) : wt(e, t);
1296
- }
1297
- function sr(e) {
1298
- const t = le(fe).first((n) => n.isPrimitive(e));
1299
- return t ? t.create(e) : null;
1300
- }
1301
- const ir = Symbol("__brand");
1302
- export {
1303
- O as FluentArrayDefinition,
1304
- nt as FluentObjectDefinition,
1305
- R as FluentStringDefinition,
1306
- me as IndexedDBMap,
1307
- ge as JSError,
1308
- Ve as ListenersManager,
1309
- K as MagicObject,
1310
- D as ObjectsMap,
1311
- A as PromisedValue,
1312
- ft as RuntimeErrorClass,
1313
- Be as Semaphore,
1314
- ze as Storage,
1315
- L as StorageSingleton,
1316
- ir as __brand,
1317
- Vt as after,
1318
- jn as afterAnimationFrame,
1319
- Jt as applyMixins,
1320
- hn as applyStrictChecks,
1321
- le as arr,
1322
- qe as arrayChunk,
1323
- jt as arrayClear,
1324
- Pt as arrayDiff,
1325
- De as arrayEquals,
1326
- G as arrayFilter,
1327
- Ue as arrayFind,
1328
- _t as arrayFirst,
1329
- vt as arrayFlatMap,
1330
- q as arrayFrom,
1331
- It as arrayGroupBy,
1332
- Tt as arrayIsEmpty,
1333
- At as arrayProject,
1334
- Et as arrayPull,
1335
- Mt as arrayRandomItem,
1336
- Ot as arrayRandomItems,
1337
- v as arrayRemove,
1338
- Rt as arrayRemoveIndex,
1339
- Ct as arrayReplace,
1340
- St as arraySorted,
1341
- Fe as arraySwap,
1342
- Lt as arrayUnique,
1343
- xt as arrayWhere,
1344
- We as arrayWithItemAt,
1345
- Nt as arrayWithout,
1346
- qt as arrayWithoutIndex,
1347
- J as arrayWithoutIndexes,
1348
- $e as arrayZip,
1349
- ye as assert,
1350
- Ln as asyncFirst,
1351
- Ge as asyncMemo,
1352
- pe as catchError,
1353
- Mn as clamp,
1354
- C as compare,
1355
- Pn as debounce,
1356
- $ as deepAssign,
1357
- ht as deepEquals,
1358
- I as deepGet,
1359
- be as deepSet,
1360
- En as deleteLocationQueryParameters,
1361
- pn as downloadFile,
1362
- dn as escapeHtmlEntities,
1363
- yn as escapeRegexText,
1364
- ut as evaluate,
1365
- Jn as extendFacadeMethods,
1366
- Gn as facade,
1367
- p as fail,
1368
- sr as fluent,
1369
- ie as fluentStringHelpers,
1370
- un as forceEnv,
1371
- _n as forever,
1372
- mn as formatCodeBlock,
1373
- Xe as getAsyncMemo,
1374
- we as getClassMethods,
1375
- E as getEnv,
1376
- Qn as getFacadeInstance,
1377
- In as getLocationQueryParameter,
1378
- Bt as getLocationQueryParameters,
1379
- Ye as getMemo,
1380
- ke as getWeakMemo,
1381
- Tn as hasLocationQueryParameter,
1382
- er as invade,
1383
- je as invert,
1384
- Pe as isArray,
1385
- _e as isConstructor,
1386
- an as isDevelopment,
1387
- ve as isEmpty,
1388
- ce as isFacade,
1389
- Ie as isInstanceOf,
1390
- dt as isIterable,
1391
- Ae as isNullable,
1392
- m as isObject,
1393
- Te as isPlainObject,
1394
- ln as isProduction,
1395
- xn as isPromise,
1396
- yt as isString,
1397
- Sn as isSuccessfulResponse,
1398
- fn as isTesting,
1399
- vn as isValidDateString,
1400
- rr as map,
1401
- gn as md5,
1402
- Je as memo,
1403
- Qt as mixed,
1404
- Rn as mixedWithoutTypes,
1405
- Ee as monkeyPatch,
1406
- Xn as noop,
1407
- pt as objectDeepClone,
1408
- Me as objectEntries,
1409
- Oe as objectFromEntries,
1410
- gt as objectHasOwnProperty,
1411
- mt as objectKeys,
1412
- Ce as objectMap,
1413
- Se as objectOnly,
1414
- bt as objectPropertyIsObject,
1415
- wt as objectPull,
1416
- Re as objectValues,
1417
- H as objectWithout,
1418
- Le as objectWithoutEmpty,
1419
- Qe as once,
1420
- xe as overridePrototypeMethod,
1421
- He as parseBoolean,
1422
- cn as parseDate,
1423
- or as pull,
1424
- sn as randomInt,
1425
- Ke as range,
1426
- Kn as requireUrlDirectoryName,
1427
- $n as requireUrlParentDirectory,
1428
- Vn as requireUrlParse,
1429
- Yn as required,
1430
- tn as resetAsyncMemo,
1431
- en as resetMemo,
1432
- nn as resetWeakMemo,
1433
- On as round,
1434
- at as runtimeGlobal,
1435
- z as seconds,
1436
- rn as setAsyncMemo,
1437
- on as setMemo,
1438
- Dt as setWeakMemo,
1439
- bn as shortId,
1440
- Nn as silenced,
1441
- nr as str,
1442
- qn as stringCapitalize,
1443
- Dn as stringExcerpt,
1444
- Wn as stringMatch,
1445
- Fn as stringMatchAll,
1446
- Zt as stringReverse,
1447
- W as stringSplitWords,
1448
- Xt as stringToCamelCase,
1449
- Yt as stringToSlug,
1450
- kt as stringToStudlyCase,
1451
- te as stringToTitleCase,
1452
- Un as stringTrimmed,
1453
- Zn as tap,
1454
- Ne as toError,
1455
- N as toString,
1456
- An as updateLocationQueryParameters,
1457
- oe as urlClean,
1458
- ne as urlDirectoryName,
1459
- re as urlFileName,
1460
- Y as urlParentDirectory,
1461
- k as urlParse,
1462
- ee as urlResolve,
1463
- Bn as urlResolveDirectory,
1464
- F as urlRoot,
1465
- zn as urlRoute,
1466
- Cn as usesMixin,
1467
- wn as uuid,
1468
- Hn as validUrl,
1469
- kn as value,
1470
- Ze as weakMemo,
1471
- tr as when
1472
- };
1473
- //# sourceMappingURL=noeldemartin-utils.js.map