@tarojs/components-advanced 3.6.2-canary.2 → 3.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +35 -0
  2. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/_virtual/arrayLikeToArray.js +7 -0
  4. package/dist/_virtual/arrayLikeToArray.js.map +1 -0
  5. package/dist/_virtual/arrayLikeToArray2.js +4 -0
  6. package/dist/_virtual/arrayLikeToArray2.js.map +1 -0
  7. package/dist/_virtual/arrayWithoutHoles.js +7 -0
  8. package/dist/_virtual/arrayWithoutHoles.js.map +1 -0
  9. package/dist/_virtual/arrayWithoutHoles2.js +4 -0
  10. package/dist/_virtual/arrayWithoutHoles2.js.map +1 -0
  11. package/dist/_virtual/assertThisInitialized.js +7 -0
  12. package/dist/_virtual/assertThisInitialized.js.map +1 -0
  13. package/dist/_virtual/assertThisInitialized2.js +4 -0
  14. package/dist/_virtual/assertThisInitialized2.js.map +1 -0
  15. package/dist/_virtual/classCallCheck.js +4 -0
  16. package/dist/_virtual/classCallCheck.js.map +1 -0
  17. package/dist/_virtual/createClass.js +4 -0
  18. package/dist/_virtual/createClass.js.map +1 -0
  19. package/dist/_virtual/createSuper.js +4 -0
  20. package/dist/_virtual/createSuper.js.map +1 -0
  21. package/dist/_virtual/defineProperty.js +4 -0
  22. package/dist/_virtual/defineProperty.js.map +1 -0
  23. package/dist/_virtual/defineProperty2.js +7 -0
  24. package/dist/_virtual/defineProperty2.js.map +1 -0
  25. package/dist/_virtual/getPrototypeOf.js +7 -0
  26. package/dist/_virtual/getPrototypeOf.js.map +1 -0
  27. package/dist/_virtual/getPrototypeOf2.js +4 -0
  28. package/dist/_virtual/getPrototypeOf2.js.map +1 -0
  29. package/dist/_virtual/index.esm.js +7 -0
  30. package/dist/_virtual/index.esm.js.map +1 -0
  31. package/dist/_virtual/index.js +4 -0
  32. package/dist/_virtual/index.js.map +1 -0
  33. package/dist/_virtual/inherits.js +4 -0
  34. package/dist/_virtual/inherits.js.map +1 -0
  35. package/dist/_virtual/isNativeReflectConstruct.js +7 -0
  36. package/dist/_virtual/isNativeReflectConstruct.js.map +1 -0
  37. package/dist/_virtual/isNativeReflectConstruct2.js +4 -0
  38. package/dist/_virtual/isNativeReflectConstruct2.js.map +1 -0
  39. package/dist/_virtual/iterableToArray.js +7 -0
  40. package/dist/_virtual/iterableToArray.js.map +1 -0
  41. package/dist/_virtual/iterableToArray2.js +4 -0
  42. package/dist/_virtual/iterableToArray2.js.map +1 -0
  43. package/dist/_virtual/nonIterableSpread.js +7 -0
  44. package/dist/_virtual/nonIterableSpread.js.map +1 -0
  45. package/dist/_virtual/nonIterableSpread2.js +4 -0
  46. package/dist/_virtual/nonIterableSpread2.js.map +1 -0
  47. package/dist/_virtual/objectSpread2.js +4 -0
  48. package/dist/_virtual/objectSpread2.js.map +1 -0
  49. package/dist/_virtual/possibleConstructorReturn.js +7 -0
  50. package/dist/_virtual/possibleConstructorReturn.js.map +1 -0
  51. package/dist/_virtual/possibleConstructorReturn2.js +4 -0
  52. package/dist/_virtual/possibleConstructorReturn2.js.map +1 -0
  53. package/dist/_virtual/runtime.esm.js +7 -0
  54. package/dist/_virtual/runtime.esm.js.map +1 -0
  55. package/dist/_virtual/setPrototypeOf.js +7 -0
  56. package/dist/_virtual/setPrototypeOf.js.map +1 -0
  57. package/dist/_virtual/setPrototypeOf2.js +4 -0
  58. package/dist/_virtual/setPrototypeOf2.js.map +1 -0
  59. package/dist/_virtual/toConsumableArray.js +4 -0
  60. package/dist/_virtual/toConsumableArray.js.map +1 -0
  61. package/dist/_virtual/typeof.js +4 -0
  62. package/dist/_virtual/typeof.js.map +1 -0
  63. package/dist/_virtual/typeof2.js +7 -0
  64. package/dist/_virtual/typeof2.js.map +1 -0
  65. package/dist/_virtual/unsupportedIterableToArray.js +7 -0
  66. package/dist/_virtual/unsupportedIterableToArray.js.map +1 -0
  67. package/dist/_virtual/unsupportedIterableToArray2.js +4 -0
  68. package/dist/_virtual/unsupportedIterableToArray2.js.map +1 -0
  69. package/dist/components/virtual-list/index.d.ts +29 -0
  70. package/dist/components/virtual-list/index.js.map +1 -1
  71. package/dist/components/virtual-list/react/index.js +1 -1
  72. package/dist/components/virtual-list/react/list.js +1 -1
  73. package/dist/components/virtual-list/utils.js +4 -3
  74. package/dist/components/virtual-list/utils.js.map +1 -1
  75. package/dist/components/virtual-list/vue/render.js +3 -2
  76. package/dist/components/virtual-list/vue/render.js.map +1 -1
  77. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +21 -0
  78. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +1 -0
  79. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +20 -0
  80. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.map +1 -0
  81. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/assertThisInitialized.js +19 -0
  82. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/assertThisInitialized.js.map +1 -0
  83. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/classCallCheck.js +17 -0
  84. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/classCallCheck.js.map +1 -0
  85. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createClass.js +30 -0
  86. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createClass.js.map +1 -0
  87. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createSuper.js +43 -0
  88. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createSuper.js.map +1 -0
  89. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/defineProperty.js +26 -0
  90. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/defineProperty.js.map +1 -0
  91. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/getPrototypeOf.js +18 -0
  92. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/getPrototypeOf.js.map +1 -0
  93. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/inherits.js +34 -0
  94. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/inherits.js.map +1 -0
  95. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +24 -0
  96. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js.map +1 -0
  97. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/iterableToArray.js +15 -0
  98. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/iterableToArray.js.map +1 -0
  99. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/nonIterableSpread.js +15 -0
  100. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/nonIterableSpread.js.map +1 -0
  101. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/objectSpread2.js +42 -0
  102. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/objectSpread2.js.map +1 -0
  103. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +31 -0
  104. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js.map +1 -0
  105. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/setPrototypeOf.js +19 -0
  106. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/setPrototypeOf.js.map +1 -0
  107. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/toConsumableArray.js +35 -0
  108. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/toConsumableArray.js.map +1 -0
  109. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/typeof.js +21 -0
  110. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/typeof.js.map +1 -0
  111. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +25 -0
  112. package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +1 -0
  113. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_reactivity@3.2.37/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +1252 -0
  114. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_reactivity@3.2.37/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js.map +1 -0
  115. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_runtime-core@3.2.37/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +7856 -0
  116. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_runtime-core@3.2.37/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js.map +1 -0
  117. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_runtime-dom@3.2.37/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1702 -0
  118. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_runtime-dom@3.2.37/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js.map +1 -0
  119. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_shared@3.2.37/node_modules/@vue/shared/dist/shared.esm-bundler.js +597 -0
  120. package/dist/node_modules/.pnpm/registry.npmjs.org_@vue_shared@3.2.37/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +1 -0
  121. package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js +221 -0
  122. package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js.map +1 -0
  123. package/dist/node_modules/.pnpm/registry.npmjs.org_vue@3.2.37/node_modules/vue/dist/vue.runtime.esm-bundler.js +24 -0
  124. package/dist/node_modules/.pnpm/registry.npmjs.org_vue@3.2.37/node_modules/vue/dist/vue.runtime.esm-bundler.js.map +1 -0
  125. package/dist/packages/taro/index.js +23 -0
  126. package/dist/packages/taro/index.js.map +1 -0
  127. package/dist/packages/taro-api/dist/index.esm.js +861 -0
  128. package/dist/packages/taro-api/dist/index.esm.js.map +1 -0
  129. package/dist/packages/taro-runtime/dist/runtime.esm.js +4107 -0
  130. package/dist/packages/taro-runtime/dist/runtime.esm.js.map +1 -0
  131. package/dist/utils/timer.js +4 -4
  132. package/dist/utils/timer.js.map +1 -1
  133. package/package.json +4 -4
