@bigbinary/neeto-payments-frontend 1.6.0-beta2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/AccountsDashboard.js +8 -10
  2. package/dist/AccountsDashboard.js.map +1 -1
  3. package/dist/Dashboard.js +11 -11
  4. package/dist/{ExportModal-85725c35.js → ExportModal-48434e79.js} +8 -8
  5. package/dist/{ExportModal-85725c35.js.map → ExportModal-48434e79.js.map} +1 -1
  6. package/dist/PayoutsDashboard.js +10 -12
  7. package/dist/PayoutsDashboard.js.map +1 -1
  8. package/dist/PayoutsPage.js +11 -11
  9. package/dist/RazorpayDashboard.js +9 -11
  10. package/dist/RazorpayDashboard.js.map +1 -1
  11. package/dist/RazorpayPaymentButton.js +6 -9
  12. package/dist/RazorpayPaymentButton.js.map +1 -1
  13. package/dist/StripeConnect.js +5 -6
  14. package/dist/StripeConnect.js.map +1 -1
  15. package/dist/UpiMarkAsPaidButton.js +4 -7
  16. package/dist/UpiMarkAsPaidButton.js.map +1 -1
  17. package/dist/UpiPayment.js +2 -5
  18. package/dist/UpiPayment.js.map +1 -1
  19. package/dist/V2PaymentsDashboard.js +5 -6
  20. package/dist/V2PaymentsDashboard.js.map +1 -1
  21. package/dist/cjs/AccountsDashboard.js +11 -12
  22. package/dist/cjs/AccountsDashboard.js.map +1 -1
  23. package/dist/cjs/Dashboard.js +15 -13
  24. package/dist/cjs/Dashboard.js.map +1 -1
  25. package/dist/cjs/{ExportModal-20f368a1.js → ExportModal-edfd3a7f.js} +11 -10
  26. package/dist/cjs/{ExportModal-20f368a1.js.map → ExportModal-edfd3a7f.js.map} +1 -1
  27. package/dist/cjs/PayoutsDashboard.js +12 -13
  28. package/dist/cjs/PayoutsDashboard.js.map +1 -1
  29. package/dist/cjs/PayoutsPage.js +11 -11
  30. package/dist/cjs/RazorpayDashboard.js +10 -12
  31. package/dist/cjs/RazorpayDashboard.js.map +1 -1
  32. package/dist/cjs/RazorpayPaymentButton.js +6 -9
  33. package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
  34. package/dist/cjs/StripeConnect.js +6 -7
  35. package/dist/cjs/StripeConnect.js.map +1 -1
  36. package/dist/cjs/UpiMarkAsPaidButton.js +4 -7
  37. package/dist/cjs/UpiMarkAsPaidButton.js.map +1 -1
  38. package/dist/cjs/UpiPayment.js +2 -5
  39. package/dist/cjs/UpiPayment.js.map +1 -1
  40. package/dist/cjs/V2PaymentsDashboard.js +6 -7
  41. package/dist/cjs/V2PaymentsDashboard.js.map +1 -1
  42. package/dist/cjs/{exportChannel-7bd80952.js → exportChannel-9ac7cd08.js} +3 -3
  43. package/dist/cjs/{exportChannel-7bd80952.js.map → exportChannel-9ac7cd08.js.map} +1 -1
  44. package/dist/cjs/index.js +14 -14
  45. package/dist/cjs/queryConstants-45f84f3e.js +23 -0
  46. package/dist/cjs/queryConstants-45f84f3e.js.map +1 -0
  47. package/dist/cjs/renderFunctions-ec0f0a22.js +167 -0
  48. package/dist/cjs/renderFunctions-ec0f0a22.js.map +1 -0
  49. package/dist/cjs/{useConnectApi-f0665633.js → useConnectApi-c4afdf7d.js} +9 -8
  50. package/dist/cjs/useConnectApi-c4afdf7d.js.map +1 -0
  51. package/dist/cjs/{useFiltersAndPagination-312c0331.js → useFiltersAndPagination-0a176991.js} +2 -2
  52. package/dist/cjs/{useFiltersAndPagination-312c0331.js.map → useFiltersAndPagination-0a176991.js.map} +1 -1
  53. package/dist/cjs/{usePaymentApi-ae70e5df.js → usePaymentApi-7e79121a.js} +5 -5
  54. package/dist/cjs/{usePaymentApi-ae70e5df.js.map → usePaymentApi-7e79121a.js.map} +1 -1
  55. package/dist/cjs/{usePaymentsApi-815be3da.js → usePaymentsApi-74c8e44e.js} +4 -4
  56. package/dist/cjs/{usePaymentsApi-815be3da.js.map → usePaymentsApi-74c8e44e.js.map} +1 -1
  57. package/dist/cjs/{usePlatformApi-830827fa.js → usePlatformApi-cbedf69d.js} +11 -10
  58. package/dist/cjs/{usePlatformApi-830827fa.js.map → usePlatformApi-cbedf69d.js.map} +1 -1
  59. package/dist/cjs/useRazorpayPayment.js +3 -7
  60. package/dist/cjs/useRazorpayPayment.js.map +1 -1
  61. package/dist/{exportChannel-250e6f14.js → exportChannel-d0b7ed09.js} +2 -2
  62. package/dist/{exportChannel-250e6f14.js.map → exportChannel-d0b7ed09.js.map} +1 -1
  63. package/dist/index.js +14 -14
  64. package/dist/queryConstants-7d91832f.js +21 -0
  65. package/dist/queryConstants-7d91832f.js.map +1 -0
  66. package/dist/renderFunctions-058c9e2b.js +147 -0
  67. package/dist/renderFunctions-058c9e2b.js.map +1 -0
  68. package/dist/{useConnectApi-87335bf6.js → useConnectApi-4009b9b5.js} +3 -2
  69. package/dist/useConnectApi-4009b9b5.js.map +1 -0
  70. package/dist/{useFiltersAndPagination-2ab7bc8f.js → useFiltersAndPagination-bc8bad69.js} +2 -2
  71. package/dist/{useFiltersAndPagination-2ab7bc8f.js.map → useFiltersAndPagination-bc8bad69.js.map} +1 -1
  72. package/dist/{usePaymentApi-12737871.js → usePaymentApi-9876df31.js} +3 -3
  73. package/dist/{usePaymentApi-12737871.js.map → usePaymentApi-9876df31.js.map} +1 -1
  74. package/dist/{usePaymentsApi-a801ab15.js → usePaymentsApi-f3be0081.js} +2 -2
  75. package/dist/{usePaymentsApi-a801ab15.js.map → usePaymentsApi-f3be0081.js.map} +1 -1
  76. package/dist/{usePlatformApi-8adc2a50.js → usePlatformApi-b6664fae.js} +4 -3
  77. package/dist/{usePlatformApi-8adc2a50.js.map → usePlatformApi-b6664fae.js.map} +1 -1
  78. package/dist/useRazorpayPayment.js +3 -7
  79. package/dist/useRazorpayPayment.js.map +1 -1
  80. package/package.json +12 -10
  81. package/dist/U2TDTBMY-c464dc98.js +0 -12081
  82. package/dist/U2TDTBMY-c464dc98.js.map +0 -1
  83. package/dist/cjs/U2TDTBMY-e2fad970.js +0 -12083
  84. package/dist/cjs/U2TDTBMY-e2fad970.js.map +0 -1
  85. package/dist/cjs/mutation-ed7b84fc.js +0 -235
  86. package/dist/cjs/mutation-ed7b84fc.js.map +0 -1
  87. package/dist/cjs/queryConstants-de21eed5.js +0 -944
  88. package/dist/cjs/queryConstants-de21eed5.js.map +0 -1
  89. package/dist/cjs/renderFunctions-398d3fb5.js +0 -3719
  90. package/dist/cjs/renderFunctions-398d3fb5.js.map +0 -1
  91. package/dist/cjs/useConnectApi-f0665633.js.map +0 -1
  92. package/dist/cjs/useMutation-4c7cdbe1.js +0 -154
  93. package/dist/cjs/useMutation-4c7cdbe1.js.map +0 -1
  94. package/dist/cjs/utils-7eba34a4.js +0 -664
  95. package/dist/cjs/utils-7eba34a4.js.map +0 -1
  96. package/dist/mutation-286611ef.js +0 -232
  97. package/dist/mutation-286611ef.js.map +0 -1
  98. package/dist/queryConstants-765c8816.js +0 -920
  99. package/dist/queryConstants-765c8816.js.map +0 -1
  100. package/dist/renderFunctions-97b121a4.js +0 -3633
  101. package/dist/renderFunctions-97b121a4.js.map +0 -1
  102. package/dist/useConnectApi-87335bf6.js.map +0 -1
  103. package/dist/useMutation-8d67f853.js +0 -132
  104. package/dist/useMutation-8d67f853.js.map +0 -1
  105. package/dist/utils-e29db9c9.js +0 -614
  106. package/dist/utils-e29db9c9.js.map +0 -1
