@entropic-bond/crud-panel 4.0.4 → 4.1.0

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