@entropic-bond/crud-panel 4.4.4 → 4.4.6

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.
@@ -1,2383 +1,2188 @@
1
- class Se {
2
- constructor() {
3
- this.subscribers = /* @__PURE__ */ new Set();
4
- }
5
- /**
6
- * Subscribes a listener callback function. On every notification,
7
- * the listener callback will be called with an event as a parameter if sent.
8
- *
9
- * @param callback the listener callback
10
- * @returns a function to unsubscribe the listener from further notifications
11
- */
12
- subscribe(t) {
13
- return this.subscribers.add(t), () => this.unsubscribe(t);
14
- }
15
- /**
16
- * Removes the callback from the notification list.
17
- *
18
- * @param listenerCallback the listener callback to remove
19
- */
20
- unsubscribe(t) {
21
- this.subscribers.delete(t);
22
- }
23
- /**
24
- * Notifies all the subscribers with the event passed as parameter.
25
- *
26
- * @param event the event passed to all subscribers.
27
- */
28
- notify(t) {
29
- this.subscribers.forEach((s) => s(t));
30
- }
31
- /**
32
- * Returns the number of subscribers.
33
- *
34
- * @returns the number of subscribers
35
- * @example
36
- * const observable = new Observable<number>()
37
- * observable.subscribe( event => console.log( event ) )
38
- * observable.subscribe( event => console.log( event ) )
39
- * observable.subscribe( event => console.log( event ) )
40
- * console.log( observable.subscribersCount ) // 3
41
- */
42
- get subscribersCount() {
43
- return this.subscribers.size;
44
- }
1
+ //#region \0rolldown/runtime.js
2
+ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = class {
3
+ constructor() {
4
+ this.subscribers = /* @__PURE__ */ new Set();
5
+ }
6
+ subscribe(e) {
7
+ return this.subscribers.add(e), () => this.unsubscribe(e);
8
+ }
9
+ unsubscribe(e) {
10
+ this.subscribers.delete(e);
11
+ }
12
+ notify(e) {
13
+ this.subscribers.forEach((t) => t(e));
14
+ }
15
+ get subscribersCount() {
16
+ return this.subscribers.size;
17
+ }
18
+ }, n = [];
19
+ for (let e = 0; e < 256; ++e) n.push((e + 256).toString(16).slice(1));
20
+ function r(e, t = 0) {
21
+ return (n[e[t + 0]] + n[e[t + 1]] + n[e[t + 2]] + n[e[t + 3]] + "-" + n[e[t + 4]] + n[e[t + 5]] + "-" + n[e[t + 6]] + n[e[t + 7]] + "-" + n[e[t + 8]] + n[e[t + 9]] + "-" + n[e[t + 10]] + n[e[t + 11]] + n[e[t + 12]] + n[e[t + 13]] + n[e[t + 14]] + n[e[t + 15]]).toLowerCase();
45
22
  }
46
- const j = [];
47
- for (let n = 0; n < 256; ++n)
48
- j.push((n + 256).toString(16).slice(1));
49
- function lt(n, t = 0) {
50
- return (j[n[t + 0]] + j[n[t + 1]] + j[n[t + 2]] + j[n[t + 3]] + "-" + j[n[t + 4]] + j[n[t + 5]] + "-" + j[n[t + 6]] + j[n[t + 7]] + "-" + j[n[t + 8]] + j[n[t + 9]] + "-" + j[n[t + 10]] + j[n[t + 11]] + j[n[t + 12]] + j[n[t + 13]] + j[n[t + 14]] + j[n[t + 15]]).toLowerCase();
23
+ var i, a = /* @__PURE__ */ new Uint8Array(16);
24
+ function o() {
25
+ if (!i) {
26
+ if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
27
+ i = crypto.getRandomValues.bind(crypto);
28
+ }
29
+ return i(a);
51
30
  }
52
- let ke;
53
- const ft = new Uint8Array(16);
54
- function dt() {
55
- if (!ke) {
56
- if (typeof crypto > "u" || !crypto.getRandomValues)
57
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
58
- ke = crypto.getRandomValues.bind(crypto);
59
- }
60
- return ke(ft);
31
+ var s = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
32
+ function c(e, t, n) {
33
+ e ||= {};
34
+ let i = e.random ?? e.rng?.() ?? o();
35
+ if (i.length < 16) throw Error("Random bytes length must be >= 16");
36
+ if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, t) {
37
+ if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
38
+ for (let e = 0; e < 16; ++e) t[n + e] = i[e];
39
+ return t;
40
+ }
41
+ return r(i);
61
42
  }
62
- const ht = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Be = { randomUUID: ht };
63
- function pt(n, t, s) {
64
- n = n || {};
65
- const a = n.random ?? n.rng?.() ?? dt();
66
- if (a.length < 16)
67
- throw new Error("Random bytes length must be >= 16");
68
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, lt(a);
43
+ function l(e, t, n) {
44
+ return s.randomUUID && !t && !e ? s.randomUUID() : c(e, t, n);
69
45
  }
70
- function mt(n, t, s) {
71
- return Be.randomUUID && !n ? Be.randomUUID() : pt(n);
46
+ function u(e, t, n, r) {
47
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
48
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
49
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
50
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
72
51
  }
73
- var _t = Object.defineProperty, yt = (n, t, s, a) => {
74
- for (var c = void 0, p = n.length - 1, O; p >= 0; p--)
75
- (O = n[p]) && (c = O(t, s, c) || c);
76
- return c && _t(t, s, c), c;
77
- }, A;
78
- const tt = (A = class {
79
- /**
80
- * Registers a class to be used by the persistence engine.
81
- * @param className the name of the class to be registered
82
- * @param factory the constructor of the registered class
83
- * @param annotation an annotation associated with the class
84
- */
85
- static registerFactory(n, t, s, a = !1) {
86
- this._factoryMap[n] = { factory: t, annotation: s, isLegacy: a };
87
- }
88
- /**
89
- * Returns the constructor of a registered class
90
- * @param className the name of the class to be retrieved
91
- * @returns the constructor of the class
92
- * @throws an error if the class is not registered
93
- * @see registerFactory
94
- * @see registeredClasses
95
- * @see classesExtending
96
- * @see annotations
97
- */
98
- static classFactory(n) {
99
- if (!n) throw new Error("You should provide a class name.");
100
- if (!this._factoryMap[n]) throw new Error(`You should register class ${n} prior to use.`);
101
- return this._factoryMap[n].factory;
102
- }
103
- /**
104
- * Returns the names of all registered classes
105
- * @returns the names of all registered classes
106
- * @see registerFactory
107
- * @see classFactory
108
- */
109
- static registeredClasses() {
110
- return Object.entries(this._factoryMap).filter(([, n]) => !n.isLegacy).map(([n]) => n);
111
- }
112
- /**
113
- * Returns the names of all registered classes, including legacy names
114
- * @returns the names of all registered classes, including legacy names
115
- * @see registerFactory
116
- * @see classFactory
117
- */
118
- static registeredClassesAndLegacyNames() {
119
- return Object.keys(this._factoryMap);
120
- }
121
- /**
122
- * Returns the names of all registered classes that extend a given class
123
- * @param derivedFrom the parent class to be queried
124
- * @returns the names of all registered classes that extend the given class
125
- * @see registerFactory
126
- * @see classFactory
127
- */
128
- static classesExtending(n) {
129
- return Object.entries(this._factoryMap).filter(([, t]) => new t.factory() instanceof n && !t.isLegacy).map(([t]) => t);
130
- }
131
- /**
132
- * Returns the annotation associated with a registered class
133
- * @param className the name of the class to be retrieved
134
- * @returns the annotation associated with the class
135
- * @throws an error if the class is not registered
136
- * @see registerFactory
137
- */
138
- static annotations(n) {
139
- if (n instanceof A ? n = n.className : typeof n == "string" || (n = new n().className), !this._factoryMap[n]) throw new Error(`You should register class ${n} prior to use.`);
140
- return this._factoryMap[n].annotation;
141
- }
142
- /**
143
- * Returns a new instance of Persistent class.
144
- * @param className the initial id of this instance. If not provided, a new id will be generated
145
- */
146
- constructor(n = mt()) {
147
- this._id = n;
148
- }
149
- /**
150
- * Gets the class name of this instance.
151
- */
152
- get className() {
153
- return this.__className;
154
- }
155
- /**
156
- * Sets the id of this instance.
157
- * @param value the id of this instance
158
- */
159
- setId(n) {
160
- this._id = n;
161
- }
162
- /**
163
- * Returns the id of this instance.
164
- * @returns the id of this instance
165
- */
166
- get id() {
167
- return this._id;
168
- }
169
- /**
170
- * This method is called by the persistence engine when the instance has been
171
- * just serialized. It is called after the properties are initialized with
172
- * serialized data.
173
- */
174
- afterDeserialize() {
175
- }
176
- /**
177
- * This method is called by the persistence engine before the instance is
178
- * serialized.
179
- */
180
- beforeSerialize() {
181
- }
182
- /**
183
- * Returns an array of the persistent properties of this instance.
184
- * @returns an array of the persistent properties of this instance
185
- */
186
- getPersistentProperties() {
187
- return this._persistentProperties ? this._persistentProperties.map((n) => ({
188
- ...n,
189
- name: n.name.slice(1)
190
- })) : [];
191
- }
192
- /**
193
- * Get the property information of this instance
194
- * @param propName the persistent property name
195
- * @returns the property information
196
- */
197
- getPropInfo(n) {
198
- const t = this.getPersistentProperties().find((s) => s.name === n);
199
- if (!t) throw new Error(`Property "${n}" has not been registered.`);
200
- return t;
201
- }
202
- /**
203
- * Query if the property is required
204
- * To mark a property as required, use the @required decorator
205
- * @param propName the persistent property name
206
- * @returns true if the property is required
207
- * @see required
208
- */
209
- isRequired(n) {
210
- return this.getPropInfo(n).validator != null;
211
- }
212
- /**
213
- * Query if the property value is valid
214
- * Define the validator function using the @required decorator
215
- * @param propName the persistent property name
216
- * @returns true if the property value is valid using the validator function
217
- * passed to the @required decorator
218
- * @see required
219
- */
220
- isPropValueValid(n) {
221
- const t = this.getPropInfo(n);
222
- return t.validator ? t.validator(this[t.name], t, this) : !0;
223
- }
224
- /**
225
- * Copy the persistent properties of the given instance to this instance.
226
- * The property `id` will be ignored.
227
- * Only the properties that are not null or undefined will be copied.
228
- * @param instance the instance to be copied
229
- * @returns this instance
230
- * @see fromObject
231
- * @see toObject
232
- */
233
- clone(n) {
234
- const t = n.toObject();
235
- return delete t.id, this.fromObject(t);
236
- }
237
- /**
238
- * Initializes the persistent properties of this instance from the properties
239
- * of given object.
240
- * @param obj the object to be copied
241
- * @returns this instance
242
- * @see clone
243
- * @see toObject
244
- */
245
- fromObject(n) {
246
- return this.fromObj(n), this.afterDeserialize(), this;
247
- }
248
- fromObj(n) {
249
- return this._persistentProperties ? (this._persistentProperties.forEach((t) => {
250
- const s = this.removeUnderscore(t), a = n[s];
251
- a != null && (this[t.name] = this.fromDeepObject(a));
252
- }), this) : this;
253
- }
254
- /**
255
- * Returns a plain object representation of this instance.
256
- * Only the properties that are not null or undefined will be copied.
257
- * @returns a plain object representation of this instance
258
- * @see fromObject
259
- * @see clone
260
- */
261
- toObject() {
262
- const n = {}, t = this.toObj(n);
263
- return this.pushDocument(n, this.className, t), {
264
- ...t,
265
- __rootCollections: n
266
- };
267
- }
268
- toObj(n) {
269
- if (!this._persistentProperties) return {};
270
- this.beforeSerialize();
271
- const t = {};
272
- if (!this.className) throw new Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
273
- return this._persistentProperties.forEach((s) => {
274
- const a = this[s.name], c = this.removeUnderscore(s);
275
- a != null && (s.isReference ? t[c] = this.toReferenceObj(s, n) : t[c] = this.toDeepObj(a, n), s.searchableArray && (t[A.searchableArrayNameFor(c)] = a.map((p) => p.id)));
276
- }), t.__className = this.className, t;
277
- }
278
- static searchableArrayNameFor(n) {
279
- return `__${n}_searchable`;
280
- }
281
- fromDeepObject(n) {
282
- if (n == null) return n;
283
- if (Array.isArray(n))
284
- return n.map((t) => this.fromDeepObject(t));
285
- if (n.__documentReference) {
286
- const t = n, s = A.createInstance(t);
287
- return s.__documentReference = n.__documentReference, s;
288
- }
289
- if (n.__className)
290
- return A.createInstance(n);
291
- if (typeof n == "object") {
292
- const t = {};
293
- return Object.entries(n).forEach(
294
- ([s, a]) => t[s] = this.fromDeepObject(a)
295
- ), t;
296
- }
297
- return n;
298
- }
299
- toDeepObj(n, t) {
300
- if (n != null) {
301
- if (Array.isArray(n))
302
- return n.map((s) => this.toDeepObj(s, t));
303
- if (n.__documentReference) return n;
304
- if (n instanceof A)
305
- return n.toObj(t);
306
- if (typeof n == "object") {
307
- const s = {};
308
- return Object.entries(n).forEach(
309
- ([a, c]) => s[a] = this.toDeepObj(c, t)
310
- ), s;
311
- }
312
- return n;
313
- }
314
- }
315
- static collectionPath(n, t, s) {
316
- let a;
317
- return typeof t.storeInCollection == "function" ? a = t.storeInCollection(n, t, s) : a = t.storeInCollection ?? n.className, a;
318
- }
319
- toReferenceObj(n, t) {
320
- const s = this[n.name];
321
- return Array.isArray(s) ? s.map((a) => (n.isPureReference || this.pushDocument(t, A.collectionPath(a, n), a), this.buildRefObject(a, A.collectionPath(a, n), n.cachedProps))) : (n.isPureReference || this.pushDocument(t, A.collectionPath(s, n), s), this.buildRefObject(s, A.collectionPath(s, n), n.cachedProps));
322
- }
323
- buildRefObject(n, t, s) {
324
- const a = s?.reduce((c, p) => (n[p] !== void 0 && (c[p] = n[p]), c), {});
325
- return {
326
- id: n.id,
327
- __className: n.className || n.__className,
328
- __documentReference: {
329
- storedInCollection: t
330
- },
331
- ...a
332
- };
333
- }
334
- pushDocument(n, t, s) {
335
- if ("__documentReference" in s && s.__documentReference) return;
336
- n[t] || (n[t] = []);
337
- const a = this.toDeepObj(s, n);
338
- n[t].push(a);
339
- }
340
- removeUnderscore(n) {
341
- return n.name.slice(1);
342
- }
343
- static createReference(n) {
344
- const t = A.createInstance(n);
345
- return t.__documentReference = n.__documentReference || { storedInCollection: t.className }, t;
346
- }
347
- static createInstance(n) {
348
- if (typeof n == "string")
349
- return new (A.classFactory(n))();
350
- try {
351
- return new (A.classFactory(n.__className))().fromObject(n);
352
- } catch (t) {
353
- const s = Object.entries(n).filter(([a, c]) => c != null && typeof c != "function").map(([a, c]) => `${a}: ${c}`).join(`,
354
- `);
355
- throw new Error(`${t}
356
- -----> Class name not found in object:
357
- {
358
- ${s}
359
- }
360
- `);
361
- }
362
- }
363
- static propInfo(n, t) {
364
- return A.createInstance(n).getPropInfo(t);
365
- }
366
- /**
367
- * Return the type of a persistent property.
368
- * Several strategies are used to determine the type:
369
- * - If the typeName is defined in the property info a decorator, it is used
370
- * - If the property value is an array, the type of the first element is used
371
- * - If the property value is a Persistent instance, its class name is used
372
- * - Otherwise, the typeof operator is used to determine the type
373
- * @param propInfo the persistent property info to retrieve the type
374
- * @returns the type of the property or the type of the first element if the property is an array or undefined if cannot be determined
375
- */
376
- static propType(n) {
377
- if (n.typeName) return Array.isArray(n.typeName) ? "undefined[]" : n.typeName ?? "undefined";
378
- const t = A.createInstance(n.ownerClassName())[n.name];
379
- if (Array.isArray(t)) {
380
- if (t.length === 0) return "undefined[]";
381
- const s = t[0];
382
- return s instanceof A ? s.className + "[]" : typeof s + "[]";
383
- } else
384
- return t instanceof A ? t.className : typeof t;
385
- }
386
- /**
387
- * Retrieves a collection of references with the properties that are stored in the reference object
388
- * @returns the references collection
389
- */
390
- static getSystemRegisteredReferencesWithCachedProps() {
391
- return A.registeredClasses().reduce((n, t) => {
392
- const s = A.createInstance(t).getPersistentProperties().filter(
393
- (a) => a.cachedProps
394
- );
395
- return s.length > 0 && (n[t] = s), n;
396
- }, {});
397
- }
398
- }, A._factoryMap = {}, A);
399
- yt([
400
- he
401
- ], tt.prototype, "_id");
402
- let rt = tt;
403
- function he(n, t) {
404
- return gt()(n, t);
52
+ var d = class e {
53
+ static registerFactory(e, t, n, r = !1) {
54
+ this._factoryMap[e] = {
55
+ factory: t,
56
+ annotation: n,
57
+ isLegacy: r
58
+ };
59
+ }
60
+ static classFactory(e) {
61
+ if (!e) throw Error("You should provide a class name.");
62
+ if (!this._factoryMap[e]) throw Error(`You should register class ${e} prior to use.`);
63
+ return this._factoryMap[e].factory;
64
+ }
65
+ static registeredClasses() {
66
+ return Object.entries(this._factoryMap).filter(([, e]) => !e.isLegacy).map(([e]) => e);
67
+ }
68
+ static registeredClassesAndLegacyNames() {
69
+ return Object.keys(this._factoryMap);
70
+ }
71
+ static classesExtending(e) {
72
+ return Object.entries(this._factoryMap).filter(([, t]) => new t.factory() instanceof e && !t.isLegacy).map(([e]) => e);
73
+ }
74
+ static isInstanceOf(t, n) {
75
+ let r = e.classFactory(n);
76
+ return t instanceof e ? t instanceof r : e.createInstance(t) instanceof r;
77
+ }
78
+ static annotations(t) {
79
+ if (t instanceof e ? t = t.className : typeof t == "string" || (t = new t().className), !this._factoryMap[t]) throw Error(`You should register class ${t} prior to use.`);
80
+ return this._factoryMap[t].annotation;
81
+ }
82
+ constructor(e = l()) {
83
+ this._id = e;
84
+ }
85
+ get className() {
86
+ return this.__className;
87
+ }
88
+ setId(e) {
89
+ this._id = e;
90
+ }
91
+ get id() {
92
+ return this._id;
93
+ }
94
+ afterDeserialize() {}
95
+ beforeSerialize() {}
96
+ getPersistentProperties() {
97
+ return this._persistentProperties ? this._persistentProperties.map((e) => ({
98
+ ...e,
99
+ name: e.name.slice(1)
100
+ })) : [];
101
+ }
102
+ getPropInfo(e) {
103
+ let t = this.getPersistentProperties().find((t) => t.name === e);
104
+ if (!t) throw Error(`Property "${e}" has not been registered.`);
105
+ return t;
106
+ }
107
+ isRequired(e) {
108
+ return this.getPropInfo(e).validator != null;
109
+ }
110
+ isPropValueValid(e) {
111
+ let t = this.getPropInfo(e);
112
+ return t.validator ? t.validator(this[t.name], t, this) : !0;
113
+ }
114
+ clone(e) {
115
+ let t = e.toObject();
116
+ return delete t.id, this.fromObject(t);
117
+ }
118
+ fromObject(e) {
119
+ return this.fromObj(e), this.afterDeserialize(), this;
120
+ }
121
+ fromObj(e) {
122
+ return this._persistentProperties && this._persistentProperties.forEach((t) => {
123
+ let n = e[this.removeUnderscore(t)];
124
+ n != null && (this[t.name] = this.fromDeepObject(n));
125
+ }), this;
126
+ }
127
+ toObject() {
128
+ let e = {}, t = this.toObj(e);
129
+ return this.pushDocument(e, this.className, t), {
130
+ ...t,
131
+ __rootCollections: e
132
+ };
133
+ }
134
+ toObj(t) {
135
+ if (!this._persistentProperties) return {};
136
+ this.beforeSerialize();
137
+ let n = {};
138
+ if (!this.className) throw Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
139
+ return this._persistentProperties.forEach((r) => {
140
+ let i = this[r.name], a = this.removeUnderscore(r);
141
+ i != null && (r.isReference ? n[a] = this.toReferenceObj(r, t) : n[a] = this.toDeepObj(i, t), r.searchableArray && (n[e.searchableArrayNameFor(a)] = i.map((e) => e.id)));
142
+ }), n.__className = this.className, n;
143
+ }
144
+ static searchableArrayNameFor(e) {
145
+ return `__${e}_searchable`;
146
+ }
147
+ fromDeepObject(t) {
148
+ if (t == null) return t;
149
+ if (Array.isArray(t)) return t.map((e) => this.fromDeepObject(e));
150
+ if (t.__documentReference) {
151
+ let n = t, r = e.createInstance(n);
152
+ return r.__documentReference = t.__documentReference, r;
153
+ }
154
+ if (t.__className) return e.createInstance(t);
155
+ if (typeof t == "object") {
156
+ let e = {};
157
+ return Object.entries(t).forEach(([t, n]) => e[t] = this.fromDeepObject(n)), e;
158
+ }
159
+ return t;
160
+ }
161
+ toDeepObj(t, n) {
162
+ if (t != null) {
163
+ if (Array.isArray(t)) return t.map((e) => this.toDeepObj(e, n));
164
+ if (t.__documentReference) return t;
165
+ if (t instanceof e) return t.toObj(n);
166
+ if (typeof t == "object") {
167
+ let e = {};
168
+ return Object.entries(t).forEach(([t, r]) => e[t] = this.toDeepObj(r, n)), e;
169
+ }
170
+ return t;
171
+ }
172
+ }
173
+ static collectionPath(e, t, n) {
174
+ let r;
175
+ return r = typeof t.storeInCollection == "function" ? t.storeInCollection(e, t, n) : t.storeInCollection ?? e.className, r;
176
+ }
177
+ toReferenceObj(t, n) {
178
+ let r = this[t.name];
179
+ return Array.isArray(r) ? r.map((r) => (t.isPureReference || this.pushDocument(n, e.collectionPath(r, t), r), this.buildRefObject(r, e.collectionPath(r, t), t.cachedProps))) : (t.isPureReference || this.pushDocument(n, e.collectionPath(r, t), r), this.buildRefObject(r, e.collectionPath(r, t), t.cachedProps));
180
+ }
181
+ buildRefObject(e, t, n) {
182
+ let r = n?.reduce((t, n) => (e[n] !== void 0 && (t[n] = e[n]), t), {});
183
+ return {
184
+ id: e.id,
185
+ __className: e.className || e.__className,
186
+ __documentReference: { storedInCollection: t },
187
+ ...r
188
+ };
189
+ }
190
+ pushDocument(e, t, n) {
191
+ if ("__documentReference" in n && n.__documentReference) return;
192
+ e[t] || (e[t] = []);
193
+ let r = this.toDeepObj(n, e);
194
+ e[t].push(r);
195
+ }
196
+ removeUnderscore(e) {
197
+ return e.name.slice(1);
198
+ }
199
+ static createReference(t) {
200
+ let n = e.createInstance(t);
201
+ return n.__documentReference = t.__documentReference || { storedInCollection: n.className }, n;
202
+ }
203
+ static createInstance(t) {
204
+ if (typeof t == "string") return new (e.classFactory(t))();
205
+ try {
206
+ return new (e.classFactory(t.__className))().fromObject(t);
207
+ } catch (e) {
208
+ let n = Object.entries(t).filter(([e, t]) => t != null && typeof t != "function").map(([e, t]) => `${e}: ${t}`).join(",\n ");
209
+ throw Error(`${e}\n-----> Class name not found in object:\n{\n\t ${n} \n}\n`);
210
+ }
211
+ }
212
+ static propInfo(t, n) {
213
+ return e.createInstance(t).getPropInfo(n);
214
+ }
215
+ static propType(t) {
216
+ if (t.typeName) return Array.isArray(t.typeName) ? "undefined[]" : t.typeName ?? "undefined";
217
+ let n = e.createInstance(t.ownerClassName())[t.name];
218
+ if (Array.isArray(n)) {
219
+ if (n.length === 0) return "undefined[]";
220
+ let t = n[0];
221
+ return t instanceof e ? t.className + "[]" : typeof t + "[]";
222
+ } else if (n instanceof e) return n.className;
223
+ else return typeof n;
224
+ }
225
+ static getSystemRegisteredReferencesWithCachedProps() {
226
+ return e.registeredClasses().reduce((t, n) => {
227
+ let r = e.createInstance(n).getPersistentProperties().filter((e) => e.cachedProps);
228
+ return r.length > 0 && (t[n] = r), t;
229
+ }, {});
230
+ }
231
+ static {
232
+ this._factoryMap = {};
233
+ }
234
+ };
235
+ u([f], d.prototype, "_id", void 0);
236
+ function f(e, t) {
237
+ return p()(e, t);
405
238
  }
406
- function gt(n) {
407
- return function(t, s) {
408
- Object.getOwnPropertyDescriptor(t, "_persistentProperties") || (t._persistentProperties ? t._persistentProperties = [...t._persistentProperties] : t._persistentProperties = []);
409
- const a = t._persistentProperties.find((c) => c.name === s);
410
- a ? Object.assign(a, n) : t._persistentProperties.push({
411
- name: s,
412
- ownerClassName: () => t.className,
413
- ...n
414
- });
415
- };
239
+ function p(e) {
240
+ return function(t, n) {
241
+ Object.getOwnPropertyDescriptor(t, "_persistentProperties") || (t._persistentProperties ? t._persistentProperties = [...t._persistentProperties] : t._persistentProperties = []);
242
+ let r = t._persistentProperties.find((e) => e.name === n);
243
+ r ? Object.assign(r, e) : t._persistentProperties.push({
244
+ name: n,
245
+ ownerClassName: () => t.className,
246
+ ...e
247
+ });
248
+ };
416
249
  }
417
- function vt(n, t) {
418
- return (s) => {
419
- rt.registerFactory(n, s, t), s.prototype.__className = n;
420
- };
250
+ function m(e, t) {
251
+ return (n) => {
252
+ d.registerFactory(e, n, t), n.prototype.__className = e;
253
+ };
421
254
  }
422
- const nt = class de {
423
- static registerCloudStorage(t, s) {
424
- de._cloudStorageFactoryMap[t] = s;
425
- }
426
- static createInstance(t) {
427
- const s = de._cloudStorageFactoryMap[t];
428
- if (!s)
429
- throw new Error(`You should register the ${t} cloud storage provider prior to use it`);
430
- return s();
431
- }
432
- get className() {
433
- return this.__className;
434
- }
435
- static useCloudStorage(t) {
436
- de._defaultCloudStorage = t;
437
- }
438
- static get defaultCloudStorage() {
439
- if (!de._defaultCloudStorage)
440
- throw new Error("You should define a default cloud storage provider prior to use it");
441
- return de._defaultCloudStorage;
442
- }
255
+ var h = class e {
256
+ static {
257
+ this.error = {
258
+ persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
259
+ invalidQueryOrder: "Cannot add where calls after or calls"
260
+ };
261
+ }
262
+ constructor(t, n, r) {
263
+ if (r) {
264
+ if (!(n instanceof d)) throw Error(e.error.persistentNeedForSubCollection);
265
+ this.collectionName = `${n.className}/${n.id}/${r}`;
266
+ } else this.collectionName = n instanceof d ? n.className : n;
267
+ this._stream = t;
268
+ }
269
+ findById(e, t) {
270
+ return new Promise((n, r) => {
271
+ this._stream.findById(e, this.collectionName).then((e) => {
272
+ e ? (t ? t.fromObject(e) : t = d.createInstance(e), n(t)) : n(void 0);
273
+ }).catch((e) => r(e));
274
+ });
275
+ }
276
+ save(e) {
277
+ let t = e.toObject();
278
+ return this.collectionName !== t.__className && (t.__rootCollections[this.collectionName] = t.__rootCollections[t.__className], delete t.__rootCollections[t.__className]), new Promise((e, n) => {
279
+ this._stream.save(t.__rootCollections).then(() => e()).catch((e) => n(e));
280
+ });
281
+ }
282
+ delete(e) {
283
+ return new Promise((t, n) => {
284
+ this._stream.delete(e, this.collectionName).then(() => t()).catch((e) => n(e));
285
+ });
286
+ }
287
+ find() {
288
+ return new g(this);
289
+ }
290
+ query(e = {}, t) {
291
+ if (t) {
292
+ let n = t instanceof d ? t.className : t;
293
+ e.operations ||= [], e.operations.push({
294
+ property: "__className",
295
+ operator: "==",
296
+ value: n
297
+ });
298
+ }
299
+ return this.mapToInstance(() => this._stream.find(this.preprocessQueryObject(e), this.collectionName));
300
+ }
301
+ count(e) {
302
+ return this._stream.count(e, this.collectionName);
303
+ }
304
+ next(e) {
305
+ return this.mapToInstance(() => this._stream.next(e));
306
+ }
307
+ onDocumentChange(e, t) {
308
+ return this._stream.onDocumentChange(this.collectionName, e, (e) => t(y.toPersistentDocumentChange(e)));
309
+ }
310
+ onCollectionChange(e, t) {
311
+ return this._stream.onCollectionChange(this.preprocessQueryObject(e.getQueryObject()), this.collectionName, (e) => t(e.map((e) => y.toPersistentDocumentChange(e))));
312
+ }
313
+ onCollectionTemplateChange(e, t) {
314
+ return this._stream.onDocumentTemplateChange(e, (e) => t(y.toPersistentDocumentChange(e)));
315
+ }
316
+ mapToInstance(e) {
317
+ return new Promise((t, n) => {
318
+ e().then((e) => t(e.map((e) => d.createInstance(e)))).catch((e) => n(e));
319
+ });
320
+ }
321
+ preprocessQueryObject(e) {
322
+ if (Object.values(e).length === 0) return e;
323
+ let t = e.operations?.map((e) => {
324
+ let t = e.value[0] ?? e.value;
325
+ return y.isArrayOperator(e.operator) && t instanceof d ? {
326
+ property: d.searchableArrayNameFor(e.property),
327
+ operator: e.operator,
328
+ value: Array.isArray(e.value) ? e.value.map((e) => e.id) : t.id,
329
+ aggregate: e.aggregate
330
+ } : {
331
+ property: e.property,
332
+ operator: e.operator,
333
+ value: e.value instanceof d ? { id: e.value.id } : e.value,
334
+ aggregate: e.aggregate
335
+ };
336
+ }) ?? [];
337
+ return {
338
+ ...e,
339
+ operations: t
340
+ };
341
+ }
342
+ }, g = class {
343
+ constructor(e) {
344
+ this.queryObject = { operations: [] }, this.model = e;
345
+ }
346
+ where(e, t, n, r) {
347
+ if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(h.error.invalidQueryOrder);
348
+ return this.queryObject.operations?.push({
349
+ property: e,
350
+ operator: t,
351
+ value: n,
352
+ aggregate: r
353
+ }), this;
354
+ }
355
+ whereDeepProp(e, t, n, r) {
356
+ if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(h.error.invalidQueryOrder);
357
+ let i = e.split("."), a = {}, o = i.length > 1 ? a : n;
358
+ return i.slice(1).forEach((e, t) => {
359
+ a[e] = t < i.length - 2 ? {} : n, a = a[e];
360
+ }), this.queryObject.operations?.push({
361
+ property: i[0],
362
+ operator: t,
363
+ value: o,
364
+ aggregate: r
365
+ }), this;
366
+ }
367
+ and(e, t, n) {
368
+ return this.where(e, t, n);
369
+ }
370
+ andDeepProp(e, t, n) {
371
+ return this.whereDeepProp(e, t, n);
372
+ }
373
+ or(e, t, n) {
374
+ return this.where(e, t, n, !0);
375
+ }
376
+ orDeepProp(e, t, n) {
377
+ return this.whereDeepProp(e, t, n, !0);
378
+ }
379
+ instanceOf(e) {
380
+ let t = e instanceof d ? e.className : e;
381
+ return this.queryObject.operations?.push({
382
+ property: "__className",
383
+ operator: "==",
384
+ value: t
385
+ }), this;
386
+ }
387
+ get(e) {
388
+ return e && (this.queryObject.limit = e), this.model.query(this.queryObject);
389
+ }
390
+ limit(e) {
391
+ return this.queryObject.limit = e, this;
392
+ }
393
+ orderBy(e, t = "asc") {
394
+ return this.queryObject.sort = {
395
+ propertyName: e,
396
+ order: t
397
+ }, this;
398
+ }
399
+ orderByDeepProp(e, t = "asc") {
400
+ return this.queryObject.sort = {
401
+ propertyName: e,
402
+ order: t
403
+ }, this;
404
+ }
405
+ count() {
406
+ return this.model.count(this.queryObject);
407
+ }
408
+ getQueryObject() {
409
+ return this.queryObject;
410
+ }
411
+ getQueryModel() {
412
+ return this.model;
413
+ }
414
+ }, _ = class e {
415
+ constructor() {}
416
+ static {
417
+ this.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
418
+ }
419
+ static useDataSource(e) {
420
+ this._dataSource = e;
421
+ }
422
+ static get dataSource() {
423
+ return e._dataSource;
424
+ }
425
+ static getModel(t) {
426
+ if (!e._dataSource) throw Error(this.error.shouldBeRegistered);
427
+ return new h(e._dataSource, t);
428
+ }
429
+ static getModelForSubCollection(t, n) {
430
+ if (!e._dataSource) throw Error(this.error.shouldBeRegistered);
431
+ return new h(e._dataSource, t, n);
432
+ }
433
+ static async populate(e) {
434
+ if (!e) return;
435
+ let t = async (e) => {
436
+ let t = e;
437
+ if (!t.__documentReference) return e;
438
+ let n = await this.getModel(t.__documentReference.storedInCollection).findById(t.id, e);
439
+ return n && (n.__documentReference = void 0), n;
440
+ };
441
+ return Array.isArray(e) ? (await Promise.all(e.map((e) => t(e)))).filter((e) => e) : t(e);
442
+ }
443
+ static isPopulated(e) {
444
+ return Array.isArray(e) ? e.reduce((e, t) => e && t.__documentReference === void 0, !0) : e.__documentReference === void 0;
445
+ }
446
+ }, v = class e {
447
+ constructor(e) {
448
+ this._resolveCollectionPaths = () => {
449
+ throw Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
450
+ }, this._disabledChangeListeners = /* @__PURE__ */ new Set(), this._collectionsToWatch = {}, e && (this._beforeUpdateDocument = e.beforeUpdateDocument, this._afterUpdateDocument = e.afterUpdateDocument, this._afterDocumentChange = e.afterDocumentChange, this._beforeDocumentChange = e.beforeDocumentChange, this._beforeQueryOwnerCollection = e.beforeQueryOwnerCollection), this.installUpdaters();
451
+ }
452
+ installUpdaters() {
453
+ let e = d.getSystemRegisteredReferencesWithCachedProps();
454
+ this._collectionsToWatch = {}, Object.entries(e).forEach(([e, t]) => {
455
+ t.forEach((t) => {
456
+ t.typeName && (Array.isArray(t.typeName) ? t.typeName : [t?.typeName ?? e]).map((e) => d.collectionPath(d.createInstance(e), t)).forEach((e) => {
457
+ this._collectionsToWatch[e] || (this._collectionsToWatch[e] = []), this._collectionsToWatch[e].find((e) => e.name === t.name && e.ownerClassName() === t.ownerClassName()) || this._collectionsToWatch[e].push(t);
458
+ });
459
+ });
460
+ });
461
+ }
462
+ set beforeDocumentChange(e) {
463
+ this._beforeDocumentChange = e;
464
+ }
465
+ set afterDocumentChange(e) {
466
+ this._afterDocumentChange = e;
467
+ }
468
+ set beforeUpdateDocument(e) {
469
+ this._beforeUpdateDocument = e;
470
+ }
471
+ set afterUpdateDocument(e) {
472
+ this._afterUpdateDocument = e;
473
+ }
474
+ set beforeQueryOwnerCollection(e) {
475
+ this._beforeQueryOwnerCollection = e;
476
+ }
477
+ set resolveCollectionPaths(e) {
478
+ this._resolveCollectionPaths = e;
479
+ }
480
+ get collectionsToWatch() {
481
+ return this._collectionsToWatch;
482
+ }
483
+ updateProps(e, t) {
484
+ let n = this._collectionsToWatch[e];
485
+ return n ? this.onDocumentChange(t, n) : Promise.resolve();
486
+ }
487
+ async onDocumentChange(t, n) {
488
+ let r = y.toPersistentDocumentChange(t);
489
+ this._beforeDocumentChange?.(r, n);
490
+ let i = {};
491
+ t.type !== "update" || !r.before || r.after?.id && this._disabledChangeListeners.has(r.after?.id) || (await Promise.all(n.map(async (t) => {
492
+ let n = e.ownerCollectionPath(d.createInstance(t.ownerClassName()), t, r.params), a = await this._resolveCollectionPaths(n);
493
+ await Promise.all(a.map(async (e) => {
494
+ let n = _.getModel(e), a = n.find(), o = !1;
495
+ t.cachedProps?.forEach((e) => {
496
+ r.before[e] !== r.after[e] && (o = !0);
497
+ }), o && (a = t.searchableArray ? a.where(t.name, "contains", r.before) : a.where(t.name, "==", r.before)), a = this._beforeQueryOwnerCollection?.(a) ?? a;
498
+ let s = await a.get();
499
+ return i[e] = {
500
+ totalDocumentsToUpdate: s.length,
501
+ updatedDocuments: [],
502
+ documentsToUpdate: s.map((e) => e.name ?? e.id)
503
+ }, Promise.all([s.map(async (a) => {
504
+ let o = !1;
505
+ if (t.cachedProps?.forEach((e) => {
506
+ r.before[e] !== r.after[e] && (o = !0);
507
+ }), o) {
508
+ if (t.searchableArray) {
509
+ let e = a[t.name].findIndex((e) => e.id === r.before.id);
510
+ a[t.name][e] = r.after;
511
+ } else a[`_${t.name}`] = r.after;
512
+ this._beforeUpdateDocument?.(a, t, r.after), this.disableChangeListener(a), await n.save(a), this.enableChangeListener(a), i[e]?.updatedDocuments.push(a.id), this._afterUpdateDocument?.(a, t, r.after);
513
+ } else return Promise.resolve();
514
+ })]);
515
+ }));
516
+ })), this._afterDocumentChange?.(i, n));
517
+ }
518
+ disableChangeListener(e) {
519
+ this._disabledChangeListeners.add(e.id);
520
+ }
521
+ enableChangeListener(e) {
522
+ this._disabledChangeListeners.delete(e.id);
523
+ }
524
+ static ownerCollectionPath(e, t, n) {
525
+ let r;
526
+ return r = typeof t.ownerCollection == "function" ? t.ownerCollection(e, t, n) : t.ownerCollection ?? e.className, r;
527
+ }
528
+ }, y = class e {
529
+ constructor() {
530
+ this._cachedPropsUpdater = void 0;
531
+ }
532
+ installCachedPropsUpdater(e) {
533
+ return this._cachedPropsUpdater = new v(e), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater;
534
+ }
535
+ get cachedPropsUpdater() {
536
+ return this._cachedPropsUpdater;
537
+ }
538
+ static toPropertyPathOperations(t) {
539
+ return t ? t.map((t) => {
540
+ if (e.isArrayOperator(t.operator) && t.value[0] instanceof d) return {
541
+ property: d.searchableArrayNameFor(t.property),
542
+ operator: t.operator,
543
+ value: t.value.map((e) => e.id),
544
+ aggregate: t.aggregate
545
+ };
546
+ let [n, r] = this.toPropertyPathValue(t.value);
547
+ return {
548
+ property: `${String(t.property)}${n ? "." + n : ""}`,
549
+ operator: t.operator,
550
+ value: r,
551
+ aggregate: t.aggregate
552
+ };
553
+ }) : [];
554
+ }
555
+ static isArrayOperator(e) {
556
+ return e === "containsAny" || e === "contains";
557
+ }
558
+ static toPersistentDocumentChange(e) {
559
+ return {
560
+ ...e,
561
+ before: e.before && d.createInstance(e.before),
562
+ after: e.after && d.createInstance(e.after)
563
+ };
564
+ }
565
+ static toPropertyPathValue(e) {
566
+ if (typeof e == "object" && !Array.isArray(e)) {
567
+ let t = Object.keys(e)[0], [n, r] = this.toPropertyPathValue(e[t]);
568
+ return [`${t}${n ? "." + n : ""}`, r];
569
+ } else return [void 0, e];
570
+ }
571
+ static isStringMatchingTemplate(e, t) {
572
+ let n = e.split("/"), r = t.split("/");
573
+ if (r.length > n.length) return !1;
574
+ for (let e = 0; e < r.length; e++) {
575
+ let t = n[e], i = r[e];
576
+ if (!(t.startsWith("{") && t.endsWith("}") || t.startsWith("${") && t.endsWith("}")) && t !== i) return !1;
577
+ }
578
+ for (let e = r.length; e < n.length; e++) {
579
+ let t = n[e];
580
+ if (!(t.startsWith("{") && t.endsWith("}") || t.startsWith("${") && t.endsWith("}"))) return !1;
581
+ }
582
+ return !0;
583
+ }
584
+ static extractTemplateParams(e, t) {
585
+ let n = t.split("/"), r = e.split("/"), i = {};
586
+ if (r.length > n.length) return i;
587
+ for (let e = 0; e < r.length; e++) {
588
+ let t = n[e], a = r[e];
589
+ if (t.startsWith("{") && t.endsWith("}")) i[t.slice(1, -1)] = a;
590
+ else if (t.startsWith("${") && t.endsWith("}")) i[t.slice(2, -1)] = a;
591
+ else if (t !== a) return {};
592
+ }
593
+ for (let e = r.length; e < n.length; e++) {
594
+ let t = n[e];
595
+ if (!(t.startsWith("{") && t.endsWith("}") || t.startsWith("${") && t.endsWith("}"))) return {};
596
+ }
597
+ return i;
598
+ }
599
+ }, b = class e {
600
+ static registerCloudStorage(t, n) {
601
+ e._cloudStorageFactoryMap[t] = n;
602
+ }
603
+ static createInstance(t) {
604
+ let n = e._cloudStorageFactoryMap[t];
605
+ if (!n) throw Error(`You should register the ${t} cloud storage provider prior to use it`);
606
+ return n();
607
+ }
608
+ get className() {
609
+ return this.__className;
610
+ }
611
+ static useCloudStorage(t) {
612
+ e._defaultCloudStorage = t;
613
+ }
614
+ static get defaultCloudStorage() {
615
+ if (!e._defaultCloudStorage) throw Error("You should define a default cloud storage provider prior to use it");
616
+ return e._defaultCloudStorage;
617
+ }
618
+ static {
619
+ this._cloudStorageFactoryMap = {};
620
+ }
443
621
  };
444
- nt._cloudStorageFactoryMap = {};
445
- let Ee = nt;
446
- function Et(n, t) {
447
- return Ee.registerCloudStorage(n, t), (s) => {
448
- s.prototype.__className = n;
449
- };
622
+ function x(e, t) {
623
+ return b.registerCloudStorage(e, t), (t) => {
624
+ t.prototype.__className = e;
625
+ };
450
626
  }
451
- var bt = (n, t, s, a) => {
452
- for (var c = t, p = n.length - 1, O; p >= 0; p--)
453
- (O = n[p]) && (c = O(c) || c);
454
- return c;
627
+ var S = class extends b {
628
+ constructor(e = "") {
629
+ super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = e;
630
+ }
631
+ simulateDelay(e) {
632
+ return this._simulateDelay = e, this;
633
+ }
634
+ resolveWithDelay(e) {
635
+ if (this._simulateDelay <= 0) return Promise.resolve(e);
636
+ let t = new Promise((t) => {
637
+ setTimeout(() => t(e), this._simulateDelay);
638
+ });
639
+ return this._pendingPromises.push(t), t.finally(() => this._pendingPromises = this._pendingPromises.filter((e) => e === t)), t;
640
+ }
641
+ save(e, t) {
642
+ let n = e;
643
+ this._onProgress && this._onProgress(0, 100), this.mockFileSystem[e] = JSON.stringify(t), this._onProgress && this._onProgress(100, 100);
644
+ let r = t instanceof File ? t.name : n;
645
+ return this.resolveWithDelay(r);
646
+ }
647
+ uploadControl() {
648
+ return {
649
+ resume: () => {},
650
+ pause: () => {},
651
+ cancel: () => {},
652
+ onProgress: (e) => this._onProgress = e
653
+ };
654
+ }
655
+ getUrl(e) {
656
+ return Promise.resolve(this._pathToMockFiles + e);
657
+ }
658
+ delete(e) {
659
+ return delete this.mockFileSystem[e], this.resolveWithDelay();
660
+ }
455
661
  };
456
- let je = class extends Ee {
457
- constructor(n = "") {
458
- super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = n;
459
- }
460
- /**
461
- * Introduce a delay in the execution of operations to simulate a real data source
462
- * @param miliSeconds the number of milliseconds to delay the execution of operations
463
- * @returns a chainable reference to this object
464
- */
465
- simulateDelay(n) {
466
- return this._simulateDelay = n, this;
467
- }
468
- resolveWithDelay(n) {
469
- if (this._simulateDelay <= 0) return Promise.resolve(n);
470
- const t = new Promise((s) => {
471
- setTimeout(
472
- () => s(n),
473
- this._simulateDelay
474
- );
475
- });
476
- return this._pendingPromises.push(t), t.finally(
477
- () => this._pendingPromises = this._pendingPromises.filter((s) => s === t)
478
- ), t;
479
- }
480
- save(n, t) {
481
- const s = n;
482
- this._onProgress && this._onProgress(0, 100), this.mockFileSystem[n] = JSON.stringify(t), this._onProgress && this._onProgress(100, 100);
483
- const a = t instanceof File ? t.name : s;
484
- return this.resolveWithDelay(a);
485
- }
486
- uploadControl() {
487
- return {
488
- resume: () => {
489
- },
490
- pause: () => {
491
- },
492
- cancel: () => {
493
- },
494
- onProgress: (n) => this._onProgress = n
495
- };
496
- }
497
- getUrl(n) {
498
- return Promise.resolve(this._pathToMockFiles + n);
499
- }
500
- delete(n) {
501
- return delete this.mockFileSystem[n], this.resolveWithDelay();
502
- }
662
+ S = u([x("MockCloudStorage", () => new S())], S);
663
+ var C = /* @__PURE__ */ function(e) {
664
+ return e[e.stored = 0] = "stored", e[e.pendingDataSet = 1] = "pendingDataSet", e[e.deleted = 2] = "deleted", e;
665
+ }({}), w = class extends d {
666
+ constructor(...e) {
667
+ super(...e), this._onChange = new t();
668
+ }
669
+ async save({ data: e, fileName: t, progress: n, cloudStorageProvider: r } = {}) {
670
+ let i = e || this._pendingData;
671
+ i && (this._reference && await this.delete(), this.provider = r || b.defaultCloudStorage, this._originalFileName = t || (i instanceof File ? i.name : void 0), this._reference = await this.provider.save(this.id, i, n), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({
672
+ event: C.stored,
673
+ storedFile: this
674
+ }));
675
+ }
676
+ uploadControl() {
677
+ return this.provider.uploadControl();
678
+ }
679
+ async delete() {
680
+ if (!this._reference) throw Error("Cannot delete a not stored file");
681
+ await this.provider.delete(this._reference), this._reference = void 0, this._url = void 0, this._onChange.notify({
682
+ event: C.deleted,
683
+ storedFile: this
684
+ });
685
+ }
686
+ set provider(e) {
687
+ this._provider = e, this._cloudStorageProviderName = e.className;
688
+ }
689
+ get provider() {
690
+ if (!this._provider) try {
691
+ this._provider = b.createInstance(this._cloudStorageProviderName);
692
+ } catch {
693
+ this._provider = b.defaultCloudStorage;
694
+ }
695
+ return this._provider;
696
+ }
697
+ get url() {
698
+ return this._url;
699
+ }
700
+ get mimeType() {
701
+ return this._mimeType;
702
+ }
703
+ setDataToStore(e) {
704
+ return this._pendingData = e, this._originalFileName = e instanceof File ? e.name : void 0, this._mimeType = e instanceof Blob ? e.type : void 0, this._onChange.notify({
705
+ event: C.pendingDataSet,
706
+ pendingData: e,
707
+ storedFile: this
708
+ }), this;
709
+ }
710
+ get originalFileName() {
711
+ return this._originalFileName;
712
+ }
713
+ onChange(e) {
714
+ return this._onChange.subscribe(e);
715
+ }
503
716
  };
504
- je = bt([
505
- Et("MockCloudStorage", () => new je())
506
- ], je);
507
- var wt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, pe = (n, t, s, a) => {
508
- for (var c = a > 1 ? void 0 : a ? Rt(t, s) : t, p = n.length - 1, O; p >= 0; p--)
509
- (O = n[p]) && (c = (a ? O(t, s, c) : O(c)) || c);
510
- return a && c && wt(t, s, c), c;
717
+ u([f], w.prototype, "_reference", void 0), u([f], w.prototype, "_url", void 0), u([f], w.prototype, "_cloudStorageProviderName", void 0), u([f], w.prototype, "_originalFileName", void 0), u([f], w.prototype, "_mimeType", void 0), w = u([m("StoredFile")], w);
718
+ var T = class {};
719
+ (class e extends T {
720
+ static {
721
+ this.error = { shouldBeRegistered: "You should register an auth service before using Auth." };
722
+ }
723
+ constructor() {
724
+ if (super(), this._onAuthStateChange = new t(), !e._authService) throw Error(e.error.shouldBeRegistered);
725
+ e._authService.onAuthStateChange((e) => this.authStateChanged(e));
726
+ }
727
+ static useAuthService(t) {
728
+ e._authService != t && (e._authService = t, this._instance = void 0);
729
+ }
730
+ static get instance() {
731
+ return this._instance ||= new this();
732
+ }
733
+ signUp(t) {
734
+ return e._authService.signUp(t);
735
+ }
736
+ login(t) {
737
+ return e._authService.login(t);
738
+ }
739
+ logout() {
740
+ return e._authService.logout();
741
+ }
742
+ resetEmailPassword(t) {
743
+ return e._authService.resetEmailPassword(t);
744
+ }
745
+ resendVerificationEmail(t, n, r) {
746
+ return e._authService.resendVerificationEmail(t, n, r);
747
+ }
748
+ refreshToken() {
749
+ return e._authService.refreshToken();
750
+ }
751
+ onAuthStateChange(e) {
752
+ return this._onAuthStateChange.subscribe(e);
753
+ }
754
+ removeAuthStateChange(e) {
755
+ this._onAuthStateChange.unsubscribe(e);
756
+ }
757
+ linkAdditionalProvider(t) {
758
+ return e._authService.linkAdditionalProvider(t);
759
+ }
760
+ unlinkProvider(t) {
761
+ return e._authService.unlinkProvider(t);
762
+ }
763
+ authStateChanged(e) {
764
+ this._onAuthStateChange.notify(e);
765
+ }
766
+ static {
767
+ this._instance = void 0;
768
+ }
769
+ }), class e {
770
+ constructor() {}
771
+ static {
772
+ this.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
773
+ }
774
+ static useCloudFunctionsService(e) {
775
+ this._cloudFunctionsService != e && (this._cloudFunctionsService = e);
776
+ }
777
+ static get instance() {
778
+ if (!this._cloudFunctionsService) throw Error(e.error.shouldBeRegistered);
779
+ return e._instance ||= new e();
780
+ }
781
+ getRawFunction(t) {
782
+ return e._cloudFunctionsService.retrieveFunction(t);
783
+ }
784
+ getFunction(t) {
785
+ let n = e._cloudFunctionsService.callFunction, r = this.getRawFunction(t);
786
+ return async (e) => {
787
+ let t = await n(r, this.processParam(e));
788
+ return this.processResult(t);
789
+ };
790
+ }
791
+ processParam(e) {
792
+ if (e != null) return e instanceof d ? e.toObject() : Array.isArray(e) ? e.map((e) => this.processParam(e)) : typeof e == "object" ? Object.entries(e).reduce((e, [t, n]) => (e[t] = this.processParam(n), e), {}) : e;
793
+ }
794
+ processResult(e) {
795
+ if (e != null) return e.__className ? d.createInstance(e) : Array.isArray(e) ? e.map((e) => this.processResult(e)) : typeof e == "object" ? Object.entries(e).reduce((e, [t, n]) => (e[t] = this.processResult(n), e), {}) : e;
796
+ }
511
797
  };
512
- let ce = class extends rt {
513
- constructor() {
514
- super(...arguments), this._onChange = new Se();
515
- }
516
- async save({ data: n, fileName: t, progress: s, cloudStorageProvider: a } = {}) {
517
- const c = n || this._pendingData;
518
- c && (this._reference && await this.delete(), this.provider = a || Ee.defaultCloudStorage, this._originalFileName = t || (c instanceof File ? c.name : void 0), this._reference = await this.provider.save(this.id, c, s), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({ event: 0, storedFile: this }));
519
- }
520
- uploadControl() {
521
- return this.provider.uploadControl();
522
- }
523
- async delete() {
524
- if (!this._reference) throw new Error("Cannot delete a not stored file");
525
- await this.provider.delete(this._reference), this._reference = void 0, this._url = void 0, this._onChange.notify({ event: 2, storedFile: this });
526
- }
527
- set provider(n) {
528
- this._provider = n, this._cloudStorageProviderName = n.className;
529
- }
530
- get provider() {
531
- if (!this._provider)
532
- try {
533
- this._provider = Ee.createInstance(this._cloudStorageProviderName);
534
- } catch {
535
- this._provider = Ee.defaultCloudStorage;
536
- }
537
- return this._provider;
538
- }
539
- get url() {
540
- return this._url;
541
- }
542
- get mimeType() {
543
- return this._mimeType;
544
- }
545
- setDataToStore(n) {
546
- return this._pendingData = n, this._originalFileName = n instanceof File ? n.name : void 0, this._mimeType = n instanceof Blob ? n.type : void 0, this._onChange.notify({
547
- event: 1,
548
- pendingData: n,
549
- storedFile: this
550
- }), this;
551
- }
552
- get originalFileName() {
553
- return this._originalFileName;
554
- }
555
- onChange(n) {
556
- return this._onChange.subscribe(n);
557
- }
558
- };
559
- pe([
560
- he
561
- ], ce.prototype, "_reference", 2);
562
- pe([
563
- he
564
- ], ce.prototype, "_url", 2);
565
- pe([
566
- he
567
- ], ce.prototype, "_cloudStorageProviderName", 2);
568
- pe([
569
- he
570
- ], ce.prototype, "_originalFileName", 2);
571
- pe([
572
- he
573
- ], ce.prototype, "_mimeType", 2);
574
- ce = pe([
575
- vt("StoredFile")
576
- ], ce);
577
- function Ct(n, t = "-") {
578
- if (!n) return "";
579
- const s = n.slice(1).replace(/( |[A-Z])/g, (a) => a === " " ? "-" : t + a[0].toLowerCase());
580
- return n[0].toLocaleLowerCase() + s.replace(/--/g, "-");
581
- }
582
- class Tt {
583
- constructor() {
584
- this._debug = !1, this._stages = {}, this._onProgress = new Se();
585
- }
586
- notifyBusy(t, s) {
587
- this.pushStage({
588
- name: s ?? "",
589
- progress: t ? 0 : 1,
590
- total: 1
591
- });
592
- }
593
- pushStage(t) {
594
- this._stages[t.name] = t;
595
- const s = Object.values(this._stages).reduce((a, c, p, O) => a + c.progress / c.total / O.length, 0);
596
- this._onProgress.notify({
597
- busy: s < 1,
598
- overallProgress: s,
599
- stages: this._stages
600
- }), s >= 1 && (this._stages = {}), this.debug && console.log(`ProgressController ${t.name}: Progress: ${t.progress} Stages: ${t.total}`);
601
- }
602
- onProgress(t) {
603
- return this._onProgress.subscribe(t);
604
- }
605
- set debug(t) {
606
- this._debug = t;
607
- }
608
- get debug() {
609
- return this._debug;
610
- }
798
+ var E = class {};
799
+ (class e extends E {
800
+ static {
801
+ this.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." };
802
+ }
803
+ constructor() {
804
+ super();
805
+ }
806
+ static useServerAuthService(t) {
807
+ e._authService != t && (e._authService = t, this._instance = void 0);
808
+ }
809
+ static get instance() {
810
+ if (!e._authService) throw Error(e.error.shouldBeRegistered);
811
+ return this._instance ||= new e();
812
+ }
813
+ getUser(t) {
814
+ return e._authService.getUser(t);
815
+ }
816
+ updateUser(t, n) {
817
+ return e._authService.updateUser(t, n);
818
+ }
819
+ setCustomCredentials(t, n) {
820
+ return e._authService.setCustomCredentials(t, n);
821
+ }
822
+ deleteUser(t) {
823
+ return e._authService.deleteUser(t);
824
+ }
825
+ static {
826
+ this._instance = void 0;
827
+ }
828
+ });
829
+ function D(e, t = "-") {
830
+ if (!e) return "";
831
+ let n = e.slice(1).replace(/( |[A-Z])/g, (e) => e === " " ? "-" : t + e[0].toLowerCase());
832
+ return e[0].toLocaleLowerCase() + n.replace(/--/g, "-");
611
833
  }
612
- const ne = class ne {
613
- constructor(t) {
614
- this.progressController = new Tt(), this.onChangeHdl = new Se(), this.onErrorHdl = new Se(), this.validator = {}, this.setDocument(t || this.createDocument());
615
- }
616
- allRequiredPropertiesFilled() {
617
- return this.nonFilledRequiredProperties.length <= 0 && this.validateGlobal();
618
- }
619
- get nonFilledRequiredProperties() {
620
- return this.requiredProperties.filter((t) => this.validateProp(t));
621
- }
622
- get requiredProperties() {
623
- if (!this.document) throw new Error(ne.errorMessages.missedDocument);
624
- const t = this.document.getPersistentProperties().filter((a) => this.document.isRequired(a.name)).map((a) => a.name);
625
- return [...new Set(t.concat(Object.keys(this.validator)))];
626
- }
627
- addValidator(t, s, a) {
628
- this.validator[t] = {
629
- func: s,
630
- errorMessage: a
631
- };
632
- }
633
- removeValidator(t) {
634
- delete this.validator[t];
635
- }
636
- addGlobalValidator(t, s) {
637
- this.globalValidator = {
638
- func: t,
639
- errorMessage: s
640
- };
641
- }
642
- removeGlobalValidator() {
643
- this.globalValidator = void 0;
644
- }
645
- failedValidationError(t) {
646
- if (t) return this.validator[t]?.errorMessage;
647
- const s = this.nonFilledRequiredProperties[0];
648
- return s ? this.validator[s]?.errorMessage : this.globalValidator?.errorMessage;
649
- }
650
- validateProp(t) {
651
- if (!this.document) throw new Error(ne.errorMessages.missedDocument);
652
- const s = this.document[t];
653
- return this.validator[t] ? !this.validator[t].func(s) : !this.document.isPropValueValid(t);
654
- }
655
- validateGlobal() {
656
- if (!this.document) throw new Error(ne.errorMessages.missedDocument);
657
- return this.globalValidator ? this.globalValidator.func(this.document) : !0;
658
- }
659
- storeDoc() {
660
- if (!this.document) throw new Error(ne.errorMessages.missedDocument);
661
- return this.model.save(this.document);
662
- }
663
- deleteDoc() {
664
- if (!this.document) throw new Error(ne.errorMessages.missedDocument);
665
- return this.model.delete(this.document.id);
666
- }
667
- /**
668
- * Override this method to customize the query used to retrieve the documents
669
- * in the documentCollection method. This is the default method used by
670
- * the documentCollection method. If the findDocs method is overridden and returns
671
- * non undefined value, then this queryDocs method will not be used.
672
- *
673
- * @param limit the maximum number of documents to retrieve
674
- * @returns a query to retrieve the documents
675
- * @see documentCollection
676
- * @see findDocs
677
- */
678
- queryDocs(t) {
679
- let s = this.model.find();
680
- return t && (s = s.limit(t)), s;
681
- }
682
- /**
683
- * Override this method to customize the query used to retrieve the documents
684
- * in the documentCollection method. The default method called by the
685
- * documentCollection method is the queryDocs method. If this findDocs method
686
- * returns a non undefined value, then this method will be used instead of the
687
- * queryDocs method.
688
- *
689
- * @param limit the maximum number of documents to retrieve
690
- * @returns a query to retrieve the documents
691
- * @see documentCollection
692
- * @see queryDocs
693
- */
694
- findDocs(t) {
695
- }
696
- /**
697
- * Sets a filter function to filter in memory the documents returned by the `documentCollection` method.
698
- *
699
- * @param filter the filter function
700
- * @returns the controller itself
701
- */
702
- async setFilter(t) {
703
- return this._filter = t, this.onChangeHdl.notify({ action: "filterChange" }), this;
704
- }
705
- /**
706
- * Removes the filter function set by the `setFilter` method.
707
- * @returns the controller itself
708
- */
709
- resetFilter() {
710
- return this._filter = void 0, this.onChangeHdl.notify({ action: "filterChange" }), this;
711
- }
712
- onChange(t) {
713
- return this.onChangeHdl.subscribe(t);
714
- }
715
- /**
716
- * Notifies the observer of any error that occurs during the execution of the controller.
717
- * If there are no subscribers to this event, the error will be thrown.
718
- *
719
- * @param observer
720
- * @returns the unsubscriber function
721
- */
722
- onError(t) {
723
- return this.onErrorHdl.subscribe(t);
724
- }
725
- notifyChange(t) {
726
- this.onChangeHdl.notify(t);
727
- }
728
- newDocument() {
729
- return this.setDocument(this.createDocument());
730
- }
731
- async storeDocument() {
732
- const t = "Saving main document";
733
- try {
734
- this.progressController.notifyBusy(!0, t), await this.storeDoc(), this.onChangeHdl.notify({
735
- documentCollection: await this.documentCollection(),
736
- action: "saved"
737
- });
738
- } catch (s) {
739
- if (this.onChangeHdl.notify({ error: this.errorToError(s) }), this.onErrorHdl.notify(this.errorToError(s)), this.throwOnError) throw s;
740
- } finally {
741
- this.progressController.notifyBusy(!1, t);
742
- }
743
- }
744
- async deleteDocument() {
745
- const t = "Delete main document";
746
- try {
747
- this.progressController.notifyBusy(!0, t), await this.deleteDoc(), this.onChangeHdl.notify({
748
- documentCollection: await this.documentCollection(),
749
- action: "deleted"
750
- });
751
- } catch (s) {
752
- if (this.onChangeHdl.notify({ error: this.errorToError(s) }), this.onErrorHdl.notify(this.errorToError(s)), this.throwOnError) throw s;
753
- } finally {
754
- this.progressController.notifyBusy(!1, t);
755
- }
756
- }
757
- async documentCollection(t) {
758
- const s = "Retrieving document collection";
759
- let a = [];
760
- try {
761
- this.progressController.notifyBusy(!0, s);
762
- const c = this.findDocs(t);
763
- c ? a = await c : a = await this.queryDocs(t).get();
764
- } catch (c) {
765
- if (this.onChangeHdl.notify({ error: this.errorToError(c) }), this.onErrorHdl.notify(this.errorToError(c)), this.throwOnError) throw c;
766
- } finally {
767
- this.onChangeHdl.notify({ documentCollection: a }), this.progressController.notifyBusy(!1, s);
768
- }
769
- return a;
770
- }
771
- filter(t) {
772
- return t.filter((s) => this._filter?.(s) ?? !0);
773
- }
774
- onProgress(t) {
775
- return this.progressController.onProgress(t);
776
- }
777
- get model() {
778
- return this.getModel();
779
- }
780
- setDocument(t) {
781
- return this._document !== t && (this.unsubscribeDocument && this.unsubscribeDocument(), t && (this.unsubscribeDocument = t.onChange((s) => this.onChangeHdl.notify({ documentProps: s }))), this._document = t, this.onChangeHdl.notify({ documentChanged: this._document })), this;
782
- }
783
- set document(t) {
784
- this.setDocument(t);
785
- }
786
- get document() {
787
- return this._document;
788
- }
789
- /**
790
- * Use this method to throw an error in a controlled way.
791
- * It will notify the subscribers of the `onError` event and throw the error
792
- * if there are no subscribers to the `onError` event.
793
- *
794
- * @param error the error to throw
795
- */
796
- managedThrow(t) {
797
- if (this.onChangeHdl.notify({ error: this.errorToError(t) }), this.onErrorHdl.notify(this.errorToError(t)), this.throwOnError) throw this.errorToError(t);
798
- }
799
- errorToError(t) {
800
- return t instanceof Error ? t : typeof t == "string" ? new Error(t) : "code" in t ? new Error(t.code) : "message" in t ? new Error(t.error) : new Error(JSON.stringify(t));
801
- }
802
- get throwOnError() {
803
- return this.onErrorHdl.subscribersCount === 0;
804
- }
834
+ //#endregion
835
+ //#region src/progress-controller.ts
836
+ var O = class {
837
+ constructor() {
838
+ this._debug = !1, this._stages = {}, this._onProgress = new t();
839
+ }
840
+ notifyBusy(e, t) {
841
+ this.pushStage({
842
+ name: t ?? "",
843
+ progress: +!e,
844
+ total: 1
845
+ });
846
+ }
847
+ pushStage(e) {
848
+ this._stages[e.name] = e;
849
+ let t = Object.values(this._stages).reduce((e, t, n, r) => e + t.progress / t.total / r.length, 0);
850
+ this._onProgress.notify({
851
+ busy: t < 1,
852
+ overallProgress: t,
853
+ stages: this._stages
854
+ }), t >= 1 && (this._stages = {}), this.debug && console.log(`ProgressController ${e.name}: Progress: ${e.progress} Stages: ${e.total}`);
855
+ }
856
+ onProgress(e) {
857
+ return this._onProgress.subscribe(e);
858
+ }
859
+ set debug(e) {
860
+ this._debug = e;
861
+ }
862
+ get debug() {
863
+ return this._debug;
864
+ }
865
+ }, k = class e {
866
+ static {
867
+ this.errorMessages = { missedDocument: "No document to save" };
868
+ }
869
+ constructor(e) {
870
+ this.progressController = new O(), this.onChangeHdl = new t(), this.onErrorHdl = new t(), this.validator = {}, this.setDocument(e || this.createDocument());
871
+ }
872
+ allRequiredPropertiesFilled() {
873
+ return this.nonFilledRequiredProperties.length <= 0 && this.validateGlobal();
874
+ }
875
+ get nonFilledRequiredProperties() {
876
+ return this.requiredProperties.filter((e) => this.validateProp(e));
877
+ }
878
+ get requiredProperties() {
879
+ if (!this.document) throw Error(e.errorMessages.missedDocument);
880
+ let t = this.document.getPersistentProperties().filter((e) => this.document.isRequired(e.name)).map((e) => e.name);
881
+ return [...new Set(t.concat(Object.keys(this.validator)))];
882
+ }
883
+ addValidator(e, t, n) {
884
+ this.validator[e] = {
885
+ func: t,
886
+ errorMessage: n
887
+ };
888
+ }
889
+ removeValidator(e) {
890
+ delete this.validator[e];
891
+ }
892
+ addGlobalValidator(e, t) {
893
+ this.globalValidator = {
894
+ func: e,
895
+ errorMessage: t
896
+ };
897
+ }
898
+ removeGlobalValidator() {
899
+ this.globalValidator = void 0;
900
+ }
901
+ failedValidationError(e) {
902
+ if (e) return this.validator[e]?.errorMessage;
903
+ let t = this.nonFilledRequiredProperties[0];
904
+ if (t) return this.validator[t]?.errorMessage;
905
+ if (!this.validateGlobal()) return this.globalValidator?.errorMessage;
906
+ }
907
+ validateProp(t) {
908
+ if (!this.document) throw Error(e.errorMessages.missedDocument);
909
+ let n = this.document[t];
910
+ return this.validator[t] ? !this.validator[t].func(n) : !this.document.isPropValueValid(t);
911
+ }
912
+ validateGlobal() {
913
+ if (!this.document) throw Error(e.errorMessages.missedDocument);
914
+ return this.globalValidator ? this.globalValidator.func(this.document) : !0;
915
+ }
916
+ storeDoc() {
917
+ if (!this.document) throw Error(e.errorMessages.missedDocument);
918
+ return this.model.save(this.document);
919
+ }
920
+ deleteDoc() {
921
+ if (!this.document) throw Error(e.errorMessages.missedDocument);
922
+ return this.model.delete(this.document.id);
923
+ }
924
+ queryDocs(e) {
925
+ let t = this.model.find();
926
+ return e && (t = t.limit(e)), t;
927
+ }
928
+ findDocs(e) {}
929
+ async setFilter(e) {
930
+ return this._filter = e, this.onChangeHdl.notify({ action: "filterChange" }), this;
931
+ }
932
+ resetFilter() {
933
+ return this._filter = void 0, this.onChangeHdl.notify({ action: "filterChange" }), this;
934
+ }
935
+ onChange(e) {
936
+ return this.onChangeHdl.subscribe(e);
937
+ }
938
+ onError(e) {
939
+ return this.onErrorHdl.subscribe(e);
940
+ }
941
+ notifyChange(e) {
942
+ this.onChangeHdl.notify(e);
943
+ }
944
+ newDocument() {
945
+ return this.setDocument(this.createDocument());
946
+ }
947
+ async storeDocument() {
948
+ let e = "Saving main document";
949
+ try {
950
+ this.progressController.notifyBusy(!0, e), await this.storeDoc(), this.onChangeHdl.notify({
951
+ documentCollection: await this.documentCollection(),
952
+ action: "saved"
953
+ });
954
+ } catch (e) {
955
+ if (this.onChangeHdl.notify({ error: this.errorToError(e) }), this.onErrorHdl.notify(this.errorToError(e)), this.throwOnError) throw e;
956
+ } finally {
957
+ this.progressController.notifyBusy(!1, e);
958
+ }
959
+ }
960
+ async deleteDocument() {
961
+ let e = "Delete main document";
962
+ try {
963
+ this.progressController.notifyBusy(!0, e), await this.deleteDoc(), this.onChangeHdl.notify({
964
+ documentCollection: await this.documentCollection(),
965
+ action: "deleted"
966
+ });
967
+ } catch (e) {
968
+ if (this.onChangeHdl.notify({ error: this.errorToError(e) }), this.onErrorHdl.notify(this.errorToError(e)), this.throwOnError) throw e;
969
+ } finally {
970
+ this.progressController.notifyBusy(!1, e);
971
+ }
972
+ }
973
+ async documentCollection(e) {
974
+ let t = "Retrieving document collection", n = [];
975
+ try {
976
+ this.progressController.notifyBusy(!0, t);
977
+ let r = this.findDocs(e);
978
+ n = r ? await r : await this.queryDocs(e).get();
979
+ } catch (e) {
980
+ if (this.onChangeHdl.notify({ error: this.errorToError(e) }), this.onErrorHdl.notify(this.errorToError(e)), this.throwOnError) throw e;
981
+ } finally {
982
+ this.onChangeHdl.notify({ documentCollection: n }), this.progressController.notifyBusy(!1, t);
983
+ }
984
+ return n;
985
+ }
986
+ filter(e) {
987
+ return e.filter((e) => this._filter?.(e) ?? !0);
988
+ }
989
+ onProgress(e) {
990
+ return this.progressController.onProgress(e);
991
+ }
992
+ get model() {
993
+ return this.getModel();
994
+ }
995
+ setDocument(e) {
996
+ return this._document !== e && (this.unsubscribeDocument && this.unsubscribeDocument(), e && (this.unsubscribeDocument = e.onChange((e) => this.onChangeHdl.notify({ documentProps: e }))), this._document = e, this.onChangeHdl.notify({ documentChanged: this._document })), this;
997
+ }
998
+ set document(e) {
999
+ this.setDocument(e);
1000
+ }
1001
+ get document() {
1002
+ return this._document;
1003
+ }
1004
+ managedThrow(e) {
1005
+ if (this.onChangeHdl.notify({ error: this.errorToError(e) }), this.onErrorHdl.notify(this.errorToError(e)), this.throwOnError) throw this.errorToError(e);
1006
+ }
1007
+ errorToError(e) {
1008
+ return e instanceof Error ? e : typeof e == "string" ? Error(e) : "code" in e ? Error(e.code) : "message" in e ? Error(e.error) : Error(JSON.stringify(e));
1009
+ }
1010
+ get throwOnError() {
1011
+ return this.onErrorHdl.subscribersCount === 0;
1012
+ }
1013
+ }, A = /* @__PURE__ */ e(((e) => {
1014
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), o = Symbol.for("react.consumer"), s = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), f = Symbol.for("react.activity"), p = Symbol.iterator;
1015
+ function m(e) {
1016
+ return typeof e != "object" || !e ? null : (e = p && e[p] || e["@@iterator"], typeof e == "function" ? e : null);
1017
+ }
1018
+ var h = {
1019
+ isMounted: function() {
1020
+ return !1;
1021
+ },
1022
+ enqueueForceUpdate: function() {},
1023
+ enqueueReplaceState: function() {},
1024
+ enqueueSetState: function() {}
1025
+ }, g = Object.assign, _ = {};
1026
+ function v(e, t, n) {
1027
+ this.props = e, this.context = t, this.refs = _, this.updater = n || h;
1028
+ }
1029
+ v.prototype.isReactComponent = {}, v.prototype.setState = function(e, t) {
1030
+ if (typeof e != "object" && typeof e != "function" && e != null) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
1031
+ this.updater.enqueueSetState(this, e, t, "setState");
1032
+ }, v.prototype.forceUpdate = function(e) {
1033
+ this.updater.enqueueForceUpdate(this, e, "forceUpdate");
1034
+ };
1035
+ function y() {}
1036
+ y.prototype = v.prototype;
1037
+ function b(e, t, n) {
1038
+ this.props = e, this.context = t, this.refs = _, this.updater = n || h;
1039
+ }
1040
+ var x = b.prototype = new y();
1041
+ x.constructor = b, g(x, v.prototype), x.isPureReactComponent = !0;
1042
+ var S = Array.isArray;
1043
+ function C() {}
1044
+ var w = {
1045
+ H: null,
1046
+ A: null,
1047
+ T: null,
1048
+ S: null
1049
+ }, T = Object.prototype.hasOwnProperty;
1050
+ function E(e, n, r) {
1051
+ var i = r.ref;
1052
+ return {
1053
+ $$typeof: t,
1054
+ type: e,
1055
+ key: n,
1056
+ ref: i === void 0 ? null : i,
1057
+ props: r
1058
+ };
1059
+ }
1060
+ function D(e, t) {
1061
+ return E(e.type, t, e.props);
1062
+ }
1063
+ function O(e) {
1064
+ return typeof e == "object" && !!e && e.$$typeof === t;
1065
+ }
1066
+ function k(e) {
1067
+ var t = {
1068
+ "=": "=0",
1069
+ ":": "=2"
1070
+ };
1071
+ return "$" + e.replace(/[=:]/g, function(e) {
1072
+ return t[e];
1073
+ });
1074
+ }
1075
+ var A = /\/+/g;
1076
+ function j(e, t) {
1077
+ return typeof e == "object" && e && e.key != null ? k("" + e.key) : t.toString(36);
1078
+ }
1079
+ function M(e) {
1080
+ switch (e.status) {
1081
+ case "fulfilled": return e.value;
1082
+ case "rejected": throw e.reason;
1083
+ default: switch (typeof e.status == "string" ? e.then(C, C) : (e.status = "pending", e.then(function(t) {
1084
+ e.status === "pending" && (e.status = "fulfilled", e.value = t);
1085
+ }, function(t) {
1086
+ e.status === "pending" && (e.status = "rejected", e.reason = t);
1087
+ })), e.status) {
1088
+ case "fulfilled": return e.value;
1089
+ case "rejected": throw e.reason;
1090
+ }
1091
+ }
1092
+ throw e;
1093
+ }
1094
+ function N(e, r, i, a, o) {
1095
+ var s = typeof e;
1096
+ (s === "undefined" || s === "boolean") && (e = null);
1097
+ var c = !1;
1098
+ if (e === null) c = !0;
1099
+ else switch (s) {
1100
+ case "bigint":
1101
+ case "string":
1102
+ case "number":
1103
+ c = !0;
1104
+ break;
1105
+ case "object": switch (e.$$typeof) {
1106
+ case t:
1107
+ case n:
1108
+ c = !0;
1109
+ break;
1110
+ case d: return c = e._init, N(c(e._payload), r, i, a, o);
1111
+ }
1112
+ }
1113
+ if (c) return o = o(e), c = a === "" ? "." + j(e, 0) : a, S(o) ? (i = "", c != null && (i = c.replace(A, "$&/") + "/"), N(o, r, i, "", function(e) {
1114
+ return e;
1115
+ })) : o != null && (O(o) && (o = D(o, i + (o.key == null || e && e.key === o.key ? "" : ("" + o.key).replace(A, "$&/") + "/") + c)), r.push(o)), 1;
1116
+ c = 0;
1117
+ var l = a === "" ? "." : a + ":";
1118
+ if (S(e)) for (var u = 0; u < e.length; u++) a = e[u], s = l + j(a, u), c += N(a, r, i, s, o);
1119
+ else if (u = m(e), typeof u == "function") for (e = u.call(e), u = 0; !(a = e.next()).done;) a = a.value, s = l + j(a, u++), c += N(a, r, i, s, o);
1120
+ else if (s === "object") {
1121
+ if (typeof e.then == "function") return N(M(e), r, i, a, o);
1122
+ throw r = String(e), Error("Objects are not valid as a React child (found: " + (r === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : r) + "). If you meant to render a collection of children, use an array instead.");
1123
+ }
1124
+ return c;
1125
+ }
1126
+ function P(e, t, n) {
1127
+ if (e == null) return e;
1128
+ var r = [], i = 0;
1129
+ return N(e, r, "", "", function(e) {
1130
+ return t.call(n, e, i++);
1131
+ }), r;
1132
+ }
1133
+ function F(e) {
1134
+ if (e._status === -1) {
1135
+ var t = e._result;
1136
+ t = t(), t.then(function(t) {
1137
+ (e._status === 0 || e._status === -1) && (e._status = 1, e._result = t);
1138
+ }, function(t) {
1139
+ (e._status === 0 || e._status === -1) && (e._status = 2, e._result = t);
1140
+ }), e._status === -1 && (e._status = 0, e._result = t);
1141
+ }
1142
+ if (e._status === 1) return e._result.default;
1143
+ throw e._result;
1144
+ }
1145
+ var I = typeof reportError == "function" ? reportError : function(e) {
1146
+ if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1147
+ var t = new window.ErrorEvent("error", {
1148
+ bubbles: !0,
1149
+ cancelable: !0,
1150
+ message: typeof e == "object" && e && typeof e.message == "string" ? String(e.message) : String(e),
1151
+ error: e
1152
+ });
1153
+ if (!window.dispatchEvent(t)) return;
1154
+ } else if (typeof process == "object" && typeof process.emit == "function") {
1155
+ process.emit("uncaughtException", e);
1156
+ return;
1157
+ }
1158
+ console.error(e);
1159
+ }, L = {
1160
+ map: P,
1161
+ forEach: function(e, t, n) {
1162
+ P(e, function() {
1163
+ t.apply(this, arguments);
1164
+ }, n);
1165
+ },
1166
+ count: function(e) {
1167
+ var t = 0;
1168
+ return P(e, function() {
1169
+ t++;
1170
+ }), t;
1171
+ },
1172
+ toArray: function(e) {
1173
+ return P(e, function(e) {
1174
+ return e;
1175
+ }) || [];
1176
+ },
1177
+ only: function(e) {
1178
+ if (!O(e)) throw Error("React.Children.only expected to receive a single React element child.");
1179
+ return e;
1180
+ }
1181
+ };
1182
+ e.Activity = f, e.Children = L, e.Component = v, e.Fragment = r, e.Profiler = a, e.PureComponent = b, e.StrictMode = i, e.Suspense = l, e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = w, e.__COMPILER_RUNTIME = {
1183
+ __proto__: null,
1184
+ c: function(e) {
1185
+ return w.H.useMemoCache(e);
1186
+ }
1187
+ }, e.cache = function(e) {
1188
+ return function() {
1189
+ return e.apply(null, arguments);
1190
+ };
1191
+ }, e.cacheSignal = function() {
1192
+ return null;
1193
+ }, e.cloneElement = function(e, t, n) {
1194
+ if (e == null) throw Error("The argument must be a React element, but you passed " + e + ".");
1195
+ var r = g({}, e.props), i = e.key;
1196
+ if (t != null) for (a in t.key !== void 0 && (i = "" + t.key), t) !T.call(t, a) || a === "key" || a === "__self" || a === "__source" || a === "ref" && t.ref === void 0 || (r[a] = t[a]);
1197
+ var a = arguments.length - 2;
1198
+ if (a === 1) r.children = n;
1199
+ else if (1 < a) {
1200
+ for (var o = Array(a), s = 0; s < a; s++) o[s] = arguments[s + 2];
1201
+ r.children = o;
1202
+ }
1203
+ return E(e.type, i, r);
1204
+ }, e.createContext = function(e) {
1205
+ return e = {
1206
+ $$typeof: s,
1207
+ _currentValue: e,
1208
+ _currentValue2: e,
1209
+ _threadCount: 0,
1210
+ Provider: null,
1211
+ Consumer: null
1212
+ }, e.Provider = e, e.Consumer = {
1213
+ $$typeof: o,
1214
+ _context: e
1215
+ }, e;
1216
+ }, e.createElement = function(e, t, n) {
1217
+ var r, i = {}, a = null;
1218
+ if (t != null) for (r in t.key !== void 0 && (a = "" + t.key), t) T.call(t, r) && r !== "key" && r !== "__self" && r !== "__source" && (i[r] = t[r]);
1219
+ var o = arguments.length - 2;
1220
+ if (o === 1) i.children = n;
1221
+ else if (1 < o) {
1222
+ for (var s = Array(o), c = 0; c < o; c++) s[c] = arguments[c + 2];
1223
+ i.children = s;
1224
+ }
1225
+ if (e && e.defaultProps) for (r in o = e.defaultProps, o) i[r] === void 0 && (i[r] = o[r]);
1226
+ return E(e, a, i);
1227
+ }, e.createRef = function() {
1228
+ return { current: null };
1229
+ }, e.forwardRef = function(e) {
1230
+ return {
1231
+ $$typeof: c,
1232
+ render: e
1233
+ };
1234
+ }, e.isValidElement = O, e.lazy = function(e) {
1235
+ return {
1236
+ $$typeof: d,
1237
+ _payload: {
1238
+ _status: -1,
1239
+ _result: e
1240
+ },
1241
+ _init: F
1242
+ };
1243
+ }, e.memo = function(e, t) {
1244
+ return {
1245
+ $$typeof: u,
1246
+ type: e,
1247
+ compare: t === void 0 ? null : t
1248
+ };
1249
+ }, e.startTransition = function(e) {
1250
+ var t = w.T, n = {};
1251
+ w.T = n;
1252
+ try {
1253
+ var r = e(), i = w.S;
1254
+ i !== null && i(n, r), typeof r == "object" && r && typeof r.then == "function" && r.then(C, I);
1255
+ } catch (e) {
1256
+ I(e);
1257
+ } finally {
1258
+ t !== null && n.types !== null && (t.types = n.types), w.T = t;
1259
+ }
1260
+ }, e.unstable_useCacheRefresh = function() {
1261
+ return w.H.useCacheRefresh();
1262
+ }, e.use = function(e) {
1263
+ return w.H.use(e);
1264
+ }, e.useActionState = function(e, t, n) {
1265
+ return w.H.useActionState(e, t, n);
1266
+ }, e.useCallback = function(e, t) {
1267
+ return w.H.useCallback(e, t);
1268
+ }, e.useContext = function(e) {
1269
+ return w.H.useContext(e);
1270
+ }, e.useDebugValue = function() {}, e.useDeferredValue = function(e, t) {
1271
+ return w.H.useDeferredValue(e, t);
1272
+ }, e.useEffect = function(e, t) {
1273
+ return w.H.useEffect(e, t);
1274
+ }, e.useEffectEvent = function(e) {
1275
+ return w.H.useEffectEvent(e);
1276
+ }, e.useId = function() {
1277
+ return w.H.useId();
1278
+ }, e.useImperativeHandle = function(e, t, n) {
1279
+ return w.H.useImperativeHandle(e, t, n);
1280
+ }, e.useInsertionEffect = function(e, t) {
1281
+ return w.H.useInsertionEffect(e, t);
1282
+ }, e.useLayoutEffect = function(e, t) {
1283
+ return w.H.useLayoutEffect(e, t);
1284
+ }, e.useMemo = function(e, t) {
1285
+ return w.H.useMemo(e, t);
1286
+ }, e.useOptimistic = function(e, t) {
1287
+ return w.H.useOptimistic(e, t);
1288
+ }, e.useReducer = function(e, t, n) {
1289
+ return w.H.useReducer(e, t, n);
1290
+ }, e.useRef = function(e) {
1291
+ return w.H.useRef(e);
1292
+ }, e.useState = function(e) {
1293
+ return w.H.useState(e);
1294
+ }, e.useSyncExternalStore = function(e, t, n) {
1295
+ return w.H.useSyncExternalStore(e, t, n);
1296
+ }, e.useTransition = function() {
1297
+ return w.H.useTransition();
1298
+ }, e.version = "19.2.7";
1299
+ })), j = /* @__PURE__ */ e(((e, t) => {
1300
+ process.env.NODE_ENV !== "production" && (function() {
1301
+ function n(e, t) {
1302
+ Object.defineProperty(a.prototype, e, { get: function() {
1303
+ console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", t[0], t[1]);
1304
+ } });
1305
+ }
1306
+ function r(e) {
1307
+ return typeof e != "object" || !e ? null : (e = H && e[H] || e["@@iterator"], typeof e == "function" ? e : null);
1308
+ }
1309
+ function i(e, t) {
1310
+ e = (e = e.constructor) && (e.displayName || e.name) || "ReactClass";
1311
+ var n = e + "." + t;
1312
+ U[n] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", t, e), U[n] = !0);
1313
+ }
1314
+ function a(e, t, n) {
1315
+ this.props = e, this.context = t, this.refs = G, this.updater = n || W;
1316
+ }
1317
+ function o() {}
1318
+ function s(e, t, n) {
1319
+ this.props = e, this.context = t, this.refs = G, this.updater = n || W;
1320
+ }
1321
+ function c() {}
1322
+ function l(e) {
1323
+ return "" + e;
1324
+ }
1325
+ function u(e) {
1326
+ try {
1327
+ l(e);
1328
+ var t = !1;
1329
+ } catch {
1330
+ t = !0;
1331
+ }
1332
+ if (t) {
1333
+ t = console;
1334
+ var n = t.error, r = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
1335
+ return n.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", r), l(e);
1336
+ }
1337
+ }
1338
+ function d(e) {
1339
+ if (e == null) return null;
1340
+ if (typeof e == "function") return e.$$typeof === ce ? null : e.displayName || e.name || null;
1341
+ if (typeof e == "string") return e;
1342
+ switch (e) {
1343
+ case L: return "Fragment";
1344
+ case ee: return "Profiler";
1345
+ case R: return "StrictMode";
1346
+ case re: return "Suspense";
1347
+ case ie: return "SuspenseList";
1348
+ case ae: return "Activity";
1349
+ }
1350
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
1351
+ case I: return "Portal";
1352
+ case te: return e.displayName || "Context";
1353
+ case z: return (e._context.displayName || "Context") + ".Consumer";
1354
+ case ne:
1355
+ var t = e.render;
1356
+ return e = e.displayName, e ||= (e = t.displayName || t.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
1357
+ case B: return t = e.displayName || null, t === null ? d(e.type) || "Memo" : t;
1358
+ case V:
1359
+ t = e._payload, e = e._init;
1360
+ try {
1361
+ return d(e(t));
1362
+ } catch {}
1363
+ }
1364
+ return null;
1365
+ }
1366
+ function f(e) {
1367
+ if (e === L) return "<>";
1368
+ if (typeof e == "object" && e && e.$$typeof === V) return "<...>";
1369
+ try {
1370
+ var t = d(e);
1371
+ return t ? "<" + t + ">" : "<...>";
1372
+ } catch {
1373
+ return "<...>";
1374
+ }
1375
+ }
1376
+ function p() {
1377
+ var e = q.A;
1378
+ return e === null ? null : e.getOwner();
1379
+ }
1380
+ function m() {
1381
+ return Error("react-stack-top-frame");
1382
+ }
1383
+ function h(e) {
1384
+ if (J.call(e, "key")) {
1385
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
1386
+ if (t && t.isReactWarning) return !1;
1387
+ }
1388
+ return e.key !== void 0;
1389
+ }
1390
+ function g(e, t) {
1391
+ function n() {
1392
+ ue || (ue = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
1393
+ }
1394
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
1395
+ get: n,
1396
+ configurable: !0
1397
+ });
1398
+ }
1399
+ function _() {
1400
+ var e = d(this.type);
1401
+ return fe[e] || (fe[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
1402
+ }
1403
+ function v(e, t, n, r, i, a) {
1404
+ var o = n.ref;
1405
+ return e = {
1406
+ $$typeof: F,
1407
+ type: e,
1408
+ key: t,
1409
+ props: n,
1410
+ _owner: r
1411
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
1412
+ enumerable: !1,
1413
+ value: null
1414
+ }) : Object.defineProperty(e, "ref", {
1415
+ enumerable: !1,
1416
+ get: _
1417
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
1418
+ configurable: !1,
1419
+ enumerable: !1,
1420
+ writable: !0,
1421
+ value: 0
1422
+ }), Object.defineProperty(e, "_debugInfo", {
1423
+ configurable: !1,
1424
+ enumerable: !1,
1425
+ writable: !0,
1426
+ value: null
1427
+ }), Object.defineProperty(e, "_debugStack", {
1428
+ configurable: !1,
1429
+ enumerable: !1,
1430
+ writable: !0,
1431
+ value: i
1432
+ }), Object.defineProperty(e, "_debugTask", {
1433
+ configurable: !1,
1434
+ enumerable: !1,
1435
+ writable: !0,
1436
+ value: a
1437
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
1438
+ }
1439
+ function y(e, t) {
1440
+ return t = v(e.type, t, e.props, e._owner, e._debugStack, e._debugTask), e._store && (t._store.validated = e._store.validated), t;
1441
+ }
1442
+ function b(e) {
1443
+ x(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === V && (e._payload.status === "fulfilled" ? x(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
1444
+ }
1445
+ function x(e) {
1446
+ return typeof e == "object" && !!e && e.$$typeof === F;
1447
+ }
1448
+ function S(e) {
1449
+ var t = {
1450
+ "=": "=0",
1451
+ ":": "=2"
1452
+ };
1453
+ return "$" + e.replace(/[=:]/g, function(e) {
1454
+ return t[e];
1455
+ });
1456
+ }
1457
+ function C(e, t) {
1458
+ return typeof e == "object" && e && e.key != null ? (u(e.key), S("" + e.key)) : t.toString(36);
1459
+ }
1460
+ function w(e) {
1461
+ switch (e.status) {
1462
+ case "fulfilled": return e.value;
1463
+ case "rejected": throw e.reason;
1464
+ default: switch (typeof e.status == "string" ? e.then(c, c) : (e.status = "pending", e.then(function(t) {
1465
+ e.status === "pending" && (e.status = "fulfilled", e.value = t);
1466
+ }, function(t) {
1467
+ e.status === "pending" && (e.status = "rejected", e.reason = t);
1468
+ })), e.status) {
1469
+ case "fulfilled": return e.value;
1470
+ case "rejected": throw e.reason;
1471
+ }
1472
+ }
1473
+ throw e;
1474
+ }
1475
+ function T(e, t, n, i, a) {
1476
+ var o = typeof e;
1477
+ (o === "undefined" || o === "boolean") && (e = null);
1478
+ var s = !1;
1479
+ if (e === null) s = !0;
1480
+ else switch (o) {
1481
+ case "bigint":
1482
+ case "string":
1483
+ case "number":
1484
+ s = !0;
1485
+ break;
1486
+ case "object": switch (e.$$typeof) {
1487
+ case F:
1488
+ case I:
1489
+ s = !0;
1490
+ break;
1491
+ case V: return s = e._init, T(s(e._payload), t, n, i, a);
1492
+ }
1493
+ }
1494
+ if (s) {
1495
+ s = e, a = a(s);
1496
+ var c = i === "" ? "." + C(s, 0) : i;
1497
+ return se(a) ? (n = "", c != null && (n = c.replace(ge, "$&/") + "/"), T(a, t, n, "", function(e) {
1498
+ return e;
1499
+ })) : a != null && (x(a) && (a.key != null && (s && s.key === a.key || u(a.key)), n = y(a, n + (a.key == null || s && s.key === a.key ? "" : ("" + a.key).replace(ge, "$&/") + "/") + c), i !== "" && s != null && x(s) && s.key == null && s._store && !s._store.validated && (n._store.validated = 2), a = n), t.push(a)), 1;
1500
+ }
1501
+ if (s = 0, c = i === "" ? "." : i + ":", se(e)) for (var l = 0; l < e.length; l++) i = e[l], o = c + C(i, l), s += T(i, t, n, o, a);
1502
+ else if (l = r(e), typeof l == "function") for (l === e.entries && (he || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), he = !0), e = l.call(e), l = 0; !(i = e.next()).done;) i = i.value, o = c + C(i, l++), s += T(i, t, n, o, a);
1503
+ else if (o === "object") {
1504
+ if (typeof e.then == "function") return T(w(e), t, n, i, a);
1505
+ throw t = String(e), Error("Objects are not valid as a React child (found: " + (t === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : t) + "). If you meant to render a collection of children, use an array instead.");
1506
+ }
1507
+ return s;
1508
+ }
1509
+ function E(e, t, n) {
1510
+ if (e == null) return e;
1511
+ var r = [], i = 0;
1512
+ return T(e, r, "", "", function(e) {
1513
+ return t.call(n, e, i++);
1514
+ }), r;
1515
+ }
1516
+ function D(e) {
1517
+ if (e._status === -1) {
1518
+ var t = e._ioInfo;
1519
+ t != null && (t.start = t.end = performance.now()), t = e._result;
1520
+ var n = t();
1521
+ if (n.then(function(t) {
1522
+ if (e._status === 0 || e._status === -1) {
1523
+ e._status = 1, e._result = t;
1524
+ var r = e._ioInfo;
1525
+ r != null && (r.end = performance.now()), n.status === void 0 && (n.status = "fulfilled", n.value = t);
1526
+ }
1527
+ }, function(t) {
1528
+ if (e._status === 0 || e._status === -1) {
1529
+ e._status = 2, e._result = t;
1530
+ var r = e._ioInfo;
1531
+ r != null && (r.end = performance.now()), n.status === void 0 && (n.status = "rejected", n.reason = t);
1532
+ }
1533
+ }), t = e._ioInfo, t != null) {
1534
+ t.value = n;
1535
+ var r = n.displayName;
1536
+ typeof r == "string" && (t.name = r);
1537
+ }
1538
+ e._status === -1 && (e._status = 0, e._result = n);
1539
+ }
1540
+ if (e._status === 1) return t = e._result, t === void 0 && console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", t), "default" in t || console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", t), t.default;
1541
+ throw e._result;
1542
+ }
1543
+ function O() {
1544
+ var e = q.H;
1545
+ return e === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), e;
1546
+ }
1547
+ function k() {
1548
+ q.asyncTransitions--;
1549
+ }
1550
+ function A(e) {
1551
+ if (Y === null) try {
1552
+ var n = ("require" + Math.random()).slice(0, 7);
1553
+ Y = (t && t[n]).call(t, "timers").setImmediate;
1554
+ } catch {
1555
+ Y = function(e) {
1556
+ !1 === ve && (ve = !0, typeof MessageChannel > "u" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
1557
+ var t = new MessageChannel();
1558
+ t.port1.onmessage = e, t.port2.postMessage(void 0);
1559
+ };
1560
+ }
1561
+ return Y(e);
1562
+ }
1563
+ function j(e) {
1564
+ return 1 < e.length && typeof AggregateError == "function" ? AggregateError(e) : e[0];
1565
+ }
1566
+ function M(e, t) {
1567
+ t !== X - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "), X = t;
1568
+ }
1569
+ function N(e, t, n) {
1570
+ var r = q.actQueue;
1571
+ if (r !== null) if (r.length !== 0) try {
1572
+ P(r), A(function() {
1573
+ return N(e, t, n);
1574
+ });
1575
+ return;
1576
+ } catch (e) {
1577
+ q.thrownErrors.push(e);
1578
+ }
1579
+ else q.actQueue = null;
1580
+ 0 < q.thrownErrors.length ? (r = j(q.thrownErrors), q.thrownErrors.length = 0, n(r)) : t(e);
1581
+ }
1582
+ function P(e) {
1583
+ if (!Q) {
1584
+ Q = !0;
1585
+ var t = 0;
1586
+ try {
1587
+ for (; t < e.length; t++) {
1588
+ var n = e[t];
1589
+ do {
1590
+ q.didUsePromise = !1;
1591
+ var r = n(!1);
1592
+ if (r !== null) {
1593
+ if (q.didUsePromise) {
1594
+ e[t] = n, e.splice(0, t);
1595
+ return;
1596
+ }
1597
+ n = r;
1598
+ } else break;
1599
+ } while (1);
1600
+ }
1601
+ e.length = 0;
1602
+ } catch (n) {
1603
+ e.splice(0, t + 1), q.thrownErrors.push(n);
1604
+ } finally {
1605
+ Q = !1;
1606
+ }
1607
+ }
1608
+ }
1609
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1610
+ var F = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), ee = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), te = Symbol.for("react.context"), ne = Symbol.for("react.forward_ref"), re = Symbol.for("react.suspense"), ie = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), ae = Symbol.for("react.activity"), H = Symbol.iterator, U = {}, W = {
1611
+ isMounted: function() {
1612
+ return !1;
1613
+ },
1614
+ enqueueForceUpdate: function(e) {
1615
+ i(e, "forceUpdate");
1616
+ },
1617
+ enqueueReplaceState: function(e) {
1618
+ i(e, "replaceState");
1619
+ },
1620
+ enqueueSetState: function(e) {
1621
+ i(e, "setState");
1622
+ }
1623
+ }, oe = Object.assign, G = {};
1624
+ Object.freeze(G), a.prototype.isReactComponent = {}, a.prototype.setState = function(e, t) {
1625
+ if (typeof e != "object" && typeof e != "function" && e != null) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
1626
+ this.updater.enqueueSetState(this, e, t, "setState");
1627
+ }, a.prototype.forceUpdate = function(e) {
1628
+ this.updater.enqueueForceUpdate(this, e, "forceUpdate");
1629
+ };
1630
+ var K = {
1631
+ isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
1632
+ replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
1633
+ };
1634
+ for ($ in K) K.hasOwnProperty($) && n($, K[$]);
1635
+ o.prototype = a.prototype, K = s.prototype = new o(), K.constructor = s, oe(K, a.prototype), K.isPureReactComponent = !0;
1636
+ var se = Array.isArray, ce = Symbol.for("react.client.reference"), q = {
1637
+ H: null,
1638
+ A: null,
1639
+ T: null,
1640
+ S: null,
1641
+ actQueue: null,
1642
+ asyncTransitions: 0,
1643
+ isBatchingLegacy: !1,
1644
+ didScheduleLegacyUpdate: !1,
1645
+ didUsePromise: !1,
1646
+ thrownErrors: [],
1647
+ getCurrentStack: null,
1648
+ recentlyCreatedOwnerStacks: 0
1649
+ }, J = Object.prototype.hasOwnProperty, le = console.createTask ? console.createTask : function() {
1650
+ return null;
1651
+ };
1652
+ K = { react_stack_bottom_frame: function(e) {
1653
+ return e();
1654
+ } };
1655
+ var ue, de, fe = {}, pe = K.react_stack_bottom_frame.bind(K, m)(), me = le(f(m)), he = !1, ge = /\/+/g, _e = typeof reportError == "function" ? reportError : function(e) {
1656
+ if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1657
+ var t = new window.ErrorEvent("error", {
1658
+ bubbles: !0,
1659
+ cancelable: !0,
1660
+ message: typeof e == "object" && e && typeof e.message == "string" ? String(e.message) : String(e),
1661
+ error: e
1662
+ });
1663
+ if (!window.dispatchEvent(t)) return;
1664
+ } else if (typeof process == "object" && typeof process.emit == "function") {
1665
+ process.emit("uncaughtException", e);
1666
+ return;
1667
+ }
1668
+ console.error(e);
1669
+ }, ve = !1, Y = null, X = 0, Z = !1, Q = !1, ye = typeof queueMicrotask == "function" ? function(e) {
1670
+ queueMicrotask(function() {
1671
+ return queueMicrotask(e);
1672
+ });
1673
+ } : A;
1674
+ K = Object.freeze({
1675
+ __proto__: null,
1676
+ c: function(e) {
1677
+ return O().useMemoCache(e);
1678
+ }
1679
+ });
1680
+ var $ = {
1681
+ map: E,
1682
+ forEach: function(e, t, n) {
1683
+ E(e, function() {
1684
+ t.apply(this, arguments);
1685
+ }, n);
1686
+ },
1687
+ count: function(e) {
1688
+ var t = 0;
1689
+ return E(e, function() {
1690
+ t++;
1691
+ }), t;
1692
+ },
1693
+ toArray: function(e) {
1694
+ return E(e, function(e) {
1695
+ return e;
1696
+ }) || [];
1697
+ },
1698
+ only: function(e) {
1699
+ if (!x(e)) throw Error("React.Children.only expected to receive a single React element child.");
1700
+ return e;
1701
+ }
1702
+ };
1703
+ e.Activity = ae, e.Children = $, e.Component = a, e.Fragment = L, e.Profiler = ee, e.PureComponent = s, e.StrictMode = R, e.Suspense = re, e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = q, e.__COMPILER_RUNTIME = K, e.act = function(e) {
1704
+ var t = q.actQueue, n = X;
1705
+ X++;
1706
+ var r = q.actQueue = t === null ? [] : t, i = !1;
1707
+ try {
1708
+ var a = e();
1709
+ } catch (e) {
1710
+ q.thrownErrors.push(e);
1711
+ }
1712
+ if (0 < q.thrownErrors.length) throw M(t, n), e = j(q.thrownErrors), q.thrownErrors.length = 0, e;
1713
+ if (typeof a == "object" && a && typeof a.then == "function") {
1714
+ var o = a;
1715
+ return ye(function() {
1716
+ i || Z || (Z = !0, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
1717
+ }), { then: function(e, a) {
1718
+ i = !0, o.then(function(i) {
1719
+ if (M(t, n), n === 0) {
1720
+ try {
1721
+ P(r), A(function() {
1722
+ return N(i, e, a);
1723
+ });
1724
+ } catch (e) {
1725
+ q.thrownErrors.push(e);
1726
+ }
1727
+ if (0 < q.thrownErrors.length) {
1728
+ var o = j(q.thrownErrors);
1729
+ q.thrownErrors.length = 0, a(o);
1730
+ }
1731
+ } else e(i);
1732
+ }, function(e) {
1733
+ M(t, n), 0 < q.thrownErrors.length ? (e = j(q.thrownErrors), q.thrownErrors.length = 0, a(e)) : a(e);
1734
+ });
1735
+ } };
1736
+ }
1737
+ var s = a;
1738
+ if (M(t, n), n === 0 && (P(r), r.length !== 0 && ye(function() {
1739
+ i || Z || (Z = !0, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
1740
+ }), q.actQueue = null), 0 < q.thrownErrors.length) throw e = j(q.thrownErrors), q.thrownErrors.length = 0, e;
1741
+ return { then: function(e, t) {
1742
+ i = !0, n === 0 ? (q.actQueue = r, A(function() {
1743
+ return N(s, e, t);
1744
+ })) : e(s);
1745
+ } };
1746
+ }, e.cache = function(e) {
1747
+ return function() {
1748
+ return e.apply(null, arguments);
1749
+ };
1750
+ }, e.cacheSignal = function() {
1751
+ return null;
1752
+ }, e.captureOwnerStack = function() {
1753
+ var e = q.getCurrentStack;
1754
+ return e === null ? null : e();
1755
+ }, e.cloneElement = function(e, t, n) {
1756
+ if (e == null) throw Error("The argument must be a React element, but you passed " + e + ".");
1757
+ var r = oe({}, e.props), i = e.key, a = e._owner;
1758
+ if (t != null) {
1759
+ var o;
1760
+ a: {
1761
+ if (J.call(t, "ref") && (o = Object.getOwnPropertyDescriptor(t, "ref").get) && o.isReactWarning) {
1762
+ o = !1;
1763
+ break a;
1764
+ }
1765
+ o = t.ref !== void 0;
1766
+ }
1767
+ for (s in o && (a = p()), h(t) && (u(t.key), i = "" + t.key), t) !J.call(t, s) || s === "key" || s === "__self" || s === "__source" || s === "ref" && t.ref === void 0 || (r[s] = t[s]);
1768
+ }
1769
+ var s = arguments.length - 2;
1770
+ if (s === 1) r.children = n;
1771
+ else if (1 < s) {
1772
+ o = Array(s);
1773
+ for (var c = 0; c < s; c++) o[c] = arguments[c + 2];
1774
+ r.children = o;
1775
+ }
1776
+ for (r = v(e.type, i, r, a, e._debugStack, e._debugTask), i = 2; i < arguments.length; i++) b(arguments[i]);
1777
+ return r;
1778
+ }, e.createContext = function(e) {
1779
+ return e = {
1780
+ $$typeof: te,
1781
+ _currentValue: e,
1782
+ _currentValue2: e,
1783
+ _threadCount: 0,
1784
+ Provider: null,
1785
+ Consumer: null
1786
+ }, e.Provider = e, e.Consumer = {
1787
+ $$typeof: z,
1788
+ _context: e
1789
+ }, e._currentRenderer = null, e._currentRenderer2 = null, e;
1790
+ }, e.createElement = function(e, t, n) {
1791
+ for (var r = 2; r < arguments.length; r++) b(arguments[r]);
1792
+ r = {};
1793
+ var i = null;
1794
+ if (t != null) for (c in de || !("__self" in t) || "key" in t || (de = !0, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), h(t) && (u(t.key), i = "" + t.key), t) J.call(t, c) && c !== "key" && c !== "__self" && c !== "__source" && (r[c] = t[c]);
1795
+ var a = arguments.length - 2;
1796
+ if (a === 1) r.children = n;
1797
+ else if (1 < a) {
1798
+ for (var o = Array(a), s = 0; s < a; s++) o[s] = arguments[s + 2];
1799
+ Object.freeze && Object.freeze(o), r.children = o;
1800
+ }
1801
+ if (e && e.defaultProps) for (c in a = e.defaultProps, a) r[c] === void 0 && (r[c] = a[c]);
1802
+ i && g(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e);
1803
+ var c = 1e4 > q.recentlyCreatedOwnerStacks++;
1804
+ return v(e, i, r, p(), c ? Error("react-stack-top-frame") : pe, c ? le(f(e)) : me);
1805
+ }, e.createRef = function() {
1806
+ var e = { current: null };
1807
+ return Object.seal(e), e;
1808
+ }, e.forwardRef = function(e) {
1809
+ e != null && e.$$typeof === B ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof e == "function" ? e.length !== 0 && e.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", e.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.") : console.error("forwardRef requires a render function but was given %s.", e === null ? "null" : typeof e), e != null && e.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
1810
+ var t = {
1811
+ $$typeof: ne,
1812
+ render: e
1813
+ }, n;
1814
+ return Object.defineProperty(t, "displayName", {
1815
+ enumerable: !1,
1816
+ configurable: !0,
1817
+ get: function() {
1818
+ return n;
1819
+ },
1820
+ set: function(t) {
1821
+ n = t, e.name || e.displayName || (Object.defineProperty(e, "name", { value: t }), e.displayName = t);
1822
+ }
1823
+ }), t;
1824
+ }, e.isValidElement = x, e.lazy = function(e) {
1825
+ e = {
1826
+ _status: -1,
1827
+ _result: e
1828
+ };
1829
+ var t = {
1830
+ $$typeof: V,
1831
+ _payload: e,
1832
+ _init: D
1833
+ }, n = {
1834
+ name: "lazy",
1835
+ start: -1,
1836
+ end: -1,
1837
+ value: null,
1838
+ owner: null,
1839
+ debugStack: Error("react-stack-top-frame"),
1840
+ debugTask: console.createTask ? console.createTask("lazy()") : null
1841
+ };
1842
+ return e._ioInfo = n, t._debugInfo = [{ awaited: n }], t;
1843
+ }, e.memo = function(e, t) {
1844
+ e ?? console.error("memo: The first argument must be a component. Instead received: %s", e === null ? "null" : typeof e), t = {
1845
+ $$typeof: B,
1846
+ type: e,
1847
+ compare: t === void 0 ? null : t
1848
+ };
1849
+ var n;
1850
+ return Object.defineProperty(t, "displayName", {
1851
+ enumerable: !1,
1852
+ configurable: !0,
1853
+ get: function() {
1854
+ return n;
1855
+ },
1856
+ set: function(t) {
1857
+ n = t, e.name || e.displayName || (Object.defineProperty(e, "name", { value: t }), e.displayName = t);
1858
+ }
1859
+ }), t;
1860
+ }, e.startTransition = function(e) {
1861
+ var t = q.T, n = {};
1862
+ n._updatedFibers = /* @__PURE__ */ new Set(), q.T = n;
1863
+ try {
1864
+ var r = e(), i = q.S;
1865
+ i !== null && i(n, r), typeof r == "object" && r && typeof r.then == "function" && (q.asyncTransitions++, r.then(k, k), r.then(c, _e));
1866
+ } catch (e) {
1867
+ _e(e);
1868
+ } finally {
1869
+ t === null && n._updatedFibers && (e = n._updatedFibers.size, n._updatedFibers.clear(), 10 < e && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), t !== null && n.types !== null && (t.types !== null && t.types !== n.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), t.types = n.types), q.T = t;
1870
+ }
1871
+ }, e.unstable_useCacheRefresh = function() {
1872
+ return O().useCacheRefresh();
1873
+ }, e.use = function(e) {
1874
+ return O().use(e);
1875
+ }, e.useActionState = function(e, t, n) {
1876
+ return O().useActionState(e, t, n);
1877
+ }, e.useCallback = function(e, t) {
1878
+ return O().useCallback(e, t);
1879
+ }, e.useContext = function(e) {
1880
+ var t = O();
1881
+ return e.$$typeof === z && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"), t.useContext(e);
1882
+ }, e.useDebugValue = function(e, t) {
1883
+ return O().useDebugValue(e, t);
1884
+ }, e.useDeferredValue = function(e, t) {
1885
+ return O().useDeferredValue(e, t);
1886
+ }, e.useEffect = function(e, t) {
1887
+ return e ?? console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"), O().useEffect(e, t);
1888
+ }, e.useEffectEvent = function(e) {
1889
+ return O().useEffectEvent(e);
1890
+ }, e.useId = function() {
1891
+ return O().useId();
1892
+ }, e.useImperativeHandle = function(e, t, n) {
1893
+ return O().useImperativeHandle(e, t, n);
1894
+ }, e.useInsertionEffect = function(e, t) {
1895
+ return e ?? console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"), O().useInsertionEffect(e, t);
1896
+ }, e.useLayoutEffect = function(e, t) {
1897
+ return e ?? console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"), O().useLayoutEffect(e, t);
1898
+ }, e.useMemo = function(e, t) {
1899
+ return O().useMemo(e, t);
1900
+ }, e.useOptimistic = function(e, t) {
1901
+ return O().useOptimistic(e, t);
1902
+ }, e.useReducer = function(e, t, n) {
1903
+ return O().useReducer(e, t, n);
1904
+ }, e.useRef = function(e) {
1905
+ return O().useRef(e);
1906
+ }, e.useState = function(e) {
1907
+ return O().useState(e);
1908
+ }, e.useSyncExternalStore = function(e, t, n) {
1909
+ return O().useSyncExternalStore(e, t, n);
1910
+ }, e.useTransition = function() {
1911
+ return O().useTransition();
1912
+ }, e.version = "19.2.7", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1913
+ })();
1914
+ })), M = /* @__PURE__ */ e(((e, t) => {
1915
+ process.env.NODE_ENV === "production" ? t.exports = A() : t.exports = j();
1916
+ })), N = /* @__PURE__ */ e(((e) => {
1917
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
1918
+ function r(e, n, r) {
1919
+ var i = null;
1920
+ if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
1921
+ else r = n;
1922
+ return n = r.ref, {
1923
+ $$typeof: t,
1924
+ type: e,
1925
+ key: i,
1926
+ ref: n === void 0 ? null : n,
1927
+ props: r
1928
+ };
1929
+ }
1930
+ e.Fragment = n, e.jsx = r, e.jsxs = r;
1931
+ })), P = /* @__PURE__ */ e(((e) => {
1932
+ process.env.NODE_ENV !== "production" && (function() {
1933
+ function t(e) {
1934
+ if (e == null) return null;
1935
+ if (typeof e == "function") return e.$$typeof === O ? null : e.displayName || e.name || null;
1936
+ if (typeof e == "string") return e;
1937
+ switch (e) {
1938
+ case _: return "Fragment";
1939
+ case y: return "Profiler";
1940
+ case v: return "StrictMode";
1941
+ case C: return "Suspense";
1942
+ case w: return "SuspenseList";
1943
+ case D: return "Activity";
1944
+ }
1945
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
1946
+ case g: return "Portal";
1947
+ case x: return e.displayName || "Context";
1948
+ case b: return (e._context.displayName || "Context") + ".Consumer";
1949
+ case S:
1950
+ var n = e.render;
1951
+ return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
1952
+ case T: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
1953
+ case E:
1954
+ n = e._payload, e = e._init;
1955
+ try {
1956
+ return t(e(n));
1957
+ } catch {}
1958
+ }
1959
+ return null;
1960
+ }
1961
+ function n(e) {
1962
+ return "" + e;
1963
+ }
1964
+ function r(e) {
1965
+ try {
1966
+ n(e);
1967
+ var t = !1;
1968
+ } catch {
1969
+ t = !0;
1970
+ }
1971
+ if (t) {
1972
+ t = console;
1973
+ var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
1974
+ return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
1975
+ }
1976
+ }
1977
+ function i(e) {
1978
+ if (e === _) return "<>";
1979
+ if (typeof e == "object" && e && e.$$typeof === E) return "<...>";
1980
+ try {
1981
+ var n = t(e);
1982
+ return n ? "<" + n + ">" : "<...>";
1983
+ } catch {
1984
+ return "<...>";
1985
+ }
1986
+ }
1987
+ function a() {
1988
+ var e = k.A;
1989
+ return e === null ? null : e.getOwner();
1990
+ }
1991
+ function o() {
1992
+ return Error("react-stack-top-frame");
1993
+ }
1994
+ function s(e) {
1995
+ if (A.call(e, "key")) {
1996
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
1997
+ if (t && t.isReactWarning) return !1;
1998
+ }
1999
+ return e.key !== void 0;
2000
+ }
2001
+ function c(e, t) {
2002
+ function n() {
2003
+ P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
2004
+ }
2005
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
2006
+ get: n,
2007
+ configurable: !0
2008
+ });
2009
+ }
2010
+ function l() {
2011
+ var e = t(this.type);
2012
+ return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
2013
+ }
2014
+ function u(e, t, n, r, i, a) {
2015
+ var o = n.ref;
2016
+ return e = {
2017
+ $$typeof: h,
2018
+ type: e,
2019
+ key: t,
2020
+ props: n,
2021
+ _owner: r
2022
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
2023
+ enumerable: !1,
2024
+ value: null
2025
+ }) : Object.defineProperty(e, "ref", {
2026
+ enumerable: !1,
2027
+ get: l
2028
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
2029
+ configurable: !1,
2030
+ enumerable: !1,
2031
+ writable: !0,
2032
+ value: 0
2033
+ }), Object.defineProperty(e, "_debugInfo", {
2034
+ configurable: !1,
2035
+ enumerable: !1,
2036
+ writable: !0,
2037
+ value: null
2038
+ }), Object.defineProperty(e, "_debugStack", {
2039
+ configurable: !1,
2040
+ enumerable: !1,
2041
+ writable: !0,
2042
+ value: i
2043
+ }), Object.defineProperty(e, "_debugTask", {
2044
+ configurable: !1,
2045
+ enumerable: !1,
2046
+ writable: !0,
2047
+ value: a
2048
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
2049
+ }
2050
+ function d(e, n, i, o, l, d) {
2051
+ var p = n.children;
2052
+ if (p !== void 0) if (o) if (j(p)) {
2053
+ for (o = 0; o < p.length; o++) f(p[o]);
2054
+ Object.freeze && Object.freeze(p);
2055
+ } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
2056
+ else f(p);
2057
+ if (A.call(n, "key")) {
2058
+ p = t(e);
2059
+ var m = Object.keys(n).filter(function(e) {
2060
+ return e !== "key";
2061
+ });
2062
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
2063
+ }
2064
+ if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
2065
+ else i = n;
2066
+ return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
2067
+ }
2068
+ function f(e) {
2069
+ p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === E && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
2070
+ }
2071
+ function p(e) {
2072
+ return typeof e == "object" && !!e && e.$$typeof === h;
2073
+ }
2074
+ var m = M(), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), k = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, j = Array.isArray, N = console.createTask ? console.createTask : function() {
2075
+ return null;
2076
+ };
2077
+ m = { react_stack_bottom_frame: function(e) {
2078
+ return e();
2079
+ } };
2080
+ var P, F = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = N(i(o)), R = {};
2081
+ e.Fragment = _, e.jsx = function(e, t, n) {
2082
+ var r = 1e4 > k.recentlyCreatedOwnerStacks++;
2083
+ return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
2084
+ }, e.jsxs = function(e, t, n) {
2085
+ var r = 1e4 > k.recentlyCreatedOwnerStacks++;
2086
+ return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
2087
+ };
2088
+ })();
2089
+ })), F = /* @__PURE__ */ e(((e, t) => {
2090
+ process.env.NODE_ENV === "production" ? t.exports = N() : t.exports = P();
2091
+ })), I = M(), L = F(), R = class extends I.Component {
2092
+ constructor(e) {
2093
+ super(e), this.unfilteredDocuments = [], this.state = {
2094
+ documents: [],
2095
+ mode: 0
2096
+ };
2097
+ }
2098
+ async componentDidMount() {
2099
+ let { controller: e } = this.props;
2100
+ this.unsubscriber = e.onChange((t) => {
2101
+ t.documentCollection && (this.unfilteredDocuments = t.documentCollection, this.setState({ documents: e.filter(this.unfilteredDocuments) })), t.action === "filterChange" ? this.setState({ documents: e.filter(this.unfilteredDocuments) }) : this.setState({});
2102
+ }), this.unfilteredDocuments = await e.documentCollection(), this.setState({ documents: e.filter(this.unfilteredDocuments) });
2103
+ }
2104
+ componentWillUnmount() {
2105
+ this.unsubscriber?.();
2106
+ }
2107
+ newDocument() {
2108
+ this.props.controller.newDocument(), this.setState({ mode: 1 });
2109
+ }
2110
+ editDocument(e) {
2111
+ this.props.controller.setDocument(e), this.setState({ mode: 2 });
2112
+ }
2113
+ async storeDocument(e) {
2114
+ let { controller: t, layout: n } = this.props;
2115
+ t.setDocument(e), await t.storeDocument(), n === "formAndItems" ? this.newDocument() : this.setState({ mode: 0 });
2116
+ }
2117
+ invokeContentViewChild(e) {
2118
+ let { children: t, layout: n, controller: r } = this.props, { mode: i } = this.state, a = n !== "formAndItems";
2119
+ if (!r.document) return;
2120
+ let o = {
2121
+ controller: r,
2122
+ submitButtonCaption: i == 2 ? e?.updateButtonLabel : e?.addButtonLabel,
2123
+ onSubmit: (e) => this.storeDocument(e),
2124
+ onCancel: a ? () => this.setState({ mode: 0 }) : () => this.newDocument()
2125
+ };
2126
+ return typeof t[0] == "function" ? (0, I.cloneElement)(t[0](o), { key: r.document.id }) : (0, I.cloneElement)(t[0], {
2127
+ key: r.document.id,
2128
+ ...o
2129
+ });
2130
+ }
2131
+ invokeDetailViewChild(e) {
2132
+ let { children: t, controller: n } = this.props, r = {
2133
+ document: e,
2134
+ onSelect: (e) => this.editDocument(e),
2135
+ onDelete: (e) => n.setDocument(e).deleteDocument()
2136
+ };
2137
+ return typeof t[1] == "function" ? (0, I.cloneElement)(t[1](r), { key: e.id }) : (0, I.cloneElement)(t[1], {
2138
+ key: e.id,
2139
+ ...r
2140
+ });
2141
+ }
2142
+ render() {
2143
+ let { mode: e, documents: t } = this.state, { className: n, cardAddButton: r, controller: i } = this.props, a = D(i.document?.className), o = this.props.labels || {}, s = this.props.layout || "itemsAlways";
2144
+ typeof o == "function" && (o = o(i));
2145
+ let { addNewDocumentLabel: c, singularDocumentInCollectionCaption: l, documentsInCollectionCaption: u, noDocumentsFoundLabel: d } = o;
2146
+ return /* @__PURE__ */ (0, L.jsxs)("div", {
2147
+ className: `crud-panel ${a} ${n || ""}`,
2148
+ children: [
2149
+ e === 0 && s !== "formAndItems" && !r && /* @__PURE__ */ (0, L.jsx)("div", {
2150
+ className: "header",
2151
+ children: this.props.header ? typeof this.props.header == "function" ? this.props.header(i, () => this.newDocument(), o) : this.props.header : /* @__PURE__ */ (0, L.jsx)("button", {
2152
+ onClick: () => this.newDocument(),
2153
+ children: c
2154
+ })
2155
+ }),
2156
+ (s === "formAndItems" || e === 1 || e === 2) && /* @__PURE__ */ (0, L.jsx)("div", {
2157
+ className: "content-panel",
2158
+ children: this.invokeContentViewChild(o)
2159
+ }),
2160
+ (s === "itemsAlways" || s === "formAndItems" || e === 0) && /* @__PURE__ */ (0, L.jsxs)("div", {
2161
+ className: "collection-panel",
2162
+ children: [t?.length > 0 && /* @__PURE__ */ (0, L.jsx)("h3", { children: t.length > 1 ? u : l || u }), /* @__PURE__ */ (0, L.jsxs)("div", {
2163
+ className: "documents",
2164
+ children: [r && /* @__PURE__ */ (0, L.jsxs)("div", {
2165
+ className: "crud-card card-add-button clickable",
2166
+ onClick: () => this.newDocument(),
2167
+ children: [/* @__PURE__ */ (0, L.jsx)("div", {
2168
+ className: "button-element",
2169
+ children: r
2170
+ }), /* @__PURE__ */ (0, L.jsx)("div", {
2171
+ className: "add-label",
2172
+ children: c
2173
+ })]
2174
+ }), t?.length ? t.map((e) => this.invokeDetailViewChild(e)) : /* @__PURE__ */ (0, L.jsx)("p", { children: d })]
2175
+ })]
2176
+ }),
2177
+ /* @__PURE__ */ (0, L.jsx)("div", {
2178
+ className: "footer",
2179
+ children: this.props.footer && typeof this.props.footer == "function" ? this.props.footer(i, () => this.newDocument(), o) : this.props.footer
2180
+ })
2181
+ ]
2182
+ });
2183
+ }
805
2184
  };
806
- ne.errorMessages = {
807
- missedDocument: "No document to save"
808
- };
809
- let Ge = ne;
810
- var Te = { exports: {} }, _e = {};
811
- var Qe;
812
- function Ot() {
813
- if (Qe) return _e;
814
- Qe = 1;
815
- var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
816
- function s(a, c, p) {
817
- var O = null;
818
- if (p !== void 0 && (O = "" + p), c.key !== void 0 && (O = "" + c.key), "key" in c) {
819
- p = {};
820
- for (var S in c)
821
- S !== "key" && (p[S] = c[S]);
822
- } else p = c;
823
- return c = p.ref, {
824
- $$typeof: n,
825
- type: a,
826
- key: O,
827
- ref: c !== void 0 ? c : null,
828
- props: p
829
- };
830
- }
831
- return _e.Fragment = t, _e.jsx = s, _e.jsxs = s, _e;
832
- }
833
- var ye = {}, Oe = { exports: {} }, _ = {};
834
- var Xe;
835
- function St() {
836
- if (Xe) return _;
837
- Xe = 1;
838
- var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), p = Symbol.for("react.consumer"), O = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), V = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), L = Symbol.for("react.activity"), $ = Symbol.iterator;
839
- function U(r) {
840
- return r === null || typeof r != "object" ? null : (r = $ && r[$] || r["@@iterator"], typeof r == "function" ? r : null);
841
- }
842
- var Q = {
843
- isMounted: function() {
844
- return !1;
845
- },
846
- enqueueForceUpdate: function() {
847
- },
848
- enqueueReplaceState: function() {
849
- },
850
- enqueueSetState: function() {
851
- }
852
- }, oe = Object.assign, X = {};
853
- function W(r, i, f) {
854
- this.props = r, this.context = i, this.refs = X, this.updater = f || Q;
855
- }
856
- W.prototype.isReactComponent = {}, W.prototype.setState = function(r, i) {
857
- if (typeof r != "object" && typeof r != "function" && r != null)
858
- throw Error(
859
- "takes an object of state variables to update or a function which returns an object of state variables."
860
- );
861
- this.updater.enqueueSetState(this, r, i, "setState");
862
- }, W.prototype.forceUpdate = function(r) {
863
- this.updater.enqueueForceUpdate(this, r, "forceUpdate");
864
- };
865
- function K() {
866
- }
867
- K.prototype = W.prototype;
868
- function se(r, i, f) {
869
- this.props = r, this.context = i, this.refs = X, this.updater = f || Q;
870
- }
871
- var Z = se.prototype = new K();
872
- Z.constructor = se, oe(Z, W.prototype), Z.isPureReactComponent = !0;
873
- var F = Array.isArray;
874
- function ie() {
875
- }
876
- var R = { H: null, A: null, T: null, S: null }, le = Object.prototype.hasOwnProperty;
877
- function N(r, i, f) {
878
- var d = f.ref;
879
- return {
880
- $$typeof: n,
881
- type: r,
882
- key: i,
883
- ref: d !== void 0 ? d : null,
884
- props: f
885
- };
886
- }
887
- function J(r, i) {
888
- return N(r.type, i, r.props);
889
- }
890
- function ue(r) {
891
- return typeof r == "object" && r !== null && r.$$typeof === n;
892
- }
893
- function C(r) {
894
- var i = { "=": "=0", ":": "=2" };
895
- return "$" + r.replace(/[=:]/g, function(f) {
896
- return i[f];
897
- });
898
- }
899
- var ee = /\/+/g;
900
- function z(r, i) {
901
- return typeof r == "object" && r !== null && r.key != null ? C("" + r.key) : i.toString(36);
902
- }
903
- function q(r) {
904
- switch (r.status) {
905
- case "fulfilled":
906
- return r.value;
907
- case "rejected":
908
- throw r.reason;
909
- default:
910
- switch (typeof r.status == "string" ? r.then(ie, ie) : (r.status = "pending", r.then(
911
- function(i) {
912
- r.status === "pending" && (r.status = "fulfilled", r.value = i);
913
- },
914
- function(i) {
915
- r.status === "pending" && (r.status = "rejected", r.reason = i);
916
- }
917
- )), r.status) {
918
- case "fulfilled":
919
- return r.value;
920
- case "rejected":
921
- throw r.reason;
922
- }
923
- }
924
- throw r;
925
- }
926
- function M(r, i, f, d, g) {
927
- var w = typeof r;
928
- (w === "undefined" || w === "boolean") && (r = null);
929
- var m = !1;
930
- if (r === null) m = !0;
931
- else
932
- switch (w) {
933
- case "bigint":
934
- case "string":
935
- case "number":
936
- m = !0;
937
- break;
938
- case "object":
939
- switch (r.$$typeof) {
940
- case n:
941
- case t:
942
- m = !0;
943
- break;
944
- case I:
945
- return m = r._init, M(
946
- m(r._payload),
947
- i,
948
- f,
949
- d,
950
- g
951
- );
952
- }
953
- }
954
- if (m)
955
- return g = g(r), m = d === "" ? "." + z(r, 0) : d, F(g) ? (f = "", m != null && (f = m.replace(ee, "$&/") + "/"), M(g, i, f, "", function(G) {
956
- return G;
957
- })) : g != null && (ue(g) && (g = J(
958
- g,
959
- f + (g.key == null || r && r.key === g.key ? "" : ("" + g.key).replace(
960
- ee,
961
- "$&/"
962
- ) + "/") + m
963
- )), i.push(g)), 1;
964
- m = 0;
965
- var k = d === "" ? "." : d + ":";
966
- if (F(r))
967
- for (var P = 0; P < r.length; P++)
968
- d = r[P], w = k + z(d, P), m += M(
969
- d,
970
- i,
971
- f,
972
- w,
973
- g
974
- );
975
- else if (P = U(r), typeof P == "function")
976
- for (r = P.call(r), P = 0; !(d = r.next()).done; )
977
- d = d.value, w = k + z(d, P++), m += M(
978
- d,
979
- i,
980
- f,
981
- w,
982
- g
983
- );
984
- else if (w === "object") {
985
- if (typeof r.then == "function")
986
- return M(
987
- q(r),
988
- i,
989
- f,
990
- d,
991
- g
992
- );
993
- throw i = String(r), Error(
994
- "Objects are not valid as a React child (found: " + (i === "[object Object]" ? "object with keys {" + Object.keys(r).join(", ") + "}" : i) + "). If you meant to render a collection of children, use an array instead."
995
- );
996
- }
997
- return m;
998
- }
999
- function x(r, i, f) {
1000
- if (r == null) return r;
1001
- var d = [], g = 0;
1002
- return M(r, d, "", "", function(w) {
1003
- return i.call(f, w, g++);
1004
- }), d;
1005
- }
1006
- function te(r) {
1007
- if (r._status === -1) {
1008
- var i = r._result;
1009
- i = i(), i.then(
1010
- function(f) {
1011
- (r._status === 0 || r._status === -1) && (r._status = 1, r._result = f);
1012
- },
1013
- function(f) {
1014
- (r._status === 0 || r._status === -1) && (r._status = 2, r._result = f);
1015
- }
1016
- ), r._status === -1 && (r._status = 0, r._result = i);
1017
- }
1018
- if (r._status === 1) return r._result.default;
1019
- throw r._result;
1020
- }
1021
- var B = typeof reportError == "function" ? reportError : function(r) {
1022
- if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1023
- var i = new window.ErrorEvent("error", {
1024
- bubbles: !0,
1025
- cancelable: !0,
1026
- message: typeof r == "object" && r !== null && typeof r.message == "string" ? String(r.message) : String(r),
1027
- error: r
1028
- });
1029
- if (!window.dispatchEvent(i)) return;
1030
- } else if (typeof process == "object" && typeof process.emit == "function") {
1031
- process.emit("uncaughtException", r);
1032
- return;
1033
- }
1034
- console.error(r);
1035
- }, ae = {
1036
- map: x,
1037
- forEach: function(r, i, f) {
1038
- x(
1039
- r,
1040
- function() {
1041
- i.apply(this, arguments);
1042
- },
1043
- f
1044
- );
1045
- },
1046
- count: function(r) {
1047
- var i = 0;
1048
- return x(r, function() {
1049
- i++;
1050
- }), i;
1051
- },
1052
- toArray: function(r) {
1053
- return x(r, function(i) {
1054
- return i;
1055
- }) || [];
1056
- },
1057
- only: function(r) {
1058
- if (!ue(r))
1059
- throw Error(
1060
- "React.Children.only expected to receive a single React element child."
1061
- );
1062
- return r;
1063
- }
1064
- };
1065
- return _.Activity = L, _.Children = ae, _.Component = W, _.Fragment = s, _.Profiler = c, _.PureComponent = se, _.StrictMode = a, _.Suspense = D, _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = R, _.__COMPILER_RUNTIME = {
1066
- __proto__: null,
1067
- c: function(r) {
1068
- return R.H.useMemoCache(r);
1069
- }
1070
- }, _.cache = function(r) {
1071
- return function() {
1072
- return r.apply(null, arguments);
1073
- };
1074
- }, _.cacheSignal = function() {
1075
- return null;
1076
- }, _.cloneElement = function(r, i, f) {
1077
- if (r == null)
1078
- throw Error(
1079
- "The argument must be a React element, but you passed " + r + "."
1080
- );
1081
- var d = oe({}, r.props), g = r.key;
1082
- if (i != null)
1083
- for (w in i.key !== void 0 && (g = "" + i.key), i)
1084
- !le.call(i, w) || w === "key" || w === "__self" || w === "__source" || w === "ref" && i.ref === void 0 || (d[w] = i[w]);
1085
- var w = arguments.length - 2;
1086
- if (w === 1) d.children = f;
1087
- else if (1 < w) {
1088
- for (var m = Array(w), k = 0; k < w; k++)
1089
- m[k] = arguments[k + 2];
1090
- d.children = m;
1091
- }
1092
- return N(r.type, g, d);
1093
- }, _.createContext = function(r) {
1094
- return r = {
1095
- $$typeof: O,
1096
- _currentValue: r,
1097
- _currentValue2: r,
1098
- _threadCount: 0,
1099
- Provider: null,
1100
- Consumer: null
1101
- }, r.Provider = r, r.Consumer = {
1102
- $$typeof: p,
1103
- _context: r
1104
- }, r;
1105
- }, _.createElement = function(r, i, f) {
1106
- var d, g = {}, w = null;
1107
- if (i != null)
1108
- for (d in i.key !== void 0 && (w = "" + i.key), i)
1109
- le.call(i, d) && d !== "key" && d !== "__self" && d !== "__source" && (g[d] = i[d]);
1110
- var m = arguments.length - 2;
1111
- if (m === 1) g.children = f;
1112
- else if (1 < m) {
1113
- for (var k = Array(m), P = 0; P < m; P++)
1114
- k[P] = arguments[P + 2];
1115
- g.children = k;
1116
- }
1117
- if (r && r.defaultProps)
1118
- for (d in m = r.defaultProps, m)
1119
- g[d] === void 0 && (g[d] = m[d]);
1120
- return N(r, w, g);
1121
- }, _.createRef = function() {
1122
- return { current: null };
1123
- }, _.forwardRef = function(r) {
1124
- return { $$typeof: S, render: r };
1125
- }, _.isValidElement = ue, _.lazy = function(r) {
1126
- return {
1127
- $$typeof: I,
1128
- _payload: { _status: -1, _result: r },
1129
- _init: te
1130
- };
1131
- }, _.memo = function(r, i) {
1132
- return {
1133
- $$typeof: V,
1134
- type: r,
1135
- compare: i === void 0 ? null : i
1136
- };
1137
- }, _.startTransition = function(r) {
1138
- var i = R.T, f = {};
1139
- R.T = f;
1140
- try {
1141
- var d = r(), g = R.S;
1142
- g !== null && g(f, d), typeof d == "object" && d !== null && typeof d.then == "function" && d.then(ie, B);
1143
- } catch (w) {
1144
- B(w);
1145
- } finally {
1146
- i !== null && f.types !== null && (i.types = f.types), R.T = i;
1147
- }
1148
- }, _.unstable_useCacheRefresh = function() {
1149
- return R.H.useCacheRefresh();
1150
- }, _.use = function(r) {
1151
- return R.H.use(r);
1152
- }, _.useActionState = function(r, i, f) {
1153
- return R.H.useActionState(r, i, f);
1154
- }, _.useCallback = function(r, i) {
1155
- return R.H.useCallback(r, i);
1156
- }, _.useContext = function(r) {
1157
- return R.H.useContext(r);
1158
- }, _.useDebugValue = function() {
1159
- }, _.useDeferredValue = function(r, i) {
1160
- return R.H.useDeferredValue(r, i);
1161
- }, _.useEffect = function(r, i) {
1162
- return R.H.useEffect(r, i);
1163
- }, _.useEffectEvent = function(r) {
1164
- return R.H.useEffectEvent(r);
1165
- }, _.useId = function() {
1166
- return R.H.useId();
1167
- }, _.useImperativeHandle = function(r, i, f) {
1168
- return R.H.useImperativeHandle(r, i, f);
1169
- }, _.useInsertionEffect = function(r, i) {
1170
- return R.H.useInsertionEffect(r, i);
1171
- }, _.useLayoutEffect = function(r, i) {
1172
- return R.H.useLayoutEffect(r, i);
1173
- }, _.useMemo = function(r, i) {
1174
- return R.H.useMemo(r, i);
1175
- }, _.useOptimistic = function(r, i) {
1176
- return R.H.useOptimistic(r, i);
1177
- }, _.useReducer = function(r, i, f) {
1178
- return R.H.useReducer(r, i, f);
1179
- }, _.useRef = function(r) {
1180
- return R.H.useRef(r);
1181
- }, _.useState = function(r) {
1182
- return R.H.useState(r);
1183
- }, _.useSyncExternalStore = function(r, i, f) {
1184
- return R.H.useSyncExternalStore(
1185
- r,
1186
- i,
1187
- f
1188
- );
1189
- }, _.useTransition = function() {
1190
- return R.H.useTransition();
1191
- }, _.version = "19.2.3", _;
1192
- }
1193
- var ve = { exports: {} };
1194
- ve.exports;
1195
- var Ke;
1196
- function Pt() {
1197
- return Ke || (Ke = 1, function(n, t) {
1198
- process.env.NODE_ENV !== "production" && function() {
1199
- function s(e, o) {
1200
- Object.defineProperty(p.prototype, e, {
1201
- get: function() {
1202
- console.warn(
1203
- "%s(...) is deprecated in plain JavaScript React classes. %s",
1204
- o[0],
1205
- o[1]
1206
- );
1207
- }
1208
- });
1209
- }
1210
- function a(e) {
1211
- return e === null || typeof e != "object" ? null : (e = Ne && e[Ne] || e["@@iterator"], typeof e == "function" ? e : null);
1212
- }
1213
- function c(e, o) {
1214
- e = (e = e.constructor) && (e.displayName || e.name) || "ReactClass";
1215
- var u = e + "." + o;
1216
- Me[u] || (console.error(
1217
- "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
1218
- o,
1219
- e
1220
- ), Me[u] = !0);
1221
- }
1222
- function p(e, o, u) {
1223
- this.props = e, this.context = o, this.refs = Pe, this.updater = u || Ie;
1224
- }
1225
- function O() {
1226
- }
1227
- function S(e, o, u) {
1228
- this.props = e, this.context = o, this.refs = Pe, this.updater = u || Ie;
1229
- }
1230
- function D() {
1231
- }
1232
- function V(e) {
1233
- return "" + e;
1234
- }
1235
- function I(e) {
1236
- try {
1237
- V(e);
1238
- var o = !1;
1239
- } catch {
1240
- o = !0;
1241
- }
1242
- if (o) {
1243
- o = console;
1244
- var u = o.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
1245
- return u.call(
1246
- o,
1247
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1248
- l
1249
- ), V(e);
1250
- }
1251
- }
1252
- function L(e) {
1253
- if (e == null) return null;
1254
- if (typeof e == "function")
1255
- return e.$$typeof === st ? null : e.displayName || e.name || null;
1256
- if (typeof e == "string") return e;
1257
- switch (e) {
1258
- case r:
1259
- return "Fragment";
1260
- case f:
1261
- return "Profiler";
1262
- case i:
1263
- return "StrictMode";
1264
- case m:
1265
- return "Suspense";
1266
- case k:
1267
- return "SuspenseList";
1268
- case De:
1269
- return "Activity";
1270
- }
1271
- if (typeof e == "object")
1272
- switch (typeof e.tag == "number" && console.error(
1273
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1274
- ), e.$$typeof) {
1275
- case ae:
1276
- return "Portal";
1277
- case g:
1278
- return e.displayName || "Context";
1279
- case d:
1280
- return (e._context.displayName || "Context") + ".Consumer";
1281
- case w:
1282
- var o = e.render;
1283
- return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
1284
- case P:
1285
- return o = e.displayName || null, o !== null ? o : L(e.type) || "Memo";
1286
- case G:
1287
- o = e._payload, e = e._init;
1288
- try {
1289
- return L(e(o));
1290
- } catch {
1291
- }
1292
- }
1293
- return null;
1294
- }
1295
- function $(e) {
1296
- if (e === r) return "<>";
1297
- if (typeof e == "object" && e !== null && e.$$typeof === G)
1298
- return "<...>";
1299
- try {
1300
- var o = L(e);
1301
- return o ? "<" + o + ">" : "<...>";
1302
- } catch {
1303
- return "<...>";
1304
- }
1305
- }
1306
- function U() {
1307
- var e = v.A;
1308
- return e === null ? null : e.getOwner();
1309
- }
1310
- function Q() {
1311
- return Error("react-stack-top-frame");
1312
- }
1313
- function oe(e) {
1314
- if (be.call(e, "key")) {
1315
- var o = Object.getOwnPropertyDescriptor(e, "key").get;
1316
- if (o && o.isReactWarning) return !1;
1317
- }
1318
- return e.key !== void 0;
1319
- }
1320
- function X(e, o) {
1321
- function u() {
1322
- Ue || (Ue = !0, console.error(
1323
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1324
- o
1325
- ));
1326
- }
1327
- u.isReactWarning = !0, Object.defineProperty(e, "key", {
1328
- get: u,
1329
- configurable: !0
1330
- });
1331
- }
1332
- function W() {
1333
- var e = L(this.type);
1334
- return qe[e] || (qe[e] = !0, console.error(
1335
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1336
- )), e = this.props.ref, e !== void 0 ? e : null;
1337
- }
1338
- function K(e, o, u, l, h, E) {
1339
- var y = u.ref;
1340
- return e = {
1341
- $$typeof: B,
1342
- type: e,
1343
- key: o,
1344
- props: u,
1345
- _owner: l
1346
- }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
1347
- enumerable: !1,
1348
- get: W
1349
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
1350
- configurable: !1,
1351
- enumerable: !1,
1352
- writable: !0,
1353
- value: 0
1354
- }), Object.defineProperty(e, "_debugInfo", {
1355
- configurable: !1,
1356
- enumerable: !1,
1357
- writable: !0,
1358
- value: null
1359
- }), Object.defineProperty(e, "_debugStack", {
1360
- configurable: !1,
1361
- enumerable: !1,
1362
- writable: !0,
1363
- value: h
1364
- }), Object.defineProperty(e, "_debugTask", {
1365
- configurable: !1,
1366
- enumerable: !1,
1367
- writable: !0,
1368
- value: E
1369
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
1370
- }
1371
- function se(e, o) {
1372
- return o = K(
1373
- e.type,
1374
- o,
1375
- e.props,
1376
- e._owner,
1377
- e._debugStack,
1378
- e._debugTask
1379
- ), e._store && (o._store.validated = e._store.validated), o;
1380
- }
1381
- function Z(e) {
1382
- F(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === G && (e._payload.status === "fulfilled" ? F(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
1383
- }
1384
- function F(e) {
1385
- return typeof e == "object" && e !== null && e.$$typeof === B;
1386
- }
1387
- function ie(e) {
1388
- var o = { "=": "=0", ":": "=2" };
1389
- return "$" + e.replace(/[=:]/g, function(u) {
1390
- return o[u];
1391
- });
1392
- }
1393
- function R(e, o) {
1394
- return typeof e == "object" && e !== null && e.key != null ? (I(e.key), ie("" + e.key)) : o.toString(36);
1395
- }
1396
- function le(e) {
1397
- switch (e.status) {
1398
- case "fulfilled":
1399
- return e.value;
1400
- case "rejected":
1401
- throw e.reason;
1402
- default:
1403
- switch (typeof e.status == "string" ? e.then(D, D) : (e.status = "pending", e.then(
1404
- function(o) {
1405
- e.status === "pending" && (e.status = "fulfilled", e.value = o);
1406
- },
1407
- function(o) {
1408
- e.status === "pending" && (e.status = "rejected", e.reason = o);
1409
- }
1410
- )), e.status) {
1411
- case "fulfilled":
1412
- return e.value;
1413
- case "rejected":
1414
- throw e.reason;
1415
- }
1416
- }
1417
- throw e;
1418
- }
1419
- function N(e, o, u, l, h) {
1420
- var E = typeof e;
1421
- (E === "undefined" || E === "boolean") && (e = null);
1422
- var y = !1;
1423
- if (e === null) y = !0;
1424
- else
1425
- switch (E) {
1426
- case "bigint":
1427
- case "string":
1428
- case "number":
1429
- y = !0;
1430
- break;
1431
- case "object":
1432
- switch (e.$$typeof) {
1433
- case B:
1434
- case ae:
1435
- y = !0;
1436
- break;
1437
- case G:
1438
- return y = e._init, N(
1439
- y(e._payload),
1440
- o,
1441
- u,
1442
- l,
1443
- h
1444
- );
1445
- }
1446
- }
1447
- if (y) {
1448
- y = e, h = h(y);
1449
- var T = l === "" ? "." + R(y, 0) : l;
1450
- return Ye(h) ? (u = "", T != null && (u = T.replace($e, "$&/") + "/"), N(h, o, u, "", function(re) {
1451
- return re;
1452
- })) : h != null && (F(h) && (h.key != null && (y && y.key === h.key || I(h.key)), u = se(
1453
- h,
1454
- u + (h.key == null || y && y.key === h.key ? "" : ("" + h.key).replace(
1455
- $e,
1456
- "$&/"
1457
- ) + "/") + T
1458
- ), l !== "" && y != null && F(y) && y.key == null && y._store && !y._store.validated && (u._store.validated = 2), h = u), o.push(h)), 1;
1459
- }
1460
- if (y = 0, T = l === "" ? "." : l + ":", Ye(e))
1461
- for (var b = 0; b < e.length; b++)
1462
- l = e[b], E = T + R(l, b), y += N(
1463
- l,
1464
- o,
1465
- u,
1466
- E,
1467
- h
1468
- );
1469
- else if (b = a(e), typeof b == "function")
1470
- for (b === e.entries && (xe || console.warn(
1471
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
1472
- ), xe = !0), e = b.call(e), b = 0; !(l = e.next()).done; )
1473
- l = l.value, E = T + R(l, b++), y += N(
1474
- l,
1475
- o,
1476
- u,
1477
- E,
1478
- h
1479
- );
1480
- else if (E === "object") {
1481
- if (typeof e.then == "function")
1482
- return N(
1483
- le(e),
1484
- o,
1485
- u,
1486
- l,
1487
- h
1488
- );
1489
- throw o = String(e), Error(
1490
- "Objects are not valid as a React child (found: " + (o === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : o) + "). If you meant to render a collection of children, use an array instead."
1491
- );
1492
- }
1493
- return y;
1494
- }
1495
- function J(e, o, u) {
1496
- if (e == null) return e;
1497
- var l = [], h = 0;
1498
- return N(e, l, "", "", function(E) {
1499
- return o.call(u, E, h++);
1500
- }), l;
1501
- }
1502
- function ue(e) {
1503
- if (e._status === -1) {
1504
- var o = e._ioInfo;
1505
- o != null && (o.start = o.end = performance.now()), o = e._result;
1506
- var u = o();
1507
- if (u.then(
1508
- function(h) {
1509
- if (e._status === 0 || e._status === -1) {
1510
- e._status = 1, e._result = h;
1511
- var E = e._ioInfo;
1512
- E != null && (E.end = performance.now()), u.status === void 0 && (u.status = "fulfilled", u.value = h);
1513
- }
1514
- },
1515
- function(h) {
1516
- if (e._status === 0 || e._status === -1) {
1517
- e._status = 2, e._result = h;
1518
- var E = e._ioInfo;
1519
- E != null && (E.end = performance.now()), u.status === void 0 && (u.status = "rejected", u.reason = h);
1520
- }
1521
- }
1522
- ), o = e._ioInfo, o != null) {
1523
- o.value = u;
1524
- var l = u.displayName;
1525
- typeof l == "string" && (o.name = l);
1526
- }
1527
- e._status === -1 && (e._status = 0, e._result = u);
1528
- }
1529
- if (e._status === 1)
1530
- return o = e._result, o === void 0 && console.error(
1531
- `lazy: Expected the result of a dynamic import() call. Instead received: %s
1532
-
1533
- Your code should look like:
1534
- const MyComponent = lazy(() => import('./MyComponent'))
2185
+ //#endregion
2186
+ export { k as CrudController, R as CrudPanel };
1535
2187
 
1536
- Did you accidentally put curly braces around the import?`,
1537
- o
1538
- ), "default" in o || console.error(
1539
- `lazy: Expected the result of a dynamic import() call. Instead received: %s
1540
-
1541
- Your code should look like:
1542
- const MyComponent = lazy(() => import('./MyComponent'))`,
1543
- o
1544
- ), o.default;
1545
- throw e._result;
1546
- }
1547
- function C() {
1548
- var e = v.H;
1549
- return e === null && console.error(
1550
- `Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1551
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
1552
- 2. You might be breaking the Rules of Hooks
1553
- 3. You might have more than one copy of React in the same app
1554
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
1555
- ), e;
1556
- }
1557
- function ee() {
1558
- v.asyncTransitions--;
1559
- }
1560
- function z(e) {
1561
- if (we === null)
1562
- try {
1563
- var o = ("require" + Math.random()).slice(0, 7);
1564
- we = (n && n[o]).call(
1565
- n,
1566
- "timers"
1567
- ).setImmediate;
1568
- } catch {
1569
- we = function(l) {
1570
- ze === !1 && (ze = !0, typeof MessageChannel > "u" && console.error(
1571
- "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
1572
- ));
1573
- var h = new MessageChannel();
1574
- h.port1.onmessage = l, h.port2.postMessage(void 0);
1575
- };
1576
- }
1577
- return we(e);
1578
- }
1579
- function q(e) {
1580
- return 1 < e.length && typeof AggregateError == "function" ? new AggregateError(e) : e[0];
1581
- }
1582
- function M(e, o) {
1583
- o !== Re - 1 && console.error(
1584
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
1585
- ), Re = o;
1586
- }
1587
- function x(e, o, u) {
1588
- var l = v.actQueue;
1589
- if (l !== null)
1590
- if (l.length !== 0)
1591
- try {
1592
- te(l), z(function() {
1593
- return x(e, o, u);
1594
- });
1595
- return;
1596
- } catch (h) {
1597
- v.thrownErrors.push(h);
1598
- }
1599
- else v.actQueue = null;
1600
- 0 < v.thrownErrors.length ? (l = q(v.thrownErrors), v.thrownErrors.length = 0, u(l)) : o(e);
1601
- }
1602
- function te(e) {
1603
- if (!Ae) {
1604
- Ae = !0;
1605
- var o = 0;
1606
- try {
1607
- for (; o < e.length; o++) {
1608
- var u = e[o];
1609
- do {
1610
- v.didUsePromise = !1;
1611
- var l = u(!1);
1612
- if (l !== null) {
1613
- if (v.didUsePromise) {
1614
- e[o] = u, e.splice(0, o);
1615
- return;
1616
- }
1617
- u = l;
1618
- } else break;
1619
- } while (!0);
1620
- }
1621
- e.length = 0;
1622
- } catch (h) {
1623
- e.splice(0, o + 1), v.thrownErrors.push(h);
1624
- } finally {
1625
- Ae = !1;
1626
- }
1627
- }
1628
- }
1629
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1630
- var B = Symbol.for("react.transitional.element"), ae = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), d = Symbol.for("react.consumer"), g = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), De = Symbol.for("react.activity"), Ne = Symbol.iterator, Me = {}, Ie = {
1631
- isMounted: function() {
1632
- return !1;
1633
- },
1634
- enqueueForceUpdate: function(e) {
1635
- c(e, "forceUpdate");
1636
- },
1637
- enqueueReplaceState: function(e) {
1638
- c(e, "replaceState");
1639
- },
1640
- enqueueSetState: function(e) {
1641
- c(e, "setState");
1642
- }
1643
- }, Le = Object.assign, Pe = {};
1644
- Object.freeze(Pe), p.prototype.isReactComponent = {}, p.prototype.setState = function(e, o) {
1645
- if (typeof e != "object" && typeof e != "function" && e != null)
1646
- throw Error(
1647
- "takes an object of state variables to update or a function which returns an object of state variables."
1648
- );
1649
- this.updater.enqueueSetState(this, e, o, "setState");
1650
- }, p.prototype.forceUpdate = function(e) {
1651
- this.updater.enqueueForceUpdate(this, e, "forceUpdate");
1652
- };
1653
- var Y = {
1654
- isMounted: [
1655
- "isMounted",
1656
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
1657
- ],
1658
- replaceState: [
1659
- "replaceState",
1660
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
1661
- ]
1662
- };
1663
- for (me in Y)
1664
- Y.hasOwnProperty(me) && s(me, Y[me]);
1665
- O.prototype = p.prototype, Y = S.prototype = new O(), Y.constructor = S, Le(Y, p.prototype), Y.isPureReactComponent = !0;
1666
- var Ye = Array.isArray, st = Symbol.for("react.client.reference"), v = {
1667
- H: null,
1668
- A: null,
1669
- T: null,
1670
- S: null,
1671
- actQueue: null,
1672
- asyncTransitions: 0,
1673
- isBatchingLegacy: !1,
1674
- didScheduleLegacyUpdate: !1,
1675
- didUsePromise: !1,
1676
- thrownErrors: [],
1677
- getCurrentStack: null,
1678
- recentlyCreatedOwnerStacks: 0
1679
- }, be = Object.prototype.hasOwnProperty, He = console.createTask ? console.createTask : function() {
1680
- return null;
1681
- };
1682
- Y = {
1683
- react_stack_bottom_frame: function(e) {
1684
- return e();
1685
- }
1686
- };
1687
- var Ue, Fe, qe = {}, it = Y.react_stack_bottom_frame.bind(
1688
- Y,
1689
- Q
1690
- )(), ut = He($(Q)), xe = !1, $e = /\/+/g, We = typeof reportError == "function" ? reportError : function(e) {
1691
- if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1692
- var o = new window.ErrorEvent("error", {
1693
- bubbles: !0,
1694
- cancelable: !0,
1695
- message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
1696
- error: e
1697
- });
1698
- if (!window.dispatchEvent(o)) return;
1699
- } else if (typeof process == "object" && typeof process.emit == "function") {
1700
- process.emit("uncaughtException", e);
1701
- return;
1702
- }
1703
- console.error(e);
1704
- }, ze = !1, we = null, Re = 0, Ce = !1, Ae = !1, Ve = typeof queueMicrotask == "function" ? function(e) {
1705
- queueMicrotask(function() {
1706
- return queueMicrotask(e);
1707
- });
1708
- } : z;
1709
- Y = Object.freeze({
1710
- __proto__: null,
1711
- c: function(e) {
1712
- return C().useMemoCache(e);
1713
- }
1714
- });
1715
- var me = {
1716
- map: J,
1717
- forEach: function(e, o, u) {
1718
- J(
1719
- e,
1720
- function() {
1721
- o.apply(this, arguments);
1722
- },
1723
- u
1724
- );
1725
- },
1726
- count: function(e) {
1727
- var o = 0;
1728
- return J(e, function() {
1729
- o++;
1730
- }), o;
1731
- },
1732
- toArray: function(e) {
1733
- return J(e, function(o) {
1734
- return o;
1735
- }) || [];
1736
- },
1737
- only: function(e) {
1738
- if (!F(e))
1739
- throw Error(
1740
- "React.Children.only expected to receive a single React element child."
1741
- );
1742
- return e;
1743
- }
1744
- };
1745
- t.Activity = De, t.Children = me, t.Component = p, t.Fragment = r, t.Profiler = f, t.PureComponent = S, t.StrictMode = i, t.Suspense = m, t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = v, t.__COMPILER_RUNTIME = Y, t.act = function(e) {
1746
- var o = v.actQueue, u = Re;
1747
- Re++;
1748
- var l = v.actQueue = o !== null ? o : [], h = !1;
1749
- try {
1750
- var E = e();
1751
- } catch (b) {
1752
- v.thrownErrors.push(b);
1753
- }
1754
- if (0 < v.thrownErrors.length)
1755
- throw M(o, u), e = q(v.thrownErrors), v.thrownErrors.length = 0, e;
1756
- if (E !== null && typeof E == "object" && typeof E.then == "function") {
1757
- var y = E;
1758
- return Ve(function() {
1759
- h || Ce || (Ce = !0, console.error(
1760
- "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
1761
- ));
1762
- }), {
1763
- then: function(b, re) {
1764
- h = !0, y.then(
1765
- function(fe) {
1766
- if (M(o, u), u === 0) {
1767
- try {
1768
- te(l), z(function() {
1769
- return x(
1770
- fe,
1771
- b,
1772
- re
1773
- );
1774
- });
1775
- } catch (ct) {
1776
- v.thrownErrors.push(ct);
1777
- }
1778
- if (0 < v.thrownErrors.length) {
1779
- var at = q(
1780
- v.thrownErrors
1781
- );
1782
- v.thrownErrors.length = 0, re(at);
1783
- }
1784
- } else b(fe);
1785
- },
1786
- function(fe) {
1787
- M(o, u), 0 < v.thrownErrors.length && (fe = q(
1788
- v.thrownErrors
1789
- ), v.thrownErrors.length = 0), re(fe);
1790
- }
1791
- );
1792
- }
1793
- };
1794
- }
1795
- var T = E;
1796
- if (M(o, u), u === 0 && (te(l), l.length !== 0 && Ve(function() {
1797
- h || Ce || (Ce = !0, console.error(
1798
- "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
1799
- ));
1800
- }), v.actQueue = null), 0 < v.thrownErrors.length)
1801
- throw e = q(v.thrownErrors), v.thrownErrors.length = 0, e;
1802
- return {
1803
- then: function(b, re) {
1804
- h = !0, u === 0 ? (v.actQueue = l, z(function() {
1805
- return x(
1806
- T,
1807
- b,
1808
- re
1809
- );
1810
- })) : b(T);
1811
- }
1812
- };
1813
- }, t.cache = function(e) {
1814
- return function() {
1815
- return e.apply(null, arguments);
1816
- };
1817
- }, t.cacheSignal = function() {
1818
- return null;
1819
- }, t.captureOwnerStack = function() {
1820
- var e = v.getCurrentStack;
1821
- return e === null ? null : e();
1822
- }, t.cloneElement = function(e, o, u) {
1823
- if (e == null)
1824
- throw Error(
1825
- "The argument must be a React element, but you passed " + e + "."
1826
- );
1827
- var l = Le({}, e.props), h = e.key, E = e._owner;
1828
- if (o != null) {
1829
- var y;
1830
- e: {
1831
- if (be.call(o, "ref") && (y = Object.getOwnPropertyDescriptor(
1832
- o,
1833
- "ref"
1834
- ).get) && y.isReactWarning) {
1835
- y = !1;
1836
- break e;
1837
- }
1838
- y = o.ref !== void 0;
1839
- }
1840
- y && (E = U()), oe(o) && (I(o.key), h = "" + o.key);
1841
- for (T in o)
1842
- !be.call(o, T) || T === "key" || T === "__self" || T === "__source" || T === "ref" && o.ref === void 0 || (l[T] = o[T]);
1843
- }
1844
- var T = arguments.length - 2;
1845
- if (T === 1) l.children = u;
1846
- else if (1 < T) {
1847
- y = Array(T);
1848
- for (var b = 0; b < T; b++)
1849
- y[b] = arguments[b + 2];
1850
- l.children = y;
1851
- }
1852
- for (l = K(
1853
- e.type,
1854
- h,
1855
- l,
1856
- E,
1857
- e._debugStack,
1858
- e._debugTask
1859
- ), h = 2; h < arguments.length; h++)
1860
- Z(arguments[h]);
1861
- return l;
1862
- }, t.createContext = function(e) {
1863
- return e = {
1864
- $$typeof: g,
1865
- _currentValue: e,
1866
- _currentValue2: e,
1867
- _threadCount: 0,
1868
- Provider: null,
1869
- Consumer: null
1870
- }, e.Provider = e, e.Consumer = {
1871
- $$typeof: d,
1872
- _context: e
1873
- }, e._currentRenderer = null, e._currentRenderer2 = null, e;
1874
- }, t.createElement = function(e, o, u) {
1875
- for (var l = 2; l < arguments.length; l++)
1876
- Z(arguments[l]);
1877
- l = {};
1878
- var h = null;
1879
- if (o != null)
1880
- for (b in Fe || !("__self" in o) || "key" in o || (Fe = !0, console.warn(
1881
- "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
1882
- )), oe(o) && (I(o.key), h = "" + o.key), o)
1883
- be.call(o, b) && b !== "key" && b !== "__self" && b !== "__source" && (l[b] = o[b]);
1884
- var E = arguments.length - 2;
1885
- if (E === 1) l.children = u;
1886
- else if (1 < E) {
1887
- for (var y = Array(E), T = 0; T < E; T++)
1888
- y[T] = arguments[T + 2];
1889
- Object.freeze && Object.freeze(y), l.children = y;
1890
- }
1891
- if (e && e.defaultProps)
1892
- for (b in E = e.defaultProps, E)
1893
- l[b] === void 0 && (l[b] = E[b]);
1894
- h && X(
1895
- l,
1896
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
1897
- );
1898
- var b = 1e4 > v.recentlyCreatedOwnerStacks++;
1899
- return K(
1900
- e,
1901
- h,
1902
- l,
1903
- U(),
1904
- b ? Error("react-stack-top-frame") : it,
1905
- b ? He($(e)) : ut
1906
- );
1907
- }, t.createRef = function() {
1908
- var e = { current: null };
1909
- return Object.seal(e), e;
1910
- }, t.forwardRef = function(e) {
1911
- e != null && e.$$typeof === P ? console.error(
1912
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1913
- ) : typeof e != "function" ? console.error(
1914
- "forwardRef requires a render function but was given %s.",
1915
- e === null ? "null" : typeof e
1916
- ) : e.length !== 0 && e.length !== 2 && console.error(
1917
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
1918
- e.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1919
- ), e != null && e.defaultProps != null && console.error(
1920
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1921
- );
1922
- var o = { $$typeof: w, render: e }, u;
1923
- return Object.defineProperty(o, "displayName", {
1924
- enumerable: !1,
1925
- configurable: !0,
1926
- get: function() {
1927
- return u;
1928
- },
1929
- set: function(l) {
1930
- u = l, e.name || e.displayName || (Object.defineProperty(e, "name", { value: l }), e.displayName = l);
1931
- }
1932
- }), o;
1933
- }, t.isValidElement = F, t.lazy = function(e) {
1934
- e = { _status: -1, _result: e };
1935
- var o = {
1936
- $$typeof: G,
1937
- _payload: e,
1938
- _init: ue
1939
- }, u = {
1940
- name: "lazy",
1941
- start: -1,
1942
- end: -1,
1943
- value: null,
1944
- owner: null,
1945
- debugStack: Error("react-stack-top-frame"),
1946
- debugTask: console.createTask ? console.createTask("lazy()") : null
1947
- };
1948
- return e._ioInfo = u, o._debugInfo = [{ awaited: u }], o;
1949
- }, t.memo = function(e, o) {
1950
- e == null && console.error(
1951
- "memo: The first argument must be a component. Instead received: %s",
1952
- e === null ? "null" : typeof e
1953
- ), o = {
1954
- $$typeof: P,
1955
- type: e,
1956
- compare: o === void 0 ? null : o
1957
- };
1958
- var u;
1959
- return Object.defineProperty(o, "displayName", {
1960
- enumerable: !1,
1961
- configurable: !0,
1962
- get: function() {
1963
- return u;
1964
- },
1965
- set: function(l) {
1966
- u = l, e.name || e.displayName || (Object.defineProperty(e, "name", { value: l }), e.displayName = l);
1967
- }
1968
- }), o;
1969
- }, t.startTransition = function(e) {
1970
- var o = v.T, u = {};
1971
- u._updatedFibers = /* @__PURE__ */ new Set(), v.T = u;
1972
- try {
1973
- var l = e(), h = v.S;
1974
- h !== null && h(u, l), typeof l == "object" && l !== null && typeof l.then == "function" && (v.asyncTransitions++, l.then(ee, ee), l.then(D, We));
1975
- } catch (E) {
1976
- We(E);
1977
- } finally {
1978
- o === null && u._updatedFibers && (e = u._updatedFibers.size, u._updatedFibers.clear(), 10 < e && console.warn(
1979
- "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
1980
- )), o !== null && u.types !== null && (o.types !== null && o.types !== u.types && console.error(
1981
- "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
1982
- ), o.types = u.types), v.T = o;
1983
- }
1984
- }, t.unstable_useCacheRefresh = function() {
1985
- return C().useCacheRefresh();
1986
- }, t.use = function(e) {
1987
- return C().use(e);
1988
- }, t.useActionState = function(e, o, u) {
1989
- return C().useActionState(
1990
- e,
1991
- o,
1992
- u
1993
- );
1994
- }, t.useCallback = function(e, o) {
1995
- return C().useCallback(e, o);
1996
- }, t.useContext = function(e) {
1997
- var o = C();
1998
- return e.$$typeof === d && console.error(
1999
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
2000
- ), o.useContext(e);
2001
- }, t.useDebugValue = function(e, o) {
2002
- return C().useDebugValue(e, o);
2003
- }, t.useDeferredValue = function(e, o) {
2004
- return C().useDeferredValue(e, o);
2005
- }, t.useEffect = function(e, o) {
2006
- return e == null && console.warn(
2007
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
2008
- ), C().useEffect(e, o);
2009
- }, t.useEffectEvent = function(e) {
2010
- return C().useEffectEvent(e);
2011
- }, t.useId = function() {
2012
- return C().useId();
2013
- }, t.useImperativeHandle = function(e, o, u) {
2014
- return C().useImperativeHandle(e, o, u);
2015
- }, t.useInsertionEffect = function(e, o) {
2016
- return e == null && console.warn(
2017
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
2018
- ), C().useInsertionEffect(e, o);
2019
- }, t.useLayoutEffect = function(e, o) {
2020
- return e == null && console.warn(
2021
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
2022
- ), C().useLayoutEffect(e, o);
2023
- }, t.useMemo = function(e, o) {
2024
- return C().useMemo(e, o);
2025
- }, t.useOptimistic = function(e, o) {
2026
- return C().useOptimistic(e, o);
2027
- }, t.useReducer = function(e, o, u) {
2028
- return C().useReducer(e, o, u);
2029
- }, t.useRef = function(e) {
2030
- return C().useRef(e);
2031
- }, t.useState = function(e) {
2032
- return C().useState(e);
2033
- }, t.useSyncExternalStore = function(e, o, u) {
2034
- return C().useSyncExternalStore(
2035
- e,
2036
- o,
2037
- u
2038
- );
2039
- }, t.useTransition = function() {
2040
- return C().useTransition();
2041
- }, t.version = "19.2.3", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2042
- }();
2043
- }(ve, ve.exports)), ve.exports;
2044
- }
2045
- var Ze;
2046
- function ot() {
2047
- return Ze || (Ze = 1, process.env.NODE_ENV === "production" ? Oe.exports = St() : Oe.exports = Pt()), Oe.exports;
2048
- }
2049
- var Je;
2050
- function At() {
2051
- return Je || (Je = 1, process.env.NODE_ENV !== "production" && function() {
2052
- function n(r) {
2053
- if (r == null) return null;
2054
- if (typeof r == "function")
2055
- return r.$$typeof === ue ? null : r.displayName || r.name || null;
2056
- if (typeof r == "string") return r;
2057
- switch (r) {
2058
- case X:
2059
- return "Fragment";
2060
- case K:
2061
- return "Profiler";
2062
- case W:
2063
- return "StrictMode";
2064
- case ie:
2065
- return "Suspense";
2066
- case R:
2067
- return "SuspenseList";
2068
- case J:
2069
- return "Activity";
2070
- }
2071
- if (typeof r == "object")
2072
- switch (typeof r.tag == "number" && console.error(
2073
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
2074
- ), r.$$typeof) {
2075
- case oe:
2076
- return "Portal";
2077
- case Z:
2078
- return r.displayName || "Context";
2079
- case se:
2080
- return (r._context.displayName || "Context") + ".Consumer";
2081
- case F:
2082
- var i = r.render;
2083
- return r = r.displayName, r || (r = i.displayName || i.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
2084
- case le:
2085
- return i = r.displayName || null, i !== null ? i : n(r.type) || "Memo";
2086
- case N:
2087
- i = r._payload, r = r._init;
2088
- try {
2089
- return n(r(i));
2090
- } catch {
2091
- }
2092
- }
2093
- return null;
2094
- }
2095
- function t(r) {
2096
- return "" + r;
2097
- }
2098
- function s(r) {
2099
- try {
2100
- t(r);
2101
- var i = !1;
2102
- } catch {
2103
- i = !0;
2104
- }
2105
- if (i) {
2106
- i = console;
2107
- var f = i.error, d = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
2108
- return f.call(
2109
- i,
2110
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
2111
- d
2112
- ), t(r);
2113
- }
2114
- }
2115
- function a(r) {
2116
- if (r === X) return "<>";
2117
- if (typeof r == "object" && r !== null && r.$$typeof === N)
2118
- return "<...>";
2119
- try {
2120
- var i = n(r);
2121
- return i ? "<" + i + ">" : "<...>";
2122
- } catch {
2123
- return "<...>";
2124
- }
2125
- }
2126
- function c() {
2127
- var r = C.A;
2128
- return r === null ? null : r.getOwner();
2129
- }
2130
- function p() {
2131
- return Error("react-stack-top-frame");
2132
- }
2133
- function O(r) {
2134
- if (ee.call(r, "key")) {
2135
- var i = Object.getOwnPropertyDescriptor(r, "key").get;
2136
- if (i && i.isReactWarning) return !1;
2137
- }
2138
- return r.key !== void 0;
2139
- }
2140
- function S(r, i) {
2141
- function f() {
2142
- M || (M = !0, console.error(
2143
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
2144
- i
2145
- ));
2146
- }
2147
- f.isReactWarning = !0, Object.defineProperty(r, "key", {
2148
- get: f,
2149
- configurable: !0
2150
- });
2151
- }
2152
- function D() {
2153
- var r = n(this.type);
2154
- return x[r] || (x[r] = !0, console.error(
2155
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
2156
- )), r = this.props.ref, r !== void 0 ? r : null;
2157
- }
2158
- function V(r, i, f, d, g, w) {
2159
- var m = f.ref;
2160
- return r = {
2161
- $$typeof: Q,
2162
- type: r,
2163
- key: i,
2164
- props: f,
2165
- _owner: d
2166
- }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(r, "ref", {
2167
- enumerable: !1,
2168
- get: D
2169
- }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
2170
- configurable: !1,
2171
- enumerable: !1,
2172
- writable: !0,
2173
- value: 0
2174
- }), Object.defineProperty(r, "_debugInfo", {
2175
- configurable: !1,
2176
- enumerable: !1,
2177
- writable: !0,
2178
- value: null
2179
- }), Object.defineProperty(r, "_debugStack", {
2180
- configurable: !1,
2181
- enumerable: !1,
2182
- writable: !0,
2183
- value: g
2184
- }), Object.defineProperty(r, "_debugTask", {
2185
- configurable: !1,
2186
- enumerable: !1,
2187
- writable: !0,
2188
- value: w
2189
- }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
2190
- }
2191
- function I(r, i, f, d, g, w) {
2192
- var m = i.children;
2193
- if (m !== void 0)
2194
- if (d)
2195
- if (z(m)) {
2196
- for (d = 0; d < m.length; d++)
2197
- L(m[d]);
2198
- Object.freeze && Object.freeze(m);
2199
- } else
2200
- console.error(
2201
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
2202
- );
2203
- else L(m);
2204
- if (ee.call(i, "key")) {
2205
- m = n(r);
2206
- var k = Object.keys(i).filter(function(G) {
2207
- return G !== "key";
2208
- });
2209
- d = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", ae[m + d] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
2210
- `A props object containing a "key" prop is being spread into JSX:
2211
- let props = %s;
2212
- <%s {...props} />
2213
- React keys must be passed directly to JSX without using spread:
2214
- let props = %s;
2215
- <%s key={someKey} {...props} />`,
2216
- d,
2217
- m,
2218
- k,
2219
- m
2220
- ), ae[m + d] = !0);
2221
- }
2222
- if (m = null, f !== void 0 && (s(f), m = "" + f), O(i) && (s(i.key), m = "" + i.key), "key" in i) {
2223
- f = {};
2224
- for (var P in i)
2225
- P !== "key" && (f[P] = i[P]);
2226
- } else f = i;
2227
- return m && S(
2228
- f,
2229
- typeof r == "function" ? r.displayName || r.name || "Unknown" : r
2230
- ), V(
2231
- r,
2232
- m,
2233
- f,
2234
- c(),
2235
- g,
2236
- w
2237
- );
2238
- }
2239
- function L(r) {
2240
- $(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === N && (r._payload.status === "fulfilled" ? $(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
2241
- }
2242
- function $(r) {
2243
- return typeof r == "object" && r !== null && r.$$typeof === Q;
2244
- }
2245
- var U = ot(), Q = Symbol.for("react.transitional.element"), oe = Symbol.for("react.portal"), X = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), K = Symbol.for("react.profiler"), se = Symbol.for("react.consumer"), Z = Symbol.for("react.context"), F = Symbol.for("react.forward_ref"), ie = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), le = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), C = U.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, z = Array.isArray, q = console.createTask ? console.createTask : function() {
2246
- return null;
2247
- };
2248
- U = {
2249
- react_stack_bottom_frame: function(r) {
2250
- return r();
2251
- }
2252
- };
2253
- var M, x = {}, te = U.react_stack_bottom_frame.bind(
2254
- U,
2255
- p
2256
- )(), B = q(a(p)), ae = {};
2257
- ye.Fragment = X, ye.jsx = function(r, i, f) {
2258
- var d = 1e4 > C.recentlyCreatedOwnerStacks++;
2259
- return I(
2260
- r,
2261
- i,
2262
- f,
2263
- !1,
2264
- d ? Error("react-stack-top-frame") : te,
2265
- d ? q(a(r)) : B
2266
- );
2267
- }, ye.jsxs = function(r, i, f) {
2268
- var d = 1e4 > C.recentlyCreatedOwnerStacks++;
2269
- return I(
2270
- r,
2271
- i,
2272
- f,
2273
- !0,
2274
- d ? Error("react-stack-top-frame") : te,
2275
- d ? q(a(r)) : B
2276
- );
2277
- };
2278
- }()), ye;
2279
- }
2280
- var et;
2281
- function kt() {
2282
- return et || (et = 1, process.env.NODE_ENV === "production" ? Te.exports = Ot() : Te.exports = At()), Te.exports;
2283
- }
2284
- var H = kt(), ge = ot();
2285
- class jt extends ge.Component {
2286
- constructor(t) {
2287
- super(t), this.unfilteredDocuments = [], this.state = {
2288
- documents: [],
2289
- mode: 0
2290
- /* normal */
2291
- };
2292
- }
2293
- async componentDidMount() {
2294
- const { controller: t } = this.props;
2295
- this.unsubscriber = t.onChange((s) => {
2296
- s.documentCollection && (this.unfilteredDocuments = s.documentCollection, this.setState({
2297
- documents: t.filter(this.unfilteredDocuments)
2298
- })), s.action === "filterChange" ? this.setState({
2299
- documents: t.filter(this.unfilteredDocuments)
2300
- }) : this.setState({});
2301
- }), this.unfilteredDocuments = await t.documentCollection(), this.setState({
2302
- documents: t.filter(this.unfilteredDocuments)
2303
- });
2304
- }
2305
- componentWillUnmount() {
2306
- this.unsubscriber?.();
2307
- }
2308
- newDocument() {
2309
- this.props.controller.newDocument(), this.setState({
2310
- mode: 1
2311
- /* add */
2312
- });
2313
- }
2314
- editDocument(t) {
2315
- this.props.controller.setDocument(t), this.setState({
2316
- mode: 2
2317
- /* edit */
2318
- });
2319
- }
2320
- async storeDocument(t) {
2321
- const { controller: s, layout: a } = this.props;
2322
- s.setDocument(t), await s.storeDocument(), a === "formAndItems" ? this.newDocument() : this.setState({
2323
- mode: 0
2324
- /* normal */
2325
- });
2326
- }
2327
- invokeContentViewChild(t) {
2328
- const { children: s, layout: a, controller: c } = this.props, { mode: p } = this.state, O = a !== "formAndItems";
2329
- if (!c.document) return;
2330
- const S = {
2331
- controller: c,
2332
- submitButtonCaption: p == 2 ? t?.updateButtonLabel : t?.addButtonLabel,
2333
- onSubmit: (D) => this.storeDocument(D),
2334
- onCancel: O ? () => this.setState({
2335
- mode: 0
2336
- /* normal */
2337
- }) : () => this.newDocument()
2338
- };
2339
- return typeof s[0] == "function" ? ge.cloneElement(s[0](S), { key: c.document.id }) : ge.cloneElement(s[0], { key: c.document.id, ...S });
2340
- }
2341
- invokeDetailViewChild(t) {
2342
- const { children: s, controller: a } = this.props, c = {
2343
- document: t,
2344
- onSelect: (p) => this.editDocument(p),
2345
- onDelete: (p) => a.setDocument(p).deleteDocument()
2346
- };
2347
- return typeof s[1] == "function" ? ge.cloneElement(s[1](c), { key: t.id }) : ge.cloneElement(s[1], { key: t.id, ...c });
2348
- }
2349
- render() {
2350
- const { mode: t, documents: s } = this.state, { className: a, cardAddButton: c, controller: p } = this.props, O = Ct(p.document?.className);
2351
- let S = this.props.labels || {};
2352
- const D = this.props.layout || "itemsAlways";
2353
- typeof S == "function" && (S = S(p));
2354
- const { addNewDocumentLabel: V, singularDocumentInCollectionCaption: I, documentsInCollectionCaption: L, noDocumentsFoundLabel: $ } = S;
2355
- return /* @__PURE__ */ H.jsxs("div", { className: `crud-panel ${O} ${a || ""}`, children: [
2356
- t === 0 && D !== "formAndItems" && !c && /* @__PURE__ */ H.jsx("div", { className: "header", children: this.props.header ? typeof this.props.header == "function" ? this.props.header(p, () => this.newDocument(), S) : this.props.header : /* @__PURE__ */ H.jsx("button", { onClick: () => this.newDocument(), children: V }) }),
2357
- (D === "formAndItems" || t === 1 || t === 2) && /* @__PURE__ */ H.jsx("div", { className: "content-panel", children: this.invokeContentViewChild(S) }),
2358
- (D === "itemsAlways" || D === "formAndItems" || t === 0) && /* @__PURE__ */ H.jsxs("div", { className: "collection-panel", children: [
2359
- s?.length > 0 && /* @__PURE__ */ H.jsx("h3", { children: s.length > 1 ? L : I || L }),
2360
- /* @__PURE__ */ H.jsxs("div", { className: "documents", children: [
2361
- c && /* @__PURE__ */ H.jsxs(
2362
- "div",
2363
- {
2364
- className: "crud-card card-add-button clickable",
2365
- onClick: () => this.newDocument(),
2366
- children: [
2367
- /* @__PURE__ */ H.jsx("div", { className: "button-element", children: c }),
2368
- /* @__PURE__ */ H.jsx("div", { className: "add-label", children: V })
2369
- ]
2370
- }
2371
- ),
2372
- s?.length ? s.map((U) => this.invokeDetailViewChild(U)) : /* @__PURE__ */ H.jsx("p", { children: $ })
2373
- ] })
2374
- ] }),
2375
- /* @__PURE__ */ H.jsx("div", { className: "footer", children: this.props.footer && typeof this.props.footer == "function" ? this.props.footer(p, () => this.newDocument(), S) : this.props.footer })
2376
- ] });
2377
- }
2378
- }
2379
- export {
2380
- Ge as CrudController,
2381
- jt as CrudPanel
2382
- };
2383
- //# sourceMappingURL=entropic-bond-crud-panel.js.map
2188
+ //# sourceMappingURL=entropic-bond-crud-panel.js.map