@katlux/providers 0.1.0-beta.9 → 0.1.1-alpha.85

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.
package/dist/index.cjs CHANGED
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ const vue = require('vue');
4
+ const nuxtAppCompat = require('@katlux/providers/nuxtAppCompat');
3
5
  const providers = require('@katlux/providers');
6
+ const h3 = require('h3');
7
+ const ofetch = require('ofetch');
4
8
 
5
9
  var EDataFilterOperator = /* @__PURE__ */ ((EDataFilterOperator2) => {
6
10
  EDataFilterOperator2["Equal"] = "==";
@@ -27,2840 +31,6 @@ var ECacheStrategy = /* @__PURE__ */ ((ECacheStrategy2) => {
27
31
  return ECacheStrategy2;
28
32
  })(ECacheStrategy || {});
29
33
 
30
- /**
31
- * @vue/shared v3.5.24
32
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
33
- * @license MIT
34
- **/
35
- // @__NO_SIDE_EFFECTS__
36
- function makeMap(str) {
37
- const map = /* @__PURE__ */ Object.create(null);
38
- for (const key of str.split(",")) map[key] = 1;
39
- return (val) => val in map;
40
- }
41
-
42
- const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
43
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
44
- const NOOP = () => {
45
- };
46
- const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
47
- (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
48
- const extend = Object.assign;
49
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
50
- const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
51
- const isArray = Array.isArray;
52
- const isMap = (val) => toTypeString(val) === "[object Map]";
53
- const isSet = (val) => toTypeString(val) === "[object Set]";
54
- const isFunction = (val) => typeof val === "function";
55
- const isString = (val) => typeof val === "string";
56
- const isSymbol = (val) => typeof val === "symbol";
57
- const isObject = (val) => val !== null && typeof val === "object";
58
- const isPromise = (val) => {
59
- return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
60
- };
61
- const objectToString = Object.prototype.toString;
62
- const toTypeString = (value) => objectToString.call(value);
63
- const toRawType = (value) => {
64
- return toTypeString(value).slice(8, -1);
65
- };
66
- const isPlainObject = (val) => toTypeString(val) === "[object Object]";
67
- const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
68
- const cacheStringFunction = (fn) => {
69
- const cache = /* @__PURE__ */ Object.create(null);
70
- return ((str) => {
71
- const hit = cache[str];
72
- return hit || (cache[str] = fn(str));
73
- });
74
- };
75
- const capitalize = cacheStringFunction((str) => {
76
- return str.charAt(0).toUpperCase() + str.slice(1);
77
- });
78
- const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
79
- let _globalThis;
80
- const getGlobalThis = () => {
81
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
82
- };
83
-
84
- function normalizeStyle(value) {
85
- if (isArray(value)) {
86
- const res = {};
87
- for (let i = 0; i < value.length; i++) {
88
- const item = value[i];
89
- const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
90
- if (normalized) {
91
- for (const key in normalized) {
92
- res[key] = normalized[key];
93
- }
94
- }
95
- }
96
- return res;
97
- } else if (isString(value) || isObject(value)) {
98
- return value;
99
- }
100
- }
101
- const listDelimiterRE = /;(?![^(]*\))/g;
102
- const propertyDelimiterRE = /:([^]+)/;
103
- const styleCommentRE = /\/\*[^]*?\*\//g;
104
- function parseStringStyle(cssText) {
105
- const ret = {};
106
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
107
- if (item) {
108
- const tmp = item.split(propertyDelimiterRE);
109
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
110
- }
111
- });
112
- return ret;
113
- }
114
- function normalizeClass(value) {
115
- let res = "";
116
- if (isString(value)) {
117
- res = value;
118
- } else if (isArray(value)) {
119
- for (let i = 0; i < value.length; i++) {
120
- const normalized = normalizeClass(value[i]);
121
- if (normalized) {
122
- res += normalized + " ";
123
- }
124
- }
125
- } else if (isObject(value)) {
126
- for (const name in value) {
127
- if (value[name]) {
128
- res += name + " ";
129
- }
130
- }
131
- }
132
- return res.trim();
133
- }
134
-
135
- /**
136
- * @vue/reactivity v3.5.24
137
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
138
- * @license MIT
139
- **/
140
-
141
- function warn(msg, ...args) {
142
- console.warn(`[Vue warn] ${msg}`, ...args);
143
- }
144
-
145
- let activeSub;
146
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
147
- class ReactiveEffect {
148
- constructor(fn) {
149
- this.fn = fn;
150
- /**
151
- * @internal
152
- */
153
- this.deps = void 0;
154
- /**
155
- * @internal
156
- */
157
- this.depsTail = void 0;
158
- /**
159
- * @internal
160
- */
161
- this.flags = 1 | 4;
162
- /**
163
- * @internal
164
- */
165
- this.next = void 0;
166
- /**
167
- * @internal
168
- */
169
- this.cleanup = void 0;
170
- this.scheduler = void 0;
171
- }
172
- pause() {
173
- this.flags |= 64;
174
- }
175
- resume() {
176
- if (this.flags & 64) {
177
- this.flags &= -65;
178
- if (pausedQueueEffects.has(this)) {
179
- pausedQueueEffects.delete(this);
180
- this.trigger();
181
- }
182
- }
183
- }
184
- /**
185
- * @internal
186
- */
187
- notify() {
188
- if (this.flags & 2 && !(this.flags & 32)) {
189
- return;
190
- }
191
- if (!(this.flags & 8)) {
192
- batch(this);
193
- }
194
- }
195
- run() {
196
- if (!(this.flags & 1)) {
197
- return this.fn();
198
- }
199
- this.flags |= 2;
200
- cleanupEffect(this);
201
- prepareDeps(this);
202
- const prevEffect = activeSub;
203
- const prevShouldTrack = shouldTrack;
204
- activeSub = this;
205
- shouldTrack = true;
206
- try {
207
- return this.fn();
208
- } finally {
209
- if (!!(process.env.NODE_ENV !== "production") && activeSub !== this) {
210
- warn(
211
- "Active effect was not restored correctly - this is likely a Vue internal bug."
212
- );
213
- }
214
- cleanupDeps(this);
215
- activeSub = prevEffect;
216
- shouldTrack = prevShouldTrack;
217
- this.flags &= -3;
218
- }
219
- }
220
- stop() {
221
- if (this.flags & 1) {
222
- for (let link = this.deps; link; link = link.nextDep) {
223
- removeSub(link);
224
- }
225
- this.deps = this.depsTail = void 0;
226
- cleanupEffect(this);
227
- this.onStop && this.onStop();
228
- this.flags &= -2;
229
- }
230
- }
231
- trigger() {
232
- if (this.flags & 64) {
233
- pausedQueueEffects.add(this);
234
- } else if (this.scheduler) {
235
- this.scheduler();
236
- } else {
237
- this.runIfDirty();
238
- }
239
- }
240
- /**
241
- * @internal
242
- */
243
- runIfDirty() {
244
- if (isDirty(this)) {
245
- this.run();
246
- }
247
- }
248
- get dirty() {
249
- return isDirty(this);
250
- }
251
- }
252
- let batchDepth = 0;
253
- let batchedSub;
254
- let batchedComputed;
255
- function batch(sub, isComputed = false) {
256
- sub.flags |= 8;
257
- if (isComputed) {
258
- sub.next = batchedComputed;
259
- batchedComputed = sub;
260
- return;
261
- }
262
- sub.next = batchedSub;
263
- batchedSub = sub;
264
- }
265
- function startBatch() {
266
- batchDepth++;
267
- }
268
- function endBatch() {
269
- if (--batchDepth > 0) {
270
- return;
271
- }
272
- if (batchedComputed) {
273
- let e = batchedComputed;
274
- batchedComputed = void 0;
275
- while (e) {
276
- const next = e.next;
277
- e.next = void 0;
278
- e.flags &= -9;
279
- e = next;
280
- }
281
- }
282
- let error;
283
- while (batchedSub) {
284
- let e = batchedSub;
285
- batchedSub = void 0;
286
- while (e) {
287
- const next = e.next;
288
- e.next = void 0;
289
- e.flags &= -9;
290
- if (e.flags & 1) {
291
- try {
292
- ;
293
- e.trigger();
294
- } catch (err) {
295
- if (!error) error = err;
296
- }
297
- }
298
- e = next;
299
- }
300
- }
301
- if (error) throw error;
302
- }
303
- function prepareDeps(sub) {
304
- for (let link = sub.deps; link; link = link.nextDep) {
305
- link.version = -1;
306
- link.prevActiveLink = link.dep.activeLink;
307
- link.dep.activeLink = link;
308
- }
309
- }
310
- function cleanupDeps(sub) {
311
- let head;
312
- let tail = sub.depsTail;
313
- let link = tail;
314
- while (link) {
315
- const prev = link.prevDep;
316
- if (link.version === -1) {
317
- if (link === tail) tail = prev;
318
- removeSub(link);
319
- removeDep(link);
320
- } else {
321
- head = link;
322
- }
323
- link.dep.activeLink = link.prevActiveLink;
324
- link.prevActiveLink = void 0;
325
- link = prev;
326
- }
327
- sub.deps = head;
328
- sub.depsTail = tail;
329
- }
330
- function isDirty(sub) {
331
- for (let link = sub.deps; link; link = link.nextDep) {
332
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
333
- return true;
334
- }
335
- }
336
- if (sub._dirty) {
337
- return true;
338
- }
339
- return false;
340
- }
341
- function refreshComputed(computed) {
342
- if (computed.flags & 4 && !(computed.flags & 16)) {
343
- return;
344
- }
345
- computed.flags &= -17;
346
- if (computed.globalVersion === globalVersion) {
347
- return;
348
- }
349
- computed.globalVersion = globalVersion;
350
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
351
- return;
352
- }
353
- computed.flags |= 2;
354
- const dep = computed.dep;
355
- const prevSub = activeSub;
356
- const prevShouldTrack = shouldTrack;
357
- activeSub = computed;
358
- shouldTrack = true;
359
- try {
360
- prepareDeps(computed);
361
- const value = computed.fn(computed._value);
362
- if (dep.version === 0 || hasChanged(value, computed._value)) {
363
- computed.flags |= 128;
364
- computed._value = value;
365
- dep.version++;
366
- }
367
- } catch (err) {
368
- dep.version++;
369
- throw err;
370
- } finally {
371
- activeSub = prevSub;
372
- shouldTrack = prevShouldTrack;
373
- cleanupDeps(computed);
374
- computed.flags &= -3;
375
- }
376
- }
377
- function removeSub(link, soft = false) {
378
- const { dep, prevSub, nextSub } = link;
379
- if (prevSub) {
380
- prevSub.nextSub = nextSub;
381
- link.prevSub = void 0;
382
- }
383
- if (nextSub) {
384
- nextSub.prevSub = prevSub;
385
- link.nextSub = void 0;
386
- }
387
- if (!!(process.env.NODE_ENV !== "production") && dep.subsHead === link) {
388
- dep.subsHead = nextSub;
389
- }
390
- if (dep.subs === link) {
391
- dep.subs = prevSub;
392
- if (!prevSub && dep.computed) {
393
- dep.computed.flags &= -5;
394
- for (let l = dep.computed.deps; l; l = l.nextDep) {
395
- removeSub(l, true);
396
- }
397
- }
398
- }
399
- if (!soft && !--dep.sc && dep.map) {
400
- dep.map.delete(dep.key);
401
- }
402
- }
403
- function removeDep(link) {
404
- const { prevDep, nextDep } = link;
405
- if (prevDep) {
406
- prevDep.nextDep = nextDep;
407
- link.prevDep = void 0;
408
- }
409
- if (nextDep) {
410
- nextDep.prevDep = prevDep;
411
- link.nextDep = void 0;
412
- }
413
- }
414
- let shouldTrack = true;
415
- const trackStack = [];
416
- function pauseTracking() {
417
- trackStack.push(shouldTrack);
418
- shouldTrack = false;
419
- }
420
- function resetTracking() {
421
- const last = trackStack.pop();
422
- shouldTrack = last === void 0 ? true : last;
423
- }
424
- function cleanupEffect(e) {
425
- const { cleanup } = e;
426
- e.cleanup = void 0;
427
- if (cleanup) {
428
- const prevSub = activeSub;
429
- activeSub = void 0;
430
- try {
431
- cleanup();
432
- } finally {
433
- activeSub = prevSub;
434
- }
435
- }
436
- }
437
-
438
- let globalVersion = 0;
439
- class Link {
440
- constructor(sub, dep) {
441
- this.sub = sub;
442
- this.dep = dep;
443
- this.version = dep.version;
444
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
445
- }
446
- }
447
- class Dep {
448
- // TODO isolatedDeclarations "__v_skip"
449
- constructor(computed) {
450
- this.computed = computed;
451
- this.version = 0;
452
- /**
453
- * Link between this dep and the current active effect
454
- */
455
- this.activeLink = void 0;
456
- /**
457
- * Doubly linked list representing the subscribing effects (tail)
458
- */
459
- this.subs = void 0;
460
- /**
461
- * For object property deps cleanup
462
- */
463
- this.map = void 0;
464
- this.key = void 0;
465
- /**
466
- * Subscriber counter
467
- */
468
- this.sc = 0;
469
- /**
470
- * @internal
471
- */
472
- this.__v_skip = true;
473
- if (!!(process.env.NODE_ENV !== "production")) {
474
- this.subsHead = void 0;
475
- }
476
- }
477
- track(debugInfo) {
478
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
479
- return;
480
- }
481
- let link = this.activeLink;
482
- if (link === void 0 || link.sub !== activeSub) {
483
- link = this.activeLink = new Link(activeSub, this);
484
- if (!activeSub.deps) {
485
- activeSub.deps = activeSub.depsTail = link;
486
- } else {
487
- link.prevDep = activeSub.depsTail;
488
- activeSub.depsTail.nextDep = link;
489
- activeSub.depsTail = link;
490
- }
491
- addSub(link);
492
- } else if (link.version === -1) {
493
- link.version = this.version;
494
- if (link.nextDep) {
495
- const next = link.nextDep;
496
- next.prevDep = link.prevDep;
497
- if (link.prevDep) {
498
- link.prevDep.nextDep = next;
499
- }
500
- link.prevDep = activeSub.depsTail;
501
- link.nextDep = void 0;
502
- activeSub.depsTail.nextDep = link;
503
- activeSub.depsTail = link;
504
- if (activeSub.deps === link) {
505
- activeSub.deps = next;
506
- }
507
- }
508
- }
509
- if (!!(process.env.NODE_ENV !== "production") && activeSub.onTrack) {
510
- activeSub.onTrack(
511
- extend(
512
- {
513
- effect: activeSub
514
- },
515
- debugInfo
516
- )
517
- );
518
- }
519
- return link;
520
- }
521
- trigger(debugInfo) {
522
- this.version++;
523
- globalVersion++;
524
- this.notify(debugInfo);
525
- }
526
- notify(debugInfo) {
527
- startBatch();
528
- try {
529
- if (!!(process.env.NODE_ENV !== "production")) {
530
- for (let head = this.subsHead; head; head = head.nextSub) {
531
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
532
- head.sub.onTrigger(
533
- extend(
534
- {
535
- effect: head.sub
536
- },
537
- debugInfo
538
- )
539
- );
540
- }
541
- }
542
- }
543
- for (let link = this.subs; link; link = link.prevSub) {
544
- if (link.sub.notify()) {
545
- ;
546
- link.sub.dep.notify();
547
- }
548
- }
549
- } finally {
550
- endBatch();
551
- }
552
- }
553
- }
554
- function addSub(link) {
555
- link.dep.sc++;
556
- if (link.sub.flags & 4) {
557
- const computed = link.dep.computed;
558
- if (computed && !link.dep.subs) {
559
- computed.flags |= 4 | 16;
560
- for (let l = computed.deps; l; l = l.nextDep) {
561
- addSub(l);
562
- }
563
- }
564
- const currentTail = link.dep.subs;
565
- if (currentTail !== link) {
566
- link.prevSub = currentTail;
567
- if (currentTail) currentTail.nextSub = link;
568
- }
569
- if (!!(process.env.NODE_ENV !== "production") && link.dep.subsHead === void 0) {
570
- link.dep.subsHead = link;
571
- }
572
- link.dep.subs = link;
573
- }
574
- }
575
- const targetMap = /* @__PURE__ */ new WeakMap();
576
- const ITERATE_KEY = Symbol(
577
- !!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
578
- );
579
- const MAP_KEY_ITERATE_KEY = Symbol(
580
- !!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
581
- );
582
- const ARRAY_ITERATE_KEY = Symbol(
583
- !!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
584
- );
585
- function track(target, type, key) {
586
- if (shouldTrack && activeSub) {
587
- let depsMap = targetMap.get(target);
588
- if (!depsMap) {
589
- targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
590
- }
591
- let dep = depsMap.get(key);
592
- if (!dep) {
593
- depsMap.set(key, dep = new Dep());
594
- dep.map = depsMap;
595
- dep.key = key;
596
- }
597
- if (!!(process.env.NODE_ENV !== "production")) {
598
- dep.track({
599
- target,
600
- type,
601
- key
602
- });
603
- } else {
604
- dep.track();
605
- }
606
- }
607
- }
608
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
609
- const depsMap = targetMap.get(target);
610
- if (!depsMap) {
611
- globalVersion++;
612
- return;
613
- }
614
- const run = (dep) => {
615
- if (dep) {
616
- if (!!(process.env.NODE_ENV !== "production")) {
617
- dep.trigger({
618
- target,
619
- type,
620
- key,
621
- newValue,
622
- oldValue,
623
- oldTarget
624
- });
625
- } else {
626
- dep.trigger();
627
- }
628
- }
629
- };
630
- startBatch();
631
- if (type === "clear") {
632
- depsMap.forEach(run);
633
- } else {
634
- const targetIsArray = isArray(target);
635
- const isArrayIndex = targetIsArray && isIntegerKey(key);
636
- if (targetIsArray && key === "length") {
637
- const newLength = Number(newValue);
638
- depsMap.forEach((dep, key2) => {
639
- if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
640
- run(dep);
641
- }
642
- });
643
- } else {
644
- if (key !== void 0 || depsMap.has(void 0)) {
645
- run(depsMap.get(key));
646
- }
647
- if (isArrayIndex) {
648
- run(depsMap.get(ARRAY_ITERATE_KEY));
649
- }
650
- switch (type) {
651
- case "add":
652
- if (!targetIsArray) {
653
- run(depsMap.get(ITERATE_KEY));
654
- if (isMap(target)) {
655
- run(depsMap.get(MAP_KEY_ITERATE_KEY));
656
- }
657
- } else if (isArrayIndex) {
658
- run(depsMap.get("length"));
659
- }
660
- break;
661
- case "delete":
662
- if (!targetIsArray) {
663
- run(depsMap.get(ITERATE_KEY));
664
- if (isMap(target)) {
665
- run(depsMap.get(MAP_KEY_ITERATE_KEY));
666
- }
667
- }
668
- break;
669
- case "set":
670
- if (isMap(target)) {
671
- run(depsMap.get(ITERATE_KEY));
672
- }
673
- break;
674
- }
675
- }
676
- }
677
- endBatch();
678
- }
679
-
680
- function reactiveReadArray(array) {
681
- const raw = toRaw(array);
682
- if (raw === array) return raw;
683
- track(raw, "iterate", ARRAY_ITERATE_KEY);
684
- return isShallow(array) ? raw : raw.map(toReactive);
685
- }
686
- function shallowReadArray(arr) {
687
- track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
688
- return arr;
689
- }
690
- const arrayInstrumentations = {
691
- __proto__: null,
692
- [Symbol.iterator]() {
693
- return iterator(this, Symbol.iterator, toReactive);
694
- },
695
- concat(...args) {
696
- return reactiveReadArray(this).concat(
697
- ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
698
- );
699
- },
700
- entries() {
701
- return iterator(this, "entries", (value) => {
702
- value[1] = toReactive(value[1]);
703
- return value;
704
- });
705
- },
706
- every(fn, thisArg) {
707
- return apply(this, "every", fn, thisArg, void 0, arguments);
708
- },
709
- filter(fn, thisArg) {
710
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
711
- },
712
- find(fn, thisArg) {
713
- return apply(this, "find", fn, thisArg, toReactive, arguments);
714
- },
715
- findIndex(fn, thisArg) {
716
- return apply(this, "findIndex", fn, thisArg, void 0, arguments);
717
- },
718
- findLast(fn, thisArg) {
719
- return apply(this, "findLast", fn, thisArg, toReactive, arguments);
720
- },
721
- findLastIndex(fn, thisArg) {
722
- return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
723
- },
724
- // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
725
- forEach(fn, thisArg) {
726
- return apply(this, "forEach", fn, thisArg, void 0, arguments);
727
- },
728
- includes(...args) {
729
- return searchProxy(this, "includes", args);
730
- },
731
- indexOf(...args) {
732
- return searchProxy(this, "indexOf", args);
733
- },
734
- join(separator) {
735
- return reactiveReadArray(this).join(separator);
736
- },
737
- // keys() iterator only reads `length`, no optimization required
738
- lastIndexOf(...args) {
739
- return searchProxy(this, "lastIndexOf", args);
740
- },
741
- map(fn, thisArg) {
742
- return apply(this, "map", fn, thisArg, void 0, arguments);
743
- },
744
- pop() {
745
- return noTracking(this, "pop");
746
- },
747
- push(...args) {
748
- return noTracking(this, "push", args);
749
- },
750
- reduce(fn, ...args) {
751
- return reduce(this, "reduce", fn, args);
752
- },
753
- reduceRight(fn, ...args) {
754
- return reduce(this, "reduceRight", fn, args);
755
- },
756
- shift() {
757
- return noTracking(this, "shift");
758
- },
759
- // slice could use ARRAY_ITERATE but also seems to beg for range tracking
760
- some(fn, thisArg) {
761
- return apply(this, "some", fn, thisArg, void 0, arguments);
762
- },
763
- splice(...args) {
764
- return noTracking(this, "splice", args);
765
- },
766
- toReversed() {
767
- return reactiveReadArray(this).toReversed();
768
- },
769
- toSorted(comparer) {
770
- return reactiveReadArray(this).toSorted(comparer);
771
- },
772
- toSpliced(...args) {
773
- return reactiveReadArray(this).toSpliced(...args);
774
- },
775
- unshift(...args) {
776
- return noTracking(this, "unshift", args);
777
- },
778
- values() {
779
- return iterator(this, "values", toReactive);
780
- }
781
- };
782
- function iterator(self, method, wrapValue) {
783
- const arr = shallowReadArray(self);
784
- const iter = arr[method]();
785
- if (arr !== self && !isShallow(self)) {
786
- iter._next = iter.next;
787
- iter.next = () => {
788
- const result = iter._next();
789
- if (!result.done) {
790
- result.value = wrapValue(result.value);
791
- }
792
- return result;
793
- };
794
- }
795
- return iter;
796
- }
797
- const arrayProto = Array.prototype;
798
- function apply(self, method, fn, thisArg, wrappedRetFn, args) {
799
- const arr = shallowReadArray(self);
800
- const needsWrap = arr !== self && !isShallow(self);
801
- const methodFn = arr[method];
802
- if (methodFn !== arrayProto[method]) {
803
- const result2 = methodFn.apply(self, args);
804
- return needsWrap ? toReactive(result2) : result2;
805
- }
806
- let wrappedFn = fn;
807
- if (arr !== self) {
808
- if (needsWrap) {
809
- wrappedFn = function(item, index) {
810
- return fn.call(this, toReactive(item), index, self);
811
- };
812
- } else if (fn.length > 2) {
813
- wrappedFn = function(item, index) {
814
- return fn.call(this, item, index, self);
815
- };
816
- }
817
- }
818
- const result = methodFn.call(arr, wrappedFn, thisArg);
819
- return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
820
- }
821
- function reduce(self, method, fn, args) {
822
- const arr = shallowReadArray(self);
823
- let wrappedFn = fn;
824
- if (arr !== self) {
825
- if (!isShallow(self)) {
826
- wrappedFn = function(acc, item, index) {
827
- return fn.call(this, acc, toReactive(item), index, self);
828
- };
829
- } else if (fn.length > 3) {
830
- wrappedFn = function(acc, item, index) {
831
- return fn.call(this, acc, item, index, self);
832
- };
833
- }
834
- }
835
- return arr[method](wrappedFn, ...args);
836
- }
837
- function searchProxy(self, method, args) {
838
- const arr = toRaw(self);
839
- track(arr, "iterate", ARRAY_ITERATE_KEY);
840
- const res = arr[method](...args);
841
- if ((res === -1 || res === false) && isProxy(args[0])) {
842
- args[0] = toRaw(args[0]);
843
- return arr[method](...args);
844
- }
845
- return res;
846
- }
847
- function noTracking(self, method, args = []) {
848
- pauseTracking();
849
- startBatch();
850
- const res = toRaw(self)[method].apply(self, args);
851
- endBatch();
852
- resetTracking();
853
- return res;
854
- }
855
-
856
- const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
857
- const builtInSymbols = new Set(
858
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
859
- );
860
- function hasOwnProperty(key) {
861
- if (!isSymbol(key)) key = String(key);
862
- const obj = toRaw(this);
863
- track(obj, "has", key);
864
- return obj.hasOwnProperty(key);
865
- }
866
- class BaseReactiveHandler {
867
- constructor(_isReadonly = false, _isShallow = false) {
868
- this._isReadonly = _isReadonly;
869
- this._isShallow = _isShallow;
870
- }
871
- get(target, key, receiver) {
872
- if (key === "__v_skip") return target["__v_skip"];
873
- const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
874
- if (key === "__v_isReactive") {
875
- return !isReadonly2;
876
- } else if (key === "__v_isReadonly") {
877
- return isReadonly2;
878
- } else if (key === "__v_isShallow") {
879
- return isShallow2;
880
- } else if (key === "__v_raw") {
881
- if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
882
- // this means the receiver is a user proxy of the reactive proxy
883
- Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
884
- return target;
885
- }
886
- return;
887
- }
888
- const targetIsArray = isArray(target);
889
- if (!isReadonly2) {
890
- let fn;
891
- if (targetIsArray && (fn = arrayInstrumentations[key])) {
892
- return fn;
893
- }
894
- if (key === "hasOwnProperty") {
895
- return hasOwnProperty;
896
- }
897
- }
898
- const res = Reflect.get(
899
- target,
900
- key,
901
- // if this is a proxy wrapping a ref, return methods using the raw ref
902
- // as receiver so that we don't have to call `toRaw` on the ref in all
903
- // its class methods
904
- isRef(target) ? target : receiver
905
- );
906
- if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
907
- return res;
908
- }
909
- if (!isReadonly2) {
910
- track(target, "get", key);
911
- }
912
- if (isShallow2) {
913
- return res;
914
- }
915
- if (isRef(res)) {
916
- const value = targetIsArray && isIntegerKey(key) ? res : res.value;
917
- return isReadonly2 && isObject(value) ? readonly(value) : value;
918
- }
919
- if (isObject(res)) {
920
- return isReadonly2 ? readonly(res) : reactive(res);
921
- }
922
- return res;
923
- }
924
- }
925
- class MutableReactiveHandler extends BaseReactiveHandler {
926
- constructor(isShallow2 = false) {
927
- super(false, isShallow2);
928
- }
929
- set(target, key, value, receiver) {
930
- let oldValue = target[key];
931
- if (!this._isShallow) {
932
- const isOldValueReadonly = isReadonly(oldValue);
933
- if (!isShallow(value) && !isReadonly(value)) {
934
- oldValue = toRaw(oldValue);
935
- value = toRaw(value);
936
- }
937
- if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
938
- if (isOldValueReadonly) {
939
- if (!!(process.env.NODE_ENV !== "production")) {
940
- warn(
941
- `Set operation on key "${String(key)}" failed: target is readonly.`,
942
- target[key]
943
- );
944
- }
945
- return true;
946
- } else {
947
- oldValue.value = value;
948
- return true;
949
- }
950
- }
951
- }
952
- const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
953
- const result = Reflect.set(
954
- target,
955
- key,
956
- value,
957
- isRef(target) ? target : receiver
958
- );
959
- if (target === toRaw(receiver)) {
960
- if (!hadKey) {
961
- trigger(target, "add", key, value);
962
- } else if (hasChanged(value, oldValue)) {
963
- trigger(target, "set", key, value, oldValue);
964
- }
965
- }
966
- return result;
967
- }
968
- deleteProperty(target, key) {
969
- const hadKey = hasOwn(target, key);
970
- const oldValue = target[key];
971
- const result = Reflect.deleteProperty(target, key);
972
- if (result && hadKey) {
973
- trigger(target, "delete", key, void 0, oldValue);
974
- }
975
- return result;
976
- }
977
- has(target, key) {
978
- const result = Reflect.has(target, key);
979
- if (!isSymbol(key) || !builtInSymbols.has(key)) {
980
- track(target, "has", key);
981
- }
982
- return result;
983
- }
984
- ownKeys(target) {
985
- track(
986
- target,
987
- "iterate",
988
- isArray(target) ? "length" : ITERATE_KEY
989
- );
990
- return Reflect.ownKeys(target);
991
- }
992
- }
993
- class ReadonlyReactiveHandler extends BaseReactiveHandler {
994
- constructor(isShallow2 = false) {
995
- super(true, isShallow2);
996
- }
997
- set(target, key) {
998
- if (!!(process.env.NODE_ENV !== "production")) {
999
- warn(
1000
- `Set operation on key "${String(key)}" failed: target is readonly.`,
1001
- target
1002
- );
1003
- }
1004
- return true;
1005
- }
1006
- deleteProperty(target, key) {
1007
- if (!!(process.env.NODE_ENV !== "production")) {
1008
- warn(
1009
- `Delete operation on key "${String(key)}" failed: target is readonly.`,
1010
- target
1011
- );
1012
- }
1013
- return true;
1014
- }
1015
- }
1016
- const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1017
- const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1018
-
1019
- const toShallow = (value) => value;
1020
- const getProto = (v) => Reflect.getPrototypeOf(v);
1021
- function createIterableMethod(method, isReadonly2, isShallow2) {
1022
- return function(...args) {
1023
- const target = this["__v_raw"];
1024
- const rawTarget = toRaw(target);
1025
- const targetIsMap = isMap(rawTarget);
1026
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1027
- const isKeyOnly = method === "keys" && targetIsMap;
1028
- const innerIterator = target[method](...args);
1029
- const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
1030
- !isReadonly2 && track(
1031
- rawTarget,
1032
- "iterate",
1033
- isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1034
- );
1035
- return {
1036
- // iterator protocol
1037
- next() {
1038
- const { value, done } = innerIterator.next();
1039
- return done ? { value, done } : {
1040
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1041
- done
1042
- };
1043
- },
1044
- // iterable protocol
1045
- [Symbol.iterator]() {
1046
- return this;
1047
- }
1048
- };
1049
- };
1050
- }
1051
- function createReadonlyMethod(type) {
1052
- return function(...args) {
1053
- if (!!(process.env.NODE_ENV !== "production")) {
1054
- const key = args[0] ? `on key "${args[0]}" ` : ``;
1055
- warn(
1056
- `${capitalize(type)} operation ${key}failed: target is readonly.`,
1057
- toRaw(this)
1058
- );
1059
- }
1060
- return type === "delete" ? false : type === "clear" ? void 0 : this;
1061
- };
1062
- }
1063
- function createInstrumentations(readonly, shallow) {
1064
- const instrumentations = {
1065
- get(key) {
1066
- const target = this["__v_raw"];
1067
- const rawTarget = toRaw(target);
1068
- const rawKey = toRaw(key);
1069
- if (!readonly) {
1070
- if (hasChanged(key, rawKey)) {
1071
- track(rawTarget, "get", key);
1072
- }
1073
- track(rawTarget, "get", rawKey);
1074
- }
1075
- const { has } = getProto(rawTarget);
1076
- const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1077
- if (has.call(rawTarget, key)) {
1078
- return wrap(target.get(key));
1079
- } else if (has.call(rawTarget, rawKey)) {
1080
- return wrap(target.get(rawKey));
1081
- } else if (target !== rawTarget) {
1082
- target.get(key);
1083
- }
1084
- },
1085
- get size() {
1086
- const target = this["__v_raw"];
1087
- !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1088
- return target.size;
1089
- },
1090
- has(key) {
1091
- const target = this["__v_raw"];
1092
- const rawTarget = toRaw(target);
1093
- const rawKey = toRaw(key);
1094
- if (!readonly) {
1095
- if (hasChanged(key, rawKey)) {
1096
- track(rawTarget, "has", key);
1097
- }
1098
- track(rawTarget, "has", rawKey);
1099
- }
1100
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
1101
- },
1102
- forEach(callback, thisArg) {
1103
- const observed = this;
1104
- const target = observed["__v_raw"];
1105
- const rawTarget = toRaw(target);
1106
- const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1107
- !readonly && track(rawTarget, "iterate", ITERATE_KEY);
1108
- return target.forEach((value, key) => {
1109
- return callback.call(thisArg, wrap(value), wrap(key), observed);
1110
- });
1111
- }
1112
- };
1113
- extend(
1114
- instrumentations,
1115
- readonly ? {
1116
- add: createReadonlyMethod("add"),
1117
- set: createReadonlyMethod("set"),
1118
- delete: createReadonlyMethod("delete"),
1119
- clear: createReadonlyMethod("clear")
1120
- } : {
1121
- add(value) {
1122
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1123
- value = toRaw(value);
1124
- }
1125
- const target = toRaw(this);
1126
- const proto = getProto(target);
1127
- const hadKey = proto.has.call(target, value);
1128
- if (!hadKey) {
1129
- target.add(value);
1130
- trigger(target, "add", value, value);
1131
- }
1132
- return this;
1133
- },
1134
- set(key, value) {
1135
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1136
- value = toRaw(value);
1137
- }
1138
- const target = toRaw(this);
1139
- const { has, get } = getProto(target);
1140
- let hadKey = has.call(target, key);
1141
- if (!hadKey) {
1142
- key = toRaw(key);
1143
- hadKey = has.call(target, key);
1144
- } else if (!!(process.env.NODE_ENV !== "production")) {
1145
- checkIdentityKeys(target, has, key);
1146
- }
1147
- const oldValue = get.call(target, key);
1148
- target.set(key, value);
1149
- if (!hadKey) {
1150
- trigger(target, "add", key, value);
1151
- } else if (hasChanged(value, oldValue)) {
1152
- trigger(target, "set", key, value, oldValue);
1153
- }
1154
- return this;
1155
- },
1156
- delete(key) {
1157
- const target = toRaw(this);
1158
- const { has, get } = getProto(target);
1159
- let hadKey = has.call(target, key);
1160
- if (!hadKey) {
1161
- key = toRaw(key);
1162
- hadKey = has.call(target, key);
1163
- } else if (!!(process.env.NODE_ENV !== "production")) {
1164
- checkIdentityKeys(target, has, key);
1165
- }
1166
- const oldValue = get ? get.call(target, key) : void 0;
1167
- const result = target.delete(key);
1168
- if (hadKey) {
1169
- trigger(target, "delete", key, void 0, oldValue);
1170
- }
1171
- return result;
1172
- },
1173
- clear() {
1174
- const target = toRaw(this);
1175
- const hadItems = target.size !== 0;
1176
- const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
1177
- const result = target.clear();
1178
- if (hadItems) {
1179
- trigger(
1180
- target,
1181
- "clear",
1182
- void 0,
1183
- void 0,
1184
- oldTarget
1185
- );
1186
- }
1187
- return result;
1188
- }
1189
- }
1190
- );
1191
- const iteratorMethods = [
1192
- "keys",
1193
- "values",
1194
- "entries",
1195
- Symbol.iterator
1196
- ];
1197
- iteratorMethods.forEach((method) => {
1198
- instrumentations[method] = createIterableMethod(method, readonly, shallow);
1199
- });
1200
- return instrumentations;
1201
- }
1202
- function createInstrumentationGetter(isReadonly2, shallow) {
1203
- const instrumentations = createInstrumentations(isReadonly2, shallow);
1204
- return (target, key, receiver) => {
1205
- if (key === "__v_isReactive") {
1206
- return !isReadonly2;
1207
- } else if (key === "__v_isReadonly") {
1208
- return isReadonly2;
1209
- } else if (key === "__v_raw") {
1210
- return target;
1211
- }
1212
- return Reflect.get(
1213
- hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1214
- key,
1215
- receiver
1216
- );
1217
- };
1218
- }
1219
- const mutableCollectionHandlers = {
1220
- get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1221
- };
1222
- const readonlyCollectionHandlers = {
1223
- get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1224
- };
1225
- function checkIdentityKeys(target, has, key) {
1226
- const rawKey = toRaw(key);
1227
- if (rawKey !== key && has.call(target, rawKey)) {
1228
- const type = toRawType(target);
1229
- warn(
1230
- `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
1231
- );
1232
- }
1233
- }
1234
-
1235
- const reactiveMap = /* @__PURE__ */ new WeakMap();
1236
- const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1237
- const readonlyMap = /* @__PURE__ */ new WeakMap();
1238
- const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1239
- function targetTypeMap(rawType) {
1240
- switch (rawType) {
1241
- case "Object":
1242
- case "Array":
1243
- return 1 /* COMMON */;
1244
- case "Map":
1245
- case "Set":
1246
- case "WeakMap":
1247
- case "WeakSet":
1248
- return 2 /* COLLECTION */;
1249
- default:
1250
- return 0 /* INVALID */;
1251
- }
1252
- }
1253
- function getTargetType(value) {
1254
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1255
- }
1256
- function reactive(target) {
1257
- if (isReadonly(target)) {
1258
- return target;
1259
- }
1260
- return createReactiveObject(
1261
- target,
1262
- false,
1263
- mutableHandlers,
1264
- mutableCollectionHandlers,
1265
- reactiveMap
1266
- );
1267
- }
1268
- function readonly(target) {
1269
- return createReactiveObject(
1270
- target,
1271
- true,
1272
- readonlyHandlers,
1273
- readonlyCollectionHandlers,
1274
- readonlyMap
1275
- );
1276
- }
1277
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1278
- if (!isObject(target)) {
1279
- if (!!(process.env.NODE_ENV !== "production")) {
1280
- warn(
1281
- `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
1282
- target
1283
- )}`
1284
- );
1285
- }
1286
- return target;
1287
- }
1288
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1289
- return target;
1290
- }
1291
- const targetType = getTargetType(target);
1292
- if (targetType === 0 /* INVALID */) {
1293
- return target;
1294
- }
1295
- const existingProxy = proxyMap.get(target);
1296
- if (existingProxy) {
1297
- return existingProxy;
1298
- }
1299
- const proxy = new Proxy(
1300
- target,
1301
- targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1302
- );
1303
- proxyMap.set(target, proxy);
1304
- return proxy;
1305
- }
1306
- function isReactive(value) {
1307
- if (isReadonly(value)) {
1308
- return isReactive(value["__v_raw"]);
1309
- }
1310
- return !!(value && value["__v_isReactive"]);
1311
- }
1312
- function isReadonly(value) {
1313
- return !!(value && value["__v_isReadonly"]);
1314
- }
1315
- function isShallow(value) {
1316
- return !!(value && value["__v_isShallow"]);
1317
- }
1318
- function isProxy(value) {
1319
- return value ? !!value["__v_raw"] : false;
1320
- }
1321
- function toRaw(observed) {
1322
- const raw = observed && observed["__v_raw"];
1323
- return raw ? toRaw(raw) : observed;
1324
- }
1325
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
1326
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1327
-
1328
- function isRef(r) {
1329
- return r ? r["__v_isRef"] === true : false;
1330
- }
1331
- function ref(value) {
1332
- return createRef(value, false);
1333
- }
1334
- function createRef(rawValue, shallow) {
1335
- if (isRef(rawValue)) {
1336
- return rawValue;
1337
- }
1338
- return new RefImpl(rawValue, shallow);
1339
- }
1340
- class RefImpl {
1341
- constructor(value, isShallow2) {
1342
- this.dep = new Dep();
1343
- this["__v_isRef"] = true;
1344
- this["__v_isShallow"] = false;
1345
- this._rawValue = isShallow2 ? value : toRaw(value);
1346
- this._value = isShallow2 ? value : toReactive(value);
1347
- this["__v_isShallow"] = isShallow2;
1348
- }
1349
- get value() {
1350
- if (!!(process.env.NODE_ENV !== "production")) {
1351
- this.dep.track({
1352
- target: this,
1353
- type: "get",
1354
- key: "value"
1355
- });
1356
- } else {
1357
- this.dep.track();
1358
- }
1359
- return this._value;
1360
- }
1361
- set value(newValue) {
1362
- const oldValue = this._rawValue;
1363
- const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1364
- newValue = useDirectValue ? newValue : toRaw(newValue);
1365
- if (hasChanged(newValue, oldValue)) {
1366
- this._rawValue = newValue;
1367
- this._value = useDirectValue ? newValue : toReactive(newValue);
1368
- if (!!(process.env.NODE_ENV !== "production")) {
1369
- this.dep.trigger({
1370
- target: this,
1371
- type: "set",
1372
- key: "value",
1373
- newValue,
1374
- oldValue
1375
- });
1376
- } else {
1377
- this.dep.trigger();
1378
- }
1379
- }
1380
- }
1381
- }
1382
-
1383
- class ComputedRefImpl {
1384
- constructor(fn, setter, isSSR) {
1385
- this.fn = fn;
1386
- this.setter = setter;
1387
- /**
1388
- * @internal
1389
- */
1390
- this._value = void 0;
1391
- /**
1392
- * @internal
1393
- */
1394
- this.dep = new Dep(this);
1395
- /**
1396
- * @internal
1397
- */
1398
- this.__v_isRef = true;
1399
- // TODO isolatedDeclarations "__v_isReadonly"
1400
- // A computed is also a subscriber that tracks other deps
1401
- /**
1402
- * @internal
1403
- */
1404
- this.deps = void 0;
1405
- /**
1406
- * @internal
1407
- */
1408
- this.depsTail = void 0;
1409
- /**
1410
- * @internal
1411
- */
1412
- this.flags = 16;
1413
- /**
1414
- * @internal
1415
- */
1416
- this.globalVersion = globalVersion - 1;
1417
- /**
1418
- * @internal
1419
- */
1420
- this.next = void 0;
1421
- // for backwards compat
1422
- this.effect = this;
1423
- this["__v_isReadonly"] = !setter;
1424
- this.isSSR = isSSR;
1425
- }
1426
- /**
1427
- * @internal
1428
- */
1429
- notify() {
1430
- this.flags |= 16;
1431
- if (!(this.flags & 8) && // avoid infinite self recursion
1432
- activeSub !== this) {
1433
- batch(this, true);
1434
- return true;
1435
- } else if (!!(process.env.NODE_ENV !== "production")) ;
1436
- }
1437
- get value() {
1438
- const link = !!(process.env.NODE_ENV !== "production") ? this.dep.track({
1439
- target: this,
1440
- type: "get",
1441
- key: "value"
1442
- }) : this.dep.track();
1443
- refreshComputed(this);
1444
- if (link) {
1445
- link.version = this.dep.version;
1446
- }
1447
- return this._value;
1448
- }
1449
- set value(newValue) {
1450
- if (this.setter) {
1451
- this.setter(newValue);
1452
- } else if (!!(process.env.NODE_ENV !== "production")) {
1453
- warn("Write operation failed: computed value is readonly");
1454
- }
1455
- }
1456
- }
1457
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1458
- let getter;
1459
- let setter;
1460
- if (isFunction(getterOrOptions)) {
1461
- getter = getterOrOptions;
1462
- } else {
1463
- getter = getterOrOptions.get;
1464
- setter = getterOrOptions.set;
1465
- }
1466
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1467
- if (!!(process.env.NODE_ENV !== "production") && debugOptions) ;
1468
- return cRef;
1469
- }
1470
- const INITIAL_WATCHER_VALUE = {};
1471
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1472
- let activeWatcher = void 0;
1473
- function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1474
- if (owner) {
1475
- let cleanups = cleanupMap.get(owner);
1476
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1477
- cleanups.push(cleanupFn);
1478
- } else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
1479
- warn(
1480
- `onWatcherCleanup() was called when there was no active watcher to associate with.`
1481
- );
1482
- }
1483
- }
1484
- function watch$1(source, cb, options = EMPTY_OBJ) {
1485
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1486
- const warnInvalidSource = (s) => {
1487
- (options.onWarn || warn)(
1488
- `Invalid watch source: `,
1489
- s,
1490
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1491
- );
1492
- };
1493
- const reactiveGetter = (source2) => {
1494
- if (deep) return source2;
1495
- if (isShallow(source2) || deep === false || deep === 0)
1496
- return traverse(source2, 1);
1497
- return traverse(source2);
1498
- };
1499
- let effect;
1500
- let getter;
1501
- let cleanup;
1502
- let boundCleanup;
1503
- let forceTrigger = false;
1504
- let isMultiSource = false;
1505
- if (isRef(source)) {
1506
- getter = () => source.value;
1507
- forceTrigger = isShallow(source);
1508
- } else if (isReactive(source)) {
1509
- getter = () => reactiveGetter(source);
1510
- forceTrigger = true;
1511
- } else if (isArray(source)) {
1512
- isMultiSource = true;
1513
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1514
- getter = () => source.map((s) => {
1515
- if (isRef(s)) {
1516
- return s.value;
1517
- } else if (isReactive(s)) {
1518
- return reactiveGetter(s);
1519
- } else if (isFunction(s)) {
1520
- return call ? call(s, 2) : s();
1521
- } else {
1522
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
1523
- }
1524
- });
1525
- } else if (isFunction(source)) {
1526
- if (cb) {
1527
- getter = call ? () => call(source, 2) : source;
1528
- } else {
1529
- getter = () => {
1530
- if (cleanup) {
1531
- pauseTracking();
1532
- try {
1533
- cleanup();
1534
- } finally {
1535
- resetTracking();
1536
- }
1537
- }
1538
- const currentEffect = activeWatcher;
1539
- activeWatcher = effect;
1540
- try {
1541
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1542
- } finally {
1543
- activeWatcher = currentEffect;
1544
- }
1545
- };
1546
- }
1547
- } else {
1548
- getter = NOOP;
1549
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
1550
- }
1551
- if (cb && deep) {
1552
- const baseGetter = getter;
1553
- const depth = deep === true ? Infinity : deep;
1554
- getter = () => traverse(baseGetter(), depth);
1555
- }
1556
- const watchHandle = () => {
1557
- effect.stop();
1558
- };
1559
- if (once && cb) {
1560
- const _cb = cb;
1561
- cb = (...args) => {
1562
- _cb(...args);
1563
- watchHandle();
1564
- };
1565
- }
1566
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1567
- const job = (immediateFirstRun) => {
1568
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1569
- return;
1570
- }
1571
- if (cb) {
1572
- const newValue = effect.run();
1573
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1574
- if (cleanup) {
1575
- cleanup();
1576
- }
1577
- const currentWatcher = activeWatcher;
1578
- activeWatcher = effect;
1579
- try {
1580
- const args = [
1581
- newValue,
1582
- // pass undefined as the old value when it's changed for the first time
1583
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1584
- boundCleanup
1585
- ];
1586
- oldValue = newValue;
1587
- call ? call(cb, 3, args) : (
1588
- // @ts-expect-error
1589
- cb(...args)
1590
- );
1591
- } finally {
1592
- activeWatcher = currentWatcher;
1593
- }
1594
- }
1595
- } else {
1596
- effect.run();
1597
- }
1598
- };
1599
- if (augmentJob) {
1600
- augmentJob(job);
1601
- }
1602
- effect = new ReactiveEffect(getter);
1603
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1604
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1605
- cleanup = effect.onStop = () => {
1606
- const cleanups = cleanupMap.get(effect);
1607
- if (cleanups) {
1608
- if (call) {
1609
- call(cleanups, 4);
1610
- } else {
1611
- for (const cleanup2 of cleanups) cleanup2();
1612
- }
1613
- cleanupMap.delete(effect);
1614
- }
1615
- };
1616
- if (!!(process.env.NODE_ENV !== "production")) {
1617
- effect.onTrack = options.onTrack;
1618
- effect.onTrigger = options.onTrigger;
1619
- }
1620
- if (cb) {
1621
- if (immediate) {
1622
- job(true);
1623
- } else {
1624
- oldValue = effect.run();
1625
- }
1626
- } else if (scheduler) {
1627
- scheduler(job.bind(null, true), true);
1628
- } else {
1629
- effect.run();
1630
- }
1631
- watchHandle.pause = effect.pause.bind(effect);
1632
- watchHandle.resume = effect.resume.bind(effect);
1633
- watchHandle.stop = watchHandle;
1634
- return watchHandle;
1635
- }
1636
- function traverse(value, depth = Infinity, seen) {
1637
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1638
- return value;
1639
- }
1640
- seen = seen || /* @__PURE__ */ new Map();
1641
- if ((seen.get(value) || 0) >= depth) {
1642
- return value;
1643
- }
1644
- seen.set(value, depth);
1645
- depth--;
1646
- if (isRef(value)) {
1647
- traverse(value.value, depth, seen);
1648
- } else if (isArray(value)) {
1649
- for (let i = 0; i < value.length; i++) {
1650
- traverse(value[i], depth, seen);
1651
- }
1652
- } else if (isSet(value) || isMap(value)) {
1653
- value.forEach((v) => {
1654
- traverse(v, depth, seen);
1655
- });
1656
- } else if (isPlainObject(value)) {
1657
- for (const key in value) {
1658
- traverse(value[key], depth, seen);
1659
- }
1660
- for (const key of Object.getOwnPropertySymbols(value)) {
1661
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
1662
- traverse(value[key], depth, seen);
1663
- }
1664
- }
1665
- }
1666
- return value;
1667
- }
1668
-
1669
- /**
1670
- * @vue/runtime-core v3.5.24
1671
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
1672
- * @license MIT
1673
- **/
1674
-
1675
- const stack = [];
1676
- function pushWarningContext(vnode) {
1677
- stack.push(vnode);
1678
- }
1679
- function popWarningContext() {
1680
- stack.pop();
1681
- }
1682
- let isWarning = false;
1683
- function warn$1(msg, ...args) {
1684
- if (isWarning) return;
1685
- isWarning = true;
1686
- pauseTracking();
1687
- const instance = stack.length ? stack[stack.length - 1].component : null;
1688
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
1689
- const trace = getComponentTrace();
1690
- if (appWarnHandler) {
1691
- callWithErrorHandling(
1692
- appWarnHandler,
1693
- instance,
1694
- 11,
1695
- [
1696
- // eslint-disable-next-line no-restricted-syntax
1697
- msg + args.map((a) => {
1698
- var _a, _b;
1699
- return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1700
- }).join(""),
1701
- instance && instance.proxy,
1702
- trace.map(
1703
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
1704
- ).join("\n"),
1705
- trace
1706
- ]
1707
- );
1708
- } else {
1709
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
1710
- if (trace.length && // avoid spamming console during tests
1711
- true) {
1712
- warnArgs.push(`
1713
- `, ...formatTrace(trace));
1714
- }
1715
- console.warn(...warnArgs);
1716
- }
1717
- resetTracking();
1718
- isWarning = false;
1719
- }
1720
- function getComponentTrace() {
1721
- let currentVNode = stack[stack.length - 1];
1722
- if (!currentVNode) {
1723
- return [];
1724
- }
1725
- const normalizedStack = [];
1726
- while (currentVNode) {
1727
- const last = normalizedStack[0];
1728
- if (last && last.vnode === currentVNode) {
1729
- last.recurseCount++;
1730
- } else {
1731
- normalizedStack.push({
1732
- vnode: currentVNode,
1733
- recurseCount: 0
1734
- });
1735
- }
1736
- const parentInstance = currentVNode.component && currentVNode.component.parent;
1737
- currentVNode = parentInstance && parentInstance.vnode;
1738
- }
1739
- return normalizedStack;
1740
- }
1741
- function formatTrace(trace) {
1742
- const logs = [];
1743
- trace.forEach((entry, i) => {
1744
- logs.push(...i === 0 ? [] : [`
1745
- `], ...formatTraceEntry(entry));
1746
- });
1747
- return logs;
1748
- }
1749
- function formatTraceEntry({ vnode, recurseCount }) {
1750
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
1751
- const isRoot = vnode.component ? vnode.component.parent == null : false;
1752
- const open = ` at <${formatComponentName(
1753
- vnode.component,
1754
- vnode.type,
1755
- isRoot
1756
- )}`;
1757
- const close = `>` + postfix;
1758
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
1759
- }
1760
- function formatProps(props) {
1761
- const res = [];
1762
- const keys = Object.keys(props);
1763
- keys.slice(0, 3).forEach((key) => {
1764
- res.push(...formatProp(key, props[key]));
1765
- });
1766
- if (keys.length > 3) {
1767
- res.push(` ...`);
1768
- }
1769
- return res;
1770
- }
1771
- function formatProp(key, value, raw) {
1772
- if (isString(value)) {
1773
- value = JSON.stringify(value);
1774
- return raw ? value : [`${key}=${value}`];
1775
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
1776
- return raw ? value : [`${key}=${value}`];
1777
- } else if (isRef(value)) {
1778
- value = formatProp(key, toRaw(value.value), true);
1779
- return raw ? value : [`${key}=Ref<`, value, `>`];
1780
- } else if (isFunction(value)) {
1781
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1782
- } else {
1783
- value = toRaw(value);
1784
- return raw ? value : [`${key}=`, value];
1785
- }
1786
- }
1787
- const ErrorTypeStrings$1 = {
1788
- ["sp"]: "serverPrefetch hook",
1789
- ["bc"]: "beforeCreate hook",
1790
- ["c"]: "created hook",
1791
- ["bm"]: "beforeMount hook",
1792
- ["m"]: "mounted hook",
1793
- ["bu"]: "beforeUpdate hook",
1794
- ["u"]: "updated",
1795
- ["bum"]: "beforeUnmount hook",
1796
- ["um"]: "unmounted hook",
1797
- ["a"]: "activated hook",
1798
- ["da"]: "deactivated hook",
1799
- ["ec"]: "errorCaptured hook",
1800
- ["rtc"]: "renderTracked hook",
1801
- ["rtg"]: "renderTriggered hook",
1802
- [0]: "setup function",
1803
- [1]: "render function",
1804
- [2]: "watcher getter",
1805
- [3]: "watcher callback",
1806
- [4]: "watcher cleanup function",
1807
- [5]: "native event handler",
1808
- [6]: "component event handler",
1809
- [7]: "vnode hook",
1810
- [8]: "directive hook",
1811
- [9]: "transition hook",
1812
- [10]: "app errorHandler",
1813
- [11]: "app warnHandler",
1814
- [12]: "ref function",
1815
- [13]: "async component loader",
1816
- [14]: "scheduler flush",
1817
- [15]: "component update",
1818
- [16]: "app unmount cleanup function"
1819
- };
1820
- function callWithErrorHandling(fn, instance, type, args) {
1821
- try {
1822
- return args ? fn(...args) : fn();
1823
- } catch (err) {
1824
- handleError(err, instance, type);
1825
- }
1826
- }
1827
- function callWithAsyncErrorHandling(fn, instance, type, args) {
1828
- if (isFunction(fn)) {
1829
- const res = callWithErrorHandling(fn, instance, type, args);
1830
- if (res && isPromise(res)) {
1831
- res.catch((err) => {
1832
- handleError(err, instance, type);
1833
- });
1834
- }
1835
- return res;
1836
- }
1837
- if (isArray(fn)) {
1838
- const values = [];
1839
- for (let i = 0; i < fn.length; i++) {
1840
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1841
- }
1842
- return values;
1843
- } else if (!!(process.env.NODE_ENV !== "production")) {
1844
- warn$1(
1845
- `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1846
- );
1847
- }
1848
- }
1849
- function handleError(err, instance, type, throwInDev = true) {
1850
- const contextVNode = instance ? instance.vnode : null;
1851
- const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
1852
- if (instance) {
1853
- let cur = instance.parent;
1854
- const exposedInstance = instance.proxy;
1855
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
1856
- while (cur) {
1857
- const errorCapturedHooks = cur.ec;
1858
- if (errorCapturedHooks) {
1859
- for (let i = 0; i < errorCapturedHooks.length; i++) {
1860
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1861
- return;
1862
- }
1863
- }
1864
- }
1865
- cur = cur.parent;
1866
- }
1867
- if (errorHandler) {
1868
- pauseTracking();
1869
- callWithErrorHandling(errorHandler, null, 10, [
1870
- err,
1871
- exposedInstance,
1872
- errorInfo
1873
- ]);
1874
- resetTracking();
1875
- return;
1876
- }
1877
- }
1878
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
1879
- }
1880
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
1881
- if (!!(process.env.NODE_ENV !== "production")) {
1882
- const info = ErrorTypeStrings$1[type];
1883
- if (contextVNode) {
1884
- pushWarningContext(contextVNode);
1885
- }
1886
- warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1887
- if (contextVNode) {
1888
- popWarningContext();
1889
- }
1890
- if (throwInDev) {
1891
- throw err;
1892
- } else {
1893
- console.error(err);
1894
- }
1895
- } else if (throwInProd) {
1896
- throw err;
1897
- } else {
1898
- console.error(err);
1899
- }
1900
- }
1901
-
1902
- const queue = [];
1903
- let flushIndex = -1;
1904
- const pendingPostFlushCbs = [];
1905
- let activePostFlushCbs = null;
1906
- let postFlushIndex = 0;
1907
- const resolvedPromise = /* @__PURE__ */ Promise.resolve();
1908
- let currentFlushPromise = null;
1909
- const RECURSION_LIMIT = 100;
1910
- function findInsertionIndex(id) {
1911
- let start = flushIndex + 1;
1912
- let end = queue.length;
1913
- while (start < end) {
1914
- const middle = start + end >>> 1;
1915
- const middleJob = queue[middle];
1916
- const middleJobId = getId(middleJob);
1917
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
1918
- start = middle + 1;
1919
- } else {
1920
- end = middle;
1921
- }
1922
- }
1923
- return start;
1924
- }
1925
- function queueJob(job) {
1926
- if (!(job.flags & 1)) {
1927
- const jobId = getId(job);
1928
- const lastJob = queue[queue.length - 1];
1929
- if (!lastJob || // fast path when the job id is larger than the tail
1930
- !(job.flags & 2) && jobId >= getId(lastJob)) {
1931
- queue.push(job);
1932
- } else {
1933
- queue.splice(findInsertionIndex(jobId), 0, job);
1934
- }
1935
- job.flags |= 1;
1936
- queueFlush();
1937
- }
1938
- }
1939
- function queueFlush() {
1940
- if (!currentFlushPromise) {
1941
- currentFlushPromise = resolvedPromise.then(flushJobs);
1942
- }
1943
- }
1944
- function queuePostFlushCb(cb) {
1945
- if (!isArray(cb)) {
1946
- if (activePostFlushCbs && cb.id === -1) {
1947
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
1948
- } else if (!(cb.flags & 1)) {
1949
- pendingPostFlushCbs.push(cb);
1950
- cb.flags |= 1;
1951
- }
1952
- } else {
1953
- pendingPostFlushCbs.push(...cb);
1954
- }
1955
- queueFlush();
1956
- }
1957
- function flushPostFlushCbs(seen) {
1958
- if (pendingPostFlushCbs.length) {
1959
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
1960
- (a, b) => getId(a) - getId(b)
1961
- );
1962
- pendingPostFlushCbs.length = 0;
1963
- if (activePostFlushCbs) {
1964
- activePostFlushCbs.push(...deduped);
1965
- return;
1966
- }
1967
- activePostFlushCbs = deduped;
1968
- if (!!(process.env.NODE_ENV !== "production")) {
1969
- seen = seen || /* @__PURE__ */ new Map();
1970
- }
1971
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1972
- const cb = activePostFlushCbs[postFlushIndex];
1973
- if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
1974
- continue;
1975
- }
1976
- if (cb.flags & 4) {
1977
- cb.flags &= -2;
1978
- }
1979
- if (!(cb.flags & 8)) cb();
1980
- cb.flags &= -2;
1981
- }
1982
- activePostFlushCbs = null;
1983
- postFlushIndex = 0;
1984
- }
1985
- }
1986
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
1987
- function flushJobs(seen) {
1988
- if (!!(process.env.NODE_ENV !== "production")) {
1989
- seen = seen || /* @__PURE__ */ new Map();
1990
- }
1991
- const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
1992
- try {
1993
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1994
- const job = queue[flushIndex];
1995
- if (job && !(job.flags & 8)) {
1996
- if (!!(process.env.NODE_ENV !== "production") && check(job)) {
1997
- continue;
1998
- }
1999
- if (job.flags & 4) {
2000
- job.flags &= ~1;
2001
- }
2002
- callWithErrorHandling(
2003
- job,
2004
- job.i,
2005
- job.i ? 15 : 14
2006
- );
2007
- if (!(job.flags & 4)) {
2008
- job.flags &= ~1;
2009
- }
2010
- }
2011
- }
2012
- } finally {
2013
- for (; flushIndex < queue.length; flushIndex++) {
2014
- const job = queue[flushIndex];
2015
- if (job) {
2016
- job.flags &= -2;
2017
- }
2018
- }
2019
- flushIndex = -1;
2020
- queue.length = 0;
2021
- flushPostFlushCbs(seen);
2022
- currentFlushPromise = null;
2023
- if (queue.length || pendingPostFlushCbs.length) {
2024
- flushJobs(seen);
2025
- }
2026
- }
2027
- }
2028
- function checkRecursiveUpdates(seen, fn) {
2029
- const count = seen.get(fn) || 0;
2030
- if (count > RECURSION_LIMIT) {
2031
- const instance = fn.i;
2032
- const componentName = instance && getComponentName(instance.type);
2033
- handleError(
2034
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2035
- null,
2036
- 10
2037
- );
2038
- return true;
2039
- }
2040
- seen.set(fn, count + 1);
2041
- return false;
2042
- }
2043
- const hmrDirtyComponents = /* @__PURE__ */ new Map();
2044
- if (!!(process.env.NODE_ENV !== "production")) {
2045
- getGlobalThis().__VUE_HMR_RUNTIME__ = {
2046
- createRecord: tryWrap(createRecord),
2047
- rerender: tryWrap(rerender),
2048
- reload: tryWrap(reload)
2049
- };
2050
- }
2051
- const map = /* @__PURE__ */ new Map();
2052
- function createRecord(id, initialDef) {
2053
- if (map.has(id)) {
2054
- return false;
2055
- }
2056
- map.set(id, {
2057
- initialDef: normalizeClassComponent(initialDef),
2058
- instances: /* @__PURE__ */ new Set()
2059
- });
2060
- return true;
2061
- }
2062
- function normalizeClassComponent(component) {
2063
- return isClassComponent(component) ? component.__vccOpts : component;
2064
- }
2065
- function rerender(id, newRender) {
2066
- const record = map.get(id);
2067
- if (!record) {
2068
- return;
2069
- }
2070
- record.initialDef.render = newRender;
2071
- [...record.instances].forEach((instance) => {
2072
- if (newRender) {
2073
- instance.render = newRender;
2074
- normalizeClassComponent(instance.type).render = newRender;
2075
- }
2076
- instance.renderCache = [];
2077
- if (!(instance.job.flags & 8)) {
2078
- instance.update();
2079
- }
2080
- });
2081
- }
2082
- function reload(id, newComp) {
2083
- const record = map.get(id);
2084
- if (!record) return;
2085
- newComp = normalizeClassComponent(newComp);
2086
- updateComponentDef(record.initialDef, newComp);
2087
- const instances = [...record.instances];
2088
- for (let i = 0; i < instances.length; i++) {
2089
- const instance = instances[i];
2090
- const oldComp = normalizeClassComponent(instance.type);
2091
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2092
- if (!dirtyInstances) {
2093
- if (oldComp !== record.initialDef) {
2094
- updateComponentDef(oldComp, newComp);
2095
- }
2096
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2097
- }
2098
- dirtyInstances.add(instance);
2099
- instance.appContext.propsCache.delete(instance.type);
2100
- instance.appContext.emitsCache.delete(instance.type);
2101
- instance.appContext.optionsCache.delete(instance.type);
2102
- if (instance.ceReload) {
2103
- dirtyInstances.add(instance);
2104
- instance.ceReload(newComp.styles);
2105
- dirtyInstances.delete(instance);
2106
- } else if (instance.parent) {
2107
- queueJob(() => {
2108
- if (!(instance.job.flags & 8)) {
2109
- instance.parent.update();
2110
- dirtyInstances.delete(instance);
2111
- }
2112
- });
2113
- } else if (instance.appContext.reload) {
2114
- instance.appContext.reload();
2115
- } else if (typeof window !== "undefined") {
2116
- window.location.reload();
2117
- } else {
2118
- console.warn(
2119
- "[HMR] Root or manually mounted instance modified. Full reload required."
2120
- );
2121
- }
2122
- if (instance.root.ce && instance !== instance.root) {
2123
- instance.root.ce._removeChildStyle(oldComp);
2124
- }
2125
- }
2126
- queuePostFlushCb(() => {
2127
- hmrDirtyComponents.clear();
2128
- });
2129
- }
2130
- function updateComponentDef(oldComp, newComp) {
2131
- extend(oldComp, newComp);
2132
- for (const key in oldComp) {
2133
- if (key !== "__file" && !(key in newComp)) {
2134
- delete oldComp[key];
2135
- }
2136
- }
2137
- }
2138
- function tryWrap(fn) {
2139
- return (id, arg) => {
2140
- try {
2141
- return fn(id, arg);
2142
- } catch (e) {
2143
- console.error(e);
2144
- console.warn(
2145
- `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
2146
- );
2147
- }
2148
- };
2149
- }
2150
-
2151
- let devtools$1;
2152
- let buffer = [];
2153
- function setDevtoolsHook$1(hook, target) {
2154
- var _a, _b;
2155
- devtools$1 = hook;
2156
- if (devtools$1) {
2157
- devtools$1.enabled = true;
2158
- buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
2159
- buffer = [];
2160
- } else if (
2161
- // handle late devtools injection - only do this if we are in an actual
2162
- // browser environment to avoid the timer handle stalling test runner exit
2163
- // (#4815)
2164
- typeof window !== "undefined" && // some envs mock window but not fully
2165
- window.HTMLElement && // also exclude jsdom
2166
- // eslint-disable-next-line no-restricted-syntax
2167
- !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
2168
- ) {
2169
- const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
2170
- replay.push((newHook) => {
2171
- setDevtoolsHook$1(newHook, target);
2172
- });
2173
- setTimeout(() => {
2174
- if (!devtools$1) {
2175
- target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
2176
- buffer = [];
2177
- }
2178
- }, 3e3);
2179
- } else {
2180
- buffer = [];
2181
- }
2182
- }
2183
-
2184
- let currentRenderingInstance = null;
2185
- let currentScopeId = null;
2186
- const isTeleport = (type) => type.__isTeleport;
2187
- function setTransitionHooks(vnode, hooks) {
2188
- if (vnode.shapeFlag & 6 && vnode.component) {
2189
- vnode.transition = hooks;
2190
- setTransitionHooks(vnode.component.subTree, hooks);
2191
- } else if (vnode.shapeFlag & 128) {
2192
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2193
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2194
- } else {
2195
- vnode.transition = hooks;
2196
- }
2197
- }
2198
-
2199
- getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
2200
- getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
2201
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2202
- const PublicInstanceProxyHandlers = {
2203
- };
2204
- if (!!(process.env.NODE_ENV !== "production") && true) {
2205
- PublicInstanceProxyHandlers.ownKeys = (target) => {
2206
- warn$1(
2207
- `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
2208
- );
2209
- return Reflect.ownKeys(target);
2210
- };
2211
- }
2212
- let currentApp = null;
2213
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
2214
- const instance = getCurrentInstance();
2215
- if (instance || currentApp) {
2216
- let provides = instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
2217
- if (provides && key in provides) {
2218
- return provides[key];
2219
- } else if (arguments.length > 1) {
2220
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
2221
- } else if (!!(process.env.NODE_ENV !== "production")) {
2222
- warn$1(`injection "${String(key)}" not found.`);
2223
- }
2224
- } else if (!!(process.env.NODE_ENV !== "production")) {
2225
- warn$1(`inject() can only be used inside setup() or functional components.`);
2226
- }
2227
- }
2228
-
2229
- const internalObjectProto = {};
2230
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
2231
-
2232
- const queuePostRenderEffect = queueEffectWithSuspense ;
2233
-
2234
- const ssrContextKey = Symbol.for("v-scx");
2235
- const useSSRContext = () => {
2236
- {
2237
- const ctx = inject(ssrContextKey);
2238
- if (!ctx) {
2239
- !!(process.env.NODE_ENV !== "production") && warn$1(
2240
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
2241
- );
2242
- }
2243
- return ctx;
2244
- }
2245
- };
2246
- function watch(source, cb, options) {
2247
- if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
2248
- warn$1(
2249
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
2250
- );
2251
- }
2252
- return doWatch(source, cb, options);
2253
- }
2254
- function doWatch(source, cb, options = EMPTY_OBJ) {
2255
- const { immediate, deep, flush, once } = options;
2256
- if (!!(process.env.NODE_ENV !== "production") && !cb) {
2257
- if (immediate !== void 0) {
2258
- warn$1(
2259
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
2260
- );
2261
- }
2262
- if (deep !== void 0) {
2263
- warn$1(
2264
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
2265
- );
2266
- }
2267
- if (once !== void 0) {
2268
- warn$1(
2269
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
2270
- );
2271
- }
2272
- }
2273
- const baseWatchOptions = extend({}, options);
2274
- if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
2275
- const runsImmediately = cb && immediate || !cb && flush !== "post";
2276
- let ssrCleanup;
2277
- if (isInSSRComponentSetup) {
2278
- if (flush === "sync") {
2279
- const ctx = useSSRContext();
2280
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
2281
- } else if (!runsImmediately) {
2282
- const watchStopHandle = () => {
2283
- };
2284
- watchStopHandle.stop = NOOP;
2285
- watchStopHandle.resume = NOOP;
2286
- watchStopHandle.pause = NOOP;
2287
- return watchStopHandle;
2288
- }
2289
- }
2290
- const instance = currentInstance;
2291
- baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
2292
- let isPre = false;
2293
- if (flush === "post") {
2294
- baseWatchOptions.scheduler = (job) => {
2295
- queuePostRenderEffect(job, instance && instance.suspense);
2296
- };
2297
- } else if (flush !== "sync") {
2298
- isPre = true;
2299
- baseWatchOptions.scheduler = (job, isFirstRun) => {
2300
- if (isFirstRun) {
2301
- job();
2302
- } else {
2303
- queueJob(job);
2304
- }
2305
- };
2306
- }
2307
- baseWatchOptions.augmentJob = (job) => {
2308
- if (cb) {
2309
- job.flags |= 4;
2310
- }
2311
- if (isPre) {
2312
- job.flags |= 2;
2313
- if (instance) {
2314
- job.id = instance.uid;
2315
- job.i = instance;
2316
- }
2317
- }
2318
- };
2319
- const watchHandle = watch$1(source, cb, baseWatchOptions);
2320
- if (isInSSRComponentSetup) {
2321
- if (ssrCleanup) {
2322
- ssrCleanup.push(watchHandle);
2323
- } else if (runsImmediately) {
2324
- watchHandle();
2325
- }
2326
- }
2327
- return watchHandle;
2328
- }
2329
-
2330
- const isSuspense = (type) => type.__isSuspense;
2331
- function queueEffectWithSuspense(fn, suspense) {
2332
- if (suspense && suspense.pendingBranch) {
2333
- if (isArray(fn)) {
2334
- suspense.effects.push(...fn);
2335
- } else {
2336
- suspense.effects.push(fn);
2337
- }
2338
- } else {
2339
- queuePostFlushCb(fn);
2340
- }
2341
- }
2342
-
2343
- const Fragment = Symbol.for("v-fgt");
2344
- const Text = Symbol.for("v-txt");
2345
- const Comment = Symbol.for("v-cmt");
2346
- function isVNode(value) {
2347
- return value ? value.__v_isVNode === true : false;
2348
- }
2349
- const createVNodeWithArgsTransform = (...args) => {
2350
- return _createVNode(
2351
- ...args
2352
- );
2353
- };
2354
- const normalizeKey = ({ key }) => key != null ? key : null;
2355
- const normalizeRef = ({
2356
- ref,
2357
- ref_key,
2358
- ref_for
2359
- }) => {
2360
- if (typeof ref === "number") {
2361
- ref = "" + ref;
2362
- }
2363
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
2364
- };
2365
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
2366
- const vnode = {
2367
- __v_isVNode: true,
2368
- __v_skip: true,
2369
- type,
2370
- props,
2371
- key: props && normalizeKey(props),
2372
- ref: props && normalizeRef(props),
2373
- scopeId: currentScopeId,
2374
- slotScopeIds: null,
2375
- children,
2376
- component: null,
2377
- suspense: null,
2378
- ssContent: null,
2379
- ssFallback: null,
2380
- dirs: null,
2381
- transition: null,
2382
- el: null,
2383
- anchor: null,
2384
- target: null,
2385
- targetStart: null,
2386
- targetAnchor: null,
2387
- staticCount: 0,
2388
- shapeFlag,
2389
- patchFlag,
2390
- dynamicProps,
2391
- dynamicChildren: null,
2392
- appContext: null,
2393
- ctx: currentRenderingInstance
2394
- };
2395
- if (needFullChildrenNormalization) {
2396
- normalizeChildren(vnode, children);
2397
- if (shapeFlag & 128) {
2398
- type.normalize(vnode);
2399
- }
2400
- } else if (children) {
2401
- vnode.shapeFlag |= isString(children) ? 8 : 16;
2402
- }
2403
- if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
2404
- warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
2405
- }
2406
- return vnode;
2407
- }
2408
- const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
2409
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
2410
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
2411
- if (!!(process.env.NODE_ENV !== "production") && !type) {
2412
- warn$1(`Invalid vnode type when creating vnode: ${type}.`);
2413
- }
2414
- type = Comment;
2415
- }
2416
- if (isVNode(type)) {
2417
- const cloned = cloneVNode(
2418
- type,
2419
- props,
2420
- true
2421
- /* mergeRef: true */
2422
- );
2423
- if (children) {
2424
- normalizeChildren(cloned, children);
2425
- }
2426
- cloned.patchFlag = -2;
2427
- return cloned;
2428
- }
2429
- if (isClassComponent(type)) {
2430
- type = type.__vccOpts;
2431
- }
2432
- if (props) {
2433
- props = guardReactiveProps(props);
2434
- let { class: klass, style } = props;
2435
- if (klass && !isString(klass)) {
2436
- props.class = normalizeClass(klass);
2437
- }
2438
- if (isObject(style)) {
2439
- if (isProxy(style) && !isArray(style)) {
2440
- style = extend({}, style);
2441
- }
2442
- props.style = normalizeStyle(style);
2443
- }
2444
- }
2445
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
2446
- if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
2447
- type = toRaw(type);
2448
- warn$1(
2449
- `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
2450
- `
2451
- Component that was made reactive: `,
2452
- type
2453
- );
2454
- }
2455
- return createBaseVNode(
2456
- type,
2457
- props,
2458
- children,
2459
- patchFlag,
2460
- dynamicProps,
2461
- shapeFlag,
2462
- isBlockNode,
2463
- true
2464
- );
2465
- }
2466
- function guardReactiveProps(props) {
2467
- if (!props) return null;
2468
- return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
2469
- }
2470
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
2471
- const { props, ref, patchFlag, children, transition } = vnode;
2472
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
2473
- const cloned = {
2474
- __v_isVNode: true,
2475
- __v_skip: true,
2476
- type: vnode.type,
2477
- props: mergedProps,
2478
- key: mergedProps && normalizeKey(mergedProps),
2479
- ref: extraProps && extraProps.ref ? (
2480
- // #2078 in the case of <component :is="vnode" ref="extra"/>
2481
- // if the vnode itself already has a ref, cloneVNode will need to merge
2482
- // the refs so the single vnode can be set on multiple refs
2483
- mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
2484
- ) : ref,
2485
- scopeId: vnode.scopeId,
2486
- slotScopeIds: vnode.slotScopeIds,
2487
- children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
2488
- target: vnode.target,
2489
- targetStart: vnode.targetStart,
2490
- targetAnchor: vnode.targetAnchor,
2491
- staticCount: vnode.staticCount,
2492
- shapeFlag: vnode.shapeFlag,
2493
- // if the vnode is cloned with extra props, we can no longer assume its
2494
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
2495
- // note: preserve flag for fragments since they use the flag for children
2496
- // fast paths only.
2497
- patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
2498
- dynamicProps: vnode.dynamicProps,
2499
- dynamicChildren: vnode.dynamicChildren,
2500
- appContext: vnode.appContext,
2501
- dirs: vnode.dirs,
2502
- transition,
2503
- // These should technically only be non-null on mounted VNodes. However,
2504
- // they *should* be copied for kept-alive vnodes. So we just always copy
2505
- // them since them being non-null during a mount doesn't affect the logic as
2506
- // they will simply be overwritten.
2507
- component: vnode.component,
2508
- suspense: vnode.suspense,
2509
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
2510
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
2511
- placeholder: vnode.placeholder,
2512
- el: vnode.el,
2513
- anchor: vnode.anchor,
2514
- ctx: vnode.ctx,
2515
- ce: vnode.ce
2516
- };
2517
- if (transition && cloneTransition) {
2518
- setTransitionHooks(
2519
- cloned,
2520
- transition.clone(cloned)
2521
- );
2522
- }
2523
- return cloned;
2524
- }
2525
- function deepCloneVNode(vnode) {
2526
- const cloned = cloneVNode(vnode);
2527
- if (isArray(vnode.children)) {
2528
- cloned.children = vnode.children.map(deepCloneVNode);
2529
- }
2530
- return cloned;
2531
- }
2532
- function createTextVNode(text = " ", flag = 0) {
2533
- return createVNode(Text, null, text, flag);
2534
- }
2535
- function normalizeChildren(vnode, children) {
2536
- let type = 0;
2537
- const { shapeFlag } = vnode;
2538
- if (children == null) {
2539
- children = null;
2540
- } else if (isArray(children)) {
2541
- type = 16;
2542
- } else if (typeof children === "object") {
2543
- if (shapeFlag & (1 | 64)) {
2544
- const slot = children.default;
2545
- if (slot) {
2546
- slot._c && (slot._d = false);
2547
- normalizeChildren(vnode, slot());
2548
- slot._c && (slot._d = true);
2549
- }
2550
- return;
2551
- } else {
2552
- type = 32;
2553
- const slotFlag = children._;
2554
- if (!slotFlag && !isInternalObject(children)) {
2555
- children._ctx = currentRenderingInstance;
2556
- }
2557
- }
2558
- } else if (isFunction(children)) {
2559
- children = { default: children, _ctx: currentRenderingInstance };
2560
- type = 32;
2561
- } else {
2562
- children = String(children);
2563
- if (shapeFlag & 64) {
2564
- type = 16;
2565
- children = [createTextVNode(children)];
2566
- } else {
2567
- type = 8;
2568
- }
2569
- }
2570
- vnode.children = children;
2571
- vnode.shapeFlag |= type;
2572
- }
2573
- function mergeProps(...args) {
2574
- const ret = {};
2575
- for (let i = 0; i < args.length; i++) {
2576
- const toMerge = args[i];
2577
- for (const key in toMerge) {
2578
- if (key === "class") {
2579
- if (ret.class !== toMerge.class) {
2580
- ret.class = normalizeClass([ret.class, toMerge.class]);
2581
- }
2582
- } else if (key === "style") {
2583
- ret.style = normalizeStyle([ret.style, toMerge.style]);
2584
- } else if (isOn(key)) {
2585
- const existing = ret[key];
2586
- const incoming = toMerge[key];
2587
- if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
2588
- ret[key] = existing ? [].concat(existing, incoming) : incoming;
2589
- }
2590
- } else if (key !== "") {
2591
- ret[key] = toMerge[key];
2592
- }
2593
- }
2594
- }
2595
- return ret;
2596
- }
2597
- let currentInstance = null;
2598
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
2599
- {
2600
- const g = getGlobalThis();
2601
- const registerGlobalSetter = (key, setter) => {
2602
- let setters;
2603
- if (!(setters = g[key])) setters = g[key] = [];
2604
- setters.push(setter);
2605
- return (v) => {
2606
- if (setters.length > 1) setters.forEach((set) => set(v));
2607
- else setters[0](v);
2608
- };
2609
- };
2610
- registerGlobalSetter(
2611
- `__VUE_INSTANCE_SETTERS__`,
2612
- (v) => currentInstance = v
2613
- );
2614
- registerGlobalSetter(
2615
- `__VUE_SSR_SETTERS__`,
2616
- (v) => isInSSRComponentSetup = v
2617
- );
2618
- }
2619
- let isInSSRComponentSetup = false;
2620
- !!(process.env.NODE_ENV !== "production") ? {
2621
- } : {
2622
- };
2623
- const classifyRE = /(?:^|[-_])\w/g;
2624
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
2625
- function getComponentName(Component, includeInferred = true) {
2626
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
2627
- }
2628
- function formatComponentName(instance, Component, isRoot = false) {
2629
- let name = getComponentName(Component);
2630
- if (!name && Component.__file) {
2631
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
2632
- if (match) {
2633
- name = match[1];
2634
- }
2635
- }
2636
- if (!name && instance && instance.parent) {
2637
- const inferFromRegistry = (registry) => {
2638
- for (const key in registry) {
2639
- if (registry[key] === Component) {
2640
- return key;
2641
- }
2642
- }
2643
- };
2644
- name = inferFromRegistry(
2645
- instance.components || instance.parent.type.components
2646
- ) || inferFromRegistry(instance.appContext.components);
2647
- }
2648
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
2649
- }
2650
- function isClassComponent(value) {
2651
- return isFunction(value) && "__vccOpts" in value;
2652
- }
2653
-
2654
- const computed = (getterOrOptions, debugOptions) => {
2655
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
2656
- if (!!(process.env.NODE_ENV !== "production")) {
2657
- const i = getCurrentInstance();
2658
- if (i && i.appContext.config.warnRecursiveComputed) {
2659
- c._warnRecursive = true;
2660
- }
2661
- }
2662
- return c;
2663
- };
2664
-
2665
- function initCustomFormatter() {
2666
- if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
2667
- return;
2668
- }
2669
- const vueStyle = { style: "color:#3ba776" };
2670
- const numberStyle = { style: "color:#1677ff" };
2671
- const stringStyle = { style: "color:#f5222d" };
2672
- const keywordStyle = { style: "color:#eb2f96" };
2673
- const formatter = {
2674
- __vue_custom_formatter: true,
2675
- header(obj) {
2676
- if (!isObject(obj)) {
2677
- return null;
2678
- }
2679
- if (obj.__isVue) {
2680
- return ["div", vueStyle, `VueInstance`];
2681
- } else if (isRef(obj)) {
2682
- pauseTracking();
2683
- const value = obj.value;
2684
- resetTracking();
2685
- return [
2686
- "div",
2687
- {},
2688
- ["span", vueStyle, genRefFlag(obj)],
2689
- "<",
2690
- formatValue(value),
2691
- `>`
2692
- ];
2693
- } else if (isReactive(obj)) {
2694
- return [
2695
- "div",
2696
- {},
2697
- ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
2698
- "<",
2699
- formatValue(obj),
2700
- `>${isReadonly(obj) ? ` (readonly)` : ``}`
2701
- ];
2702
- } else if (isReadonly(obj)) {
2703
- return [
2704
- "div",
2705
- {},
2706
- ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
2707
- "<",
2708
- formatValue(obj),
2709
- ">"
2710
- ];
2711
- }
2712
- return null;
2713
- },
2714
- hasBody(obj) {
2715
- return obj && obj.__isVue;
2716
- },
2717
- body(obj) {
2718
- if (obj && obj.__isVue) {
2719
- return [
2720
- "div",
2721
- {},
2722
- ...formatInstance(obj.$)
2723
- ];
2724
- }
2725
- }
2726
- };
2727
- function formatInstance(instance) {
2728
- const blocks = [];
2729
- if (instance.type.props && instance.props) {
2730
- blocks.push(createInstanceBlock("props", toRaw(instance.props)));
2731
- }
2732
- if (instance.setupState !== EMPTY_OBJ) {
2733
- blocks.push(createInstanceBlock("setup", instance.setupState));
2734
- }
2735
- if (instance.data !== EMPTY_OBJ) {
2736
- blocks.push(createInstanceBlock("data", toRaw(instance.data)));
2737
- }
2738
- const computed = extractKeys(instance, "computed");
2739
- if (computed) {
2740
- blocks.push(createInstanceBlock("computed", computed));
2741
- }
2742
- const injected = extractKeys(instance, "inject");
2743
- if (injected) {
2744
- blocks.push(createInstanceBlock("injected", injected));
2745
- }
2746
- blocks.push([
2747
- "div",
2748
- {},
2749
- [
2750
- "span",
2751
- {
2752
- style: keywordStyle.style + ";opacity:0.66"
2753
- },
2754
- "$ (internal): "
2755
- ],
2756
- ["object", { object: instance }]
2757
- ]);
2758
- return blocks;
2759
- }
2760
- function createInstanceBlock(type, target) {
2761
- target = extend({}, target);
2762
- if (!Object.keys(target).length) {
2763
- return ["span", {}];
2764
- }
2765
- return [
2766
- "div",
2767
- { style: "line-height:1.25em;margin-bottom:0.6em" },
2768
- [
2769
- "div",
2770
- {
2771
- style: "color:#476582"
2772
- },
2773
- type
2774
- ],
2775
- [
2776
- "div",
2777
- {
2778
- style: "padding-left:1.25em"
2779
- },
2780
- ...Object.keys(target).map((key) => {
2781
- return [
2782
- "div",
2783
- {},
2784
- ["span", keywordStyle, key + ": "],
2785
- formatValue(target[key], false)
2786
- ];
2787
- })
2788
- ]
2789
- ];
2790
- }
2791
- function formatValue(v, asRaw = true) {
2792
- if (typeof v === "number") {
2793
- return ["span", numberStyle, v];
2794
- } else if (typeof v === "string") {
2795
- return ["span", stringStyle, JSON.stringify(v)];
2796
- } else if (typeof v === "boolean") {
2797
- return ["span", keywordStyle, v];
2798
- } else if (isObject(v)) {
2799
- return ["object", { object: asRaw ? toRaw(v) : v }];
2800
- } else {
2801
- return ["span", stringStyle, String(v)];
2802
- }
2803
- }
2804
- function extractKeys(instance, type) {
2805
- const Comp = instance.type;
2806
- if (isFunction(Comp)) {
2807
- return;
2808
- }
2809
- const extracted = {};
2810
- for (const key in instance.ctx) {
2811
- if (isKeyOfType(Comp, key, type)) {
2812
- extracted[key] = instance.ctx[key];
2813
- }
2814
- }
2815
- return extracted;
2816
- }
2817
- function isKeyOfType(Comp, key, type) {
2818
- const opts = Comp[type];
2819
- if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
2820
- return true;
2821
- }
2822
- if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
2823
- return true;
2824
- }
2825
- if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
2826
- return true;
2827
- }
2828
- }
2829
- function genRefFlag(v) {
2830
- if (isShallow(v)) {
2831
- return `ShallowRef`;
2832
- }
2833
- if (v.effect) {
2834
- return `ComputedRef`;
2835
- }
2836
- return `Ref`;
2837
- }
2838
- if (window.devtoolsFormatters) {
2839
- window.devtoolsFormatters.push(formatter);
2840
- } else {
2841
- window.devtoolsFormatters = [formatter];
2842
- }
2843
- }
2844
- !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
2845
- !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
2846
- !!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
2847
-
2848
- /**
2849
- * vue v3.5.24
2850
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
2851
- * @license MIT
2852
- **/
2853
-
2854
- function initDev() {
2855
- {
2856
- initCustomFormatter();
2857
- }
2858
- }
2859
-
2860
- if (!!(process.env.NODE_ENV !== "production")) {
2861
- initDev();
2862
- }
2863
-
2864
34
  const useDebounce = (callback, delay) => {
2865
35
  let timeoutId = null;
2866
36
  return function(...args) {
@@ -2873,34 +43,27 @@ const useDebounce = (callback, delay) => {
2873
43
  };
2874
44
  };
2875
45
 
2876
- const APP_MODULE = "#app";
2877
46
  class ADataProvider {
2878
- filter = ref(null);
2879
- sortList = ref([]);
2880
- currentPage = ref(1);
2881
- pageSize = ref(10);
2882
- pageData = ref([]);
2883
- rowCount = ref(0);
2884
- loading = ref(false);
2885
- SSR = ref(false);
2886
- deduplicate = ref(true);
47
+ filter = vue.ref(null);
48
+ sortList = vue.ref([]);
49
+ currentPage = vue.ref(1);
50
+ pageSize = vue.ref(10);
51
+ pageData = vue.ref([]);
52
+ rowCount = vue.ref(0);
53
+ loading = vue.ref(false);
54
+ SSR = vue.ref(false);
55
+ deduplicate = vue.ref(true);
2887
56
  nuxtApp = null;
2888
- urlPageParam = ref("");
2889
- selectedRows = ref([]);
2890
- selectAll = ref(false);
57
+ urlPageParam = vue.ref("");
58
+ selectedRows = vue.ref([]);
59
+ selectAll = vue.ref(false);
2891
60
  constructor(options) {
2892
61
  if (options?.nuxtApp) {
2893
62
  this.nuxtApp = options.nuxtApp;
2894
63
  } else if (undefined) {
2895
64
  try {
2896
- import(
2897
- /* @vite-ignore */
2898
- APP_MODULE
2899
- ).then((appModule) => {
2900
- this.nuxtApp = appModule.useNuxtApp();
2901
- }).catch(() => {
2902
- });
2903
- } catch (e) {
65
+ this.nuxtApp = nuxtAppCompat.getNuxtApp();
66
+ } catch {
2904
67
  }
2905
68
  }
2906
69
  if (options?.filter) {
@@ -2923,33 +86,28 @@ class ADataProvider {
2923
86
  }
2924
87
  if (options?.urlPageParam) {
2925
88
  this.urlPageParam.value = options.urlPageParam;
2926
- try {
2927
- import(
2928
- /* @vite-ignore */
2929
- APP_MODULE
2930
- ).then((appModule) => {
2931
- const route = appModule.useRoute();
2932
- const pageFromUrl = route.query[options.urlPageParam];
2933
- if (pageFromUrl) {
2934
- const parsedPage = parseInt(pageFromUrl, 10);
2935
- if (!isNaN(parsedPage) && parsedPage > 0) {
2936
- this.currentPage.value = parsedPage;
89
+ if (undefined) {
90
+ try {
91
+ const route = nuxtAppCompat.getRoute();
92
+ if (route) {
93
+ const pageFromUrl = route.query[options.urlPageParam];
94
+ if (pageFromUrl) {
95
+ const parsedPage = parseInt(pageFromUrl, 10);
96
+ if (!isNaN(parsedPage) && parsedPage > 0) {
97
+ this.currentPage.value = parsedPage;
98
+ }
2937
99
  }
2938
100
  }
2939
- }).catch(() => {
2940
- });
2941
- } catch (e) {
101
+ } catch (e) {
102
+ }
2942
103
  }
2943
104
  }
2944
- watch(this.currentPage, (newPage) => {
105
+ vue.watch(this.currentPage, (newPage) => {
2945
106
  this.loadPageData();
2946
107
  if (undefined && this.urlPageParam.value) {
2947
108
  try {
2948
- import(
2949
- /* @vite-ignore */
2950
- APP_MODULE
2951
- ).then((appModule) => {
2952
- const router = appModule.useRouter();
109
+ const router = nuxtAppCompat.getRouter();
110
+ if (router) {
2953
111
  const currentQuery = { ...router.currentRoute.value.query };
2954
112
  if (newPage === 1) {
2955
113
  delete currentQuery[this.urlPageParam.value];
@@ -2957,21 +115,20 @@ class ADataProvider {
2957
115
  currentQuery[this.urlPageParam.value] = String(newPage);
2958
116
  }
2959
117
  router.replace({ query: currentQuery });
2960
- }).catch(() => {
2961
- });
118
+ }
2962
119
  } catch (e) {
2963
120
  }
2964
121
  }
2965
122
  });
2966
- watch(this.pageSize, () => {
123
+ vue.watch(this.pageSize, () => {
2967
124
  this.currentPage.value = 1;
2968
125
  this.loadPageData();
2969
126
  });
2970
- watch(this.filter, useDebounce(() => {
127
+ vue.watch(this.filter, useDebounce(() => {
2971
128
  this.currentPage.value = 1;
2972
129
  this.loadPageData();
2973
130
  }, 300));
2974
- watch(this.sortList, () => {
131
+ vue.watch(this.sortList, () => {
2975
132
  this.currentPage.value = 1;
2976
133
  this.loadPageData();
2977
134
  });
@@ -2988,6 +145,9 @@ class ADataProvider {
2988
145
  setPageSize(pageSize) {
2989
146
  this.pageSize.value = pageSize;
2990
147
  }
148
+ async refresh(hardRefresh = false) {
149
+ this.loadPageData();
150
+ }
2991
151
  }
2992
152
 
2993
153
  const useFilterLogic = () => {
@@ -3219,8 +379,8 @@ const useSortLogic = () => {
3219
379
  const { filterData: filterData$1 } = useFilterLogic();
3220
380
  const { sortData } = useSortLogic();
3221
381
  class CFlatClientDataProvider extends ADataProvider {
3222
- allData = ref([]);
3223
- filteredData = ref([]);
382
+ allData = vue.ref([]);
383
+ filteredData = vue.ref([]);
3224
384
  constructor(options) {
3225
385
  super(options);
3226
386
  }
@@ -3246,8 +406,6 @@ class CFlatClientDataProvider extends ADataProvider {
3246
406
  this.pageData.value = this.filteredData.value.slice(startIndex, endIndex);
3247
407
  }
3248
408
  }
3249
- refreshData() {
3250
- }
3251
409
  }
3252
410
 
3253
411
  class ACacheProvider {
@@ -3377,9 +535,9 @@ class CMemoryCache extends ACacheProvider {
3377
535
  this._hydrateFromPayload();
3378
536
  }
3379
537
  }
3380
- _hydrateFromPayload() {
538
+ async _hydrateFromPayload() {
3381
539
  try {
3382
- const nuxtApp = typeof useNuxtApp === "function" ? useNuxtApp() : null;
540
+ const nuxtApp = await nuxtAppCompat.getNuxtApp();
3383
541
  const payloadData = nuxtApp?.payload?.data || globalThis.__NUXT__?.payload?.data;
3384
542
  if (!payloadData) return;
3385
543
  for (const key in payloadData) {
@@ -3525,9 +683,9 @@ class CLocalStorageCache extends ACacheProvider {
3525
683
  this._hydrateFromPayload();
3526
684
  }
3527
685
  }
3528
- _hydrateFromPayload() {
686
+ async _hydrateFromPayload() {
3529
687
  try {
3530
- const nuxtApp = typeof useNuxtApp === "function" ? useNuxtApp() : null;
688
+ const nuxtApp = await nuxtAppCompat.getNuxtApp();
3531
689
  const payloadData = nuxtApp?.payload?.data || window.__NUXT__?.payload?.data;
3532
690
  if (!payloadData) return;
3533
691
  const prefix = "cache:";
@@ -3727,9 +885,9 @@ class CIndexedDBCache extends ACacheProvider {
3727
885
  super();
3728
886
  this.setStore();
3729
887
  }
3730
- _hydrateFromPayload() {
888
+ async _hydrateFromPayload() {
3731
889
  try {
3732
- const nuxtApp = typeof useNuxtApp === "function" ? useNuxtApp() : null;
890
+ const nuxtApp = await nuxtAppCompat.getNuxtApp();
3733
891
  const payloadData = nuxtApp?.payload?.data || globalThis.__NUXT__?.payload?.data;
3734
892
  if (!payloadData) return;
3735
893
  const prefix = "cache:";
@@ -3989,8 +1147,11 @@ class CCookieCache extends ACacheProvider {
3989
1147
  if (undefined) {
3990
1148
  cookieStr = document.cookie;
3991
1149
  } else if (nuxtApp) {
3992
- const headers = nuxtApp.node?.req?.headers || nuxtApp.ssrContext?.event?.node?.req?.headers;
3993
- cookieStr = headers?.["cookie"] || "";
1150
+ const event = nuxtApp.ssrContext?.event;
1151
+ if (event) {
1152
+ const cookies2 = h3.parseCookies(event);
1153
+ return Object.keys(cookies2).filter((k) => k.startsWith(prefix)).map((k) => k.substring(prefix.length));
1154
+ }
3994
1155
  }
3995
1156
  if (!cookieStr) return [];
3996
1157
  const keys = [];
@@ -4021,21 +1182,14 @@ class CCookieCache extends ACacheProvider {
4021
1182
  }
4022
1183
  }
4023
1184
  } else if (nuxtApp) {
4024
- const headers = nuxtApp.node?.req?.headers || nuxtApp.ssrContext?.event?.node?.req?.headers;
4025
- const cookieStr = headers?.["cookie"] || "";
4026
- const name = prefixedKey + "=";
4027
- const ca = cookieStr.split(";");
4028
- for (let i = 0; i < ca.length; i++) {
4029
- let c = ca[i].trim();
4030
- if (c.indexOf(name) === 0) {
4031
- cookieValue = c.substring(name.length, c.length);
4032
- break;
4033
- }
1185
+ const event = nuxtApp.ssrContext?.event;
1186
+ if (event) {
1187
+ cookieValue = h3.getCookie(event, prefixedKey) ?? null;
4034
1188
  }
4035
1189
  }
4036
1190
  if (!cookieValue) return null;
4037
1191
  try {
4038
- const val = JSON.parse(decodeURIComponent(cookieValue));
1192
+ const val = JSON.parse(cookieValue);
4039
1193
  if (val && val.timestamp && val.lifetime) {
4040
1194
  if (Date.now() - val.timestamp <= val.lifetime) {
4041
1195
  return val.data;
@@ -4055,42 +1209,30 @@ class CCookieCache extends ACacheProvider {
4055
1209
  timestamp: Date.now(),
4056
1210
  lifetime
4057
1211
  };
4058
- const cookieValue = encodeURIComponent(JSON.stringify(entry));
4059
1212
  const maxAge = Math.floor(lifetime / 1e3);
4060
- new Date(Date.now() + lifetime).toUTCString();
4061
- const cookieStr = `${prefixedKey}=${cookieValue}; Max-Age=${maxAge}; Path=/; SameSite=Lax${undefined ? "; HttpOnly" : ""}`;
4062
1213
  if (undefined) {
4063
- document.cookie = cookieStr;
1214
+ const cookieValue = encodeURIComponent(JSON.stringify(entry));
1215
+ document.cookie = `${prefixedKey}=${cookieValue}; Max-Age=${maxAge}; Path=/; SameSite=Lax`;
4064
1216
  } else if (nuxtApp) {
4065
- const res = nuxtApp.node?.res || nuxtApp.ssrContext?.event?.node?.res;
4066
- if (res) {
4067
- const existing = res.getHeader("Set-Cookie");
4068
- if (!existing) {
4069
- res.setHeader("Set-Cookie", cookieStr);
4070
- } else if (Array.isArray(existing)) {
4071
- res.setHeader("Set-Cookie", [...existing, cookieStr]);
4072
- } else {
4073
- res.setHeader("Set-Cookie", [existing, cookieStr]);
4074
- }
1217
+ const event = nuxtApp.ssrContext?.event;
1218
+ if (event) {
1219
+ h3.setCookie(event, prefixedKey, JSON.stringify(entry), {
1220
+ maxAge,
1221
+ path: "/",
1222
+ sameSite: "lax",
1223
+ httpOnly: true
1224
+ });
4075
1225
  }
4076
1226
  }
4077
1227
  }
4078
1228
  async remove(key, nuxtApp) {
4079
1229
  const prefixedKey = "cache:" + key;
4080
- const cookieStr = `${prefixedKey}=; Max-Age=0; Path=/; SameSite=Lax${undefined ? "; HttpOnly" : ""}`;
4081
1230
  if (undefined) {
4082
- document.cookie = cookieStr;
1231
+ document.cookie = `${prefixedKey}=; Max-Age=0; Path=/; SameSite=Lax`;
4083
1232
  } else if (nuxtApp) {
4084
- const res = nuxtApp.node?.res || nuxtApp.ssrContext?.event?.node?.res;
4085
- if (res) {
4086
- const existing = res.getHeader("Set-Cookie");
4087
- if (!existing) {
4088
- res.setHeader("Set-Cookie", cookieStr);
4089
- } else if (Array.isArray(existing)) {
4090
- res.setHeader("Set-Cookie", [...existing, cookieStr]);
4091
- } else {
4092
- res.setHeader("Set-Cookie", [existing, cookieStr]);
4093
- }
1233
+ const event = nuxtApp.ssrContext?.event;
1234
+ if (event) {
1235
+ h3.deleteCookie(event, prefixedKey, { path: "/", sameSite: "lax", httpOnly: true });
4094
1236
  }
4095
1237
  }
4096
1238
  }
@@ -4108,21 +1250,14 @@ class CCookieCache extends ACacheProvider {
4108
1250
  }
4109
1251
  }
4110
1252
  } else if (nuxtApp) {
4111
- const headers = nuxtApp.node?.req?.headers || nuxtApp.ssrContext?.event?.node?.req?.headers;
4112
- const cookieStr = headers?.["cookie"] || "";
4113
- const name = prefixedKey + "=";
4114
- const ca = cookieStr.split(";");
4115
- for (let i = 0; i < ca.length; i++) {
4116
- let c = ca[i].trim();
4117
- if (c.indexOf(name) === 0) {
4118
- cookieValue = c.substring(name.length, c.length);
4119
- break;
4120
- }
1253
+ const event = nuxtApp.ssrContext?.event;
1254
+ if (event) {
1255
+ cookieValue = h3.getCookie(event, prefixedKey) ?? null;
4121
1256
  }
4122
1257
  }
4123
1258
  if (!cookieValue) return null;
4124
1259
  try {
4125
- const val = JSON.parse(decodeURIComponent(cookieValue));
1260
+ const val = JSON.parse(cookieValue);
4126
1261
  if (val && val.timestamp && val.lifetime) {
4127
1262
  return Math.max(0, val.timestamp + val.lifetime - Date.now());
4128
1263
  }
@@ -4474,6 +1609,9 @@ class RequestProvider {
4474
1609
  static requestQueue = [];
4475
1610
  static executing = false;
4476
1611
  static requestsInFlight = /* @__PURE__ */ new Map();
1612
+ lastUrl;
1613
+ lastOptions;
1614
+ dataReceivedCallback;
4477
1615
  constructor(provider, lifetime, deduplicate) {
4478
1616
  if (provider) this.setCacheProvider(provider);
4479
1617
  if (lifetime) this.setCacheLifetime(lifetime);
@@ -4492,6 +1630,26 @@ class RequestProvider {
4492
1630
  setDeduplicate(deduplicate) {
4493
1631
  this.deduplicate = deduplicate;
4494
1632
  }
1633
+ onDataReceived(callback) {
1634
+ this.dataReceivedCallback = callback;
1635
+ }
1636
+ hasLastUrl() {
1637
+ return !!this.lastUrl;
1638
+ }
1639
+ async refresh(hardRefresh = false) {
1640
+ if (!this.dataReceivedCallback) {
1641
+ return null;
1642
+ }
1643
+ if (!this.lastUrl) {
1644
+ console.warn("[RequestProvider] refresh called before any request was made.");
1645
+ return null;
1646
+ }
1647
+ const options = { ...this.lastOptions };
1648
+ if (hardRefresh) {
1649
+ options.disableCache = true;
1650
+ }
1651
+ return this.request(this.lastUrl, options);
1652
+ }
4495
1653
  getUniqueKey(url, options) {
4496
1654
  if (options?.key) return options.key;
4497
1655
  const { query, body, headers, method } = options || {};
@@ -4508,7 +1666,15 @@ class RequestProvider {
4508
1666
  const uniqueKey = this.getUniqueKey(url, options);
4509
1667
  const shouldDeduplicate = options?.deduplicate ?? this.deduplicate;
4510
1668
  if (shouldDeduplicate && RequestProvider.requestsInFlight.has(uniqueKey)) {
4511
- return RequestProvider.requestsInFlight.get(uniqueKey);
1669
+ const inflightPromise = RequestProvider.requestsInFlight.get(uniqueKey);
1670
+ return inflightPromise.then((result) => {
1671
+ this.lastUrl = url;
1672
+ this.lastOptions = options;
1673
+ if (this.dataReceivedCallback) {
1674
+ this.dataReceivedCallback(result);
1675
+ }
1676
+ return result;
1677
+ });
4512
1678
  }
4513
1679
  const promise = new Promise((resolve, reject) => {
4514
1680
  RequestProvider.requestQueue.push({
@@ -4551,9 +1717,13 @@ class RequestProvider {
4551
1717
  const nuxtApp = options?.nuxtApp;
4552
1718
  let serverHeaders = {};
4553
1719
  if (nuxtApp && undefined) {
4554
- const req = nuxtApp.node?.req || nuxtApp.ssrContext?.event?.node?.req;
4555
- if (req?.headers?.cookie) {
4556
- serverHeaders = { cookie: req.headers.cookie };
1720
+ const event = nuxtApp.ssrContext?.event;
1721
+ if (event) {
1722
+ const { getRequestHeader } = await import('h3');
1723
+ const cookieHeader = getRequestHeader(event, "cookie");
1724
+ if (cookieHeader) {
1725
+ serverHeaders = { cookie: cookieHeader };
1726
+ }
4557
1727
  }
4558
1728
  }
4559
1729
  const provider = cacheStrategy ? CacheProviderFactory.getProvider(cacheStrategy) : this.cacheProvider;
@@ -4564,6 +1734,11 @@ class RequestProvider {
4564
1734
  const cached = await provider.get(uniqueKey, nuxtApp);
4565
1735
  if (cached) {
4566
1736
  console.log(`[RequestProvider] CACHE HIT: ${url}`);
1737
+ this.lastUrl = url;
1738
+ this.lastOptions = options;
1739
+ if (this.dataReceivedCallback) {
1740
+ this.dataReceivedCallback(cached);
1741
+ }
4567
1742
  return cached;
4568
1743
  }
4569
1744
  console.log(`[RequestProvider] CACHE MISS: ${url}`);
@@ -4574,27 +1749,37 @@ class RequestProvider {
4574
1749
  headers: { ...headers, ...serverHeaders },
4575
1750
  query
4576
1751
  };
4577
- const responseData = await $fetch(url, fetchOptions);
1752
+ const responseData = await ofetch.$fetch(url, fetchOptions);
4578
1753
  if (provider && cacheLifetime && responseData && isGetRequest) {
4579
1754
  await provider.set(uniqueKey, responseData, cacheLifetime, nuxtApp);
4580
1755
  }
1756
+ this.lastUrl = url;
1757
+ this.lastOptions = options;
1758
+ if (this.dataReceivedCallback) {
1759
+ this.dataReceivedCallback(responseData);
1760
+ }
4581
1761
  return responseData;
4582
1762
  }
4583
1763
  }
4584
1764
 
4585
1765
  class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4586
- apiUrl = ref("");
4587
- contextKey = ref("");
4588
- initialLoad = ref(true);
1766
+ apiUrl = vue.ref("");
1767
+ contextKey = vue.ref("");
1768
+ initialLoad = vue.ref(true);
4589
1769
  requestProvider = new RequestProvider();
4590
- cacheStrategy = ref(null);
4591
- cacheLifetime = ref(0);
4592
- refreshOnMutation = ref(void 0);
1770
+ cacheStrategy = vue.ref(null);
1771
+ cacheLifetime = vue.ref(0);
1772
+ refreshOnMutation = vue.ref(void 0);
4593
1773
  constructor(options) {
4594
1774
  super(options);
4595
1775
  if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
4596
1776
  if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
4597
1777
  if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
1778
+ this.requestProvider.onDataReceived((data) => {
1779
+ if (data) {
1780
+ this.setData(data.rows || data);
1781
+ }
1782
+ });
4598
1783
  }
4599
1784
  setContextKey(key) {
4600
1785
  this.contextKey.value = key;
@@ -4602,22 +1787,35 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4602
1787
  if (this.cacheStrategy.value) this.requestProvider.setCacheProvider(this.cacheStrategy.value);
4603
1788
  if (this.cacheLifetime.value) this.requestProvider.setCacheLifetime(this.cacheLifetime.value);
4604
1789
  }
1790
+ async refresh(hardRefresh = false) {
1791
+ await this.refreshData({ disableCache: hardRefresh });
1792
+ }
4605
1793
  async refreshData(options) {
1794
+ if (!this.requestProvider.hasLastUrl()) {
1795
+ await this._initialFetch(options?.disableCache ?? false);
1796
+ return;
1797
+ }
1798
+ this.loading.value = true;
1799
+ try {
1800
+ await this.requestProvider.refresh(options?.disableCache ?? false);
1801
+ } finally {
1802
+ this.loading.value = false;
1803
+ }
1804
+ }
1805
+ async _initialFetch(disableCache = false) {
4606
1806
  if (!this.SSR.value && undefined) return;
4607
1807
  const fetcher = async () => {
4608
1808
  const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
4609
1809
  deduplicate: this.deduplicate.value,
4610
1810
  nuxtApp: this.nuxtApp,
4611
- disableCache: options?.disableCache
1811
+ disableCache
4612
1812
  });
4613
- if (this.SSR.value && undefined) {
4614
- return await promise;
4615
- }
1813
+ if (this.SSR.value && undefined) return await promise;
4616
1814
  return promise;
4617
1815
  };
4618
1816
  const key = `${this.contextKey.value}`;
4619
- if (this.contextKey.value && this.initialLoad.value) {
4620
- const { data } = useNuxtData(key);
1817
+ if (this.contextKey.value && this.initialLoad.value && !disableCache) {
1818
+ const { data } = nuxtAppCompat.getNuxtData(key, this.nuxtApp);
4621
1819
  if (data.value) {
4622
1820
  const result = data.value;
4623
1821
  this.setData(result.rows);
@@ -4627,7 +1825,10 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4627
1825
  }
4628
1826
  }
4629
1827
  if (undefined && this.contextKey.value) {
4630
- const { data } = await useAsyncData(key, fetcher);
1828
+ if (disableCache) {
1829
+ nuxtAppCompat.clearNuxtDataKey(key, this.nuxtApp);
1830
+ }
1831
+ const { data } = await nuxtAppCompat.getAsyncData(key, fetcher, this.nuxtApp);
4631
1832
  if (data.value) {
4632
1833
  const result = data.value;
4633
1834
  this.setData(result.rows);
@@ -4640,22 +1841,20 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4640
1841
  const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
4641
1842
  deduplicate: this.deduplicate.value,
4642
1843
  nuxtApp: this.nuxtApp,
4643
- disableCache: options?.disableCache
1844
+ disableCache
4644
1845
  });
4645
- promise.then((returnedData2) => {
1846
+ promise.then(() => {
4646
1847
  this.initialLoad.value = false;
4647
1848
  this.loading.value = false;
4648
- this.setData(returnedData2.rows);
4649
1849
  }).catch(() => {
4650
1850
  this.initialLoad.value = false;
4651
1851
  this.loading.value = false;
4652
1852
  });
4653
1853
  return;
4654
1854
  }
4655
- const returnedData = await fetcher();
1855
+ await fetcher();
4656
1856
  this.initialLoad.value = false;
4657
1857
  this.loading.value = false;
4658
- this.setData(returnedData.rows);
4659
1858
  }
4660
1859
  async setAPIUrl(url) {
4661
1860
  this.loading.value = true;
@@ -4672,19 +1871,18 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4672
1871
  nuxtApp: this.nuxtApp
4673
1872
  });
4674
1873
  if (this.refreshOnMutation.value) {
4675
- await this.refreshData({ disableCache: true });
1874
+ await this.refresh(true);
4676
1875
  } else {
4677
1876
  if (result && result.item) {
4678
1877
  this.allData.value.push(result.item);
4679
1878
  this.loadPageData();
4680
- } else {
4681
- await this.refreshData({ disableCache: true });
1879
+ await this.refresh(true);
4682
1880
  }
4683
1881
  if (this.requestProvider.cacheProvider) {
4684
1882
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
4685
1883
  }
4686
1884
  if (this.contextKey.value) {
4687
- clearNuxtData(this.contextKey.value);
1885
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
4688
1886
  }
4689
1887
  }
4690
1888
  }
@@ -4696,7 +1894,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4696
1894
  nuxtApp: this.nuxtApp
4697
1895
  });
4698
1896
  if (this.refreshOnMutation.value) {
4699
- await this.refreshData({ disableCache: true });
1897
+ await this.refresh(true);
4700
1898
  } else {
4701
1899
  const index = this.allData.value.findIndex((row) => row["id"] === item["id"]);
4702
1900
  if (index !== -1) {
@@ -4711,7 +1909,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4711
1909
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
4712
1910
  }
4713
1911
  if (this.contextKey.value) {
4714
- clearNuxtData(this.contextKey.value);
1912
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
4715
1913
  }
4716
1914
  }
4717
1915
  }
@@ -4725,7 +1923,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4725
1923
  nuxtApp: this.nuxtApp
4726
1924
  });
4727
1925
  if (this.refreshOnMutation.value) {
4728
- await this.refreshData({ disableCache: true });
1926
+ await this.refresh(true);
4729
1927
  } else {
4730
1928
  const idsToDelete = new Set(ids);
4731
1929
  this.allData.value = this.allData.value.filter((row) => !idsToDelete.has(row["id"]));
@@ -4733,21 +1931,21 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
4733
1931
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
4734
1932
  }
4735
1933
  if (this.contextKey.value) {
4736
- clearNuxtData(this.contextKey.value);
1934
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
4737
1935
  }
4738
1936
  }
4739
1937
  }
4740
1938
  }
4741
1939
 
4742
1940
  class CFlatServerDataProvider extends ADataProvider {
4743
- pageDataHandler = ref((currentPage, pageSize, filter, sortList) => {
1941
+ pageDataHandler = vue.ref((currentPage, pageSize, filter, sortList) => {
4744
1942
  return {
4745
1943
  rows: [],
4746
1944
  rowCount: 0
4747
1945
  };
4748
1946
  });
4749
- contextKey = ref("");
4750
- initialLoad = ref(true);
1947
+ contextKey = vue.ref("");
1948
+ initialLoad = vue.ref(true);
4751
1949
  constructor(options) {
4752
1950
  super(options);
4753
1951
  }
@@ -4770,7 +1968,7 @@ class CFlatServerDataProvider extends ADataProvider {
4770
1968
  ].join("-");
4771
1969
  const fetcher = async () => await this.pageDataHandler.value(this.currentPage.value, this.pageSize.value, this.filter.value, this.sortList.value, options);
4772
1970
  if (!options?.disableCache && this.SSR.value && this.contextKey.value && this.initialLoad.value) {
4773
- const { data } = useNuxtData(key);
1971
+ const { data } = nuxtAppCompat.getNuxtData(key, this.nuxtApp);
4774
1972
  if (data.value) {
4775
1973
  const result = data.value;
4776
1974
  this.pageData.value = result.rows;
@@ -4780,9 +1978,9 @@ class CFlatServerDataProvider extends ADataProvider {
4780
1978
  return;
4781
1979
  }
4782
1980
  }
4783
- if (this.SSR.value && this.contextKey.value) {
1981
+ if (this.SSR.value && this.contextKey.value && !options?.disableCache && (undefined || this.initialLoad.value)) {
4784
1982
  this.loading.value = true;
4785
- const { data } = await useAsyncData(key, fetcher);
1983
+ const { data } = await nuxtAppCompat.getAsyncData(key, fetcher, this.nuxtApp);
4786
1984
  if (data.value) {
4787
1985
  const result = data.value;
4788
1986
  this.pageData.value = result.rows;
@@ -4793,7 +1991,7 @@ class CFlatServerDataProvider extends ADataProvider {
4793
1991
  }
4794
1992
  }
4795
1993
  if (!this.SSR.value) {
4796
- onNuxtReady(() => {
1994
+ nuxtAppCompat.onNuxtReadyCallback(() => {
4797
1995
  this.loading.value = true;
4798
1996
  fetcher().then((returnedData2) => {
4799
1997
  this.pageData.value = returnedData2.rows;
@@ -4814,20 +2012,45 @@ class CFlatServerDataProvider extends ADataProvider {
4814
2012
  this.initialLoad.value = false;
4815
2013
  this.loading.value = false;
4816
2014
  }
2015
+ async refresh(hardRefresh = false) {
2016
+ await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
2017
+ }
4817
2018
  }
4818
2019
 
4819
2020
  class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
4820
- apiUrl = ref("");
2021
+ apiUrl = vue.ref("");
4821
2022
  requestProvider = new RequestProvider();
4822
- cacheStrategy = ref(null);
4823
- cacheLifetime = ref(0);
4824
- refreshOnMutation = ref(true);
2023
+ cacheStrategy = vue.ref(null);
2024
+ cacheLifetime = vue.ref(0);
2025
+ refreshOnMutation = vue.ref(true);
4825
2026
  // Default true for server
4826
2027
  constructor(options) {
4827
2028
  super(options);
4828
2029
  if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
4829
2030
  if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
4830
2031
  if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
2032
+ this.requestProvider.onDataReceived((data) => {
2033
+ if (data) {
2034
+ this.pageData.value = data.rows || data;
2035
+ if (data.rowCount !== void 0) {
2036
+ this.rowCount.value = data.rowCount;
2037
+ }
2038
+ }
2039
+ });
2040
+ }
2041
+ async refresh(hardRefresh = false) {
2042
+ if (hardRefresh && this.requestProvider.cacheProvider) {
2043
+ await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
2044
+ }
2045
+ this.loading.value = true;
2046
+ try {
2047
+ await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
2048
+ } finally {
2049
+ this.loading.value = false;
2050
+ }
2051
+ }
2052
+ async refreshData(options) {
2053
+ await this.refresh(options?.disableCache ?? false);
4831
2054
  }
4832
2055
  async setAPIUrl(url) {
4833
2056
  this.apiUrl.value = url;
@@ -4863,17 +2086,17 @@ class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
4863
2086
  if (this.requestProvider.cacheProvider) {
4864
2087
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
4865
2088
  }
4866
- this.loadPageData({ disableCache: true });
2089
+ await this.refresh(true);
4867
2090
  }
4868
2091
  }
4869
2092
  }
4870
2093
 
4871
2094
  class AAPIDataProvider {
4872
- apiUrl = ref("");
4873
- cacheStrategy = ref(null);
4874
- cacheLifetime = ref(60 * 1e3);
2095
+ apiUrl = vue.ref("");
2096
+ cacheStrategy = vue.ref(null);
2097
+ cacheLifetime = vue.ref(60 * 1e3);
4875
2098
  requestProvider = new RequestProvider();
4876
- refreshOnMutation = ref(void 0);
2099
+ refreshOnMutation = vue.ref(void 0);
4877
2100
  constructor(options) {
4878
2101
  if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
4879
2102
  if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
@@ -4889,7 +2112,7 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
4889
2112
  expandedByDefault = false;
4890
2113
  paginateBy = "all";
4891
2114
  // Tree state
4892
- expandedNodes = ref(/* @__PURE__ */ new Set());
2115
+ expandedNodes = vue.ref(/* @__PURE__ */ new Set());
4893
2116
  // Internal: static tree structure (only rebuilds when data changes)
4894
2117
  _staticNodes;
4895
2118
  _nodeMap;
@@ -4900,10 +2123,10 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
4900
2123
  if (options?.idKey) this.idKey = options.idKey;
4901
2124
  if (options?.expandedByDefault) this.expandedByDefault = options.expandedByDefault;
4902
2125
  if (options?.paginateBy) this.paginateBy = options.paginateBy;
4903
- this._staticNodes = computed(() => this.buildStaticNodes());
4904
- this._nodeMap = computed(() => new Map(this._staticNodes.value.map((n) => [n.id, n])));
4905
- this._sortedNodeIds = computed(() => this.computeSortedIds());
4906
- watch([this.expandedNodes, this._staticNodes], () => {
2126
+ this._staticNodes = vue.computed(() => this.buildStaticNodes());
2127
+ this._nodeMap = vue.computed(() => new Map(this._staticNodes.value.map((n) => [n.id, n])));
2128
+ this._sortedNodeIds = vue.computed(() => this.computeSortedIds());
2129
+ vue.watch([this.expandedNodes, this._staticNodes], () => {
4907
2130
  this.updatePageData();
4908
2131
  }, { immediate: true });
4909
2132
  }
@@ -5126,18 +2349,23 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
5126
2349
  }
5127
2350
 
5128
2351
  class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5129
- apiUrl = ref("");
5130
- contextKey = ref("");
5131
- initialLoad = ref(true);
2352
+ apiUrl = vue.ref("");
2353
+ contextKey = vue.ref("");
2354
+ initialLoad = vue.ref(true);
5132
2355
  requestProvider = new RequestProvider();
5133
- cacheStrategy = ref(null);
5134
- cacheLifetime = ref(0);
5135
- refreshOnMutation = ref(void 0);
2356
+ cacheStrategy = vue.ref(null);
2357
+ cacheLifetime = vue.ref(0);
2358
+ refreshOnMutation = vue.ref(void 0);
5136
2359
  constructor(options) {
5137
2360
  super(options);
5138
2361
  if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
5139
2362
  if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
5140
2363
  if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
2364
+ this.requestProvider.onDataReceived((data) => {
2365
+ if (data) {
2366
+ this.setData(data.rows || data);
2367
+ }
2368
+ });
5141
2369
  }
5142
2370
  setContextKey(key) {
5143
2371
  this.contextKey.value = key;
@@ -5145,22 +2373,35 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5145
2373
  if (this.cacheStrategy.value) this.requestProvider.setCacheProvider(this.cacheStrategy.value);
5146
2374
  if (this.cacheLifetime.value) this.requestProvider.setCacheLifetime(this.cacheLifetime.value);
5147
2375
  }
2376
+ async refresh(hardRefresh = false) {
2377
+ await this.refreshData({ disableCache: hardRefresh });
2378
+ }
5148
2379
  async refreshData(options) {
2380
+ if (!this.requestProvider.hasLastUrl()) {
2381
+ await this._initialFetch(options?.disableCache ?? false);
2382
+ return;
2383
+ }
2384
+ this.loading.value = true;
2385
+ try {
2386
+ await this.requestProvider.refresh(options?.disableCache ?? false);
2387
+ } finally {
2388
+ this.loading.value = false;
2389
+ }
2390
+ }
2391
+ async _initialFetch(disableCache = false) {
5149
2392
  if (!this.SSR.value && undefined) return;
5150
2393
  const fetcher = async () => {
5151
2394
  const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
5152
2395
  deduplicate: this.deduplicate.value,
5153
2396
  nuxtApp: this.nuxtApp,
5154
- disableCache: options?.disableCache
2397
+ disableCache
5155
2398
  });
5156
- if (this.SSR.value && undefined) {
5157
- return await promise;
5158
- }
2399
+ if (this.SSR.value && undefined) return await promise;
5159
2400
  return promise;
5160
2401
  };
5161
2402
  const key = `${this.contextKey.value}`;
5162
- if (this.contextKey.value && this.initialLoad.value) {
5163
- const { data } = useNuxtData(key);
2403
+ if (this.contextKey.value && this.initialLoad.value && !disableCache) {
2404
+ const { data } = nuxtAppCompat.getNuxtData(key, this.nuxtApp);
5164
2405
  if (data.value) {
5165
2406
  const result = data.value;
5166
2407
  this.setData(result.rows);
@@ -5170,7 +2411,10 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5170
2411
  }
5171
2412
  }
5172
2413
  if (undefined && this.contextKey.value) {
5173
- const { data } = await useAsyncData(key, fetcher);
2414
+ if (disableCache) {
2415
+ nuxtAppCompat.clearNuxtDataKey(key, this.nuxtApp);
2416
+ }
2417
+ const { data } = await nuxtAppCompat.getAsyncData(key, fetcher, this.nuxtApp);
5174
2418
  if (data.value) {
5175
2419
  const result = data.value;
5176
2420
  this.setData(result.rows);
@@ -5183,22 +2427,20 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5183
2427
  const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
5184
2428
  deduplicate: this.deduplicate.value,
5185
2429
  nuxtApp: this.nuxtApp,
5186
- disableCache: options?.disableCache
2430
+ disableCache
5187
2431
  });
5188
- promise.then((returnedData2) => {
2432
+ promise.then(() => {
5189
2433
  this.initialLoad.value = false;
5190
2434
  this.loading.value = false;
5191
- this.setData(returnedData2.rows);
5192
2435
  }).catch(() => {
5193
2436
  this.initialLoad.value = false;
5194
2437
  this.loading.value = false;
5195
2438
  });
5196
2439
  return;
5197
2440
  }
5198
- const returnedData = await fetcher();
2441
+ await fetcher();
5199
2442
  this.initialLoad.value = false;
5200
2443
  this.loading.value = false;
5201
- this.setData(returnedData.rows);
5202
2444
  }
5203
2445
  async setAPIUrl(url) {
5204
2446
  this.loading.value = true;
@@ -5215,18 +2457,18 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5215
2457
  nuxtApp: this.nuxtApp
5216
2458
  });
5217
2459
  if (this.refreshOnMutation.value) {
5218
- await this.refreshData({ disableCache: true });
2460
+ await this.refresh(true);
5219
2461
  } else {
5220
2462
  if (result && result.item) {
5221
2463
  this.allData.value.push(result.item);
5222
2464
  } else {
5223
- await this.refreshData({ disableCache: true });
2465
+ await this.refresh(true);
5224
2466
  }
5225
2467
  if (this.requestProvider.cacheProvider) {
5226
2468
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
5227
2469
  }
5228
2470
  if (this.contextKey.value) {
5229
- clearNuxtData(this.contextKey.value);
2471
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
5230
2472
  }
5231
2473
  }
5232
2474
  }
@@ -5238,7 +2480,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5238
2480
  nuxtApp: this.nuxtApp
5239
2481
  });
5240
2482
  if (this.refreshOnMutation.value) {
5241
- await this.refreshData({ disableCache: true });
2483
+ await this.refresh(true);
5242
2484
  } else {
5243
2485
  const index = this.allData.value.findIndex((row) => row[this.idKey] === item[this.idKey]);
5244
2486
  if (index !== -1) {
@@ -5253,7 +2495,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5253
2495
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
5254
2496
  }
5255
2497
  if (this.contextKey.value) {
5256
- clearNuxtData(this.contextKey.value);
2498
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
5257
2499
  }
5258
2500
  }
5259
2501
  }
@@ -5267,7 +2509,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5267
2509
  nuxtApp: this.nuxtApp
5268
2510
  });
5269
2511
  if (this.refreshOnMutation.value) {
5270
- await this.refreshData({ disableCache: true });
2512
+ await this.refresh(true);
5271
2513
  } else {
5272
2514
  const idsToDelete = new Set(ids);
5273
2515
  this.allData.value = this.allData.value.filter((row) => !idsToDelete.has(row[this.idKey]));
@@ -5275,7 +2517,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
5275
2517
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
5276
2518
  }
5277
2519
  if (this.contextKey.value) {
5278
- clearNuxtData(this.contextKey.value);
2520
+ nuxtAppCompat.clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
5279
2521
  }
5280
2522
  }
5281
2523
  }
@@ -5288,18 +2530,18 @@ class CTreeServerDataProvider extends ADataProvider {
5288
2530
  expandedByDefault = false;
5289
2531
  paginateBy = "all";
5290
2532
  // Tree state - toggled nodes (sent to server for visibility calculation)
5291
- expandedNodes = ref(/* @__PURE__ */ new Set());
2533
+ expandedNodes = vue.ref(/* @__PURE__ */ new Set());
5292
2534
  // Server-side data handler
5293
- pageDataHandler = ref(null);
5294
- contextKey = ref("");
5295
- initialLoad = ref(true);
2535
+ pageDataHandler = vue.ref(null);
2536
+ contextKey = vue.ref("");
2537
+ initialLoad = vue.ref(true);
5296
2538
  constructor(options) {
5297
2539
  super(options);
5298
2540
  if (options?.parentKey) this.parentKey = options.parentKey;
5299
2541
  if (options?.idKey) this.idKey = options.idKey;
5300
2542
  if (options?.expandedByDefault) this.expandedByDefault = options.expandedByDefault;
5301
2543
  if (options?.paginateBy) this.paginateBy = options.paginateBy;
5302
- watch([this.expandedNodes, this.currentPage, this.pageSize], () => {
2544
+ vue.watch([this.expandedNodes, this.currentPage, this.pageSize], () => {
5303
2545
  if (this.pageDataHandler.value && !this.initialLoad.value) {
5304
2546
  this.loadPageData();
5305
2547
  }
@@ -5344,7 +2586,7 @@ class CTreeServerDataProvider extends ADataProvider {
5344
2586
  options
5345
2587
  );
5346
2588
  if (!options?.disableCache && this.SSR.value && this.contextKey.value && this.initialLoad.value) {
5347
- const { data } = useNuxtData(key);
2589
+ const { data } = nuxtAppCompat.getNuxtData(key, this.nuxtApp);
5348
2590
  if (data.value) {
5349
2591
  const result = data.value;
5350
2592
  this.pageData.value = result.rows;
@@ -5354,9 +2596,9 @@ class CTreeServerDataProvider extends ADataProvider {
5354
2596
  return;
5355
2597
  }
5356
2598
  }
5357
- if (this.SSR.value && this.contextKey.value) {
2599
+ if (this.SSR.value && this.contextKey.value && !options?.disableCache && (undefined || this.initialLoad.value)) {
5358
2600
  this.loading.value = true;
5359
- const { data } = await useAsyncData(key, fetcher);
2601
+ const { data } = await nuxtAppCompat.getAsyncData(key, fetcher, this.nuxtApp);
5360
2602
  if (data.value) {
5361
2603
  const result = data.value;
5362
2604
  this.pageData.value = result.rows;
@@ -5367,7 +2609,7 @@ class CTreeServerDataProvider extends ADataProvider {
5367
2609
  }
5368
2610
  }
5369
2611
  if (!this.SSR.value) {
5370
- onNuxtReady(() => {
2612
+ nuxtAppCompat.onNuxtReadyCallback(() => {
5371
2613
  this.loading.value = true;
5372
2614
  fetcher().then((returnedData2) => {
5373
2615
  this.pageData.value = returnedData2.rows;
@@ -5388,6 +2630,9 @@ class CTreeServerDataProvider extends ADataProvider {
5388
2630
  this.initialLoad.value = false;
5389
2631
  this.loading.value = false;
5390
2632
  }
2633
+ async refresh(hardRefresh = false) {
2634
+ await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
2635
+ }
5391
2636
  // ============================================
5392
2637
  // Expand/Collapse API
5393
2638
  // ============================================
@@ -5417,17 +2662,39 @@ class CTreeServerDataProvider extends ADataProvider {
5417
2662
  }
5418
2663
 
5419
2664
  class CAPITreeServerDataProvider extends CTreeServerDataProvider {
5420
- apiUrl = ref("");
2665
+ apiUrl = vue.ref("");
5421
2666
  requestProvider = new RequestProvider();
5422
- cacheStrategy = ref(null);
5423
- cacheLifetime = ref(0);
5424
- refreshOnMutation = ref(true);
2667
+ cacheStrategy = vue.ref(null);
2668
+ cacheLifetime = vue.ref(0);
2669
+ refreshOnMutation = vue.ref(true);
5425
2670
  // Default true for server
5426
2671
  constructor(options) {
5427
2672
  super(options);
5428
2673
  if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
5429
2674
  if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
5430
2675
  if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
2676
+ this.requestProvider.onDataReceived((data) => {
2677
+ if (data) {
2678
+ this.pageData.value = data.rows || data;
2679
+ if (data.rowCount !== void 0) {
2680
+ this.rowCount.value = data.rowCount;
2681
+ }
2682
+ }
2683
+ });
2684
+ }
2685
+ async refresh(hardRefresh = false) {
2686
+ if (hardRefresh && this.requestProvider.cacheProvider) {
2687
+ await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
2688
+ }
2689
+ this.loading.value = true;
2690
+ try {
2691
+ await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
2692
+ } finally {
2693
+ this.loading.value = false;
2694
+ }
2695
+ }
2696
+ async refreshData(options) {
2697
+ await this.refresh(options?.disableCache ?? false);
5431
2698
  }
5432
2699
  async setAPIUrl(url) {
5433
2700
  this.apiUrl.value = url;
@@ -5469,7 +2736,7 @@ class CAPITreeServerDataProvider extends CTreeServerDataProvider {
5469
2736
  if (this.requestProvider.cacheProvider) {
5470
2737
  await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
5471
2738
  }
5472
- this.loadPageData({ disableCache: true });
2739
+ await this.refresh(true);
5473
2740
  }
5474
2741
  }
5475
2742
  }