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