@cfp-studio/plugin-vue3 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.mts +5 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.mjs +656 -0
  5. package/package.json +51 -0
  6. package/preview/index.ts +141 -0
  7. package/preview/modules/@vue/compiler-core/LICENSE +21 -0
  8. package/preview/modules/@vue/compiler-core/README.md +1 -0
  9. package/preview/modules/@vue/compiler-core/dist/compiler-core.cjs.js +6813 -0
  10. package/preview/modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
  11. package/preview/modules/@vue/compiler-core/dist/compiler-core.d.ts +1091 -0
  12. package/preview/modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +5790 -0
  13. package/preview/modules/@vue/compiler-core/index.js +7 -0
  14. package/preview/modules/@vue/compiler-core/node_modules/.bin/parser +17 -0
  15. package/preview/modules/@vue/compiler-core/package.json +58 -0
  16. package/preview/modules/@vue/compiler-sfc/LICENSE +21 -0
  17. package/preview/modules/@vue/compiler-sfc/README.md +80 -0
  18. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +24970 -0
  19. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +484 -0
  20. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +53043 -0
  21. package/preview/modules/@vue/compiler-sfc/node_modules/.bin/parser +17 -0
  22. package/preview/modules/@vue/compiler-sfc/package.json +67 -0
  23. package/preview/modules/@vue/reactivity/LICENSE +21 -0
  24. package/preview/modules/@vue/reactivity/README.md +19 -0
  25. package/preview/modules/@vue/reactivity/dist/reactivity.cjs.js +1939 -0
  26. package/preview/modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
  27. package/preview/modules/@vue/reactivity/dist/reactivity.d.ts +754 -0
  28. package/preview/modules/@vue/reactivity/dist/reactivity.esm-browser.js +1938 -0
  29. package/preview/modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js +5 -0
  30. package/preview/modules/@vue/reactivity/dist/reactivity.esm-bundler.js +1896 -0
  31. package/preview/modules/@vue/reactivity/dist/reactivity.global.js +1994 -0
  32. package/preview/modules/@vue/reactivity/dist/reactivity.global.prod.js +5 -0
  33. package/preview/modules/@vue/reactivity/index.js +7 -0
  34. package/preview/modules/@vue/reactivity/package.json +55 -0
  35. package/preview/modules/@vue/runtime-core/LICENSE +21 -0
  36. package/preview/modules/@vue/runtime-core/README.md +28 -0
  37. package/preview/modules/@vue/runtime-core/dist/runtime-core.cjs.js +8493 -0
  38. package/preview/modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
  39. package/preview/modules/@vue/runtime-core/dist/runtime-core.d.ts +1832 -0
  40. package/preview/modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +8419 -0
  41. package/preview/modules/@vue/runtime-core/index.js +7 -0
  42. package/preview/modules/@vue/runtime-core/package.json +52 -0
  43. package/preview/modules/@vue/runtime-dom/LICENSE +21 -0
  44. package/preview/modules/@vue/runtime-dom/README.md +13 -0
  45. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.cjs.js +1820 -0
  46. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
  47. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1395 -0
  48. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +12332 -0
  49. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +5 -0
  50. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1860 -0
  51. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.global.js +12383 -0
  52. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js +5 -0
  53. package/preview/modules/@vue/runtime-dom/index.js +7 -0
  54. package/preview/modules/@vue/runtime-dom/package.json +60 -0
  55. package/preview/modules/@vue/shared/LICENSE +21 -0
  56. package/preview/modules/@vue/shared/README.md +3 -0
  57. package/preview/modules/@vue/shared/dist/shared.cjs.js +594 -0
  58. package/preview/modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
  59. package/preview/modules/@vue/shared/dist/shared.d.ts +328 -0
  60. package/preview/modules/@vue/shared/dist/shared.esm-bundler.js +519 -0
  61. package/preview/modules/@vue/shared/index.js +7 -0
  62. package/preview/modules/@vue/shared/package.json +47 -0
  63. package/preview/modules/vue/LICENSE +21 -0
  64. package/preview/modules/vue/README.md +62 -0
  65. package/preview/modules/vue/compiler-sfc/index.browser.js +1 -0
  66. package/preview/modules/vue/compiler-sfc/index.browser.mjs +1 -0
  67. package/preview/modules/vue/compiler-sfc/index.d.mts +1 -0
  68. package/preview/modules/vue/compiler-sfc/index.d.ts +1 -0
  69. package/preview/modules/vue/compiler-sfc/index.js +3 -0
  70. package/preview/modules/vue/compiler-sfc/index.mjs +3 -0
  71. package/preview/modules/vue/compiler-sfc/package.json +4 -0
  72. package/preview/modules/vue/compiler-sfc/register-ts.js +3 -0
  73. package/preview/modules/vue/dist/vue.cjs.js +80 -0
  74. package/preview/modules/vue/dist/vue.cjs.prod.js +66 -0
  75. package/preview/modules/vue/dist/vue.d.mts +7 -0
  76. package/preview/modules/vue/dist/vue.d.ts +7 -0
  77. package/preview/modules/vue/dist/vue.esm-browser.js +18216 -0
  78. package/preview/modules/vue/dist/vue.esm-browser.prod.js +9 -0
  79. package/preview/modules/vue/dist/vue.esm-bundler.js +71 -0
  80. package/preview/modules/vue/dist/vue.global.js +18096 -0
  81. package/preview/modules/vue/dist/vue.global.prod.js +9 -0
  82. package/preview/modules/vue/dist/vue.runtime.esm-browser.js +12355 -0
  83. package/preview/modules/vue/dist/vue.runtime.esm-browser.prod.js +5 -0
  84. package/preview/modules/vue/dist/vue.runtime.esm-bundler.js +26 -0
  85. package/preview/modules/vue/dist/vue.runtime.global.js +12407 -0
  86. package/preview/modules/vue/dist/vue.runtime.global.prod.js +5 -0
  87. package/preview/modules/vue/index.js +7 -0
  88. package/preview/modules/vue/index.mjs +1 -0
  89. package/preview/modules/vue/jsx-runtime/index.d.ts +25 -0
  90. package/preview/modules/vue/jsx-runtime/index.js +15 -0
  91. package/preview/modules/vue/jsx-runtime/index.mjs +12 -0
  92. package/preview/modules/vue/jsx-runtime/package.json +5 -0
  93. package/preview/modules/vue/jsx.d.ts +22 -0
  94. package/preview/modules/vue/node_modules/.bin/tsc +17 -0
  95. package/preview/modules/vue/node_modules/.bin/tsserver +17 -0
  96. package/preview/modules/vue/package.json +112 -0
  97. package/preview/modules/vue/server-renderer/index.d.mts +1 -0
  98. package/preview/modules/vue/server-renderer/index.d.ts +1 -0
  99. package/preview/modules/vue/server-renderer/index.js +1 -0
  100. package/preview/modules/vue/server-renderer/index.mjs +1 -0
  101. package/preview/modules/vue/server-renderer/package.json +4 -0
  102. package/preview/tsconfig.json +8 -0
