@vue/reactivity 3.5.17 → 3.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/reactivity v3.5.17
2
+ * @vue/reactivity v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -15,12 +15,6 @@ const EMPTY_OBJ = Object.freeze({}) ;
15
15
  const NOOP = () => {
16
16
  };
17
17
  const extend = Object.assign;
18
- const remove = (arr, el) => {
19
- const i = arr.indexOf(el);
20
- if (i > -1) {
21
- arr.splice(i, 1);
22
- }
23
- };
24
18
  const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
25
19
  const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
26
20
  const isArray = Array.isArray;
@@ -61,633 +55,343 @@ function warn(msg, ...args) {
61
55
  console.warn(`[Vue warn] ${msg}`, ...args);
62
56
  }
63
57
 
64
- let activeEffectScope;
65
- class EffectScope {
66
- constructor(detached = false) {
67
- this.detached = detached;
68
- /**
69
- * @internal
70
- */
71
- this._active = true;
72
- /**
73
- * @internal track `on` calls, allow `on` call multiple times
74
- */
75
- this._on = 0;
76
- /**
77
- * @internal
78
- */
79
- this.effects = [];
80
- /**
81
- * @internal
82
- */
83
- this.cleanups = [];
84
- this._isPaused = false;
85
- this.parent = activeEffectScope;
86
- if (!detached && activeEffectScope) {
87
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
88
- this
89
- ) - 1;
90
- }
58
+ var ReactiveFlags$1 = /* @__PURE__ */ ((ReactiveFlags2) => {
59
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
60
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
61
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
62
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
63
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
64
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
65
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
66
+ return ReactiveFlags2;
67
+ })(ReactiveFlags$1 || {});
68
+ const notifyBuffer = [];
69
+ let batchDepth = 0;
70
+ let activeSub = void 0;
71
+ let notifyIndex = 0;
72
+ let notifyBufferLength = 0;
73
+ function setActiveSub(sub) {
74
+ try {
75
+ return activeSub;
76
+ } finally {
77
+ activeSub = sub;
91
78
  }
92
- get active() {
93
- return this._active;
79
+ }
80
+ function startBatch() {
81
+ ++batchDepth;
82
+ }
83
+ function endBatch() {
84
+ if (!--batchDepth && notifyBufferLength) {
85
+ flush();
94
86
  }
95
- pause() {
96
- if (this._active) {
97
- this._isPaused = true;
98
- let i, l;
99
- if (this.scopes) {
100
- for (i = 0, l = this.scopes.length; i < l; i++) {
101
- this.scopes[i].pause();
102
- }
103
- }
104
- for (i = 0, l = this.effects.length; i < l; i++) {
105
- this.effects[i].pause();
106
- }
107
- }
87
+ }
88
+ function link(dep, sub) {
89
+ const prevDep = sub.depsTail;
90
+ if (prevDep !== void 0 && prevDep.dep === dep) {
91
+ return;
108
92
  }
109
- /**
110
- * Resumes the effect scope, including all child scopes and effects.
111
- */
112
- resume() {
113
- if (this._active) {
114
- if (this._isPaused) {
115
- this._isPaused = false;
116
- let i, l;
117
- if (this.scopes) {
118
- for (i = 0, l = this.scopes.length; i < l; i++) {
119
- this.scopes[i].resume();
120
- }
121
- }
122
- for (i = 0, l = this.effects.length; i < l; i++) {
123
- this.effects[i].resume();
124
- }
125
- }
93
+ let nextDep = void 0;
94
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
95
+ if (recursedCheck) {
96
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
97
+ if (nextDep !== void 0 && nextDep.dep === dep) {
98
+ sub.depsTail = nextDep;
99
+ return;
126
100
  }
127
101
  }
128
- run(fn) {
129
- if (this._active) {
130
- const currentEffectScope = activeEffectScope;
131
- try {
132
- activeEffectScope = this;
133
- return fn();
134
- } finally {
135
- activeEffectScope = currentEffectScope;
136
- }
137
- } else {
138
- warn(`cannot run an inactive effect scope.`);
139
- }
102
+ const prevSub = dep.subsTail;
103
+ const newLink = sub.depsTail = dep.subsTail = {
104
+ dep,
105
+ sub,
106
+ prevDep,
107
+ nextDep,
108
+ prevSub,
109
+ nextSub: void 0
110
+ };
111
+ if (nextDep !== void 0) {
112
+ nextDep.prevDep = newLink;
140
113
  }
141
- /**
142
- * This should only be called on non-detached scopes
143
- * @internal
144
- */
145
- on() {
146
- if (++this._on === 1) {
147
- this.prevScope = activeEffectScope;
148
- activeEffectScope = this;
149
- }
114
+ if (prevDep !== void 0) {
115
+ prevDep.nextDep = newLink;
116
+ } else {
117
+ sub.deps = newLink;
150
118
  }
151
- /**
152
- * This should only be called on non-detached scopes
153
- * @internal
154
- */
155
- off() {
156
- if (this._on > 0 && --this._on === 0) {
157
- activeEffectScope = this.prevScope;
158
- this.prevScope = void 0;
159
- }
160
- }
161
- stop(fromParent) {
162
- if (this._active) {
163
- this._active = false;
164
- let i, l;
165
- for (i = 0, l = this.effects.length; i < l; i++) {
166
- this.effects[i].stop();
167
- }
168
- this.effects.length = 0;
169
- for (i = 0, l = this.cleanups.length; i < l; i++) {
170
- this.cleanups[i]();
171
- }
172
- this.cleanups.length = 0;
173
- if (this.scopes) {
174
- for (i = 0, l = this.scopes.length; i < l; i++) {
175
- this.scopes[i].stop(true);
176
- }
177
- this.scopes.length = 0;
178
- }
179
- if (!this.detached && this.parent && !fromParent) {
180
- const last = this.parent.scopes.pop();
181
- if (last && last !== this) {
182
- this.parent.scopes[this.index] = last;
183
- last.index = this.index;
184
- }
185
- }
186
- this.parent = void 0;
187
- }
119
+ if (prevSub !== void 0) {
120
+ prevSub.nextSub = newLink;
121
+ } else {
122
+ dep.subs = newLink;
188
123
  }
189
124
  }
190
- function effectScope(detached) {
191
- return new EffectScope(detached);
192
- }
193
- function getCurrentScope() {
194
- return activeEffectScope;
195
- }
196
- function onScopeDispose(fn, failSilently = false) {
197
- if (activeEffectScope) {
198
- activeEffectScope.cleanups.push(fn);
199
- } else if (!failSilently) {
200
- warn(
201
- `onScopeDispose() is called when there is no active effect scope to be associated with.`
202
- );
125
+ function unlink(link2, sub = link2.sub) {
126
+ const dep = link2.dep;
127
+ const prevDep = link2.prevDep;
128
+ const nextDep = link2.nextDep;
129
+ const nextSub = link2.nextSub;
130
+ const prevSub = link2.prevSub;
131
+ if (nextDep !== void 0) {
132
+ nextDep.prevDep = prevDep;
133
+ } else {
134
+ sub.depsTail = prevDep;
203
135
  }
204
- }
205
-
206
- let activeSub;
207
- const EffectFlags = {
208
- "ACTIVE": 1,
209
- "1": "ACTIVE",
210
- "RUNNING": 2,
211
- "2": "RUNNING",
212
- "TRACKING": 4,
213
- "4": "TRACKING",
214
- "NOTIFIED": 8,
215
- "8": "NOTIFIED",
216
- "DIRTY": 16,
217
- "16": "DIRTY",
218
- "ALLOW_RECURSE": 32,
219
- "32": "ALLOW_RECURSE",
220
- "PAUSED": 64,
221
- "64": "PAUSED",
222
- "EVALUATED": 128,
223
- "128": "EVALUATED"
224
- };
225
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
226
- class ReactiveEffect {
227
- constructor(fn) {
228
- this.fn = fn;
229
- /**
230
- * @internal
231
- */
232
- this.deps = void 0;
233
- /**
234
- * @internal
235
- */
236
- this.depsTail = void 0;
237
- /**
238
- * @internal
239
- */
240
- this.flags = 1 | 4;
241
- /**
242
- * @internal
243
- */
244
- this.next = void 0;
245
- /**
246
- * @internal
247
- */
248
- this.cleanup = void 0;
249
- this.scheduler = void 0;
250
- if (activeEffectScope && activeEffectScope.active) {
251
- activeEffectScope.effects.push(this);
252
- }
136
+ if (prevDep !== void 0) {
137
+ prevDep.nextDep = nextDep;
138
+ } else {
139
+ sub.deps = nextDep;
253
140
  }
254
- pause() {
255
- this.flags |= 64;
141
+ if (nextSub !== void 0) {
142
+ nextSub.prevSub = prevSub;
143
+ } else {
144
+ dep.subsTail = prevSub;
256
145
  }
257
- resume() {
258
- if (this.flags & 64) {
259
- this.flags &= -65;
260
- if (pausedQueueEffects.has(this)) {
261
- pausedQueueEffects.delete(this);
262
- this.trigger();
146
+ if (prevSub !== void 0) {
147
+ prevSub.nextSub = nextSub;
148
+ } else if ((dep.subs = nextSub) === void 0) {
149
+ let toRemove = dep.deps;
150
+ if (toRemove !== void 0) {
151
+ do {
152
+ toRemove = unlink(toRemove, dep);
153
+ } while (toRemove !== void 0);
154
+ dep.flags |= 16 /* Dirty */;
155
+ }
156
+ }
157
+ return nextDep;
158
+ }
159
+ function propagate(link2) {
160
+ let next = link2.nextSub;
161
+ let stack;
162
+ top: do {
163
+ const sub = link2.sub;
164
+ let flags = sub.flags;
165
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
166
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
167
+ sub.flags = flags | 32 /* Pending */;
168
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
169
+ flags = 0 /* None */;
170
+ } else if (!(flags & 4 /* RecursedCheck */)) {
171
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
172
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
173
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
174
+ flags &= 1 /* Mutable */;
175
+ } else {
176
+ flags = 0 /* None */;
263
177
  }
264
- }
265
- }
266
- /**
267
- * @internal
268
- */
269
- notify() {
270
- if (this.flags & 2 && !(this.flags & 32)) {
271
- return;
272
- }
273
- if (!(this.flags & 8)) {
274
- batch(this);
275
- }
276
- }
277
- run() {
278
- if (!(this.flags & 1)) {
279
- return this.fn();
280
- }
281
- this.flags |= 2;
282
- cleanupEffect(this);
283
- prepareDeps(this);
284
- const prevEffect = activeSub;
285
- const prevShouldTrack = shouldTrack;
286
- activeSub = this;
287
- shouldTrack = true;
288
- try {
289
- return this.fn();
290
- } finally {
291
- if (activeSub !== this) {
292
- warn(
293
- "Active effect was not restored correctly - this is likely a Vue internal bug."
294
- );
178
+ if (flags & 2 /* Watching */) {
179
+ notifyBuffer[notifyBufferLength++] = sub;
295
180
  }
296
- cleanupDeps(this);
297
- activeSub = prevEffect;
298
- shouldTrack = prevShouldTrack;
299
- this.flags &= -3;
300
- }
301
- }
302
- stop() {
303
- if (this.flags & 1) {
304
- for (let link = this.deps; link; link = link.nextDep) {
305
- removeSub(link);
181
+ if (flags & 1 /* Mutable */) {
182
+ const subSubs = sub.subs;
183
+ if (subSubs !== void 0) {
184
+ link2 = subSubs;
185
+ if (subSubs.nextSub !== void 0) {
186
+ stack = { value: next, prev: stack };
187
+ next = link2.nextSub;
188
+ }
189
+ continue;
190
+ }
306
191
  }
307
- this.deps = this.depsTail = void 0;
308
- cleanupEffect(this);
309
- this.onStop && this.onStop();
310
- this.flags &= -2;
311
192
  }
312
- }
313
- trigger() {
314
- if (this.flags & 64) {
315
- pausedQueueEffects.add(this);
316
- } else if (this.scheduler) {
317
- this.scheduler();
318
- } else {
319
- this.runIfDirty();
193
+ if ((link2 = next) !== void 0) {
194
+ next = link2.nextSub;
195
+ continue;
320
196
  }
321
- }
322
- /**
323
- * @internal
324
- */
325
- runIfDirty() {
326
- if (isDirty(this)) {
327
- this.run();
197
+ while (stack !== void 0) {
198
+ link2 = stack.value;
199
+ stack = stack.prev;
200
+ if (link2 !== void 0) {
201
+ next = link2.nextSub;
202
+ continue top;
203
+ }
328
204
  }
329
- }
330
- get dirty() {
331
- return isDirty(this);
332
- }
205
+ break;
206
+ } while (true);
333
207
  }
334
- let batchDepth = 0;
335
- let batchedSub;
336
- let batchedComputed;
337
- function batch(sub, isComputed = false) {
338
- sub.flags |= 8;
339
- if (isComputed) {
340
- sub.next = batchedComputed;
341
- batchedComputed = sub;
342
- return;
343
- }
344
- sub.next = batchedSub;
345
- batchedSub = sub;
208
+ function startTracking(sub) {
209
+ sub.depsTail = void 0;
210
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
211
+ return setActiveSub(sub);
346
212
  }
347
- function startBatch() {
348
- batchDepth++;
349
- }
350
- function endBatch() {
351
- if (--batchDepth > 0) {
352
- return;
213
+ function endTracking(sub, prevSub) {
214
+ if (activeSub !== sub) {
215
+ warn(
216
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
217
+ );
353
218
  }
354
- if (batchedComputed) {
355
- let e = batchedComputed;
356
- batchedComputed = void 0;
357
- while (e) {
358
- const next = e.next;
359
- e.next = void 0;
360
- e.flags &= -9;
361
- e = next;
362
- }
363
- }
364
- let error;
365
- while (batchedSub) {
366
- let e = batchedSub;
367
- batchedSub = void 0;
368
- while (e) {
369
- const next = e.next;
370
- e.next = void 0;
371
- e.flags &= -9;
372
- if (e.flags & 1) {
373
- try {
374
- ;
375
- e.trigger();
376
- } catch (err) {
377
- if (!error) error = err;
219
+ activeSub = prevSub;
220
+ const depsTail = sub.depsTail;
221
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
222
+ while (toRemove !== void 0) {
223
+ toRemove = unlink(toRemove, sub);
224
+ }
225
+ sub.flags &= -5 /* RecursedCheck */;
226
+ }
227
+ function flush() {
228
+ while (notifyIndex < notifyBufferLength) {
229
+ const effect = notifyBuffer[notifyIndex];
230
+ notifyBuffer[notifyIndex++] = void 0;
231
+ effect.notify();
232
+ }
233
+ notifyIndex = 0;
234
+ notifyBufferLength = 0;
235
+ }
236
+ function checkDirty(link2, sub) {
237
+ let stack;
238
+ let checkDepth = 0;
239
+ top: do {
240
+ const dep = link2.dep;
241
+ const depFlags = dep.flags;
242
+ let dirty = false;
243
+ if (sub.flags & 16 /* Dirty */) {
244
+ dirty = true;
245
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
246
+ if (dep.update()) {
247
+ const subs = dep.subs;
248
+ if (subs.nextSub !== void 0) {
249
+ shallowPropagate(subs);
378
250
  }
251
+ dirty = true;
379
252
  }
380
- e = next;
381
- }
382
- }
383
- if (error) throw error;
384
- }
385
- function prepareDeps(sub) {
386
- for (let link = sub.deps; link; link = link.nextDep) {
387
- link.version = -1;
388
- link.prevActiveLink = link.dep.activeLink;
389
- link.dep.activeLink = link;
253
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
254
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
255
+ stack = { value: link2, prev: stack };
256
+ }
257
+ link2 = dep.deps;
258
+ sub = dep;
259
+ ++checkDepth;
260
+ continue;
261
+ }
262
+ if (!dirty && link2.nextDep !== void 0) {
263
+ link2 = link2.nextDep;
264
+ continue;
265
+ }
266
+ while (checkDepth) {
267
+ --checkDepth;
268
+ const firstSub = sub.subs;
269
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
270
+ if (hasMultipleSubs) {
271
+ link2 = stack.value;
272
+ stack = stack.prev;
273
+ } else {
274
+ link2 = firstSub;
275
+ }
276
+ if (dirty) {
277
+ if (sub.update()) {
278
+ if (hasMultipleSubs) {
279
+ shallowPropagate(firstSub);
280
+ }
281
+ sub = link2.sub;
282
+ continue;
283
+ }
284
+ } else {
285
+ sub.flags &= -33 /* Pending */;
286
+ }
287
+ sub = link2.sub;
288
+ if (link2.nextDep !== void 0) {
289
+ link2 = link2.nextDep;
290
+ continue top;
291
+ }
292
+ dirty = false;
293
+ }
294
+ return dirty;
295
+ } while (true);
296
+ }
297
+ function shallowPropagate(link2) {
298
+ do {
299
+ const sub = link2.sub;
300
+ const nextSub = link2.nextSub;
301
+ const subFlags = sub.flags;
302
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
303
+ sub.flags = subFlags | 16 /* Dirty */;
304
+ }
305
+ link2 = nextSub;
306
+ } while (link2 !== void 0);
307
+ }
308
+ function isValidLink(checkLink, sub) {
309
+ const depsTail = sub.depsTail;
310
+ if (depsTail !== void 0) {
311
+ let link2 = sub.deps;
312
+ do {
313
+ if (link2 === checkLink) {
314
+ return true;
315
+ }
316
+ if (link2 === depsTail) {
317
+ break;
318
+ }
319
+ link2 = link2.nextDep;
320
+ } while (link2 !== void 0);
390
321
  }
322
+ return false;
391
323
  }
392
- function cleanupDeps(sub) {
393
- let head;
394
- let tail = sub.depsTail;
395
- let link = tail;
396
- while (link) {
397
- const prev = link.prevDep;
398
- if (link.version === -1) {
399
- if (link === tail) tail = prev;
400
- removeSub(link);
401
- removeDep(link);
402
- } else {
403
- head = link;
404
- }
405
- link.dep.activeLink = link.prevActiveLink;
406
- link.prevActiveLink = void 0;
407
- link = prev;
324
+
325
+ const triggerEventInfos = [];
326
+ function onTrack(sub, debugInfo) {
327
+ if (sub.onTrack) {
328
+ sub.onTrack(
329
+ extend(
330
+ {
331
+ effect: sub
332
+ },
333
+ debugInfo
334
+ )
335
+ );
408
336
  }
409
- sub.deps = head;
410
- sub.depsTail = tail;
411
337
  }
412
- function isDirty(sub) {
413
- for (let link = sub.deps; link; link = link.nextDep) {
414
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
415
- return true;
416
- }
417
- }
418
- if (sub._dirty) {
419
- return true;
338
+ function onTrigger(sub) {
339
+ if (sub.onTrigger) {
340
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
341
+ sub.onTrigger(
342
+ extend(
343
+ {
344
+ effect: sub
345
+ },
346
+ debugInfo
347
+ )
348
+ );
420
349
  }
421
- return false;
422
350
  }
423
- function refreshComputed(computed) {
424
- if (computed.flags & 4 && !(computed.flags & 16)) {
425
- return;
426
- }
427
- computed.flags &= -17;
428
- if (computed.globalVersion === globalVersion) {
429
- return;
430
- }
431
- computed.globalVersion = globalVersion;
432
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
433
- return;
434
- }
435
- computed.flags |= 2;
436
- const dep = computed.dep;
437
- const prevSub = activeSub;
438
- const prevShouldTrack = shouldTrack;
439
- activeSub = computed;
440
- shouldTrack = true;
441
- try {
442
- prepareDeps(computed);
443
- const value = computed.fn(computed._value);
444
- if (dep.version === 0 || hasChanged(value, computed._value)) {
445
- computed.flags |= 128;
446
- computed._value = value;
447
- dep.version++;
351
+ function setupOnTrigger(target) {
352
+ Object.defineProperty(target.prototype, "onTrigger", {
353
+ get() {
354
+ return this._onTrigger;
355
+ },
356
+ set(val) {
357
+ if (val && !this._onTrigger) setupFlagsHandler(this);
358
+ this._onTrigger = val;
448
359
  }
449
- } catch (err) {
450
- dep.version++;
451
- throw err;
452
- } finally {
453
- activeSub = prevSub;
454
- shouldTrack = prevShouldTrack;
455
- cleanupDeps(computed);
456
- computed.flags &= -3;
457
- }
360
+ });
458
361
  }
459
- function removeSub(link, soft = false) {
460
- const { dep, prevSub, nextSub } = link;
461
- if (prevSub) {
462
- prevSub.nextSub = nextSub;
463
- link.prevSub = void 0;
464
- }
465
- if (nextSub) {
466
- nextSub.prevSub = prevSub;
467
- link.nextSub = void 0;
468
- }
469
- if (dep.subsHead === link) {
470
- dep.subsHead = nextSub;
471
- }
472
- if (dep.subs === link) {
473
- dep.subs = prevSub;
474
- if (!prevSub && dep.computed) {
475
- dep.computed.flags &= -5;
476
- for (let l = dep.computed.deps; l; l = l.nextDep) {
477
- removeSub(l, true);
362
+ function setupFlagsHandler(target) {
363
+ target._flags = target.flags;
364
+ Object.defineProperty(target, "flags", {
365
+ get() {
366
+ return target._flags;
367
+ },
368
+ set(value) {
369
+ if (!(target._flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) && !!(value & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending))) {
370
+ onTrigger(this);
478
371
  }
372
+ target._flags = value;
479
373
  }
480
- }
481
- if (!soft && !--dep.sc && dep.map) {
482
- dep.map.delete(dep.key);
483
- }
484
- }
485
- function removeDep(link) {
486
- const { prevDep, nextDep } = link;
487
- if (prevDep) {
488
- prevDep.nextDep = nextDep;
489
- link.prevDep = void 0;
490
- }
491
- if (nextDep) {
492
- nextDep.prevDep = prevDep;
493
- link.nextDep = void 0;
494
- }
495
- }
496
- function effect(fn, options) {
497
- if (fn.effect instanceof ReactiveEffect) {
498
- fn = fn.effect.fn;
499
- }
500
- const e = new ReactiveEffect(fn);
501
- if (options) {
502
- extend(e, options);
503
- }
504
- try {
505
- e.run();
506
- } catch (err) {
507
- e.stop();
508
- throw err;
509
- }
510
- const runner = e.run.bind(e);
511
- runner.effect = e;
512
- return runner;
513
- }
514
- function stop(runner) {
515
- runner.effect.stop();
516
- }
517
- let shouldTrack = true;
518
- const trackStack = [];
519
- function pauseTracking() {
520
- trackStack.push(shouldTrack);
521
- shouldTrack = false;
522
- }
523
- function enableTracking() {
524
- trackStack.push(shouldTrack);
525
- shouldTrack = true;
526
- }
527
- function resetTracking() {
528
- const last = trackStack.pop();
529
- shouldTrack = last === void 0 ? true : last;
530
- }
531
- function onEffectCleanup(fn, failSilently = false) {
532
- if (activeSub instanceof ReactiveEffect) {
533
- activeSub.cleanup = fn;
534
- } else if (!failSilently) {
535
- warn(
536
- `onEffectCleanup() was called when there was no active effect to associate with.`
537
- );
538
- }
539
- }
540
- function cleanupEffect(e) {
541
- const { cleanup } = e;
542
- e.cleanup = void 0;
543
- if (cleanup) {
544
- const prevSub = activeSub;
545
- activeSub = void 0;
546
- try {
547
- cleanup();
548
- } finally {
549
- activeSub = prevSub;
550
- }
551
- }
374
+ });
552
375
  }
553
376
 
554
- let globalVersion = 0;
555
- class Link {
556
- constructor(sub, dep) {
557
- this.sub = sub;
558
- this.dep = dep;
559
- this.version = dep.version;
560
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
561
- }
562
- }
563
377
  class Dep {
564
- // TODO isolatedDeclarations "__v_skip"
565
- constructor(computed) {
566
- this.computed = computed;
567
- this.version = 0;
568
- /**
569
- * Link between this dep and the current active effect
570
- */
571
- this.activeLink = void 0;
572
- /**
573
- * Doubly linked list representing the subscribing effects (tail)
574
- */
575
- this.subs = void 0;
576
- /**
577
- * For object property deps cleanup
578
- */
579
- this.map = void 0;
580
- this.key = void 0;
581
- /**
582
- * Subscriber counter
583
- */
584
- this.sc = 0;
585
- /**
586
- * @internal
587
- */
588
- this.__v_skip = true;
589
- {
590
- this.subsHead = void 0;
591
- }
378
+ constructor(map, key) {
379
+ this.map = map;
380
+ this.key = key;
381
+ this._subs = void 0;
382
+ this.subsTail = void 0;
383
+ this.flags = ReactiveFlags$1.None;
592
384
  }
593
- track(debugInfo) {
594
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
595
- return;
596
- }
597
- let link = this.activeLink;
598
- if (link === void 0 || link.sub !== activeSub) {
599
- link = this.activeLink = new Link(activeSub, this);
600
- if (!activeSub.deps) {
601
- activeSub.deps = activeSub.depsTail = link;
602
- } else {
603
- link.prevDep = activeSub.depsTail;
604
- activeSub.depsTail.nextDep = link;
605
- activeSub.depsTail = link;
606
- }
607
- addSub(link);
608
- } else if (link.version === -1) {
609
- link.version = this.version;
610
- if (link.nextDep) {
611
- const next = link.nextDep;
612
- next.prevDep = link.prevDep;
613
- if (link.prevDep) {
614
- link.prevDep.nextDep = next;
615
- }
616
- link.prevDep = activeSub.depsTail;
617
- link.nextDep = void 0;
618
- activeSub.depsTail.nextDep = link;
619
- activeSub.depsTail = link;
620
- if (activeSub.deps === link) {
621
- activeSub.deps = next;
622
- }
623
- }
624
- }
625
- if (activeSub.onTrack) {
626
- activeSub.onTrack(
627
- extend(
628
- {
629
- effect: activeSub
630
- },
631
- debugInfo
632
- )
633
- );
634
- }
635
- return link;
385
+ get subs() {
386
+ return this._subs;
636
387
  }
637
- trigger(debugInfo) {
638
- this.version++;
639
- globalVersion++;
640
- this.notify(debugInfo);
641
- }
642
- notify(debugInfo) {
643
- startBatch();
644
- try {
645
- if (true) {
646
- for (let head = this.subsHead; head; head = head.nextSub) {
647
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
648
- head.sub.onTrigger(
649
- extend(
650
- {
651
- effect: head.sub
652
- },
653
- debugInfo
654
- )
655
- );
656
- }
657
- }
658
- }
659
- for (let link = this.subs; link; link = link.prevSub) {
660
- if (link.sub.notify()) {
661
- ;
662
- link.sub.dep.notify();
663
- }
664
- }
665
- } finally {
666
- endBatch();
388
+ set subs(value) {
389
+ this._subs = value;
390
+ if (value === void 0) {
391
+ this.map.delete(this.key);
667
392
  }
668
393
  }
669
394
  }
670
- function addSub(link) {
671
- link.dep.sc++;
672
- if (link.sub.flags & 4) {
673
- const computed = link.dep.computed;
674
- if (computed && !link.dep.subs) {
675
- computed.flags |= 4 | 16;
676
- for (let l = computed.deps; l; l = l.nextDep) {
677
- addSub(l);
678
- }
679
- }
680
- const currentTail = link.dep.subs;
681
- if (currentTail !== link) {
682
- link.prevSub = currentTail;
683
- if (currentTail) currentTail.nextSub = link;
684
- }
685
- if (link.dep.subsHead === void 0) {
686
- link.dep.subsHead = link;
687
- }
688
- link.dep.subs = link;
689
- }
690
- }
691
395
  const targetMap = /* @__PURE__ */ new WeakMap();
692
396
  const ITERATE_KEY = Symbol(
693
397
  "Object iterate"
@@ -699,36 +403,34 @@ const ARRAY_ITERATE_KEY = Symbol(
699
403
  "Array iterate"
700
404
  );
701
405
  function track(target, type, key) {
702
- if (shouldTrack && activeSub) {
406
+ if (activeSub !== void 0) {
703
407
  let depsMap = targetMap.get(target);
704
408
  if (!depsMap) {
705
409
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
706
410
  }
707
411
  let dep = depsMap.get(key);
708
412
  if (!dep) {
709
- depsMap.set(key, dep = new Dep());
710
- dep.map = depsMap;
711
- dep.key = key;
413
+ depsMap.set(key, dep = new Dep(depsMap, key));
712
414
  }
713
415
  {
714
- dep.track({
416
+ onTrack(activeSub, {
715
417
  target,
716
418
  type,
717
419
  key
718
420
  });
719
421
  }
422
+ link(dep, activeSub);
720
423
  }
721
424
  }
722
425
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
723
426
  const depsMap = targetMap.get(target);
724
427
  if (!depsMap) {
725
- globalVersion++;
726
428
  return;
727
429
  }
728
430
  const run = (dep) => {
729
- if (dep) {
431
+ if (dep !== void 0 && dep.subs !== void 0) {
730
432
  {
731
- dep.trigger({
433
+ triggerEventInfos.push({
732
434
  target,
733
435
  type,
734
436
  key,
@@ -737,6 +439,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
737
439
  oldTarget
738
440
  });
739
441
  }
442
+ propagate(dep.subs);
443
+ shallowPropagate(dep.subs);
444
+ {
445
+ triggerEventInfos.pop();
446
+ }
740
447
  }
741
448
  };
742
449
  startBatch();
@@ -961,11 +668,11 @@ function searchProxy(self, method, args) {
961
668
  return res;
962
669
  }
963
670
  function noTracking(self, method, args = []) {
964
- pauseTracking();
965
671
  startBatch();
672
+ const prevSub = setActiveSub();
966
673
  const res = toRaw(self)[method].apply(self, args);
674
+ setActiveSub(prevSub);
967
675
  endBatch();
968
- resetTracking();
969
676
  return res;
970
677
  }
971
678
 
@@ -1011,14 +718,18 @@ class BaseReactiveHandler {
1011
718
  return hasOwnProperty;
1012
719
  }
1013
720
  }
721
+ const wasRef = isRef(target);
1014
722
  const res = Reflect.get(
1015
723
  target,
1016
724
  key,
1017
725
  // if this is a proxy wrapping a ref, return methods using the raw ref
1018
726
  // as receiver so that we don't have to call `toRaw` on the ref in all
1019
727
  // its class methods
1020
- isRef(target) ? target : receiver
728
+ wasRef ? target : receiver
1021
729
  );
730
+ if (wasRef && key !== "value") {
731
+ return res;
732
+ }
1022
733
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1023
734
  return res;
1024
735
  }
@@ -1470,33 +1181,47 @@ function isRef(r) {
1470
1181
  return r ? r["__v_isRef"] === true : false;
1471
1182
  }
1472
1183
  function ref(value) {
1473
- return createRef(value, false);
1184
+ return createRef(value, toReactive);
1474
1185
  }
1475
1186
  function shallowRef(value) {
1476
- return createRef(value, true);
1187
+ return createRef(value);
1477
1188
  }
1478
- function createRef(rawValue, shallow) {
1189
+ function createRef(rawValue, wrap) {
1479
1190
  if (isRef(rawValue)) {
1480
1191
  return rawValue;
1481
1192
  }
1482
- return new RefImpl(rawValue, shallow);
1193
+ return new RefImpl(rawValue, wrap);
1483
1194
  }
1484
1195
  class RefImpl {
1485
- constructor(value, isShallow2) {
1486
- this.dep = new Dep();
1487
- this["__v_isRef"] = true;
1488
- this["__v_isShallow"] = false;
1489
- this._rawValue = isShallow2 ? value : toRaw(value);
1490
- this._value = isShallow2 ? value : toReactive(value);
1491
- this["__v_isShallow"] = isShallow2;
1196
+ // TODO isolatedDeclarations "__v_isShallow"
1197
+ constructor(value, wrap) {
1198
+ this.subs = void 0;
1199
+ this.subsTail = void 0;
1200
+ this.flags = ReactiveFlags$1.Mutable;
1201
+ /**
1202
+ * @internal
1203
+ */
1204
+ this.__v_isRef = true;
1205
+ // TODO isolatedDeclarations "__v_isRef"
1206
+ /**
1207
+ * @internal
1208
+ */
1209
+ this.__v_isShallow = false;
1210
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1211
+ this._value = wrap ? wrap(value) : value;
1212
+ this._wrap = wrap;
1213
+ this["__v_isShallow"] = !wrap;
1214
+ }
1215
+ get dep() {
1216
+ return this;
1492
1217
  }
1493
1218
  get value() {
1494
- {
1495
- this.dep.track({
1496
- target: this,
1497
- type: "get",
1498
- key: "value"
1499
- });
1219
+ trackRef(this);
1220
+ if (this.flags & ReactiveFlags$1.Dirty && this.update()) {
1221
+ const subs = this.subs;
1222
+ if (subs !== void 0) {
1223
+ shallowPropagate(subs);
1224
+ }
1500
1225
  }
1501
1226
  return this._value;
1502
1227
  }
@@ -1505,191 +1230,539 @@ class RefImpl {
1505
1230
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1506
1231
  newValue = useDirectValue ? newValue : toRaw(newValue);
1507
1232
  if (hasChanged(newValue, oldValue)) {
1233
+ this.flags |= ReactiveFlags$1.Dirty;
1508
1234
  this._rawValue = newValue;
1509
- this._value = useDirectValue ? newValue : toReactive(newValue);
1510
- {
1511
- this.dep.trigger({
1512
- target: this,
1513
- type: "set",
1514
- key: "value",
1515
- newValue,
1516
- oldValue
1517
- });
1235
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1236
+ const subs = this.subs;
1237
+ if (subs !== void 0) {
1238
+ {
1239
+ triggerEventInfos.push({
1240
+ target: this,
1241
+ type: "set",
1242
+ key: "value",
1243
+ newValue,
1244
+ oldValue
1245
+ });
1246
+ }
1247
+ propagate(subs);
1248
+ if (!batchDepth) {
1249
+ flush();
1250
+ }
1251
+ {
1252
+ triggerEventInfos.pop();
1253
+ }
1254
+ }
1255
+ }
1256
+ }
1257
+ update() {
1258
+ this.flags &= ~ReactiveFlags$1.Dirty;
1259
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1260
+ }
1261
+ }
1262
+ function triggerRef(ref2) {
1263
+ const dep = ref2.dep;
1264
+ if (dep !== void 0 && dep.subs !== void 0) {
1265
+ propagate(dep.subs);
1266
+ shallowPropagate(dep.subs);
1267
+ if (!batchDepth) {
1268
+ flush();
1269
+ }
1270
+ }
1271
+ }
1272
+ function trackRef(dep) {
1273
+ if (activeSub !== void 0) {
1274
+ {
1275
+ onTrack(activeSub, {
1276
+ target: dep,
1277
+ type: "get",
1278
+ key: "value"
1279
+ });
1280
+ }
1281
+ link(dep, activeSub);
1282
+ }
1283
+ }
1284
+ function unref(ref2) {
1285
+ return isRef(ref2) ? ref2.value : ref2;
1286
+ }
1287
+ function toValue(source) {
1288
+ return isFunction(source) ? source() : unref(source);
1289
+ }
1290
+ const shallowUnwrapHandlers = {
1291
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1292
+ set: (target, key, value, receiver) => {
1293
+ const oldValue = target[key];
1294
+ if (isRef(oldValue) && !isRef(value)) {
1295
+ oldValue.value = value;
1296
+ return true;
1297
+ } else {
1298
+ return Reflect.set(target, key, value, receiver);
1299
+ }
1300
+ }
1301
+ };
1302
+ function proxyRefs(objectWithRefs) {
1303
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1304
+ }
1305
+ class CustomRefImpl {
1306
+ constructor(factory) {
1307
+ this.subs = void 0;
1308
+ this.subsTail = void 0;
1309
+ this.flags = ReactiveFlags$1.None;
1310
+ this["__v_isRef"] = true;
1311
+ this._value = void 0;
1312
+ const { get, set } = factory(
1313
+ () => trackRef(this),
1314
+ () => triggerRef(this)
1315
+ );
1316
+ this._get = get;
1317
+ this._set = set;
1318
+ }
1319
+ get dep() {
1320
+ return this;
1321
+ }
1322
+ get value() {
1323
+ return this._value = this._get();
1324
+ }
1325
+ set value(newVal) {
1326
+ this._set(newVal);
1327
+ }
1328
+ }
1329
+ function customRef(factory) {
1330
+ return new CustomRefImpl(factory);
1331
+ }
1332
+ function toRefs(object) {
1333
+ const ret = isArray(object) ? new Array(object.length) : {};
1334
+ for (const key in object) {
1335
+ ret[key] = propertyToRef(object, key);
1336
+ }
1337
+ return ret;
1338
+ }
1339
+ class ObjectRefImpl {
1340
+ constructor(_object, _key, _defaultValue) {
1341
+ this._object = _object;
1342
+ this._key = _key;
1343
+ this._defaultValue = _defaultValue;
1344
+ this["__v_isRef"] = true;
1345
+ this._value = void 0;
1346
+ }
1347
+ get value() {
1348
+ const val = this._object[this._key];
1349
+ return this._value = val === void 0 ? this._defaultValue : val;
1350
+ }
1351
+ set value(newVal) {
1352
+ this._object[this._key] = newVal;
1353
+ }
1354
+ get dep() {
1355
+ return getDepFromReactive(toRaw(this._object), this._key);
1356
+ }
1357
+ }
1358
+ class GetterRefImpl {
1359
+ constructor(_getter) {
1360
+ this._getter = _getter;
1361
+ this["__v_isRef"] = true;
1362
+ this["__v_isReadonly"] = true;
1363
+ this._value = void 0;
1364
+ }
1365
+ get value() {
1366
+ return this._value = this._getter();
1367
+ }
1368
+ }
1369
+ function toRef(source, key, defaultValue) {
1370
+ if (isRef(source)) {
1371
+ return source;
1372
+ } else if (isFunction(source)) {
1373
+ return new GetterRefImpl(source);
1374
+ } else if (isObject(source) && arguments.length > 1) {
1375
+ return propertyToRef(source, key, defaultValue);
1376
+ } else {
1377
+ return ref(source);
1378
+ }
1379
+ }
1380
+ function propertyToRef(source, key, defaultValue) {
1381
+ const val = source[key];
1382
+ return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1383
+ }
1384
+
1385
+ const EffectFlags = {
1386
+ "ALLOW_RECURSE": 128,
1387
+ "128": "ALLOW_RECURSE",
1388
+ "PAUSED": 256,
1389
+ "256": "PAUSED",
1390
+ "STOP": 1024,
1391
+ "1024": "STOP"
1392
+ };
1393
+ class ReactiveEffect {
1394
+ constructor(fn) {
1395
+ this.deps = void 0;
1396
+ this.depsTail = void 0;
1397
+ this.subs = void 0;
1398
+ this.subsTail = void 0;
1399
+ this.flags = ReactiveFlags$1.Watching | ReactiveFlags$1.Dirty;
1400
+ /**
1401
+ * @internal
1402
+ */
1403
+ this.cleanups = [];
1404
+ /**
1405
+ * @internal
1406
+ */
1407
+ this.cleanupsLength = 0;
1408
+ if (fn !== void 0) {
1409
+ this.fn = fn;
1410
+ }
1411
+ if (activeEffectScope) {
1412
+ link(this, activeEffectScope);
1413
+ }
1414
+ }
1415
+ // @ts-expect-error
1416
+ fn() {
1417
+ }
1418
+ get active() {
1419
+ return !(this.flags & 1024);
1420
+ }
1421
+ pause() {
1422
+ this.flags |= 256;
1423
+ }
1424
+ resume() {
1425
+ const flags = this.flags &= -257;
1426
+ if (flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) {
1427
+ this.notify();
1428
+ }
1429
+ }
1430
+ notify() {
1431
+ if (!(this.flags & 256) && this.dirty) {
1432
+ this.run();
1433
+ }
1434
+ }
1435
+ run() {
1436
+ if (!this.active) {
1437
+ return this.fn();
1438
+ }
1439
+ cleanup(this);
1440
+ const prevSub = startTracking(this);
1441
+ try {
1442
+ return this.fn();
1443
+ } finally {
1444
+ endTracking(this, prevSub);
1445
+ const flags = this.flags;
1446
+ if ((flags & (ReactiveFlags$1.Recursed | 128)) === (ReactiveFlags$1.Recursed | 128)) {
1447
+ this.flags = flags & ~ReactiveFlags$1.Recursed;
1448
+ this.notify();
1449
+ }
1450
+ }
1451
+ }
1452
+ stop() {
1453
+ if (!this.active) {
1454
+ return;
1455
+ }
1456
+ this.flags = 1024;
1457
+ let dep = this.deps;
1458
+ while (dep !== void 0) {
1459
+ dep = unlink(dep, this);
1460
+ }
1461
+ const sub = this.subs;
1462
+ if (sub !== void 0) {
1463
+ unlink(sub);
1464
+ }
1465
+ cleanup(this);
1466
+ }
1467
+ get dirty() {
1468
+ const flags = this.flags;
1469
+ if (flags & ReactiveFlags$1.Dirty) {
1470
+ return true;
1471
+ }
1472
+ if (flags & ReactiveFlags$1.Pending) {
1473
+ if (checkDirty(this.deps, this)) {
1474
+ this.flags = flags | ReactiveFlags$1.Dirty;
1475
+ return true;
1476
+ } else {
1477
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1518
1478
  }
1519
1479
  }
1480
+ return false;
1481
+ }
1482
+ }
1483
+ {
1484
+ setupOnTrigger(ReactiveEffect);
1485
+ }
1486
+ function effect(fn, options) {
1487
+ if (fn.effect instanceof ReactiveEffect) {
1488
+ fn = fn.effect.fn;
1489
+ }
1490
+ const e = new ReactiveEffect(fn);
1491
+ if (options) {
1492
+ const { onStop, scheduler } = options;
1493
+ if (onStop) {
1494
+ options.onStop = void 0;
1495
+ const stop2 = e.stop.bind(e);
1496
+ e.stop = () => {
1497
+ stop2();
1498
+ onStop();
1499
+ };
1500
+ }
1501
+ if (scheduler) {
1502
+ options.scheduler = void 0;
1503
+ e.notify = () => {
1504
+ if (!(e.flags & 256)) {
1505
+ scheduler();
1506
+ }
1507
+ };
1508
+ }
1509
+ extend(e, options);
1520
1510
  }
1521
- }
1522
- function triggerRef(ref2) {
1523
- if (ref2.dep) {
1524
- {
1525
- ref2.dep.trigger({
1526
- target: ref2,
1527
- type: "set",
1528
- key: "value",
1529
- newValue: ref2._value
1530
- });
1531
- }
1511
+ try {
1512
+ e.run();
1513
+ } catch (err) {
1514
+ e.stop();
1515
+ throw err;
1532
1516
  }
1517
+ const runner = e.run.bind(e);
1518
+ runner.effect = e;
1519
+ return runner;
1533
1520
  }
1534
- function unref(ref2) {
1535
- return isRef(ref2) ? ref2.value : ref2;
1521
+ function stop(runner) {
1522
+ runner.effect.stop();
1536
1523
  }
1537
- function toValue(source) {
1538
- return isFunction(source) ? source() : unref(source);
1524
+ const resetTrackingStack = [];
1525
+ function pauseTracking() {
1526
+ resetTrackingStack.push(activeSub);
1527
+ setActiveSub();
1539
1528
  }
1540
- const shallowUnwrapHandlers = {
1541
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1542
- set: (target, key, value, receiver) => {
1543
- const oldValue = target[key];
1544
- if (isRef(oldValue) && !isRef(value)) {
1545
- oldValue.value = value;
1546
- return true;
1547
- } else {
1548
- return Reflect.set(target, key, value, receiver);
1529
+ function enableTracking() {
1530
+ const isPaused = activeSub === void 0;
1531
+ if (!isPaused) {
1532
+ resetTrackingStack.push(activeSub);
1533
+ } else {
1534
+ resetTrackingStack.push(void 0);
1535
+ for (let i = resetTrackingStack.length - 1; i >= 0; i--) {
1536
+ if (resetTrackingStack[i] !== void 0) {
1537
+ setActiveSub(resetTrackingStack[i]);
1538
+ break;
1539
+ }
1549
1540
  }
1550
1541
  }
1551
- };
1552
- function proxyRefs(objectWithRefs) {
1553
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1554
1542
  }
1555
- class CustomRefImpl {
1556
- constructor(factory) {
1557
- this["__v_isRef"] = true;
1558
- this._value = void 0;
1559
- const dep = this.dep = new Dep();
1560
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1561
- this._get = get;
1562
- this._set = set;
1563
- }
1564
- get value() {
1565
- return this._value = this._get();
1543
+ function resetTracking() {
1544
+ if (resetTrackingStack.length === 0) {
1545
+ warn(
1546
+ `resetTracking() was called when there was no active tracking to reset.`
1547
+ );
1566
1548
  }
1567
- set value(newVal) {
1568
- this._set(newVal);
1549
+ if (resetTrackingStack.length) {
1550
+ setActiveSub(resetTrackingStack.pop());
1551
+ } else {
1552
+ setActiveSub();
1569
1553
  }
1570
1554
  }
1571
- function customRef(factory) {
1572
- return new CustomRefImpl(factory);
1555
+ function cleanup(sub) {
1556
+ const l = sub.cleanupsLength;
1557
+ if (l) {
1558
+ for (let i = 0; i < l; i++) {
1559
+ sub.cleanups[i]();
1560
+ }
1561
+ sub.cleanupsLength = 0;
1562
+ }
1573
1563
  }
1574
- function toRefs(object) {
1575
- if (!isProxy(object)) {
1576
- warn(`toRefs() expects a reactive object but received a plain one.`);
1564
+ function onEffectCleanup(fn, failSilently = false) {
1565
+ if (activeSub instanceof ReactiveEffect) {
1566
+ activeSub.cleanups[activeSub.cleanupsLength++] = () => cleanupEffect(fn);
1567
+ } else if (!failSilently) {
1568
+ warn(
1569
+ `onEffectCleanup() was called when there was no active effect to associate with.`
1570
+ );
1577
1571
  }
1578
- const ret = isArray(object) ? new Array(object.length) : {};
1579
- for (const key in object) {
1580
- ret[key] = propertyToRef(object, key);
1572
+ }
1573
+ function cleanupEffect(fn) {
1574
+ const prevSub = setActiveSub();
1575
+ try {
1576
+ fn();
1577
+ } finally {
1578
+ setActiveSub(prevSub);
1581
1579
  }
1582
- return ret;
1583
1580
  }
1584
- class ObjectRefImpl {
1585
- constructor(_object, _key, _defaultValue) {
1586
- this._object = _object;
1587
- this._key = _key;
1588
- this._defaultValue = _defaultValue;
1589
- this["__v_isRef"] = true;
1590
- this._value = void 0;
1581
+
1582
+ let activeEffectScope;
1583
+ class EffectScope {
1584
+ constructor(detached = false) {
1585
+ this.deps = void 0;
1586
+ this.depsTail = void 0;
1587
+ this.subs = void 0;
1588
+ this.subsTail = void 0;
1589
+ this.flags = 0;
1590
+ /**
1591
+ * @internal
1592
+ */
1593
+ this.cleanups = [];
1594
+ /**
1595
+ * @internal
1596
+ */
1597
+ this.cleanupsLength = 0;
1598
+ if (!detached && activeEffectScope) {
1599
+ link(this, activeEffectScope);
1600
+ }
1591
1601
  }
1592
- get value() {
1593
- const val = this._object[this._key];
1594
- return this._value = val === void 0 ? this._defaultValue : val;
1602
+ get active() {
1603
+ return !(this.flags & 1024);
1595
1604
  }
1596
- set value(newVal) {
1597
- this._object[this._key] = newVal;
1605
+ pause() {
1606
+ if (!(this.flags & 256)) {
1607
+ this.flags |= 256;
1608
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1609
+ const dep = link2.dep;
1610
+ if ("pause" in dep) {
1611
+ dep.pause();
1612
+ }
1613
+ }
1614
+ }
1598
1615
  }
1599
- get dep() {
1600
- return getDepFromReactive(toRaw(this._object), this._key);
1616
+ /**
1617
+ * Resumes the effect scope, including all child scopes and effects.
1618
+ */
1619
+ resume() {
1620
+ const flags = this.flags;
1621
+ if (flags & 256) {
1622
+ this.flags = flags & -257;
1623
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1624
+ const dep = link2.dep;
1625
+ if ("resume" in dep) {
1626
+ dep.resume();
1627
+ }
1628
+ }
1629
+ }
1601
1630
  }
1602
- }
1603
- class GetterRefImpl {
1604
- constructor(_getter) {
1605
- this._getter = _getter;
1606
- this["__v_isRef"] = true;
1607
- this["__v_isReadonly"] = true;
1608
- this._value = void 0;
1631
+ run(fn) {
1632
+ const prevScope = activeEffectScope;
1633
+ try {
1634
+ activeEffectScope = this;
1635
+ return fn();
1636
+ } finally {
1637
+ activeEffectScope = prevScope;
1638
+ }
1609
1639
  }
1610
- get value() {
1611
- return this._value = this._getter();
1640
+ stop() {
1641
+ if (!this.active) {
1642
+ return;
1643
+ }
1644
+ this.flags = 1024;
1645
+ let dep = this.deps;
1646
+ while (dep !== void 0) {
1647
+ const node = dep.dep;
1648
+ if ("stop" in node) {
1649
+ dep = dep.nextDep;
1650
+ node.stop();
1651
+ } else {
1652
+ dep = unlink(dep, this);
1653
+ }
1654
+ }
1655
+ const sub = this.subs;
1656
+ if (sub !== void 0) {
1657
+ unlink(sub);
1658
+ }
1659
+ cleanup(this);
1612
1660
  }
1613
1661
  }
1614
- function toRef(source, key, defaultValue) {
1615
- if (isRef(source)) {
1616
- return source;
1617
- } else if (isFunction(source)) {
1618
- return new GetterRefImpl(source);
1619
- } else if (isObject(source) && arguments.length > 1) {
1620
- return propertyToRef(source, key, defaultValue);
1621
- } else {
1622
- return ref(source);
1662
+ function effectScope(detached) {
1663
+ return new EffectScope(detached);
1664
+ }
1665
+ function getCurrentScope() {
1666
+ return activeEffectScope;
1667
+ }
1668
+ function setCurrentScope(scope) {
1669
+ try {
1670
+ return activeEffectScope;
1671
+ } finally {
1672
+ activeEffectScope = scope;
1623
1673
  }
1624
1674
  }
1625
- function propertyToRef(source, key, defaultValue) {
1626
- const val = source[key];
1627
- return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1675
+ function onScopeDispose(fn, failSilently = false) {
1676
+ if (activeEffectScope !== void 0) {
1677
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1678
+ } else if (!failSilently) {
1679
+ warn(
1680
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
1681
+ );
1682
+ }
1628
1683
  }
1629
1684
 
1630
1685
  class ComputedRefImpl {
1631
- constructor(fn, setter, isSSR) {
1686
+ constructor(fn, setter) {
1632
1687
  this.fn = fn;
1633
1688
  this.setter = setter;
1634
1689
  /**
1635
1690
  * @internal
1636
1691
  */
1637
1692
  this._value = void 0;
1638
- /**
1639
- * @internal
1640
- */
1641
- this.dep = new Dep(this);
1642
- /**
1643
- * @internal
1644
- */
1645
- this.__v_isRef = true;
1646
- // TODO isolatedDeclarations "__v_isReadonly"
1647
- // A computed is also a subscriber that tracks other deps
1648
- /**
1649
- * @internal
1650
- */
1693
+ this.subs = void 0;
1694
+ this.subsTail = void 0;
1651
1695
  this.deps = void 0;
1652
- /**
1653
- * @internal
1654
- */
1655
1696
  this.depsTail = void 0;
1697
+ this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
1656
1698
  /**
1657
1699
  * @internal
1658
1700
  */
1659
- this.flags = 16;
1660
- /**
1661
- * @internal
1662
- */
1663
- this.globalVersion = globalVersion - 1;
1664
- /**
1665
- * @internal
1666
- */
1667
- this.next = void 0;
1668
- // for backwards compat
1669
- this.effect = this;
1701
+ this.__v_isRef = true;
1670
1702
  this["__v_isReadonly"] = !setter;
1671
- this.isSSR = isSSR;
1703
+ }
1704
+ // TODO isolatedDeclarations "__v_isReadonly"
1705
+ // for backwards compat
1706
+ get effect() {
1707
+ return this;
1708
+ }
1709
+ // for backwards compat
1710
+ get dep() {
1711
+ return this;
1672
1712
  }
1673
1713
  /**
1674
1714
  * @internal
1715
+ * for backwards compat
1675
1716
  */
1676
- notify() {
1677
- this.flags |= 16;
1678
- if (!(this.flags & 8) && // avoid infinite self recursion
1679
- activeSub !== this) {
1680
- batch(this, true);
1717
+ get _dirty() {
1718
+ const flags = this.flags;
1719
+ if (flags & ReactiveFlags$1.Dirty) {
1681
1720
  return true;
1682
1721
  }
1722
+ if (flags & ReactiveFlags$1.Pending) {
1723
+ if (checkDirty(this.deps, this)) {
1724
+ this.flags = flags | ReactiveFlags$1.Dirty;
1725
+ return true;
1726
+ } else {
1727
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1728
+ }
1729
+ }
1730
+ return false;
1731
+ }
1732
+ /**
1733
+ * @internal
1734
+ * for backwards compat
1735
+ */
1736
+ set _dirty(v) {
1737
+ if (v) {
1738
+ this.flags |= ReactiveFlags$1.Dirty;
1739
+ } else {
1740
+ this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
1741
+ }
1683
1742
  }
1684
1743
  get value() {
1685
- const link = this.dep.track({
1686
- target: this,
1687
- type: "get",
1688
- key: "value"
1689
- }) ;
1690
- refreshComputed(this);
1691
- if (link) {
1692
- link.version = this.dep.version;
1744
+ const flags = this.flags;
1745
+ if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
1746
+ if (this.update()) {
1747
+ const subs = this.subs;
1748
+ if (subs !== void 0) {
1749
+ shallowPropagate(subs);
1750
+ }
1751
+ }
1752
+ } else if (flags & ReactiveFlags$1.Pending) {
1753
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1754
+ }
1755
+ if (activeSub !== void 0) {
1756
+ {
1757
+ onTrack(activeSub, {
1758
+ target: this,
1759
+ type: "get",
1760
+ key: "value"
1761
+ });
1762
+ }
1763
+ link(this, activeSub);
1764
+ } else if (activeEffectScope !== void 0) {
1765
+ link(this, activeEffectScope);
1693
1766
  }
1694
1767
  return this._value;
1695
1768
  }
@@ -1700,6 +1773,23 @@ class ComputedRefImpl {
1700
1773
  warn("Write operation failed: computed value is readonly");
1701
1774
  }
1702
1775
  }
1776
+ update() {
1777
+ const prevSub = startTracking(this);
1778
+ try {
1779
+ const oldValue = this._value;
1780
+ const newValue = this.fn(oldValue);
1781
+ if (hasChanged(oldValue, newValue)) {
1782
+ this._value = newValue;
1783
+ return true;
1784
+ }
1785
+ return false;
1786
+ } finally {
1787
+ endTracking(this, prevSub);
1788
+ }
1789
+ }
1790
+ }
1791
+ {
1792
+ setupOnTrigger(ComputedRefImpl);
1703
1793
  }
1704
1794
  function computed(getterOrOptions, debugOptions, isSSR = false) {
1705
1795
  let getter;
@@ -1710,7 +1800,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1710
1800
  getter = getterOrOptions.get;
1711
1801
  setter = getterOrOptions.set;
1712
1802
  }
1713
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1803
+ const cRef = new ComputedRefImpl(getter, setter);
1714
1804
  if (debugOptions && !isSSR) {
1715
1805
  cRef.onTrack = debugOptions.onTrack;
1716
1806
  cRef.onTrigger = debugOptions.onTrigger;
@@ -1747,177 +1837,155 @@ const WatchErrorCodes = {
1747
1837
  "4": "WATCH_CLEANUP"
1748
1838
  };
1749
1839
  const INITIAL_WATCHER_VALUE = {};
1750
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1751
1840
  let activeWatcher = void 0;
1752
1841
  function getCurrentWatcher() {
1753
1842
  return activeWatcher;
1754
1843
  }
1755
1844
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1756
1845
  if (owner) {
1757
- let cleanups = cleanupMap.get(owner);
1758
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1759
- cleanups.push(cleanupFn);
1846
+ const { call } = owner.options;
1847
+ if (call) {
1848
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1849
+ } else {
1850
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1851
+ }
1760
1852
  } else if (!failSilently) {
1761
1853
  warn(
1762
1854
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1763
1855
  );
1764
1856
  }
1765
1857
  }
1766
- function watch(source, cb, options = EMPTY_OBJ) {
1767
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1768
- const warnInvalidSource = (s) => {
1769
- (options.onWarn || warn)(
1770
- `Invalid watch source: `,
1771
- s,
1772
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1773
- );
1774
- };
1775
- const reactiveGetter = (source2) => {
1776
- if (deep) return source2;
1777
- if (isShallow(source2) || deep === false || deep === 0)
1778
- return traverse(source2, 1);
1779
- return traverse(source2);
1780
- };
1781
- let effect;
1782
- let getter;
1783
- let cleanup;
1784
- let boundCleanup;
1785
- let forceTrigger = false;
1786
- let isMultiSource = false;
1787
- if (isRef(source)) {
1788
- getter = () => source.value;
1789
- forceTrigger = isShallow(source);
1790
- } else if (isReactive(source)) {
1791
- getter = () => reactiveGetter(source);
1792
- forceTrigger = true;
1793
- } else if (isArray(source)) {
1794
- isMultiSource = true;
1795
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1796
- getter = () => source.map((s) => {
1797
- if (isRef(s)) {
1798
- return s.value;
1799
- } else if (isReactive(s)) {
1800
- return reactiveGetter(s);
1801
- } else if (isFunction(s)) {
1802
- return call ? call(s, 2) : s();
1858
+ class WatcherEffect extends ReactiveEffect {
1859
+ constructor(source, cb, options = EMPTY_OBJ) {
1860
+ const { deep, once, call, onWarn } = options;
1861
+ let getter;
1862
+ let forceTrigger = false;
1863
+ let isMultiSource = false;
1864
+ if (isRef(source)) {
1865
+ getter = () => source.value;
1866
+ forceTrigger = isShallow(source);
1867
+ } else if (isReactive(source)) {
1868
+ getter = () => reactiveGetter(source, deep);
1869
+ forceTrigger = true;
1870
+ } else if (isArray(source)) {
1871
+ isMultiSource = true;
1872
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1873
+ getter = () => source.map((s) => {
1874
+ if (isRef(s)) {
1875
+ return s.value;
1876
+ } else if (isReactive(s)) {
1877
+ return reactiveGetter(s, deep);
1878
+ } else if (isFunction(s)) {
1879
+ return call ? call(s, 2) : s();
1880
+ } else {
1881
+ warnInvalidSource(s, onWarn);
1882
+ }
1883
+ });
1884
+ } else if (isFunction(source)) {
1885
+ if (cb) {
1886
+ getter = call ? () => call(source, 2) : source;
1803
1887
  } else {
1804
- warnInvalidSource(s);
1805
- }
1806
- });
1807
- } else if (isFunction(source)) {
1808
- if (cb) {
1809
- getter = call ? () => call(source, 2) : source;
1810
- } else {
1811
- getter = () => {
1812
- if (cleanup) {
1813
- pauseTracking();
1888
+ getter = () => {
1889
+ if (this.cleanupsLength) {
1890
+ const prevSub = setActiveSub();
1891
+ try {
1892
+ cleanup(this);
1893
+ } finally {
1894
+ setActiveSub(prevSub);
1895
+ }
1896
+ }
1897
+ const currentEffect = activeWatcher;
1898
+ activeWatcher = this;
1814
1899
  try {
1815
- cleanup();
1900
+ return call ? call(source, 3, [
1901
+ this.boundCleanup
1902
+ ]) : source(this.boundCleanup);
1816
1903
  } finally {
1817
- resetTracking();
1904
+ activeWatcher = currentEffect;
1818
1905
  }
1819
- }
1820
- const currentEffect = activeWatcher;
1821
- activeWatcher = effect;
1822
- try {
1823
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1824
- } finally {
1825
- activeWatcher = currentEffect;
1826
- }
1906
+ };
1907
+ }
1908
+ } else {
1909
+ getter = NOOP;
1910
+ warnInvalidSource(source, onWarn);
1911
+ }
1912
+ if (cb && deep) {
1913
+ const baseGetter = getter;
1914
+ const depth = deep === true ? Infinity : deep;
1915
+ getter = () => traverse(baseGetter(), depth);
1916
+ }
1917
+ super(getter);
1918
+ this.cb = cb;
1919
+ this.options = options;
1920
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1921
+ this.forceTrigger = forceTrigger;
1922
+ this.isMultiSource = isMultiSource;
1923
+ if (once && cb) {
1924
+ const _cb = cb;
1925
+ cb = (...args) => {
1926
+ _cb(...args);
1927
+ this.stop();
1827
1928
  };
1828
1929
  }
1829
- } else {
1830
- getter = NOOP;
1831
- warnInvalidSource(source);
1832
- }
1833
- if (cb && deep) {
1834
- const baseGetter = getter;
1835
- const depth = deep === true ? Infinity : deep;
1836
- getter = () => traverse(baseGetter(), depth);
1837
- }
1838
- const scope = getCurrentScope();
1839
- const watchHandle = () => {
1840
- effect.stop();
1841
- if (scope && scope.active) {
1842
- remove(scope.effects, effect);
1930
+ this.cb = cb;
1931
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1932
+ {
1933
+ this.onTrack = options.onTrack;
1934
+ this.onTrigger = options.onTrigger;
1843
1935
  }
1844
- };
1845
- if (once && cb) {
1846
- const _cb = cb;
1847
- cb = (...args) => {
1848
- _cb(...args);
1849
- watchHandle();
1850
- };
1851
1936
  }
1852
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1853
- const job = (immediateFirstRun) => {
1854
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1937
+ run(initialRun = false) {
1938
+ const oldValue = this.oldValue;
1939
+ const newValue = this.oldValue = super.run();
1940
+ if (!this.cb) {
1855
1941
  return;
1856
1942
  }
1857
- if (cb) {
1858
- const newValue = effect.run();
1859
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1860
- if (cleanup) {
1861
- cleanup();
1862
- }
1863
- const currentWatcher = activeWatcher;
1864
- activeWatcher = effect;
1865
- try {
1866
- const args = [
1867
- newValue,
1868
- // pass undefined as the old value when it's changed for the first time
1869
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1870
- boundCleanup
1871
- ];
1872
- oldValue = newValue;
1873
- call ? call(cb, 3, args) : (
1874
- // @ts-expect-error
1875
- cb(...args)
1876
- );
1877
- } finally {
1878
- activeWatcher = currentWatcher;
1879
- }
1880
- }
1881
- } else {
1882
- effect.run();
1943
+ const { immediate, deep, call } = this.options;
1944
+ if (initialRun && !immediate) {
1945
+ return;
1883
1946
  }
1884
- };
1885
- if (augmentJob) {
1886
- augmentJob(job);
1887
- }
1888
- effect = new ReactiveEffect(getter);
1889
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1890
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1891
- cleanup = effect.onStop = () => {
1892
- const cleanups = cleanupMap.get(effect);
1893
- if (cleanups) {
1894
- if (call) {
1895
- call(cleanups, 4);
1896
- } else {
1897
- for (const cleanup2 of cleanups) cleanup2();
1947
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1948
+ cleanup(this);
1949
+ const currentWatcher = activeWatcher;
1950
+ activeWatcher = this;
1951
+ try {
1952
+ const args = [
1953
+ newValue,
1954
+ // pass undefined as the old value when it's changed for the first time
1955
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1956
+ this.boundCleanup
1957
+ ];
1958
+ call ? call(this.cb, 3, args) : (
1959
+ // @ts-expect-error
1960
+ this.cb(...args)
1961
+ );
1962
+ } finally {
1963
+ activeWatcher = currentWatcher;
1898
1964
  }
1899
- cleanupMap.delete(effect);
1900
- }
1901
- };
1902
- {
1903
- effect.onTrack = options.onTrack;
1904
- effect.onTrigger = options.onTrigger;
1905
- }
1906
- if (cb) {
1907
- if (immediate) {
1908
- job(true);
1909
- } else {
1910
- oldValue = effect.run();
1911
1965
  }
1912
- } else if (scheduler) {
1913
- scheduler(job.bind(null, true), true);
1914
- } else {
1915
- effect.run();
1916
1966
  }
1917
- watchHandle.pause = effect.pause.bind(effect);
1918
- watchHandle.resume = effect.resume.bind(effect);
1919
- watchHandle.stop = watchHandle;
1920
- return watchHandle;
1967
+ }
1968
+ function reactiveGetter(source, deep) {
1969
+ if (deep) return source;
1970
+ if (isShallow(source) || deep === false || deep === 0)
1971
+ return traverse(source, 1);
1972
+ return traverse(source);
1973
+ }
1974
+ function warnInvalidSource(s, onWarn) {
1975
+ (onWarn || warn)(
1976
+ `Invalid watch source: `,
1977
+ s,
1978
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1979
+ );
1980
+ }
1981
+ function watch(source, cb, options = EMPTY_OBJ) {
1982
+ const effect = new WatcherEffect(source, cb, options);
1983
+ effect.run(true);
1984
+ const stop = effect.stop.bind(effect);
1985
+ stop.pause = effect.pause.bind(effect);
1986
+ stop.resume = effect.resume.bind(effect);
1987
+ stop.stop = stop;
1988
+ return stop;
1921
1989
  }
1922
1990
  function traverse(value, depth = Infinity, seen) {
1923
1991
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1952,4 +2020,4 @@ function traverse(value, depth = Infinity, seen) {
1952
2020
  return value;
1953
2021
  }
1954
2022
 
1955
- export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };
2023
+ export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, WatcherEffect, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, setActiveSub, setCurrentScope, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };