@vue/server-renderer 3.4.27 → 3.4.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server-renderer.cjs.js +4002 -193
- package/dist/server-renderer.cjs.prod.js +3042 -31
- package/dist/server-renderer.esm-browser.js +520 -511
- package/dist/server-renderer.esm-browser.prod.js +2 -2
- package/dist/server-renderer.esm-bundler.js +4003 -248
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.4.
|
|
2
|
+
* @vue/server-renderer v3.4.28
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { createVNode, ssrContextKey, warn as warn$
|
|
7
|
-
import { isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, makeMap, isArray, toDisplayString, extend,
|
|
6
|
+
import { createVNode as createVNode$1, ssrContextKey as ssrContextKey$1, warn as warn$3, Fragment as Fragment$1, Static, Comment as Comment$1, Text as Text$1, mergeProps as mergeProps$1, ssrUtils as ssrUtils$1, createApp, initDirectivesForSSR } from 'vue';
|
|
7
|
+
import { isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, makeMap, isArray, toDisplayString, extend, isSymbol, isMap, isIntegerKey, hasOwn, hasChanged, isObject, capitalize, toRawType, def, isFunction, NOOP, isPromise, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isModelListener, isBuiltInDirective, NO, isReservedProp, EMPTY_ARR, remove, isSet, isPlainObject, getGlobalThis, looseEqual, looseIndexOf, escapeHtmlComment, isVoidTag } from '@vue/shared';
|
|
8
8
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
9
9
|
|
|
10
10
|
const shouldIgnoreProp = /* @__PURE__ */ makeMap(
|
|
@@ -65,7 +65,7 @@ function ssrRenderStyle(raw) {
|
|
|
65
65
|
|
|
66
66
|
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
|
67
67
|
return renderComponentVNode(
|
|
68
|
-
createVNode(comp, props, children),
|
|
68
|
+
createVNode$1(comp, props, children),
|
|
69
69
|
parentComponent,
|
|
70
70
|
slotScopeId
|
|
71
71
|
);
|
|
@@ -131,19 +131,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
131
131
|
fallbackRenderFn();
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
const commentTestRE =
|
|
134
|
+
const commentTestRE = /^<!--[\s\S]*-->$/;
|
|
135
135
|
const commentRE = /<!--[^]*?-->/gm;
|
|
136
136
|
function isComment(item) {
|
|
137
|
-
if (typeof item !== "string" || !commentTestRE.test(item))
|
|
138
|
-
|
|
139
|
-
if (item.length <= 8)
|
|
140
|
-
return true;
|
|
137
|
+
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
|
138
|
+
if (item.length <= 8) return true;
|
|
141
139
|
return !item.replace(commentRE, "").trim();
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
145
143
|
parentPush("<!--teleport start-->");
|
|
146
|
-
const context = parentComponent.appContext.provides[ssrContextKey];
|
|
144
|
+
const context = parentComponent.appContext.provides[ssrContextKey$1];
|
|
147
145
|
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
148
146
|
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
|
149
147
|
const bufferIndex = targetBuffer.length;
|
|
@@ -165,8 +163,206 @@ function ssrInterpolate(value) {
|
|
|
165
163
|
return escapeHtml(toDisplayString(value));
|
|
166
164
|
}
|
|
167
165
|
|
|
166
|
+
function warn$2(msg, ...args) {
|
|
167
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let activeEffectScope;
|
|
171
|
+
class EffectScope {
|
|
172
|
+
constructor(detached = false) {
|
|
173
|
+
this.detached = detached;
|
|
174
|
+
/**
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
this._active = true;
|
|
178
|
+
/**
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
this.effects = [];
|
|
182
|
+
/**
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
this.cleanups = [];
|
|
186
|
+
this.parent = activeEffectScope;
|
|
187
|
+
if (!detached && activeEffectScope) {
|
|
188
|
+
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
189
|
+
this
|
|
190
|
+
) - 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
get active() {
|
|
194
|
+
return this._active;
|
|
195
|
+
}
|
|
196
|
+
run(fn) {
|
|
197
|
+
if (this._active) {
|
|
198
|
+
const currentEffectScope = activeEffectScope;
|
|
199
|
+
try {
|
|
200
|
+
activeEffectScope = this;
|
|
201
|
+
return fn();
|
|
202
|
+
} finally {
|
|
203
|
+
activeEffectScope = currentEffectScope;
|
|
204
|
+
}
|
|
205
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
206
|
+
warn$2(`cannot run an inactive effect scope.`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* This should only be called on non-detached scopes
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
on() {
|
|
214
|
+
activeEffectScope = this;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* This should only be called on non-detached scopes
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
off() {
|
|
221
|
+
activeEffectScope = this.parent;
|
|
222
|
+
}
|
|
223
|
+
stop(fromParent) {
|
|
224
|
+
if (this._active) {
|
|
225
|
+
let i, l;
|
|
226
|
+
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
227
|
+
this.effects[i].stop();
|
|
228
|
+
}
|
|
229
|
+
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
|
230
|
+
this.cleanups[i]();
|
|
231
|
+
}
|
|
232
|
+
if (this.scopes) {
|
|
233
|
+
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
234
|
+
this.scopes[i].stop(true);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
238
|
+
const last = this.parent.scopes.pop();
|
|
239
|
+
if (last && last !== this) {
|
|
240
|
+
this.parent.scopes[this.index] = last;
|
|
241
|
+
last.index = this.index;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
this.parent = void 0;
|
|
245
|
+
this._active = false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
250
|
+
if (scope && scope.active) {
|
|
251
|
+
scope.effects.push(effect);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function getCurrentScope() {
|
|
255
|
+
return activeEffectScope;
|
|
256
|
+
}
|
|
257
|
+
|
|
168
258
|
let activeEffect;
|
|
259
|
+
class ReactiveEffect {
|
|
260
|
+
constructor(fn, trigger, scheduler, scope) {
|
|
261
|
+
this.fn = fn;
|
|
262
|
+
this.trigger = trigger;
|
|
263
|
+
this.scheduler = scheduler;
|
|
264
|
+
this.active = true;
|
|
265
|
+
this.deps = [];
|
|
266
|
+
/**
|
|
267
|
+
* @internal
|
|
268
|
+
*/
|
|
269
|
+
this._dirtyLevel = 4;
|
|
270
|
+
/**
|
|
271
|
+
* @internal
|
|
272
|
+
*/
|
|
273
|
+
this._trackId = 0;
|
|
274
|
+
/**
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
this._runnings = 0;
|
|
278
|
+
/**
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
this._shouldSchedule = false;
|
|
282
|
+
/**
|
|
283
|
+
* @internal
|
|
284
|
+
*/
|
|
285
|
+
this._depsLength = 0;
|
|
286
|
+
recordEffectScope(this, scope);
|
|
287
|
+
}
|
|
288
|
+
get dirty() {
|
|
289
|
+
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
290
|
+
this._dirtyLevel = 1;
|
|
291
|
+
pauseTracking();
|
|
292
|
+
for (let i = 0; i < this._depsLength; i++) {
|
|
293
|
+
const dep = this.deps[i];
|
|
294
|
+
if (dep.computed) {
|
|
295
|
+
triggerComputed(dep.computed);
|
|
296
|
+
if (this._dirtyLevel >= 4) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (this._dirtyLevel === 1) {
|
|
302
|
+
this._dirtyLevel = 0;
|
|
303
|
+
}
|
|
304
|
+
resetTracking();
|
|
305
|
+
}
|
|
306
|
+
return this._dirtyLevel >= 4;
|
|
307
|
+
}
|
|
308
|
+
set dirty(v) {
|
|
309
|
+
this._dirtyLevel = v ? 4 : 0;
|
|
310
|
+
}
|
|
311
|
+
run() {
|
|
312
|
+
this._dirtyLevel = 0;
|
|
313
|
+
if (!this.active) {
|
|
314
|
+
return this.fn();
|
|
315
|
+
}
|
|
316
|
+
let lastShouldTrack = shouldTrack;
|
|
317
|
+
let lastEffect = activeEffect;
|
|
318
|
+
try {
|
|
319
|
+
shouldTrack = true;
|
|
320
|
+
activeEffect = this;
|
|
321
|
+
this._runnings++;
|
|
322
|
+
preCleanupEffect(this);
|
|
323
|
+
return this.fn();
|
|
324
|
+
} finally {
|
|
325
|
+
postCleanupEffect(this);
|
|
326
|
+
this._runnings--;
|
|
327
|
+
activeEffect = lastEffect;
|
|
328
|
+
shouldTrack = lastShouldTrack;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
stop() {
|
|
332
|
+
if (this.active) {
|
|
333
|
+
preCleanupEffect(this);
|
|
334
|
+
postCleanupEffect(this);
|
|
335
|
+
this.onStop && this.onStop();
|
|
336
|
+
this.active = false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function triggerComputed(computed) {
|
|
341
|
+
return computed.value;
|
|
342
|
+
}
|
|
343
|
+
function preCleanupEffect(effect2) {
|
|
344
|
+
effect2._trackId++;
|
|
345
|
+
effect2._depsLength = 0;
|
|
346
|
+
}
|
|
347
|
+
function postCleanupEffect(effect2) {
|
|
348
|
+
if (effect2.deps.length > effect2._depsLength) {
|
|
349
|
+
for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
|
350
|
+
cleanupDepEffect(effect2.deps[i], effect2);
|
|
351
|
+
}
|
|
352
|
+
effect2.deps.length = effect2._depsLength;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function cleanupDepEffect(dep, effect2) {
|
|
356
|
+
const trackId = dep.get(effect2);
|
|
357
|
+
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
|
358
|
+
dep.delete(effect2);
|
|
359
|
+
if (dep.size === 0) {
|
|
360
|
+
dep.cleanup();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
169
364
|
let shouldTrack = true;
|
|
365
|
+
let pauseScheduleStack = 0;
|
|
170
366
|
const trackStack = [];
|
|
171
367
|
function pauseTracking() {
|
|
172
368
|
trackStack.push(shouldTrack);
|
|
@@ -176,12 +372,24 @@ function resetTracking() {
|
|
|
176
372
|
const last = trackStack.pop();
|
|
177
373
|
shouldTrack = last === void 0 ? true : last;
|
|
178
374
|
}
|
|
375
|
+
function pauseScheduling() {
|
|
376
|
+
pauseScheduleStack++;
|
|
377
|
+
}
|
|
378
|
+
function resetScheduling() {
|
|
379
|
+
pauseScheduleStack--;
|
|
380
|
+
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
|
381
|
+
queueEffectSchedulers.shift()();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
179
384
|
function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
180
385
|
var _a;
|
|
181
386
|
if (dep.get(effect2) !== effect2._trackId) {
|
|
182
387
|
dep.set(effect2, effect2._trackId);
|
|
183
388
|
const oldDep = effect2.deps[effect2._depsLength];
|
|
184
389
|
if (oldDep !== dep) {
|
|
390
|
+
if (oldDep) {
|
|
391
|
+
cleanupDepEffect(oldDep, effect2);
|
|
392
|
+
}
|
|
185
393
|
effect2.deps[effect2._depsLength++] = dep;
|
|
186
394
|
} else {
|
|
187
395
|
effect2._depsLength++;
|
|
@@ -191,6 +399,31 @@ function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
|
191
399
|
}
|
|
192
400
|
}
|
|
193
401
|
}
|
|
402
|
+
const queueEffectSchedulers = [];
|
|
403
|
+
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
|
404
|
+
var _a;
|
|
405
|
+
pauseScheduling();
|
|
406
|
+
for (const effect2 of dep.keys()) {
|
|
407
|
+
let tracking;
|
|
408
|
+
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
|
409
|
+
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
|
|
410
|
+
effect2._dirtyLevel = dirtyLevel;
|
|
411
|
+
}
|
|
412
|
+
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
|
413
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
414
|
+
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
415
|
+
}
|
|
416
|
+
effect2.trigger();
|
|
417
|
+
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
|
|
418
|
+
effect2._shouldSchedule = false;
|
|
419
|
+
if (effect2.scheduler) {
|
|
420
|
+
queueEffectSchedulers.push(effect2.scheduler);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
resetScheduling();
|
|
426
|
+
}
|
|
194
427
|
|
|
195
428
|
const createDep = (cleanup, computed) => {
|
|
196
429
|
const dep = /* @__PURE__ */ new Map();
|
|
@@ -200,8 +433,8 @@ const createDep = (cleanup, computed) => {
|
|
|
200
433
|
};
|
|
201
434
|
|
|
202
435
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
203
|
-
Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
|
|
204
|
-
Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
|
|
436
|
+
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
|
|
437
|
+
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
|
|
205
438
|
function track(target, type, key) {
|
|
206
439
|
if (shouldTrack && activeEffect) {
|
|
207
440
|
let depsMap = targetMap.get(target);
|
|
@@ -223,271 +456,3696 @@ function track(target, type, key) {
|
|
|
223
456
|
);
|
|
224
457
|
}
|
|
225
458
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
459
|
+
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
460
|
+
const depsMap = targetMap.get(target);
|
|
461
|
+
if (!depsMap) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
let deps = [];
|
|
465
|
+
if (type === "clear") {
|
|
466
|
+
deps = [...depsMap.values()];
|
|
467
|
+
} else if (key === "length" && isArray(target)) {
|
|
468
|
+
const newLength = Number(newValue);
|
|
469
|
+
depsMap.forEach((dep, key2) => {
|
|
470
|
+
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
471
|
+
deps.push(dep);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
} else {
|
|
475
|
+
if (key !== void 0) {
|
|
476
|
+
deps.push(depsMap.get(key));
|
|
477
|
+
}
|
|
478
|
+
switch (type) {
|
|
479
|
+
case "add":
|
|
480
|
+
if (!isArray(target)) {
|
|
481
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
482
|
+
if (isMap(target)) {
|
|
483
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
484
|
+
}
|
|
485
|
+
} else if (isIntegerKey(key)) {
|
|
486
|
+
deps.push(depsMap.get("length"));
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
case "delete":
|
|
490
|
+
if (!isArray(target)) {
|
|
491
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
492
|
+
if (isMap(target)) {
|
|
493
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
break;
|
|
497
|
+
case "set":
|
|
498
|
+
if (isMap(target)) {
|
|
499
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
500
|
+
}
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
pauseScheduling();
|
|
505
|
+
for (const dep of deps) {
|
|
506
|
+
if (dep) {
|
|
507
|
+
triggerEffects(
|
|
508
|
+
dep,
|
|
509
|
+
4,
|
|
510
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
511
|
+
target,
|
|
512
|
+
type,
|
|
513
|
+
key,
|
|
514
|
+
newValue,
|
|
515
|
+
oldValue,
|
|
516
|
+
oldTarget
|
|
517
|
+
} : void 0
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
resetScheduling();
|
|
230
522
|
}
|
|
231
523
|
|
|
232
|
-
|
|
233
|
-
|
|
524
|
+
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
525
|
+
const builtInSymbols = new Set(
|
|
526
|
+
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
527
|
+
);
|
|
528
|
+
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
529
|
+
function createArrayInstrumentations() {
|
|
530
|
+
const instrumentations = {};
|
|
531
|
+
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
532
|
+
instrumentations[key] = function(...args) {
|
|
533
|
+
const arr = toRaw(this);
|
|
534
|
+
for (let i = 0, l = this.length; i < l; i++) {
|
|
535
|
+
track(arr, "get", i + "");
|
|
536
|
+
}
|
|
537
|
+
const res = arr[key](...args);
|
|
538
|
+
if (res === -1 || res === false) {
|
|
539
|
+
return arr[key](...args.map(toRaw));
|
|
540
|
+
} else {
|
|
541
|
+
return res;
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
});
|
|
545
|
+
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
546
|
+
instrumentations[key] = function(...args) {
|
|
547
|
+
pauseTracking();
|
|
548
|
+
pauseScheduling();
|
|
549
|
+
const res = toRaw(this)[key].apply(this, args);
|
|
550
|
+
resetScheduling();
|
|
551
|
+
resetTracking();
|
|
552
|
+
return res;
|
|
553
|
+
};
|
|
554
|
+
});
|
|
555
|
+
return instrumentations;
|
|
234
556
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
557
|
+
function hasOwnProperty(key) {
|
|
558
|
+
if (!isSymbol(key)) key = String(key);
|
|
559
|
+
const obj = toRaw(this);
|
|
560
|
+
track(obj, "has", key);
|
|
561
|
+
return obj.hasOwnProperty(key);
|
|
239
562
|
}
|
|
240
|
-
|
|
241
|
-
|
|
563
|
+
class BaseReactiveHandler {
|
|
564
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
565
|
+
this._isReadonly = _isReadonly;
|
|
566
|
+
this._isShallow = _isShallow;
|
|
567
|
+
}
|
|
568
|
+
get(target, key, receiver) {
|
|
569
|
+
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
570
|
+
if (key === "__v_isReactive") {
|
|
571
|
+
return !isReadonly2;
|
|
572
|
+
} else if (key === "__v_isReadonly") {
|
|
573
|
+
return isReadonly2;
|
|
574
|
+
} else if (key === "__v_isShallow") {
|
|
575
|
+
return isShallow2;
|
|
576
|
+
} else if (key === "__v_raw") {
|
|
577
|
+
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
578
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
579
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
580
|
+
return target;
|
|
581
|
+
}
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const targetIsArray = isArray(target);
|
|
585
|
+
if (!isReadonly2) {
|
|
586
|
+
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
|
587
|
+
return Reflect.get(arrayInstrumentations, key, receiver);
|
|
588
|
+
}
|
|
589
|
+
if (key === "hasOwnProperty") {
|
|
590
|
+
return hasOwnProperty;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const res = Reflect.get(target, key, receiver);
|
|
594
|
+
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
595
|
+
return res;
|
|
596
|
+
}
|
|
597
|
+
if (!isReadonly2) {
|
|
598
|
+
track(target, "get", key);
|
|
599
|
+
}
|
|
600
|
+
if (isShallow2) {
|
|
601
|
+
return res;
|
|
602
|
+
}
|
|
603
|
+
if (isRef(res)) {
|
|
604
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
605
|
+
}
|
|
606
|
+
if (isObject(res)) {
|
|
607
|
+
return isReadonly2 ? readonly(res) : reactive(res);
|
|
608
|
+
}
|
|
609
|
+
return res;
|
|
610
|
+
}
|
|
242
611
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
612
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
613
|
+
constructor(isShallow2 = false) {
|
|
614
|
+
super(false, isShallow2);
|
|
615
|
+
}
|
|
616
|
+
set(target, key, value, receiver) {
|
|
617
|
+
let oldValue = target[key];
|
|
618
|
+
if (!this._isShallow) {
|
|
619
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
620
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
621
|
+
oldValue = toRaw(oldValue);
|
|
622
|
+
value = toRaw(value);
|
|
623
|
+
}
|
|
624
|
+
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
625
|
+
if (isOldValueReadonly) {
|
|
626
|
+
return false;
|
|
627
|
+
} else {
|
|
628
|
+
oldValue.value = value;
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
634
|
+
const result = Reflect.set(target, key, value, receiver);
|
|
635
|
+
if (target === toRaw(receiver)) {
|
|
636
|
+
if (!hadKey) {
|
|
637
|
+
trigger(target, "add", key, value);
|
|
638
|
+
} else if (hasChanged(value, oldValue)) {
|
|
639
|
+
trigger(target, "set", key, value, oldValue);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
deleteProperty(target, key) {
|
|
645
|
+
const hadKey = hasOwn(target, key);
|
|
646
|
+
const oldValue = target[key];
|
|
647
|
+
const result = Reflect.deleteProperty(target, key);
|
|
648
|
+
if (result && hadKey) {
|
|
649
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
650
|
+
}
|
|
651
|
+
return result;
|
|
652
|
+
}
|
|
653
|
+
has(target, key) {
|
|
654
|
+
const result = Reflect.has(target, key);
|
|
655
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
656
|
+
track(target, "has", key);
|
|
657
|
+
}
|
|
658
|
+
return result;
|
|
659
|
+
}
|
|
660
|
+
ownKeys(target) {
|
|
661
|
+
track(
|
|
662
|
+
target,
|
|
663
|
+
"iterate",
|
|
664
|
+
isArray(target) ? "length" : ITERATE_KEY
|
|
264
665
|
);
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
666
|
+
return Reflect.ownKeys(target);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
670
|
+
constructor(isShallow2 = false) {
|
|
671
|
+
super(true, isShallow2);
|
|
672
|
+
}
|
|
673
|
+
set(target, key) {
|
|
674
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
675
|
+
warn$2(
|
|
676
|
+
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
677
|
+
target
|
|
678
|
+
);
|
|
271
679
|
}
|
|
272
|
-
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
deleteProperty(target, key) {
|
|
683
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
684
|
+
warn$2(
|
|
685
|
+
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
686
|
+
target
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
return true;
|
|
273
690
|
}
|
|
274
|
-
resetTracking();
|
|
275
691
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
692
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
693
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
694
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
695
|
+
true
|
|
696
|
+
);
|
|
697
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
698
|
+
|
|
699
|
+
const toShallow = (value) => value;
|
|
700
|
+
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
701
|
+
function get(target, key, isReadonly = false, isShallow = false) {
|
|
702
|
+
target = target["__v_raw"];
|
|
703
|
+
const rawTarget = toRaw(target);
|
|
704
|
+
const rawKey = toRaw(key);
|
|
705
|
+
if (!isReadonly) {
|
|
706
|
+
if (hasChanged(key, rawKey)) {
|
|
707
|
+
track(rawTarget, "get", key);
|
|
708
|
+
}
|
|
709
|
+
track(rawTarget, "get", rawKey);
|
|
280
710
|
}
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
711
|
+
const { has: has2 } = getProto(rawTarget);
|
|
712
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
713
|
+
if (has2.call(rawTarget, key)) {
|
|
714
|
+
return wrap(target.get(key));
|
|
715
|
+
} else if (has2.call(rawTarget, rawKey)) {
|
|
716
|
+
return wrap(target.get(rawKey));
|
|
717
|
+
} else if (target !== rawTarget) {
|
|
718
|
+
target.get(key);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
function has(key, isReadonly = false) {
|
|
722
|
+
const target = this["__v_raw"];
|
|
723
|
+
const rawTarget = toRaw(target);
|
|
724
|
+
const rawKey = toRaw(key);
|
|
725
|
+
if (!isReadonly) {
|
|
726
|
+
if (hasChanged(key, rawKey)) {
|
|
727
|
+
track(rawTarget, "has", key);
|
|
291
728
|
}
|
|
292
|
-
|
|
293
|
-
currentVNode = parentInstance && parentInstance.vnode;
|
|
729
|
+
track(rawTarget, "has", rawKey);
|
|
294
730
|
}
|
|
295
|
-
return
|
|
731
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
296
732
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
`], ...formatTraceEntry(entry));
|
|
302
|
-
});
|
|
303
|
-
return logs;
|
|
733
|
+
function size(target, isReadonly = false) {
|
|
734
|
+
target = target["__v_raw"];
|
|
735
|
+
!isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
|
736
|
+
return Reflect.get(target, "size", target);
|
|
304
737
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return
|
|
738
|
+
function add(value) {
|
|
739
|
+
value = toRaw(value);
|
|
740
|
+
const target = toRaw(this);
|
|
741
|
+
const proto = getProto(target);
|
|
742
|
+
const hadKey = proto.has.call(target, value);
|
|
743
|
+
if (!hadKey) {
|
|
744
|
+
target.add(value);
|
|
745
|
+
trigger(target, "add", value, value);
|
|
746
|
+
}
|
|
747
|
+
return this;
|
|
315
748
|
}
|
|
316
|
-
function
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
749
|
+
function set(key, value) {
|
|
750
|
+
value = toRaw(value);
|
|
751
|
+
const target = toRaw(this);
|
|
752
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
753
|
+
let hadKey = has2.call(target, key);
|
|
754
|
+
if (!hadKey) {
|
|
755
|
+
key = toRaw(key);
|
|
756
|
+
hadKey = has2.call(target, key);
|
|
757
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
758
|
+
checkIdentityKeys(target, has2, key);
|
|
324
759
|
}
|
|
325
|
-
|
|
760
|
+
const oldValue = get2.call(target, key);
|
|
761
|
+
target.set(key, value);
|
|
762
|
+
if (!hadKey) {
|
|
763
|
+
trigger(target, "add", key, value);
|
|
764
|
+
} else if (hasChanged(value, oldValue)) {
|
|
765
|
+
trigger(target, "set", key, value, oldValue);
|
|
766
|
+
}
|
|
767
|
+
return this;
|
|
326
768
|
}
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
769
|
+
function deleteEntry(key) {
|
|
770
|
+
const target = toRaw(this);
|
|
771
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
772
|
+
let hadKey = has2.call(target, key);
|
|
773
|
+
if (!hadKey) {
|
|
774
|
+
key = toRaw(key);
|
|
775
|
+
hadKey = has2.call(target, key);
|
|
776
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
777
|
+
checkIdentityKeys(target, has2, key);
|
|
778
|
+
}
|
|
779
|
+
const oldValue = get2 ? get2.call(target, key) : void 0;
|
|
780
|
+
const result = target.delete(key);
|
|
781
|
+
if (hadKey) {
|
|
782
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
783
|
+
}
|
|
784
|
+
return result;
|
|
785
|
+
}
|
|
786
|
+
function clear() {
|
|
787
|
+
const target = toRaw(this);
|
|
788
|
+
const hadItems = target.size !== 0;
|
|
789
|
+
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
790
|
+
const result = target.clear();
|
|
791
|
+
if (hadItems) {
|
|
792
|
+
trigger(target, "clear", void 0, void 0, oldTarget);
|
|
793
|
+
}
|
|
794
|
+
return result;
|
|
795
|
+
}
|
|
796
|
+
function createForEach(isReadonly, isShallow) {
|
|
797
|
+
return function forEach(callback, thisArg) {
|
|
798
|
+
const observed = this;
|
|
799
|
+
const target = observed["__v_raw"];
|
|
800
|
+
const rawTarget = toRaw(target);
|
|
801
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
802
|
+
!isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
803
|
+
return target.forEach((value, key) => {
|
|
804
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
805
|
+
});
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
function createIterableMethod(method, isReadonly, isShallow) {
|
|
809
|
+
return function(...args) {
|
|
810
|
+
const target = this["__v_raw"];
|
|
811
|
+
const rawTarget = toRaw(target);
|
|
812
|
+
const targetIsMap = isMap(rawTarget);
|
|
813
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
814
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
815
|
+
const innerIterator = target[method](...args);
|
|
816
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
817
|
+
!isReadonly && track(
|
|
818
|
+
rawTarget,
|
|
819
|
+
"iterate",
|
|
820
|
+
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
|
821
|
+
);
|
|
822
|
+
return {
|
|
823
|
+
// iterator protocol
|
|
824
|
+
next() {
|
|
825
|
+
const { value, done } = innerIterator.next();
|
|
826
|
+
return done ? { value, done } : {
|
|
827
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
828
|
+
done
|
|
829
|
+
};
|
|
830
|
+
},
|
|
831
|
+
// iterable protocol
|
|
832
|
+
[Symbol.iterator]() {
|
|
833
|
+
return this;
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
function createReadonlyMethod(type) {
|
|
839
|
+
return function(...args) {
|
|
840
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
841
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
842
|
+
warn$2(
|
|
843
|
+
`${capitalize(type)} operation ${key}failed: target is readonly.`,
|
|
844
|
+
toRaw(this)
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function createInstrumentations() {
|
|
851
|
+
const mutableInstrumentations2 = {
|
|
852
|
+
get(key) {
|
|
853
|
+
return get(this, key);
|
|
854
|
+
},
|
|
855
|
+
get size() {
|
|
856
|
+
return size(this);
|
|
857
|
+
},
|
|
858
|
+
has,
|
|
859
|
+
add,
|
|
860
|
+
set,
|
|
861
|
+
delete: deleteEntry,
|
|
862
|
+
clear,
|
|
863
|
+
forEach: createForEach(false, false)
|
|
864
|
+
};
|
|
865
|
+
const shallowInstrumentations2 = {
|
|
866
|
+
get(key) {
|
|
867
|
+
return get(this, key, false, true);
|
|
868
|
+
},
|
|
869
|
+
get size() {
|
|
870
|
+
return size(this);
|
|
871
|
+
},
|
|
872
|
+
has,
|
|
873
|
+
add,
|
|
874
|
+
set,
|
|
875
|
+
delete: deleteEntry,
|
|
876
|
+
clear,
|
|
877
|
+
forEach: createForEach(false, true)
|
|
878
|
+
};
|
|
879
|
+
const readonlyInstrumentations2 = {
|
|
880
|
+
get(key) {
|
|
881
|
+
return get(this, key, true);
|
|
882
|
+
},
|
|
883
|
+
get size() {
|
|
884
|
+
return size(this, true);
|
|
885
|
+
},
|
|
886
|
+
has(key) {
|
|
887
|
+
return has.call(this, key, true);
|
|
888
|
+
},
|
|
889
|
+
add: createReadonlyMethod("add"),
|
|
890
|
+
set: createReadonlyMethod("set"),
|
|
891
|
+
delete: createReadonlyMethod("delete"),
|
|
892
|
+
clear: createReadonlyMethod("clear"),
|
|
893
|
+
forEach: createForEach(true, false)
|
|
894
|
+
};
|
|
895
|
+
const shallowReadonlyInstrumentations2 = {
|
|
896
|
+
get(key) {
|
|
897
|
+
return get(this, key, true, true);
|
|
898
|
+
},
|
|
899
|
+
get size() {
|
|
900
|
+
return size(this, true);
|
|
901
|
+
},
|
|
902
|
+
has(key) {
|
|
903
|
+
return has.call(this, key, true);
|
|
904
|
+
},
|
|
905
|
+
add: createReadonlyMethod("add"),
|
|
906
|
+
set: createReadonlyMethod("set"),
|
|
907
|
+
delete: createReadonlyMethod("delete"),
|
|
908
|
+
clear: createReadonlyMethod("clear"),
|
|
909
|
+
forEach: createForEach(true, true)
|
|
910
|
+
};
|
|
911
|
+
const iteratorMethods = [
|
|
912
|
+
"keys",
|
|
913
|
+
"values",
|
|
914
|
+
"entries",
|
|
915
|
+
Symbol.iterator
|
|
916
|
+
];
|
|
917
|
+
iteratorMethods.forEach((method) => {
|
|
918
|
+
mutableInstrumentations2[method] = createIterableMethod(method, false, false);
|
|
919
|
+
readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
|
|
920
|
+
shallowInstrumentations2[method] = createIterableMethod(method, false, true);
|
|
921
|
+
shallowReadonlyInstrumentations2[method] = createIterableMethod(
|
|
922
|
+
method,
|
|
923
|
+
true,
|
|
924
|
+
true
|
|
925
|
+
);
|
|
926
|
+
});
|
|
927
|
+
return [
|
|
928
|
+
mutableInstrumentations2,
|
|
929
|
+
readonlyInstrumentations2,
|
|
930
|
+
shallowInstrumentations2,
|
|
931
|
+
shallowReadonlyInstrumentations2
|
|
932
|
+
];
|
|
933
|
+
}
|
|
934
|
+
const [
|
|
935
|
+
mutableInstrumentations,
|
|
936
|
+
readonlyInstrumentations,
|
|
937
|
+
shallowInstrumentations,
|
|
938
|
+
shallowReadonlyInstrumentations
|
|
939
|
+
] = /* @__PURE__ */ createInstrumentations();
|
|
940
|
+
function createInstrumentationGetter(isReadonly, shallow) {
|
|
941
|
+
const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
|
|
942
|
+
return (target, key, receiver) => {
|
|
943
|
+
if (key === "__v_isReactive") {
|
|
944
|
+
return !isReadonly;
|
|
945
|
+
} else if (key === "__v_isReadonly") {
|
|
946
|
+
return isReadonly;
|
|
947
|
+
} else if (key === "__v_raw") {
|
|
948
|
+
return target;
|
|
949
|
+
}
|
|
950
|
+
return Reflect.get(
|
|
951
|
+
hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
952
|
+
key,
|
|
953
|
+
receiver
|
|
954
|
+
);
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
const mutableCollectionHandlers = {
|
|
958
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
959
|
+
};
|
|
960
|
+
const shallowCollectionHandlers = {
|
|
961
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
962
|
+
};
|
|
963
|
+
const readonlyCollectionHandlers = {
|
|
964
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
965
|
+
};
|
|
966
|
+
const shallowReadonlyCollectionHandlers = {
|
|
967
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
968
|
+
};
|
|
969
|
+
function checkIdentityKeys(target, has2, key) {
|
|
970
|
+
const rawKey = toRaw(key);
|
|
971
|
+
if (rawKey !== key && has2.call(target, rawKey)) {
|
|
972
|
+
const type = toRawType(target);
|
|
973
|
+
warn$2(
|
|
974
|
+
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
980
|
+
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
981
|
+
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
982
|
+
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
983
|
+
function targetTypeMap(rawType) {
|
|
984
|
+
switch (rawType) {
|
|
985
|
+
case "Object":
|
|
986
|
+
case "Array":
|
|
987
|
+
return 1 /* COMMON */;
|
|
988
|
+
case "Map":
|
|
989
|
+
case "Set":
|
|
990
|
+
case "WeakMap":
|
|
991
|
+
case "WeakSet":
|
|
992
|
+
return 2 /* COLLECTION */;
|
|
993
|
+
default:
|
|
994
|
+
return 0 /* INVALID */;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
function getTargetType(value) {
|
|
998
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
|
|
999
|
+
}
|
|
1000
|
+
function reactive(target) {
|
|
1001
|
+
if (isReadonly(target)) {
|
|
1002
|
+
return target;
|
|
1003
|
+
}
|
|
1004
|
+
return createReactiveObject(
|
|
1005
|
+
target,
|
|
1006
|
+
false,
|
|
1007
|
+
mutableHandlers,
|
|
1008
|
+
mutableCollectionHandlers,
|
|
1009
|
+
reactiveMap
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
function shallowReactive(target) {
|
|
1013
|
+
return createReactiveObject(
|
|
1014
|
+
target,
|
|
1015
|
+
false,
|
|
1016
|
+
shallowReactiveHandlers,
|
|
1017
|
+
shallowCollectionHandlers,
|
|
1018
|
+
shallowReactiveMap
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
function readonly(target) {
|
|
1022
|
+
return createReactiveObject(
|
|
1023
|
+
target,
|
|
1024
|
+
true,
|
|
1025
|
+
readonlyHandlers,
|
|
1026
|
+
readonlyCollectionHandlers,
|
|
1027
|
+
readonlyMap
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
function shallowReadonly(target) {
|
|
1031
|
+
return createReactiveObject(
|
|
1032
|
+
target,
|
|
1033
|
+
true,
|
|
1034
|
+
shallowReadonlyHandlers,
|
|
1035
|
+
shallowReadonlyCollectionHandlers,
|
|
1036
|
+
shallowReadonlyMap
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1040
|
+
if (!isObject(target)) {
|
|
1041
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1042
|
+
warn$2(
|
|
1043
|
+
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
|
|
1044
|
+
target
|
|
1045
|
+
)}`
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
return target;
|
|
1049
|
+
}
|
|
1050
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1051
|
+
return target;
|
|
1052
|
+
}
|
|
1053
|
+
const existingProxy = proxyMap.get(target);
|
|
1054
|
+
if (existingProxy) {
|
|
1055
|
+
return existingProxy;
|
|
1056
|
+
}
|
|
1057
|
+
const targetType = getTargetType(target);
|
|
1058
|
+
if (targetType === 0 /* INVALID */) {
|
|
1059
|
+
return target;
|
|
1060
|
+
}
|
|
1061
|
+
const proxy = new Proxy(
|
|
1062
|
+
target,
|
|
1063
|
+
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
1064
|
+
);
|
|
1065
|
+
proxyMap.set(target, proxy);
|
|
1066
|
+
return proxy;
|
|
1067
|
+
}
|
|
1068
|
+
function isReactive(value) {
|
|
1069
|
+
if (isReadonly(value)) {
|
|
1070
|
+
return isReactive(value["__v_raw"]);
|
|
1071
|
+
}
|
|
1072
|
+
return !!(value && value["__v_isReactive"]);
|
|
1073
|
+
}
|
|
1074
|
+
function isReadonly(value) {
|
|
1075
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1076
|
+
}
|
|
1077
|
+
function isShallow(value) {
|
|
1078
|
+
return !!(value && value["__v_isShallow"]);
|
|
1079
|
+
}
|
|
1080
|
+
function isProxy(value) {
|
|
1081
|
+
return value ? !!value["__v_raw"] : false;
|
|
1082
|
+
}
|
|
1083
|
+
function toRaw(observed) {
|
|
1084
|
+
const raw = observed && observed["__v_raw"];
|
|
1085
|
+
return raw ? toRaw(raw) : observed;
|
|
1086
|
+
}
|
|
1087
|
+
function markRaw(value) {
|
|
1088
|
+
if (Object.isExtensible(value)) {
|
|
1089
|
+
def(value, "__v_skip", true);
|
|
1090
|
+
}
|
|
1091
|
+
return value;
|
|
1092
|
+
}
|
|
1093
|
+
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1094
|
+
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1095
|
+
|
|
1096
|
+
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
|
|
1097
|
+
class ComputedRefImpl {
|
|
1098
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1099
|
+
this.getter = getter;
|
|
1100
|
+
this._setter = _setter;
|
|
1101
|
+
this.dep = void 0;
|
|
1102
|
+
this.__v_isRef = true;
|
|
1103
|
+
this["__v_isReadonly"] = false;
|
|
1104
|
+
this.effect = new ReactiveEffect(
|
|
1105
|
+
() => getter(this._value),
|
|
1106
|
+
() => triggerRefValue(
|
|
1107
|
+
this,
|
|
1108
|
+
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1109
|
+
)
|
|
1110
|
+
);
|
|
1111
|
+
this.effect.computed = this;
|
|
1112
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1113
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1114
|
+
}
|
|
1115
|
+
get value() {
|
|
1116
|
+
const self = toRaw(this);
|
|
1117
|
+
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1118
|
+
triggerRefValue(self, 4);
|
|
1119
|
+
}
|
|
1120
|
+
trackRefValue(self);
|
|
1121
|
+
if (self.effect._dirtyLevel >= 2) {
|
|
1122
|
+
if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
|
|
1123
|
+
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1124
|
+
|
|
1125
|
+
getter: `, this.getter);
|
|
1126
|
+
}
|
|
1127
|
+
triggerRefValue(self, 2);
|
|
1128
|
+
}
|
|
1129
|
+
return self._value;
|
|
1130
|
+
}
|
|
1131
|
+
set value(newValue) {
|
|
1132
|
+
this._setter(newValue);
|
|
1133
|
+
}
|
|
1134
|
+
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1135
|
+
get _dirty() {
|
|
1136
|
+
return this.effect.dirty;
|
|
1137
|
+
}
|
|
1138
|
+
set _dirty(v) {
|
|
1139
|
+
this.effect.dirty = v;
|
|
1140
|
+
}
|
|
1141
|
+
// #endregion
|
|
1142
|
+
}
|
|
1143
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1144
|
+
let getter;
|
|
1145
|
+
let setter;
|
|
1146
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1147
|
+
if (onlyGetter) {
|
|
1148
|
+
getter = getterOrOptions;
|
|
1149
|
+
setter = !!(process.env.NODE_ENV !== "production") ? () => {
|
|
1150
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1151
|
+
} : NOOP;
|
|
1152
|
+
} else {
|
|
1153
|
+
getter = getterOrOptions.get;
|
|
1154
|
+
setter = getterOrOptions.set;
|
|
1155
|
+
}
|
|
1156
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1157
|
+
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1158
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1159
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1160
|
+
}
|
|
1161
|
+
return cRef;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
function trackRefValue(ref2) {
|
|
1165
|
+
var _a;
|
|
1166
|
+
if (shouldTrack && activeEffect) {
|
|
1167
|
+
ref2 = toRaw(ref2);
|
|
1168
|
+
trackEffect(
|
|
1169
|
+
activeEffect,
|
|
1170
|
+
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1171
|
+
() => ref2.dep = void 0,
|
|
1172
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1173
|
+
),
|
|
1174
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
1175
|
+
target: ref2,
|
|
1176
|
+
type: "get",
|
|
1177
|
+
key: "value"
|
|
1178
|
+
} : void 0
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
|
|
1183
|
+
ref2 = toRaw(ref2);
|
|
1184
|
+
const dep = ref2.dep;
|
|
1185
|
+
if (dep) {
|
|
1186
|
+
triggerEffects(
|
|
1187
|
+
dep,
|
|
1188
|
+
dirtyLevel,
|
|
1189
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
1190
|
+
target: ref2,
|
|
1191
|
+
type: "set",
|
|
1192
|
+
key: "value",
|
|
1193
|
+
newValue: newVal,
|
|
1194
|
+
oldValue: oldVal
|
|
1195
|
+
} : void 0
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function isRef(r) {
|
|
1200
|
+
return !!(r && r.__v_isRef === true);
|
|
1201
|
+
}
|
|
1202
|
+
function unref(ref2) {
|
|
1203
|
+
return isRef(ref2) ? ref2.value : ref2;
|
|
1204
|
+
}
|
|
1205
|
+
const shallowUnwrapHandlers = {
|
|
1206
|
+
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
|
1207
|
+
set: (target, key, value, receiver) => {
|
|
1208
|
+
const oldValue = target[key];
|
|
1209
|
+
if (isRef(oldValue) && !isRef(value)) {
|
|
1210
|
+
oldValue.value = value;
|
|
1211
|
+
return true;
|
|
1212
|
+
} else {
|
|
1213
|
+
return Reflect.set(target, key, value, receiver);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
function proxyRefs(objectWithRefs) {
|
|
1218
|
+
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
const stack = [];
|
|
1222
|
+
function pushWarningContext(vnode) {
|
|
1223
|
+
stack.push(vnode);
|
|
1224
|
+
}
|
|
1225
|
+
function popWarningContext() {
|
|
1226
|
+
stack.pop();
|
|
1227
|
+
}
|
|
1228
|
+
function warn$1(msg, ...args) {
|
|
1229
|
+
pauseTracking();
|
|
1230
|
+
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1231
|
+
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1232
|
+
const trace = getComponentTrace();
|
|
1233
|
+
if (appWarnHandler) {
|
|
1234
|
+
callWithErrorHandling(
|
|
1235
|
+
appWarnHandler,
|
|
1236
|
+
instance,
|
|
1237
|
+
11,
|
|
1238
|
+
[
|
|
1239
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
1240
|
+
msg + args.map((a) => {
|
|
1241
|
+
var _a, _b;
|
|
1242
|
+
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
1243
|
+
}).join(""),
|
|
1244
|
+
instance && instance.proxy,
|
|
1245
|
+
trace.map(
|
|
1246
|
+
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
|
1247
|
+
).join("\n"),
|
|
1248
|
+
trace
|
|
1249
|
+
]
|
|
1250
|
+
);
|
|
1251
|
+
} else {
|
|
1252
|
+
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1253
|
+
if (trace.length && // avoid spamming console during tests
|
|
1254
|
+
true) {
|
|
1255
|
+
warnArgs.push(`
|
|
1256
|
+
`, ...formatTrace(trace));
|
|
1257
|
+
}
|
|
1258
|
+
console.warn(...warnArgs);
|
|
1259
|
+
}
|
|
1260
|
+
resetTracking();
|
|
1261
|
+
}
|
|
1262
|
+
function getComponentTrace() {
|
|
1263
|
+
let currentVNode = stack[stack.length - 1];
|
|
1264
|
+
if (!currentVNode) {
|
|
1265
|
+
return [];
|
|
1266
|
+
}
|
|
1267
|
+
const normalizedStack = [];
|
|
1268
|
+
while (currentVNode) {
|
|
1269
|
+
const last = normalizedStack[0];
|
|
1270
|
+
if (last && last.vnode === currentVNode) {
|
|
1271
|
+
last.recurseCount++;
|
|
1272
|
+
} else {
|
|
1273
|
+
normalizedStack.push({
|
|
1274
|
+
vnode: currentVNode,
|
|
1275
|
+
recurseCount: 0
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
1279
|
+
currentVNode = parentInstance && parentInstance.vnode;
|
|
1280
|
+
}
|
|
1281
|
+
return normalizedStack;
|
|
1282
|
+
}
|
|
1283
|
+
function formatTrace(trace) {
|
|
1284
|
+
const logs = [];
|
|
1285
|
+
trace.forEach((entry, i) => {
|
|
1286
|
+
logs.push(...i === 0 ? [] : [`
|
|
1287
|
+
`], ...formatTraceEntry(entry));
|
|
1288
|
+
});
|
|
1289
|
+
return logs;
|
|
1290
|
+
}
|
|
1291
|
+
function formatTraceEntry({ vnode, recurseCount }) {
|
|
1292
|
+
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
1293
|
+
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
1294
|
+
const open = ` at <${formatComponentName(
|
|
1295
|
+
vnode.component,
|
|
1296
|
+
vnode.type,
|
|
1297
|
+
isRoot
|
|
1298
|
+
)}`;
|
|
1299
|
+
const close = `>` + postfix;
|
|
1300
|
+
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
|
1301
|
+
}
|
|
1302
|
+
function formatProps(props) {
|
|
1303
|
+
const res = [];
|
|
1304
|
+
const keys = Object.keys(props);
|
|
1305
|
+
keys.slice(0, 3).forEach((key) => {
|
|
1306
|
+
res.push(...formatProp(key, props[key]));
|
|
1307
|
+
});
|
|
1308
|
+
if (keys.length > 3) {
|
|
1309
|
+
res.push(` ...`);
|
|
1310
|
+
}
|
|
1311
|
+
return res;
|
|
1312
|
+
}
|
|
1313
|
+
function formatProp(key, value, raw) {
|
|
1314
|
+
if (isString(value)) {
|
|
1315
|
+
value = JSON.stringify(value);
|
|
1316
|
+
return raw ? value : [`${key}=${value}`];
|
|
1317
|
+
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1318
|
+
return raw ? value : [`${key}=${value}`];
|
|
1319
|
+
} else if (isRef(value)) {
|
|
1320
|
+
value = formatProp(key, toRaw(value.value), true);
|
|
1321
|
+
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
1322
|
+
} else if (isFunction(value)) {
|
|
1323
|
+
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
1324
|
+
} else {
|
|
1325
|
+
value = toRaw(value);
|
|
1326
|
+
return raw ? value : [`${key}=`, value];
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
const ErrorTypeStrings = {
|
|
1331
|
+
["sp"]: "serverPrefetch hook",
|
|
1332
|
+
["bc"]: "beforeCreate hook",
|
|
1333
|
+
["c"]: "created hook",
|
|
1334
|
+
["bm"]: "beforeMount hook",
|
|
1335
|
+
["m"]: "mounted hook",
|
|
1336
|
+
["bu"]: "beforeUpdate hook",
|
|
1337
|
+
["u"]: "updated",
|
|
1338
|
+
["bum"]: "beforeUnmount hook",
|
|
1339
|
+
["um"]: "unmounted hook",
|
|
1340
|
+
["a"]: "activated hook",
|
|
1341
|
+
["da"]: "deactivated hook",
|
|
1342
|
+
["ec"]: "errorCaptured hook",
|
|
1343
|
+
["rtc"]: "renderTracked hook",
|
|
1344
|
+
["rtg"]: "renderTriggered hook",
|
|
1345
|
+
[0]: "setup function",
|
|
1346
|
+
[1]: "render function",
|
|
1347
|
+
[2]: "watcher getter",
|
|
1348
|
+
[3]: "watcher callback",
|
|
1349
|
+
[4]: "watcher cleanup function",
|
|
1350
|
+
[5]: "native event handler",
|
|
1351
|
+
[6]: "component event handler",
|
|
1352
|
+
[7]: "vnode hook",
|
|
1353
|
+
[8]: "directive hook",
|
|
1354
|
+
[9]: "transition hook",
|
|
1355
|
+
[10]: "app errorHandler",
|
|
1356
|
+
[11]: "app warnHandler",
|
|
1357
|
+
[12]: "ref function",
|
|
1358
|
+
[13]: "async component loader",
|
|
1359
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
1360
|
+
};
|
|
1361
|
+
function callWithErrorHandling(fn, instance, type, args) {
|
|
1362
|
+
try {
|
|
1363
|
+
return args ? fn(...args) : fn();
|
|
1364
|
+
} catch (err) {
|
|
1365
|
+
handleError(err, instance, type);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1369
|
+
if (isFunction(fn)) {
|
|
1370
|
+
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1371
|
+
if (res && isPromise(res)) {
|
|
1372
|
+
res.catch((err) => {
|
|
1373
|
+
handleError(err, instance, type);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
return res;
|
|
1377
|
+
}
|
|
1378
|
+
if (isArray(fn)) {
|
|
1379
|
+
const values = [];
|
|
1380
|
+
for (let i = 0; i < fn.length; i++) {
|
|
1381
|
+
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1382
|
+
}
|
|
1383
|
+
return values;
|
|
1384
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1385
|
+
warn$1(
|
|
1386
|
+
`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function handleError(err, instance, type, throwInDev = true) {
|
|
1391
|
+
const contextVNode = instance ? instance.vnode : null;
|
|
1392
|
+
if (instance) {
|
|
1393
|
+
let cur = instance.parent;
|
|
1394
|
+
const exposedInstance = instance.proxy;
|
|
1395
|
+
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
1396
|
+
while (cur) {
|
|
1397
|
+
const errorCapturedHooks = cur.ec;
|
|
1398
|
+
if (errorCapturedHooks) {
|
|
1399
|
+
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
1400
|
+
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
cur = cur.parent;
|
|
1406
|
+
}
|
|
1407
|
+
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
1408
|
+
if (appErrorHandler) {
|
|
1409
|
+
pauseTracking();
|
|
1410
|
+
callWithErrorHandling(
|
|
1411
|
+
appErrorHandler,
|
|
1412
|
+
null,
|
|
1413
|
+
10,
|
|
1414
|
+
[err, exposedInstance, errorInfo]
|
|
1415
|
+
);
|
|
1416
|
+
resetTracking();
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
logError(err, type, contextVNode, throwInDev);
|
|
1421
|
+
}
|
|
1422
|
+
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1423
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1424
|
+
const info = ErrorTypeStrings[type];
|
|
1425
|
+
if (contextVNode) {
|
|
1426
|
+
pushWarningContext(contextVNode);
|
|
1427
|
+
}
|
|
1428
|
+
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1429
|
+
if (contextVNode) {
|
|
1430
|
+
popWarningContext();
|
|
1431
|
+
}
|
|
1432
|
+
if (throwInDev) {
|
|
1433
|
+
throw err;
|
|
1434
|
+
} else {
|
|
1435
|
+
console.error(err);
|
|
1436
|
+
}
|
|
1437
|
+
} else {
|
|
1438
|
+
console.error(err);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
let isFlushing = false;
|
|
1443
|
+
let isFlushPending = false;
|
|
1444
|
+
const queue = [];
|
|
1445
|
+
let flushIndex = 0;
|
|
1446
|
+
const pendingPostFlushCbs = [];
|
|
1447
|
+
let activePostFlushCbs = null;
|
|
1448
|
+
let postFlushIndex = 0;
|
|
1449
|
+
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1450
|
+
let currentFlushPromise = null;
|
|
1451
|
+
const RECURSION_LIMIT = 100;
|
|
1452
|
+
function nextTick(fn) {
|
|
1453
|
+
const p = currentFlushPromise || resolvedPromise;
|
|
1454
|
+
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
1455
|
+
}
|
|
1456
|
+
function findInsertionIndex(id) {
|
|
1457
|
+
let start = flushIndex + 1;
|
|
1458
|
+
let end = queue.length;
|
|
1459
|
+
while (start < end) {
|
|
1460
|
+
const middle = start + end >>> 1;
|
|
1461
|
+
const middleJob = queue[middle];
|
|
1462
|
+
const middleJobId = getId(middleJob);
|
|
1463
|
+
if (middleJobId < id || middleJobId === id && middleJob.pre) {
|
|
1464
|
+
start = middle + 1;
|
|
1465
|
+
} else {
|
|
1466
|
+
end = middle;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return start;
|
|
1470
|
+
}
|
|
1471
|
+
function queueJob(job) {
|
|
1472
|
+
if (!queue.length || !queue.includes(
|
|
1473
|
+
job,
|
|
1474
|
+
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1475
|
+
)) {
|
|
1476
|
+
if (job.id == null) {
|
|
1477
|
+
queue.push(job);
|
|
1478
|
+
} else {
|
|
1479
|
+
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1480
|
+
}
|
|
1481
|
+
queueFlush();
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
function queueFlush() {
|
|
1485
|
+
if (!isFlushing && !isFlushPending) {
|
|
1486
|
+
isFlushPending = true;
|
|
1487
|
+
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
function queuePostFlushCb(cb) {
|
|
1491
|
+
if (!isArray(cb)) {
|
|
1492
|
+
if (!activePostFlushCbs || !activePostFlushCbs.includes(
|
|
1493
|
+
cb,
|
|
1494
|
+
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1495
|
+
)) {
|
|
1496
|
+
pendingPostFlushCbs.push(cb);
|
|
1497
|
+
}
|
|
1498
|
+
} else {
|
|
1499
|
+
pendingPostFlushCbs.push(...cb);
|
|
1500
|
+
}
|
|
1501
|
+
queueFlush();
|
|
1502
|
+
}
|
|
1503
|
+
function flushPostFlushCbs(seen) {
|
|
1504
|
+
if (pendingPostFlushCbs.length) {
|
|
1505
|
+
const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
|
1506
|
+
(a, b) => getId(a) - getId(b)
|
|
1507
|
+
);
|
|
1508
|
+
pendingPostFlushCbs.length = 0;
|
|
1509
|
+
if (activePostFlushCbs) {
|
|
1510
|
+
activePostFlushCbs.push(...deduped);
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
activePostFlushCbs = deduped;
|
|
1514
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1515
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1516
|
+
}
|
|
1517
|
+
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1518
|
+
const cb = activePostFlushCbs[postFlushIndex];
|
|
1519
|
+
if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
|
|
1520
|
+
continue;
|
|
1521
|
+
}
|
|
1522
|
+
if (cb.active !== false) cb();
|
|
1523
|
+
}
|
|
1524
|
+
activePostFlushCbs = null;
|
|
1525
|
+
postFlushIndex = 0;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
1529
|
+
const comparator = (a, b) => {
|
|
1530
|
+
const diff = getId(a) - getId(b);
|
|
1531
|
+
if (diff === 0) {
|
|
1532
|
+
if (a.pre && !b.pre) return -1;
|
|
1533
|
+
if (b.pre && !a.pre) return 1;
|
|
1534
|
+
}
|
|
1535
|
+
return diff;
|
|
1536
|
+
};
|
|
1537
|
+
function flushJobs(seen) {
|
|
1538
|
+
isFlushPending = false;
|
|
1539
|
+
isFlushing = true;
|
|
1540
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1541
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1542
|
+
}
|
|
1543
|
+
queue.sort(comparator);
|
|
1544
|
+
const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
|
|
1545
|
+
try {
|
|
1546
|
+
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1547
|
+
const job = queue[flushIndex];
|
|
1548
|
+
if (job && job.active !== false) {
|
|
1549
|
+
if (!!(process.env.NODE_ENV !== "production") && check(job)) {
|
|
1550
|
+
continue;
|
|
1551
|
+
}
|
|
1552
|
+
callWithErrorHandling(job, null, 14);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
} finally {
|
|
1556
|
+
flushIndex = 0;
|
|
1557
|
+
queue.length = 0;
|
|
1558
|
+
flushPostFlushCbs(seen);
|
|
1559
|
+
isFlushing = false;
|
|
1560
|
+
currentFlushPromise = null;
|
|
1561
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1562
|
+
flushJobs(seen);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
function checkRecursiveUpdates(seen, fn) {
|
|
1567
|
+
if (!seen.has(fn)) {
|
|
1568
|
+
seen.set(fn, 1);
|
|
1569
|
+
} else {
|
|
1570
|
+
const count = seen.get(fn);
|
|
1571
|
+
if (count > RECURSION_LIMIT) {
|
|
1572
|
+
const instance = fn.ownerInstance;
|
|
1573
|
+
const componentName = instance && getComponentName(instance.type);
|
|
1574
|
+
handleError(
|
|
1575
|
+
`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
|
|
1576
|
+
null,
|
|
1577
|
+
10
|
|
1578
|
+
);
|
|
1579
|
+
return true;
|
|
1580
|
+
} else {
|
|
1581
|
+
seen.set(fn, count + 1);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
let devtools;
|
|
1587
|
+
let buffer = [];
|
|
1588
|
+
let devtoolsNotInstalled = false;
|
|
1589
|
+
function emit$1(event, ...args) {
|
|
1590
|
+
if (devtools) {
|
|
1591
|
+
devtools.emit(event, ...args);
|
|
1592
|
+
} else if (!devtoolsNotInstalled) {
|
|
1593
|
+
buffer.push({ event, args });
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
function setDevtoolsHook(hook, target) {
|
|
1597
|
+
var _a, _b;
|
|
1598
|
+
devtools = hook;
|
|
1599
|
+
if (devtools) {
|
|
1600
|
+
devtools.enabled = true;
|
|
1601
|
+
buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
|
|
1602
|
+
buffer = [];
|
|
1603
|
+
} else if (
|
|
1604
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
1605
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
1606
|
+
// (#4815)
|
|
1607
|
+
typeof window !== "undefined" && // some envs mock window but not fully
|
|
1608
|
+
window.HTMLElement && // also exclude jsdom
|
|
1609
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
1610
|
+
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
|
1611
|
+
) {
|
|
1612
|
+
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
|
1613
|
+
replay.push((newHook) => {
|
|
1614
|
+
setDevtoolsHook(newHook, target);
|
|
1615
|
+
});
|
|
1616
|
+
setTimeout(() => {
|
|
1617
|
+
if (!devtools) {
|
|
1618
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
1619
|
+
devtoolsNotInstalled = true;
|
|
1620
|
+
buffer = [];
|
|
1621
|
+
}
|
|
1622
|
+
}, 3e3);
|
|
1623
|
+
} else {
|
|
1624
|
+
devtoolsNotInstalled = true;
|
|
1625
|
+
buffer = [];
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
1629
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
1630
|
+
// @__NO_SIDE_EFFECTS__
|
|
1631
|
+
function createDevtoolsComponentHook(hook) {
|
|
1632
|
+
return (component) => {
|
|
1633
|
+
emit$1(
|
|
1634
|
+
hook,
|
|
1635
|
+
component.appContext.app,
|
|
1636
|
+
component.uid,
|
|
1637
|
+
component.parent ? component.parent.uid : void 0,
|
|
1638
|
+
component
|
|
1639
|
+
);
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
|
|
1643
|
+
"perf:start" /* PERFORMANCE_START */
|
|
1644
|
+
);
|
|
1645
|
+
const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
|
|
1646
|
+
"perf:end" /* PERFORMANCE_END */
|
|
1647
|
+
);
|
|
1648
|
+
function createDevtoolsPerformanceHook(hook) {
|
|
1649
|
+
return (component, type, time) => {
|
|
1650
|
+
emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
function devtoolsComponentEmit(component, event, params) {
|
|
1654
|
+
emit$1(
|
|
1655
|
+
"component:emit" /* COMPONENT_EMIT */,
|
|
1656
|
+
component.appContext.app,
|
|
1657
|
+
component,
|
|
1658
|
+
event,
|
|
1659
|
+
params
|
|
1660
|
+
);
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
function emit(instance, event, ...rawArgs) {
|
|
1664
|
+
if (instance.isUnmounted) return;
|
|
1665
|
+
const props = instance.vnode.props || EMPTY_OBJ;
|
|
1666
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1667
|
+
const {
|
|
1668
|
+
emitsOptions,
|
|
1669
|
+
propsOptions: [propsOptions]
|
|
1670
|
+
} = instance;
|
|
1671
|
+
if (emitsOptions) {
|
|
1672
|
+
if (!(event in emitsOptions) && true) {
|
|
1673
|
+
if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
|
1674
|
+
warn$1(
|
|
1675
|
+
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
} else {
|
|
1679
|
+
const validator = emitsOptions[event];
|
|
1680
|
+
if (isFunction(validator)) {
|
|
1681
|
+
const isValid = validator(...rawArgs);
|
|
1682
|
+
if (!isValid) {
|
|
1683
|
+
warn$1(
|
|
1684
|
+
`Invalid event arguments: event validation failed for event "${event}".`
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
let args = rawArgs;
|
|
1692
|
+
const isModelListener = event.startsWith("update:");
|
|
1693
|
+
const modelArg = isModelListener && event.slice(7);
|
|
1694
|
+
if (modelArg && modelArg in props) {
|
|
1695
|
+
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
|
1696
|
+
const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
|
|
1697
|
+
if (trim) {
|
|
1698
|
+
args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
1699
|
+
}
|
|
1700
|
+
if (number) {
|
|
1701
|
+
args = rawArgs.map(looseToNumber);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1705
|
+
devtoolsComponentEmit(instance, event, args);
|
|
1706
|
+
}
|
|
1707
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1708
|
+
const lowerCaseEvent = event.toLowerCase();
|
|
1709
|
+
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
|
1710
|
+
warn$1(
|
|
1711
|
+
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
1712
|
+
instance,
|
|
1713
|
+
instance.type
|
|
1714
|
+
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
|
|
1715
|
+
event
|
|
1716
|
+
)}" instead of "${event}".`
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
let handlerName;
|
|
1721
|
+
let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
|
1722
|
+
props[handlerName = toHandlerKey(camelize(event))];
|
|
1723
|
+
if (!handler && isModelListener) {
|
|
1724
|
+
handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
|
1725
|
+
}
|
|
1726
|
+
if (handler) {
|
|
1727
|
+
callWithAsyncErrorHandling(
|
|
1728
|
+
handler,
|
|
1729
|
+
instance,
|
|
1730
|
+
6,
|
|
1731
|
+
args
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1734
|
+
const onceHandler = props[handlerName + `Once`];
|
|
1735
|
+
if (onceHandler) {
|
|
1736
|
+
if (!instance.emitted) {
|
|
1737
|
+
instance.emitted = {};
|
|
1738
|
+
} else if (instance.emitted[handlerName]) {
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
instance.emitted[handlerName] = true;
|
|
1742
|
+
callWithAsyncErrorHandling(
|
|
1743
|
+
onceHandler,
|
|
1744
|
+
instance,
|
|
1745
|
+
6,
|
|
1746
|
+
args
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
1751
|
+
const cache = appContext.emitsCache;
|
|
1752
|
+
const cached = cache.get(comp);
|
|
1753
|
+
if (cached !== void 0) {
|
|
1754
|
+
return cached;
|
|
1755
|
+
}
|
|
1756
|
+
const raw = comp.emits;
|
|
1757
|
+
let normalized = {};
|
|
1758
|
+
let hasExtends = false;
|
|
1759
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
1760
|
+
const extendEmits = (raw2) => {
|
|
1761
|
+
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
|
1762
|
+
if (normalizedFromExtend) {
|
|
1763
|
+
hasExtends = true;
|
|
1764
|
+
extend(normalized, normalizedFromExtend);
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
if (!asMixin && appContext.mixins.length) {
|
|
1768
|
+
appContext.mixins.forEach(extendEmits);
|
|
1769
|
+
}
|
|
1770
|
+
if (comp.extends) {
|
|
1771
|
+
extendEmits(comp.extends);
|
|
1772
|
+
}
|
|
1773
|
+
if (comp.mixins) {
|
|
1774
|
+
comp.mixins.forEach(extendEmits);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
if (!raw && !hasExtends) {
|
|
1778
|
+
if (isObject(comp)) {
|
|
1779
|
+
cache.set(comp, null);
|
|
1780
|
+
}
|
|
1781
|
+
return null;
|
|
1782
|
+
}
|
|
1783
|
+
if (isArray(raw)) {
|
|
1784
|
+
raw.forEach((key) => normalized[key] = null);
|
|
1785
|
+
} else {
|
|
1786
|
+
extend(normalized, raw);
|
|
1787
|
+
}
|
|
1788
|
+
if (isObject(comp)) {
|
|
1789
|
+
cache.set(comp, normalized);
|
|
1790
|
+
}
|
|
1791
|
+
return normalized;
|
|
1792
|
+
}
|
|
1793
|
+
function isEmitListener(options, key) {
|
|
1794
|
+
if (!options || !isOn(key)) {
|
|
1795
|
+
return false;
|
|
1796
|
+
}
|
|
1797
|
+
key = key.slice(2).replace(/Once$/, "");
|
|
1798
|
+
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
let currentRenderingInstance = null;
|
|
1802
|
+
let currentScopeId = null;
|
|
1803
|
+
function setCurrentRenderingInstance$1(instance) {
|
|
1804
|
+
const prev = currentRenderingInstance;
|
|
1805
|
+
currentRenderingInstance = instance;
|
|
1806
|
+
currentScopeId = instance && instance.type.__scopeId || null;
|
|
1807
|
+
return prev;
|
|
1808
|
+
}
|
|
1809
|
+
function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
1810
|
+
if (!ctx) return fn;
|
|
1811
|
+
if (fn._n) {
|
|
1812
|
+
return fn;
|
|
1813
|
+
}
|
|
1814
|
+
const renderFnWithContext = (...args) => {
|
|
1815
|
+
if (renderFnWithContext._d) {
|
|
1816
|
+
setBlockTracking(-1);
|
|
1817
|
+
}
|
|
1818
|
+
const prevInstance = setCurrentRenderingInstance$1(ctx);
|
|
1819
|
+
let res;
|
|
1820
|
+
try {
|
|
1821
|
+
res = fn(...args);
|
|
1822
|
+
} finally {
|
|
1823
|
+
setCurrentRenderingInstance$1(prevInstance);
|
|
1824
|
+
if (renderFnWithContext._d) {
|
|
1825
|
+
setBlockTracking(1);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1829
|
+
devtoolsComponentUpdated(ctx);
|
|
1830
|
+
}
|
|
1831
|
+
return res;
|
|
1832
|
+
};
|
|
1833
|
+
renderFnWithContext._n = true;
|
|
1834
|
+
renderFnWithContext._c = true;
|
|
1835
|
+
renderFnWithContext._d = true;
|
|
1836
|
+
return renderFnWithContext;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
let accessedAttrs = false;
|
|
1840
|
+
function markAttrsAccessed() {
|
|
1841
|
+
accessedAttrs = true;
|
|
1842
|
+
}
|
|
1843
|
+
function renderComponentRoot$1(instance) {
|
|
1844
|
+
const {
|
|
1845
|
+
type: Component,
|
|
1846
|
+
vnode,
|
|
1847
|
+
proxy,
|
|
1848
|
+
withProxy,
|
|
1849
|
+
propsOptions: [propsOptions],
|
|
1850
|
+
slots,
|
|
1851
|
+
attrs,
|
|
1852
|
+
emit,
|
|
1853
|
+
render,
|
|
1854
|
+
renderCache,
|
|
1855
|
+
props,
|
|
1856
|
+
data,
|
|
1857
|
+
setupState,
|
|
1858
|
+
ctx,
|
|
1859
|
+
inheritAttrs
|
|
1860
|
+
} = instance;
|
|
1861
|
+
const prev = setCurrentRenderingInstance$1(instance);
|
|
1862
|
+
let result;
|
|
1863
|
+
let fallthroughAttrs;
|
|
1864
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1865
|
+
accessedAttrs = false;
|
|
1866
|
+
}
|
|
1867
|
+
try {
|
|
1868
|
+
if (vnode.shapeFlag & 4) {
|
|
1869
|
+
const proxyToUse = withProxy || proxy;
|
|
1870
|
+
const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
|
1871
|
+
get(target, key, receiver) {
|
|
1872
|
+
warn$1(
|
|
1873
|
+
`Property '${String(
|
|
1874
|
+
key
|
|
1875
|
+
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
1876
|
+
);
|
|
1877
|
+
return Reflect.get(target, key, receiver);
|
|
1878
|
+
}
|
|
1879
|
+
}) : proxyToUse;
|
|
1880
|
+
result = normalizeVNode$1(
|
|
1881
|
+
render.call(
|
|
1882
|
+
thisProxy,
|
|
1883
|
+
proxyToUse,
|
|
1884
|
+
renderCache,
|
|
1885
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
|
|
1886
|
+
setupState,
|
|
1887
|
+
data,
|
|
1888
|
+
ctx
|
|
1889
|
+
)
|
|
1890
|
+
);
|
|
1891
|
+
fallthroughAttrs = attrs;
|
|
1892
|
+
} else {
|
|
1893
|
+
const render2 = Component;
|
|
1894
|
+
if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
|
|
1895
|
+
markAttrsAccessed();
|
|
1896
|
+
}
|
|
1897
|
+
result = normalizeVNode$1(
|
|
1898
|
+
render2.length > 1 ? render2(
|
|
1899
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
|
|
1900
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
1901
|
+
get attrs() {
|
|
1902
|
+
markAttrsAccessed();
|
|
1903
|
+
return shallowReadonly(attrs);
|
|
1904
|
+
},
|
|
1905
|
+
slots,
|
|
1906
|
+
emit
|
|
1907
|
+
} : { attrs, slots, emit }
|
|
1908
|
+
) : render2(
|
|
1909
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
|
|
1910
|
+
null
|
|
1911
|
+
)
|
|
1912
|
+
);
|
|
1913
|
+
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
|
1914
|
+
}
|
|
1915
|
+
} catch (err) {
|
|
1916
|
+
handleError(err, instance, 1);
|
|
1917
|
+
result = createVNode(Comment);
|
|
1918
|
+
}
|
|
1919
|
+
let root = result;
|
|
1920
|
+
let setRoot = void 0;
|
|
1921
|
+
if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
|
|
1922
|
+
[root, setRoot] = getChildRoot(result);
|
|
1923
|
+
}
|
|
1924
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
1925
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
1926
|
+
const { shapeFlag } = root;
|
|
1927
|
+
if (keys.length) {
|
|
1928
|
+
if (shapeFlag & (1 | 6)) {
|
|
1929
|
+
if (propsOptions && keys.some(isModelListener)) {
|
|
1930
|
+
fallthroughAttrs = filterModelListeners(
|
|
1931
|
+
fallthroughAttrs,
|
|
1932
|
+
propsOptions
|
|
1933
|
+
);
|
|
1934
|
+
}
|
|
1935
|
+
root = cloneVNode(root, fallthroughAttrs, false, true);
|
|
1936
|
+
} else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
|
|
1937
|
+
const allAttrs = Object.keys(attrs);
|
|
1938
|
+
const eventAttrs = [];
|
|
1939
|
+
const extraAttrs = [];
|
|
1940
|
+
for (let i = 0, l = allAttrs.length; i < l; i++) {
|
|
1941
|
+
const key = allAttrs[i];
|
|
1942
|
+
if (isOn(key)) {
|
|
1943
|
+
if (!isModelListener(key)) {
|
|
1944
|
+
eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
|
1945
|
+
}
|
|
1946
|
+
} else {
|
|
1947
|
+
extraAttrs.push(key);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
if (extraAttrs.length) {
|
|
1951
|
+
warn$1(
|
|
1952
|
+
`Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
|
|
1953
|
+
);
|
|
1954
|
+
}
|
|
1955
|
+
if (eventAttrs.length) {
|
|
1956
|
+
warn$1(
|
|
1957
|
+
`Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
|
|
1958
|
+
);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
if (vnode.dirs) {
|
|
1964
|
+
if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
|
|
1965
|
+
warn$1(
|
|
1966
|
+
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
1967
|
+
);
|
|
1968
|
+
}
|
|
1969
|
+
root = cloneVNode(root, null, false, true);
|
|
1970
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
1971
|
+
}
|
|
1972
|
+
if (vnode.transition) {
|
|
1973
|
+
if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
|
|
1974
|
+
warn$1(
|
|
1975
|
+
`Component inside <Transition> renders non-element root node that cannot be animated.`
|
|
1976
|
+
);
|
|
1977
|
+
}
|
|
1978
|
+
root.transition = vnode.transition;
|
|
1979
|
+
}
|
|
1980
|
+
if (!!(process.env.NODE_ENV !== "production") && setRoot) {
|
|
1981
|
+
setRoot(root);
|
|
1982
|
+
} else {
|
|
1983
|
+
result = root;
|
|
1984
|
+
}
|
|
1985
|
+
setCurrentRenderingInstance$1(prev);
|
|
1986
|
+
return result;
|
|
1987
|
+
}
|
|
1988
|
+
const getChildRoot = (vnode) => {
|
|
1989
|
+
const rawChildren = vnode.children;
|
|
1990
|
+
const dynamicChildren = vnode.dynamicChildren;
|
|
1991
|
+
const childRoot = filterSingleRoot(rawChildren, false);
|
|
1992
|
+
if (!childRoot) {
|
|
1993
|
+
return [vnode, void 0];
|
|
1994
|
+
} else if (!!(process.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
|
|
1995
|
+
return getChildRoot(childRoot);
|
|
1996
|
+
}
|
|
1997
|
+
const index = rawChildren.indexOf(childRoot);
|
|
1998
|
+
const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
|
1999
|
+
const setRoot = (updatedRoot) => {
|
|
2000
|
+
rawChildren[index] = updatedRoot;
|
|
2001
|
+
if (dynamicChildren) {
|
|
2002
|
+
if (dynamicIndex > -1) {
|
|
2003
|
+
dynamicChildren[dynamicIndex] = updatedRoot;
|
|
2004
|
+
} else if (updatedRoot.patchFlag > 0) {
|
|
2005
|
+
vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
};
|
|
2009
|
+
return [normalizeVNode$1(childRoot), setRoot];
|
|
2010
|
+
};
|
|
2011
|
+
function filterSingleRoot(children, recurse = true) {
|
|
2012
|
+
let singleRoot;
|
|
2013
|
+
for (let i = 0; i < children.length; i++) {
|
|
2014
|
+
const child = children[i];
|
|
2015
|
+
if (isVNode$2(child)) {
|
|
2016
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
2017
|
+
if (singleRoot) {
|
|
2018
|
+
return;
|
|
2019
|
+
} else {
|
|
2020
|
+
singleRoot = child;
|
|
2021
|
+
if (!!(process.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
|
|
2022
|
+
return filterSingleRoot(singleRoot.children);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
} else {
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
return singleRoot;
|
|
2031
|
+
}
|
|
2032
|
+
const getFunctionalFallthrough = (attrs) => {
|
|
2033
|
+
let res;
|
|
2034
|
+
for (const key in attrs) {
|
|
2035
|
+
if (key === "class" || key === "style" || isOn(key)) {
|
|
2036
|
+
(res || (res = {}))[key] = attrs[key];
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
return res;
|
|
2040
|
+
};
|
|
2041
|
+
const filterModelListeners = (attrs, props) => {
|
|
2042
|
+
const res = {};
|
|
2043
|
+
for (const key in attrs) {
|
|
2044
|
+
if (!isModelListener(key) || !(key.slice(9) in props)) {
|
|
2045
|
+
res[key] = attrs[key];
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
return res;
|
|
2049
|
+
};
|
|
2050
|
+
const isElementRoot = (vnode) => {
|
|
2051
|
+
return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
2055
|
+
|
|
2056
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
2057
|
+
function queueEffectWithSuspense(fn, suspense) {
|
|
2058
|
+
if (suspense && suspense.pendingBranch) {
|
|
2059
|
+
if (isArray(fn)) {
|
|
2060
|
+
suspense.effects.push(...fn);
|
|
2061
|
+
} else {
|
|
2062
|
+
suspense.effects.push(fn);
|
|
2063
|
+
}
|
|
2064
|
+
} else {
|
|
2065
|
+
queuePostFlushCb(fn);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
2070
|
+
if (target) {
|
|
2071
|
+
const hooks = target[type] || (target[type] = []);
|
|
2072
|
+
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
2073
|
+
pauseTracking();
|
|
2074
|
+
const reset = setCurrentInstance(target);
|
|
2075
|
+
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
2076
|
+
reset();
|
|
2077
|
+
resetTracking();
|
|
2078
|
+
return res;
|
|
2079
|
+
});
|
|
2080
|
+
if (prepend) {
|
|
2081
|
+
hooks.unshift(wrappedHook);
|
|
2082
|
+
} else {
|
|
2083
|
+
hooks.push(wrappedHook);
|
|
2084
|
+
}
|
|
2085
|
+
return wrappedHook;
|
|
2086
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2087
|
+
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2088
|
+
warn$1(
|
|
2089
|
+
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
const createHook = (lifecycle) => (hook, target = currentInstance) => {
|
|
2094
|
+
if (!isInSSRComponentSetup || lifecycle === "sp") {
|
|
2095
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
const onBeforeMount = createHook("bm");
|
|
2099
|
+
const onMounted = createHook("m");
|
|
2100
|
+
const onBeforeUpdate = createHook("bu");
|
|
2101
|
+
const onUpdated = createHook("u");
|
|
2102
|
+
const onBeforeUnmount = createHook("bum");
|
|
2103
|
+
const onUnmounted = createHook("um");
|
|
2104
|
+
const onServerPrefetch = createHook("sp");
|
|
2105
|
+
const onRenderTriggered = createHook(
|
|
2106
|
+
"rtg"
|
|
2107
|
+
);
|
|
2108
|
+
const onRenderTracked = createHook(
|
|
2109
|
+
"rtc"
|
|
2110
|
+
);
|
|
2111
|
+
function onErrorCaptured(hook, target = currentInstance) {
|
|
2112
|
+
injectHook("ec", hook, target);
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
function validateDirectiveName(name) {
|
|
2116
|
+
if (isBuiltInDirective(name)) {
|
|
2117
|
+
warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
const getPublicInstance = (i) => {
|
|
2122
|
+
if (!i) return null;
|
|
2123
|
+
if (isStatefulComponent(i)) return getComponentPublicInstance(i);
|
|
2124
|
+
return getPublicInstance(i.parent);
|
|
2125
|
+
};
|
|
2126
|
+
const publicPropertiesMap = (
|
|
2127
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
2128
|
+
// due to type annotation
|
|
2129
|
+
/* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
|
|
2130
|
+
$: (i) => i,
|
|
2131
|
+
$el: (i) => i.vnode.el,
|
|
2132
|
+
$data: (i) => i.data,
|
|
2133
|
+
$props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
|
|
2134
|
+
$attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
|
|
2135
|
+
$slots: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.slots) : i.slots,
|
|
2136
|
+
$refs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.refs) : i.refs,
|
|
2137
|
+
$parent: (i) => getPublicInstance(i.parent),
|
|
2138
|
+
$root: (i) => getPublicInstance(i.root),
|
|
2139
|
+
$emit: (i) => i.emit,
|
|
2140
|
+
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
2141
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2142
|
+
i.effect.dirty = true;
|
|
2143
|
+
queueJob(i.update);
|
|
2144
|
+
}),
|
|
2145
|
+
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2146
|
+
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
|
|
2147
|
+
})
|
|
2148
|
+
);
|
|
2149
|
+
const isReservedPrefix = (key) => key === "_" || key === "$";
|
|
2150
|
+
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
|
2151
|
+
const PublicInstanceProxyHandlers = {
|
|
2152
|
+
get({ _: instance }, key) {
|
|
2153
|
+
if (key === "__v_skip") {
|
|
2154
|
+
return true;
|
|
2155
|
+
}
|
|
2156
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
2157
|
+
if (!!(process.env.NODE_ENV !== "production") && key === "__isVue") {
|
|
2158
|
+
return true;
|
|
2159
|
+
}
|
|
2160
|
+
let normalizedProps;
|
|
2161
|
+
if (key[0] !== "$") {
|
|
2162
|
+
const n = accessCache[key];
|
|
2163
|
+
if (n !== void 0) {
|
|
2164
|
+
switch (n) {
|
|
2165
|
+
case 1 /* SETUP */:
|
|
2166
|
+
return setupState[key];
|
|
2167
|
+
case 2 /* DATA */:
|
|
2168
|
+
return data[key];
|
|
2169
|
+
case 4 /* CONTEXT */:
|
|
2170
|
+
return ctx[key];
|
|
2171
|
+
case 3 /* PROPS */:
|
|
2172
|
+
return props[key];
|
|
2173
|
+
}
|
|
2174
|
+
} else if (hasSetupBinding(setupState, key)) {
|
|
2175
|
+
accessCache[key] = 1 /* SETUP */;
|
|
2176
|
+
return setupState[key];
|
|
2177
|
+
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
2178
|
+
accessCache[key] = 2 /* DATA */;
|
|
2179
|
+
return data[key];
|
|
2180
|
+
} else if (
|
|
2181
|
+
// only cache other properties when instance has declared (thus stable)
|
|
2182
|
+
// props
|
|
2183
|
+
(normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
|
|
2184
|
+
) {
|
|
2185
|
+
accessCache[key] = 3 /* PROPS */;
|
|
2186
|
+
return props[key];
|
|
2187
|
+
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2188
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2189
|
+
return ctx[key];
|
|
2190
|
+
} else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
2191
|
+
accessCache[key] = 0 /* OTHER */;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
const publicGetter = publicPropertiesMap[key];
|
|
2195
|
+
let cssModule, globalProperties;
|
|
2196
|
+
if (publicGetter) {
|
|
2197
|
+
if (key === "$attrs") {
|
|
2198
|
+
track(instance.attrs, "get", "");
|
|
2199
|
+
!!(process.env.NODE_ENV !== "production") && markAttrsAccessed();
|
|
2200
|
+
} else if (!!(process.env.NODE_ENV !== "production") && key === "$slots") {
|
|
2201
|
+
track(instance, "get", key);
|
|
2202
|
+
}
|
|
2203
|
+
return publicGetter(instance);
|
|
2204
|
+
} else if (
|
|
2205
|
+
// css module (injected by vue-loader)
|
|
2206
|
+
(cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
|
2207
|
+
) {
|
|
2208
|
+
return cssModule;
|
|
2209
|
+
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2210
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2211
|
+
return ctx[key];
|
|
2212
|
+
} else if (
|
|
2213
|
+
// global properties
|
|
2214
|
+
globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
|
|
2215
|
+
) {
|
|
2216
|
+
{
|
|
2217
|
+
return globalProperties[key];
|
|
2218
|
+
}
|
|
2219
|
+
} else if (!!(process.env.NODE_ENV !== "production") && currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
2220
|
+
// to infinite warning loop
|
|
2221
|
+
key.indexOf("__v") !== 0)) {
|
|
2222
|
+
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
2223
|
+
warn$1(
|
|
2224
|
+
`Property ${JSON.stringify(
|
|
2225
|
+
key
|
|
2226
|
+
)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
|
|
2227
|
+
);
|
|
2228
|
+
} else if (instance === currentRenderingInstance) {
|
|
2229
|
+
warn$1(
|
|
2230
|
+
`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
|
2231
|
+
);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
},
|
|
2235
|
+
set({ _: instance }, key, value) {
|
|
2236
|
+
const { data, setupState, ctx } = instance;
|
|
2237
|
+
if (hasSetupBinding(setupState, key)) {
|
|
2238
|
+
setupState[key] = value;
|
|
2239
|
+
return true;
|
|
2240
|
+
} else if (!!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
|
2241
|
+
warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
2242
|
+
return false;
|
|
2243
|
+
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
2244
|
+
data[key] = value;
|
|
2245
|
+
return true;
|
|
2246
|
+
} else if (hasOwn(instance.props, key)) {
|
|
2247
|
+
!!(process.env.NODE_ENV !== "production") && warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
2248
|
+
return false;
|
|
2249
|
+
}
|
|
2250
|
+
if (key[0] === "$" && key.slice(1) in instance) {
|
|
2251
|
+
!!(process.env.NODE_ENV !== "production") && warn$1(
|
|
2252
|
+
`Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
|
|
2253
|
+
);
|
|
2254
|
+
return false;
|
|
2255
|
+
} else {
|
|
2256
|
+
if (!!(process.env.NODE_ENV !== "production") && key in instance.appContext.config.globalProperties) {
|
|
2257
|
+
Object.defineProperty(ctx, key, {
|
|
2258
|
+
enumerable: true,
|
|
2259
|
+
configurable: true,
|
|
2260
|
+
value
|
|
2261
|
+
});
|
|
2262
|
+
} else {
|
|
2263
|
+
ctx[key] = value;
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
return true;
|
|
2267
|
+
},
|
|
2268
|
+
has({
|
|
2269
|
+
_: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
|
2270
|
+
}, key) {
|
|
2271
|
+
let normalizedProps;
|
|
2272
|
+
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
|
|
2273
|
+
},
|
|
2274
|
+
defineProperty(target, key, descriptor) {
|
|
2275
|
+
if (descriptor.get != null) {
|
|
2276
|
+
target._.accessCache[key] = 0;
|
|
2277
|
+
} else if (hasOwn(descriptor, "value")) {
|
|
2278
|
+
this.set(target, key, descriptor.value, null);
|
|
2279
|
+
}
|
|
2280
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
2284
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
2285
|
+
warn$1(
|
|
2286
|
+
`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
|
2287
|
+
);
|
|
2288
|
+
return Reflect.ownKeys(target);
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2291
|
+
function createDevRenderContext(instance) {
|
|
2292
|
+
const target = {};
|
|
2293
|
+
Object.defineProperty(target, `_`, {
|
|
2294
|
+
configurable: true,
|
|
2295
|
+
enumerable: false,
|
|
2296
|
+
get: () => instance
|
|
2297
|
+
});
|
|
2298
|
+
Object.keys(publicPropertiesMap).forEach((key) => {
|
|
2299
|
+
Object.defineProperty(target, key, {
|
|
2300
|
+
configurable: true,
|
|
2301
|
+
enumerable: false,
|
|
2302
|
+
get: () => publicPropertiesMap[key](instance),
|
|
2303
|
+
// intercepted by the proxy so no need for implementation,
|
|
2304
|
+
// but needed to prevent set errors
|
|
2305
|
+
set: NOOP
|
|
2306
|
+
});
|
|
2307
|
+
});
|
|
2308
|
+
return target;
|
|
2309
|
+
}
|
|
2310
|
+
function exposePropsOnRenderContext(instance) {
|
|
2311
|
+
const {
|
|
2312
|
+
ctx,
|
|
2313
|
+
propsOptions: [propsOptions]
|
|
2314
|
+
} = instance;
|
|
2315
|
+
if (propsOptions) {
|
|
2316
|
+
Object.keys(propsOptions).forEach((key) => {
|
|
2317
|
+
Object.defineProperty(ctx, key, {
|
|
2318
|
+
enumerable: true,
|
|
2319
|
+
configurable: true,
|
|
2320
|
+
get: () => instance.props[key],
|
|
2321
|
+
set: NOOP
|
|
2322
|
+
});
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
function exposeSetupStateOnRenderContext(instance) {
|
|
2327
|
+
const { ctx, setupState } = instance;
|
|
2328
|
+
Object.keys(toRaw(setupState)).forEach((key) => {
|
|
2329
|
+
if (!setupState.__isScriptSetup) {
|
|
2330
|
+
if (isReservedPrefix(key[0])) {
|
|
2331
|
+
warn$1(
|
|
2332
|
+
`setup() return property ${JSON.stringify(
|
|
2333
|
+
key
|
|
2334
|
+
)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
|
|
2335
|
+
);
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
Object.defineProperty(ctx, key, {
|
|
2339
|
+
enumerable: true,
|
|
2340
|
+
configurable: true,
|
|
2341
|
+
get: () => setupState[key],
|
|
2342
|
+
set: NOOP
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
function normalizePropsOrEmits(props) {
|
|
2349
|
+
return isArray(props) ? props.reduce(
|
|
2350
|
+
(normalized, p) => (normalized[p] = null, normalized),
|
|
2351
|
+
{}
|
|
2352
|
+
) : props;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
function createDuplicateChecker() {
|
|
2356
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
2357
|
+
return (type, key) => {
|
|
2358
|
+
if (cache[key]) {
|
|
2359
|
+
warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
2360
|
+
} else {
|
|
2361
|
+
cache[key] = type;
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
let shouldCacheAccess = true;
|
|
2366
|
+
function applyOptions(instance) {
|
|
2367
|
+
const options = resolveMergedOptions(instance);
|
|
2368
|
+
const publicThis = instance.proxy;
|
|
2369
|
+
const ctx = instance.ctx;
|
|
2370
|
+
shouldCacheAccess = false;
|
|
2371
|
+
if (options.beforeCreate) {
|
|
2372
|
+
callHook(options.beforeCreate, instance, "bc");
|
|
2373
|
+
}
|
|
2374
|
+
const {
|
|
2375
|
+
// state
|
|
2376
|
+
data: dataOptions,
|
|
2377
|
+
computed: computedOptions,
|
|
2378
|
+
methods,
|
|
2379
|
+
watch: watchOptions,
|
|
2380
|
+
provide: provideOptions,
|
|
2381
|
+
inject: injectOptions,
|
|
2382
|
+
// lifecycle
|
|
2383
|
+
created,
|
|
2384
|
+
beforeMount,
|
|
2385
|
+
mounted,
|
|
2386
|
+
beforeUpdate,
|
|
2387
|
+
updated,
|
|
2388
|
+
activated,
|
|
2389
|
+
deactivated,
|
|
2390
|
+
beforeDestroy,
|
|
2391
|
+
beforeUnmount,
|
|
2392
|
+
destroyed,
|
|
2393
|
+
unmounted,
|
|
2394
|
+
render,
|
|
2395
|
+
renderTracked,
|
|
2396
|
+
renderTriggered,
|
|
2397
|
+
errorCaptured,
|
|
2398
|
+
serverPrefetch,
|
|
2399
|
+
// public API
|
|
2400
|
+
expose,
|
|
2401
|
+
inheritAttrs,
|
|
2402
|
+
// assets
|
|
2403
|
+
components,
|
|
2404
|
+
directives,
|
|
2405
|
+
filters
|
|
2406
|
+
} = options;
|
|
2407
|
+
const checkDuplicateProperties = !!(process.env.NODE_ENV !== "production") ? createDuplicateChecker() : null;
|
|
2408
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2409
|
+
const [propsOptions] = instance.propsOptions;
|
|
2410
|
+
if (propsOptions) {
|
|
2411
|
+
for (const key in propsOptions) {
|
|
2412
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
if (injectOptions) {
|
|
2417
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
|
2418
|
+
}
|
|
2419
|
+
if (methods) {
|
|
2420
|
+
for (const key in methods) {
|
|
2421
|
+
const methodHandler = methods[key];
|
|
2422
|
+
if (isFunction(methodHandler)) {
|
|
2423
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2424
|
+
Object.defineProperty(ctx, key, {
|
|
2425
|
+
value: methodHandler.bind(publicThis),
|
|
2426
|
+
configurable: true,
|
|
2427
|
+
enumerable: true,
|
|
2428
|
+
writable: true
|
|
2429
|
+
});
|
|
2430
|
+
} else {
|
|
2431
|
+
ctx[key] = methodHandler.bind(publicThis);
|
|
2432
|
+
}
|
|
2433
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2434
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
2435
|
+
}
|
|
2436
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2437
|
+
warn$1(
|
|
2438
|
+
`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
|
2439
|
+
);
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
if (dataOptions) {
|
|
2444
|
+
if (!!(process.env.NODE_ENV !== "production") && !isFunction(dataOptions)) {
|
|
2445
|
+
warn$1(
|
|
2446
|
+
`The data option must be a function. Plain object usage is no longer supported.`
|
|
2447
|
+
);
|
|
2448
|
+
}
|
|
2449
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
2450
|
+
if (!!(process.env.NODE_ENV !== "production") && isPromise(data)) {
|
|
2451
|
+
warn$1(
|
|
2452
|
+
`data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
|
|
2453
|
+
);
|
|
2454
|
+
}
|
|
2455
|
+
if (!isObject(data)) {
|
|
2456
|
+
!!(process.env.NODE_ENV !== "production") && warn$1(`data() should return an object.`);
|
|
2457
|
+
} else {
|
|
2458
|
+
instance.data = reactive(data);
|
|
2459
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2460
|
+
for (const key in data) {
|
|
2461
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
2462
|
+
if (!isReservedPrefix(key[0])) {
|
|
2463
|
+
Object.defineProperty(ctx, key, {
|
|
2464
|
+
configurable: true,
|
|
2465
|
+
enumerable: true,
|
|
2466
|
+
get: () => data[key],
|
|
2467
|
+
set: NOOP
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
shouldCacheAccess = true;
|
|
2475
|
+
if (computedOptions) {
|
|
2476
|
+
for (const key in computedOptions) {
|
|
2477
|
+
const opt = computedOptions[key];
|
|
2478
|
+
const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
|
2479
|
+
if (!!(process.env.NODE_ENV !== "production") && get === NOOP) {
|
|
2480
|
+
warn$1(`Computed property "${key}" has no getter.`);
|
|
2481
|
+
}
|
|
2482
|
+
const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : !!(process.env.NODE_ENV !== "production") ? () => {
|
|
2483
|
+
warn$1(
|
|
2484
|
+
`Write operation failed: computed property "${key}" is readonly.`
|
|
2485
|
+
);
|
|
2486
|
+
} : NOOP;
|
|
2487
|
+
const c = computed({
|
|
2488
|
+
get,
|
|
2489
|
+
set
|
|
2490
|
+
});
|
|
2491
|
+
Object.defineProperty(ctx, key, {
|
|
2492
|
+
enumerable: true,
|
|
2493
|
+
configurable: true,
|
|
2494
|
+
get: () => c.value,
|
|
2495
|
+
set: (v) => c.value = v
|
|
2496
|
+
});
|
|
2497
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2498
|
+
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
if (watchOptions) {
|
|
2503
|
+
for (const key in watchOptions) {
|
|
2504
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
if (provideOptions) {
|
|
2508
|
+
const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
|
2509
|
+
Reflect.ownKeys(provides).forEach((key) => {
|
|
2510
|
+
provide(key, provides[key]);
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
if (created) {
|
|
2514
|
+
callHook(created, instance, "c");
|
|
2515
|
+
}
|
|
2516
|
+
function registerLifecycleHook(register, hook) {
|
|
2517
|
+
if (isArray(hook)) {
|
|
2518
|
+
hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
|
2519
|
+
} else if (hook) {
|
|
2520
|
+
register(hook.bind(publicThis));
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
2524
|
+
registerLifecycleHook(onMounted, mounted);
|
|
2525
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
2526
|
+
registerLifecycleHook(onUpdated, updated);
|
|
2527
|
+
registerLifecycleHook(onActivated, activated);
|
|
2528
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
2529
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
2530
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
2531
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
2532
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
2533
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
2534
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
2535
|
+
if (isArray(expose)) {
|
|
2536
|
+
if (expose.length) {
|
|
2537
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
2538
|
+
expose.forEach((key) => {
|
|
2539
|
+
Object.defineProperty(exposed, key, {
|
|
2540
|
+
get: () => publicThis[key],
|
|
2541
|
+
set: (val) => publicThis[key] = val
|
|
2542
|
+
});
|
|
2543
|
+
});
|
|
2544
|
+
} else if (!instance.exposed) {
|
|
2545
|
+
instance.exposed = {};
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
if (render && instance.render === NOOP) {
|
|
2549
|
+
instance.render = render;
|
|
2550
|
+
}
|
|
2551
|
+
if (inheritAttrs != null) {
|
|
2552
|
+
instance.inheritAttrs = inheritAttrs;
|
|
2553
|
+
}
|
|
2554
|
+
if (components) instance.components = components;
|
|
2555
|
+
if (directives) instance.directives = directives;
|
|
2556
|
+
}
|
|
2557
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
|
|
2558
|
+
if (isArray(injectOptions)) {
|
|
2559
|
+
injectOptions = normalizeInject(injectOptions);
|
|
2560
|
+
}
|
|
2561
|
+
for (const key in injectOptions) {
|
|
2562
|
+
const opt = injectOptions[key];
|
|
2563
|
+
let injected;
|
|
2564
|
+
if (isObject(opt)) {
|
|
2565
|
+
if ("default" in opt) {
|
|
2566
|
+
injected = inject(
|
|
2567
|
+
opt.from || key,
|
|
2568
|
+
opt.default,
|
|
2569
|
+
true
|
|
2570
|
+
);
|
|
2571
|
+
} else {
|
|
2572
|
+
injected = inject(opt.from || key);
|
|
2573
|
+
}
|
|
2574
|
+
} else {
|
|
2575
|
+
injected = inject(opt);
|
|
2576
|
+
}
|
|
2577
|
+
if (isRef(injected)) {
|
|
2578
|
+
Object.defineProperty(ctx, key, {
|
|
2579
|
+
enumerable: true,
|
|
2580
|
+
configurable: true,
|
|
2581
|
+
get: () => injected.value,
|
|
2582
|
+
set: (v) => injected.value = v
|
|
2583
|
+
});
|
|
2584
|
+
} else {
|
|
2585
|
+
ctx[key] = injected;
|
|
2586
|
+
}
|
|
2587
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2588
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
function callHook(hook, instance, type) {
|
|
2593
|
+
callWithAsyncErrorHandling(
|
|
2594
|
+
isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
|
2595
|
+
instance,
|
|
2596
|
+
type
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
2600
|
+
const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
2601
|
+
if (isString(raw)) {
|
|
2602
|
+
const handler = ctx[raw];
|
|
2603
|
+
if (isFunction(handler)) {
|
|
2604
|
+
watch(getter, handler);
|
|
2605
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2606
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
2607
|
+
}
|
|
2608
|
+
} else if (isFunction(raw)) {
|
|
2609
|
+
watch(getter, raw.bind(publicThis));
|
|
2610
|
+
} else if (isObject(raw)) {
|
|
2611
|
+
if (isArray(raw)) {
|
|
2612
|
+
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
2613
|
+
} else {
|
|
2614
|
+
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
2615
|
+
if (isFunction(handler)) {
|
|
2616
|
+
watch(getter, handler, raw);
|
|
2617
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2618
|
+
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2622
|
+
warn$1(`Invalid watch option: "${key}"`, raw);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
function resolveMergedOptions(instance) {
|
|
2626
|
+
const base = instance.type;
|
|
2627
|
+
const { mixins, extends: extendsOptions } = base;
|
|
2628
|
+
const {
|
|
2629
|
+
mixins: globalMixins,
|
|
2630
|
+
optionsCache: cache,
|
|
2631
|
+
config: { optionMergeStrategies }
|
|
2632
|
+
} = instance.appContext;
|
|
2633
|
+
const cached = cache.get(base);
|
|
2634
|
+
let resolved;
|
|
2635
|
+
if (cached) {
|
|
2636
|
+
resolved = cached;
|
|
2637
|
+
} else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2638
|
+
{
|
|
2639
|
+
resolved = base;
|
|
2640
|
+
}
|
|
2641
|
+
} else {
|
|
2642
|
+
resolved = {};
|
|
2643
|
+
if (globalMixins.length) {
|
|
2644
|
+
globalMixins.forEach(
|
|
2645
|
+
(m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
|
2646
|
+
);
|
|
2647
|
+
}
|
|
2648
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2649
|
+
}
|
|
2650
|
+
if (isObject(base)) {
|
|
2651
|
+
cache.set(base, resolved);
|
|
2652
|
+
}
|
|
2653
|
+
return resolved;
|
|
2654
|
+
}
|
|
2655
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2656
|
+
const { mixins, extends: extendsOptions } = from;
|
|
2657
|
+
if (extendsOptions) {
|
|
2658
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
2659
|
+
}
|
|
2660
|
+
if (mixins) {
|
|
2661
|
+
mixins.forEach(
|
|
2662
|
+
(m) => mergeOptions(to, m, strats, true)
|
|
2663
|
+
);
|
|
2664
|
+
}
|
|
2665
|
+
for (const key in from) {
|
|
2666
|
+
if (asMixin && key === "expose") {
|
|
2667
|
+
!!(process.env.NODE_ENV !== "production") && warn$1(
|
|
2668
|
+
`"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
|
2669
|
+
);
|
|
2670
|
+
} else {
|
|
2671
|
+
const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
|
2672
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
return to;
|
|
2676
|
+
}
|
|
2677
|
+
const internalOptionMergeStrats = {
|
|
2678
|
+
data: mergeDataFn,
|
|
2679
|
+
props: mergeEmitsOrPropsOptions,
|
|
2680
|
+
emits: mergeEmitsOrPropsOptions,
|
|
2681
|
+
// objects
|
|
2682
|
+
methods: mergeObjectOptions,
|
|
2683
|
+
computed: mergeObjectOptions,
|
|
2684
|
+
// lifecycle
|
|
2685
|
+
beforeCreate: mergeAsArray,
|
|
2686
|
+
created: mergeAsArray,
|
|
2687
|
+
beforeMount: mergeAsArray,
|
|
2688
|
+
mounted: mergeAsArray,
|
|
2689
|
+
beforeUpdate: mergeAsArray,
|
|
2690
|
+
updated: mergeAsArray,
|
|
2691
|
+
beforeDestroy: mergeAsArray,
|
|
2692
|
+
beforeUnmount: mergeAsArray,
|
|
2693
|
+
destroyed: mergeAsArray,
|
|
2694
|
+
unmounted: mergeAsArray,
|
|
2695
|
+
activated: mergeAsArray,
|
|
2696
|
+
deactivated: mergeAsArray,
|
|
2697
|
+
errorCaptured: mergeAsArray,
|
|
2698
|
+
serverPrefetch: mergeAsArray,
|
|
2699
|
+
// assets
|
|
2700
|
+
components: mergeObjectOptions,
|
|
2701
|
+
directives: mergeObjectOptions,
|
|
2702
|
+
// watch
|
|
2703
|
+
watch: mergeWatchOptions,
|
|
2704
|
+
// provide / inject
|
|
2705
|
+
provide: mergeDataFn,
|
|
2706
|
+
inject: mergeInject
|
|
2707
|
+
};
|
|
2708
|
+
function mergeDataFn(to, from) {
|
|
2709
|
+
if (!from) {
|
|
2710
|
+
return to;
|
|
2711
|
+
}
|
|
2712
|
+
if (!to) {
|
|
2713
|
+
return from;
|
|
2714
|
+
}
|
|
2715
|
+
return function mergedDataFn() {
|
|
2716
|
+
return (extend)(
|
|
2717
|
+
isFunction(to) ? to.call(this, this) : to,
|
|
2718
|
+
isFunction(from) ? from.call(this, this) : from
|
|
2719
|
+
);
|
|
2720
|
+
};
|
|
2721
|
+
}
|
|
2722
|
+
function mergeInject(to, from) {
|
|
2723
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2724
|
+
}
|
|
2725
|
+
function normalizeInject(raw) {
|
|
2726
|
+
if (isArray(raw)) {
|
|
2727
|
+
const res = {};
|
|
2728
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2729
|
+
res[raw[i]] = raw[i];
|
|
2730
|
+
}
|
|
2731
|
+
return res;
|
|
2732
|
+
}
|
|
2733
|
+
return raw;
|
|
2734
|
+
}
|
|
2735
|
+
function mergeAsArray(to, from) {
|
|
2736
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
2737
|
+
}
|
|
2738
|
+
function mergeObjectOptions(to, from) {
|
|
2739
|
+
return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
|
2740
|
+
}
|
|
2741
|
+
function mergeEmitsOrPropsOptions(to, from) {
|
|
2742
|
+
if (to) {
|
|
2743
|
+
if (isArray(to) && isArray(from)) {
|
|
2744
|
+
return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
2745
|
+
}
|
|
2746
|
+
return extend(
|
|
2747
|
+
/* @__PURE__ */ Object.create(null),
|
|
2748
|
+
normalizePropsOrEmits(to),
|
|
2749
|
+
normalizePropsOrEmits(from != null ? from : {})
|
|
2750
|
+
);
|
|
2751
|
+
} else {
|
|
2752
|
+
return from;
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
function mergeWatchOptions(to, from) {
|
|
2756
|
+
if (!to) return from;
|
|
2757
|
+
if (!from) return to;
|
|
2758
|
+
const merged = extend(/* @__PURE__ */ Object.create(null), to);
|
|
2759
|
+
for (const key in from) {
|
|
2760
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
2761
|
+
}
|
|
2762
|
+
return merged;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
function createAppContext() {
|
|
2766
|
+
return {
|
|
2767
|
+
app: null,
|
|
2768
|
+
config: {
|
|
2769
|
+
isNativeTag: NO,
|
|
2770
|
+
performance: false,
|
|
2771
|
+
globalProperties: {},
|
|
2772
|
+
optionMergeStrategies: {},
|
|
2773
|
+
errorHandler: void 0,
|
|
2774
|
+
warnHandler: void 0,
|
|
2775
|
+
compilerOptions: {}
|
|
2776
|
+
},
|
|
2777
|
+
mixins: [],
|
|
2778
|
+
components: {},
|
|
2779
|
+
directives: {},
|
|
2780
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
2781
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
2782
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
2783
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2786
|
+
let currentApp = null;
|
|
2787
|
+
|
|
2788
|
+
function provide(key, value) {
|
|
2789
|
+
if (!currentInstance) {
|
|
2790
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2791
|
+
warn$1(`provide() can only be used inside setup().`);
|
|
2792
|
+
}
|
|
2793
|
+
} else {
|
|
2794
|
+
let provides = currentInstance.provides;
|
|
2795
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
2796
|
+
if (parentProvides === provides) {
|
|
2797
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
2798
|
+
}
|
|
2799
|
+
provides[key] = value;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
2803
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
2804
|
+
if (instance || currentApp) {
|
|
2805
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
2806
|
+
if (provides && key in provides) {
|
|
2807
|
+
return provides[key];
|
|
2808
|
+
} else if (arguments.length > 1) {
|
|
2809
|
+
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
2810
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2811
|
+
warn$1(`injection "${String(key)}" not found.`);
|
|
2812
|
+
}
|
|
2813
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2814
|
+
warn$1(`inject() can only be used inside setup() or functional components.`);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
const internalObjectProto = {};
|
|
2819
|
+
const createInternalObject = () => Object.create(internalObjectProto);
|
|
2820
|
+
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
2821
|
+
|
|
2822
|
+
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
2823
|
+
const props = {};
|
|
2824
|
+
const attrs = createInternalObject();
|
|
2825
|
+
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
2826
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
2827
|
+
for (const key in instance.propsOptions[0]) {
|
|
2828
|
+
if (!(key in props)) {
|
|
2829
|
+
props[key] = void 0;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2833
|
+
validateProps(rawProps || {}, props, instance);
|
|
2834
|
+
}
|
|
2835
|
+
if (isStateful) {
|
|
2836
|
+
instance.props = isSSR ? props : shallowReactive(props);
|
|
2837
|
+
} else {
|
|
2838
|
+
if (!instance.type.props) {
|
|
2839
|
+
instance.props = attrs;
|
|
2840
|
+
} else {
|
|
2841
|
+
instance.props = props;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
instance.attrs = attrs;
|
|
2845
|
+
}
|
|
2846
|
+
function setFullProps(instance, rawProps, props, attrs) {
|
|
2847
|
+
const [options, needCastKeys] = instance.propsOptions;
|
|
2848
|
+
let hasAttrsChanged = false;
|
|
2849
|
+
let rawCastValues;
|
|
2850
|
+
if (rawProps) {
|
|
2851
|
+
for (let key in rawProps) {
|
|
2852
|
+
if (isReservedProp(key)) {
|
|
2853
|
+
continue;
|
|
2854
|
+
}
|
|
2855
|
+
const value = rawProps[key];
|
|
2856
|
+
let camelKey;
|
|
2857
|
+
if (options && hasOwn(options, camelKey = camelize(key))) {
|
|
2858
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
2859
|
+
props[camelKey] = value;
|
|
2860
|
+
} else {
|
|
2861
|
+
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
2862
|
+
}
|
|
2863
|
+
} else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2864
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
2865
|
+
attrs[key] = value;
|
|
2866
|
+
hasAttrsChanged = true;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
if (needCastKeys) {
|
|
2872
|
+
const rawCurrentProps = toRaw(props);
|
|
2873
|
+
const castValues = rawCastValues || EMPTY_OBJ;
|
|
2874
|
+
for (let i = 0; i < needCastKeys.length; i++) {
|
|
2875
|
+
const key = needCastKeys[i];
|
|
2876
|
+
props[key] = resolvePropValue(
|
|
2877
|
+
options,
|
|
2878
|
+
rawCurrentProps,
|
|
2879
|
+
key,
|
|
2880
|
+
castValues[key],
|
|
2881
|
+
instance,
|
|
2882
|
+
!hasOwn(castValues, key)
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return hasAttrsChanged;
|
|
2887
|
+
}
|
|
2888
|
+
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
2889
|
+
const opt = options[key];
|
|
2890
|
+
if (opt != null) {
|
|
2891
|
+
const hasDefault = hasOwn(opt, "default");
|
|
2892
|
+
if (hasDefault && value === void 0) {
|
|
2893
|
+
const defaultValue = opt.default;
|
|
2894
|
+
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
2895
|
+
const { propsDefaults } = instance;
|
|
2896
|
+
if (key in propsDefaults) {
|
|
2897
|
+
value = propsDefaults[key];
|
|
2898
|
+
} else {
|
|
2899
|
+
const reset = setCurrentInstance(instance);
|
|
2900
|
+
value = propsDefaults[key] = defaultValue.call(
|
|
2901
|
+
null,
|
|
2902
|
+
props
|
|
2903
|
+
);
|
|
2904
|
+
reset();
|
|
2905
|
+
}
|
|
2906
|
+
} else {
|
|
2907
|
+
value = defaultValue;
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
if (opt[0 /* shouldCast */]) {
|
|
2911
|
+
if (isAbsent && !hasDefault) {
|
|
2912
|
+
value = false;
|
|
2913
|
+
} else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
|
|
2914
|
+
value = true;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
return value;
|
|
2919
|
+
}
|
|
2920
|
+
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
2921
|
+
const cache = appContext.propsCache;
|
|
2922
|
+
const cached = cache.get(comp);
|
|
2923
|
+
if (cached) {
|
|
2924
|
+
return cached;
|
|
2925
|
+
}
|
|
2926
|
+
const raw = comp.props;
|
|
2927
|
+
const normalized = {};
|
|
2928
|
+
const needCastKeys = [];
|
|
2929
|
+
let hasExtends = false;
|
|
2930
|
+
if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
|
|
2931
|
+
const extendProps = (raw2) => {
|
|
2932
|
+
hasExtends = true;
|
|
2933
|
+
const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
|
2934
|
+
extend(normalized, props);
|
|
2935
|
+
if (keys) needCastKeys.push(...keys);
|
|
2936
|
+
};
|
|
2937
|
+
if (!asMixin && appContext.mixins.length) {
|
|
2938
|
+
appContext.mixins.forEach(extendProps);
|
|
2939
|
+
}
|
|
2940
|
+
if (comp.extends) {
|
|
2941
|
+
extendProps(comp.extends);
|
|
2942
|
+
}
|
|
2943
|
+
if (comp.mixins) {
|
|
2944
|
+
comp.mixins.forEach(extendProps);
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
if (!raw && !hasExtends) {
|
|
2948
|
+
if (isObject(comp)) {
|
|
2949
|
+
cache.set(comp, EMPTY_ARR);
|
|
2950
|
+
}
|
|
2951
|
+
return EMPTY_ARR;
|
|
2952
|
+
}
|
|
2953
|
+
if (isArray(raw)) {
|
|
2954
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2955
|
+
if (!!(process.env.NODE_ENV !== "production") && !isString(raw[i])) {
|
|
2956
|
+
warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
2957
|
+
}
|
|
2958
|
+
const normalizedKey = camelize(raw[i]);
|
|
2959
|
+
if (validatePropName(normalizedKey)) {
|
|
2960
|
+
normalized[normalizedKey] = EMPTY_OBJ;
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
} else if (raw) {
|
|
2964
|
+
if (!!(process.env.NODE_ENV !== "production") && !isObject(raw)) {
|
|
2965
|
+
warn$1(`invalid props options`, raw);
|
|
2966
|
+
}
|
|
2967
|
+
for (const key in raw) {
|
|
2968
|
+
const normalizedKey = camelize(key);
|
|
2969
|
+
if (validatePropName(normalizedKey)) {
|
|
2970
|
+
const opt = raw[key];
|
|
2971
|
+
const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
|
|
2972
|
+
if (prop) {
|
|
2973
|
+
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
2974
|
+
const stringIndex = getTypeIndex(String, prop.type);
|
|
2975
|
+
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
2976
|
+
prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
|
|
2977
|
+
if (booleanIndex > -1 || hasOwn(prop, "default")) {
|
|
2978
|
+
needCastKeys.push(normalizedKey);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
const res = [normalized, needCastKeys];
|
|
2985
|
+
if (isObject(comp)) {
|
|
2986
|
+
cache.set(comp, res);
|
|
2987
|
+
}
|
|
2988
|
+
return res;
|
|
2989
|
+
}
|
|
2990
|
+
function validatePropName(key) {
|
|
2991
|
+
if (key[0] !== "$" && !isReservedProp(key)) {
|
|
2992
|
+
return true;
|
|
2993
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2994
|
+
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
2995
|
+
}
|
|
2996
|
+
return false;
|
|
2997
|
+
}
|
|
2998
|
+
function getType(ctor) {
|
|
2999
|
+
if (ctor === null) {
|
|
3000
|
+
return "null";
|
|
3001
|
+
}
|
|
3002
|
+
if (typeof ctor === "function") {
|
|
3003
|
+
return ctor.name || "";
|
|
3004
|
+
} else if (typeof ctor === "object") {
|
|
3005
|
+
const name = ctor.constructor && ctor.constructor.name;
|
|
3006
|
+
return name || "";
|
|
3007
|
+
}
|
|
3008
|
+
return "";
|
|
3009
|
+
}
|
|
3010
|
+
function isSameType(a, b) {
|
|
3011
|
+
return getType(a) === getType(b);
|
|
3012
|
+
}
|
|
3013
|
+
function getTypeIndex(type, expectedTypes) {
|
|
3014
|
+
if (isArray(expectedTypes)) {
|
|
3015
|
+
return expectedTypes.findIndex((t) => isSameType(t, type));
|
|
3016
|
+
} else if (isFunction(expectedTypes)) {
|
|
3017
|
+
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
3018
|
+
}
|
|
3019
|
+
return -1;
|
|
3020
|
+
}
|
|
3021
|
+
function validateProps(rawProps, props, instance) {
|
|
3022
|
+
const resolvedValues = toRaw(props);
|
|
3023
|
+
const options = instance.propsOptions[0];
|
|
3024
|
+
for (const key in options) {
|
|
3025
|
+
let opt = options[key];
|
|
3026
|
+
if (opt == null) continue;
|
|
3027
|
+
validateProp(
|
|
3028
|
+
key,
|
|
3029
|
+
resolvedValues[key],
|
|
3030
|
+
opt,
|
|
3031
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
|
|
3032
|
+
!hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
function validateProp(name, value, prop, props, isAbsent) {
|
|
3037
|
+
const { type, required, validator, skipCheck } = prop;
|
|
3038
|
+
if (required && isAbsent) {
|
|
3039
|
+
warn$1('Missing required prop: "' + name + '"');
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
if (value == null && !required) {
|
|
3043
|
+
return;
|
|
3044
|
+
}
|
|
3045
|
+
if (type != null && type !== true && !skipCheck) {
|
|
3046
|
+
let isValid = false;
|
|
3047
|
+
const types = isArray(type) ? type : [type];
|
|
3048
|
+
const expectedTypes = [];
|
|
3049
|
+
for (let i = 0; i < types.length && !isValid; i++) {
|
|
3050
|
+
const { valid, expectedType } = assertType(value, types[i]);
|
|
3051
|
+
expectedTypes.push(expectedType || "");
|
|
3052
|
+
isValid = valid;
|
|
3053
|
+
}
|
|
3054
|
+
if (!isValid) {
|
|
3055
|
+
warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
if (validator && !validator(value, props)) {
|
|
3060
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
const isSimpleType = /* @__PURE__ */ makeMap(
|
|
3064
|
+
"String,Number,Boolean,Function,Symbol,BigInt"
|
|
3065
|
+
);
|
|
3066
|
+
function assertType(value, type) {
|
|
3067
|
+
let valid;
|
|
3068
|
+
const expectedType = getType(type);
|
|
3069
|
+
if (isSimpleType(expectedType)) {
|
|
3070
|
+
const t = typeof value;
|
|
3071
|
+
valid = t === expectedType.toLowerCase();
|
|
3072
|
+
if (!valid && t === "object") {
|
|
3073
|
+
valid = value instanceof type;
|
|
3074
|
+
}
|
|
3075
|
+
} else if (expectedType === "Object") {
|
|
3076
|
+
valid = isObject(value);
|
|
3077
|
+
} else if (expectedType === "Array") {
|
|
3078
|
+
valid = isArray(value);
|
|
3079
|
+
} else if (expectedType === "null") {
|
|
3080
|
+
valid = value === null;
|
|
3081
|
+
} else {
|
|
3082
|
+
valid = value instanceof type;
|
|
3083
|
+
}
|
|
3084
|
+
return {
|
|
3085
|
+
valid,
|
|
3086
|
+
expectedType
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
3090
|
+
if (expectedTypes.length === 0) {
|
|
3091
|
+
return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
|
3092
|
+
}
|
|
3093
|
+
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
|
|
3094
|
+
const expectedType = expectedTypes[0];
|
|
3095
|
+
const receivedType = toRawType(value);
|
|
3096
|
+
const expectedValue = styleValue(value, expectedType);
|
|
3097
|
+
const receivedValue = styleValue(value, receivedType);
|
|
3098
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
|
3099
|
+
message += ` with value ${expectedValue}`;
|
|
3100
|
+
}
|
|
3101
|
+
message += `, got ${receivedType} `;
|
|
3102
|
+
if (isExplicable(receivedType)) {
|
|
3103
|
+
message += `with value ${receivedValue}.`;
|
|
3104
|
+
}
|
|
3105
|
+
return message;
|
|
3106
|
+
}
|
|
3107
|
+
function styleValue(value, type) {
|
|
3108
|
+
if (type === "String") {
|
|
3109
|
+
return `"${value}"`;
|
|
3110
|
+
} else if (type === "Number") {
|
|
3111
|
+
return `${Number(value)}`;
|
|
3112
|
+
} else {
|
|
3113
|
+
return `${value}`;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
function isExplicable(type) {
|
|
3117
|
+
const explicitTypes = ["string", "number", "boolean"];
|
|
3118
|
+
return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
|
3119
|
+
}
|
|
3120
|
+
function isBoolean(...args) {
|
|
3121
|
+
return args.some((elem) => elem.toLowerCase() === "boolean");
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
3125
|
+
const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode$1) : [normalizeVNode$1(value)];
|
|
3126
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3127
|
+
if (rawSlot._n) {
|
|
3128
|
+
return rawSlot;
|
|
3129
|
+
}
|
|
3130
|
+
const normalized = withCtx((...args) => {
|
|
3131
|
+
if (!!(process.env.NODE_ENV !== "production") && currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
|
3132
|
+
warn$1(
|
|
3133
|
+
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3136
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
3137
|
+
}, ctx);
|
|
3138
|
+
normalized._c = false;
|
|
3139
|
+
return normalized;
|
|
3140
|
+
};
|
|
3141
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
3142
|
+
const ctx = rawSlots._ctx;
|
|
3143
|
+
for (const key in rawSlots) {
|
|
3144
|
+
if (isInternalKey(key)) continue;
|
|
3145
|
+
const value = rawSlots[key];
|
|
3146
|
+
if (isFunction(value)) {
|
|
3147
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
3148
|
+
} else if (value != null) {
|
|
3149
|
+
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
3150
|
+
warn$1(
|
|
3151
|
+
`Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
|
3152
|
+
);
|
|
3153
|
+
}
|
|
3154
|
+
const normalized = normalizeSlotValue(value);
|
|
3155
|
+
slots[key] = () => normalized;
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
};
|
|
3159
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
3160
|
+
if (!!(process.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
|
|
3161
|
+
warn$1(
|
|
3162
|
+
`Non-function value encountered for default slot. Prefer function slots for better performance.`
|
|
3163
|
+
);
|
|
3164
|
+
}
|
|
3165
|
+
const normalized = normalizeSlotValue(children);
|
|
3166
|
+
instance.slots.default = () => normalized;
|
|
3167
|
+
};
|
|
3168
|
+
const initSlots = (instance, children) => {
|
|
3169
|
+
const slots = instance.slots = createInternalObject();
|
|
3170
|
+
if (instance.vnode.shapeFlag & 32) {
|
|
3171
|
+
const type = children._;
|
|
3172
|
+
if (type) {
|
|
3173
|
+
extend(slots, children);
|
|
3174
|
+
def(slots, "_", type, true);
|
|
3175
|
+
} else {
|
|
3176
|
+
normalizeObjectSlots(children, slots);
|
|
3177
|
+
}
|
|
3178
|
+
} else if (children) {
|
|
3179
|
+
normalizeVNodeSlots(instance, children);
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
|
|
3183
|
+
let supported;
|
|
3184
|
+
let perf;
|
|
3185
|
+
function startMeasure(instance, type) {
|
|
3186
|
+
if (instance.appContext.config.performance && isSupported()) {
|
|
3187
|
+
perf.mark(`vue-${type}-${instance.uid}`);
|
|
3188
|
+
}
|
|
3189
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
3190
|
+
devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
function endMeasure(instance, type) {
|
|
3194
|
+
if (instance.appContext.config.performance && isSupported()) {
|
|
3195
|
+
const startTag = `vue-${type}-${instance.uid}`;
|
|
3196
|
+
const endTag = startTag + `:end`;
|
|
3197
|
+
perf.mark(endTag);
|
|
3198
|
+
perf.measure(
|
|
3199
|
+
`<${formatComponentName(instance, instance.type)}> ${type}`,
|
|
3200
|
+
startTag,
|
|
3201
|
+
endTag
|
|
3202
|
+
);
|
|
3203
|
+
perf.clearMarks(startTag);
|
|
3204
|
+
perf.clearMarks(endTag);
|
|
3205
|
+
}
|
|
3206
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
3207
|
+
devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
function isSupported() {
|
|
3211
|
+
if (supported !== void 0) {
|
|
3212
|
+
return supported;
|
|
3213
|
+
}
|
|
3214
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
3215
|
+
supported = true;
|
|
3216
|
+
perf = window.performance;
|
|
3217
|
+
} else {
|
|
3218
|
+
supported = false;
|
|
3219
|
+
}
|
|
3220
|
+
return supported;
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
const queuePostRenderEffect = queueEffectWithSuspense ;
|
|
3224
|
+
|
|
3225
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
3226
|
+
const useSSRContext = () => {
|
|
3227
|
+
{
|
|
3228
|
+
const ctx = inject(ssrContextKey);
|
|
3229
|
+
if (!ctx) {
|
|
3230
|
+
!!(process.env.NODE_ENV !== "production") && warn$1(
|
|
3231
|
+
`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
|
|
3232
|
+
);
|
|
3233
|
+
}
|
|
3234
|
+
return ctx;
|
|
3235
|
+
}
|
|
3236
|
+
};
|
|
3237
|
+
|
|
3238
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
3239
|
+
function watch(source, cb, options) {
|
|
3240
|
+
if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
|
|
3241
|
+
warn$1(
|
|
3242
|
+
`\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
|
|
3243
|
+
);
|
|
3244
|
+
}
|
|
3245
|
+
return doWatch(source, cb, options);
|
|
3246
|
+
}
|
|
3247
|
+
function doWatch(source, cb, {
|
|
3248
|
+
immediate,
|
|
3249
|
+
deep,
|
|
3250
|
+
flush,
|
|
3251
|
+
once,
|
|
3252
|
+
onTrack,
|
|
3253
|
+
onTrigger
|
|
3254
|
+
} = EMPTY_OBJ) {
|
|
3255
|
+
if (cb && once) {
|
|
3256
|
+
const _cb = cb;
|
|
3257
|
+
cb = (...args) => {
|
|
3258
|
+
_cb(...args);
|
|
3259
|
+
unwatch();
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3262
|
+
if (!!(process.env.NODE_ENV !== "production") && deep !== void 0 && typeof deep === "number") {
|
|
3263
|
+
warn$1(
|
|
3264
|
+
`watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
|
|
3265
|
+
);
|
|
3266
|
+
}
|
|
3267
|
+
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
3268
|
+
if (immediate !== void 0) {
|
|
3269
|
+
warn$1(
|
|
3270
|
+
`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3271
|
+
);
|
|
3272
|
+
}
|
|
3273
|
+
if (deep !== void 0) {
|
|
3274
|
+
warn$1(
|
|
3275
|
+
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3276
|
+
);
|
|
3277
|
+
}
|
|
3278
|
+
if (once !== void 0) {
|
|
3279
|
+
warn$1(
|
|
3280
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3281
|
+
);
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
const warnInvalidSource = (s) => {
|
|
3285
|
+
warn$1(
|
|
3286
|
+
`Invalid watch source: `,
|
|
3287
|
+
s,
|
|
3288
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
3289
|
+
);
|
|
3290
|
+
};
|
|
3291
|
+
const instance = currentInstance;
|
|
3292
|
+
const reactiveGetter = (source2) => deep === true ? source2 : (
|
|
3293
|
+
// for deep: false, only traverse root-level properties
|
|
3294
|
+
traverse(source2, deep === false ? 1 : void 0)
|
|
3295
|
+
);
|
|
3296
|
+
let getter;
|
|
3297
|
+
let forceTrigger = false;
|
|
3298
|
+
let isMultiSource = false;
|
|
3299
|
+
if (isRef(source)) {
|
|
3300
|
+
getter = () => source.value;
|
|
3301
|
+
forceTrigger = isShallow(source);
|
|
3302
|
+
} else if (isReactive(source)) {
|
|
3303
|
+
getter = () => reactiveGetter(source);
|
|
3304
|
+
forceTrigger = true;
|
|
3305
|
+
} else if (isArray(source)) {
|
|
3306
|
+
isMultiSource = true;
|
|
3307
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
3308
|
+
getter = () => source.map((s) => {
|
|
3309
|
+
if (isRef(s)) {
|
|
3310
|
+
return s.value;
|
|
3311
|
+
} else if (isReactive(s)) {
|
|
3312
|
+
return reactiveGetter(s);
|
|
3313
|
+
} else if (isFunction(s)) {
|
|
3314
|
+
return callWithErrorHandling(s, instance, 2);
|
|
3315
|
+
} else {
|
|
3316
|
+
!!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
|
|
3317
|
+
}
|
|
3318
|
+
});
|
|
3319
|
+
} else if (isFunction(source)) {
|
|
3320
|
+
if (cb) {
|
|
3321
|
+
getter = () => callWithErrorHandling(source, instance, 2);
|
|
3322
|
+
} else {
|
|
3323
|
+
getter = () => {
|
|
3324
|
+
if (cleanup) {
|
|
3325
|
+
cleanup();
|
|
3326
|
+
}
|
|
3327
|
+
return callWithAsyncErrorHandling(
|
|
3328
|
+
source,
|
|
3329
|
+
instance,
|
|
3330
|
+
3,
|
|
3331
|
+
[onCleanup]
|
|
3332
|
+
);
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
} else {
|
|
3336
|
+
getter = NOOP;
|
|
3337
|
+
!!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
|
|
3338
|
+
}
|
|
3339
|
+
if (cb && deep) {
|
|
3340
|
+
const baseGetter = getter;
|
|
3341
|
+
getter = () => traverse(baseGetter());
|
|
3342
|
+
}
|
|
3343
|
+
let cleanup;
|
|
3344
|
+
let onCleanup = (fn) => {
|
|
3345
|
+
cleanup = effect.onStop = () => {
|
|
3346
|
+
callWithErrorHandling(fn, instance, 4);
|
|
3347
|
+
cleanup = effect.onStop = void 0;
|
|
3348
|
+
};
|
|
3349
|
+
};
|
|
3350
|
+
let ssrCleanup;
|
|
3351
|
+
if (isInSSRComponentSetup) {
|
|
3352
|
+
onCleanup = NOOP;
|
|
3353
|
+
if (!cb) {
|
|
3354
|
+
getter();
|
|
3355
|
+
} else if (immediate) {
|
|
3356
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3357
|
+
getter(),
|
|
3358
|
+
isMultiSource ? [] : void 0,
|
|
3359
|
+
onCleanup
|
|
3360
|
+
]);
|
|
3361
|
+
}
|
|
3362
|
+
if (flush === "sync") {
|
|
3363
|
+
const ctx = useSSRContext();
|
|
3364
|
+
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
3365
|
+
} else {
|
|
3366
|
+
return NOOP;
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3370
|
+
const job = () => {
|
|
3371
|
+
if (!effect.active || !effect.dirty) {
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
if (cb) {
|
|
3375
|
+
const newValue = effect.run();
|
|
3376
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
|
|
3377
|
+
if (cleanup) {
|
|
3378
|
+
cleanup();
|
|
3379
|
+
}
|
|
3380
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3381
|
+
newValue,
|
|
3382
|
+
// pass undefined as the old value when it's changed for the first time
|
|
3383
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
3384
|
+
onCleanup
|
|
3385
|
+
]);
|
|
3386
|
+
oldValue = newValue;
|
|
3387
|
+
}
|
|
3388
|
+
} else {
|
|
3389
|
+
effect.run();
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
job.allowRecurse = !!cb;
|
|
3393
|
+
let scheduler;
|
|
3394
|
+
if (flush === "sync") {
|
|
3395
|
+
scheduler = job;
|
|
3396
|
+
} else if (flush === "post") {
|
|
3397
|
+
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3398
|
+
} else {
|
|
3399
|
+
job.pre = true;
|
|
3400
|
+
if (instance) job.id = instance.uid;
|
|
3401
|
+
scheduler = () => queueJob(job);
|
|
3402
|
+
}
|
|
3403
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
3404
|
+
const scope = getCurrentScope();
|
|
3405
|
+
const unwatch = () => {
|
|
3406
|
+
effect.stop();
|
|
3407
|
+
if (scope) {
|
|
3408
|
+
remove(scope.effects, effect);
|
|
3409
|
+
}
|
|
3410
|
+
};
|
|
3411
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3412
|
+
effect.onTrack = onTrack;
|
|
3413
|
+
effect.onTrigger = onTrigger;
|
|
3414
|
+
}
|
|
3415
|
+
if (cb) {
|
|
3416
|
+
if (immediate) {
|
|
3417
|
+
job();
|
|
3418
|
+
} else {
|
|
3419
|
+
oldValue = effect.run();
|
|
3420
|
+
}
|
|
3421
|
+
} else if (flush === "post") {
|
|
3422
|
+
queuePostRenderEffect(
|
|
3423
|
+
effect.run.bind(effect),
|
|
3424
|
+
instance && instance.suspense
|
|
3425
|
+
);
|
|
3426
|
+
} else {
|
|
3427
|
+
effect.run();
|
|
3428
|
+
}
|
|
3429
|
+
if (ssrCleanup) ssrCleanup.push(unwatch);
|
|
3430
|
+
return unwatch;
|
|
3431
|
+
}
|
|
3432
|
+
function instanceWatch(source, value, options) {
|
|
3433
|
+
const publicThis = this.proxy;
|
|
3434
|
+
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
|
3435
|
+
let cb;
|
|
3436
|
+
if (isFunction(value)) {
|
|
3437
|
+
cb = value;
|
|
3438
|
+
} else {
|
|
3439
|
+
cb = value.handler;
|
|
3440
|
+
options = value;
|
|
3441
|
+
}
|
|
3442
|
+
const reset = setCurrentInstance(this);
|
|
3443
|
+
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
3444
|
+
reset();
|
|
3445
|
+
return res;
|
|
3446
|
+
}
|
|
3447
|
+
function createPathGetter(ctx, path) {
|
|
3448
|
+
const segments = path.split(".");
|
|
3449
|
+
return () => {
|
|
3450
|
+
let cur = ctx;
|
|
3451
|
+
for (let i = 0; i < segments.length && cur; i++) {
|
|
3452
|
+
cur = cur[segments[i]];
|
|
3453
|
+
}
|
|
3454
|
+
return cur;
|
|
3455
|
+
};
|
|
3456
|
+
}
|
|
3457
|
+
function traverse(value, depth = Infinity, seen) {
|
|
3458
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
3459
|
+
return value;
|
|
3460
|
+
}
|
|
3461
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
3462
|
+
if (seen.has(value)) {
|
|
3463
|
+
return value;
|
|
3464
|
+
}
|
|
3465
|
+
seen.add(value);
|
|
3466
|
+
depth--;
|
|
3467
|
+
if (isRef(value)) {
|
|
3468
|
+
traverse(value.value, depth, seen);
|
|
3469
|
+
} else if (isArray(value)) {
|
|
3470
|
+
for (let i = 0; i < value.length; i++) {
|
|
3471
|
+
traverse(value[i], depth, seen);
|
|
3472
|
+
}
|
|
3473
|
+
} else if (isSet(value) || isMap(value)) {
|
|
3474
|
+
value.forEach((v) => {
|
|
3475
|
+
traverse(v, depth, seen);
|
|
3476
|
+
});
|
|
3477
|
+
} else if (isPlainObject(value)) {
|
|
3478
|
+
for (const key in value) {
|
|
3479
|
+
traverse(value[key], depth, seen);
|
|
3480
|
+
}
|
|
3481
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
3482
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
3483
|
+
traverse(value[key], depth, seen);
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
return value;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
3491
|
+
function onActivated(hook, target) {
|
|
3492
|
+
registerKeepAliveHook(hook, "a", target);
|
|
3493
|
+
}
|
|
3494
|
+
function onDeactivated(hook, target) {
|
|
3495
|
+
registerKeepAliveHook(hook, "da", target);
|
|
3496
|
+
}
|
|
3497
|
+
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
3498
|
+
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
3499
|
+
let current = target;
|
|
3500
|
+
while (current) {
|
|
3501
|
+
if (current.isDeactivated) {
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
current = current.parent;
|
|
3505
|
+
}
|
|
3506
|
+
return hook();
|
|
3507
|
+
});
|
|
3508
|
+
injectHook(type, wrappedHook, target);
|
|
3509
|
+
if (target) {
|
|
3510
|
+
let current = target.parent;
|
|
3511
|
+
while (current && current.parent) {
|
|
3512
|
+
if (isKeepAlive(current.parent.vnode)) {
|
|
3513
|
+
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
3514
|
+
}
|
|
3515
|
+
current = current.parent;
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
3520
|
+
const injected = injectHook(
|
|
3521
|
+
type,
|
|
3522
|
+
hook,
|
|
3523
|
+
keepAliveRoot,
|
|
3524
|
+
true
|
|
3525
|
+
/* prepend */
|
|
3526
|
+
);
|
|
3527
|
+
onUnmounted(() => {
|
|
3528
|
+
remove(keepAliveRoot[type], injected);
|
|
3529
|
+
}, target);
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
function setTransitionHooks(vnode, hooks) {
|
|
3533
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
3534
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
3535
|
+
} else if (vnode.shapeFlag & 128) {
|
|
3536
|
+
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
3537
|
+
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
338
3538
|
} else {
|
|
339
|
-
|
|
340
|
-
return raw ? value : [`${key}=`, value];
|
|
3539
|
+
vnode.transition = hooks;
|
|
341
3540
|
}
|
|
342
3541
|
}
|
|
343
3542
|
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
[2]: "watcher getter",
|
|
362
|
-
[3]: "watcher callback",
|
|
363
|
-
[4]: "watcher cleanup function",
|
|
364
|
-
[5]: "native event handler",
|
|
365
|
-
[6]: "component event handler",
|
|
366
|
-
[7]: "vnode hook",
|
|
367
|
-
[8]: "directive hook",
|
|
368
|
-
[9]: "transition hook",
|
|
369
|
-
[10]: "app errorHandler",
|
|
370
|
-
[11]: "app warnHandler",
|
|
371
|
-
[12]: "ref function",
|
|
372
|
-
[13]: "async component loader",
|
|
373
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
3543
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
3544
|
+
|
|
3545
|
+
const Fragment = Symbol.for("v-fgt");
|
|
3546
|
+
const Text = Symbol.for("v-txt");
|
|
3547
|
+
const Comment = Symbol.for("v-cmt");
|
|
3548
|
+
let currentBlock = null;
|
|
3549
|
+
let isBlockTreeEnabled = 1;
|
|
3550
|
+
function setBlockTracking(value) {
|
|
3551
|
+
isBlockTreeEnabled += value;
|
|
3552
|
+
}
|
|
3553
|
+
function isVNode$2(value) {
|
|
3554
|
+
return value ? value.__v_isVNode === true : false;
|
|
3555
|
+
}
|
|
3556
|
+
const createVNodeWithArgsTransform = (...args) => {
|
|
3557
|
+
return _createVNode(
|
|
3558
|
+
...args
|
|
3559
|
+
);
|
|
374
3560
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
3561
|
+
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
3562
|
+
const normalizeRef = ({
|
|
3563
|
+
ref,
|
|
3564
|
+
ref_key,
|
|
3565
|
+
ref_for
|
|
3566
|
+
}) => {
|
|
3567
|
+
if (typeof ref === "number") {
|
|
3568
|
+
ref = "" + ref;
|
|
3569
|
+
}
|
|
3570
|
+
return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
|
3571
|
+
};
|
|
3572
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
3573
|
+
const vnode = {
|
|
3574
|
+
__v_isVNode: true,
|
|
3575
|
+
__v_skip: true,
|
|
3576
|
+
type,
|
|
3577
|
+
props,
|
|
3578
|
+
key: props && normalizeKey(props),
|
|
3579
|
+
ref: props && normalizeRef(props),
|
|
3580
|
+
scopeId: currentScopeId,
|
|
3581
|
+
slotScopeIds: null,
|
|
3582
|
+
children,
|
|
3583
|
+
component: null,
|
|
3584
|
+
suspense: null,
|
|
3585
|
+
ssContent: null,
|
|
3586
|
+
ssFallback: null,
|
|
3587
|
+
dirs: null,
|
|
3588
|
+
transition: null,
|
|
3589
|
+
el: null,
|
|
3590
|
+
anchor: null,
|
|
3591
|
+
target: null,
|
|
3592
|
+
targetAnchor: null,
|
|
3593
|
+
staticCount: 0,
|
|
3594
|
+
shapeFlag,
|
|
3595
|
+
patchFlag,
|
|
3596
|
+
dynamicProps,
|
|
3597
|
+
dynamicChildren: null,
|
|
3598
|
+
appContext: null,
|
|
3599
|
+
ctx: currentRenderingInstance
|
|
3600
|
+
};
|
|
3601
|
+
if (needFullChildrenNormalization) {
|
|
3602
|
+
normalizeChildren(vnode, children);
|
|
3603
|
+
if (shapeFlag & 128) {
|
|
3604
|
+
type.normalize(vnode);
|
|
3605
|
+
}
|
|
3606
|
+
} else if (children) {
|
|
3607
|
+
vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
380
3608
|
}
|
|
3609
|
+
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
|
|
3610
|
+
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
3611
|
+
}
|
|
3612
|
+
if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
|
|
3613
|
+
!isBlockNode && // has current parent block
|
|
3614
|
+
currentBlock && // presence of a patch flag indicates this node needs patching on updates.
|
|
3615
|
+
// component nodes also should always be patched, because even if the
|
|
3616
|
+
// component doesn't need to update, it needs to persist the instance on to
|
|
3617
|
+
// the next vnode so that it can be properly unmounted later.
|
|
3618
|
+
(vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
|
|
3619
|
+
// vnode should not be considered dynamic due to handler caching.
|
|
3620
|
+
vnode.patchFlag !== 32) {
|
|
3621
|
+
currentBlock.push(vnode);
|
|
3622
|
+
}
|
|
3623
|
+
return vnode;
|
|
381
3624
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
388
|
-
while (cur) {
|
|
389
|
-
const errorCapturedHooks = cur.ec;
|
|
390
|
-
if (errorCapturedHooks) {
|
|
391
|
-
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
392
|
-
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
cur = cur.parent;
|
|
3625
|
+
const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
3626
|
+
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
3627
|
+
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
3628
|
+
if (!!(process.env.NODE_ENV !== "production") && !type) {
|
|
3629
|
+
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
398
3630
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
3631
|
+
type = Comment;
|
|
3632
|
+
}
|
|
3633
|
+
if (isVNode$2(type)) {
|
|
3634
|
+
const cloned = cloneVNode(
|
|
3635
|
+
type,
|
|
3636
|
+
props,
|
|
3637
|
+
true
|
|
3638
|
+
/* mergeRef: true */
|
|
3639
|
+
);
|
|
3640
|
+
if (children) {
|
|
3641
|
+
normalizeChildren(cloned, children);
|
|
3642
|
+
}
|
|
3643
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
3644
|
+
if (cloned.shapeFlag & 6) {
|
|
3645
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
3646
|
+
} else {
|
|
3647
|
+
currentBlock.push(cloned);
|
|
3648
|
+
}
|
|
410
3649
|
}
|
|
3650
|
+
cloned.patchFlag = -2;
|
|
3651
|
+
return cloned;
|
|
411
3652
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
3653
|
+
if (isClassComponent(type)) {
|
|
3654
|
+
type = type.__vccOpts;
|
|
3655
|
+
}
|
|
3656
|
+
if (props) {
|
|
3657
|
+
props = guardReactiveProps(props);
|
|
3658
|
+
let { class: klass, style } = props;
|
|
3659
|
+
if (klass && !isString(klass)) {
|
|
3660
|
+
props.class = normalizeClass(klass);
|
|
419
3661
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
3662
|
+
if (isObject(style)) {
|
|
3663
|
+
if (isProxy(style) && !isArray(style)) {
|
|
3664
|
+
style = extend({}, style);
|
|
3665
|
+
}
|
|
3666
|
+
props.style = normalizeStyle(style);
|
|
423
3667
|
}
|
|
424
|
-
|
|
425
|
-
|
|
3668
|
+
}
|
|
3669
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
3670
|
+
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
3671
|
+
type = toRaw(type);
|
|
3672
|
+
warn$1(
|
|
3673
|
+
`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
|
|
3674
|
+
`
|
|
3675
|
+
Component that was made reactive: `,
|
|
3676
|
+
type
|
|
3677
|
+
);
|
|
3678
|
+
}
|
|
3679
|
+
return createBaseVNode(
|
|
3680
|
+
type,
|
|
3681
|
+
props,
|
|
3682
|
+
children,
|
|
3683
|
+
patchFlag,
|
|
3684
|
+
dynamicProps,
|
|
3685
|
+
shapeFlag,
|
|
3686
|
+
isBlockNode,
|
|
3687
|
+
true
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3690
|
+
function guardReactiveProps(props) {
|
|
3691
|
+
if (!props) return null;
|
|
3692
|
+
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
3693
|
+
}
|
|
3694
|
+
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
3695
|
+
const { props, ref, patchFlag, children, transition } = vnode;
|
|
3696
|
+
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
3697
|
+
const cloned = {
|
|
3698
|
+
__v_isVNode: true,
|
|
3699
|
+
__v_skip: true,
|
|
3700
|
+
type: vnode.type,
|
|
3701
|
+
props: mergedProps,
|
|
3702
|
+
key: mergedProps && normalizeKey(mergedProps),
|
|
3703
|
+
ref: extraProps && extraProps.ref ? (
|
|
3704
|
+
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
3705
|
+
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
3706
|
+
// the refs so the single vnode can be set on multiple refs
|
|
3707
|
+
mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
|
3708
|
+
) : ref,
|
|
3709
|
+
scopeId: vnode.scopeId,
|
|
3710
|
+
slotScopeIds: vnode.slotScopeIds,
|
|
3711
|
+
children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
|
3712
|
+
target: vnode.target,
|
|
3713
|
+
targetAnchor: vnode.targetAnchor,
|
|
3714
|
+
staticCount: vnode.staticCount,
|
|
3715
|
+
shapeFlag: vnode.shapeFlag,
|
|
3716
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
3717
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
3718
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
3719
|
+
// fast paths only.
|
|
3720
|
+
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
3721
|
+
dynamicProps: vnode.dynamicProps,
|
|
3722
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
3723
|
+
appContext: vnode.appContext,
|
|
3724
|
+
dirs: vnode.dirs,
|
|
3725
|
+
transition,
|
|
3726
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
3727
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
3728
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
3729
|
+
// they will simply be overwritten.
|
|
3730
|
+
component: vnode.component,
|
|
3731
|
+
suspense: vnode.suspense,
|
|
3732
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
3733
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
3734
|
+
el: vnode.el,
|
|
3735
|
+
anchor: vnode.anchor,
|
|
3736
|
+
ctx: vnode.ctx,
|
|
3737
|
+
ce: vnode.ce
|
|
3738
|
+
};
|
|
3739
|
+
if (transition && cloneTransition) {
|
|
3740
|
+
setTransitionHooks(
|
|
3741
|
+
cloned,
|
|
3742
|
+
transition.clone(cloned)
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
return cloned;
|
|
3746
|
+
}
|
|
3747
|
+
function deepCloneVNode(vnode) {
|
|
3748
|
+
const cloned = cloneVNode(vnode);
|
|
3749
|
+
if (isArray(vnode.children)) {
|
|
3750
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
3751
|
+
}
|
|
3752
|
+
return cloned;
|
|
3753
|
+
}
|
|
3754
|
+
function createTextVNode(text = " ", flag = 0) {
|
|
3755
|
+
return createVNode(Text, null, text, flag);
|
|
3756
|
+
}
|
|
3757
|
+
function normalizeVNode$1(child) {
|
|
3758
|
+
if (child == null || typeof child === "boolean") {
|
|
3759
|
+
return createVNode(Comment);
|
|
3760
|
+
} else if (isArray(child)) {
|
|
3761
|
+
return createVNode(
|
|
3762
|
+
Fragment,
|
|
3763
|
+
null,
|
|
3764
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
3765
|
+
child.slice()
|
|
3766
|
+
);
|
|
3767
|
+
} else if (typeof child === "object") {
|
|
3768
|
+
return cloneIfMounted(child);
|
|
3769
|
+
} else {
|
|
3770
|
+
return createVNode(Text, null, String(child));
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
function cloneIfMounted(child) {
|
|
3774
|
+
return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
|
3775
|
+
}
|
|
3776
|
+
function normalizeChildren(vnode, children) {
|
|
3777
|
+
let type = 0;
|
|
3778
|
+
const { shapeFlag } = vnode;
|
|
3779
|
+
if (children == null) {
|
|
3780
|
+
children = null;
|
|
3781
|
+
} else if (isArray(children)) {
|
|
3782
|
+
type = 16;
|
|
3783
|
+
} else if (typeof children === "object") {
|
|
3784
|
+
if (shapeFlag & (1 | 64)) {
|
|
3785
|
+
const slot = children.default;
|
|
3786
|
+
if (slot) {
|
|
3787
|
+
slot._c && (slot._d = false);
|
|
3788
|
+
normalizeChildren(vnode, slot());
|
|
3789
|
+
slot._c && (slot._d = true);
|
|
3790
|
+
}
|
|
3791
|
+
return;
|
|
426
3792
|
} else {
|
|
427
|
-
|
|
3793
|
+
type = 32;
|
|
3794
|
+
const slotFlag = children._;
|
|
3795
|
+
if (!slotFlag && !isInternalObject(children)) {
|
|
3796
|
+
children._ctx = currentRenderingInstance;
|
|
3797
|
+
} else if (slotFlag === 3 && currentRenderingInstance) {
|
|
3798
|
+
if (currentRenderingInstance.slots._ === 1) {
|
|
3799
|
+
children._ = 1;
|
|
3800
|
+
} else {
|
|
3801
|
+
children._ = 2;
|
|
3802
|
+
vnode.patchFlag |= 1024;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
428
3805
|
}
|
|
3806
|
+
} else if (isFunction(children)) {
|
|
3807
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
3808
|
+
type = 32;
|
|
429
3809
|
} else {
|
|
430
|
-
|
|
3810
|
+
children = String(children);
|
|
3811
|
+
if (shapeFlag & 64) {
|
|
3812
|
+
type = 16;
|
|
3813
|
+
children = [createTextVNode(children)];
|
|
3814
|
+
} else {
|
|
3815
|
+
type = 8;
|
|
3816
|
+
}
|
|
431
3817
|
}
|
|
3818
|
+
vnode.children = children;
|
|
3819
|
+
vnode.shapeFlag |= type;
|
|
432
3820
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
let
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
replay.push((newHook) => {
|
|
453
|
-
setDevtoolsHook(newHook, target);
|
|
454
|
-
});
|
|
455
|
-
setTimeout(() => {
|
|
456
|
-
if (!devtools) {
|
|
457
|
-
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
458
|
-
buffer = [];
|
|
3821
|
+
function mergeProps(...args) {
|
|
3822
|
+
const ret = {};
|
|
3823
|
+
for (let i = 0; i < args.length; i++) {
|
|
3824
|
+
const toMerge = args[i];
|
|
3825
|
+
for (const key in toMerge) {
|
|
3826
|
+
if (key === "class") {
|
|
3827
|
+
if (ret.class !== toMerge.class) {
|
|
3828
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
3829
|
+
}
|
|
3830
|
+
} else if (key === "style") {
|
|
3831
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
3832
|
+
} else if (isOn(key)) {
|
|
3833
|
+
const existing = ret[key];
|
|
3834
|
+
const incoming = toMerge[key];
|
|
3835
|
+
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
|
3836
|
+
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
3837
|
+
}
|
|
3838
|
+
} else if (key !== "") {
|
|
3839
|
+
ret[key] = toMerge[key];
|
|
459
3840
|
}
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
buffer = [];
|
|
3841
|
+
}
|
|
463
3842
|
}
|
|
3843
|
+
return ret;
|
|
464
3844
|
}
|
|
465
3845
|
|
|
3846
|
+
const emptyAppContext = createAppContext();
|
|
3847
|
+
let uid = 0;
|
|
3848
|
+
function createComponentInstance$1(vnode, parent, suspense) {
|
|
3849
|
+
const type = vnode.type;
|
|
3850
|
+
const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
|
3851
|
+
const instance = {
|
|
3852
|
+
uid: uid++,
|
|
3853
|
+
vnode,
|
|
3854
|
+
type,
|
|
3855
|
+
parent,
|
|
3856
|
+
appContext,
|
|
3857
|
+
root: null,
|
|
3858
|
+
// to be immediately set
|
|
3859
|
+
next: null,
|
|
3860
|
+
subTree: null,
|
|
3861
|
+
// will be set synchronously right after creation
|
|
3862
|
+
effect: null,
|
|
3863
|
+
update: null,
|
|
3864
|
+
// will be set synchronously right after creation
|
|
3865
|
+
scope: new EffectScope(
|
|
3866
|
+
true
|
|
3867
|
+
/* detached */
|
|
3868
|
+
),
|
|
3869
|
+
render: null,
|
|
3870
|
+
proxy: null,
|
|
3871
|
+
exposed: null,
|
|
3872
|
+
exposeProxy: null,
|
|
3873
|
+
withProxy: null,
|
|
3874
|
+
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
3875
|
+
accessCache: null,
|
|
3876
|
+
renderCache: [],
|
|
3877
|
+
// local resolved assets
|
|
3878
|
+
components: null,
|
|
3879
|
+
directives: null,
|
|
3880
|
+
// resolved props and emits options
|
|
3881
|
+
propsOptions: normalizePropsOptions(type, appContext),
|
|
3882
|
+
emitsOptions: normalizeEmitsOptions(type, appContext),
|
|
3883
|
+
// emit
|
|
3884
|
+
emit: null,
|
|
3885
|
+
// to be set immediately
|
|
3886
|
+
emitted: null,
|
|
3887
|
+
// props default value
|
|
3888
|
+
propsDefaults: EMPTY_OBJ,
|
|
3889
|
+
// inheritAttrs
|
|
3890
|
+
inheritAttrs: type.inheritAttrs,
|
|
3891
|
+
// state
|
|
3892
|
+
ctx: EMPTY_OBJ,
|
|
3893
|
+
data: EMPTY_OBJ,
|
|
3894
|
+
props: EMPTY_OBJ,
|
|
3895
|
+
attrs: EMPTY_OBJ,
|
|
3896
|
+
slots: EMPTY_OBJ,
|
|
3897
|
+
refs: EMPTY_OBJ,
|
|
3898
|
+
setupState: EMPTY_OBJ,
|
|
3899
|
+
setupContext: null,
|
|
3900
|
+
attrsProxy: null,
|
|
3901
|
+
slotsProxy: null,
|
|
3902
|
+
// suspense related
|
|
3903
|
+
suspense,
|
|
3904
|
+
suspenseId: suspense ? suspense.pendingId : 0,
|
|
3905
|
+
asyncDep: null,
|
|
3906
|
+
asyncResolved: false,
|
|
3907
|
+
// lifecycle hooks
|
|
3908
|
+
// not using enums here because it results in computed properties
|
|
3909
|
+
isMounted: false,
|
|
3910
|
+
isUnmounted: false,
|
|
3911
|
+
isDeactivated: false,
|
|
3912
|
+
bc: null,
|
|
3913
|
+
c: null,
|
|
3914
|
+
bm: null,
|
|
3915
|
+
m: null,
|
|
3916
|
+
bu: null,
|
|
3917
|
+
u: null,
|
|
3918
|
+
um: null,
|
|
3919
|
+
bum: null,
|
|
3920
|
+
da: null,
|
|
3921
|
+
a: null,
|
|
3922
|
+
rtg: null,
|
|
3923
|
+
rtc: null,
|
|
3924
|
+
ec: null,
|
|
3925
|
+
sp: null
|
|
3926
|
+
};
|
|
3927
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3928
|
+
instance.ctx = createDevRenderContext(instance);
|
|
3929
|
+
} else {
|
|
3930
|
+
instance.ctx = { _: instance };
|
|
3931
|
+
}
|
|
3932
|
+
instance.root = parent ? parent.root : instance;
|
|
3933
|
+
instance.emit = emit.bind(null, instance);
|
|
3934
|
+
if (vnode.ce) {
|
|
3935
|
+
vnode.ce(instance);
|
|
3936
|
+
}
|
|
3937
|
+
return instance;
|
|
3938
|
+
}
|
|
3939
|
+
let currentInstance = null;
|
|
3940
|
+
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
3941
|
+
let internalSetCurrentInstance;
|
|
3942
|
+
let setInSSRSetupState;
|
|
466
3943
|
{
|
|
467
3944
|
const g = getGlobalThis();
|
|
468
3945
|
const registerGlobalSetter = (key, setter) => {
|
|
469
3946
|
let setters;
|
|
470
|
-
if (!(setters = g[key]))
|
|
471
|
-
setters = g[key] = [];
|
|
3947
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
472
3948
|
setters.push(setter);
|
|
473
3949
|
return (v) => {
|
|
474
|
-
if (setters.length > 1)
|
|
475
|
-
|
|
476
|
-
else
|
|
477
|
-
setters[0](v);
|
|
3950
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
3951
|
+
else setters[0](v);
|
|
478
3952
|
};
|
|
479
3953
|
};
|
|
480
|
-
registerGlobalSetter(
|
|
3954
|
+
internalSetCurrentInstance = registerGlobalSetter(
|
|
481
3955
|
`__VUE_INSTANCE_SETTERS__`,
|
|
482
|
-
(v) => v
|
|
3956
|
+
(v) => currentInstance = v
|
|
483
3957
|
);
|
|
484
|
-
registerGlobalSetter(
|
|
3958
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
485
3959
|
`__VUE_SSR_SETTERS__`,
|
|
486
|
-
(v) => v
|
|
3960
|
+
(v) => isInSSRComponentSetup = v
|
|
487
3961
|
);
|
|
488
3962
|
}
|
|
489
|
-
|
|
3963
|
+
const setCurrentInstance = (instance) => {
|
|
3964
|
+
const prev = currentInstance;
|
|
3965
|
+
internalSetCurrentInstance(instance);
|
|
3966
|
+
instance.scope.on();
|
|
3967
|
+
return () => {
|
|
3968
|
+
instance.scope.off();
|
|
3969
|
+
internalSetCurrentInstance(prev);
|
|
3970
|
+
};
|
|
3971
|
+
};
|
|
3972
|
+
const unsetCurrentInstance = () => {
|
|
3973
|
+
currentInstance && currentInstance.scope.off();
|
|
3974
|
+
internalSetCurrentInstance(null);
|
|
3975
|
+
};
|
|
3976
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
3977
|
+
function validateComponentName(name, { isNativeTag }) {
|
|
3978
|
+
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
3979
|
+
warn$1(
|
|
3980
|
+
"Do not use built-in or reserved HTML elements as component id: " + name
|
|
3981
|
+
);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
function isStatefulComponent(instance) {
|
|
3985
|
+
return instance.vnode.shapeFlag & 4;
|
|
3986
|
+
}
|
|
3987
|
+
let isInSSRComponentSetup = false;
|
|
3988
|
+
function setupComponent$1(instance, isSSR = false) {
|
|
3989
|
+
isSSR && setInSSRSetupState(isSSR);
|
|
3990
|
+
const { props, children } = instance.vnode;
|
|
3991
|
+
const isStateful = isStatefulComponent(instance);
|
|
3992
|
+
initProps(instance, props, isStateful, isSSR);
|
|
3993
|
+
initSlots(instance, children);
|
|
3994
|
+
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
3995
|
+
isSSR && setInSSRSetupState(false);
|
|
3996
|
+
return setupResult;
|
|
3997
|
+
}
|
|
3998
|
+
function setupStatefulComponent(instance, isSSR) {
|
|
3999
|
+
var _a;
|
|
4000
|
+
const Component = instance.type;
|
|
4001
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4002
|
+
if (Component.name) {
|
|
4003
|
+
validateComponentName(Component.name, instance.appContext.config);
|
|
4004
|
+
}
|
|
4005
|
+
if (Component.components) {
|
|
4006
|
+
const names = Object.keys(Component.components);
|
|
4007
|
+
for (let i = 0; i < names.length; i++) {
|
|
4008
|
+
validateComponentName(names[i], instance.appContext.config);
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
if (Component.directives) {
|
|
4012
|
+
const names = Object.keys(Component.directives);
|
|
4013
|
+
for (let i = 0; i < names.length; i++) {
|
|
4014
|
+
validateDirectiveName(names[i]);
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
if (Component.compilerOptions && isRuntimeOnly()) {
|
|
4018
|
+
warn$1(
|
|
4019
|
+
`"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
|
|
4020
|
+
);
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
instance.accessCache = /* @__PURE__ */ Object.create(null);
|
|
4024
|
+
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
|
4025
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4026
|
+
exposePropsOnRenderContext(instance);
|
|
4027
|
+
}
|
|
4028
|
+
const { setup } = Component;
|
|
4029
|
+
if (setup) {
|
|
4030
|
+
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
4031
|
+
const reset = setCurrentInstance(instance);
|
|
4032
|
+
pauseTracking();
|
|
4033
|
+
const setupResult = callWithErrorHandling(
|
|
4034
|
+
setup,
|
|
4035
|
+
instance,
|
|
4036
|
+
0,
|
|
4037
|
+
[
|
|
4038
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(instance.props) : instance.props,
|
|
4039
|
+
setupContext
|
|
4040
|
+
]
|
|
4041
|
+
);
|
|
4042
|
+
resetTracking();
|
|
4043
|
+
reset();
|
|
4044
|
+
if (isPromise(setupResult)) {
|
|
4045
|
+
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
4046
|
+
if (isSSR) {
|
|
4047
|
+
return setupResult.then((resolvedResult) => {
|
|
4048
|
+
handleSetupResult(instance, resolvedResult, isSSR);
|
|
4049
|
+
}).catch((e) => {
|
|
4050
|
+
handleError(e, instance, 0);
|
|
4051
|
+
});
|
|
4052
|
+
} else {
|
|
4053
|
+
instance.asyncDep = setupResult;
|
|
4054
|
+
if (!!(process.env.NODE_ENV !== "production") && !instance.suspense) {
|
|
4055
|
+
const name = (_a = Component.name) != null ? _a : "Anonymous";
|
|
4056
|
+
warn$1(
|
|
4057
|
+
`Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
|
|
4058
|
+
);
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
} else {
|
|
4062
|
+
handleSetupResult(instance, setupResult, isSSR);
|
|
4063
|
+
}
|
|
4064
|
+
} else {
|
|
4065
|
+
finishComponentSetup(instance, isSSR);
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
function handleSetupResult(instance, setupResult, isSSR) {
|
|
4069
|
+
if (isFunction(setupResult)) {
|
|
4070
|
+
if (instance.type.__ssrInlineRender) {
|
|
4071
|
+
instance.ssrRender = setupResult;
|
|
4072
|
+
} else {
|
|
4073
|
+
instance.render = setupResult;
|
|
4074
|
+
}
|
|
4075
|
+
} else if (isObject(setupResult)) {
|
|
4076
|
+
if (!!(process.env.NODE_ENV !== "production") && isVNode$2(setupResult)) {
|
|
4077
|
+
warn$1(
|
|
4078
|
+
`setup() should not return VNodes directly - return a render function instead.`
|
|
4079
|
+
);
|
|
4080
|
+
}
|
|
4081
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
4082
|
+
instance.devtoolsRawSetupState = setupResult;
|
|
4083
|
+
}
|
|
4084
|
+
instance.setupState = proxyRefs(setupResult);
|
|
4085
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4086
|
+
exposeSetupStateOnRenderContext(instance);
|
|
4087
|
+
}
|
|
4088
|
+
} else if (!!(process.env.NODE_ENV !== "production") && setupResult !== void 0) {
|
|
4089
|
+
warn$1(
|
|
4090
|
+
`setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
|
|
4091
|
+
);
|
|
4092
|
+
}
|
|
4093
|
+
finishComponentSetup(instance, isSSR);
|
|
4094
|
+
}
|
|
4095
|
+
let compile;
|
|
4096
|
+
const isRuntimeOnly = () => !compile;
|
|
4097
|
+
function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
4098
|
+
const Component = instance.type;
|
|
4099
|
+
if (!instance.render) {
|
|
4100
|
+
if (!isSSR && compile && !Component.render) {
|
|
4101
|
+
const template = Component.template || resolveMergedOptions(instance).template;
|
|
4102
|
+
if (template) {
|
|
4103
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4104
|
+
startMeasure(instance, `compile`);
|
|
4105
|
+
}
|
|
4106
|
+
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
|
4107
|
+
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
|
4108
|
+
const finalCompilerOptions = extend(
|
|
4109
|
+
extend(
|
|
4110
|
+
{
|
|
4111
|
+
isCustomElement,
|
|
4112
|
+
delimiters
|
|
4113
|
+
},
|
|
4114
|
+
compilerOptions
|
|
4115
|
+
),
|
|
4116
|
+
componentCompilerOptions
|
|
4117
|
+
);
|
|
4118
|
+
Component.render = compile(template, finalCompilerOptions);
|
|
4119
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4120
|
+
endMeasure(instance, `compile`);
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
instance.render = Component.render || NOOP;
|
|
4125
|
+
}
|
|
4126
|
+
if (__VUE_OPTIONS_API__ && true) {
|
|
4127
|
+
const reset = setCurrentInstance(instance);
|
|
4128
|
+
pauseTracking();
|
|
4129
|
+
try {
|
|
4130
|
+
applyOptions(instance);
|
|
4131
|
+
} finally {
|
|
4132
|
+
resetTracking();
|
|
4133
|
+
reset();
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
|
|
4137
|
+
if (Component.template) {
|
|
4138
|
+
warn$1(
|
|
4139
|
+
`Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".` )
|
|
4140
|
+
);
|
|
4141
|
+
} else {
|
|
4142
|
+
warn$1(`Component is missing template or render function: `, Component);
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
const attrsProxyHandlers = !!(process.env.NODE_ENV !== "production") ? {
|
|
490
4147
|
get(target, key) {
|
|
4148
|
+
markAttrsAccessed();
|
|
491
4149
|
track(target, "get", "");
|
|
492
4150
|
return target[key];
|
|
493
4151
|
},
|
|
@@ -505,6 +4163,79 @@ function setDevtoolsHook(hook, target) {
|
|
|
505
4163
|
return target[key];
|
|
506
4164
|
}
|
|
507
4165
|
};
|
|
4166
|
+
function getSlotsProxy(instance) {
|
|
4167
|
+
return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
|
4168
|
+
get(target, key) {
|
|
4169
|
+
track(instance, "get", "$slots");
|
|
4170
|
+
return target[key];
|
|
4171
|
+
}
|
|
4172
|
+
}));
|
|
4173
|
+
}
|
|
4174
|
+
function createSetupContext(instance) {
|
|
4175
|
+
const expose = (exposed) => {
|
|
4176
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4177
|
+
if (instance.exposed) {
|
|
4178
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
4179
|
+
}
|
|
4180
|
+
if (exposed != null) {
|
|
4181
|
+
let exposedType = typeof exposed;
|
|
4182
|
+
if (exposedType === "object") {
|
|
4183
|
+
if (isArray(exposed)) {
|
|
4184
|
+
exposedType = "array";
|
|
4185
|
+
} else if (isRef(exposed)) {
|
|
4186
|
+
exposedType = "ref";
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
if (exposedType !== "object") {
|
|
4190
|
+
warn$1(
|
|
4191
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
instance.exposed = exposed || {};
|
|
4197
|
+
};
|
|
4198
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4199
|
+
let attrsProxy;
|
|
4200
|
+
return Object.freeze({
|
|
4201
|
+
get attrs() {
|
|
4202
|
+
return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
|
|
4203
|
+
},
|
|
4204
|
+
get slots() {
|
|
4205
|
+
return getSlotsProxy(instance);
|
|
4206
|
+
},
|
|
4207
|
+
get emit() {
|
|
4208
|
+
return (event, ...args) => instance.emit(event, ...args);
|
|
4209
|
+
},
|
|
4210
|
+
expose
|
|
4211
|
+
});
|
|
4212
|
+
} else {
|
|
4213
|
+
return {
|
|
4214
|
+
attrs: new Proxy(instance.attrs, attrsProxyHandlers),
|
|
4215
|
+
slots: instance.slots,
|
|
4216
|
+
emit: instance.emit,
|
|
4217
|
+
expose
|
|
4218
|
+
};
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
function getComponentPublicInstance(instance) {
|
|
4222
|
+
if (instance.exposed) {
|
|
4223
|
+
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
4224
|
+
get(target, key) {
|
|
4225
|
+
if (key in target) {
|
|
4226
|
+
return target[key];
|
|
4227
|
+
} else if (key in publicPropertiesMap) {
|
|
4228
|
+
return publicPropertiesMap[key](instance);
|
|
4229
|
+
}
|
|
4230
|
+
},
|
|
4231
|
+
has(target, key) {
|
|
4232
|
+
return key in target || key in publicPropertiesMap;
|
|
4233
|
+
}
|
|
4234
|
+
}));
|
|
4235
|
+
} else {
|
|
4236
|
+
return instance.proxy;
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
508
4239
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
509
4240
|
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
510
4241
|
function getComponentName(Component, includeInferred = true) {
|
|
@@ -532,10 +4263,34 @@ function formatComponentName(instance, Component, isRoot = false) {
|
|
|
532
4263
|
}
|
|
533
4264
|
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
534
4265
|
}
|
|
4266
|
+
function isClassComponent(value) {
|
|
4267
|
+
return isFunction(value) && "__vccOpts" in value;
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
const computed = (getterOrOptions, debugOptions) => {
|
|
4271
|
+
const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
4272
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4273
|
+
const i = getCurrentInstance();
|
|
4274
|
+
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
4275
|
+
c._warnRecursive = true;
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
return c;
|
|
4279
|
+
};
|
|
535
4280
|
|
|
536
4281
|
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
537
4282
|
!!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
|
|
538
4283
|
!!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook : NOOP;
|
|
4284
|
+
const _ssrUtils = {
|
|
4285
|
+
createComponentInstance: createComponentInstance$1,
|
|
4286
|
+
setupComponent: setupComponent$1,
|
|
4287
|
+
renderComponentRoot: renderComponentRoot$1,
|
|
4288
|
+
setCurrentRenderingInstance: setCurrentRenderingInstance$1,
|
|
4289
|
+
isVNode: isVNode$2,
|
|
4290
|
+
normalizeVNode: normalizeVNode$1,
|
|
4291
|
+
getComponentPublicInstance
|
|
4292
|
+
};
|
|
4293
|
+
const ssrUtils = _ssrUtils ;
|
|
539
4294
|
|
|
540
4295
|
function ssrRenderList(source, renderItem) {
|
|
541
4296
|
if (isArray(source) || isString(source)) {
|
|
@@ -579,7 +4334,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
|
579
4334
|
return dir.getSSRProps(
|
|
580
4335
|
{
|
|
581
4336
|
dir,
|
|
582
|
-
instance,
|
|
4337
|
+
instance: ssrUtils.getComponentPublicInstance(instance.$),
|
|
583
4338
|
value,
|
|
584
4339
|
oldValue: void 0,
|
|
585
4340
|
arg,
|
|
@@ -631,7 +4386,7 @@ const {
|
|
|
631
4386
|
setupComponent,
|
|
632
4387
|
renderComponentRoot,
|
|
633
4388
|
normalizeVNode
|
|
634
|
-
} = ssrUtils;
|
|
4389
|
+
} = ssrUtils$1;
|
|
635
4390
|
function createBuffer() {
|
|
636
4391
|
let appendable = false;
|
|
637
4392
|
const buffer = [];
|
|
@@ -721,9 +4476,11 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
721
4476
|
}
|
|
722
4477
|
}
|
|
723
4478
|
if (slotScopeId) {
|
|
724
|
-
if (!hasCloned)
|
|
725
|
-
|
|
726
|
-
|
|
4479
|
+
if (!hasCloned) attrs = { ...attrs };
|
|
4480
|
+
const slotScopeIdList = slotScopeId.trim().split(" ");
|
|
4481
|
+
for (let i = 0; i < slotScopeIdList.length; i++) {
|
|
4482
|
+
attrs[slotScopeIdList[i]] = "";
|
|
4483
|
+
}
|
|
727
4484
|
}
|
|
728
4485
|
const prev = setCurrentRenderingInstance(instance);
|
|
729
4486
|
try {
|
|
@@ -750,7 +4507,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
750
4507
|
);
|
|
751
4508
|
} else {
|
|
752
4509
|
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
|
753
|
-
warn$
|
|
4510
|
+
warn$3(`Component ${componentName} is missing template or render function.`);
|
|
754
4511
|
push(`<!---->`);
|
|
755
4512
|
}
|
|
756
4513
|
}
|
|
@@ -759,10 +4516,10 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
759
4516
|
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
760
4517
|
const { type, shapeFlag, children } = vnode;
|
|
761
4518
|
switch (type) {
|
|
762
|
-
case Text:
|
|
4519
|
+
case Text$1:
|
|
763
4520
|
push(escapeHtml(children));
|
|
764
4521
|
break;
|
|
765
|
-
case Comment:
|
|
4522
|
+
case Comment$1:
|
|
766
4523
|
push(
|
|
767
4524
|
children ? `<!--${escapeHtmlComment(children)}-->` : `<!---->`
|
|
768
4525
|
);
|
|
@@ -770,7 +4527,7 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
770
4527
|
case Static:
|
|
771
4528
|
push(children);
|
|
772
4529
|
break;
|
|
773
|
-
case Fragment:
|
|
4530
|
+
case Fragment$1:
|
|
774
4531
|
if (vnode.slotScopeIds) {
|
|
775
4532
|
slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
|
|
776
4533
|
}
|
|
@@ -793,7 +4550,7 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
793
4550
|
} else if (shapeFlag & 128) {
|
|
794
4551
|
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
|
795
4552
|
} else {
|
|
796
|
-
warn$
|
|
4553
|
+
warn$3(
|
|
797
4554
|
"[@vue/server-renderer] Invalid VNode type:",
|
|
798
4555
|
type,
|
|
799
4556
|
`(${typeof type})`
|
|
@@ -870,23 +4627,22 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
|
|
870
4627
|
} = binding;
|
|
871
4628
|
if (getSSRProps) {
|
|
872
4629
|
const props = getSSRProps(binding, vnode);
|
|
873
|
-
if (props)
|
|
874
|
-
toMerge.push(props);
|
|
4630
|
+
if (props) toMerge.push(props);
|
|
875
4631
|
}
|
|
876
4632
|
}
|
|
877
|
-
return mergeProps(rawProps || {}, ...toMerge);
|
|
4633
|
+
return mergeProps$1(rawProps || {}, ...toMerge);
|
|
878
4634
|
}
|
|
879
4635
|
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
880
4636
|
const target = vnode.props && vnode.props.to;
|
|
881
4637
|
const disabled = vnode.props && vnode.props.disabled;
|
|
882
4638
|
if (!target) {
|
|
883
4639
|
if (!disabled) {
|
|
884
|
-
warn$
|
|
4640
|
+
warn$3(`[@vue/server-renderer] Teleport is missing target prop.`);
|
|
885
4641
|
}
|
|
886
4642
|
return [];
|
|
887
4643
|
}
|
|
888
4644
|
if (!isString(target)) {
|
|
889
|
-
warn$
|
|
4645
|
+
warn$3(
|
|
890
4646
|
`[@vue/server-renderer] Teleport target must be a query selector string.`
|
|
891
4647
|
);
|
|
892
4648
|
return [];
|
|
@@ -907,7 +4663,7 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
907
4663
|
);
|
|
908
4664
|
}
|
|
909
4665
|
|
|
910
|
-
const { isVNode: isVNode$1 } = ssrUtils;
|
|
4666
|
+
const { isVNode: isVNode$1 } = ssrUtils$1;
|
|
911
4667
|
async function unrollBuffer$1(buffer) {
|
|
912
4668
|
if (buffer.hasAsync) {
|
|
913
4669
|
let ret = "";
|
|
@@ -943,9 +4699,9 @@ async function renderToString(input, context = {}) {
|
|
|
943
4699
|
if (isVNode$1(input)) {
|
|
944
4700
|
return renderToString(createApp({ render: () => input }), context);
|
|
945
4701
|
}
|
|
946
|
-
const vnode = createVNode(input._component, input._props);
|
|
4702
|
+
const vnode = createVNode$1(input._component, input._props);
|
|
947
4703
|
vnode.appContext = input._context;
|
|
948
|
-
input.provide(ssrContextKey, context);
|
|
4704
|
+
input.provide(ssrContextKey$1, context);
|
|
949
4705
|
const buffer = await renderComponentVNode(vnode);
|
|
950
4706
|
const result = await unrollBuffer$1(buffer);
|
|
951
4707
|
await resolveTeleports(context);
|
|
@@ -967,7 +4723,7 @@ async function resolveTeleports(context) {
|
|
|
967
4723
|
}
|
|
968
4724
|
}
|
|
969
4725
|
|
|
970
|
-
const { isVNode } = ssrUtils;
|
|
4726
|
+
const { isVNode } = ssrUtils$1;
|
|
971
4727
|
async function unrollBuffer(buffer, stream) {
|
|
972
4728
|
if (buffer.hasAsync) {
|
|
973
4729
|
for (let i = 0; i < buffer.length; i++) {
|
|
@@ -1003,9 +4759,9 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
1003
4759
|
stream
|
|
1004
4760
|
);
|
|
1005
4761
|
}
|
|
1006
|
-
const vnode = createVNode(input._component, input._props);
|
|
4762
|
+
const vnode = createVNode$1(input._component, input._props);
|
|
1007
4763
|
vnode.appContext = input._context;
|
|
1008
|
-
input.provide(ssrContextKey, context);
|
|
4764
|
+
input.provide(ssrContextKey$1, context);
|
|
1009
4765
|
Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
|
|
1010
4766
|
if (context.__watcherHandles) {
|
|
1011
4767
|
for (const unwatch of context.__watcherHandles) {
|
|
@@ -1056,8 +4812,7 @@ function renderToWebStream(input, context = {}) {
|
|
|
1056
4812
|
start(controller) {
|
|
1057
4813
|
renderToSimpleStream(input, context, {
|
|
1058
4814
|
push(content) {
|
|
1059
|
-
if (cancelled)
|
|
1060
|
-
return;
|
|
4815
|
+
if (cancelled) return;
|
|
1061
4816
|
if (content != null) {
|
|
1062
4817
|
controller.enqueue(encoder.encode(content));
|
|
1063
4818
|
} else {
|