@@ -0,0 +1,1994 @@
1
+ /**
2
+ * @vue/reactivity v3.5.13
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
6
+ var VueReactivity = (function (exports) {
7
+ 'use strict';
8
+
9
+ /*! #__NO_SIDE_EFFECTS__ */
10
+ // @__NO_SIDE_EFFECTS__
11
+ function makeMap(str) {
12
+ const map = /* @__PURE__ */ Object.create(null);
13
+ for (const key of str.split(",")) map[key] = 1;
14
+ return (val) => val in map;
15
+ }
16
+
17
+ const EMPTY_OBJ = Object.freeze({}) ;
18
+ const NOOP = () => {
19
+ };
20
+ const extend = Object.assign;
21
+ const remove = (arr, el) => {
22
+ const i = arr.indexOf(el);
23
+ if (i > -1) {
24
+ arr.splice(i, 1);
25
+ }
26
+ };
27
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
28
+ const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
29
+ const isArray = Array.isArray;
30
+ const isMap = (val) => toTypeString(val) === "[object Map]";
31
+ const isSet = (val) => toTypeString(val) === "[object Set]";
32
+ const isFunction = (val) => typeof val === "function";
33
+ const isString = (val) => typeof val === "string";
34
+ const isSymbol = (val) => typeof val === "symbol";
35
+ const isObject = (val) => val !== null && typeof val === "object";
36
+ const objectToString = Object.prototype.toString;
37
+ const toTypeString = (value) => objectToString.call(value);
38
+ const toRawType = (value) => {
39
+ return toTypeString(value).slice(8, -1);
40
+ };
41
+ const isPlainObject = (val) => toTypeString(val) === "[object Object]";
42
+ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
43
+ const cacheStringFunction = (fn) => {
44
+ const cache = /* @__PURE__ */ Object.create(null);
45
+ return (str) => {
46
+ const hit = cache[str];
47
+ return hit || (cache[str] = fn(str));
48
+ };
49
+ };
50
+ const capitalize = cacheStringFunction((str) => {
51
+ return str.charAt(0).toUpperCase() + str.slice(1);
52
+ });
53
+ const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
54
+ const def = (obj, key, value, writable = false) => {
55
+ Object.defineProperty(obj, key, {
56
+ configurable: true,
57
+ enumerable: false,
58
+ writable,
59
+ value
60
+ });
61
+ };
62
+
63
+ function warn(msg, ...args) {
64
+ console.warn(`[Vue warn] ${msg}`, ...args);
65
+ }
66
+
67
+ let activeEffectScope;
68
+ class EffectScope {
69
+ constructor(detached = false) {
70
+ this.detached = detached;
71
+ /**
72
+ * @internal
73
+ */
74
+ this._active = true;
75
+ /**
76
+ * @internal
77
+ */
78
+ this.effects = [];
79
+ /**
80
+ * @internal
81
+ */
82
+ this.cleanups = [];
83
+ this._isPaused = false;
84
+ this.parent = activeEffectScope;
85
+ if (!detached && activeEffectScope) {
86
+ this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
87
+ this
88
+ ) - 1;
89
+ }
90
+ }
91
+ get active() {
92
+ return this._active;
93
+ }
94
+ pause() {
95
+ if (this._active) {
96
+ this._isPaused = true;
97
+ let i, l;
98
+ if (this.scopes) {
99
+ for (i = 0, l = this.scopes.length; i < l; i++) {
100
+ this.scopes[i].pause();
101
+ }
102
+ }
103
+ for (i = 0, l = this.effects.length; i < l; i++) {
104
+ this.effects[i].pause();
105
+ }
106
+ }
107
+ }
108
+ /**
109
+ * Resumes the effect scope, including all child scopes and effects.
110
+ */
111
+ resume() {
112
+ if (this._active) {
113
+ if (this._isPaused) {
114
+ this._isPaused = false;
115
+ let i, l;
116
+ if (this.scopes) {
117
+ for (i = 0, l = this.scopes.length; i < l; i++) {
118
+ this.scopes[i].resume();
119
+ }
120
+ }
121
+ for (i = 0, l = this.effects.length; i < l; i++) {
122
+ this.effects[i].resume();
123
+ }
124
+ }
125
+ }
126
+ }
127
+ run(fn) {
128
+ if (this._active) {
129
+ const currentEffectScope = activeEffectScope;
130
+ try {
131
+ activeEffectScope = this;
132
+ return fn();
133
+ } finally {
134
+ activeEffectScope = currentEffectScope;
135
+ }
136
+ } else {
137
+ warn(`cannot run an inactive effect scope.`);
138
+ }
139
+ }
140
+ /**
141
+ * This should only be called on non-detached scopes
142
+ * @internal
143
+ */
144
+ on() {
145
+ activeEffectScope = this;
146
+ }
147
+ /**
148
+ * This should only be called on non-detached scopes
149
+ * @internal
150
+ */
151
+ off() {
152
+ activeEffectScope = this.parent;
153
+ }
154
+ stop(fromParent) {
155
+ if (this._active) {
156
+ this._active = false;
157
+ let i, l;
158
+ for (i = 0, l = this.effects.length; i < l; i++) {
159
+ this.effects[i].stop();
160
+ }
161
+ this.effects.length = 0;
162
+ for (i = 0, l = this.cleanups.length; i < l; i++) {
163
+ this.cleanups[i]();
164
+ }
165
+ this.cleanups.length = 0;
166
+ if (this.scopes) {
167
+ for (i = 0, l = this.scopes.length; i < l; i++) {
168
+ this.scopes[i].stop(true);
169
+ }
170
+ this.scopes.length = 0;
171
+ }
172
+ if (!this.detached && this.parent && !fromParent) {
173
+ const last = this.parent.scopes.pop();
174
+ if (last && last !== this) {
175
+ this.parent.scopes[this.index] = last;
176
+ last.index = this.index;
177
+ }
178
+ }
179
+ this.parent = void 0;
180
+ }
181
+ }
182
+ }
183
+ function effectScope(detached) {
184
+ return new EffectScope(detached);
185
+ }
186
+ function getCurrentScope() {
187
+ return activeEffectScope;
188
+ }
189
+ function onScopeDispose(fn, failSilently = false) {
190
+ if (activeEffectScope) {
191
+ activeEffectScope.cleanups.push(fn);
192
+ } else if (!failSilently) {
193
+ warn(
194
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
195
+ );
196
+ }
197
+ }
198
+
199
+ let activeSub;
200
+ const EffectFlags = {
201
+ "ACTIVE": 1,
202
+ "1": "ACTIVE",
203
+ "RUNNING": 2,
204
+ "2": "RUNNING",
205
+ "TRACKING": 4,
206
+ "4": "TRACKING",
207
+ "NOTIFIED": 8,
208
+ "8": "NOTIFIED",
209
+ "DIRTY": 16,
210
+ "16": "DIRTY",
211
+ "ALLOW_RECURSE": 32,
212
+ "32": "ALLOW_RECURSE",
213
+ "PAUSED": 64,
214
+ "64": "PAUSED"
215
+ };
216
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
217
+ class ReactiveEffect {
218
+ constructor(fn) {
219
+ this.fn = fn;
220
+ /**
221
+ * @internal
222
+ */
223
+ this.deps = void 0;
224
+ /**
225
+ * @internal
226
+ */
227
+ this.depsTail = void 0;
228
+ /**
229
+ * @internal
230
+ */
231
+ this.flags = 1 | 4;
232
+ /**
233
+ * @internal
234
+ */
235
+ this.next = void 0;
236
+ /**
237
+ * @internal
238
+ */
239
+ this.cleanup = void 0;
240
+ this.scheduler = void 0;
241
+ if (activeEffectScope && activeEffectScope.active) {
242
+ activeEffectScope.effects.push(this);
243
+ }
244
+ }
245
+ pause() {
246
+ this.flags |= 64;
247
+ }
248
+ resume() {
249
+ if (this.flags & 64) {
250
+ this.flags &= ~64;
251
+ if (pausedQueueEffects.has(this)) {
252
+ pausedQueueEffects.delete(this);
253
+ this.trigger();
254
+ }
255
+ }
256
+ }
257
+ /**
258
+ * @internal
259
+ */
260
+ notify() {
261
+ if (this.flags & 2 && !(this.flags & 32)) {
262
+ return;
263
+ }
264
+ if (!(this.flags & 8)) {
265
+ batch(this);
266
+ }
267
+ }
268
+ run() {
269
+ if (!(this.flags & 1)) {
270
+ return this.fn();
271
+ }
272
+ this.flags |= 2;
273
+ cleanupEffect(this);
274
+ prepareDeps(this);
275
+ const prevEffect = activeSub;
276
+ const prevShouldTrack = shouldTrack;
277
+ activeSub = this;
278
+ shouldTrack = true;
279
+ try {
280
+ return this.fn();
281
+ } finally {
282
+ if (activeSub !== this) {
283
+ warn(
284
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
285
+ );
286
+ }
287
+ cleanupDeps(this);
288
+ activeSub = prevEffect;
289
+ shouldTrack = prevShouldTrack;
290
+ this.flags &= ~2;
291
+ }
292
+ }
293
+ stop() {
294
+ if (this.flags & 1) {
295
+ for (let link = this.deps; link; link = link.nextDep) {
296
+ removeSub(link);
297
+ }
298
+ this.deps = this.depsTail = void 0;
299
+ cleanupEffect(this);
300
+ this.onStop && this.onStop();
301
+ this.flags &= ~1;
302
+ }
303
+ }
304
+ trigger() {
305
+ if (this.flags & 64) {
306
+ pausedQueueEffects.add(this);
307
+ } else if (this.scheduler) {
308
+ this.scheduler();
309
+ } else {
310
+ this.runIfDirty();
311
+ }
312
+ }
313
+ /**
314
+ * @internal
315
+ */
316
+ runIfDirty() {
317
+ if (isDirty(this)) {
318
+ this.run();
319
+ }
320
+ }
321
+ get dirty() {
322
+ return isDirty(this);
323
+ }
324
+ }
325
+ let batchDepth = 0;
326
+ let batchedSub;
327
+ let batchedComputed;
328
+ function batch(sub, isComputed = false) {
329
+ sub.flags |= 8;
330
+ if (isComputed) {
331
+ sub.next = batchedComputed;
332
+ batchedComputed = sub;
333
+ return;
334
+ }
335
+ sub.next = batchedSub;
336
+ batchedSub = sub;
337
+ }
338
+ function startBatch() {
339
+ batchDepth++;
340
+ }
341
+ function endBatch() {
342
+ if (--batchDepth > 0) {
343
+ return;
344
+ }
345
+ if (batchedComputed) {
346
+ let e = batchedComputed;
347
+ batchedComputed = void 0;
348
+ while (e) {
349
+ const next = e.next;
350
+ e.next = void 0;
351
+ e.flags &= ~8;
352
+ e = next;
353
+ }
354
+ }
355
+ let error;
356
+ while (batchedSub) {
357
+ let e = batchedSub;
358
+ batchedSub = void 0;
359
+ while (e) {
360
+ const next = e.next;
361
+ e.next = void 0;
362
+ e.flags &= ~8;
363
+ if (e.flags & 1) {
364
+ try {
365
+ ;
366
+ e.trigger();
367
+ } catch (err) {
368
+ if (!error) error = err;
369
+ }
370
+ }
371
+ e = next;
372
+ }
373
+ }
374
+ if (error) throw error;
375
+ }
376
+ function prepareDeps(sub) {
377
+ for (let link = sub.deps; link; link = link.nextDep) {
378
+ link.version = -1;
379
+ link.prevActiveLink = link.dep.activeLink;
380
+ link.dep.activeLink = link;
381
+ }
382
+ }
383
+ function cleanupDeps(sub) {
384
+ let head;
385
+ let tail = sub.depsTail;
386
+ let link = tail;
387
+ while (link) {
388
+ const prev = link.prevDep;
389
+ if (link.version === -1) {
390
+ if (link === tail) tail = prev;
391
+ removeSub(link);
392
+ removeDep(link);
393
+ } else {
394
+ head = link;
395
+ }
396
+ link.dep.activeLink = link.prevActiveLink;
397
+ link.prevActiveLink = void 0;
398
+ link = prev;
399
+ }
400
+ sub.deps = head;
401
+ sub.depsTail = tail;
402
+ }
403
+ function isDirty(sub) {
404
+ for (let link = sub.deps; link; link = link.nextDep) {
405
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
406
+ return true;
407
+ }
408
+ }
409
+ if (sub._dirty) {
410
+ return true;
411
+ }
412
+ return false;
413
+ }
414
+ function refreshComputed(computed) {
415
+ if (computed.flags & 4 && !(computed.flags & 16)) {
416
+ return;
417
+ }
418
+ computed.flags &= ~16;
419
+ if (computed.globalVersion === globalVersion) {
420
+ return;
421
+ }
422
+ computed.globalVersion = globalVersion;
423
+ const dep = computed.dep;
424
+ computed.flags |= 2;
425
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
426
+ computed.flags &= ~2;
427
+ return;
428
+ }
429
+ const prevSub = activeSub;
430
+ const prevShouldTrack = shouldTrack;
431
+ activeSub = computed;
432
+ shouldTrack = true;
433
+ try {
434
+ prepareDeps(computed);
435
+ const value = computed.fn(computed._value);
436
+ if (dep.version === 0 || hasChanged(value, computed._value)) {
437
+ computed._value = value;
438
+ dep.version++;
439
+ }
440
+ } catch (err) {
441
+ dep.version++;
442
+ throw err;
443
+ } finally {
444
+ activeSub = prevSub;
445
+ shouldTrack = prevShouldTrack;
446
+ cleanupDeps(computed);
447
+ computed.flags &= ~2;
448
+ }
449
+ }
450
+ function removeSub(link, soft = false) {
451
+ const { dep, prevSub, nextSub } = link;
452
+ if (prevSub) {
453
+ prevSub.nextSub = nextSub;
454
+ link.prevSub = void 0;
455
+ }
456
+ if (nextSub) {
457
+ nextSub.prevSub = prevSub;
458
+ link.nextSub = void 0;
459
+ }
460
+ if (dep.subsHead === link) {
461
+ dep.subsHead = nextSub;
462
+ }
463
+ if (dep.subs === link) {
464
+ dep.subs = prevSub;
465
+ if (!prevSub && dep.computed) {
466
+ dep.computed.flags &= ~4;
467
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
468
+ removeSub(l, true);
469
+ }
470
+ }
471
+ }
472
+ if (!soft && !--dep.sc && dep.map) {
473
+ dep.map.delete(dep.key);
474
+ }
475
+ }
476
+ function removeDep(link) {
477
+ const { prevDep, nextDep } = link;
478
+ if (prevDep) {
479
+ prevDep.nextDep = nextDep;
480
+ link.prevDep = void 0;
481
+ }
482
+ if (nextDep) {
483
+ nextDep.prevDep = prevDep;
484
+ link.nextDep = void 0;
485
+ }
486
+ }
487
+ function effect(fn, options) {
488
+ if (fn.effect instanceof ReactiveEffect) {
489
+ fn = fn.effect.fn;
490
+ }
491
+ const e = new ReactiveEffect(fn);
492
+ if (options) {
493
+ extend(e, options);
494
+ }
495
+ try {
496
+ e.run();
497
+ } catch (err) {
498
+ e.stop();
499
+ throw err;
500
+ }
501
+ const runner = e.run.bind(e);
502
+ runner.effect = e;
503
+ return runner;
504
+ }
505
+ function stop(runner) {
506
+ runner.effect.stop();
507
+ }
508
+ let shouldTrack = true;
509
+ const trackStack = [];
510
+ function pauseTracking() {
511
+ trackStack.push(shouldTrack);
512
+ shouldTrack = false;
513
+ }
514
+ function enableTracking() {
515
+ trackStack.push(shouldTrack);
516
+ shouldTrack = true;
517
+ }
518
+ function resetTracking() {
519
+ const last = trackStack.pop();
520
+ shouldTrack = last === void 0 ? true : last;
521
+ }
522
+ function onEffectCleanup(fn, failSilently = false) {
523
+ if (activeSub instanceof ReactiveEffect) {
524
+ activeSub.cleanup = fn;
525
+ } else if (!failSilently) {
526
+ warn(
527
+ `onEffectCleanup() was called when there was no active effect to associate with.`
528
+ );
529
+ }
530
+ }
531
+ function cleanupEffect(e) {
532
+ const { cleanup } = e;
533
+ e.cleanup = void 0;
534
+ if (cleanup) {
535
+ const prevSub = activeSub;
536
+ activeSub = void 0;
537
+ try {
538
+ cleanup();
539
+ } finally {
540
+ activeSub = prevSub;
541
+ }
542
+ }
543
+ }
544
+
545
+ let globalVersion = 0;
546
+ class Link {
547
+ constructor(sub, dep) {
548
+ this.sub = sub;
549
+ this.dep = dep;
550
+ this.version = dep.version;
551
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
552
+ }
553
+ }
554
+ class Dep {
555
+ constructor(computed) {
556
+ this.computed = computed;
557
+ this.version = 0;
558
+ /**
559
+ * Link between this dep and the current active effect
560
+ */
561
+ this.activeLink = void 0;
562
+ /**
563
+ * Doubly linked list representing the subscribing effects (tail)
564
+ */
565
+ this.subs = void 0;
566
+ /**
567
+ * For object property deps cleanup
568
+ */
569
+ this.map = void 0;
570
+ this.key = void 0;
571
+ /**
572
+ * Subscriber counter
573
+ */
574
+ this.sc = 0;
575
+ {
576
+ this.subsHead = void 0;
577
+ }
578
+ }
579
+ track(debugInfo) {
580
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
581
+ return;
582
+ }
583
+ let link = this.activeLink;
584
+ if (link === void 0 || link.sub !== activeSub) {
585
+ link = this.activeLink = new Link(activeSub, this);
586
+ if (!activeSub.deps) {
587
+ activeSub.deps = activeSub.depsTail = link;
588
+ } else {
589
+ link.prevDep = activeSub.depsTail;
590
+ activeSub.depsTail.nextDep = link;
591
+ activeSub.depsTail = link;
592
+ }
593
+ addSub(link);
594
+ } else if (link.version === -1) {
595
+ link.version = this.version;
596
+ if (link.nextDep) {
597
+ const next = link.nextDep;
598
+ next.prevDep = link.prevDep;
599
+ if (link.prevDep) {
600
+ link.prevDep.nextDep = next;
601
+ }
602
+ link.prevDep = activeSub.depsTail;
603
+ link.nextDep = void 0;
604
+ activeSub.depsTail.nextDep = link;
605
+ activeSub.depsTail = link;
606
+ if (activeSub.deps === link) {
607
+ activeSub.deps = next;
608
+ }
609
+ }
610
+ }
611
+ if (activeSub.onTrack) {
612
+ activeSub.onTrack(
613
+ extend(
614
+ {
615
+ effect: activeSub
616
+ },
617
+ debugInfo
618
+ )
619
+ );
620
+ }
621
+ return link;
622
+ }
623
+ trigger(debugInfo) {
624
+ this.version++;
625
+ globalVersion++;
626
+ this.notify(debugInfo);
627
+ }
628
+ notify(debugInfo) {
629
+ startBatch();
630
+ try {
631
+ if (true) {
632
+ for (let head = this.subsHead; head; head = head.nextSub) {
633
+ if (head.sub.onTrigger && !(head.sub.flags & 8)) {
634
+ head.sub.onTrigger(
635
+ extend(
636
+ {
637
+ effect: head.sub
638
+ },
639
+ debugInfo
640
+ )
641
+ );
642
+ }
643
+ }
644
+ }
645
+ for (let link = this.subs; link; link = link.prevSub) {
646
+ if (link.sub.notify()) {
647
+ ;
648
+ link.sub.dep.notify();
649
+ }
650
+ }
651
+ } finally {
652
+ endBatch();
653
+ }
654
+ }
655
+ }
656
+ function addSub(link) {
657
+ link.dep.sc++;
658
+ if (link.sub.flags & 4) {
659
+ const computed = link.dep.computed;
660
+ if (computed && !link.dep.subs) {
661
+ computed.flags |= 4 | 16;
662
+ for (let l = computed.deps; l; l = l.nextDep) {
663
+ addSub(l);
664
+ }
665
+ }
666
+ const currentTail = link.dep.subs;
667
+ if (currentTail !== link) {
668
+ link.prevSub = currentTail;
669
+ if (currentTail) currentTail.nextSub = link;
670
+ }
671
+ if (link.dep.subsHead === void 0) {
672
+ link.dep.subsHead = link;
673
+ }
674
+ link.dep.subs = link;
675
+ }
676
+ }
677
+ const targetMap = /* @__PURE__ */ new WeakMap();
678
+ const ITERATE_KEY = Symbol(
679
+ "Object iterate"
680
+ );
681
+ const MAP_KEY_ITERATE_KEY = Symbol(
682
+ "Map keys iterate"
683
+ );
684
+ const ARRAY_ITERATE_KEY = Symbol(
685
+ "Array iterate"
686
+ );
687
+ function track(target, type, key) {
688
+ if (shouldTrack && activeSub) {
689
+ let depsMap = targetMap.get(target);
690
+ if (!depsMap) {
691
+ targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
692
+ }
693
+ let dep = depsMap.get(key);
694
+ if (!dep) {
695
+ depsMap.set(key, dep = new Dep());
696
+ dep.map = depsMap;
697
+ dep.key = key;
698
+ }
699
+ {
700
+ dep.track({
701
+ target,
702
+ type,
703
+ key
704
+ });
705
+ }
706
+ }
707
+ }
708
+ function trigger(target, type, key, newValue, oldValue, oldTarget) {
709
+ const depsMap = targetMap.get(target);
710
+ if (!depsMap) {
711
+ globalVersion++;
712
+ return;
713
+ }
714
+ const run = (dep) => {
715
+ if (dep) {
716
+ {
717
+ dep.trigger({
718
+ target,
719
+ type,
720
+ key,
721
+ newValue,
722
+ oldValue,
723
+ oldTarget
724
+ });
725
+ }
726
+ }
727
+ };
728
+ startBatch();
729
+ if (type === "clear") {
730
+ depsMap.forEach(run);
731
+ } else {
732
+ const targetIsArray = isArray(target);
733
+ const isArrayIndex = targetIsArray && isIntegerKey(key);
734
+ if (targetIsArray && key === "length") {
735
+ const newLength = Number(newValue);
736
+ depsMap.forEach((dep, key2) => {
737
+ if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
738
+ run(dep);
739
+ }
740
+ });
741
+ } else {
742
+ if (key !== void 0 || depsMap.has(void 0)) {
743
+ run(depsMap.get(key));
744
+ }
745
+ if (isArrayIndex) {
746
+ run(depsMap.get(ARRAY_ITERATE_KEY));
747
+ }
748
+ switch (type) {
749
+ case "add":
750
+ if (!targetIsArray) {
751
+ run(depsMap.get(ITERATE_KEY));
752
+ if (isMap(target)) {
753
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
754
+ }
755
+ } else if (isArrayIndex) {
756
+ run(depsMap.get("length"));
757
+ }
758
+ break;
759
+ case "delete":
760
+ if (!targetIsArray) {
761
+ run(depsMap.get(ITERATE_KEY));
762
+ if (isMap(target)) {
763
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
764
+ }
765
+ }
766
+ break;
767
+ case "set":
768
+ if (isMap(target)) {
769
+ run(depsMap.get(ITERATE_KEY));
770
+ }
771
+ break;
772
+ }
773
+ }
774
+ }
775
+ endBatch();
776
+ }
777
+ function getDepFromReactive(object, key) {
778
+ const depMap = targetMap.get(object);
779
+ return depMap && depMap.get(key);
780
+ }
781
+
782
+ function reactiveReadArray(array) {
783
+ const raw = toRaw(array);
784
+ if (raw === array) return raw;
785
+ track(raw, "iterate", ARRAY_ITERATE_KEY);
786
+ return isShallow(array) ? raw : raw.map(toReactive);
787
+ }
788
+ function shallowReadArray(arr) {
789
+ track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
790
+ return arr;
791
+ }
792
+ const arrayInstrumentations = {
793
+ __proto__: null,
794
+ [Symbol.iterator]() {
795
+ return iterator(this, Symbol.iterator, toReactive);
796
+ },
797
+ concat(...args) {
798
+ return reactiveReadArray(this).concat(
799
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
800
+ );
801
+ },
802
+ entries() {
803
+ return iterator(this, "entries", (value) => {
804
+ value[1] = toReactive(value[1]);
805
+ return value;
806
+ });
807
+ },
808
+ every(fn, thisArg) {
809
+ return apply(this, "every", fn, thisArg, void 0, arguments);
810
+ },
811
+ filter(fn, thisArg) {
812
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
813
+ },
814
+ find(fn, thisArg) {
815
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
816
+ },
817
+ findIndex(fn, thisArg) {
818
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
819
+ },
820
+ findLast(fn, thisArg) {
821
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
822
+ },
823
+ findLastIndex(fn, thisArg) {
824
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
825
+ },
826
+ // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
827
+ forEach(fn, thisArg) {
828
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
829
+ },
830
+ includes(...args) {
831
+ return searchProxy(this, "includes", args);
832
+ },
833
+ indexOf(...args) {
834
+ return searchProxy(this, "indexOf", args);
835
+ },
836
+ join(separator) {
837
+ return reactiveReadArray(this).join(separator);
838
+ },
839
+ // keys() iterator only reads `length`, no optimisation required
840
+ lastIndexOf(...args) {
841
+ return searchProxy(this, "lastIndexOf", args);
842
+ },
843
+ map(fn, thisArg) {
844
+ return apply(this, "map", fn, thisArg, void 0, arguments);
845
+ },
846
+ pop() {
847
+ return noTracking(this, "pop");
848
+ },
849
+ push(...args) {
850
+ return noTracking(this, "push", args);
851
+ },
852
+ reduce(fn, ...args) {
853
+ return reduce(this, "reduce", fn, args);
854
+ },
855
+ reduceRight(fn, ...args) {
856
+ return reduce(this, "reduceRight", fn, args);
857
+ },
858
+ shift() {
859
+ return noTracking(this, "shift");
860
+ },
861
+ // slice could use ARRAY_ITERATE but also seems to beg for range tracking
862
+ some(fn, thisArg) {
863
+ return apply(this, "some", fn, thisArg, void 0, arguments);
864
+ },
865
+ splice(...args) {
866
+ return noTracking(this, "splice", args);
867
+ },
868
+ toReversed() {
869
+ return reactiveReadArray(this).toReversed();
870
+ },
871
+ toSorted(comparer) {
872
+ return reactiveReadArray(this).toSorted(comparer);
873
+ },
874
+ toSpliced(...args) {
875
+ return reactiveReadArray(this).toSpliced(...args);
876
+ },
877
+ unshift(...args) {
878
+ return noTracking(this, "unshift", args);
879
+ },
880
+ values() {
881
+ return iterator(this, "values", toReactive);
882
+ }
883
+ };
884
+ function iterator(self, method, wrapValue) {
885
+ const arr = shallowReadArray(self);
886
+ const iter = arr[method]();
887
+ if (arr !== self && !isShallow(self)) {
888
+ iter._next = iter.next;
889
+ iter.next = () => {
890
+ const result = iter._next();
891
+ if (result.value) {
892
+ result.value = wrapValue(result.value);
893
+ }
894
+ return result;
895
+ };
896
+ }
897
+ return iter;
898
+ }
899
+ const arrayProto = Array.prototype;
900
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
901
+ const arr = shallowReadArray(self);
902
+ const needsWrap = arr !== self && !isShallow(self);
903
+ const methodFn = arr[method];
904
+ if (methodFn !== arrayProto[method]) {
905
+ const result2 = methodFn.apply(self, args);
906
+ return needsWrap ? toReactive(result2) : result2;
907
+ }
908
+ let wrappedFn = fn;
909
+ if (arr !== self) {
910
+ if (needsWrap) {
911
+ wrappedFn = function(item, index) {
912
+ return fn.call(this, toReactive(item), index, self);
913
+ };
914
+ } else if (fn.length > 2) {
915
+ wrappedFn = function(item, index) {
916
+ return fn.call(this, item, index, self);
917
+ };
918
+ }
919
+ }
920
+ const result = methodFn.call(arr, wrappedFn, thisArg);
921
+ return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
922
+ }
923
+ function reduce(self, method, fn, args) {
924
+ const arr = shallowReadArray(self);
925
+ let wrappedFn = fn;
926
+ if (arr !== self) {
927
+ if (!isShallow(self)) {
928
+ wrappedFn = function(acc, item, index) {
929
+ return fn.call(this, acc, toReactive(item), index, self);
930
+ };
931
+ } else if (fn.length > 3) {
932
+ wrappedFn = function(acc, item, index) {
933
+ return fn.call(this, acc, item, index, self);
934
+ };
935
+ }
936
+ }
937
+ return arr[method](wrappedFn, ...args);
938
+ }
939
+ function searchProxy(self, method, args) {
940
+ const arr = toRaw(self);
941
+ track(arr, "iterate", ARRAY_ITERATE_KEY);
942
+ const res = arr[method](...args);
943
+ if ((res === -1 || res === false) && isProxy(args[0])) {
944
+ args[0] = toRaw(args[0]);
945
+ return arr[method](...args);
946
+ }
947
+ return res;
948
+ }
949
+ function noTracking(self, method, args = []) {
950
+ pauseTracking();
951
+ startBatch();
952
+ const res = toRaw(self)[method].apply(self, args);
953
+ endBatch();
954
+ resetTracking();
955
+ return res;
956
+ }
957
+
958
+ const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
959
+ const builtInSymbols = new Set(
960
+ /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
961
+ );
962
+ function hasOwnProperty(key) {
963
+ if (!isSymbol(key)) key = String(key);
964
+ const obj = toRaw(this);
965
+ track(obj, "has", key);
966
+ return obj.hasOwnProperty(key);
967
+ }
968
+ class BaseReactiveHandler {
969
+ constructor(_isReadonly = false, _isShallow = false) {
970
+ this._isReadonly = _isReadonly;
971
+ this._isShallow = _isShallow;
972
+ }
973
+ get(target, key, receiver) {
974
+ if (key === "__v_skip") return target["__v_skip"];
975
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
976
+ if (key === "__v_isReactive") {
977
+ return !isReadonly2;
978
+ } else if (key === "__v_isReadonly") {
979
+ return isReadonly2;
980
+ } else if (key === "__v_isShallow") {
981
+ return isShallow2;
982
+ } else if (key === "__v_raw") {
983
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
984
+ // this means the receiver is a user proxy of the reactive proxy
985
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
986
+ return target;
987
+ }
988
+ return;
989
+ }
990
+ const targetIsArray = isArray(target);
991
+ if (!isReadonly2) {
992
+ let fn;
993
+ if (targetIsArray && (fn = arrayInstrumentations[key])) {
994
+ return fn;
995
+ }
996
+ if (key === "hasOwnProperty") {
997
+ return hasOwnProperty;
998
+ }
999
+ }
1000
+ const res = Reflect.get(
1001
+ target,
1002
+ key,
1003
+ // if this is a proxy wrapping a ref, return methods using the raw ref
1004
+ // as receiver so that we don't have to call `toRaw` on the ref in all
1005
+ // its class methods
1006
+ isRef(target) ? target : receiver
1007
+ );
1008
+ if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1009
+ return res;
1010
+ }
1011
+ if (!isReadonly2) {
1012
+ track(target, "get", key);
1013
+ }
1014
+ if (isShallow2) {
1015
+ return res;
1016
+ }
1017
+ if (isRef(res)) {
1018
+ return targetIsArray && isIntegerKey(key) ? res : res.value;
1019
+ }
1020
+ if (isObject(res)) {
1021
+ return isReadonly2 ? readonly(res) : reactive(res);
1022
+ }
1023
+ return res;
1024
+ }
1025
+ }
1026
+ class MutableReactiveHandler extends BaseReactiveHandler {
1027
+ constructor(isShallow2 = false) {
1028
+ super(false, isShallow2);
1029
+ }
1030
+ set(target, key, value, receiver) {
1031
+ let oldValue = target[key];
1032
+ if (!this._isShallow) {
1033
+ const isOldValueReadonly = isReadonly(oldValue);
1034
+ if (!isShallow(value) && !isReadonly(value)) {
1035
+ oldValue = toRaw(oldValue);
1036
+ value = toRaw(value);
1037
+ }
1038
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1039
+ if (isOldValueReadonly) {
1040
+ return false;
1041
+ } else {
1042
+ oldValue.value = value;
1043
+ return true;
1044
+ }
1045
+ }
1046
+ }
1047
+ const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1048
+ const result = Reflect.set(
1049
+ target,
1050
+ key,
1051
+ value,
1052
+ isRef(target) ? target : receiver
1053
+ );
1054
+ if (target === toRaw(receiver)) {
1055
+ if (!hadKey) {
1056
+ trigger(target, "add", key, value);
1057
+ } else if (hasChanged(value, oldValue)) {
1058
+ trigger(target, "set", key, value, oldValue);
1059
+ }
1060
+ }
1061
+ return result;
1062
+ }
1063
+ deleteProperty(target, key) {
1064
+ const hadKey = hasOwn(target, key);
1065
+ const oldValue = target[key];
1066
+ const result = Reflect.deleteProperty(target, key);
1067
+ if (result && hadKey) {
1068
+ trigger(target, "delete", key, void 0, oldValue);
1069
+ }
1070
+ return result;
1071
+ }
1072
+ has(target, key) {
1073
+ const result = Reflect.has(target, key);
1074
+ if (!isSymbol(key) || !builtInSymbols.has(key)) {
1075
+ track(target, "has", key);
1076
+ }
1077
+ return result;
1078
+ }
1079
+ ownKeys(target) {
1080
+ track(
1081
+ target,
1082
+ "iterate",
1083
+ isArray(target) ? "length" : ITERATE_KEY
1084
+ );
1085
+ return Reflect.ownKeys(target);
1086
+ }
1087
+ }
1088
+ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1089
+ constructor(isShallow2 = false) {
1090
+ super(true, isShallow2);
1091
+ }
1092
+ set(target, key) {
1093
+ {
1094
+ warn(
1095
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1096
+ target
1097
+ );
1098
+ }
1099
+ return true;
1100
+ }
1101
+ deleteProperty(target, key) {
1102
+ {
1103
+ warn(
1104
+ `Delete operation on key "${String(key)}" failed: target is readonly.`,
1105
+ target
1106
+ );
1107
+ }
1108
+ return true;
1109
+ }
1110
+ }
1111
+ const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1112
+ const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1113
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1114
+ const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1115
+
1116
+ const toShallow = (value) => value;
1117
+ const getProto = (v) => Reflect.getPrototypeOf(v);
1118
+ function createIterableMethod(method, isReadonly2, isShallow2) {
1119
+ return function(...args) {
1120
+ const target = this["__v_raw"];
1121
+ const rawTarget = toRaw(target);
1122
+ const targetIsMap = isMap(rawTarget);
1123
+ const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1124
+ const isKeyOnly = method === "keys" && targetIsMap;
1125
+ const innerIterator = target[method](...args);
1126
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
1127
+ !isReadonly2 && track(
1128
+ rawTarget,
1129
+ "iterate",
1130
+ isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1131
+ );
1132
+ return {
1133
+ // iterator protocol
1134
+ next() {
1135
+ const { value, done } = innerIterator.next();
1136
+ return done ? { value, done } : {
1137
+ value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1138
+ done
1139
+ };
1140
+ },
1141
+ // iterable protocol
1142
+ [Symbol.iterator]() {
1143
+ return this;
1144
+ }
1145
+ };
1146
+ };
1147
+ }
1148
+ function createReadonlyMethod(type) {
1149
+ return function(...args) {
1150
+ {
1151
+ const key = args[0] ? `on key "${args[0]}" ` : ``;
1152
+ warn(
1153
+ `${capitalize(type)} operation ${key}failed: target is readonly.`,
1154
+ toRaw(this)
1155
+ );
1156
+ }
1157
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1158
+ };
1159
+ }
1160
+ function createInstrumentations(readonly, shallow) {
1161
+ const instrumentations = {
1162
+ get(key) {
1163
+ const target = this["__v_raw"];
1164
+ const rawTarget = toRaw(target);
1165
+ const rawKey = toRaw(key);
1166
+ if (!readonly) {
1167
+ if (hasChanged(key, rawKey)) {
1168
+ track(rawTarget, "get", key);
1169
+ }
1170
+ track(rawTarget, "get", rawKey);
1171
+ }
1172
+ const { has } = getProto(rawTarget);
1173
+ const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1174
+ if (has.call(rawTarget, key)) {
1175
+ return wrap(target.get(key));
1176
+ } else if (has.call(rawTarget, rawKey)) {
1177
+ return wrap(target.get(rawKey));
1178
+ } else if (target !== rawTarget) {
1179
+ target.get(key);
1180
+ }
1181
+ },
1182
+ get size() {
1183
+ const target = this["__v_raw"];
1184
+ !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1185
+ return Reflect.get(target, "size", target);
1186
+ },
1187
+ has(key) {
1188
+ const target = this["__v_raw"];
1189
+ const rawTarget = toRaw(target);
1190
+ const rawKey = toRaw(key);
1191
+ if (!readonly) {
1192
+ if (hasChanged(key, rawKey)) {
1193
+ track(rawTarget, "has", key);
1194
+ }
1195
+ track(rawTarget, "has", rawKey);
1196
+ }
1197
+ return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
1198
+ },
1199
+ forEach(callback, thisArg) {
1200
+ const observed = this;
1201
+ const target = observed["__v_raw"];
1202
+ const rawTarget = toRaw(target);
1203
+ const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1204
+ !readonly && track(rawTarget, "iterate", ITERATE_KEY);
1205
+ return target.forEach((value, key) => {
1206
+ return callback.call(thisArg, wrap(value), wrap(key), observed);
1207
+ });
1208
+ }
1209
+ };
1210
+ extend(
1211
+ instrumentations,
1212
+ readonly ? {
1213
+ add: createReadonlyMethod("add"),
1214
+ set: createReadonlyMethod("set"),
1215
+ delete: createReadonlyMethod("delete"),
1216
+ clear: createReadonlyMethod("clear")
1217
+ } : {
1218
+ add(value) {
1219
+ if (!shallow && !isShallow(value) && !isReadonly(value)) {
1220
+ value = toRaw(value);
1221
+ }
1222
+ const target = toRaw(this);
1223
+ const proto = getProto(target);
1224
+ const hadKey = proto.has.call(target, value);
1225
+ if (!hadKey) {
1226
+ target.add(value);
1227
+ trigger(target, "add", value, value);
1228
+ }
1229
+ return this;
1230
+ },
1231
+ set(key, value) {
1232
+ if (!shallow && !isShallow(value) && !isReadonly(value)) {
1233
+ value = toRaw(value);
1234
+ }
1235
+ const target = toRaw(this);
1236
+ const { has, get } = getProto(target);
1237
+ let hadKey = has.call(target, key);
1238
+ if (!hadKey) {
1239
+ key = toRaw(key);
1240
+ hadKey = has.call(target, key);
1241
+ } else {
1242
+ checkIdentityKeys(target, has, key);
1243
+ }
1244
+ const oldValue = get.call(target, key);
1245
+ target.set(key, value);
1246
+ if (!hadKey) {
1247
+ trigger(target, "add", key, value);
1248
+ } else if (hasChanged(value, oldValue)) {
1249
+ trigger(target, "set", key, value, oldValue);
1250
+ }
1251
+ return this;
1252
+ },
1253
+ delete(key) {
1254
+ const target = toRaw(this);
1255
+ const { has, get } = getProto(target);
1256
+ let hadKey = has.call(target, key);
1257
+ if (!hadKey) {
1258
+ key = toRaw(key);
1259
+ hadKey = has.call(target, key);
1260
+ } else {
1261
+ checkIdentityKeys(target, has, key);
1262
+ }
1263
+ const oldValue = get ? get.call(target, key) : void 0;
1264
+ const result = target.delete(key);
1265
+ if (hadKey) {
1266
+ trigger(target, "delete", key, void 0, oldValue);
1267
+ }
1268
+ return result;
1269
+ },
1270
+ clear() {
1271
+ const target = toRaw(this);
1272
+ const hadItems = target.size !== 0;
1273
+ const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
1274
+ const result = target.clear();
1275
+ if (hadItems) {
1276
+ trigger(
1277
+ target,
1278
+ "clear",
1279
+ void 0,
1280
+ void 0,
1281
+ oldTarget
1282
+ );
1283
+ }
1284
+ return result;
1285
+ }
1286
+ }
1287
+ );
1288
+ const iteratorMethods = [
1289
+ "keys",
1290
+ "values",
1291
+ "entries",
1292
+ Symbol.iterator
1293
+ ];
1294
+ iteratorMethods.forEach((method) => {
1295
+ instrumentations[method] = createIterableMethod(method, readonly, shallow);
1296
+ });
1297
+ return instrumentations;
1298
+ }
1299
+ function createInstrumentationGetter(isReadonly2, shallow) {
1300
+ const instrumentations = createInstrumentations(isReadonly2, shallow);
1301
+ return (target, key, receiver) => {
1302
+ if (key === "__v_isReactive") {
1303
+ return !isReadonly2;
1304
+ } else if (key === "__v_isReadonly") {
1305
+ return isReadonly2;
1306
+ } else if (key === "__v_raw") {
1307
+ return target;
1308
+ }
1309
+ return Reflect.get(
1310
+ hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1311
+ key,
1312
+ receiver
1313
+ );
1314
+ };
1315
+ }
1316
+ const mutableCollectionHandlers = {
1317
+ get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1318
+ };
1319
+ const shallowCollectionHandlers = {
1320
+ get: /* @__PURE__ */ createInstrumentationGetter(false, true)
1321
+ };
1322
+ const readonlyCollectionHandlers = {
1323
+ get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1324
+ };
1325
+ const shallowReadonlyCollectionHandlers = {
1326
+ get: /* @__PURE__ */ createInstrumentationGetter(true, true)
1327
+ };
1328
+ function checkIdentityKeys(target, has, key) {
1329
+ const rawKey = toRaw(key);
1330
+ if (rawKey !== key && has.call(target, rawKey)) {
1331
+ const type = toRawType(target);
1332
+ warn(
1333
+ `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.`
1334
+ );
1335
+ }
1336
+ }
1337
+
1338
+ const reactiveMap = /* @__PURE__ */ new WeakMap();
1339
+ const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1340
+ const readonlyMap = /* @__PURE__ */ new WeakMap();
1341
+ const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1342
+ function targetTypeMap(rawType) {
1343
+ switch (rawType) {
1344
+ case "Object":
1345
+ case "Array":
1346
+ return 1 /* COMMON */;
1347
+ case "Map":
1348
+ case "Set":
1349
+ case "WeakMap":
1350
+ case "WeakSet":
1351
+ return 2 /* COLLECTION */;
1352
+ default:
1353
+ return 0 /* INVALID */;
1354
+ }
1355
+ }
1356
+ function getTargetType(value) {
1357
+ return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1358
+ }
1359
+ function reactive(target) {
1360
+ if (isReadonly(target)) {
1361
+ return target;
1362
+ }
1363
+ return createReactiveObject(
1364
+ target,
1365
+ false,
1366
+ mutableHandlers,
1367
+ mutableCollectionHandlers,
1368
+ reactiveMap
1369
+ );
1370
+ }
1371
+ function shallowReactive(target) {
1372
+ return createReactiveObject(
1373
+ target,
1374
+ false,
1375
+ shallowReactiveHandlers,
1376
+ shallowCollectionHandlers,
1377
+ shallowReactiveMap
1378
+ );
1379
+ }
1380
+ function readonly(target) {
1381
+ return createReactiveObject(
1382
+ target,
1383
+ true,
1384
+ readonlyHandlers,
1385
+ readonlyCollectionHandlers,
1386
+ readonlyMap
1387
+ );
1388
+ }
1389
+ function shallowReadonly(target) {
1390
+ return createReactiveObject(
1391
+ target,
1392
+ true,
1393
+ shallowReadonlyHandlers,
1394
+ shallowReadonlyCollectionHandlers,
1395
+ shallowReadonlyMap
1396
+ );
1397
+ }
1398
+ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1399
+ if (!isObject(target)) {
1400
+ {
1401
+ warn(
1402
+ `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
1403
+ target
1404
+ )}`
1405
+ );
1406
+ }
1407
+ return target;
1408
+ }
1409
+ if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1410
+ return target;
1411
+ }
1412
+ const existingProxy = proxyMap.get(target);
1413
+ if (existingProxy) {
1414
+ return existingProxy;
1415
+ }
1416
+ const targetType = getTargetType(target);
1417
+ if (targetType === 0 /* INVALID */) {
1418
+ return target;
1419
+ }
1420
+ const proxy = new Proxy(
1421
+ target,
1422
+ targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1423
+ );
1424
+ proxyMap.set(target, proxy);
1425
+ return proxy;
1426
+ }
1427
+ function isReactive(value) {
1428
+ if (isReadonly(value)) {
1429
+ return isReactive(value["__v_raw"]);
1430
+ }
1431
+ return !!(value && value["__v_isReactive"]);
1432
+ }
1433
+ function isReadonly(value) {
1434
+ return !!(value && value["__v_isReadonly"]);
1435
+ }
1436
+ function isShallow(value) {
1437
+ return !!(value && value["__v_isShallow"]);
1438
+ }
1439
+ function isProxy(value) {
1440
+ return value ? !!value["__v_raw"] : false;
1441
+ }
1442
+ function toRaw(observed) {
1443
+ const raw = observed && observed["__v_raw"];
1444
+ return raw ? toRaw(raw) : observed;
1445
+ }
1446
+ function markRaw(value) {
1447
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1448
+ def(value, "__v_skip", true);
1449
+ }
1450
+ return value;
1451
+ }
1452
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1453
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1454
+
1455
+ function isRef(r) {
1456
+ return r ? r["__v_isRef"] === true : false;
1457
+ }
1458
+ function ref(value) {
1459
+ return createRef(value, false);
1460
+ }
1461
+ function shallowRef(value) {
1462
+ return createRef(value, true);
1463
+ }
1464
+ function createRef(rawValue, shallow) {
1465
+ if (isRef(rawValue)) {
1466
+ return rawValue;
1467
+ }
1468
+ return new RefImpl(rawValue, shallow);
1469
+ }
1470
+ class RefImpl {
1471
+ constructor(value, isShallow2) {
1472
+ this.dep = new Dep();
1473
+ this["__v_isRef"] = true;
1474
+ this["__v_isShallow"] = false;
1475
+ this._rawValue = isShallow2 ? value : toRaw(value);
1476
+ this._value = isShallow2 ? value : toReactive(value);
1477
+ this["__v_isShallow"] = isShallow2;
1478
+ }
1479
+ get value() {
1480
+ {
1481
+ this.dep.track({
1482
+ target: this,
1483
+ type: "get",
1484
+ key: "value"
1485
+ });
1486
+ }
1487
+ return this._value;
1488
+ }
1489
+ set value(newValue) {
1490
+ const oldValue = this._rawValue;
1491
+ const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1492
+ newValue = useDirectValue ? newValue : toRaw(newValue);
1493
+ if (hasChanged(newValue, oldValue)) {
1494
+ this._rawValue = newValue;
1495
+ this._value = useDirectValue ? newValue : toReactive(newValue);
1496
+ {
1497
+ this.dep.trigger({
1498
+ target: this,
1499
+ type: "set",
1500
+ key: "value",
1501
+ newValue,
1502
+ oldValue
1503
+ });
1504
+ }
1505
+ }
1506
+ }
1507
+ }
1508
+ function triggerRef(ref2) {
1509
+ if (ref2.dep) {
1510
+ {
1511
+ ref2.dep.trigger({
1512
+ target: ref2,
1513
+ type: "set",
1514
+ key: "value",
1515
+ newValue: ref2._value
1516
+ });
1517
+ }
1518
+ }
1519
+ }
1520
+ function unref(ref2) {
1521
+ return isRef(ref2) ? ref2.value : ref2;
1522
+ }
1523
+ function toValue(source) {
1524
+ return isFunction(source) ? source() : unref(source);
1525
+ }
1526
+ const shallowUnwrapHandlers = {
1527
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1528
+ set: (target, key, value, receiver) => {
1529
+ const oldValue = target[key];
1530
+ if (isRef(oldValue) && !isRef(value)) {
1531
+ oldValue.value = value;
1532
+ return true;
1533
+ } else {
1534
+ return Reflect.set(target, key, value, receiver);
1535
+ }
1536
+ }
1537
+ };
1538
+ function proxyRefs(objectWithRefs) {
1539
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1540
+ }
1541
+ class CustomRefImpl {
1542
+ constructor(factory) {
1543
+ this["__v_isRef"] = true;
1544
+ this._value = void 0;
1545
+ const dep = this.dep = new Dep();
1546
+ const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1547
+ this._get = get;
1548
+ this._set = set;
1549
+ }
1550
+ get value() {
1551
+ return this._value = this._get();
1552
+ }
1553
+ set value(newVal) {
1554
+ this._set(newVal);
1555
+ }
1556
+ }
1557
+ function customRef(factory) {
1558
+ return new CustomRefImpl(factory);
1559
+ }
1560
+ function toRefs(object) {
1561
+ if (!isProxy(object)) {
1562
+ warn(`toRefs() expects a reactive object but received a plain one.`);
1563
+ }
1564
+ const ret = isArray(object) ? new Array(object.length) : {};
1565
+ for (const key in object) {
1566
+ ret[key] = propertyToRef(object, key);
1567
+ }
1568
+ return ret;
1569
+ }
1570
+ class ObjectRefImpl {
1571
+ constructor(_object, _key, _defaultValue) {
1572
+ this._object = _object;
1573
+ this._key = _key;
1574
+ this._defaultValue = _defaultValue;
1575
+ this["__v_isRef"] = true;
1576
+ this._value = void 0;
1577
+ }
1578
+ get value() {
1579
+ const val = this._object[this._key];
1580
+ return this._value = val === void 0 ? this._defaultValue : val;
1581
+ }
1582
+ set value(newVal) {
1583
+ this._object[this._key] = newVal;
1584
+ }
1585
+ get dep() {
1586
+ return getDepFromReactive(toRaw(this._object), this._key);
1587
+ }
1588
+ }
1589
+ class GetterRefImpl {
1590
+ constructor(_getter) {
1591
+ this._getter = _getter;
1592
+ this["__v_isRef"] = true;
1593
+ this["__v_isReadonly"] = true;
1594
+ this._value = void 0;
1595
+ }
1596
+ get value() {
1597
+ return this._value = this._getter();
1598
+ }
1599
+ }
1600
+ function toRef(source, key, defaultValue) {
1601
+ if (isRef(source)) {
1602
+ return source;
1603
+ } else if (isFunction(source)) {
1604
+ return new GetterRefImpl(source);
1605
+ } else if (isObject(source) && arguments.length > 1) {
1606
+ return propertyToRef(source, key, defaultValue);
1607
+ } else {
1608
+ return ref(source);
1609
+ }
1610
+ }
1611
+ function propertyToRef(source, key, defaultValue) {
1612
+ const val = source[key];
1613
+ return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1614
+ }
1615
+
1616
+ class ComputedRefImpl {
1617
+ constructor(fn, setter, isSSR) {
1618
+ this.fn = fn;
1619
+ this.setter = setter;
1620
+ /**
1621
+ * @internal
1622
+ */
1623
+ this._value = void 0;
1624
+ /**
1625
+ * @internal
1626
+ */
1627
+ this.dep = new Dep(this);
1628
+ /**
1629
+ * @internal
1630
+ */
1631
+ this.__v_isRef = true;
1632
+ // TODO isolatedDeclarations "__v_isReadonly"
1633
+ // A computed is also a subscriber that tracks other deps
1634
+ /**
1635
+ * @internal
1636
+ */
1637
+ this.deps = void 0;
1638
+ /**
1639
+ * @internal
1640
+ */
1641
+ this.depsTail = void 0;
1642
+ /**
1643
+ * @internal
1644
+ */
1645
+ this.flags = 16;
1646
+ /**
1647
+ * @internal
1648
+ */
1649
+ this.globalVersion = globalVersion - 1;
1650
+ /**
1651
+ * @internal
1652
+ */
1653
+ this.next = void 0;
1654
+ // for backwards compat
1655
+ this.effect = this;
1656
+ this["__v_isReadonly"] = !setter;
1657
+ this.isSSR = isSSR;
1658
+ }
1659
+ /**
1660
+ * @internal
1661
+ */
1662
+ notify() {
1663
+ this.flags |= 16;
1664
+ if (!(this.flags & 8) && // avoid infinite self recursion
1665
+ activeSub !== this) {
1666
+ batch(this, true);
1667
+ return true;
1668
+ }
1669
+ }
1670
+ get value() {
1671
+ const link = this.dep.track({
1672
+ target: this,
1673
+ type: "get",
1674
+ key: "value"
1675
+ }) ;
1676
+ refreshComputed(this);
1677
+ if (link) {
1678
+ link.version = this.dep.version;
1679
+ }
1680
+ return this._value;
1681
+ }
1682
+ set value(newValue) {
1683
+ if (this.setter) {
1684
+ this.setter(newValue);
1685
+ } else {
1686
+ warn("Write operation failed: computed value is readonly");
1687
+ }
1688
+ }
1689
+ }
1690
+ function computed(getterOrOptions, debugOptions, isSSR = false) {
1691
+ let getter;
1692
+ let setter;
1693
+ if (isFunction(getterOrOptions)) {
1694
+ getter = getterOrOptions;
1695
+ } else {
1696
+ getter = getterOrOptions.get;
1697
+ setter = getterOrOptions.set;
1698
+ }
1699
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
1700
+ if (debugOptions && !isSSR) {
1701
+ cRef.onTrack = debugOptions.onTrack;
1702
+ cRef.onTrigger = debugOptions.onTrigger;
1703
+ }
1704
+ return cRef;
1705
+ }
1706
+
1707
+ const TrackOpTypes = {
1708
+ "GET": "get",
1709
+ "HAS": "has",
1710
+ "ITERATE": "iterate"
1711
+ };
1712
+ const TriggerOpTypes = {
1713
+ "SET": "set",
1714
+ "ADD": "add",
1715
+ "DELETE": "delete",
1716
+ "CLEAR": "clear"
1717
+ };
1718
+ const ReactiveFlags = {
1719
+ "SKIP": "__v_skip",
1720
+ "IS_REACTIVE": "__v_isReactive",
1721
+ "IS_READONLY": "__v_isReadonly",
1722
+ "IS_SHALLOW": "__v_isShallow",
1723
+ "RAW": "__v_raw",
1724
+ "IS_REF": "__v_isRef"
1725
+ };
1726
+
1727
+ const WatchErrorCodes = {
1728
+ "WATCH_GETTER": 2,
1729
+ "2": "WATCH_GETTER",
1730
+ "WATCH_CALLBACK": 3,
1731
+ "3": "WATCH_CALLBACK",
1732
+ "WATCH_CLEANUP": 4,
1733
+ "4": "WATCH_CLEANUP"
1734
+ };
1735
+ const INITIAL_WATCHER_VALUE = {};
1736
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1737
+ let activeWatcher = void 0;
1738
+ function getCurrentWatcher() {
1739
+ return activeWatcher;
1740
+ }
1741
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1742
+ if (owner) {
1743
+ let cleanups = cleanupMap.get(owner);
1744
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1745
+ cleanups.push(cleanupFn);
1746
+ } else if (!failSilently) {
1747
+ warn(
1748
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1749
+ );
1750
+ }
1751
+ }
1752
+ function watch(source, cb, options = EMPTY_OBJ) {
1753
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1754
+ const warnInvalidSource = (s) => {
1755
+ (options.onWarn || warn)(
1756
+ `Invalid watch source: `,
1757
+ s,
1758
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1759
+ );
1760
+ };
1761
+ const reactiveGetter = (source2) => {
1762
+ if (deep) return source2;
1763
+ if (isShallow(source2) || deep === false || deep === 0)
1764
+ return traverse(source2, 1);
1765
+ return traverse(source2);
1766
+ };
1767
+ let effect;
1768
+ let getter;
1769
+ let cleanup;
1770
+ let boundCleanup;
1771
+ let forceTrigger = false;
1772
+ let isMultiSource = false;
1773
+ if (isRef(source)) {
1774
+ getter = () => source.value;
1775
+ forceTrigger = isShallow(source);
1776
+ } else if (isReactive(source)) {
1777
+ getter = () => reactiveGetter(source);
1778
+ forceTrigger = true;
1779
+ } else if (isArray(source)) {
1780
+ isMultiSource = true;
1781
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1782
+ getter = () => source.map((s) => {
1783
+ if (isRef(s)) {
1784
+ return s.value;
1785
+ } else if (isReactive(s)) {
1786
+ return reactiveGetter(s);
1787
+ } else if (isFunction(s)) {
1788
+ return call ? call(s, 2) : s();
1789
+ } else {
1790
+ warnInvalidSource(s);
1791
+ }
1792
+ });
1793
+ } else if (isFunction(source)) {
1794
+ if (cb) {
1795
+ getter = call ? () => call(source, 2) : source;
1796
+ } else {
1797
+ getter = () => {
1798
+ if (cleanup) {
1799
+ pauseTracking();
1800
+ try {
1801
+ cleanup();
1802
+ } finally {
1803
+ resetTracking();
1804
+ }
1805
+ }
1806
+ const currentEffect = activeWatcher;
1807
+ activeWatcher = effect;
1808
+ try {
1809
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1810
+ } finally {
1811
+ activeWatcher = currentEffect;
1812
+ }
1813
+ };
1814
+ }
1815
+ } else {
1816
+ getter = NOOP;
1817
+ warnInvalidSource(source);
1818
+ }
1819
+ if (cb && deep) {
1820
+ const baseGetter = getter;
1821
+ const depth = deep === true ? Infinity : deep;
1822
+ getter = () => traverse(baseGetter(), depth);
1823
+ }
1824
+ const scope = getCurrentScope();
1825
+ const watchHandle = () => {
1826
+ effect.stop();
1827
+ if (scope && scope.active) {
1828
+ remove(scope.effects, effect);
1829
+ }
1830
+ };
1831
+ if (once && cb) {
1832
+ const _cb = cb;
1833
+ cb = (...args) => {
1834
+ _cb(...args);
1835
+ watchHandle();
1836
+ };
1837
+ }
1838
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1839
+ const job = (immediateFirstRun) => {
1840
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1841
+ return;
1842
+ }
1843
+ if (cb) {
1844
+ const newValue = effect.run();
1845
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1846
+ if (cleanup) {
1847
+ cleanup();
1848
+ }
1849
+ const currentWatcher = activeWatcher;
1850
+ activeWatcher = effect;
1851
+ try {
1852
+ const args = [
1853
+ newValue,
1854
+ // pass undefined as the old value when it's changed for the first time
1855
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1856
+ boundCleanup
1857
+ ];
1858
+ call ? call(cb, 3, args) : (
1859
+ // @ts-expect-error
1860
+ cb(...args)
1861
+ );
1862
+ oldValue = newValue;
1863
+ } finally {
1864
+ activeWatcher = currentWatcher;
1865
+ }
1866
+ }
1867
+ } else {
1868
+ effect.run();
1869
+ }
1870
+ };
1871
+ if (augmentJob) {
1872
+ augmentJob(job);
1873
+ }
1874
+ effect = new ReactiveEffect(getter);
1875
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1876
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1877
+ cleanup = effect.onStop = () => {
1878
+ const cleanups = cleanupMap.get(effect);
1879
+ if (cleanups) {
1880
+ if (call) {
1881
+ call(cleanups, 4);
1882
+ } else {
1883
+ for (const cleanup2 of cleanups) cleanup2();
1884
+ }
1885
+ cleanupMap.delete(effect);
1886
+ }
1887
+ };
1888
+ {
1889
+ effect.onTrack = options.onTrack;
1890
+ effect.onTrigger = options.onTrigger;
1891
+ }
1892
+ if (cb) {
1893
+ if (immediate) {
1894
+ job(true);
1895
+ } else {
1896
+ oldValue = effect.run();
1897
+ }
1898
+ } else if (scheduler) {
1899
+ scheduler(job.bind(null, true), true);
1900
+ } else {
1901
+ effect.run();
1902
+ }
1903
+ watchHandle.pause = effect.pause.bind(effect);
1904
+ watchHandle.resume = effect.resume.bind(effect);
1905
+ watchHandle.stop = watchHandle;
1906
+ return watchHandle;
1907
+ }
1908
+ function traverse(value, depth = Infinity, seen) {
1909
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1910
+ return value;
1911
+ }
1912
+ seen = seen || /* @__PURE__ */ new Set();
1913
+ if (seen.has(value)) {
1914
+ return value;
1915
+ }
1916
+ seen.add(value);
1917
+ depth--;
1918
+ if (isRef(value)) {
1919
+ traverse(value.value, depth, seen);
1920
+ } else if (isArray(value)) {
1921
+ for (let i = 0; i < value.length; i++) {
1922
+ traverse(value[i], depth, seen);
1923
+ }
1924
+ } else if (isSet(value) || isMap(value)) {
1925
+ value.forEach((v) => {
1926
+ traverse(v, depth, seen);
1927
+ });
1928
+ } else if (isPlainObject(value)) {
1929
+ for (const key in value) {
1930
+ traverse(value[key], depth, seen);
1931
+ }
1932
+ for (const key of Object.getOwnPropertySymbols(value)) {
1933
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
1934
+ traverse(value[key], depth, seen);
1935
+ }
1936
+ }
1937
+ }
1938
+ return value;
1939
+ }
1940
+
1941
+ exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
1942
+ exports.EffectFlags = EffectFlags;
1943
+ exports.EffectScope = EffectScope;
1944
+ exports.ITERATE_KEY = ITERATE_KEY;
1945
+ exports.MAP_KEY_ITERATE_KEY = MAP_KEY_ITERATE_KEY;
1946
+ exports.ReactiveEffect = ReactiveEffect;
1947
+ exports.ReactiveFlags = ReactiveFlags;
1948
+ exports.TrackOpTypes = TrackOpTypes;
1949
+ exports.TriggerOpTypes = TriggerOpTypes;
1950
+ exports.WatchErrorCodes = WatchErrorCodes;
1951
+ exports.computed = computed;
1952
+ exports.customRef = customRef;
1953
+ exports.effect = effect;
1954
+ exports.effectScope = effectScope;
1955
+ exports.enableTracking = enableTracking;
1956
+ exports.getCurrentScope = getCurrentScope;
1957
+ exports.getCurrentWatcher = getCurrentWatcher;
1958
+ exports.isProxy = isProxy;
1959
+ exports.isReactive = isReactive;
1960
+ exports.isReadonly = isReadonly;
1961
+ exports.isRef = isRef;
1962
+ exports.isShallow = isShallow;
1963
+ exports.markRaw = markRaw;
1964
+ exports.onEffectCleanup = onEffectCleanup;
1965
+ exports.onScopeDispose = onScopeDispose;
1966
+ exports.onWatcherCleanup = onWatcherCleanup;
1967
+ exports.pauseTracking = pauseTracking;
1968
+ exports.proxyRefs = proxyRefs;
1969
+ exports.reactive = reactive;
1970
+ exports.reactiveReadArray = reactiveReadArray;
1971
+ exports.readonly = readonly;
1972
+ exports.ref = ref;
1973
+ exports.resetTracking = resetTracking;
1974
+ exports.shallowReactive = shallowReactive;
1975
+ exports.shallowReadArray = shallowReadArray;
1976
+ exports.shallowReadonly = shallowReadonly;
1977
+ exports.shallowRef = shallowRef;
1978
+ exports.stop = stop;
1979
+ exports.toRaw = toRaw;
1980
+ exports.toReactive = toReactive;
1981
+ exports.toReadonly = toReadonly;
1982
+ exports.toRef = toRef;
1983
+ exports.toRefs = toRefs;
1984
+ exports.toValue = toValue;
1985
+ exports.track = track;
1986
+ exports.traverse = traverse;
1987
+ exports.trigger = trigger;
1988
+ exports.triggerRef = triggerRef;
1989
+ exports.unref = unref;
1990
+ exports.watch = watch;
1991
+
1992
+ return exports;
1993
+
1994
+ })({});