@@ -0,0 +1,1252 @@
1
+ import { extend, isArray, isMap, isIntegerKey, makeMap, isSymbol, hasOwn, isObject, hasChanged, capitalize, toRawType, def, isFunction, NOOP } from '../../../../../registry.npmjs.org_@vue_shared@3.2.37/node_modules/@vue/shared/dist/shared.esm-bundler.js';
2
+
3
+ function warn(msg, ...args) {
4
+ console.warn(`[Vue warn] ${msg}`, ...args);
5
+ }
6
+
7
+ let activeEffectScope;
8
+ class EffectScope {
9
+ constructor(detached = false) {
10
+ /**
11
+ * @internal
12
+ */
13
+ this.active = true;
14
+ /**
15
+ * @internal
16
+ */
17
+ this.effects = [];
18
+ /**
19
+ * @internal
20
+ */
21
+ this.cleanups = [];
22
+ if (!detached && activeEffectScope) {
23
+ this.parent = activeEffectScope;
24
+ this.index =
25
+ (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
26
+ }
27
+ }
28
+ run(fn) {
29
+ if (this.active) {
30
+ const currentEffectScope = activeEffectScope;
31
+ try {
32
+ activeEffectScope = this;
33
+ return fn();
34
+ }
35
+ finally {
36
+ activeEffectScope = currentEffectScope;
37
+ }
38
+ }
39
+ else if ((process.env.NODE_ENV !== 'production')) {
40
+ warn(`cannot run an inactive effect scope.`);
41
+ }
42
+ }
43
+ /**
44
+ * This should only be called on non-detached scopes
45
+ * @internal
46
+ */
47
+ on() {
48
+ activeEffectScope = this;
49
+ }
50
+ /**
51
+ * This should only be called on non-detached scopes
52
+ * @internal
53
+ */
54
+ off() {
55
+ activeEffectScope = this.parent;
56
+ }
57
+ stop(fromParent) {
58
+ if (this.active) {
59
+ let i, l;
60
+ for (i = 0, l = this.effects.length; i < l; i++) {
61
+ this.effects[i].stop();
62
+ }
63
+ for (i = 0, l = this.cleanups.length; i < l; i++) {
64
+ this.cleanups[i]();
65
+ }
66
+ if (this.scopes) {
67
+ for (i = 0, l = this.scopes.length; i < l; i++) {
68
+ this.scopes[i].stop(true);
69
+ }
70
+ }
71
+ // nested scope, dereference from parent to avoid memory leaks
72
+ if (this.parent && !fromParent) {
73
+ // optimized O(1) removal
74
+ const last = this.parent.scopes.pop();
75
+ if (last && last !== this) {
76
+ this.parent.scopes[this.index] = last;
77
+ last.index = this.index;
78
+ }
79
+ }
80
+ this.active = false;
81
+ }
82
+ }
83
+ }
84
+ function effectScope(detached) {
85
+ return new EffectScope(detached);
86
+ }
87
+ function recordEffectScope(effect, scope = activeEffectScope) {
88
+ if (scope && scope.active) {
89
+ scope.effects.push(effect);
90
+ }
91
+ }
92
+ function getCurrentScope() {
93
+ return activeEffectScope;
94
+ }
95
+ function onScopeDispose(fn) {
96
+ if (activeEffectScope) {
97
+ activeEffectScope.cleanups.push(fn);
98
+ }
99
+ else if ((process.env.NODE_ENV !== 'production')) {
100
+ warn(`onScopeDispose() is called when there is no active effect scope` +
101
+ ` to be associated with.`);
102
+ }
103
+ }
104
+
105
+ const createDep = (effects) => {
106
+ const dep = new Set(effects);
107
+ dep.w = 0;
108
+ dep.n = 0;
109
+ return dep;
110
+ };
111
+ const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
112
+ const newTracked = (dep) => (dep.n & trackOpBit) > 0;
113
+ const initDepMarkers = ({ deps }) => {
114
+ if (deps.length) {
115
+ for (let i = 0; i < deps.length; i++) {
116
+ deps[i].w |= trackOpBit; // set was tracked
117
+ }
118
+ }
119
+ };
120
+ const finalizeDepMarkers = (effect) => {
121
+ const { deps } = effect;
122
+ if (deps.length) {
123
+ let ptr = 0;
124
+ for (let i = 0; i < deps.length; i++) {
125
+ const dep = deps[i];
126
+ if (wasTracked(dep) && !newTracked(dep)) {
127
+ dep.delete(effect);
128
+ }
129
+ else {
130
+ deps[ptr++] = dep;
131
+ }
132
+ // clear bits
133
+ dep.w &= ~trackOpBit;
134
+ dep.n &= ~trackOpBit;
135
+ }
136
+ deps.length = ptr;
137
+ }
138
+ };
139
+
140
+ const targetMap = new WeakMap();
141
+ // The number of effects currently being tracked recursively.
142
+ let effectTrackDepth = 0;
143
+ let trackOpBit = 1;
144
+ /**
145
+ * The bitwise track markers support at most 30 levels of recursion.
146
+ * This value is chosen to enable modern JS engines to use a SMI on all platforms.
147
+ * When recursion depth is greater, fall back to using a full cleanup.
148
+ */
149
+ const maxMarkerBits = 30;
150
+ let activeEffect;
151
+ const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
152
+ const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
153
+ class ReactiveEffect {
154
+ constructor(fn, scheduler = null, scope) {
155
+ this.fn = fn;
156
+ this.scheduler = scheduler;
157
+ this.active = true;
158
+ this.deps = [];
159
+ this.parent = undefined;
160
+ recordEffectScope(this, scope);
161
+ }
162
+ run() {
163
+ if (!this.active) {
164
+ return this.fn();
165
+ }
166
+ let parent = activeEffect;
167
+ let lastShouldTrack = shouldTrack;
168
+ while (parent) {
169
+ if (parent === this) {
170
+ return;
171
+ }
172
+ parent = parent.parent;
173
+ }
174
+ try {
175
+ this.parent = activeEffect;
176
+ activeEffect = this;
177
+ shouldTrack = true;
178
+ trackOpBit = 1 << ++effectTrackDepth;
179
+ if (effectTrackDepth <= maxMarkerBits) {
180
+ initDepMarkers(this);
181
+ }
182
+ else {
183
+ cleanupEffect(this);
184
+ }
185
+ return this.fn();
186
+ }
187
+ finally {
188
+ if (effectTrackDepth <= maxMarkerBits) {
189
+ finalizeDepMarkers(this);
190
+ }
191
+ trackOpBit = 1 << --effectTrackDepth;
192
+ activeEffect = this.parent;
193
+ shouldTrack = lastShouldTrack;
194
+ this.parent = undefined;
195
+ if (this.deferStop) {
196
+ this.stop();
197
+ }
198
+ }
199
+ }
200
+ stop() {
201
+ // stopped while running itself - defer the cleanup
202
+ if (activeEffect === this) {
203
+ this.deferStop = true;
204
+ }
205
+ else if (this.active) {
206
+ cleanupEffect(this);
207
+ if (this.onStop) {
208
+ this.onStop();
209
+ }
210
+ this.active = false;
211
+ }
212
+ }
213
+ }
214
+ function cleanupEffect(effect) {
215
+ const { deps } = effect;
216
+ if (deps.length) {
217
+ for (let i = 0; i < deps.length; i++) {
218
+ deps[i].delete(effect);
219
+ }
220
+ deps.length = 0;
221
+ }
222
+ }
223
+ function effect(fn, options) {
224
+ if (fn.effect) {
225
+ fn = fn.effect.fn;
226
+ }
227
+ const _effect = new ReactiveEffect(fn);
228
+ if (options) {
229
+ extend(_effect, options);
230
+ if (options.scope)
231
+ recordEffectScope(_effect, options.scope);
232
+ }
233
+ if (!options || !options.lazy) {
234
+ _effect.run();
235
+ }
236
+ const runner = _effect.run.bind(_effect);
237
+ runner.effect = _effect;
238
+ return runner;
239
+ }
240
+ function stop(runner) {
241
+ runner.effect.stop();
242
+ }
243
+ let shouldTrack = true;
244
+ const trackStack = [];
245
+ function pauseTracking() {
246
+ trackStack.push(shouldTrack);
247
+ shouldTrack = false;
248
+ }
249
+ function enableTracking() {
250
+ trackStack.push(shouldTrack);
251
+ shouldTrack = true;
252
+ }
253
+ function resetTracking() {
254
+ const last = trackStack.pop();
255
+ shouldTrack = last === undefined ? true : last;
256
+ }
257
+ function track(target, type, key) {
258
+ if (shouldTrack && activeEffect) {
259
+ let depsMap = targetMap.get(target);
260
+ if (!depsMap) {
261
+ targetMap.set(target, (depsMap = new Map()));
262
+ }
263
+ let dep = depsMap.get(key);
264
+ if (!dep) {
265
+ depsMap.set(key, (dep = createDep()));
266
+ }
267
+ const eventInfo = (process.env.NODE_ENV !== 'production')
268
+ ? { effect: activeEffect, target, type, key }
269
+ : undefined;
270
+ trackEffects(dep, eventInfo);
271
+ }
272
+ }
273
+ function trackEffects(dep, debuggerEventExtraInfo) {
274
+ let shouldTrack = false;
275
+ if (effectTrackDepth <= maxMarkerBits) {
276
+ if (!newTracked(dep)) {
277
+ dep.n |= trackOpBit; // set newly tracked
278
+ shouldTrack = !wasTracked(dep);
279
+ }
280
+ }
281
+ else {
282
+ // Full cleanup mode.
283
+ shouldTrack = !dep.has(activeEffect);
284
+ }
285
+ if (shouldTrack) {
286
+ dep.add(activeEffect);
287
+ activeEffect.deps.push(dep);
288
+ if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
289
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
290
+ }
291
+ }
292
+ }
293
+ function trigger(target, type, key, newValue, oldValue, oldTarget) {
294
+ const depsMap = targetMap.get(target);
295
+ if (!depsMap) {
296
+ // never been tracked
297
+ return;
298
+ }
299
+ let deps = [];
300
+ if (type === "clear" /* CLEAR */) {
301
+ // collection being cleared
302
+ // trigger all effects for target
303
+ deps = [...depsMap.values()];
304
+ }
305
+ else if (key === 'length' && isArray(target)) {
306
+ depsMap.forEach((dep, key) => {
307
+ if (key === 'length' || key >= newValue) {
308
+ deps.push(dep);
309
+ }
310
+ });
311
+ }
312
+ else {
313
+ // schedule runs for SET | ADD | DELETE
314
+ if (key !== void 0) {
315
+ deps.push(depsMap.get(key));
316
+ }
317
+ // also run for iteration key on ADD | DELETE | Map.SET
318
+ switch (type) {
319
+ case "add" /* ADD */:
320
+ if (!isArray(target)) {
321
+ deps.push(depsMap.get(ITERATE_KEY));
322
+ if (isMap(target)) {
323
+ deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
324
+ }
325
+ }
326
+ else if (isIntegerKey(key)) {
327
+ // new index added to array -> length changes
328
+ deps.push(depsMap.get('length'));
329
+ }
330
+ break;
331
+ case "delete" /* DELETE */:
332
+ if (!isArray(target)) {
333
+ deps.push(depsMap.get(ITERATE_KEY));
334
+ if (isMap(target)) {
335
+ deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
336
+ }
337
+ }
338
+ break;
339
+ case "set" /* SET */:
340
+ if (isMap(target)) {
341
+ deps.push(depsMap.get(ITERATE_KEY));
342
+ }
343
+ break;
344
+ }
345
+ }
346
+ const eventInfo = (process.env.NODE_ENV !== 'production')
347
+ ? { target, type, key, newValue, oldValue, oldTarget }
348
+ : undefined;
349
+ if (deps.length === 1) {
350
+ if (deps[0]) {
351
+ if ((process.env.NODE_ENV !== 'production')) {
352
+ triggerEffects(deps[0], eventInfo);
353
+ }
354
+ else {
355
+ triggerEffects(deps[0]);
356
+ }
357
+ }
358
+ }
359
+ else {
360
+ const effects = [];
361
+ for (const dep of deps) {
362
+ if (dep) {
363
+ effects.push(...dep);
364
+ }
365
+ }
366
+ if ((process.env.NODE_ENV !== 'production')) {
367
+ triggerEffects(createDep(effects), eventInfo);
368
+ }
369
+ else {
370
+ triggerEffects(createDep(effects));
371
+ }
372
+ }
373
+ }
374
+ function triggerEffects(dep, debuggerEventExtraInfo) {
375
+ // spread into array for stabilization
376
+ const effects = isArray(dep) ? dep : [...dep];
377
+ for (const effect of effects) {
378
+ if (effect.computed) {
379
+ triggerEffect(effect, debuggerEventExtraInfo);
380
+ }
381
+ }
382
+ for (const effect of effects) {
383
+ if (!effect.computed) {
384
+ triggerEffect(effect, debuggerEventExtraInfo);
385
+ }
386
+ }
387
+ }
388
+ function triggerEffect(effect, debuggerEventExtraInfo) {
389
+ if (effect !== activeEffect || effect.allowRecurse) {
390
+ if ((process.env.NODE_ENV !== 'production') && effect.onTrigger) {
391
+ effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
392
+ }
393
+ if (effect.scheduler) {
394
+ effect.scheduler();
395
+ }
396
+ else {
397
+ effect.run();
398
+ }
399
+ }
400
+ }
401
+
402
+ const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
403
+ const builtInSymbols = new Set(
404
+ /*#__PURE__*/
405
+ Object.getOwnPropertyNames(Symbol)
406
+ // ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
407
+ // but accessing them on Symbol leads to TypeError because Symbol is a strict mode
408
+ // function
409
+ .filter(key => key !== 'arguments' && key !== 'caller')
410
+ .map(key => Symbol[key])
411
+ .filter(isSymbol));
412
+ const get = /*#__PURE__*/ createGetter();
413
+ const shallowGet = /*#__PURE__*/ createGetter(false, true);
414
+ const readonlyGet = /*#__PURE__*/ createGetter(true);
415
+ const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
416
+ const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
417
+ function createArrayInstrumentations() {
418
+ const instrumentations = {};
419
+ ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
420
+ instrumentations[key] = function (...args) {
421
+ const arr = toRaw(this);
422
+ for (let i = 0, l = this.length; i < l; i++) {
423
+ track(arr, "get" /* GET */, i + '');
424
+ }
425
+ // we run the method using the original args first (which may be reactive)
426
+ const res = arr[key](...args);
427
+ if (res === -1 || res === false) {
428
+ // if that didn't work, run it again using raw values.
429
+ return arr[key](...args.map(toRaw));
430
+ }
431
+ else {
432
+ return res;
433
+ }
434
+ };
435
+ });
436
+ ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
437
+ instrumentations[key] = function (...args) {
438
+ pauseTracking();
439
+ const res = toRaw(this)[key].apply(this, args);
440
+ resetTracking();
441
+ return res;
442
+ };
443
+ });
444
+ return instrumentations;
445
+ }
446
+ function createGetter(isReadonly = false, shallow = false) {
447
+ return function get(target, key, receiver) {
448
+ if (key === "__v_isReactive" /* IS_REACTIVE */) {
449
+ return !isReadonly;
450
+ }
451
+ else if (key === "__v_isReadonly" /* IS_READONLY */) {
452
+ return isReadonly;
453
+ }
454
+ else if (key === "__v_isShallow" /* IS_SHALLOW */) {
455
+ return shallow;
456
+ }
457
+ else if (key === "__v_raw" /* RAW */ &&
458
+ receiver ===
459
+ (isReadonly
460
+ ? shallow
461
+ ? shallowReadonlyMap
462
+ : readonlyMap
463
+ : shallow
464
+ ? shallowReactiveMap
465
+ : reactiveMap).get(target)) {
466
+ return target;
467
+ }
468
+ const targetIsArray = isArray(target);
469
+ if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
470
+ return Reflect.get(arrayInstrumentations, key, receiver);
471
+ }
472
+ const res = Reflect.get(target, key, receiver);
473
+ if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
474
+ return res;
475
+ }
476
+ if (!isReadonly) {
477
+ track(target, "get" /* GET */, key);
478
+ }
479
+ if (shallow) {
480
+ return res;
481
+ }
482
+ if (isRef(res)) {
483
+ // ref unwrapping - skip unwrap for Array + integer key.
484
+ return targetIsArray && isIntegerKey(key) ? res : res.value;
485
+ }
486
+ if (isObject(res)) {
487
+ // Convert returned value into a proxy as well. we do the isObject check
488
+ // here to avoid invalid value warning. Also need to lazy access readonly
489
+ // and reactive here to avoid circular dependency.
490
+ return isReadonly ? readonly(res) : reactive(res);
491
+ }
492
+ return res;
493
+ };
494
+ }
495
+ const set = /*#__PURE__*/ createSetter();
496
+ const shallowSet = /*#__PURE__*/ createSetter(true);
497
+ function createSetter(shallow = false) {
498
+ return function set(target, key, value, receiver) {
499
+ let oldValue = target[key];
500
+ if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
501
+ return false;
502
+ }
503
+ if (!shallow && !isReadonly(value)) {
504
+ if (!isShallow(value)) {
505
+ value = toRaw(value);
506
+ oldValue = toRaw(oldValue);
507
+ }
508
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
509
+ oldValue.value = value;
510
+ return true;
511
+ }
512
+ }
513
+ const hadKey = isArray(target) && isIntegerKey(key)
514
+ ? Number(key) < target.length
515
+ : hasOwn(target, key);
516
+ const result = Reflect.set(target, key, value, receiver);
517
+ // don't trigger if target is something up in the prototype chain of original
518
+ if (target === toRaw(receiver)) {
519
+ if (!hadKey) {
520
+ trigger(target, "add" /* ADD */, key, value);
521
+ }
522
+ else if (hasChanged(value, oldValue)) {
523
+ trigger(target, "set" /* SET */, key, value, oldValue);
524
+ }
525
+ }
526
+ return result;
527
+ };
528
+ }
529
+ function deleteProperty(target, key) {
530
+ const hadKey = hasOwn(target, key);
531
+ const oldValue = target[key];
532
+ const result = Reflect.deleteProperty(target, key);
533
+ if (result && hadKey) {
534
+ trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
535
+ }
536
+ return result;
537
+ }
538
+ function has(target, key) {
539
+ const result = Reflect.has(target, key);
540
+ if (!isSymbol(key) || !builtInSymbols.has(key)) {
541
+ track(target, "has" /* HAS */, key);
542
+ }
543
+ return result;
544
+ }
545
+ function ownKeys(target) {
546
+ track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
547
+ return Reflect.ownKeys(target);
548
+ }
549
+ const mutableHandlers = {
550
+ get,
551
+ set,
552
+ deleteProperty,
553
+ has,
554
+ ownKeys
555
+ };
556
+ const readonlyHandlers = {
557
+ get: readonlyGet,
558
+ set(target, key) {
559
+ if ((process.env.NODE_ENV !== 'production')) {
560
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
561
+ }
562
+ return true;
563
+ },
564
+ deleteProperty(target, key) {
565
+ if ((process.env.NODE_ENV !== 'production')) {
566
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
567
+ }
568
+ return true;
569
+ }
570
+ };
571
+ const shallowReactiveHandlers = /*#__PURE__*/ extend({}, mutableHandlers, {
572
+ get: shallowGet,
573
+ set: shallowSet
574
+ });
575
+ // Props handlers are special in the sense that it should not unwrap top-level
576
+ // refs (in order to allow refs to be explicitly passed down), but should
577
+ // retain the reactivity of the normal readonly object.
578
+ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
579
+ get: shallowReadonlyGet
580
+ });
581
+
582
+ const toShallow = (value) => value;
583
+ const getProto = (v) => Reflect.getPrototypeOf(v);
584
+ function get$1(target, key, isReadonly = false, isShallow = false) {
585
+ // #1772: readonly(reactive(Map)) should return readonly + reactive version
586
+ // of the value
587
+ target = target["__v_raw" /* RAW */];
588
+ const rawTarget = toRaw(target);
589
+ const rawKey = toRaw(key);
590
+ if (!isReadonly) {
591
+ if (key !== rawKey) {
592
+ track(rawTarget, "get" /* GET */, key);
593
+ }
594
+ track(rawTarget, "get" /* GET */, rawKey);
595
+ }
596
+ const { has } = getProto(rawTarget);
597
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
598
+ if (has.call(rawTarget, key)) {
599
+ return wrap(target.get(key));
600
+ }
601
+ else if (has.call(rawTarget, rawKey)) {
602
+ return wrap(target.get(rawKey));
603
+ }
604
+ else if (target !== rawTarget) {
605
+ // #3602 readonly(reactive(Map))
606
+ // ensure that the nested reactive `Map` can do tracking for itself
607
+ target.get(key);
608
+ }
609
+ }
610
+ function has$1(key, isReadonly = false) {
611
+ const target = this["__v_raw" /* RAW */];
612
+ const rawTarget = toRaw(target);
613
+ const rawKey = toRaw(key);
614
+ if (!isReadonly) {
615
+ if (key !== rawKey) {
616
+ track(rawTarget, "has" /* HAS */, key);
617
+ }
618
+ track(rawTarget, "has" /* HAS */, rawKey);
619
+ }
620
+ return key === rawKey
621
+ ? target.has(key)
622
+ : target.has(key) || target.has(rawKey);
623
+ }
624
+ function size(target, isReadonly = false) {
625
+ target = target["__v_raw" /* RAW */];
626
+ !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
627
+ return Reflect.get(target, 'size', target);
628
+ }
629
+ function add(value) {
630
+ value = toRaw(value);
631
+ const target = toRaw(this);
632
+ const proto = getProto(target);
633
+ const hadKey = proto.has.call(target, value);
634
+ if (!hadKey) {
635
+ target.add(value);
636
+ trigger(target, "add" /* ADD */, value, value);
637
+ }
638
+ return this;
639
+ }
640
+ function set$1(key, value) {
641
+ value = toRaw(value);
642
+ const target = toRaw(this);
643
+ const { has, get } = getProto(target);
644
+ let hadKey = has.call(target, key);
645
+ if (!hadKey) {
646
+ key = toRaw(key);
647
+ hadKey = has.call(target, key);
648
+ }
649
+ else if ((process.env.NODE_ENV !== 'production')) {
650
+ checkIdentityKeys(target, has, key);
651
+ }
652
+ const oldValue = get.call(target, key);
653
+ target.set(key, value);
654
+ if (!hadKey) {
655
+ trigger(target, "add" /* ADD */, key, value);
656
+ }
657
+ else if (hasChanged(value, oldValue)) {
658
+ trigger(target, "set" /* SET */, key, value, oldValue);
659
+ }
660
+ return this;
661
+ }
662
+ function deleteEntry(key) {
663
+ const target = toRaw(this);
664
+ const { has, get } = getProto(target);
665
+ let hadKey = has.call(target, key);
666
+ if (!hadKey) {
667
+ key = toRaw(key);
668
+ hadKey = has.call(target, key);
669
+ }
670
+ else if ((process.env.NODE_ENV !== 'production')) {
671
+ checkIdentityKeys(target, has, key);
672
+ }
673
+ const oldValue = get ? get.call(target, key) : undefined;
674
+ // forward the operation before queueing reactions
675
+ const result = target.delete(key);
676
+ if (hadKey) {
677
+ trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
678
+ }
679
+ return result;
680
+ }
681
+ function clear() {
682
+ const target = toRaw(this);
683
+ const hadItems = target.size !== 0;
684
+ const oldTarget = (process.env.NODE_ENV !== 'production')
685
+ ? isMap(target)
686
+ ? new Map(target)
687
+ : new Set(target)
688
+ : undefined;
689
+ // forward the operation before queueing reactions
690
+ const result = target.clear();
691
+ if (hadItems) {
692
+ trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
693
+ }
694
+ return result;
695
+ }
696
+ function createForEach(isReadonly, isShallow) {
697
+ return function forEach(callback, thisArg) {
698
+ const observed = this;
699
+ const target = observed["__v_raw" /* RAW */];
700
+ const rawTarget = toRaw(target);
701
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
702
+ !isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
703
+ return target.forEach((value, key) => {
704
+ // important: make sure the callback is
705
+ // 1. invoked with the reactive map as `this` and 3rd arg
706
+ // 2. the value received should be a corresponding reactive/readonly.
707
+ return callback.call(thisArg, wrap(value), wrap(key), observed);
708
+ });
709
+ };
710
+ }
711
+ function createIterableMethod(method, isReadonly, isShallow) {
712
+ return function (...args) {
713
+ const target = this["__v_raw" /* RAW */];
714
+ const rawTarget = toRaw(target);
715
+ const targetIsMap = isMap(rawTarget);
716
+ const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
717
+ const isKeyOnly = method === 'keys' && targetIsMap;
718
+ const innerIterator = target[method](...args);
719
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
720
+ !isReadonly &&
721
+ track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
722
+ // return a wrapped iterator which returns observed versions of the
723
+ // values emitted from the real iterator
724
+ return {
725
+ // iterator protocol
726
+ next() {
727
+ const { value, done } = innerIterator.next();
728
+ return done
729
+ ? { value, done }
730
+ : {
731
+ value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
732
+ done
733
+ };
734
+ },
735
+ // iterable protocol
736
+ [Symbol.iterator]() {
737
+ return this;
738
+ }
739
+ };
740
+ };
741
+ }
742
+ function createReadonlyMethod(type) {
743
+ return function (...args) {
744
+ if ((process.env.NODE_ENV !== 'production')) {
745
+ const key = args[0] ? `on key "${args[0]}" ` : ``;
746
+ console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
747
+ }
748
+ return type === "delete" /* DELETE */ ? false : this;
749
+ };
750
+ }
751
+ function createInstrumentations() {
752
+ const mutableInstrumentations = {
753
+ get(key) {
754
+ return get$1(this, key);
755
+ },
756
+ get size() {
757
+ return size(this);
758
+ },
759
+ has: has$1,
760
+ add,
761
+ set: set$1,
762
+ delete: deleteEntry,
763
+ clear,
764
+ forEach: createForEach(false, false)
765
+ };
766
+ const shallowInstrumentations = {
767
+ get(key) {
768
+ return get$1(this, key, false, true);
769
+ },
770
+ get size() {
771
+ return size(this);
772
+ },
773
+ has: has$1,
774
+ add,
775
+ set: set$1,
776
+ delete: deleteEntry,
777
+ clear,
778
+ forEach: createForEach(false, true)
779
+ };
780
+ const readonlyInstrumentations = {
781
+ get(key) {
782
+ return get$1(this, key, true);
783
+ },
784
+ get size() {
785
+ return size(this, true);
786
+ },
787
+ has(key) {
788
+ return has$1.call(this, key, true);
789
+ },
790
+ add: createReadonlyMethod("add" /* ADD */),
791
+ set: createReadonlyMethod("set" /* SET */),
792
+ delete: createReadonlyMethod("delete" /* DELETE */),
793
+ clear: createReadonlyMethod("clear" /* CLEAR */),
794
+ forEach: createForEach(true, false)
795
+ };
796
+ const shallowReadonlyInstrumentations = {
797
+ get(key) {
798
+ return get$1(this, key, true, true);
799
+ },
800
+ get size() {
801
+ return size(this, true);
802
+ },
803
+ has(key) {
804
+ return has$1.call(this, key, true);
805
+ },
806
+ add: createReadonlyMethod("add" /* ADD */),
807
+ set: createReadonlyMethod("set" /* SET */),
808
+ delete: createReadonlyMethod("delete" /* DELETE */),
809
+ clear: createReadonlyMethod("clear" /* CLEAR */),
810
+ forEach: createForEach(true, true)
811
+ };
812
+ const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
813
+ iteratorMethods.forEach(method => {
814
+ mutableInstrumentations[method] = createIterableMethod(method, false, false);
815
+ readonlyInstrumentations[method] = createIterableMethod(method, true, false);
816
+ shallowInstrumentations[method] = createIterableMethod(method, false, true);
817
+ shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
818
+ });
819
+ return [
820
+ mutableInstrumentations,
821
+ readonlyInstrumentations,
822
+ shallowInstrumentations,
823
+ shallowReadonlyInstrumentations
824
+ ];
825
+ }
826
+ const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* #__PURE__*/ createInstrumentations();
827
+ function createInstrumentationGetter(isReadonly, shallow) {
828
+ const instrumentations = shallow
829
+ ? isReadonly
830
+ ? shallowReadonlyInstrumentations
831
+ : shallowInstrumentations
832
+ : isReadonly
833
+ ? readonlyInstrumentations
834
+ : mutableInstrumentations;
835
+ return (target, key, receiver) => {
836
+ if (key === "__v_isReactive" /* IS_REACTIVE */) {
837
+ return !isReadonly;
838
+ }
839
+ else if (key === "__v_isReadonly" /* IS_READONLY */) {
840
+ return isReadonly;
841
+ }
842
+ else if (key === "__v_raw" /* RAW */) {
843
+ return target;
844
+ }
845
+ return Reflect.get(hasOwn(instrumentations, key) && key in target
846
+ ? instrumentations
847
+ : target, key, receiver);
848
+ };
849
+ }
850
+ const mutableCollectionHandlers = {
851
+ get: /*#__PURE__*/ createInstrumentationGetter(false, false)
852
+ };
853
+ const shallowCollectionHandlers = {
854
+ get: /*#__PURE__*/ createInstrumentationGetter(false, true)
855
+ };
856
+ const readonlyCollectionHandlers = {
857
+ get: /*#__PURE__*/ createInstrumentationGetter(true, false)
858
+ };
859
+ const shallowReadonlyCollectionHandlers = {
860
+ get: /*#__PURE__*/ createInstrumentationGetter(true, true)
861
+ };
862
+ function checkIdentityKeys(target, has, key) {
863
+ const rawKey = toRaw(key);
864
+ if (rawKey !== key && has.call(target, rawKey)) {
865
+ const type = toRawType(target);
866
+ console.warn(`Reactive ${type} contains both the raw and reactive ` +
867
+ `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
868
+ `which can lead to inconsistencies. ` +
869
+ `Avoid differentiating between the raw and reactive versions ` +
870
+ `of an object and only use the reactive version if possible.`);
871
+ }
872
+ }
873
+
874
+ const reactiveMap = new WeakMap();
875
+ const shallowReactiveMap = new WeakMap();
876
+ const readonlyMap = new WeakMap();
877
+ const shallowReadonlyMap = new WeakMap();
878
+ function targetTypeMap(rawType) {
879
+ switch (rawType) {
880
+ case 'Object':
881
+ case 'Array':
882
+ return 1 /* COMMON */;
883
+ case 'Map':
884
+ case 'Set':
885
+ case 'WeakMap':
886
+ case 'WeakSet':
887
+ return 2 /* COLLECTION */;
888
+ default:
889
+ return 0 /* INVALID */;
890
+ }
891
+ }
892
+ function getTargetType(value) {
893
+ return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
894
+ ? 0 /* INVALID */
895
+ : targetTypeMap(toRawType(value));
896
+ }
897
+ function reactive(target) {
898
+ // if trying to observe a readonly proxy, return the readonly version.
899
+ if (isReadonly(target)) {
900
+ return target;
901
+ }
902
+ return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
903
+ }
904
+ /**
905
+ * Return a shallowly-reactive copy of the original object, where only the root
906
+ * level properties are reactive. It also does not auto-unwrap refs (even at the
907
+ * root level).
908
+ */
909
+ function shallowReactive(target) {
910
+ return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
911
+ }
912
+ /**
913
+ * Creates a readonly copy of the original object. Note the returned copy is not
914
+ * made reactive, but `readonly` can be called on an already reactive object.
915
+ */
916
+ function readonly(target) {
917
+ return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
918
+ }
919
+ /**
920
+ * Returns a reactive-copy of the original object, where only the root level
921
+ * properties are readonly, and does NOT unwrap refs nor recursively convert
922
+ * returned properties.
923
+ * This is used for creating the props proxy object for stateful components.
924
+ */
925
+ function shallowReadonly(target) {
926
+ return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
927
+ }
928
+ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
929
+ if (!isObject(target)) {
930
+ if ((process.env.NODE_ENV !== 'production')) {
931
+ console.warn(`value cannot be made reactive: ${String(target)}`);
932
+ }
933
+ return target;
934
+ }
935
+ // target is already a Proxy, return it.
936
+ // exception: calling readonly() on a reactive object
937
+ if (target["__v_raw" /* RAW */] &&
938
+ !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
939
+ return target;
940
+ }
941
+ // target already has corresponding Proxy
942
+ const existingProxy = proxyMap.get(target);
943
+ if (existingProxy) {
944
+ return existingProxy;
945
+ }
946
+ // only specific value types can be observed.
947
+ const targetType = getTargetType(target);
948
+ if (targetType === 0 /* INVALID */) {
949
+ return target;
950
+ }
951
+ const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
952
+ proxyMap.set(target, proxy);
953
+ return proxy;
954
+ }
955
+ function isReactive(value) {
956
+ if (isReadonly(value)) {
957
+ return isReactive(value["__v_raw" /* RAW */]);
958
+ }
959
+ return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
960
+ }
961
+ function isReadonly(value) {
962
+ return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
963
+ }
964
+ function isShallow(value) {
965
+ return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
966
+ }
967
+ function isProxy(value) {
968
+ return isReactive(value) || isReadonly(value);
969
+ }
970
+ function toRaw(observed) {
971
+ const raw = observed && observed["__v_raw" /* RAW */];
972
+ return raw ? toRaw(raw) : observed;
973
+ }
974
+ function markRaw(value) {
975
+ def(value, "__v_skip" /* SKIP */, true);
976
+ return value;
977
+ }
978
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
979
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
980
+
981
+ function trackRefValue(ref) {
982
+ if (shouldTrack && activeEffect) {
983
+ ref = toRaw(ref);
984
+ if ((process.env.NODE_ENV !== 'production')) {
985
+ trackEffects(ref.dep || (ref.dep = createDep()), {
986
+ target: ref,
987
+ type: "get" /* GET */,
988
+ key: 'value'
989
+ });
990
+ }
991
+ else {
992
+ trackEffects(ref.dep || (ref.dep = createDep()));
993
+ }
994
+ }
995
+ }
996
+ function triggerRefValue(ref, newVal) {
997
+ ref = toRaw(ref);
998
+ if (ref.dep) {
999
+ if ((process.env.NODE_ENV !== 'production')) {
1000
+ triggerEffects(ref.dep, {
1001
+ target: ref,
1002
+ type: "set" /* SET */,
1003
+ key: 'value',
1004
+ newValue: newVal
1005
+ });
1006
+ }
1007
+ else {
1008
+ triggerEffects(ref.dep);
1009
+ }
1010
+ }
1011
+ }
1012
+ function isRef(r) {
1013
+ return !!(r && r.__v_isRef === true);
1014
+ }
1015
+ function ref(value) {
1016
+ return createRef(value, false);
1017
+ }
1018
+ function shallowRef(value) {
1019
+ return createRef(value, true);
1020
+ }
1021
+ function createRef(rawValue, shallow) {
1022
+ if (isRef(rawValue)) {
1023
+ return rawValue;
1024
+ }
1025
+ return new RefImpl(rawValue, shallow);
1026
+ }
1027
+ class RefImpl {
1028
+ constructor(value, __v_isShallow) {
1029
+ this.__v_isShallow = __v_isShallow;
1030
+ this.dep = undefined;
1031
+ this.__v_isRef = true;
1032
+ this._rawValue = __v_isShallow ? value : toRaw(value);
1033
+ this._value = __v_isShallow ? value : toReactive(value);
1034
+ }
1035
+ get value() {
1036
+ trackRefValue(this);
1037
+ return this._value;
1038
+ }
1039
+ set value(newVal) {
1040
+ newVal = this.__v_isShallow ? newVal : toRaw(newVal);
1041
+ if (hasChanged(newVal, this._rawValue)) {
1042
+ this._rawValue = newVal;
1043
+ this._value = this.__v_isShallow ? newVal : toReactive(newVal);
1044
+ triggerRefValue(this, newVal);
1045
+ }
1046
+ }
1047
+ }
1048
+ function triggerRef(ref) {
1049
+ triggerRefValue(ref, (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
1050
+ }
1051
+ function unref(ref) {
1052
+ return isRef(ref) ? ref.value : ref;
1053
+ }
1054
+ const shallowUnwrapHandlers = {
1055
+ get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1056
+ set: (target, key, value, receiver) => {
1057
+ const oldValue = target[key];
1058
+ if (isRef(oldValue) && !isRef(value)) {
1059
+ oldValue.value = value;
1060
+ return true;
1061
+ }
1062
+ else {
1063
+ return Reflect.set(target, key, value, receiver);
1064
+ }
1065
+ }
1066
+ };
1067
+ function proxyRefs(objectWithRefs) {
1068
+ return isReactive(objectWithRefs)
1069
+ ? objectWithRefs
1070
+ : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1071
+ }
1072
+ class CustomRefImpl {
1073
+ constructor(factory) {
1074
+ this.dep = undefined;
1075
+ this.__v_isRef = true;
1076
+ const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
1077
+ this._get = get;
1078
+ this._set = set;
1079
+ }
1080
+ get value() {
1081
+ return this._get();
1082
+ }
1083
+ set value(newVal) {
1084
+ this._set(newVal);
1085
+ }
1086
+ }
1087
+ function customRef(factory) {
1088
+ return new CustomRefImpl(factory);
1089
+ }
1090
+ function toRefs(object) {
1091
+ if ((process.env.NODE_ENV !== 'production') && !isProxy(object)) {
1092
+ console.warn(`toRefs() expects a reactive object but received a plain one.`);
1093
+ }
1094
+ const ret = isArray(object) ? new Array(object.length) : {};
1095
+ for (const key in object) {
1096
+ ret[key] = toRef(object, key);
1097
+ }
1098
+ return ret;
1099
+ }
1100
+ class ObjectRefImpl {
1101
+ constructor(_object, _key, _defaultValue) {
1102
+ this._object = _object;
1103
+ this._key = _key;
1104
+ this._defaultValue = _defaultValue;
1105
+ this.__v_isRef = true;
1106
+ }
1107
+ get value() {
1108
+ const val = this._object[this._key];
1109
+ return val === undefined ? this._defaultValue : val;
1110
+ }
1111
+ set value(newVal) {
1112
+ this._object[this._key] = newVal;
1113
+ }
1114
+ }
1115
+ function toRef(object, key, defaultValue) {
1116
+ const val = object[key];
1117
+ return isRef(val)
1118
+ ? val
1119
+ : new ObjectRefImpl(object, key, defaultValue);
1120
+ }
1121
+
1122
+ class ComputedRefImpl {
1123
+ constructor(getter, _setter, isReadonly, isSSR) {
1124
+ this._setter = _setter;
1125
+ this.dep = undefined;
1126
+ this.__v_isRef = true;
1127
+ this._dirty = true;
1128
+ this.effect = new ReactiveEffect(getter, () => {
1129
+ if (!this._dirty) {
1130
+ this._dirty = true;
1131
+ triggerRefValue(this);
1132
+ }
1133
+ });
1134
+ this.effect.computed = this;
1135
+ this.effect.active = this._cacheable = !isSSR;
1136
+ this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1137
+ }
1138
+ get value() {
1139
+ // the computed ref may get wrapped by other proxies e.g. readonly() #3376
1140
+ const self = toRaw(this);
1141
+ trackRefValue(self);
1142
+ if (self._dirty || !self._cacheable) {
1143
+ self._dirty = false;
1144
+ self._value = self.effect.run();
1145
+ }
1146
+ return self._value;
1147
+ }
1148
+ set value(newValue) {
1149
+ this._setter(newValue);
1150
+ }
1151
+ }
1152
+ function computed(getterOrOptions, debugOptions, isSSR = false) {
1153
+ let getter;
1154
+ let setter;
1155
+ const onlyGetter = isFunction(getterOrOptions);
1156
+ if (onlyGetter) {
1157
+ getter = getterOrOptions;
1158
+ setter = (process.env.NODE_ENV !== 'production')
1159
+ ? () => {
1160
+ console.warn('Write operation failed: computed value is readonly');
1161
+ }
1162
+ : NOOP;
1163
+ }
1164
+ else {
1165
+ getter = getterOrOptions.get;
1166
+ setter = getterOrOptions.set;
1167
+ }
1168
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1169
+ if ((process.env.NODE_ENV !== 'production') && debugOptions && !isSSR) {
1170
+ cRef.effect.onTrack = debugOptions.onTrack;
1171
+ cRef.effect.onTrigger = debugOptions.onTrigger;
1172
+ }
1173
+ return cRef;
1174
+ }
1175
+
1176
+ var _a;
1177
+ const tick = /*#__PURE__*/ Promise.resolve();
1178
+ const queue = [];
1179
+ let queued = false;
1180
+ const scheduler = (fn) => {
1181
+ queue.push(fn);
1182
+ if (!queued) {
1183
+ queued = true;
1184
+ tick.then(flush);
1185
+ }
1186
+ };
1187
+ const flush = () => {
1188
+ for (let i = 0; i < queue.length; i++) {
1189
+ queue[i]();
1190
+ }
1191
+ queue.length = 0;
1192
+ queued = false;
1193
+ };
1194
+ class DeferredComputedRefImpl {
1195
+ constructor(getter) {
1196
+ this.dep = undefined;
1197
+ this._dirty = true;
1198
+ this.__v_isRef = true;
1199
+ this[_a] = true;
1200
+ let compareTarget;
1201
+ let hasCompareTarget = false;
1202
+ let scheduled = false;
1203
+ this.effect = new ReactiveEffect(getter, (computedTrigger) => {
1204
+ if (this.dep) {
1205
+ if (computedTrigger) {
1206
+ compareTarget = this._value;
1207
+ hasCompareTarget = true;
1208
+ }
1209
+ else if (!scheduled) {
1210
+ const valueToCompare = hasCompareTarget ? compareTarget : this._value;
1211
+ scheduled = true;
1212
+ hasCompareTarget = false;
1213
+ scheduler(() => {
1214
+ if (this.effect.active && this._get() !== valueToCompare) {
1215
+ triggerRefValue(this);
1216
+ }
1217
+ scheduled = false;
1218
+ });
1219
+ }
1220
+ // chained upstream computeds are notified synchronously to ensure
1221
+ // value invalidation in case of sync access; normal effects are
1222
+ // deferred to be triggered in scheduler.
1223
+ for (const e of this.dep) {
1224
+ if (e.computed instanceof DeferredComputedRefImpl) {
1225
+ e.scheduler(true /* computedTrigger */);
1226
+ }
1227
+ }
1228
+ }
1229
+ this._dirty = true;
1230
+ });
1231
+ this.effect.computed = this;
1232
+ }
1233
+ _get() {
1234
+ if (this._dirty) {
1235
+ this._dirty = false;
1236
+ return (this._value = this.effect.run());
1237
+ }
1238
+ return this._value;
1239
+ }
1240
+ get value() {
1241
+ trackRefValue(this);
1242
+ // the computed ref may get wrapped by other proxies e.g. readonly() #3376
1243
+ return toRaw(this)._get();
1244
+ }
1245
+ }
1246
+ _a = "__v_isReadonly" /* IS_READONLY */;
1247
+ function deferredComputed(getter) {
1248
+ return new DeferredComputedRefImpl(getter);
1249
+ }
1250
+
1251
+ export { EffectScope, ITERATE_KEY, ReactiveEffect, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };
1252
+ //# sourceMappingURL=reactivity.esm-bundler.js.map