@@ -1,3633 +0,0 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
3
- import { S as Subscribable, h as hashQueryKeyByOptions, n as notifyManager, m as matchQuery, a as matchMutation, b as noop, e as ensureQueryFn, c as addToStart, d as addToEnd, f as focusManager, o as onlineManager, g as functionalUpdate, i as hashKey, p as partialMatchKey, s as skipToken, u as useQueryClient, k as keepPreviousData, Q as QueryClientProvider } from './utils-e29db9c9.js';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
6
- import { a as Query } from './queryConstants-765c8816.js';
7
- import { M as Mutation } from './mutation-286611ef.js';
8
- import { camelToSnakeCase, isPresent, snakeToCamelCase } from '@bigbinary/neeto-cist';
9
- import { isEmpty, assoc, modify, concat, curry } from 'ramda';
10
- import { DEFAULT_PAGE_VALUES, TAG_STYLE, DEFAULT_TAG_STYLE } from './constants.js';
11
- import { t as t$1 } from 'i18next';
12
- import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
13
- import Button from '@bigbinary/neetoui/Button';
14
- import Tag from '@bigbinary/neetoui/Tag';
15
- import Tooltip from '@bigbinary/neetoui/Tooltip';
16
- import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
17
-
18
- // src/queryCache.ts
19
- var QueryCache = class extends Subscribable {
20
- constructor(config = {}) {
21
- super();
22
- this.config = config;
23
- this.#queries = /* @__PURE__ */ new Map();
24
- }
25
- #queries;
26
- build(client, options, state) {
27
- const queryKey = options.queryKey;
28
- const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
29
- let query = this.get(queryHash);
30
- if (!query) {
31
- query = new Query({
32
- cache: this,
33
- queryKey,
34
- queryHash,
35
- options: client.defaultQueryOptions(options),
36
- state,
37
- defaultOptions: client.getQueryDefaults(queryKey)
38
- });
39
- this.add(query);
40
- }
41
- return query;
42
- }
43
- add(query) {
44
- if (!this.#queries.has(query.queryHash)) {
45
- this.#queries.set(query.queryHash, query);
46
- this.notify({
47
- type: "added",
48
- query
49
- });
50
- }
51
- }
52
- remove(query) {
53
- const queryInMap = this.#queries.get(query.queryHash);
54
- if (queryInMap) {
55
- query.destroy();
56
- if (queryInMap === query) {
57
- this.#queries.delete(query.queryHash);
58
- }
59
- this.notify({ type: "removed", query });
60
- }
61
- }
62
- clear() {
63
- notifyManager.batch(() => {
64
- this.getAll().forEach((query) => {
65
- this.remove(query);
66
- });
67
- });
68
- }
69
- get(queryHash) {
70
- return this.#queries.get(queryHash);
71
- }
72
- getAll() {
73
- return [...this.#queries.values()];
74
- }
75
- find(filters) {
76
- const defaultedFilters = { exact: true, ...filters };
77
- return this.getAll().find(
78
- (query) => matchQuery(defaultedFilters, query)
79
- );
80
- }
81
- findAll(filters = {}) {
82
- const queries = this.getAll();
83
- return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
84
- }
85
- notify(event) {
86
- notifyManager.batch(() => {
87
- this.listeners.forEach((listener) => {
88
- listener(event);
89
- });
90
- });
91
- }
92
- onFocus() {
93
- notifyManager.batch(() => {
94
- this.getAll().forEach((query) => {
95
- query.onFocus();
96
- });
97
- });
98
- }
99
- onOnline() {
100
- notifyManager.batch(() => {
101
- this.getAll().forEach((query) => {
102
- query.onOnline();
103
- });
104
- });
105
- }
106
- };
107
-
108
- // src/mutationCache.ts
109
- var MutationCache = class extends Subscribable {
110
- constructor(config = {}) {
111
- super();
112
- this.config = config;
113
- this.#mutations = /* @__PURE__ */ new Map();
114
- this.#mutationId = Date.now();
115
- }
116
- #mutations;
117
- #mutationId;
118
- build(client, options, state) {
119
- const mutation = new Mutation({
120
- mutationCache: this,
121
- mutationId: ++this.#mutationId,
122
- options: client.defaultMutationOptions(options),
123
- state
124
- });
125
- this.add(mutation);
126
- return mutation;
127
- }
128
- add(mutation) {
129
- const scope = scopeFor(mutation);
130
- const mutations = this.#mutations.get(scope) ?? [];
131
- mutations.push(mutation);
132
- this.#mutations.set(scope, mutations);
133
- this.notify({ type: "added", mutation });
134
- }
135
- remove(mutation) {
136
- const scope = scopeFor(mutation);
137
- if (this.#mutations.has(scope)) {
138
- const mutations = this.#mutations.get(scope)?.filter((x) => x !== mutation);
139
- if (mutations) {
140
- if (mutations.length === 0) {
141
- this.#mutations.delete(scope);
142
- } else {
143
- this.#mutations.set(scope, mutations);
144
- }
145
- }
146
- }
147
- this.notify({ type: "removed", mutation });
148
- }
149
- canRun(mutation) {
150
- const firstPendingMutation = this.#mutations.get(scopeFor(mutation))?.find((m) => m.state.status === "pending");
151
- return !firstPendingMutation || firstPendingMutation === mutation;
152
- }
153
- runNext(mutation) {
154
- const foundMutation = this.#mutations.get(scopeFor(mutation))?.find((m) => m !== mutation && m.state.isPaused);
155
- return foundMutation?.continue() ?? Promise.resolve();
156
- }
157
- clear() {
158
- notifyManager.batch(() => {
159
- this.getAll().forEach((mutation) => {
160
- this.remove(mutation);
161
- });
162
- });
163
- }
164
- getAll() {
165
- return [...this.#mutations.values()].flat();
166
- }
167
- find(filters) {
168
- const defaultedFilters = { exact: true, ...filters };
169
- return this.getAll().find(
170
- (mutation) => matchMutation(defaultedFilters, mutation)
171
- );
172
- }
173
- findAll(filters = {}) {
174
- return this.getAll().filter((mutation) => matchMutation(filters, mutation));
175
- }
176
- notify(event) {
177
- notifyManager.batch(() => {
178
- this.listeners.forEach((listener) => {
179
- listener(event);
180
- });
181
- });
182
- }
183
- resumePausedMutations() {
184
- const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
185
- return notifyManager.batch(
186
- () => Promise.all(
187
- pausedMutations.map((mutation) => mutation.continue().catch(noop))
188
- )
189
- );
190
- }
191
- };
192
- function scopeFor(mutation) {
193
- return mutation.options.scope?.id ?? String(mutation.mutationId);
194
- }
195
-
196
- // src/infiniteQueryBehavior.ts
197
- function infiniteQueryBehavior(pages) {
198
- return {
199
- onFetch: (context, query) => {
200
- const fetchFn = async () => {
201
- const options = context.options;
202
- const direction = context.fetchOptions?.meta?.fetchMore?.direction;
203
- const oldPages = context.state.data?.pages || [];
204
- const oldPageParams = context.state.data?.pageParams || [];
205
- const empty = { pages: [], pageParams: [] };
206
- let cancelled = false;
207
- const addSignalProperty = (object) => {
208
- Object.defineProperty(object, "signal", {
209
- enumerable: true,
210
- get: () => {
211
- if (context.signal.aborted) {
212
- cancelled = true;
213
- } else {
214
- context.signal.addEventListener("abort", () => {
215
- cancelled = true;
216
- });
217
- }
218
- return context.signal;
219
- }
220
- });
221
- };
222
- const queryFn = ensureQueryFn(context.options, context.fetchOptions);
223
- const fetchPage = async (data, param, previous) => {
224
- if (cancelled) {
225
- return Promise.reject();
226
- }
227
- if (param == null && data.pages.length) {
228
- return Promise.resolve(data);
229
- }
230
- const queryFnContext = {
231
- queryKey: context.queryKey,
232
- pageParam: param,
233
- direction: previous ? "backward" : "forward",
234
- meta: context.options.meta
235
- };
236
- addSignalProperty(queryFnContext);
237
- const page = await queryFn(
238
- queryFnContext
239
- );
240
- const { maxPages } = context.options;
241
- const addTo = previous ? addToStart : addToEnd;
242
- return {
243
- pages: addTo(data.pages, page, maxPages),
244
- pageParams: addTo(data.pageParams, param, maxPages)
245
- };
246
- };
247
- let result;
248
- if (direction && oldPages.length) {
249
- const previous = direction === "backward";
250
- const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
251
- const oldData = {
252
- pages: oldPages,
253
- pageParams: oldPageParams
254
- };
255
- const param = pageParamFn(options, oldData);
256
- result = await fetchPage(oldData, param, previous);
257
- } else {
258
- result = await fetchPage(
259
- empty,
260
- oldPageParams[0] ?? options.initialPageParam
261
- );
262
- const remainingPages = pages ?? oldPages.length;
263
- for (let i = 1; i < remainingPages; i++) {
264
- const param = getNextPageParam(options, result);
265
- result = await fetchPage(result, param);
266
- }
267
- }
268
- return result;
269
- };
270
- if (context.options.persister) {
271
- context.fetchFn = () => {
272
- return context.options.persister?.(
273
- fetchFn,
274
- {
275
- queryKey: context.queryKey,
276
- meta: context.options.meta,
277
- signal: context.signal
278
- },
279
- query
280
- );
281
- };
282
- } else {
283
- context.fetchFn = fetchFn;
284
- }
285
- }
286
- };
287
- }
288
- function getNextPageParam(options, { pages, pageParams }) {
289
- const lastIndex = pages.length - 1;
290
- return options.getNextPageParam(
291
- pages[lastIndex],
292
- pages,
293
- pageParams[lastIndex],
294
- pageParams
295
- );
296
- }
297
- function getPreviousPageParam(options, { pages, pageParams }) {
298
- return options.getPreviousPageParam?.(
299
- pages[0],
300
- pages,
301
- pageParams[0],
302
- pageParams
303
- );
304
- }
305
-
306
- // src/queryClient.ts
307
- var QueryClient = class {
308
- #queryCache;
309
- #mutationCache;
310
- #defaultOptions;
311
- #queryDefaults;
312
- #mutationDefaults;
313
- #mountCount;
314
- #unsubscribeFocus;
315
- #unsubscribeOnline;
316
- constructor(config = {}) {
317
- this.#queryCache = config.queryCache || new QueryCache();
318
- this.#mutationCache = config.mutationCache || new MutationCache();
319
- this.#defaultOptions = config.defaultOptions || {};
320
- this.#queryDefaults = /* @__PURE__ */ new Map();
321
- this.#mutationDefaults = /* @__PURE__ */ new Map();
322
- this.#mountCount = 0;
323
- }
324
- mount() {
325
- this.#mountCount++;
326
- if (this.#mountCount !== 1)
327
- return;
328
- this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
329
- if (focused) {
330
- await this.resumePausedMutations();
331
- this.#queryCache.onFocus();
332
- }
333
- });
334
- this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
335
- if (online) {
336
- await this.resumePausedMutations();
337
- this.#queryCache.onOnline();
338
- }
339
- });
340
- }
341
- unmount() {
342
- this.#mountCount--;
343
- if (this.#mountCount !== 0)
344
- return;
345
- this.#unsubscribeFocus?.();
346
- this.#unsubscribeFocus = void 0;
347
- this.#unsubscribeOnline?.();
348
- this.#unsubscribeOnline = void 0;
349
- }
350
- isFetching(filters) {
351
- return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
352
- }
353
- isMutating(filters) {
354
- return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
355
- }
356
- getQueryData(queryKey) {
357
- const options = this.defaultQueryOptions({ queryKey });
358
- return this.#queryCache.get(options.queryHash)?.state.data;
359
- }
360
- ensureQueryData(options) {
361
- const cachedData = this.getQueryData(options.queryKey);
362
- if (cachedData === void 0)
363
- return this.fetchQuery(options);
364
- else {
365
- const defaultedOptions = this.defaultQueryOptions(options);
366
- const query = this.#queryCache.build(this, defaultedOptions);
367
- if (options.revalidateIfStale && query.isStaleByTime(defaultedOptions.staleTime)) {
368
- void this.prefetchQuery(defaultedOptions);
369
- }
370
- return Promise.resolve(cachedData);
371
- }
372
- }
373
- getQueriesData(filters) {
374
- return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
375
- const data = state.data;
376
- return [queryKey, data];
377
- });
378
- }
379
- setQueryData(queryKey, updater, options) {
380
- const defaultedOptions = this.defaultQueryOptions({ queryKey });
381
- const query = this.#queryCache.get(
382
- defaultedOptions.queryHash
383
- );
384
- const prevData = query?.state.data;
385
- const data = functionalUpdate(updater, prevData);
386
- if (data === void 0) {
387
- return void 0;
388
- }
389
- return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
390
- }
391
- setQueriesData(filters, updater, options) {
392
- return notifyManager.batch(
393
- () => this.#queryCache.findAll(filters).map(({ queryKey }) => [
394
- queryKey,
395
- this.setQueryData(queryKey, updater, options)
396
- ])
397
- );
398
- }
399
- getQueryState(queryKey) {
400
- const options = this.defaultQueryOptions({ queryKey });
401
- return this.#queryCache.get(options.queryHash)?.state;
402
- }
403
- removeQueries(filters) {
404
- const queryCache = this.#queryCache;
405
- notifyManager.batch(() => {
406
- queryCache.findAll(filters).forEach((query) => {
407
- queryCache.remove(query);
408
- });
409
- });
410
- }
411
- resetQueries(filters, options) {
412
- const queryCache = this.#queryCache;
413
- const refetchFilters = {
414
- type: "active",
415
- ...filters
416
- };
417
- return notifyManager.batch(() => {
418
- queryCache.findAll(filters).forEach((query) => {
419
- query.reset();
420
- });
421
- return this.refetchQueries(refetchFilters, options);
422
- });
423
- }
424
- cancelQueries(filters = {}, cancelOptions = {}) {
425
- const defaultedCancelOptions = { revert: true, ...cancelOptions };
426
- const promises = notifyManager.batch(
427
- () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
428
- );
429
- return Promise.all(promises).then(noop).catch(noop);
430
- }
431
- invalidateQueries(filters = {}, options = {}) {
432
- return notifyManager.batch(() => {
433
- this.#queryCache.findAll(filters).forEach((query) => {
434
- query.invalidate();
435
- });
436
- if (filters.refetchType === "none") {
437
- return Promise.resolve();
438
- }
439
- const refetchFilters = {
440
- ...filters,
441
- type: filters.refetchType ?? filters.type ?? "active"
442
- };
443
- return this.refetchQueries(refetchFilters, options);
444
- });
445
- }
446
- refetchQueries(filters = {}, options) {
447
- const fetchOptions = {
448
- ...options,
449
- cancelRefetch: options?.cancelRefetch ?? true
450
- };
451
- const promises = notifyManager.batch(
452
- () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => {
453
- let promise = query.fetch(void 0, fetchOptions);
454
- if (!fetchOptions.throwOnError) {
455
- promise = promise.catch(noop);
456
- }
457
- return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
458
- })
459
- );
460
- return Promise.all(promises).then(noop);
461
- }
462
- fetchQuery(options) {
463
- const defaultedOptions = this.defaultQueryOptions(options);
464
- if (defaultedOptions.retry === void 0) {
465
- defaultedOptions.retry = false;
466
- }
467
- const query = this.#queryCache.build(this, defaultedOptions);
468
- return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
469
- }
470
- prefetchQuery(options) {
471
- return this.fetchQuery(options).then(noop).catch(noop);
472
- }
473
- fetchInfiniteQuery(options) {
474
- options.behavior = infiniteQueryBehavior(options.pages);
475
- return this.fetchQuery(options);
476
- }
477
- prefetchInfiniteQuery(options) {
478
- return this.fetchInfiniteQuery(options).then(noop).catch(noop);
479
- }
480
- resumePausedMutations() {
481
- if (onlineManager.isOnline()) {
482
- return this.#mutationCache.resumePausedMutations();
483
- }
484
- return Promise.resolve();
485
- }
486
- getQueryCache() {
487
- return this.#queryCache;
488
- }
489
- getMutationCache() {
490
- return this.#mutationCache;
491
- }
492
- getDefaultOptions() {
493
- return this.#defaultOptions;
494
- }
495
- setDefaultOptions(options) {
496
- this.#defaultOptions = options;
497
- }
498
- setQueryDefaults(queryKey, options) {
499
- this.#queryDefaults.set(hashKey(queryKey), {
500
- queryKey,
501
- defaultOptions: options
502
- });
503
- }
504
- getQueryDefaults(queryKey) {
505
- const defaults = [...this.#queryDefaults.values()];
506
- let result = {};
507
- defaults.forEach((queryDefault) => {
508
- if (partialMatchKey(queryKey, queryDefault.queryKey)) {
509
- result = { ...result, ...queryDefault.defaultOptions };
510
- }
511
- });
512
- return result;
513
- }
514
- setMutationDefaults(mutationKey, options) {
515
- this.#mutationDefaults.set(hashKey(mutationKey), {
516
- mutationKey,
517
- defaultOptions: options
518
- });
519
- }
520
- getMutationDefaults(mutationKey) {
521
- const defaults = [...this.#mutationDefaults.values()];
522
- let result = {};
523
- defaults.forEach((queryDefault) => {
524
- if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
525
- result = { ...result, ...queryDefault.defaultOptions };
526
- }
527
- });
528
- return result;
529
- }
530
- defaultQueryOptions(options) {
531
- if (options._defaulted) {
532
- return options;
533
- }
534
- const defaultedOptions = {
535
- ...this.#defaultOptions.queries,
536
- ...this.getQueryDefaults(options.queryKey),
537
- ...options,
538
- _defaulted: true
539
- };
540
- if (!defaultedOptions.queryHash) {
541
- defaultedOptions.queryHash = hashQueryKeyByOptions(
542
- defaultedOptions.queryKey,
543
- defaultedOptions
544
- );
545
- }
546
- if (defaultedOptions.refetchOnReconnect === void 0) {
547
- defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
548
- }
549
- if (defaultedOptions.throwOnError === void 0) {
550
- defaultedOptions.throwOnError = !!defaultedOptions.suspense;
551
- }
552
- if (!defaultedOptions.networkMode && defaultedOptions.persister) {
553
- defaultedOptions.networkMode = "offlineFirst";
554
- }
555
- if (defaultedOptions.enabled !== true && defaultedOptions.queryFn === skipToken) {
556
- defaultedOptions.enabled = false;
557
- }
558
- return defaultedOptions;
559
- }
560
- defaultMutationOptions(options) {
561
- if (options?._defaulted) {
562
- return options;
563
- }
564
- return {
565
- ...this.#defaultOptions.mutations,
566
- ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
567
- ...options,
568
- _defaulted: true
569
- };
570
- }
571
- clear() {
572
- this.#queryCache.clear();
573
- this.#mutationCache.clear();
574
- }
575
- };
576
-
577
- // ../../node_modules/.pnpm/solid-js@1.8.17/node_modules/solid-js/dist/solid.js
578
- var sharedConfig = {
579
- context: void 0,
580
- registry: void 0
581
- };
582
- function setHydrateContext(context) {
583
- sharedConfig.context = context;
584
- }
585
- var equalFn = (a, b) => a === b;
586
- var $PROXY = Symbol("solid-proxy");
587
- var $TRACK = Symbol("solid-track");
588
- var signalOptions = {
589
- equals: equalFn
590
- };
591
- var runEffects = runQueue;
592
- var STALE = 1;
593
- var PENDING = 2;
594
- var UNOWNED = {
595
- owned: null,
596
- cleanups: null,
597
- context: null,
598
- owner: null
599
- };
600
- var NO_INIT = {};
601
- var Owner = null;
602
- var Transition = null;
603
- var ExternalSourceConfig = null;
604
- var Listener = null;
605
- var Updates = null;
606
- var Effects = null;
607
- var ExecCount = 0;
608
- function createRoot(fn, detachedOwner) {
609
- const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
610
- owned: null,
611
- cleanups: null,
612
- context: current ? current.context : null,
613
- owner: current
614
- }, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
615
- Owner = root;
616
- Listener = null;
617
- try {
618
- return runUpdates(updateFn, true);
619
- } finally {
620
- Listener = listener;
621
- Owner = owner;
622
- }
623
- }
624
- function createSignal(value, options) {
625
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
626
- const s = {
627
- value,
628
- observers: null,
629
- observerSlots: null,
630
- comparator: options.equals || void 0
631
- };
632
- const setter = (value2) => {
633
- if (typeof value2 === "function") {
634
- value2 = value2(s.value);
635
- }
636
- return writeSignal(s, value2);
637
- };
638
- return [readSignal.bind(s), setter];
639
- }
640
- function createComputed(fn, value, options) {
641
- const c = createComputation(fn, value, true, STALE);
642
- updateComputation(c);
643
- }
644
- function createRenderEffect(fn, value, options) {
645
- const c = createComputation(fn, value, false, STALE);
646
- updateComputation(c);
647
- }
648
- function createEffect(fn, value, options) {
649
- runEffects = runUserEffects;
650
- const c = createComputation(fn, value, false, STALE);
651
- if (!options || !options.render)
652
- c.user = true;
653
- Effects ? Effects.push(c) : updateComputation(c);
654
- }
655
- function createMemo(fn, value, options) {
656
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
657
- const c = createComputation(fn, value, true, 0);
658
- c.observers = null;
659
- c.observerSlots = null;
660
- c.comparator = options.equals || void 0;
661
- updateComputation(c);
662
- return readSignal.bind(c);
663
- }
664
- function isPromise(v) {
665
- return v && typeof v === "object" && "then" in v;
666
- }
667
- function createResource(pSource, pFetcher, pOptions) {
668
- let source;
669
- let fetcher;
670
- let options;
671
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
672
- source = true;
673
- fetcher = pSource;
674
- options = pFetcher || {};
675
- } else {
676
- source = pSource;
677
- fetcher = pFetcher;
678
- options = pOptions || {};
679
- }
680
- let pr = null, initP = NO_INIT, id = null, scheduled = false, resolved = "initialValue" in options, dynamic = typeof source === "function" && createMemo(source);
681
- const contexts = /* @__PURE__ */ new Set(), [value, setValue] = (options.storage || createSignal)(options.initialValue), [error, setError] = createSignal(void 0), [track, trigger] = createSignal(void 0, {
682
- equals: false
683
- }), [state, setState] = createSignal(resolved ? "ready" : "unresolved");
684
- if (sharedConfig.context) {
685
- id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
686
- let v;
687
- if (options.ssrLoadFrom === "initial")
688
- initP = options.initialValue;
689
- else if (sharedConfig.load && (v = sharedConfig.load(id)))
690
- initP = v;
691
- }
692
- function loadEnd(p, v, error2, key) {
693
- if (pr === p) {
694
- pr = null;
695
- key !== void 0 && (resolved = true);
696
- if ((p === initP || v === initP) && options.onHydrated)
697
- queueMicrotask(
698
- () => options.onHydrated(key, {
699
- value: v
700
- })
701
- );
702
- initP = NO_INIT;
703
- completeLoad(v, error2);
704
- }
705
- return v;
706
- }
707
- function completeLoad(v, err) {
708
- runUpdates(() => {
709
- if (err === void 0)
710
- setValue(() => v);
711
- setState(err !== void 0 ? "errored" : resolved ? "ready" : "unresolved");
712
- setError(err);
713
- for (const c of contexts.keys())
714
- c.decrement();
715
- contexts.clear();
716
- }, false);
717
- }
718
- function read() {
719
- const c = SuspenseContext , v = value(), err = error();
720
- if (err !== void 0 && !pr)
721
- throw err;
722
- if (Listener && !Listener.user && c) {
723
- createComputed(() => {
724
- track();
725
- if (pr) {
726
- if (c.resolved )
727
- ;
728
- else if (!contexts.has(c)) {
729
- c.increment();
730
- contexts.add(c);
731
- }
732
- }
733
- });
734
- }
735
- return v;
736
- }
737
- function load(refetching = true) {
738
- if (refetching !== false && scheduled)
739
- return;
740
- scheduled = false;
741
- const lookup = dynamic ? dynamic() : source;
742
- if (lookup == null || lookup === false) {
743
- loadEnd(pr, untrack(value));
744
- return;
745
- }
746
- const p = initP !== NO_INIT ? initP : untrack(
747
- () => fetcher(lookup, {
748
- value: value(),
749
- refetching
750
- })
751
- );
752
- if (!isPromise(p)) {
753
- loadEnd(pr, p, void 0, lookup);
754
- return p;
755
- }
756
- pr = p;
757
- if ("value" in p) {
758
- if (p.status === "success")
759
- loadEnd(pr, p.value, void 0, lookup);
760
- else
761
- loadEnd(pr, void 0, void 0, lookup);
762
- return p;
763
- }
764
- scheduled = true;
765
- queueMicrotask(() => scheduled = false);
766
- runUpdates(() => {
767
- setState(resolved ? "refreshing" : "pending");
768
- trigger();
769
- }, false);
770
- return p.then(
771
- (v) => loadEnd(p, v, void 0, lookup),
772
- (e) => loadEnd(p, void 0, castError(e), lookup)
773
- );
774
- }
775
- Object.defineProperties(read, {
776
- state: {
777
- get: () => state()
778
- },
779
- error: {
780
- get: () => error()
781
- },
782
- loading: {
783
- get() {
784
- const s = state();
785
- return s === "pending" || s === "refreshing";
786
- }
787
- },
788
- latest: {
789
- get() {
790
- if (!resolved)
791
- return read();
792
- const err = error();
793
- if (err && !pr)
794
- throw err;
795
- return value();
796
- }
797
- }
798
- });
799
- if (dynamic)
800
- createComputed(() => load(false));
801
- else
802
- load(false);
803
- return [
804
- read,
805
- {
806
- refetch: load,
807
- mutate: setValue
808
- }
809
- ];
810
- }
811
- function batch(fn) {
812
- return runUpdates(fn, false);
813
- }
814
- function untrack(fn) {
815
- if (Listener === null)
816
- return fn();
817
- const listener = Listener;
818
- Listener = null;
819
- try {
820
- if (ExternalSourceConfig)
821
- ;
822
- return fn();
823
- } finally {
824
- Listener = listener;
825
- }
826
- }
827
- function on(deps, fn, options) {
828
- const isArray3 = Array.isArray(deps);
829
- let prevInput;
830
- let defer = options && options.defer;
831
- return (prevValue) => {
832
- let input;
833
- if (isArray3) {
834
- input = Array(deps.length);
835
- for (let i = 0; i < deps.length; i++)
836
- input[i] = deps[i]();
837
- } else
838
- input = deps();
839
- if (defer) {
840
- defer = false;
841
- return prevValue;
842
- }
843
- const result = untrack(() => fn(input, prevInput, prevValue));
844
- prevInput = input;
845
- return result;
846
- };
847
- }
848
- function onMount(fn) {
849
- createEffect(() => untrack(fn));
850
- }
851
- function onCleanup(fn) {
852
- if (Owner === null)
853
- ;
854
- else if (Owner.cleanups === null)
855
- Owner.cleanups = [fn];
856
- else
857
- Owner.cleanups.push(fn);
858
- return fn;
859
- }
860
- function getOwner() {
861
- return Owner;
862
- }
863
- function runWithOwner(o, fn) {
864
- const prev = Owner;
865
- const prevListener = Listener;
866
- Owner = o;
867
- Listener = null;
868
- try {
869
- return runUpdates(fn, true);
870
- } catch (err) {
871
- handleError(err);
872
- } finally {
873
- Owner = prev;
874
- Listener = prevListener;
875
- }
876
- }
877
- function startTransition(fn) {
878
- const l = Listener;
879
- const o = Owner;
880
- return Promise.resolve().then(() => {
881
- Listener = l;
882
- Owner = o;
883
- let t;
884
- runUpdates(fn, false);
885
- Listener = Owner = null;
886
- return t ? t.done : void 0;
887
- });
888
- }
889
- var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
890
- function useTransition() {
891
- return [transPending, startTransition];
892
- }
893
- function createContext(defaultValue, options) {
894
- const id = Symbol("context");
895
- return {
896
- id,
897
- Provider: createProvider(id),
898
- defaultValue
899
- };
900
- }
901
- function useContext(context) {
902
- return Owner && Owner.context && Owner.context[context.id] !== void 0 ? Owner.context[context.id] : context.defaultValue;
903
- }
904
- function children(fn) {
905
- const children2 = createMemo(fn);
906
- const memo = createMemo(() => resolveChildren(children2()));
907
- memo.toArray = () => {
908
- const c = memo();
909
- return Array.isArray(c) ? c : c != null ? [c] : [];
910
- };
911
- return memo;
912
- }
913
- var SuspenseContext;
914
- function readSignal() {
915
- if (this.sources && (this.state)) {
916
- if ((this.state) === STALE)
917
- updateComputation(this);
918
- else {
919
- const updates = Updates;
920
- Updates = null;
921
- runUpdates(() => lookUpstream(this), false);
922
- Updates = updates;
923
- }
924
- }
925
- if (Listener) {
926
- const sSlot = this.observers ? this.observers.length : 0;
927
- if (!Listener.sources) {
928
- Listener.sources = [this];
929
- Listener.sourceSlots = [sSlot];
930
- } else {
931
- Listener.sources.push(this);
932
- Listener.sourceSlots.push(sSlot);
933
- }
934
- if (!this.observers) {
935
- this.observers = [Listener];
936
- this.observerSlots = [Listener.sources.length - 1];
937
- } else {
938
- this.observers.push(Listener);
939
- this.observerSlots.push(Listener.sources.length - 1);
940
- }
941
- }
942
- return this.value;
943
- }
944
- function writeSignal(node, value, isComp) {
945
- let current = node.value;
946
- if (!node.comparator || !node.comparator(current, value)) {
947
- node.value = value;
948
- if (node.observers && node.observers.length) {
949
- runUpdates(() => {
950
- for (let i = 0; i < node.observers.length; i += 1) {
951
- const o = node.observers[i];
952
- const TransitionRunning = Transition && Transition.running;
953
- if (TransitionRunning && Transition.disposed.has(o))
954
- ;
955
- if (TransitionRunning ? !o.tState : !o.state) {
956
- if (o.pure)
957
- Updates.push(o);
958
- else
959
- Effects.push(o);
960
- if (o.observers)
961
- markDownstream(o);
962
- }
963
- if (!TransitionRunning)
964
- o.state = STALE;
965
- }
966
- if (Updates.length > 1e6) {
967
- Updates = [];
968
- if (false)
969
- ;
970
- throw new Error();
971
- }
972
- }, false);
973
- }
974
- }
975
- return value;
976
- }
977
- function updateComputation(node) {
978
- if (!node.fn)
979
- return;
980
- cleanNode(node);
981
- const time = ExecCount;
982
- runComputation(
983
- node,
984
- node.value,
985
- time
986
- );
987
- }
988
- function runComputation(node, value, time) {
989
- let nextValue;
990
- const owner = Owner, listener = Listener;
991
- Listener = Owner = node;
992
- try {
993
- nextValue = node.fn(value);
994
- } catch (err) {
995
- if (node.pure) {
996
- {
997
- node.state = STALE;
998
- node.owned && node.owned.forEach(cleanNode);
999
- node.owned = null;
1000
- }
1001
- }
1002
- node.updatedAt = time + 1;
1003
- return handleError(err);
1004
- } finally {
1005
- Listener = listener;
1006
- Owner = owner;
1007
- }
1008
- if (!node.updatedAt || node.updatedAt <= time) {
1009
- if (node.updatedAt != null && "observers" in node) {
1010
- writeSignal(node, nextValue);
1011
- } else node.value = nextValue;
1012
- node.updatedAt = time;
1013
- }
1014
- }
1015
- function createComputation(fn, init, pure, state = STALE, options) {
1016
- const c = {
1017
- fn,
1018
- state,
1019
- updatedAt: null,
1020
- owned: null,
1021
- sources: null,
1022
- sourceSlots: null,
1023
- cleanups: null,
1024
- value: init,
1025
- owner: Owner,
1026
- context: Owner ? Owner.context : null,
1027
- pure
1028
- };
1029
- if (Owner === null)
1030
- ;
1031
- else if (Owner !== UNOWNED) {
1032
- {
1033
- if (!Owner.owned)
1034
- Owner.owned = [c];
1035
- else
1036
- Owner.owned.push(c);
1037
- }
1038
- }
1039
- return c;
1040
- }
1041
- function runTop(node) {
1042
- if ((node.state) === 0)
1043
- return;
1044
- if ((node.state) === PENDING)
1045
- return lookUpstream(node);
1046
- if (node.suspense && untrack(node.suspense.inFallback))
1047
- return node.suspense.effects.push(node);
1048
- const ancestors = [node];
1049
- while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
1050
- if (node.state)
1051
- ancestors.push(node);
1052
- }
1053
- for (let i = ancestors.length - 1; i >= 0; i--) {
1054
- node = ancestors[i];
1055
- if ((node.state) === STALE) {
1056
- updateComputation(node);
1057
- } else if ((node.state) === PENDING) {
1058
- const updates = Updates;
1059
- Updates = null;
1060
- runUpdates(() => lookUpstream(node, ancestors[0]), false);
1061
- Updates = updates;
1062
- }
1063
- }
1064
- }
1065
- function runUpdates(fn, init) {
1066
- if (Updates)
1067
- return fn();
1068
- let wait = false;
1069
- if (!init)
1070
- Updates = [];
1071
- if (Effects)
1072
- wait = true;
1073
- else
1074
- Effects = [];
1075
- ExecCount++;
1076
- try {
1077
- const res = fn();
1078
- completeUpdates(wait);
1079
- return res;
1080
- } catch (err) {
1081
- if (!wait)
1082
- Effects = null;
1083
- Updates = null;
1084
- handleError(err);
1085
- }
1086
- }
1087
- function completeUpdates(wait) {
1088
- if (Updates) {
1089
- runQueue(Updates);
1090
- Updates = null;
1091
- }
1092
- if (wait)
1093
- return;
1094
- const e = Effects;
1095
- Effects = null;
1096
- if (e.length)
1097
- runUpdates(() => runEffects(e), false);
1098
- }
1099
- function runQueue(queue) {
1100
- for (let i = 0; i < queue.length; i++)
1101
- runTop(queue[i]);
1102
- }
1103
- function runUserEffects(queue) {
1104
- let i, userLength = 0;
1105
- for (i = 0; i < queue.length; i++) {
1106
- const e = queue[i];
1107
- if (!e.user)
1108
- runTop(e);
1109
- else
1110
- queue[userLength++] = e;
1111
- }
1112
- if (sharedConfig.context) {
1113
- if (sharedConfig.count) {
1114
- sharedConfig.effects || (sharedConfig.effects = []);
1115
- sharedConfig.effects.push(...queue.slice(0, userLength));
1116
- return;
1117
- } else if (sharedConfig.effects) {
1118
- queue = [...sharedConfig.effects, ...queue];
1119
- userLength += sharedConfig.effects.length;
1120
- delete sharedConfig.effects;
1121
- }
1122
- setHydrateContext();
1123
- }
1124
- for (i = 0; i < userLength; i++)
1125
- runTop(queue[i]);
1126
- }
1127
- function lookUpstream(node, ignore) {
1128
- node.state = 0;
1129
- for (let i = 0; i < node.sources.length; i += 1) {
1130
- const source = node.sources[i];
1131
- if (source.sources) {
1132
- const state = source.state;
1133
- if (state === STALE) {
1134
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
1135
- runTop(source);
1136
- } else if (state === PENDING)
1137
- lookUpstream(source, ignore);
1138
- }
1139
- }
1140
- }
1141
- function markDownstream(node) {
1142
- for (let i = 0; i < node.observers.length; i += 1) {
1143
- const o = node.observers[i];
1144
- if (!o.state) {
1145
- o.state = PENDING;
1146
- if (o.pure)
1147
- Updates.push(o);
1148
- else
1149
- Effects.push(o);
1150
- o.observers && markDownstream(o);
1151
- }
1152
- }
1153
- }
1154
- function cleanNode(node) {
1155
- let i;
1156
- if (node.sources) {
1157
- while (node.sources.length) {
1158
- const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
1159
- if (obs && obs.length) {
1160
- const n = obs.pop(), s = source.observerSlots.pop();
1161
- if (index < obs.length) {
1162
- n.sourceSlots[s] = index;
1163
- obs[index] = n;
1164
- source.observerSlots[index] = s;
1165
- }
1166
- }
1167
- }
1168
- }
1169
- if (node.owned) {
1170
- for (i = node.owned.length - 1; i >= 0; i--)
1171
- cleanNode(node.owned[i]);
1172
- node.owned = null;
1173
- }
1174
- if (node.cleanups) {
1175
- for (i = node.cleanups.length - 1; i >= 0; i--)
1176
- node.cleanups[i]();
1177
- node.cleanups = null;
1178
- }
1179
- node.state = 0;
1180
- }
1181
- function castError(err) {
1182
- if (err instanceof Error)
1183
- return err;
1184
- return new Error(typeof err === "string" ? err : "Unknown error", {
1185
- cause: err
1186
- });
1187
- }
1188
- function handleError(err, owner = Owner) {
1189
- const error = castError(err);
1190
- throw error;
1191
- }
1192
- function resolveChildren(children2) {
1193
- if (typeof children2 === "function" && !children2.length)
1194
- return resolveChildren(children2());
1195
- if (Array.isArray(children2)) {
1196
- const results = [];
1197
- for (let i = 0; i < children2.length; i++) {
1198
- const result = resolveChildren(children2[i]);
1199
- Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
1200
- }
1201
- return results;
1202
- }
1203
- return children2;
1204
- }
1205
- function createProvider(id, options) {
1206
- return function provider(props) {
1207
- let res;
1208
- createRenderEffect(
1209
- () => res = untrack(() => {
1210
- Owner.context = {
1211
- ...Owner.context,
1212
- [id]: props.value
1213
- };
1214
- return children(() => props.children);
1215
- }),
1216
- void 0
1217
- );
1218
- return res;
1219
- };
1220
- }
1221
- var FALLBACK = Symbol("fallback");
1222
- function dispose(d) {
1223
- for (let i = 0; i < d.length; i++)
1224
- d[i]();
1225
- }
1226
- function mapArray(list, mapFn, options = {}) {
1227
- let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
1228
- onCleanup(() => dispose(disposers));
1229
- return () => {
1230
- let newItems = list() || [], i, j;
1231
- newItems[$TRACK];
1232
- return untrack(() => {
1233
- let newLen = newItems.length, newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
1234
- if (newLen === 0) {
1235
- if (len !== 0) {
1236
- dispose(disposers);
1237
- disposers = [];
1238
- items = [];
1239
- mapped = [];
1240
- len = 0;
1241
- indexes && (indexes = []);
1242
- }
1243
- if (options.fallback) {
1244
- items = [FALLBACK];
1245
- mapped[0] = createRoot((disposer) => {
1246
- disposers[0] = disposer;
1247
- return options.fallback();
1248
- });
1249
- len = 1;
1250
- }
1251
- } else if (len === 0) {
1252
- mapped = new Array(newLen);
1253
- for (j = 0; j < newLen; j++) {
1254
- items[j] = newItems[j];
1255
- mapped[j] = createRoot(mapper);
1256
- }
1257
- len = newLen;
1258
- } else {
1259
- temp = new Array(newLen);
1260
- tempdisposers = new Array(newLen);
1261
- indexes && (tempIndexes = new Array(newLen));
1262
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++)
1263
- ;
1264
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1265
- temp[newEnd] = mapped[end];
1266
- tempdisposers[newEnd] = disposers[end];
1267
- indexes && (tempIndexes[newEnd] = indexes[end]);
1268
- }
1269
- newIndices = /* @__PURE__ */ new Map();
1270
- newIndicesNext = new Array(newEnd + 1);
1271
- for (j = newEnd; j >= start; j--) {
1272
- item = newItems[j];
1273
- i = newIndices.get(item);
1274
- newIndicesNext[j] = i === void 0 ? -1 : i;
1275
- newIndices.set(item, j);
1276
- }
1277
- for (i = start; i <= end; i++) {
1278
- item = items[i];
1279
- j = newIndices.get(item);
1280
- if (j !== void 0 && j !== -1) {
1281
- temp[j] = mapped[i];
1282
- tempdisposers[j] = disposers[i];
1283
- indexes && (tempIndexes[j] = indexes[i]);
1284
- j = newIndicesNext[j];
1285
- newIndices.set(item, j);
1286
- } else
1287
- disposers[i]();
1288
- }
1289
- for (j = start; j < newLen; j++) {
1290
- if (j in temp) {
1291
- mapped[j] = temp[j];
1292
- disposers[j] = tempdisposers[j];
1293
- if (indexes) {
1294
- indexes[j] = tempIndexes[j];
1295
- indexes[j](j);
1296
- }
1297
- } else
1298
- mapped[j] = createRoot(mapper);
1299
- }
1300
- mapped = mapped.slice(0, len = newLen);
1301
- items = newItems.slice(0);
1302
- }
1303
- return mapped;
1304
- });
1305
- function mapper(disposer) {
1306
- disposers[j] = disposer;
1307
- if (indexes) {
1308
- const [s, set] = createSignal(j);
1309
- indexes[j] = set;
1310
- return mapFn(newItems[j], s);
1311
- }
1312
- return mapFn(newItems[j]);
1313
- }
1314
- };
1315
- }
1316
- function indexArray(list, mapFn, options = {}) {
1317
- let items = [], mapped = [], disposers = [], signals = [], len = 0, i;
1318
- onCleanup(() => dispose(disposers));
1319
- return () => {
1320
- const newItems = list() || [];
1321
- newItems[$TRACK];
1322
- return untrack(() => {
1323
- if (newItems.length === 0) {
1324
- if (len !== 0) {
1325
- dispose(disposers);
1326
- disposers = [];
1327
- items = [];
1328
- mapped = [];
1329
- len = 0;
1330
- signals = [];
1331
- }
1332
- if (options.fallback) {
1333
- items = [FALLBACK];
1334
- mapped[0] = createRoot((disposer) => {
1335
- disposers[0] = disposer;
1336
- return options.fallback();
1337
- });
1338
- len = 1;
1339
- }
1340
- return mapped;
1341
- }
1342
- if (items[0] === FALLBACK) {
1343
- disposers[0]();
1344
- disposers = [];
1345
- items = [];
1346
- mapped = [];
1347
- len = 0;
1348
- }
1349
- for (i = 0; i < newItems.length; i++) {
1350
- if (i < items.length && items[i] !== newItems[i]) {
1351
- signals[i](() => newItems[i]);
1352
- } else if (i >= items.length) {
1353
- mapped[i] = createRoot(mapper);
1354
- }
1355
- }
1356
- for (; i < items.length; i++) {
1357
- disposers[i]();
1358
- }
1359
- len = signals.length = disposers.length = newItems.length;
1360
- items = newItems.slice(0);
1361
- return mapped = mapped.slice(0, len);
1362
- });
1363
- function mapper(disposer) {
1364
- disposers[i] = disposer;
1365
- const [s, set] = createSignal(newItems[i]);
1366
- signals[i] = set;
1367
- return mapFn(s, i);
1368
- }
1369
- };
1370
- }
1371
- function createComponent(Comp, props) {
1372
- return untrack(() => Comp(props || {}));
1373
- }
1374
- function trueFn() {
1375
- return true;
1376
- }
1377
- var propTraps = {
1378
- get(_, property, receiver) {
1379
- if (property === $PROXY)
1380
- return receiver;
1381
- return _.get(property);
1382
- },
1383
- has(_, property) {
1384
- if (property === $PROXY)
1385
- return true;
1386
- return _.has(property);
1387
- },
1388
- set: trueFn,
1389
- deleteProperty: trueFn,
1390
- getOwnPropertyDescriptor(_, property) {
1391
- return {
1392
- configurable: true,
1393
- enumerable: true,
1394
- get() {
1395
- return _.get(property);
1396
- },
1397
- set: trueFn,
1398
- deleteProperty: trueFn
1399
- };
1400
- },
1401
- ownKeys(_) {
1402
- return _.keys();
1403
- }
1404
- };
1405
- function resolveSource(s) {
1406
- return !(s = typeof s === "function" ? s() : s) ? {} : s;
1407
- }
1408
- function resolveSources() {
1409
- for (let i = 0, length = this.length; i < length; ++i) {
1410
- const v = this[i]();
1411
- if (v !== void 0)
1412
- return v;
1413
- }
1414
- }
1415
- function mergeProps(...sources) {
1416
- let proxy = false;
1417
- for (let i = 0; i < sources.length; i++) {
1418
- const s = sources[i];
1419
- proxy = proxy || !!s && $PROXY in s;
1420
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1421
- }
1422
- if (proxy) {
1423
- return new Proxy(
1424
- {
1425
- get(property) {
1426
- for (let i = sources.length - 1; i >= 0; i--) {
1427
- const v = resolveSource(sources[i])[property];
1428
- if (v !== void 0)
1429
- return v;
1430
- }
1431
- },
1432
- has(property) {
1433
- for (let i = sources.length - 1; i >= 0; i--) {
1434
- if (property in resolveSource(sources[i]))
1435
- return true;
1436
- }
1437
- return false;
1438
- },
1439
- keys() {
1440
- const keys = [];
1441
- for (let i = 0; i < sources.length; i++)
1442
- keys.push(...Object.keys(resolveSource(sources[i])));
1443
- return [...new Set(keys)];
1444
- }
1445
- },
1446
- propTraps
1447
- );
1448
- }
1449
- const sourcesMap = {};
1450
- const defined = /* @__PURE__ */ Object.create(null);
1451
- for (let i = sources.length - 1; i >= 0; i--) {
1452
- const source = sources[i];
1453
- if (!source)
1454
- continue;
1455
- const sourceKeys = Object.getOwnPropertyNames(source);
1456
- for (let i2 = sourceKeys.length - 1; i2 >= 0; i2--) {
1457
- const key = sourceKeys[i2];
1458
- if (key === "__proto__" || key === "constructor")
1459
- continue;
1460
- const desc = Object.getOwnPropertyDescriptor(source, key);
1461
- if (!defined[key]) {
1462
- defined[key] = desc.get ? {
1463
- enumerable: true,
1464
- configurable: true,
1465
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1466
- } : desc.value !== void 0 ? desc : void 0;
1467
- } else {
1468
- const sources2 = sourcesMap[key];
1469
- if (sources2) {
1470
- if (desc.get)
1471
- sources2.push(desc.get.bind(source));
1472
- else if (desc.value !== void 0)
1473
- sources2.push(() => desc.value);
1474
- }
1475
- }
1476
- }
1477
- }
1478
- const target = {};
1479
- const definedKeys = Object.keys(defined);
1480
- for (let i = definedKeys.length - 1; i >= 0; i--) {
1481
- const key = definedKeys[i], desc = defined[key];
1482
- if (desc && desc.get)
1483
- Object.defineProperty(target, key, desc);
1484
- else
1485
- target[key] = desc ? desc.value : void 0;
1486
- }
1487
- return target;
1488
- }
1489
- function splitProps(props, ...keys) {
1490
- if ($PROXY in props) {
1491
- const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1492
- const res = keys.map((k) => {
1493
- return new Proxy(
1494
- {
1495
- get(property) {
1496
- return k.includes(property) ? props[property] : void 0;
1497
- },
1498
- has(property) {
1499
- return k.includes(property) && property in props;
1500
- },
1501
- keys() {
1502
- return k.filter((property) => property in props);
1503
- }
1504
- },
1505
- propTraps
1506
- );
1507
- });
1508
- res.push(
1509
- new Proxy(
1510
- {
1511
- get(property) {
1512
- return blocked.has(property) ? void 0 : props[property];
1513
- },
1514
- has(property) {
1515
- return blocked.has(property) ? false : property in props;
1516
- },
1517
- keys() {
1518
- return Object.keys(props).filter((k) => !blocked.has(k));
1519
- }
1520
- },
1521
- propTraps
1522
- )
1523
- );
1524
- return res;
1525
- }
1526
- const otherObject = {};
1527
- const objects = keys.map(() => ({}));
1528
- for (const propName of Object.getOwnPropertyNames(props)) {
1529
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1530
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1531
- let blocked = false;
1532
- let objectIndex = 0;
1533
- for (const k of keys) {
1534
- if (k.includes(propName)) {
1535
- blocked = true;
1536
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1537
- }
1538
- ++objectIndex;
1539
- }
1540
- if (!blocked) {
1541
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1542
- }
1543
- }
1544
- return [...objects, otherObject];
1545
- }
1546
- function lazy(fn) {
1547
- let comp;
1548
- let p;
1549
- const wrap = (props) => {
1550
- const ctx = sharedConfig.context;
1551
- if (ctx) {
1552
- const [s, set] = createSignal();
1553
- sharedConfig.count || (sharedConfig.count = 0);
1554
- sharedConfig.count++;
1555
- (p || (p = fn())).then((mod) => {
1556
- setHydrateContext(ctx);
1557
- sharedConfig.count--;
1558
- set(() => mod.default);
1559
- setHydrateContext();
1560
- });
1561
- comp = s;
1562
- } else if (!comp) {
1563
- const [s] = createResource(() => (p || (p = fn())).then((mod) => mod.default));
1564
- comp = s;
1565
- }
1566
- let Comp;
1567
- return createMemo(
1568
- () => (Comp = comp()) && untrack(() => {
1569
- if (false)
1570
- ;
1571
- if (!ctx)
1572
- return Comp(props);
1573
- const c = sharedConfig.context;
1574
- setHydrateContext(ctx);
1575
- const r = Comp(props);
1576
- setHydrateContext(c);
1577
- return r;
1578
- })
1579
- );
1580
- };
1581
- wrap.preload = () => p || ((p = fn()).then((mod) => comp = () => mod.default), p);
1582
- return wrap;
1583
- }
1584
- var counter = 0;
1585
- function createUniqueId() {
1586
- const ctx = sharedConfig.context;
1587
- return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1588
- }
1589
- var narrowedError = (name) => `Stale read from <${name}>.`;
1590
- function For(props) {
1591
- const fallback = "fallback" in props && {
1592
- fallback: () => props.fallback
1593
- };
1594
- return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
1595
- }
1596
- function Index(props) {
1597
- const fallback = "fallback" in props && {
1598
- fallback: () => props.fallback
1599
- };
1600
- return createMemo(indexArray(() => props.each, props.children, fallback || void 0));
1601
- }
1602
- function Show(props) {
1603
- const keyed = props.keyed;
1604
- const condition = createMemo(() => props.when, void 0, {
1605
- equals: (a, b) => keyed ? a === b : !a === !b
1606
- });
1607
- return createMemo(
1608
- () => {
1609
- const c = condition();
1610
- if (c) {
1611
- const child = props.children;
1612
- const fn = typeof child === "function" && child.length > 0;
1613
- return fn ? untrack(
1614
- () => child(
1615
- keyed ? c : () => {
1616
- if (!untrack(condition))
1617
- throw narrowedError("Show");
1618
- return props.when;
1619
- }
1620
- )
1621
- ) : child;
1622
- }
1623
- return props.fallback;
1624
- },
1625
- void 0,
1626
- void 0
1627
- );
1628
- }
1629
- function Switch(props) {
1630
- let keyed = false;
1631
- const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1632
- const conditions = children(() => props.children), evalConditions = createMemo(
1633
- () => {
1634
- let conds = conditions();
1635
- if (!Array.isArray(conds))
1636
- conds = [conds];
1637
- for (let i = 0; i < conds.length; i++) {
1638
- const c = conds[i].when;
1639
- if (c) {
1640
- keyed = !!conds[i].keyed;
1641
- return [i, c, conds[i]];
1642
- }
1643
- }
1644
- return [-1];
1645
- },
1646
- void 0,
1647
- {
1648
- equals
1649
- }
1650
- );
1651
- return createMemo(
1652
- () => {
1653
- const [index, when, cond] = evalConditions();
1654
- if (index < 0)
1655
- return props.fallback;
1656
- const c = cond.children;
1657
- const fn = typeof c === "function" && c.length > 0;
1658
- return fn ? untrack(
1659
- () => c(
1660
- keyed ? when : () => {
1661
- if (untrack(evalConditions)[0] !== index)
1662
- throw narrowedError("Match");
1663
- return cond.when;
1664
- }
1665
- )
1666
- ) : c;
1667
- },
1668
- void 0,
1669
- void 0
1670
- );
1671
- }
1672
- function Match(props) {
1673
- return props;
1674
- }
1675
-
1676
- // ../../node_modules/.pnpm/solid-js@1.8.17/node_modules/solid-js/web/dist/web.js
1677
- var booleans = [
1678
- "allowfullscreen",
1679
- "async",
1680
- "autofocus",
1681
- "autoplay",
1682
- "checked",
1683
- "controls",
1684
- "default",
1685
- "disabled",
1686
- "formnovalidate",
1687
- "hidden",
1688
- "indeterminate",
1689
- "inert",
1690
- "ismap",
1691
- "loop",
1692
- "multiple",
1693
- "muted",
1694
- "nomodule",
1695
- "novalidate",
1696
- "open",
1697
- "playsinline",
1698
- "readonly",
1699
- "required",
1700
- "reversed",
1701
- "seamless",
1702
- "selected"
1703
- ];
1704
- var Properties = /* @__PURE__ */ new Set([
1705
- "className",
1706
- "value",
1707
- "readOnly",
1708
- "formNoValidate",
1709
- "isMap",
1710
- "noModule",
1711
- "playsInline",
1712
- ...booleans
1713
- ]);
1714
- var ChildProperties = /* @__PURE__ */ new Set([
1715
- "innerHTML",
1716
- "textContent",
1717
- "innerText",
1718
- "children"
1719
- ]);
1720
- var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1721
- className: "class",
1722
- htmlFor: "for"
1723
- });
1724
- var PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1725
- class: "className",
1726
- formnovalidate: {
1727
- $: "formNoValidate",
1728
- BUTTON: 1,
1729
- INPUT: 1
1730
- },
1731
- ismap: {
1732
- $: "isMap",
1733
- IMG: 1
1734
- },
1735
- nomodule: {
1736
- $: "noModule",
1737
- SCRIPT: 1
1738
- },
1739
- playsinline: {
1740
- $: "playsInline",
1741
- VIDEO: 1
1742
- },
1743
- readonly: {
1744
- $: "readOnly",
1745
- INPUT: 1,
1746
- TEXTAREA: 1
1747
- }
1748
- });
1749
- function getPropAlias(prop, tagName) {
1750
- const a = PropAliases[prop];
1751
- return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
1752
- }
1753
- var DelegatedEvents = /* @__PURE__ */ new Set([
1754
- "beforeinput",
1755
- "click",
1756
- "dblclick",
1757
- "contextmenu",
1758
- "focusin",
1759
- "focusout",
1760
- "input",
1761
- "keydown",
1762
- "keyup",
1763
- "mousedown",
1764
- "mousemove",
1765
- "mouseout",
1766
- "mouseover",
1767
- "mouseup",
1768
- "pointerdown",
1769
- "pointermove",
1770
- "pointerout",
1771
- "pointerover",
1772
- "pointerup",
1773
- "touchend",
1774
- "touchmove",
1775
- "touchstart"
1776
- ]);
1777
- var SVGElements = /* @__PURE__ */ new Set([
1778
- "altGlyph",
1779
- "altGlyphDef",
1780
- "altGlyphItem",
1781
- "animate",
1782
- "animateColor",
1783
- "animateMotion",
1784
- "animateTransform",
1785
- "circle",
1786
- "clipPath",
1787
- "color-profile",
1788
- "cursor",
1789
- "defs",
1790
- "desc",
1791
- "ellipse",
1792
- "feBlend",
1793
- "feColorMatrix",
1794
- "feComponentTransfer",
1795
- "feComposite",
1796
- "feConvolveMatrix",
1797
- "feDiffuseLighting",
1798
- "feDisplacementMap",
1799
- "feDistantLight",
1800
- "feDropShadow",
1801
- "feFlood",
1802
- "feFuncA",
1803
- "feFuncB",
1804
- "feFuncG",
1805
- "feFuncR",
1806
- "feGaussianBlur",
1807
- "feImage",
1808
- "feMerge",
1809
- "feMergeNode",
1810
- "feMorphology",
1811
- "feOffset",
1812
- "fePointLight",
1813
- "feSpecularLighting",
1814
- "feSpotLight",
1815
- "feTile",
1816
- "feTurbulence",
1817
- "filter",
1818
- "font",
1819
- "font-face",
1820
- "font-face-format",
1821
- "font-face-name",
1822
- "font-face-src",
1823
- "font-face-uri",
1824
- "foreignObject",
1825
- "g",
1826
- "glyph",
1827
- "glyphRef",
1828
- "hkern",
1829
- "image",
1830
- "line",
1831
- "linearGradient",
1832
- "marker",
1833
- "mask",
1834
- "metadata",
1835
- "missing-glyph",
1836
- "mpath",
1837
- "path",
1838
- "pattern",
1839
- "polygon",
1840
- "polyline",
1841
- "radialGradient",
1842
- "rect",
1843
- "set",
1844
- "stop",
1845
- "svg",
1846
- "switch",
1847
- "symbol",
1848
- "text",
1849
- "textPath",
1850
- "tref",
1851
- "tspan",
1852
- "use",
1853
- "view",
1854
- "vkern"
1855
- ]);
1856
- var SVGNamespace = {
1857
- xlink: "http://www.w3.org/1999/xlink",
1858
- xml: "http://www.w3.org/XML/1998/namespace"
1859
- };
1860
- function reconcileArrays(parentNode, a, b) {
1861
- let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
1862
- while (aStart < aEnd || bStart < bEnd) {
1863
- if (a[aStart] === b[bStart]) {
1864
- aStart++;
1865
- bStart++;
1866
- continue;
1867
- }
1868
- while (a[aEnd - 1] === b[bEnd - 1]) {
1869
- aEnd--;
1870
- bEnd--;
1871
- }
1872
- if (aEnd === aStart) {
1873
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
1874
- while (bStart < bEnd)
1875
- parentNode.insertBefore(b[bStart++], node);
1876
- } else if (bEnd === bStart) {
1877
- while (aStart < aEnd) {
1878
- if (!map || !map.has(a[aStart]))
1879
- a[aStart].remove();
1880
- aStart++;
1881
- }
1882
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
1883
- const node = a[--aEnd].nextSibling;
1884
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
1885
- parentNode.insertBefore(b[--bEnd], node);
1886
- a[aEnd] = b[bEnd];
1887
- } else {
1888
- if (!map) {
1889
- map = /* @__PURE__ */ new Map();
1890
- let i = bStart;
1891
- while (i < bEnd)
1892
- map.set(b[i], i++);
1893
- }
1894
- const index = map.get(a[aStart]);
1895
- if (index != null) {
1896
- if (bStart < index && index < bEnd) {
1897
- let i = aStart, sequence = 1, t;
1898
- while (++i < aEnd && i < bEnd) {
1899
- if ((t = map.get(a[i])) == null || t !== index + sequence)
1900
- break;
1901
- sequence++;
1902
- }
1903
- if (sequence > index - bStart) {
1904
- const node = a[aStart];
1905
- while (bStart < index)
1906
- parentNode.insertBefore(b[bStart++], node);
1907
- } else
1908
- parentNode.replaceChild(b[bStart++], a[aStart++]);
1909
- } else
1910
- aStart++;
1911
- } else
1912
- a[aStart++].remove();
1913
- }
1914
- }
1915
- }
1916
- var $$EVENTS = "_$DX_DELEGATE";
1917
- function render(code, element, init, options = {}) {
1918
- let disposer;
1919
- createRoot((dispose2) => {
1920
- disposer = dispose2;
1921
- element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
1922
- }, options.owner);
1923
- return () => {
1924
- disposer();
1925
- element.textContent = "";
1926
- };
1927
- }
1928
- function template(html, isCE, isSVG) {
1929
- let node;
1930
- const create = () => {
1931
- const t = document.createElement("template");
1932
- t.innerHTML = html;
1933
- return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
1934
- };
1935
- const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
1936
- fn.cloneNode = fn;
1937
- return fn;
1938
- }
1939
- function delegateEvents(eventNames, document2 = window.document) {
1940
- const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
1941
- for (let i = 0, l = eventNames.length; i < l; i++) {
1942
- const name = eventNames[i];
1943
- if (!e.has(name)) {
1944
- e.add(name);
1945
- document2.addEventListener(name, eventHandler);
1946
- }
1947
- }
1948
- }
1949
- function clearDelegatedEvents(document2 = window.document) {
1950
- if (document2[$$EVENTS]) {
1951
- for (let name of document2[$$EVENTS].keys())
1952
- document2.removeEventListener(name, eventHandler);
1953
- delete document2[$$EVENTS];
1954
- }
1955
- }
1956
- function setAttribute(node, name, value) {
1957
- if (!!sharedConfig.context && node.isConnected)
1958
- return;
1959
- if (value == null)
1960
- node.removeAttribute(name);
1961
- else
1962
- node.setAttribute(name, value);
1963
- }
1964
- function setAttributeNS(node, namespace, name, value) {
1965
- if (!!sharedConfig.context && node.isConnected)
1966
- return;
1967
- if (value == null)
1968
- node.removeAttributeNS(namespace, name);
1969
- else
1970
- node.setAttributeNS(namespace, name, value);
1971
- }
1972
- function className(node, value) {
1973
- if (!!sharedConfig.context && node.isConnected)
1974
- return;
1975
- if (value == null)
1976
- node.removeAttribute("class");
1977
- else
1978
- node.className = value;
1979
- }
1980
- function addEventListener(node, name, handler, delegate) {
1981
- if (delegate) {
1982
- if (Array.isArray(handler)) {
1983
- node[`$$${name}`] = handler[0];
1984
- node[`$$${name}Data`] = handler[1];
1985
- } else
1986
- node[`$$${name}`] = handler;
1987
- } else if (Array.isArray(handler)) {
1988
- const handlerFn = handler[0];
1989
- node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
1990
- } else
1991
- node.addEventListener(name, handler);
1992
- }
1993
- function classList(node, value, prev = {}) {
1994
- const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
1995
- let i, len;
1996
- for (i = 0, len = prevKeys.length; i < len; i++) {
1997
- const key = prevKeys[i];
1998
- if (!key || key === "undefined" || value[key])
1999
- continue;
2000
- toggleClassKey(node, key, false);
2001
- delete prev[key];
2002
- }
2003
- for (i = 0, len = classKeys.length; i < len; i++) {
2004
- const key = classKeys[i], classValue = !!value[key];
2005
- if (!key || key === "undefined" || prev[key] === classValue || !classValue)
2006
- continue;
2007
- toggleClassKey(node, key, true);
2008
- prev[key] = classValue;
2009
- }
2010
- return prev;
2011
- }
2012
- function style(node, value, prev) {
2013
- if (!value)
2014
- return prev ? setAttribute(node, "style") : value;
2015
- const nodeStyle = node.style;
2016
- if (typeof value === "string")
2017
- return nodeStyle.cssText = value;
2018
- typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
2019
- prev || (prev = {});
2020
- value || (value = {});
2021
- let v, s;
2022
- for (s in prev) {
2023
- value[s] == null && nodeStyle.removeProperty(s);
2024
- delete prev[s];
2025
- }
2026
- for (s in value) {
2027
- v = value[s];
2028
- if (v !== prev[s]) {
2029
- nodeStyle.setProperty(s, v);
2030
- prev[s] = v;
2031
- }
2032
- }
2033
- return prev;
2034
- }
2035
- function spread(node, props = {}, isSVG, skipChildren) {
2036
- const prevProps = {};
2037
- if (!skipChildren) {
2038
- createRenderEffect(
2039
- () => prevProps.children = insertExpression(node, props.children, prevProps.children)
2040
- );
2041
- }
2042
- createRenderEffect(
2043
- () => typeof props.ref === "function" ? use(props.ref, node) : props.ref = node
2044
- );
2045
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
2046
- return prevProps;
2047
- }
2048
- function use(fn, element, arg) {
2049
- return untrack(() => fn(element, arg));
2050
- }
2051
- function insert(parent, accessor, marker, initial) {
2052
- if (marker !== void 0 && !initial)
2053
- initial = [];
2054
- if (typeof accessor !== "function")
2055
- return insertExpression(parent, accessor, initial, marker);
2056
- createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
2057
- }
2058
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
2059
- props || (props = {});
2060
- for (const prop in prevProps) {
2061
- if (!(prop in props)) {
2062
- if (prop === "children")
2063
- continue;
2064
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
2065
- }
2066
- }
2067
- for (const prop in props) {
2068
- if (prop === "children") {
2069
- if (!skipChildren)
2070
- insertExpression(node, props.children);
2071
- continue;
2072
- }
2073
- const value = props[prop];
2074
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
2075
- }
2076
- }
2077
- function getNextElement(template2) {
2078
- let node, key;
2079
- if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
2080
- return template2();
2081
- }
2082
- if (sharedConfig.completed)
2083
- sharedConfig.completed.add(node);
2084
- sharedConfig.registry.delete(key);
2085
- return node;
2086
- }
2087
- function toPropertyName(name) {
2088
- return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
2089
- }
2090
- function toggleClassKey(node, key, value) {
2091
- const classNames = key.trim().split(/\s+/);
2092
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
2093
- node.classList.toggle(classNames[i], value);
2094
- }
2095
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
2096
- let isCE, isProp, isChildProp, propAlias, forceProp;
2097
- if (prop === "style")
2098
- return style(node, value, prev);
2099
- if (prop === "classList")
2100
- return classList(node, value, prev);
2101
- if (value === prev)
2102
- return prev;
2103
- if (prop === "ref") {
2104
- if (!skipRef)
2105
- value(node);
2106
- } else if (prop.slice(0, 3) === "on:") {
2107
- const e = prop.slice(3);
2108
- prev && node.removeEventListener(e, prev);
2109
- value && node.addEventListener(e, value);
2110
- } else if (prop.slice(0, 10) === "oncapture:") {
2111
- const e = prop.slice(10);
2112
- prev && node.removeEventListener(e, prev, true);
2113
- value && node.addEventListener(e, value, true);
2114
- } else if (prop.slice(0, 2) === "on") {
2115
- const name = prop.slice(2).toLowerCase();
2116
- const delegate = DelegatedEvents.has(name);
2117
- if (!delegate && prev) {
2118
- const h = Array.isArray(prev) ? prev[0] : prev;
2119
- node.removeEventListener(name, h);
2120
- }
2121
- if (delegate || value) {
2122
- addEventListener(node, name, value, delegate);
2123
- delegate && delegateEvents([name]);
2124
- }
2125
- } else if (prop.slice(0, 5) === "attr:") {
2126
- setAttribute(node, prop.slice(5), value);
2127
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
2128
- if (forceProp) {
2129
- prop = prop.slice(5);
2130
- isProp = true;
2131
- } else if (!!sharedConfig.context && node.isConnected)
2132
- return value;
2133
- if (prop === "class" || prop === "className")
2134
- className(node, value);
2135
- else if (isCE && !isProp && !isChildProp)
2136
- node[toPropertyName(prop)] = value;
2137
- else
2138
- node[propAlias || prop] = value;
2139
- } else {
2140
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
2141
- if (ns)
2142
- setAttributeNS(node, ns, prop, value);
2143
- else
2144
- setAttribute(node, Aliases[prop] || prop, value);
2145
- }
2146
- return value;
2147
- }
2148
- function eventHandler(e) {
2149
- const key = `$$${e.type}`;
2150
- let node = e.composedPath && e.composedPath()[0] || e.target;
2151
- if (e.target !== node) {
2152
- Object.defineProperty(e, "target", {
2153
- configurable: true,
2154
- value: node
2155
- });
2156
- }
2157
- Object.defineProperty(e, "currentTarget", {
2158
- configurable: true,
2159
- get() {
2160
- return node || document;
2161
- }
2162
- });
2163
- if (sharedConfig.registry && !sharedConfig.done)
2164
- sharedConfig.done = _$HY.done = true;
2165
- while (node) {
2166
- const handler = node[key];
2167
- if (handler && !node.disabled) {
2168
- const data = node[`${key}Data`];
2169
- data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
2170
- if (e.cancelBubble)
2171
- return;
2172
- }
2173
- node = node._$host || node.parentNode || node.host;
2174
- }
2175
- }
2176
- function insertExpression(parent, value, current, marker, unwrapArray) {
2177
- const hydrating = !!sharedConfig.context && parent.isConnected;
2178
- if (hydrating) {
2179
- !current && (current = [...parent.childNodes]);
2180
- let cleaned = [];
2181
- for (let i = 0; i < current.length; i++) {
2182
- const node = current[i];
2183
- if (node.nodeType === 8 && node.data.slice(0, 2) === "!$")
2184
- node.remove();
2185
- else
2186
- cleaned.push(node);
2187
- }
2188
- current = cleaned;
2189
- }
2190
- while (typeof current === "function")
2191
- current = current();
2192
- if (value === current)
2193
- return current;
2194
- const t = typeof value, multi = marker !== void 0;
2195
- parent = multi && current[0] && current[0].parentNode || parent;
2196
- if (t === "string" || t === "number") {
2197
- if (hydrating)
2198
- return current;
2199
- if (t === "number")
2200
- value = value.toString();
2201
- if (multi) {
2202
- let node = current[0];
2203
- if (node && node.nodeType === 3) {
2204
- node.data !== value && (node.data = value);
2205
- } else
2206
- node = document.createTextNode(value);
2207
- current = cleanChildren(parent, current, marker, node);
2208
- } else {
2209
- if (current !== "" && typeof current === "string") {
2210
- current = parent.firstChild.data = value;
2211
- } else
2212
- current = parent.textContent = value;
2213
- }
2214
- } else if (value == null || t === "boolean") {
2215
- if (hydrating)
2216
- return current;
2217
- current = cleanChildren(parent, current, marker);
2218
- } else if (t === "function") {
2219
- createRenderEffect(() => {
2220
- let v = value();
2221
- while (typeof v === "function")
2222
- v = v();
2223
- current = insertExpression(parent, v, current, marker);
2224
- });
2225
- return () => current;
2226
- } else if (Array.isArray(value)) {
2227
- const array = [];
2228
- const currentArray = current && Array.isArray(current);
2229
- if (normalizeIncomingArray(array, value, current, unwrapArray)) {
2230
- createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
2231
- return () => current;
2232
- }
2233
- if (hydrating) {
2234
- if (!array.length)
2235
- return current;
2236
- if (marker === void 0)
2237
- return [...parent.childNodes];
2238
- let node = array[0];
2239
- let nodes = [node];
2240
- while ((node = node.nextSibling) !== marker)
2241
- nodes.push(node);
2242
- return current = nodes;
2243
- }
2244
- if (array.length === 0) {
2245
- current = cleanChildren(parent, current, marker);
2246
- if (multi)
2247
- return current;
2248
- } else if (currentArray) {
2249
- if (current.length === 0) {
2250
- appendNodes(parent, array, marker);
2251
- } else
2252
- reconcileArrays(parent, current, array);
2253
- } else {
2254
- current && cleanChildren(parent);
2255
- appendNodes(parent, array);
2256
- }
2257
- current = array;
2258
- } else if (value.nodeType) {
2259
- if (hydrating && value.parentNode)
2260
- return current = multi ? [value] : value;
2261
- if (Array.isArray(current)) {
2262
- if (multi)
2263
- return current = cleanChildren(parent, current, marker, value);
2264
- cleanChildren(parent, current, null, value);
2265
- } else if (current == null || current === "" || !parent.firstChild) {
2266
- parent.appendChild(value);
2267
- } else
2268
- parent.replaceChild(value, parent.firstChild);
2269
- current = value;
2270
- } else
2271
- ;
2272
- return current;
2273
- }
2274
- function normalizeIncomingArray(normalized, array, current, unwrap) {
2275
- let dynamic = false;
2276
- for (let i = 0, len = array.length; i < len; i++) {
2277
- let item = array[i], prev = current && current[normalized.length], t;
2278
- if (item == null || item === true || item === false)
2279
- ;
2280
- else if ((t = typeof item) === "object" && item.nodeType) {
2281
- normalized.push(item);
2282
- } else if (Array.isArray(item)) {
2283
- dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
2284
- } else if (t === "function") {
2285
- if (unwrap) {
2286
- while (typeof item === "function")
2287
- item = item();
2288
- dynamic = normalizeIncomingArray(
2289
- normalized,
2290
- Array.isArray(item) ? item : [item],
2291
- Array.isArray(prev) ? prev : [prev]
2292
- ) || dynamic;
2293
- } else {
2294
- normalized.push(item);
2295
- dynamic = true;
2296
- }
2297
- } else {
2298
- const value = String(item);
2299
- if (prev && prev.nodeType === 3 && prev.data === value)
2300
- normalized.push(prev);
2301
- else
2302
- normalized.push(document.createTextNode(value));
2303
- }
2304
- }
2305
- return dynamic;
2306
- }
2307
- function appendNodes(parent, array, marker = null) {
2308
- for (let i = 0, len = array.length; i < len; i++)
2309
- parent.insertBefore(array[i], marker);
2310
- }
2311
- function cleanChildren(parent, current, marker, replacement) {
2312
- if (marker === void 0)
2313
- return parent.textContent = "";
2314
- const node = replacement || document.createTextNode("");
2315
- if (current.length) {
2316
- let inserted = false;
2317
- for (let i = current.length - 1; i >= 0; i--) {
2318
- const el = current[i];
2319
- if (node !== el) {
2320
- const isParent = el.parentNode === parent;
2321
- if (!inserted && !i)
2322
- isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
2323
- else
2324
- isParent && el.remove();
2325
- } else
2326
- inserted = true;
2327
- }
2328
- } else
2329
- parent.insertBefore(node, marker);
2330
- return [node];
2331
- }
2332
- function getHydrationKey() {
2333
- const hydrate = sharedConfig.context;
2334
- return `${hydrate.id}${hydrate.count++}`;
2335
- }
2336
- var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2337
- function createElement(tagName, isSVG = false) {
2338
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
2339
- }
2340
- function Portal(props) {
2341
- const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
2342
- let content;
2343
- let hydrating = !!sharedConfig.context;
2344
- createEffect(
2345
- () => {
2346
- if (hydrating)
2347
- getOwner().user = hydrating = false;
2348
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
2349
- const el = mount();
2350
- if (el instanceof HTMLHeadElement) {
2351
- const [clean, setClean] = createSignal(false);
2352
- const cleanup = () => setClean(true);
2353
- createRoot((dispose2) => insert(el, () => !clean() ? content() : dispose2(), null));
2354
- onCleanup(cleanup);
2355
- } else {
2356
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
2357
- mode: "open"
2358
- }) : container;
2359
- Object.defineProperty(container, "_$host", {
2360
- get() {
2361
- return marker.parentNode;
2362
- },
2363
- configurable: true
2364
- });
2365
- insert(renderRoot, content);
2366
- el.appendChild(container);
2367
- props.ref && props.ref(container);
2368
- onCleanup(() => el.removeChild(container));
2369
- }
2370
- },
2371
- void 0,
2372
- {
2373
- render: !hydrating
2374
- }
2375
- );
2376
- return marker;
2377
- }
2378
- function Dynamic(props) {
2379
- const [p, others] = splitProps(props, ["component"]);
2380
- const cached = createMemo(() => p.component);
2381
- return createMemo(() => {
2382
- const component = cached();
2383
- switch (typeof component) {
2384
- case "function":
2385
- return untrack(() => component(others));
2386
- case "string":
2387
- const isSvg = SVGElements.has(component);
2388
- const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
2389
- spread(el, others, isSvg);
2390
- return el;
2391
- }
2392
- });
2393
- }
2394
-
2395
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/double-indexed-kv.js
2396
- var DoubleIndexedKV = class {
2397
- constructor() {
2398
- this.keyToValue = /* @__PURE__ */ new Map();
2399
- this.valueToKey = /* @__PURE__ */ new Map();
2400
- }
2401
- set(key, value) {
2402
- this.keyToValue.set(key, value);
2403
- this.valueToKey.set(value, key);
2404
- }
2405
- getByKey(key) {
2406
- return this.keyToValue.get(key);
2407
- }
2408
- getByValue(value) {
2409
- return this.valueToKey.get(value);
2410
- }
2411
- clear() {
2412
- this.keyToValue.clear();
2413
- this.valueToKey.clear();
2414
- }
2415
- };
2416
-
2417
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/registry.js
2418
- var Registry = class {
2419
- constructor(generateIdentifier) {
2420
- this.generateIdentifier = generateIdentifier;
2421
- this.kv = new DoubleIndexedKV();
2422
- }
2423
- register(value, identifier) {
2424
- if (this.kv.getByValue(value)) {
2425
- return;
2426
- }
2427
- if (!identifier) {
2428
- identifier = this.generateIdentifier(value);
2429
- }
2430
- this.kv.set(identifier, value);
2431
- }
2432
- clear() {
2433
- this.kv.clear();
2434
- }
2435
- getIdentifier(value) {
2436
- return this.kv.getByValue(value);
2437
- }
2438
- getValue(identifier) {
2439
- return this.kv.getByKey(identifier);
2440
- }
2441
- };
2442
-
2443
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/class-registry.js
2444
- var ClassRegistry = class extends Registry {
2445
- constructor() {
2446
- super((c) => c.name);
2447
- this.classToAllowedProps = /* @__PURE__ */ new Map();
2448
- }
2449
- register(value, options) {
2450
- if (typeof options === "object") {
2451
- if (options.allowProps) {
2452
- this.classToAllowedProps.set(value, options.allowProps);
2453
- }
2454
- super.register(value, options.identifier);
2455
- } else {
2456
- super.register(value, options);
2457
- }
2458
- }
2459
- getAllowedProps(value) {
2460
- return this.classToAllowedProps.get(value);
2461
- }
2462
- };
2463
-
2464
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/util.js
2465
- function valuesOfObj(record) {
2466
- if ("values" in Object) {
2467
- return Object.values(record);
2468
- }
2469
- const values = [];
2470
- for (const key in record) {
2471
- if (record.hasOwnProperty(key)) {
2472
- values.push(record[key]);
2473
- }
2474
- }
2475
- return values;
2476
- }
2477
- function find(record, predicate) {
2478
- const values = valuesOfObj(record);
2479
- if ("find" in values) {
2480
- return values.find(predicate);
2481
- }
2482
- const valuesNotNever = values;
2483
- for (let i = 0; i < valuesNotNever.length; i++) {
2484
- const value = valuesNotNever[i];
2485
- if (predicate(value)) {
2486
- return value;
2487
- }
2488
- }
2489
- return void 0;
2490
- }
2491
- function forEach(record, run) {
2492
- Object.entries(record).forEach(([key, value]) => run(value, key));
2493
- }
2494
- function includes(arr, value) {
2495
- return arr.indexOf(value) !== -1;
2496
- }
2497
- function findArr(record, predicate) {
2498
- for (let i = 0; i < record.length; i++) {
2499
- const value = record[i];
2500
- if (predicate(value)) {
2501
- return value;
2502
- }
2503
- }
2504
- return void 0;
2505
- }
2506
-
2507
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/custom-transformer-registry.js
2508
- var CustomTransformerRegistry = class {
2509
- constructor() {
2510
- this.transfomers = {};
2511
- }
2512
- register(transformer) {
2513
- this.transfomers[transformer.name] = transformer;
2514
- }
2515
- findApplicable(v) {
2516
- return find(this.transfomers, (transformer) => transformer.isApplicable(v));
2517
- }
2518
- findByName(name) {
2519
- return this.transfomers[name];
2520
- }
2521
- };
2522
-
2523
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/is.js
2524
- var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
2525
- var isUndefined = (payload) => typeof payload === "undefined";
2526
- var isNull = (payload) => payload === null;
2527
- var isPlainObject = (payload) => {
2528
- if (typeof payload !== "object" || payload === null)
2529
- return false;
2530
- if (payload === Object.prototype)
2531
- return false;
2532
- if (Object.getPrototypeOf(payload) === null)
2533
- return true;
2534
- return Object.getPrototypeOf(payload) === Object.prototype;
2535
- };
2536
- var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
2537
- var isArray = (payload) => Array.isArray(payload);
2538
- var isString = (payload) => typeof payload === "string";
2539
- var isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
2540
- var isBoolean = (payload) => typeof payload === "boolean";
2541
- var isRegExp = (payload) => payload instanceof RegExp;
2542
- var isMap = (payload) => payload instanceof Map;
2543
- var isSet = (payload) => payload instanceof Set;
2544
- var isSymbol = (payload) => getType(payload) === "Symbol";
2545
- var isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
2546
- var isError = (payload) => payload instanceof Error;
2547
- var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
2548
- var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
2549
- var isBigint = (payload) => typeof payload === "bigint";
2550
- var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
2551
- var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
2552
- var isURL = (payload) => payload instanceof URL;
2553
-
2554
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/pathstringifier.js
2555
- var escapeKey = (key) => key.replace(/\./g, "\\.");
2556
- var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
2557
- var parsePath = (string) => {
2558
- const result = [];
2559
- let segment = "";
2560
- for (let i = 0; i < string.length; i++) {
2561
- let char = string.charAt(i);
2562
- const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
2563
- if (isEscapedDot) {
2564
- segment += ".";
2565
- i++;
2566
- continue;
2567
- }
2568
- const isEndOfSegment = char === ".";
2569
- if (isEndOfSegment) {
2570
- result.push(segment);
2571
- segment = "";
2572
- continue;
2573
- }
2574
- segment += char;
2575
- }
2576
- const lastSegment = segment;
2577
- result.push(lastSegment);
2578
- return result;
2579
- };
2580
-
2581
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/transformer.js
2582
- function simpleTransformation(isApplicable, annotation, transform, untransform) {
2583
- return {
2584
- isApplicable,
2585
- annotation,
2586
- transform,
2587
- untransform
2588
- };
2589
- }
2590
- var simpleRules = [
2591
- simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
2592
- simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
2593
- if (typeof BigInt !== "undefined") {
2594
- return BigInt(v);
2595
- }
2596
- return v;
2597
- }),
2598
- simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
2599
- simpleTransformation(isError, "Error", (v, superJson) => {
2600
- const baseError = {
2601
- name: v.name,
2602
- message: v.message
2603
- };
2604
- superJson.allowedErrorProps.forEach((prop) => {
2605
- baseError[prop] = v[prop];
2606
- });
2607
- return baseError;
2608
- }, (v, superJson) => {
2609
- const e = new Error(v.message);
2610
- e.name = v.name;
2611
- e.stack = v.stack;
2612
- superJson.allowedErrorProps.forEach((prop) => {
2613
- e[prop] = v[prop];
2614
- });
2615
- return e;
2616
- }),
2617
- simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
2618
- const body = regex.slice(1, regex.lastIndexOf("/"));
2619
- const flags = regex.slice(regex.lastIndexOf("/") + 1);
2620
- return new RegExp(body, flags);
2621
- }),
2622
- simpleTransformation(
2623
- isSet,
2624
- "set",
2625
- // (sets only exist in es6+)
2626
- // eslint-disable-next-line es5/no-es6-methods
2627
- (v) => [...v.values()],
2628
- (v) => new Set(v)
2629
- ),
2630
- simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
2631
- simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
2632
- if (isNaNValue(v)) {
2633
- return "NaN";
2634
- }
2635
- if (v > 0) {
2636
- return "Infinity";
2637
- } else {
2638
- return "-Infinity";
2639
- }
2640
- }, Number),
2641
- simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
2642
- return "-0";
2643
- }, Number),
2644
- simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
2645
- ];
2646
- function compositeTransformation(isApplicable, annotation, transform, untransform) {
2647
- return {
2648
- isApplicable,
2649
- annotation,
2650
- transform,
2651
- untransform
2652
- };
2653
- }
2654
- var symbolRule = compositeTransformation((s, superJson) => {
2655
- if (isSymbol(s)) {
2656
- const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
2657
- return isRegistered;
2658
- }
2659
- return false;
2660
- }, (s, superJson) => {
2661
- const identifier = superJson.symbolRegistry.getIdentifier(s);
2662
- return ["symbol", identifier];
2663
- }, (v) => v.description, (_, a, superJson) => {
2664
- const value = superJson.symbolRegistry.getValue(a[1]);
2665
- if (!value) {
2666
- throw new Error("Trying to deserialize unknown symbol");
2667
- }
2668
- return value;
2669
- });
2670
- var constructorToName = [
2671
- Int8Array,
2672
- Uint8Array,
2673
- Int16Array,
2674
- Uint16Array,
2675
- Int32Array,
2676
- Uint32Array,
2677
- Float32Array,
2678
- Float64Array,
2679
- Uint8ClampedArray
2680
- ].reduce((obj, ctor) => {
2681
- obj[ctor.name] = ctor;
2682
- return obj;
2683
- }, {});
2684
- var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
2685
- const ctor = constructorToName[a[1]];
2686
- if (!ctor) {
2687
- throw new Error("Trying to deserialize unknown typed array");
2688
- }
2689
- return new ctor(v);
2690
- });
2691
- function isInstanceOfRegisteredClass(potentialClass, superJson) {
2692
- if (potentialClass?.constructor) {
2693
- const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
2694
- return isRegistered;
2695
- }
2696
- return false;
2697
- }
2698
- var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
2699
- const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
2700
- return ["class", identifier];
2701
- }, (clazz, superJson) => {
2702
- const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
2703
- if (!allowedProps) {
2704
- return { ...clazz };
2705
- }
2706
- const result = {};
2707
- allowedProps.forEach((prop) => {
2708
- result[prop] = clazz[prop];
2709
- });
2710
- return result;
2711
- }, (v, a, superJson) => {
2712
- const clazz = superJson.classRegistry.getValue(a[1]);
2713
- if (!clazz) {
2714
- throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");
2715
- }
2716
- return Object.assign(Object.create(clazz.prototype), v);
2717
- });
2718
- var customRule = compositeTransformation((value, superJson) => {
2719
- return !!superJson.customTransformerRegistry.findApplicable(value);
2720
- }, (value, superJson) => {
2721
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
2722
- return ["custom", transformer.name];
2723
- }, (value, superJson) => {
2724
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
2725
- return transformer.serialize(value);
2726
- }, (v, a, superJson) => {
2727
- const transformer = superJson.customTransformerRegistry.findByName(a[1]);
2728
- if (!transformer) {
2729
- throw new Error("Trying to deserialize unknown custom value");
2730
- }
2731
- return transformer.deserialize(v);
2732
- });
2733
- var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
2734
- var transformValue = (value, superJson) => {
2735
- const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
2736
- if (applicableCompositeRule) {
2737
- return {
2738
- value: applicableCompositeRule.transform(value, superJson),
2739
- type: applicableCompositeRule.annotation(value, superJson)
2740
- };
2741
- }
2742
- const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
2743
- if (applicableSimpleRule) {
2744
- return {
2745
- value: applicableSimpleRule.transform(value, superJson),
2746
- type: applicableSimpleRule.annotation
2747
- };
2748
- }
2749
- return void 0;
2750
- };
2751
- var simpleRulesByAnnotation = {};
2752
- simpleRules.forEach((rule) => {
2753
- simpleRulesByAnnotation[rule.annotation] = rule;
2754
- });
2755
- var untransformValue = (json, type, superJson) => {
2756
- if (isArray(type)) {
2757
- switch (type[0]) {
2758
- case "symbol":
2759
- return symbolRule.untransform(json, type, superJson);
2760
- case "class":
2761
- return classRule.untransform(json, type, superJson);
2762
- case "custom":
2763
- return customRule.untransform(json, type, superJson);
2764
- case "typed-array":
2765
- return typedArrayRule.untransform(json, type, superJson);
2766
- default:
2767
- throw new Error("Unknown transformation: " + type);
2768
- }
2769
- } else {
2770
- const transformation = simpleRulesByAnnotation[type];
2771
- if (!transformation) {
2772
- throw new Error("Unknown transformation: " + type);
2773
- }
2774
- return transformation.untransform(json, superJson);
2775
- }
2776
- };
2777
-
2778
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/accessDeep.js
2779
- var getNthKey = (value, n) => {
2780
- const keys = value.keys();
2781
- while (n > 0) {
2782
- keys.next();
2783
- n--;
2784
- }
2785
- return keys.next().value;
2786
- };
2787
- function validatePath(path) {
2788
- if (includes(path, "__proto__")) {
2789
- throw new Error("__proto__ is not allowed as a property");
2790
- }
2791
- if (includes(path, "prototype")) {
2792
- throw new Error("prototype is not allowed as a property");
2793
- }
2794
- if (includes(path, "constructor")) {
2795
- throw new Error("constructor is not allowed as a property");
2796
- }
2797
- }
2798
- var getDeep = (object, path) => {
2799
- validatePath(path);
2800
- for (let i = 0; i < path.length; i++) {
2801
- const key = path[i];
2802
- if (isSet(object)) {
2803
- object = getNthKey(object, +key);
2804
- } else if (isMap(object)) {
2805
- const row = +key;
2806
- const type = +path[++i] === 0 ? "key" : "value";
2807
- const keyOfRow = getNthKey(object, row);
2808
- switch (type) {
2809
- case "key":
2810
- object = keyOfRow;
2811
- break;
2812
- case "value":
2813
- object = object.get(keyOfRow);
2814
- break;
2815
- }
2816
- } else {
2817
- object = object[key];
2818
- }
2819
- }
2820
- return object;
2821
- };
2822
- var setDeep = (object, path, mapper) => {
2823
- validatePath(path);
2824
- if (path.length === 0) {
2825
- return mapper(object);
2826
- }
2827
- let parent = object;
2828
- for (let i = 0; i < path.length - 1; i++) {
2829
- const key = path[i];
2830
- if (isArray(parent)) {
2831
- const index = +key;
2832
- parent = parent[index];
2833
- } else if (isPlainObject(parent)) {
2834
- parent = parent[key];
2835
- } else if (isSet(parent)) {
2836
- const row = +key;
2837
- parent = getNthKey(parent, row);
2838
- } else if (isMap(parent)) {
2839
- const isEnd = i === path.length - 2;
2840
- if (isEnd) {
2841
- break;
2842
- }
2843
- const row = +key;
2844
- const type = +path[++i] === 0 ? "key" : "value";
2845
- const keyOfRow = getNthKey(parent, row);
2846
- switch (type) {
2847
- case "key":
2848
- parent = keyOfRow;
2849
- break;
2850
- case "value":
2851
- parent = parent.get(keyOfRow);
2852
- break;
2853
- }
2854
- }
2855
- }
2856
- const lastKey = path[path.length - 1];
2857
- if (isArray(parent)) {
2858
- parent[+lastKey] = mapper(parent[+lastKey]);
2859
- } else if (isPlainObject(parent)) {
2860
- parent[lastKey] = mapper(parent[lastKey]);
2861
- }
2862
- if (isSet(parent)) {
2863
- const oldValue = getNthKey(parent, +lastKey);
2864
- const newValue = mapper(oldValue);
2865
- if (oldValue !== newValue) {
2866
- parent.delete(oldValue);
2867
- parent.add(newValue);
2868
- }
2869
- }
2870
- if (isMap(parent)) {
2871
- const row = +path[path.length - 2];
2872
- const keyToRow = getNthKey(parent, row);
2873
- const type = +lastKey === 0 ? "key" : "value";
2874
- switch (type) {
2875
- case "key": {
2876
- const newKey = mapper(keyToRow);
2877
- parent.set(newKey, parent.get(keyToRow));
2878
- if (newKey !== keyToRow) {
2879
- parent.delete(keyToRow);
2880
- }
2881
- break;
2882
- }
2883
- case "value": {
2884
- parent.set(keyToRow, mapper(parent.get(keyToRow)));
2885
- break;
2886
- }
2887
- }
2888
- }
2889
- return object;
2890
- };
2891
-
2892
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/plainer.js
2893
- function traverse(tree, walker2, origin = []) {
2894
- if (!tree) {
2895
- return;
2896
- }
2897
- if (!isArray(tree)) {
2898
- forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
2899
- return;
2900
- }
2901
- const [nodeValue, children2] = tree;
2902
- if (children2) {
2903
- forEach(children2, (child, key) => {
2904
- traverse(child, walker2, [...origin, ...parsePath(key)]);
2905
- });
2906
- }
2907
- walker2(nodeValue, origin);
2908
- }
2909
- function applyValueAnnotations(plain, annotations, superJson) {
2910
- traverse(annotations, (type, path) => {
2911
- plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
2912
- });
2913
- return plain;
2914
- }
2915
- function applyReferentialEqualityAnnotations(plain, annotations) {
2916
- function apply(identicalPaths, path) {
2917
- const object = getDeep(plain, parsePath(path));
2918
- identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
2919
- plain = setDeep(plain, identicalObjectPath, () => object);
2920
- });
2921
- }
2922
- if (isArray(annotations)) {
2923
- const [root, other] = annotations;
2924
- root.forEach((identicalPath) => {
2925
- plain = setDeep(plain, parsePath(identicalPath), () => plain);
2926
- });
2927
- if (other) {
2928
- forEach(other, apply);
2929
- }
2930
- } else {
2931
- forEach(annotations, apply);
2932
- }
2933
- return plain;
2934
- }
2935
- var isDeep = (object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
2936
- function addIdentity(object, path, identities) {
2937
- const existingSet = identities.get(object);
2938
- if (existingSet) {
2939
- existingSet.push(path);
2940
- } else {
2941
- identities.set(object, [path]);
2942
- }
2943
- }
2944
- function generateReferentialEqualityAnnotations(identitites, dedupe) {
2945
- const result = {};
2946
- let rootEqualityPaths = void 0;
2947
- identitites.forEach((paths) => {
2948
- if (paths.length <= 1) {
2949
- return;
2950
- }
2951
- if (!dedupe) {
2952
- paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
2953
- }
2954
- const [representativePath, ...identicalPaths] = paths;
2955
- if (representativePath.length === 0) {
2956
- rootEqualityPaths = identicalPaths.map(stringifyPath);
2957
- } else {
2958
- result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2959
- }
2960
- });
2961
- if (rootEqualityPaths) {
2962
- if (isEmptyObject(result)) {
2963
- return [rootEqualityPaths];
2964
- } else {
2965
- return [rootEqualityPaths, result];
2966
- }
2967
- } else {
2968
- return isEmptyObject(result) ? void 0 : result;
2969
- }
2970
- }
2971
- var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
2972
- const primitive = isPrimitive(object);
2973
- if (!primitive) {
2974
- addIdentity(object, path, identities);
2975
- const seen = seenObjects.get(object);
2976
- if (seen) {
2977
- return dedupe ? {
2978
- transformedValue: null
2979
- } : seen;
2980
- }
2981
- }
2982
- if (!isDeep(object, superJson)) {
2983
- const transformed2 = transformValue(object, superJson);
2984
- const result2 = transformed2 ? {
2985
- transformedValue: transformed2.value,
2986
- annotations: [transformed2.type]
2987
- } : {
2988
- transformedValue: object
2989
- };
2990
- if (!primitive) {
2991
- seenObjects.set(object, result2);
2992
- }
2993
- return result2;
2994
- }
2995
- if (includes(objectsInThisPath, object)) {
2996
- return {
2997
- transformedValue: null
2998
- };
2999
- }
3000
- const transformationResult = transformValue(object, superJson);
3001
- const transformed = transformationResult?.value ?? object;
3002
- const transformedValue = isArray(transformed) ? [] : {};
3003
- const innerAnnotations = {};
3004
- forEach(transformed, (value, index) => {
3005
- if (index === "__proto__" || index === "constructor" || index === "prototype") {
3006
- throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
3007
- }
3008
- const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
3009
- transformedValue[index] = recursiveResult.transformedValue;
3010
- if (isArray(recursiveResult.annotations)) {
3011
- innerAnnotations[index] = recursiveResult.annotations;
3012
- } else if (isPlainObject(recursiveResult.annotations)) {
3013
- forEach(recursiveResult.annotations, (tree, key) => {
3014
- innerAnnotations[escapeKey(index) + "." + key] = tree;
3015
- });
3016
- }
3017
- });
3018
- const result = isEmptyObject(innerAnnotations) ? {
3019
- transformedValue,
3020
- annotations: !!transformationResult ? [transformationResult.type] : void 0
3021
- } : {
3022
- transformedValue,
3023
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
3024
- };
3025
- if (!primitive) {
3026
- seenObjects.set(object, result);
3027
- }
3028
- return result;
3029
- };
3030
-
3031
- // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
3032
- function getType2(payload) {
3033
- return Object.prototype.toString.call(payload).slice(8, -1);
3034
- }
3035
- function isPlainObject2(payload) {
3036
- if (getType2(payload) !== "Object")
3037
- return false;
3038
- const prototype = Object.getPrototypeOf(payload);
3039
- return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
3040
- }
3041
- function isArray2(payload) {
3042
- return getType2(payload) === "Array";
3043
- }
3044
-
3045
- // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
3046
- function assignProp2(carry, key, newVal, originalObject, includeNonenumerable) {
3047
- const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
3048
- if (propType === "enumerable")
3049
- carry[key] = newVal;
3050
- if (includeNonenumerable && propType === "nonenumerable") {
3051
- Object.defineProperty(carry, key, {
3052
- value: newVal,
3053
- enumerable: false,
3054
- writable: true,
3055
- configurable: true
3056
- });
3057
- }
3058
- }
3059
- function copy(target, options = {}) {
3060
- if (isArray2(target)) {
3061
- return target.map((item) => copy(item, options));
3062
- }
3063
- if (!isPlainObject2(target)) {
3064
- return target;
3065
- }
3066
- const props = Object.getOwnPropertyNames(target);
3067
- const symbols = Object.getOwnPropertySymbols(target);
3068
- return [...props, ...symbols].reduce((carry, key) => {
3069
- if (isArray2(options.props) && !options.props.includes(key)) {
3070
- return carry;
3071
- }
3072
- const val = target[key];
3073
- const newVal = copy(val, options);
3074
- assignProp2(carry, key, newVal, target, options.nonenumerable);
3075
- return carry;
3076
- }, {});
3077
- }
3078
-
3079
- // ../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js
3080
- var SuperJSON = class {
3081
- /**
3082
- * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
3083
- */
3084
- constructor({ dedupe = false } = {}) {
3085
- this.classRegistry = new ClassRegistry();
3086
- this.symbolRegistry = new Registry((s) => s.description ?? "");
3087
- this.customTransformerRegistry = new CustomTransformerRegistry();
3088
- this.allowedErrorProps = [];
3089
- this.dedupe = dedupe;
3090
- }
3091
- serialize(object) {
3092
- const identities = /* @__PURE__ */ new Map();
3093
- const output = walker(object, identities, this, this.dedupe);
3094
- const res = {
3095
- json: output.transformedValue
3096
- };
3097
- if (output.annotations) {
3098
- res.meta = {
3099
- ...res.meta,
3100
- values: output.annotations
3101
- };
3102
- }
3103
- const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3104
- if (equalityAnnotations) {
3105
- res.meta = {
3106
- ...res.meta,
3107
- referentialEqualities: equalityAnnotations
3108
- };
3109
- }
3110
- return res;
3111
- }
3112
- deserialize(payload) {
3113
- const { json, meta } = payload;
3114
- let result = copy(json);
3115
- if (meta?.values) {
3116
- result = applyValueAnnotations(result, meta.values, this);
3117
- }
3118
- if (meta?.referentialEqualities) {
3119
- result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
3120
- }
3121
- return result;
3122
- }
3123
- stringify(object) {
3124
- return JSON.stringify(this.serialize(object));
3125
- }
3126
- parse(string) {
3127
- return this.deserialize(JSON.parse(string));
3128
- }
3129
- registerClass(v, options) {
3130
- this.classRegistry.register(v, options);
3131
- }
3132
- registerSymbol(v, identifier) {
3133
- this.symbolRegistry.register(v, identifier);
3134
- }
3135
- registerCustom(transformer, name) {
3136
- this.customTransformerRegistry.register({
3137
- name,
3138
- ...transformer
3139
- });
3140
- }
3141
- allowErrorProps(...props) {
3142
- this.allowedErrorProps.push(...props);
3143
- }
3144
- };
3145
- SuperJSON.defaultInstance = new SuperJSON();
3146
- SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
3147
- SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
3148
- SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
3149
- SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
3150
- SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
3151
- SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
3152
- SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
3153
- SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
3154
- var serialize = SuperJSON.serialize;
3155
- var stringify = SuperJSON.stringify;
3156
-
3157
- // src/utils.tsx
3158
- function getQueryStatusLabel(query) {
3159
- return query.state.fetchStatus === "fetching" ? "fetching" : !query.getObserversCount() ? "inactive" : query.state.fetchStatus === "paused" ? "paused" : query.isStale() ? "stale" : "fresh";
3160
- }
3161
- function getSidedProp(prop, side) {
3162
- return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
3163
- }
3164
- function getQueryStatusColor({
3165
- queryState,
3166
- observerCount,
3167
- isStale
3168
- }) {
3169
- return queryState.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
3170
- }
3171
- function getMutationStatusColor({
3172
- status,
3173
- isPaused
3174
- }) {
3175
- return isPaused ? "purple" : status === "error" ? "red" : status === "pending" ? "yellow" : status === "success" ? "green" : "gray";
3176
- }
3177
- function getQueryStatusColorByLabel(label) {
3178
- return label === "fresh" ? "green" : label === "stale" ? "yellow" : label === "paused" ? "purple" : label === "inactive" ? "gray" : "blue";
3179
- }
3180
- var displayValue = (value, beautify = false) => {
3181
- const {
3182
- json
3183
- } = serialize(value);
3184
- return JSON.stringify(json, null, beautify ? 2 : void 0);
3185
- };
3186
- var getStatusRank = (q) => q.state.fetchStatus !== "idle" ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
3187
- var queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
3188
- var dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
3189
- var statusAndDateSort = (a, b) => {
3190
- if (getStatusRank(a) === getStatusRank(b)) {
3191
- return dateSort(a, b);
3192
- }
3193
- return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
3194
- };
3195
- var sortFns = {
3196
- status: statusAndDateSort,
3197
- "query hash": queryHashSort,
3198
- "last updated": dateSort
3199
- };
3200
- var getMutationStatusRank = (m) => m.state.isPaused ? 0 : m.state.status === "error" ? 2 : m.state.status === "pending" ? 1 : 3;
3201
- var mutationDateSort = (a, b) => a.state.submittedAt < b.state.submittedAt ? 1 : -1;
3202
- var mutationStatusSort = (a, b) => {
3203
- if (getMutationStatusRank(a) === getMutationStatusRank(b)) {
3204
- return mutationDateSort(a, b);
3205
- }
3206
- return getMutationStatusRank(a) > getMutationStatusRank(b) ? 1 : -1;
3207
- };
3208
- var mutationSortFns = {
3209
- status: mutationStatusSort,
3210
- "last updated": mutationDateSort
3211
- };
3212
- var convertRemToPixels = (rem) => {
3213
- return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
3214
- };
3215
- var getPreferredColorScheme = () => {
3216
- const [colorScheme, setColorScheme] = createSignal("dark");
3217
- onMount(() => {
3218
- const query = window.matchMedia("(prefers-color-scheme: dark)");
3219
- setColorScheme(query.matches ? "dark" : "light");
3220
- const listener = (e) => {
3221
- setColorScheme(e.matches ? "dark" : "light");
3222
- };
3223
- query.addEventListener("change", listener);
3224
- onCleanup(() => query.removeEventListener("change", listener));
3225
- });
3226
- return colorScheme;
3227
- };
3228
- var updateNestedDataByPath = (oldData, updatePath, value) => {
3229
- if (updatePath.length === 0) {
3230
- return value;
3231
- }
3232
- if (oldData instanceof Map) {
3233
- const newData = new Map(oldData);
3234
- if (updatePath.length === 1) {
3235
- newData.set(updatePath[0], value);
3236
- return newData;
3237
- }
3238
- const [head, ...tail] = updatePath;
3239
- newData.set(head, updateNestedDataByPath(newData.get(head), tail, value));
3240
- return newData;
3241
- }
3242
- if (oldData instanceof Set) {
3243
- const setAsArray = updateNestedDataByPath(Array.from(oldData), updatePath, value);
3244
- return new Set(setAsArray);
3245
- }
3246
- if (Array.isArray(oldData)) {
3247
- const newData = [...oldData];
3248
- if (updatePath.length === 1) {
3249
- newData[updatePath[0]] = value;
3250
- return newData;
3251
- }
3252
- const [head, ...tail] = updatePath;
3253
- newData[head] = updateNestedDataByPath(newData[head], tail, value);
3254
- return newData;
3255
- }
3256
- if (oldData instanceof Object) {
3257
- const newData = {
3258
- ...oldData
3259
- };
3260
- if (updatePath.length === 1) {
3261
- newData[updatePath[0]] = value;
3262
- return newData;
3263
- }
3264
- const [head, ...tail] = updatePath;
3265
- newData[head] = updateNestedDataByPath(newData[head], tail, value);
3266
- return newData;
3267
- }
3268
- return oldData;
3269
- };
3270
- var deleteNestedDataByPath = (oldData, deletePath) => {
3271
- if (oldData instanceof Map) {
3272
- const newData = new Map(oldData);
3273
- if (deletePath.length === 1) {
3274
- newData.delete(deletePath[0]);
3275
- return newData;
3276
- }
3277
- const [head, ...tail] = deletePath;
3278
- newData.set(head, deleteNestedDataByPath(newData.get(head), tail));
3279
- return newData;
3280
- }
3281
- if (oldData instanceof Set) {
3282
- const setAsArray = deleteNestedDataByPath(Array.from(oldData), deletePath);
3283
- return new Set(setAsArray);
3284
- }
3285
- if (Array.isArray(oldData)) {
3286
- const newData = [...oldData];
3287
- if (deletePath.length === 1) {
3288
- return newData.filter((_, idx) => idx.toString() !== deletePath[0]);
3289
- }
3290
- const [head, ...tail] = deletePath;
3291
- newData[head] = deleteNestedDataByPath(newData[head], tail);
3292
- return newData;
3293
- }
3294
- if (oldData instanceof Object) {
3295
- const newData = {
3296
- ...oldData
3297
- };
3298
- if (deletePath.length === 1) {
3299
- delete newData[deletePath[0]];
3300
- return newData;
3301
- }
3302
- const [head, ...tail] = deletePath;
3303
- newData[head] = deleteNestedDataByPath(newData[head], tail);
3304
- return newData;
3305
- }
3306
- return oldData;
3307
- };
3308
- var setupStyleSheet = (nonce, target) => {
3309
- if (!nonce)
3310
- return;
3311
- const styleExists = document.querySelector("#_goober") || target?.querySelector("#_goober");
3312
- if (styleExists)
3313
- return;
3314
- const styleTag = document.createElement("style");
3315
- const textNode = document.createTextNode("");
3316
- styleTag.appendChild(textNode);
3317
- styleTag.id = "_goober";
3318
- styleTag.setAttribute("nonce", nonce);
3319
- if (target) {
3320
- target.appendChild(styleTag);
3321
- } else {
3322
- document.head.appendChild(styleTag);
3323
- }
3324
- };
3325
-
3326
- // src/index.tsx
3327
- var TanstackQueryDevtools = class {
3328
- #client;
3329
- #onlineManager;
3330
- #queryFlavor;
3331
- #version;
3332
- #isMounted = false;
3333
- #styleNonce;
3334
- #shadowDOMTarget;
3335
- #buttonPosition;
3336
- #position;
3337
- #initialIsOpen;
3338
- #errorTypes;
3339
- #Component;
3340
- #dispose;
3341
- constructor(config) {
3342
- const {
3343
- client,
3344
- queryFlavor,
3345
- version,
3346
- onlineManager,
3347
- buttonPosition,
3348
- position,
3349
- initialIsOpen,
3350
- errorTypes,
3351
- styleNonce,
3352
- shadowDOMTarget
3353
- } = config;
3354
- this.#client = createSignal(client);
3355
- this.#queryFlavor = queryFlavor;
3356
- this.#version = version;
3357
- this.#onlineManager = onlineManager;
3358
- this.#styleNonce = styleNonce;
3359
- this.#shadowDOMTarget = shadowDOMTarget;
3360
- this.#buttonPosition = createSignal(buttonPosition);
3361
- this.#position = createSignal(position);
3362
- this.#initialIsOpen = createSignal(initialIsOpen);
3363
- this.#errorTypes = createSignal(errorTypes);
3364
- }
3365
- setButtonPosition(position) {
3366
- this.#buttonPosition[1](position);
3367
- }
3368
- setPosition(position) {
3369
- this.#position[1](position);
3370
- }
3371
- setInitialIsOpen(isOpen) {
3372
- this.#initialIsOpen[1](isOpen);
3373
- }
3374
- setErrorTypes(errorTypes) {
3375
- this.#errorTypes[1](errorTypes);
3376
- }
3377
- setClient(client) {
3378
- this.#client[1](client);
3379
- }
3380
- mount(el) {
3381
- if (this.#isMounted) {
3382
- throw new Error("Devtools is already mounted");
3383
- }
3384
- const dispose = render(() => {
3385
- const _self$ = this;
3386
- const [btnPosition] = this.#buttonPosition;
3387
- const [pos] = this.#position;
3388
- const [isOpen] = this.#initialIsOpen;
3389
- const [errors] = this.#errorTypes;
3390
- const [queryClient] = this.#client;
3391
- let Devtools;
3392
- if (this.#Component) {
3393
- Devtools = this.#Component;
3394
- } else {
3395
- Devtools = lazy(() => import('./U2TDTBMY-c464dc98.js'));
3396
- this.#Component = Devtools;
3397
- }
3398
- setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
3399
- return createComponent(Devtools, mergeProps({
3400
- get queryFlavor() {
3401
- return _self$.#queryFlavor;
3402
- },
3403
- get version() {
3404
- return _self$.#version;
3405
- },
3406
- get onlineManager() {
3407
- return _self$.#onlineManager;
3408
- },
3409
- get shadowDOMTarget() {
3410
- return _self$.#shadowDOMTarget;
3411
- }
3412
- }, {
3413
- get client() {
3414
- return queryClient();
3415
- },
3416
- get buttonPosition() {
3417
- return btnPosition();
3418
- },
3419
- get position() {
3420
- return pos();
3421
- },
3422
- get initialIsOpen() {
3423
- return isOpen();
3424
- },
3425
- get errorTypes() {
3426
- return errors();
3427
- }
3428
- }));
3429
- }, el);
3430
- this.#isMounted = true;
3431
- this.#dispose = dispose;
3432
- }
3433
- unmount() {
3434
- if (!this.#isMounted) {
3435
- throw new Error("Devtools is not mounted");
3436
- }
3437
- this.#dispose?.();
3438
- this.#isMounted = false;
3439
- }
3440
- };
3441
-
3442
- function ReactQueryDevtools(props) {
3443
- const queryClient = useQueryClient(props.client);
3444
- const ref = React.useRef(null);
3445
- const {
3446
- buttonPosition,
3447
- position,
3448
- initialIsOpen,
3449
- errorTypes,
3450
- styleNonce,
3451
- shadowDOMTarget
3452
- } = props;
3453
- const [devtools] = React.useState(
3454
- new TanstackQueryDevtools({
3455
- client: queryClient,
3456
- queryFlavor: "React Query",
3457
- version: "5",
3458
- onlineManager,
3459
- buttonPosition,
3460
- position,
3461
- initialIsOpen,
3462
- errorTypes,
3463
- styleNonce,
3464
- shadowDOMTarget
3465
- })
3466
- );
3467
- React.useEffect(() => {
3468
- devtools.setClient(queryClient);
3469
- }, [queryClient, devtools]);
3470
- React.useEffect(() => {
3471
- if (buttonPosition) {
3472
- devtools.setButtonPosition(buttonPosition);
3473
- }
3474
- }, [buttonPosition, devtools]);
3475
- React.useEffect(() => {
3476
- if (position) {
3477
- devtools.setPosition(position);
3478
- }
3479
- }, [position, devtools]);
3480
- React.useEffect(() => {
3481
- devtools.setInitialIsOpen(initialIsOpen || false);
3482
- }, [initialIsOpen, devtools]);
3483
- React.useEffect(() => {
3484
- devtools.setErrorTypes(errorTypes || []);
3485
- }, [errorTypes, devtools]);
3486
- React.useEffect(() => {
3487
- if (ref.current) {
3488
- devtools.mount(ref.current);
3489
- }
3490
- return () => {
3491
- devtools.unmount();
3492
- };
3493
- }, [devtools]);
3494
- return /* @__PURE__ */ jsx("div", { className: "tsqd-parent-container", ref });
3495
- }
3496
-
3497
- var ReactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
3498
- return null;
3499
- } : ReactQueryDevtools;
3500
-
3501
- /* eslint-disable @bigbinary/neeto/api-connector-name-should-match-filename */
3502
- const queryClient = new QueryClient({
3503
- queryCache: new QueryCache(),
3504
- defaultOptions: {
3505
- queries: {
3506
- staleTime: DEFAULT_STALE_TIME,
3507
- placeholderData: keepPreviousData
3508
- }
3509
- }
3510
- });
3511
-
3512
- /* eslint-disable sonarjs/prefer-immediate-return */
3513
- const withReactQuery = Component => {
3514
- const QueryWrapper = props => /*#__PURE__*/React__default.createElement(QueryClientProvider, {
3515
- client: queryClient
3516
- }, /*#__PURE__*/React__default.createElement(Component, props), /*#__PURE__*/React__default.createElement(ReactQueryDevtools2, {
3517
- initialIsOpen: false,
3518
- position: "bottom"
3519
- }));
3520
- return QueryWrapper;
3521
- };
3522
-
3523
- const processSortProperties = sortProperties => {
3524
- if (sortProperties.sortBy === "payment_amount") {
3525
- return assoc("sortBy", "neeto_payments_engine_stripe_transactions.amount", sortProperties);
3526
- }
3527
- if (sortProperties.sortBy === "email" || sortProperties.sortBy === "first_name") {
3528
- return modify("sortBy", concat("users."), sortProperties);
3529
- }
3530
- if (sortProperties.sortBy === "payable,ends_at") {
3531
- return assoc("sortBy", "bookings.ends_at", sortProperties);
3532
- }
3533
- return sortProperties;
3534
- };
3535
- const buildDefaultPageProperties = tabs => tabs.reduce((pageProperties, tab) => ({
3536
- ...pageProperties,
3537
- [tab]: DEFAULT_PAGE_VALUES
3538
- }), {});
3539
- const buildPayload = _ref => {
3540
- let {
3541
- tab,
3542
- filters,
3543
- pageProperties,
3544
- sortProperties = {},
3545
- payoutId = null
3546
- } = _ref;
3547
- return {
3548
- tab: camelToSnakeCase(tab),
3549
- payoutId,
3550
- page: pageProperties[tab]?.page,
3551
- pageSize: pageProperties[tab]?.pageSize,
3552
- filters,
3553
- ...processSortProperties(sortProperties)
3554
- };
3555
- };
3556
- const buildRowData = _ref2 => {
3557
- let {
3558
- data,
3559
- pageProperties = {},
3560
- tab = "all"
3561
- } = _ref2;
3562
- return data.map((element, index) => ({
3563
- ...element,
3564
- payable: element.payable,
3565
- identifier: element,
3566
- id: isEmpty(pageProperties) ? index + 1 : pageProperties[tab]?.pageSize * (pageProperties[tab]?.page - 1) + index + 1
3567
- }));
3568
- };
3569
-
3570
- var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
3571
-
3572
- var css = ".ant-table-cell-row-hover .identifier-copy-button{visibility:visible!important}";
3573
- n(css,{});
3574
-
3575
- const CopyButtonWrapper = _ref => {
3576
- let {
3577
- content,
3578
- children
3579
- } = _ref;
3580
- return /*#__PURE__*/React__default.createElement("div", {
3581
- className: "flex items-center space-x-2"
3582
- }, children, isPresent(content) && /*#__PURE__*/React__default.createElement("div", {
3583
- className: "identifier-copy-button invisible"
3584
- }, /*#__PURE__*/React__default.createElement(CopyToClipboardButton, {
3585
- size: "small",
3586
- style: "text",
3587
- value: content
3588
- })));
3589
- };
3590
-
3591
- const getTagStyle = status => TAG_STYLE[status] || DEFAULT_TAG_STYLE;
3592
- const preProcessStatus = function (type, status) {
3593
- let record = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3594
- if (type === "transaction" || type === "payment") {
3595
- return record.isRefunded ? "refunded" : status;
3596
- }
3597
- if (status === "voided") {
3598
- return "incomplete";
3599
- }
3600
- return snakeToCamelCase(status);
3601
- };
3602
- const renderStatus = curry((type, status, record) => {
3603
- const processedStatus = preProcessStatus(type, status, record);
3604
- return /*#__PURE__*/React__default.createElement(Tooltip, {
3605
- content: t$1(`neetoPayments.tooltipContent.${type}.${processedStatus}`),
3606
- position: "top"
3607
- }, /*#__PURE__*/React__default.createElement("div", {
3608
- className: "w-fit"
3609
- }, /*#__PURE__*/React__default.createElement(Tag, {
3610
- label: t$1(`neetoPayments.tagLabels.${type}.${processedStatus}`),
3611
- style: getTagStyle(processedStatus)
3612
- })));
3613
- });
3614
- const renderFullName = (_, _ref) => {
3615
- let {
3616
- firstName,
3617
- lastName
3618
- } = _ref;
3619
- return `${firstName} ${lastName}`;
3620
- };
3621
- const renderEmail = email => /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
3622
- content: email
3623
- }, /*#__PURE__*/React__default.createElement(Button, {
3624
- href: `mailto:${email}`,
3625
- label: email,
3626
- style: "link"
3627
- }));
3628
- const renderDate = date => /*#__PURE__*/React__default.createElement(DateFormat.DateTime, {
3629
- date
3630
- });
3631
-
3632
- export { $TRACK as $, onMount as A, insert as B, CopyButtonWrapper as C, className as D, getQueryStatusColor as E, getMutationStatusColor as F, spread as G, getQueryStatusColorByLabel as H, displayValue as I, For as J, batch as K, Dynamic as L, template as M, Index as N, updateNestedDataByPath as O, Portal as P, use as Q, convertRemToPixels as R, Show as S, getSidedProp as T, getQueryStatusLabel as U, untrack as V, createRoot as W, createComputed as X, addEventListener as Y, stringify as Z, Match as _, renderFullName as a, Switch as a0, deleteNestedDataByPath as a1, clearDelegatedEvents as a2, useTransition as a3, renderEmail as b, renderDate as c, buildDefaultPageProperties as d, buildPayload as e, buildRowData as f, createSignal as g, delegateEvents as h, createEffect as i, createComponent as j, mergeProps as k, splitProps as l, mutationSortFns as m, n, createMemo as o, createContext as p, createRenderEffect as q, renderStatus as r, sortFns as s, setAttribute as t, useContext as u, createUniqueId as v, withReactQuery as w, on as x, onCleanup as y, getPreferredColorScheme as z };
3633
- //# sourceMappingURL=renderFunctions-97b121a4.js.map