1 | var Vue = (function (exports) {
|
2 | 'use strict';
|
3 |
|
4 | |
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function makeMap(str, expectsLowerCase) {
|
12 | const map = Object.create(null);
|
13 | const list = str.split(',');
|
14 | for (let i = 0; i < list.length; i++) {
|
15 | map[list[i]] = true;
|
16 | }
|
17 | return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
18 | }
|
19 |
|
20 | const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
21 | 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
22 | 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
23 | const isGloballyWhitelisted = makeMap(GLOBALS_WHITE_LISTED);
|
24 |
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
37 | const isSpecialBooleanAttr = makeMap(specialBooleanAttrs);
|
38 |
|
39 | function normalizeStyle(value) {
|
40 | if (isArray(value)) {
|
41 | const res = {};
|
42 | for (let i = 0; i < value.length; i++) {
|
43 | const item = value[i];
|
44 | const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
|
45 | if (normalized) {
|
46 | for (const key in normalized) {
|
47 | res[key] = normalized[key];
|
48 | }
|
49 | }
|
50 | }
|
51 | return res;
|
52 | }
|
53 | else if (isObject(value)) {
|
54 | return value;
|
55 | }
|
56 | }
|
57 | const listDelimiterRE = /;(?![^(]*\))/g;
|
58 | const propertyDelimiterRE = /:(.+)/;
|
59 | function parseStringStyle(cssText) {
|
60 | const ret = {};
|
61 | cssText.split(listDelimiterRE).forEach(item => {
|
62 | if (item) {
|
63 | const tmp = item.split(propertyDelimiterRE);
|
64 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
65 | }
|
66 | });
|
67 | return ret;
|
68 | }
|
69 | function normalizeClass(value) {
|
70 | let res = '';
|
71 | if (isString(value)) {
|
72 | res = value;
|
73 | }
|
74 | else if (isArray(value)) {
|
75 | for (let i = 0; i < value.length; i++) {
|
76 | const normalized = normalizeClass(value[i]);
|
77 | if (normalized) {
|
78 | res += normalized + ' ';
|
79 | }
|
80 | }
|
81 | }
|
82 | else if (isObject(value)) {
|
83 | for (const name in value) {
|
84 | if (value[name]) {
|
85 | res += name + ' ';
|
86 | }
|
87 | }
|
88 | }
|
89 | return res.trim();
|
90 | }
|
91 |
|
92 |
|
93 |
|
94 | const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
95 | 'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
|
96 | 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
97 | 'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
|
98 | 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
99 | 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
100 | 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
101 | 'option,output,progress,select,textarea,details,dialog,menu,' +
|
102 | 'summary,template,blockquote,iframe,tfoot';
|
103 |
|
104 | const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
105 | 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
106 | 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
107 | 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
108 | 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
109 | 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
110 | 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
111 | 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
112 | 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
113 | 'text,textPath,title,tspan,unknown,use,view';
|
114 | const isHTMLTag = makeMap(HTML_TAGS);
|
115 | const isSVGTag = makeMap(SVG_TAGS);
|
116 |
|
117 | function looseCompareArrays(a, b) {
|
118 | if (a.length !== b.length)
|
119 | return false;
|
120 | let equal = true;
|
121 | for (let i = 0; equal && i < a.length; i++) {
|
122 | equal = looseEqual(a[i], b[i]);
|
123 | }
|
124 | return equal;
|
125 | }
|
126 | function looseEqual(a, b) {
|
127 | if (a === b)
|
128 | return true;
|
129 | let aValidType = isDate(a);
|
130 | let bValidType = isDate(b);
|
131 | if (aValidType || bValidType) {
|
132 | return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
133 | }
|
134 | aValidType = isArray(a);
|
135 | bValidType = isArray(b);
|
136 | if (aValidType || bValidType) {
|
137 | return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
138 | }
|
139 | aValidType = isObject(a);
|
140 | bValidType = isObject(b);
|
141 | if (aValidType || bValidType) {
|
142 |
|
143 | if (!aValidType || !bValidType) {
|
144 | return false;
|
145 | }
|
146 | const aKeysCount = Object.keys(a).length;
|
147 | const bKeysCount = Object.keys(b).length;
|
148 | if (aKeysCount !== bKeysCount) {
|
149 | return false;
|
150 | }
|
151 | for (const key in a) {
|
152 | const aHasKey = a.hasOwnProperty(key);
|
153 | const bHasKey = b.hasOwnProperty(key);
|
154 | if ((aHasKey && !bHasKey) ||
|
155 | (!aHasKey && bHasKey) ||
|
156 | !looseEqual(a[key], b[key])) {
|
157 | return false;
|
158 | }
|
159 | }
|
160 | }
|
161 | return String(a) === String(b);
|
162 | }
|
163 | function looseIndexOf(arr, val) {
|
164 | return arr.findIndex(item => looseEqual(item, val));
|
165 | }
|
166 |
|
167 | |
168 |
|
169 |
|
170 |
|
171 | const toDisplayString = (val) => {
|
172 | return val == null
|
173 | ? ''
|
174 | : isObject(val)
|
175 | ? JSON.stringify(val, replacer, 2)
|
176 | : String(val);
|
177 | };
|
178 | const replacer = (_key, val) => {
|
179 | if (isMap(val)) {
|
180 | return {
|
181 | [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
182 | entries[`${key} =>`] = val;
|
183 | return entries;
|
184 | }, {})
|
185 | };
|
186 | }
|
187 | else if (isSet(val)) {
|
188 | return {
|
189 | [`Set(${val.size})`]: [...val.values()]
|
190 | };
|
191 | }
|
192 | else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
193 | return String(val);
|
194 | }
|
195 | return val;
|
196 | };
|
197 |
|
198 | const EMPTY_OBJ = Object.freeze({})
|
199 | ;
|
200 | const EMPTY_ARR = Object.freeze([]) ;
|
201 | const NOOP = () => { };
|
202 | |
203 |
|
204 |
|
205 | const NO = () => false;
|
206 | const onRE = /^on[^a-z]/;
|
207 | const isOn = (key) => onRE.test(key);
|
208 | const isModelListener = (key) => key.startsWith('onUpdate:');
|
209 | const extend = Object.assign;
|
210 | const remove = (arr, el) => {
|
211 | const i = arr.indexOf(el);
|
212 | if (i > -1) {
|
213 | arr.splice(i, 1);
|
214 | }
|
215 | };
|
216 | const hasOwnProperty = Object.prototype.hasOwnProperty;
|
217 | const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
218 | const isArray = Array.isArray;
|
219 | const isMap = (val) => toTypeString(val) === '[object Map]';
|
220 | const isSet = (val) => toTypeString(val) === '[object Set]';
|
221 | const isDate = (val) => val instanceof Date;
|
222 | const isFunction = (val) => typeof val === 'function';
|
223 | const isString = (val) => typeof val === 'string';
|
224 | const isSymbol = (val) => typeof val === 'symbol';
|
225 | const isObject = (val) => val !== null && typeof val === 'object';
|
226 | const isPromise = (val) => {
|
227 | return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
228 | };
|
229 | const objectToString = Object.prototype.toString;
|
230 | const toTypeString = (value) => objectToString.call(value);
|
231 | const toRawType = (value) => {
|
232 |
|
233 | return toTypeString(value).slice(8, -1);
|
234 | };
|
235 | const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
236 | const isIntegerKey = (key) => isString(key) &&
|
237 | key !== 'NaN' &&
|
238 | key[0] !== '-' &&
|
239 | '' + parseInt(key, 10) === key;
|
240 | const isReservedProp = makeMap(
|
241 |
|
242 | ',key,ref,' +
|
243 | 'onVnodeBeforeMount,onVnodeMounted,' +
|
244 | 'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
245 | 'onVnodeBeforeUnmount,onVnodeUnmounted');
|
246 | const cacheStringFunction = (fn) => {
|
247 | const cache = Object.create(null);
|
248 | return ((str) => {
|
249 | const hit = cache[str];
|
250 | return hit || (cache[str] = fn(str));
|
251 | });
|
252 | };
|
253 | const camelizeRE = /-(\w)/g;
|
254 | |
255 |
|
256 |
|
257 | const camelize = cacheStringFunction((str) => {
|
258 | return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
259 | });
|
260 | const hyphenateRE = /\B([A-Z])/g;
|
261 | |
262 |
|
263 |
|
264 | const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
265 | |
266 |
|
267 |
|
268 | const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
269 | |
270 |
|
271 |
|
272 | const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
|
273 |
|
274 | const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
275 | const invokeArrayFns = (fns, arg) => {
|
276 | for (let i = 0; i < fns.length; i++) {
|
277 | fns[i](arg);
|
278 | }
|
279 | };
|
280 | const def = (obj, key, value) => {
|
281 | Object.defineProperty(obj, key, {
|
282 | configurable: true,
|
283 | enumerable: false,
|
284 | value
|
285 | });
|
286 | };
|
287 | const toNumber = (val) => {
|
288 | const n = parseFloat(val);
|
289 | return isNaN(n) ? val : n;
|
290 | };
|
291 | let _globalThis;
|
292 | const getGlobalThis = () => {
|
293 | return (_globalThis ||
|
294 | (_globalThis =
|
295 | typeof globalThis !== 'undefined'
|
296 | ? globalThis
|
297 | : typeof self !== 'undefined'
|
298 | ? self
|
299 | : typeof window !== 'undefined'
|
300 | ? window
|
301 | : typeof global !== 'undefined'
|
302 | ? global
|
303 | : {}));
|
304 | };
|
305 |
|
306 | const targetMap = new WeakMap();
|
307 | const effectStack = [];
|
308 | let activeEffect;
|
309 | const ITERATE_KEY = Symbol('iterate' );
|
310 | const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
|
311 | function isEffect(fn) {
|
312 | return fn && fn._isEffect === true;
|
313 | }
|
314 | function effect(fn, options = EMPTY_OBJ) {
|
315 | if (isEffect(fn)) {
|
316 | fn = fn.raw;
|
317 | }
|
318 | const effect = createReactiveEffect(fn, options);
|
319 | if (!options.lazy) {
|
320 | effect();
|
321 | }
|
322 | return effect;
|
323 | }
|
324 | function stop(effect) {
|
325 | if (effect.active) {
|
326 | cleanup(effect);
|
327 | if (effect.options.onStop) {
|
328 | effect.options.onStop();
|
329 | }
|
330 | effect.active = false;
|
331 | }
|
332 | }
|
333 | let uid = 0;
|
334 | function createReactiveEffect(fn, options) {
|
335 | const effect = function reactiveEffect() {
|
336 | if (!effect.active) {
|
337 | return options.scheduler ? undefined : fn();
|
338 | }
|
339 | if (!effectStack.includes(effect)) {
|
340 | cleanup(effect);
|
341 | try {
|
342 | enableTracking();
|
343 | effectStack.push(effect);
|
344 | activeEffect = effect;
|
345 | return fn();
|
346 | }
|
347 | finally {
|
348 | effectStack.pop();
|
349 | resetTracking();
|
350 | activeEffect = effectStack[effectStack.length - 1];
|
351 | }
|
352 | }
|
353 | };
|
354 | effect.id = uid++;
|
355 | effect.allowRecurse = !!options.allowRecurse;
|
356 | effect._isEffect = true;
|
357 | effect.active = true;
|
358 | effect.raw = fn;
|
359 | effect.deps = [];
|
360 | effect.options = options;
|
361 | return effect;
|
362 | }
|
363 | function cleanup(effect) {
|
364 | const { deps } = effect;
|
365 | if (deps.length) {
|
366 | for (let i = 0; i < deps.length; i++) {
|
367 | deps[i].delete(effect);
|
368 | }
|
369 | deps.length = 0;
|
370 | }
|
371 | }
|
372 | let shouldTrack = true;
|
373 | const trackStack = [];
|
374 | function pauseTracking() {
|
375 | trackStack.push(shouldTrack);
|
376 | shouldTrack = false;
|
377 | }
|
378 | function enableTracking() {
|
379 | trackStack.push(shouldTrack);
|
380 | shouldTrack = true;
|
381 | }
|
382 | function resetTracking() {
|
383 | const last = trackStack.pop();
|
384 | shouldTrack = last === undefined ? true : last;
|
385 | }
|
386 | function track(target, type, key) {
|
387 | if (!shouldTrack || activeEffect === undefined) {
|
388 | return;
|
389 | }
|
390 | let depsMap = targetMap.get(target);
|
391 | if (!depsMap) {
|
392 | targetMap.set(target, (depsMap = new Map()));
|
393 | }
|
394 | let dep = depsMap.get(key);
|
395 | if (!dep) {
|
396 | depsMap.set(key, (dep = new Set()));
|
397 | }
|
398 | if (!dep.has(activeEffect)) {
|
399 | dep.add(activeEffect);
|
400 | activeEffect.deps.push(dep);
|
401 | if (activeEffect.options.onTrack) {
|
402 | activeEffect.options.onTrack({
|
403 | effect: activeEffect,
|
404 | target,
|
405 | type,
|
406 | key
|
407 | });
|
408 | }
|
409 | }
|
410 | }
|
411 | function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
412 | const depsMap = targetMap.get(target);
|
413 | if (!depsMap) {
|
414 |
|
415 | return;
|
416 | }
|
417 | const effects = new Set();
|
418 | const add = (effectsToAdd) => {
|
419 | if (effectsToAdd) {
|
420 | effectsToAdd.forEach(effect => {
|
421 | if (effect !== activeEffect || effect.allowRecurse) {
|
422 | effects.add(effect);
|
423 | }
|
424 | });
|
425 | }
|
426 | };
|
427 | if (type === "clear" ) {
|
428 |
|
429 |
|
430 | depsMap.forEach(add);
|
431 | }
|
432 | else if (key === 'length' && isArray(target)) {
|
433 | depsMap.forEach((dep, key) => {
|
434 | if (key === 'length' || key >= newValue) {
|
435 | add(dep);
|
436 | }
|
437 | });
|
438 | }
|
439 | else {
|
440 |
|
441 | if (key !== void 0) {
|
442 | add(depsMap.get(key));
|
443 | }
|
444 |
|
445 | switch (type) {
|
446 | case "add" :
|
447 | if (!isArray(target)) {
|
448 | add(depsMap.get(ITERATE_KEY));
|
449 | if (isMap(target)) {
|
450 | add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
451 | }
|
452 | }
|
453 | else if (isIntegerKey(key)) {
|
454 |
|
455 | add(depsMap.get('length'));
|
456 | }
|
457 | break;
|
458 | case "delete" :
|
459 | if (!isArray(target)) {
|
460 | add(depsMap.get(ITERATE_KEY));
|
461 | if (isMap(target)) {
|
462 | add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
463 | }
|
464 | }
|
465 | break;
|
466 | case "set" :
|
467 | if (isMap(target)) {
|
468 | add(depsMap.get(ITERATE_KEY));
|
469 | }
|
470 | break;
|
471 | }
|
472 | }
|
473 | const run = (effect) => {
|
474 | if (effect.options.onTrigger) {
|
475 | effect.options.onTrigger({
|
476 | effect,
|
477 | target,
|
478 | key,
|
479 | type,
|
480 | newValue,
|
481 | oldValue,
|
482 | oldTarget
|
483 | });
|
484 | }
|
485 | if (effect.options.scheduler) {
|
486 | effect.options.scheduler(effect);
|
487 | }
|
488 | else {
|
489 | effect();
|
490 | }
|
491 | };
|
492 | effects.forEach(run);
|
493 | }
|
494 |
|
495 | const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`);
|
496 | const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
497 | .map(key => Symbol[key])
|
498 | .filter(isSymbol));
|
499 | const get = /*#__PURE__*/ createGetter();
|
500 | const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
501 | const readonlyGet = /*#__PURE__*/ createGetter(true);
|
502 | const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
503 | const arrayInstrumentations = {};
|
504 | ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
505 | const method = Array.prototype[key];
|
506 | arrayInstrumentations[key] = function (...args) {
|
507 | const arr = toRaw(this);
|
508 | for (let i = 0, l = this.length; i < l; i++) {
|
509 | track(arr, "get" , i + '');
|
510 | }
|
511 |
|
512 | const res = method.apply(arr, args);
|
513 | if (res === -1 || res === false) {
|
514 |
|
515 | return method.apply(arr, args.map(toRaw));
|
516 | }
|
517 | else {
|
518 | return res;
|
519 | }
|
520 | };
|
521 | });
|
522 | ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
523 | const method = Array.prototype[key];
|
524 | arrayInstrumentations[key] = function (...args) {
|
525 | pauseTracking();
|
526 | const res = method.apply(this, args);
|
527 | resetTracking();
|
528 | return res;
|
529 | };
|
530 | });
|
531 | function createGetter(isReadonly = false, shallow = false) {
|
532 | return function get(target, key, receiver) {
|
533 | if (key === "__v_isReactive" ) {
|
534 | return !isReadonly;
|
535 | }
|
536 | else if (key === "__v_isReadonly" ) {
|
537 | return isReadonly;
|
538 | }
|
539 | else if (key === "__v_raw" &&
|
540 | receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
541 | return target;
|
542 | }
|
543 | const targetIsArray = isArray(target);
|
544 | if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
545 | return Reflect.get(arrayInstrumentations, key, receiver);
|
546 | }
|
547 | const res = Reflect.get(target, key, receiver);
|
548 | if (isSymbol(key)
|
549 | ? builtInSymbols.has(key)
|
550 | : isNonTrackableKeys(key)) {
|
551 | return res;
|
552 | }
|
553 | if (!isReadonly) {
|
554 | track(target, "get" , key);
|
555 | }
|
556 | if (shallow) {
|
557 | return res;
|
558 | }
|
559 | if (isRef(res)) {
|
560 |
|
561 | const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
|
562 | return shouldUnwrap ? res.value : res;
|
563 | }
|
564 | if (isObject(res)) {
|
565 |
|
566 |
|
567 |
|
568 | return isReadonly ? readonly(res) : reactive(res);
|
569 | }
|
570 | return res;
|
571 | };
|
572 | }
|
573 | const set = /*#__PURE__*/ createSetter();
|
574 | const shallowSet = /*#__PURE__*/ createSetter(true);
|
575 | function createSetter(shallow = false) {
|
576 | return function set(target, key, value, receiver) {
|
577 | const oldValue = target[key];
|
578 | if (!shallow) {
|
579 | value = toRaw(value);
|
580 | if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
581 | oldValue.value = value;
|
582 | return true;
|
583 | }
|
584 | }
|
585 | const hadKey = isArray(target) && isIntegerKey(key)
|
586 | ? Number(key) < target.length
|
587 | : hasOwn(target, key);
|
588 | const result = Reflect.set(target, key, value, receiver);
|
589 |
|
590 | if (target === toRaw(receiver)) {
|
591 | if (!hadKey) {
|
592 | trigger(target, "add" , key, value);
|
593 | }
|
594 | else if (hasChanged(value, oldValue)) {
|
595 | trigger(target, "set" , key, value, oldValue);
|
596 | }
|
597 | }
|
598 | return result;
|
599 | };
|
600 | }
|
601 | function deleteProperty(target, key) {
|
602 | const hadKey = hasOwn(target, key);
|
603 | const oldValue = target[key];
|
604 | const result = Reflect.deleteProperty(target, key);
|
605 | if (result && hadKey) {
|
606 | trigger(target, "delete" , key, undefined, oldValue);
|
607 | }
|
608 | return result;
|
609 | }
|
610 | function has(target, key) {
|
611 | const result = Reflect.has(target, key);
|
612 | if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
613 | track(target, "has" , key);
|
614 | }
|
615 | return result;
|
616 | }
|
617 | function ownKeys(target) {
|
618 | track(target, "iterate" , isArray(target) ? 'length' : ITERATE_KEY);
|
619 | return Reflect.ownKeys(target);
|
620 | }
|
621 | const mutableHandlers = {
|
622 | get,
|
623 | set,
|
624 | deleteProperty,
|
625 | has,
|
626 | ownKeys
|
627 | };
|
628 | const readonlyHandlers = {
|
629 | get: readonlyGet,
|
630 | set(target, key) {
|
631 | {
|
632 | console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
633 | }
|
634 | return true;
|
635 | },
|
636 | deleteProperty(target, key) {
|
637 | {
|
638 | console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
639 | }
|
640 | return true;
|
641 | }
|
642 | };
|
643 | const shallowReactiveHandlers = extend({}, mutableHandlers, {
|
644 | get: shallowGet,
|
645 | set: shallowSet
|
646 | });
|
647 | // Props handlers are special in the sense that it should not unwrap top-level
|
648 | // refs (in order to allow refs to be explicitly passed down), but should
|
649 | // retain the reactivity of the normal readonly object.
|
650 | const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
|
651 | get: shallowReadonlyGet
|
652 | });
|
653 |
|
654 | const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
655 | const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
656 | const toShallow = (value) => value;
|
657 | const getProto = (v) => Reflect.getPrototypeOf(v);
|
658 | function get$1(target, key, isReadonly = false, isShallow = false) {
|
659 |
|
660 |
|
661 | target = target["__v_raw" ];
|
662 | const rawTarget = toRaw(target);
|
663 | const rawKey = toRaw(key);
|
664 | if (key !== rawKey) {
|
665 | !isReadonly && track(rawTarget, "get" , key);
|
666 | }
|
667 | !isReadonly && track(rawTarget, "get" , rawKey);
|
668 | const { has } = getProto(rawTarget);
|
669 | const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
670 | if (has.call(rawTarget, key)) {
|
671 | return wrap(target.get(key));
|
672 | }
|
673 | else if (has.call(rawTarget, rawKey)) {
|
674 | return wrap(target.get(rawKey));
|
675 | }
|
676 | }
|
677 | function has$1(key, isReadonly = false) {
|
678 | const target = this["__v_raw" ];
|
679 | const rawTarget = toRaw(target);
|
680 | const rawKey = toRaw(key);
|
681 | if (key !== rawKey) {
|
682 | !isReadonly && track(rawTarget, "has" , key);
|
683 | }
|
684 | !isReadonly && track(rawTarget, "has" , rawKey);
|
685 | return key === rawKey
|
686 | ? target.has(key)
|
687 | : target.has(key) || target.has(rawKey);
|
688 | }
|
689 | function size(target, isReadonly = false) {
|
690 | target = target["__v_raw" ];
|
691 | !isReadonly && track(toRaw(target), "iterate" , ITERATE_KEY);
|
692 | return Reflect.get(target, 'size', target);
|
693 | }
|
694 | function add(value) {
|
695 | value = toRaw(value);
|
696 | const target = toRaw(this);
|
697 | const proto = getProto(target);
|
698 | const hadKey = proto.has.call(target, value);
|
699 | if (!hadKey) {
|
700 | target.add(value);
|
701 | trigger(target, "add" , value, value);
|
702 | }
|
703 | return this;
|
704 | }
|
705 | function set$1(key, value) {
|
706 | value = toRaw(value);
|
707 | const target = toRaw(this);
|
708 | const { has, get } = getProto(target);
|
709 | let hadKey = has.call(target, key);
|
710 | if (!hadKey) {
|
711 | key = toRaw(key);
|
712 | hadKey = has.call(target, key);
|
713 | }
|
714 | else {
|
715 | checkIdentityKeys(target, has, key);
|
716 | }
|
717 | const oldValue = get.call(target, key);
|
718 | target.set(key, value);
|
719 | if (!hadKey) {
|
720 | trigger(target, "add" , key, value);
|
721 | }
|
722 | else if (hasChanged(value, oldValue)) {
|
723 | trigger(target, "set" , key, value, oldValue);
|
724 | }
|
725 | return this;
|
726 | }
|
727 | function deleteEntry(key) {
|
728 | const target = toRaw(this);
|
729 | const { has, get } = getProto(target);
|
730 | let hadKey = has.call(target, key);
|
731 | if (!hadKey) {
|
732 | key = toRaw(key);
|
733 | hadKey = has.call(target, key);
|
734 | }
|
735 | else {
|
736 | checkIdentityKeys(target, has, key);
|
737 | }
|
738 | const oldValue = get ? get.call(target, key) : undefined;
|
739 | // forward the operation before queueing reactions
|
740 | const result = target.delete(key);
|
741 | if (hadKey) {
|
742 | trigger(target, "delete" , key, undefined, oldValue);
|
743 | }
|
744 | return result;
|
745 | }
|
746 | function clear() {
|
747 | const target = toRaw(this);
|
748 | const hadItems = target.size !== 0;
|
749 | const oldTarget = isMap(target)
|
750 | ? new Map(target)
|
751 | : new Set(target)
|
752 | ;
|
753 |
|
754 | const result = target.clear();
|
755 | if (hadItems) {
|
756 | trigger(target, "clear" , undefined, undefined, oldTarget);
|
757 | }
|
758 | return result;
|
759 | }
|
760 | function createForEach(isReadonly, isShallow) {
|
761 | return function forEach(callback, thisArg) {
|
762 | const observed = this;
|
763 | const target = observed["__v_raw" ];
|
764 | const rawTarget = toRaw(target);
|
765 | const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
766 | !isReadonly && track(rawTarget, "iterate" , ITERATE_KEY);
|
767 | return target.forEach((value, key) => {
|
768 |
|
769 |
|
770 |
|
771 | return callback.call(thisArg, wrap(value), wrap(key), observed);
|
772 | });
|
773 | };
|
774 | }
|
775 | function createIterableMethod(method, isReadonly, isShallow) {
|
776 | return function (...args) {
|
777 | const target = this["__v_raw" ];
|
778 | const rawTarget = toRaw(target);
|
779 | const targetIsMap = isMap(rawTarget);
|
780 | const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
781 | const isKeyOnly = method === 'keys' && targetIsMap;
|
782 | const innerIterator = target[method](...args);
|
783 | const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
784 | !isReadonly &&
|
785 | track(rawTarget, "iterate" , isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
786 |
|
787 |
|
788 | return {
|
789 |
|
790 | next() {
|
791 | const { value, done } = innerIterator.next();
|
792 | return done
|
793 | ? { value, done }
|
794 | : {
|
795 | value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
796 | done
|
797 | };
|
798 | },
|
799 |
|
800 | [Symbol.iterator]() {
|
801 | return this;
|
802 | }
|
803 | };
|
804 | };
|
805 | }
|
806 | function createReadonlyMethod(type) {
|
807 | return function (...args) {
|
808 | {
|
809 | const key = args[0] ? `on key "${args[0]}" ` : ``;
|
810 | console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
811 | }
|
812 | return type === "delete" ? false : this;
|
813 | };
|
814 | }
|
815 | const mutableInstrumentations = {
|
816 | get(key) {
|
817 | return get$1(this, key);
|
818 | },
|
819 | get size() {
|
820 | return size(this);
|
821 | },
|
822 | has: has$1,
|
823 | add,
|
824 | set: set$1,
|
825 | delete: deleteEntry,
|
826 | clear,
|
827 | forEach: createForEach(false, false)
|
828 | };
|
829 | const shallowInstrumentations = {
|
830 | get(key) {
|
831 | return get$1(this, key, false, true);
|
832 | },
|
833 | get size() {
|
834 | return size(this);
|
835 | },
|
836 | has: has$1,
|
837 | add,
|
838 | set: set$1,
|
839 | delete: deleteEntry,
|
840 | clear,
|
841 | forEach: createForEach(false, true)
|
842 | };
|
843 | const readonlyInstrumentations = {
|
844 | get(key) {
|
845 | return get$1(this, key, true);
|
846 | },
|
847 | get size() {
|
848 | return size(this, true);
|
849 | },
|
850 | has(key) {
|
851 | return has$1.call(this, key, true);
|
852 | },
|
853 | add: createReadonlyMethod("add" ),
|
854 | set: createReadonlyMethod("set" /* SET */),
|
855 | delete: createReadonlyMethod("delete" /* DELETE */),
|
856 | clear: createReadonlyMethod("clear" /* CLEAR */),
|
857 | forEach: createForEach(true, false)
|
858 | };
|
859 | const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
860 | iteratorMethods.forEach(method => {
|
861 | mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
862 | readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
863 | shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
864 | });
|
865 | function createInstrumentationGetter(isReadonly, shallow) {
|
866 | const instrumentations = shallow
|
867 | ? shallowInstrumentations
|
868 | : isReadonly
|
869 | ? readonlyInstrumentations
|
870 | : mutableInstrumentations;
|
871 | return (target, key, receiver) => {
|
872 | if (key === "__v_isReactive" ) {
|
873 | return !isReadonly;
|
874 | }
|
875 | else if (key === "__v_isReadonly" ) {
|
876 | return isReadonly;
|
877 | }
|
878 | else if (key === "__v_raw" ) {
|
879 | return target;
|
880 | }
|
881 | return Reflect.get(hasOwn(instrumentations, key) && key in target
|
882 | ? instrumentations
|
883 | : target, key, receiver);
|
884 | };
|
885 | }
|
886 | const mutableCollectionHandlers = {
|
887 | get: createInstrumentationGetter(false, false)
|
888 | };
|
889 | const shallowCollectionHandlers = {
|
890 | get: createInstrumentationGetter(false, true)
|
891 | };
|
892 | const readonlyCollectionHandlers = {
|
893 | get: createInstrumentationGetter(true, false)
|
894 | };
|
895 | function checkIdentityKeys(target, has, key) {
|
896 | const rawKey = toRaw(key);
|
897 | if (rawKey !== key && has.call(target, rawKey)) {
|
898 | const type = toRawType(target);
|
899 | console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
900 | `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
901 | `which can lead to inconsistencies. ` +
|
902 | `Avoid differentiating between the raw and reactive versions ` +
|
903 | `of an object and only use the reactive version if possible.`);
|
904 | }
|
905 | }
|
906 |
|
907 | const reactiveMap = new WeakMap();
|
908 | const readonlyMap = new WeakMap();
|
909 | function targetTypeMap(rawType) {
|
910 | switch (rawType) {
|
911 | case 'Object':
|
912 | case 'Array':
|
913 | return 1 ;
|
914 | case 'Map':
|
915 | case 'Set':
|
916 | case 'WeakMap':
|
917 | case 'WeakSet':
|
918 | return 2 ;
|
919 | default:
|
920 | return 0 ;
|
921 | }
|
922 | }
|
923 | function getTargetType(value) {
|
924 | return value["__v_skip" ] || !Object.isExtensible(value)
|
925 | ? 0
|
926 | : targetTypeMap(toRawType(value));
|
927 | }
|
928 | function reactive(target) {
|
929 |
|
930 | if (target && target["__v_isReadonly" ]) {
|
931 | return target;
|
932 | }
|
933 | return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
934 | }
|
935 | |
936 |
|
937 |
|
938 |
|
939 |
|
940 | function shallowReactive(target) {
|
941 | return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
942 | }
|
943 | |
944 |
|
945 |
|
946 |
|
947 | function readonly(target) {
|
948 | return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
949 | }
|
950 | |
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | function shallowReadonly(target) {
|
957 | return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
958 | }
|
959 | function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
960 | if (!isObject(target)) {
|
961 | {
|
962 | console.warn(`value cannot be made reactive: ${String(target)}`);
|
963 | }
|
964 | return target;
|
965 | }
|
966 |
|
967 |
|
968 | if (target["__v_raw" ] &&
|
969 | !(isReadonly && target["__v_isReactive" ])) {
|
970 | return target;
|
971 | }
|
972 |
|
973 | const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
974 | const existingProxy = proxyMap.get(target);
|
975 | if (existingProxy) {
|
976 | return existingProxy;
|
977 | }
|
978 |
|
979 | const targetType = getTargetType(target);
|
980 | if (targetType === 0 ) {
|
981 | return target;
|
982 | }
|
983 | const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
984 | proxyMap.set(target, proxy);
|
985 | return proxy;
|
986 | }
|
987 | function isReactive(value) {
|
988 | if (isReadonly(value)) {
|
989 | return isReactive(value["__v_raw" ]);
|
990 | }
|
991 | return !!(value && value["__v_isReactive" ]);
|
992 | }
|
993 | function isReadonly(value) {
|
994 | return !!(value && value["__v_isReadonly" ]);
|
995 | }
|
996 | function isProxy(value) {
|
997 | return isReactive(value) || isReadonly(value);
|
998 | }
|
999 | function toRaw(observed) {
|
1000 | return ((observed && toRaw(observed["__v_raw" ])) || observed);
|
1001 | }
|
1002 | function markRaw(value) {
|
1003 | def(value, "__v_skip" , true);
|
1004 | return value;
|
1005 | }
|
1006 |
|
1007 | const convert = (val) => isObject(val) ? reactive(val) : val;
|
1008 | function isRef(r) {
|
1009 | return Boolean(r && r.__v_isRef === true);
|
1010 | }
|
1011 | function ref(value) {
|
1012 | return createRef(value);
|
1013 | }
|
1014 | function shallowRef(value) {
|
1015 | return createRef(value, true);
|
1016 | }
|
1017 | class RefImpl {
|
1018 | constructor(_rawValue, _shallow = false) {
|
1019 | this._rawValue = _rawValue;
|
1020 | this._shallow = _shallow;
|
1021 | this.__v_isRef = true;
|
1022 | this._value = _shallow ? _rawValue : convert(_rawValue);
|
1023 | }
|
1024 | get value() {
|
1025 | track(toRaw(this), "get" , 'value');
|
1026 | return this._value;
|
1027 | }
|
1028 | set value(newVal) {
|
1029 | if (hasChanged(toRaw(newVal), this._rawValue)) {
|
1030 | this._rawValue = newVal;
|
1031 | this._value = this._shallow ? newVal : convert(newVal);
|
1032 | trigger(toRaw(this), "set" , 'value', newVal);
|
1033 | }
|
1034 | }
|
1035 | }
|
1036 | function createRef(rawValue, shallow = false) {
|
1037 | if (isRef(rawValue)) {
|
1038 | return rawValue;
|
1039 | }
|
1040 | return new RefImpl(rawValue, shallow);
|
1041 | }
|
1042 | function triggerRef(ref) {
|
1043 | trigger(toRaw(ref), "set" , 'value', ref.value );
|
1044 | }
|
1045 | function unref(ref) {
|
1046 | return isRef(ref) ? ref.value : ref;
|
1047 | }
|
1048 | const shallowUnwrapHandlers = {
|
1049 | get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
1050 | set: (target, key, value, receiver) => {
|
1051 | const oldValue = target[key];
|
1052 | if (isRef(oldValue) && !isRef(value)) {
|
1053 | oldValue.value = value;
|
1054 | return true;
|
1055 | }
|
1056 | else {
|
1057 | return Reflect.set(target, key, value, receiver);
|
1058 | }
|
1059 | }
|
1060 | };
|
1061 | function proxyRefs(objectWithRefs) {
|
1062 | return isReactive(objectWithRefs)
|
1063 | ? objectWithRefs
|
1064 | : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
1065 | }
|
1066 | class CustomRefImpl {
|
1067 | constructor(factory) {
|
1068 | this.__v_isRef = true;
|
1069 | const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
1070 | this._get = get;
|
1071 | this._set = set;
|
1072 | }
|
1073 | get value() {
|
1074 | return this._get();
|
1075 | }
|
1076 | set value(newVal) {
|
1077 | this._set(newVal);
|
1078 | }
|
1079 | }
|
1080 | function customRef(factory) {
|
1081 | return new CustomRefImpl(factory);
|
1082 | }
|
1083 | function toRefs(object) {
|
1084 | if (!isProxy(object)) {
|
1085 | console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
1086 | }
|
1087 | const ret = isArray(object) ? new Array(object.length) : {};
|
1088 | for (const key in object) {
|
1089 | ret[key] = toRef(object, key);
|
1090 | }
|
1091 | return ret;
|
1092 | }
|
1093 | class ObjectRefImpl {
|
1094 | constructor(_object, _key) {
|
1095 | this._object = _object;
|
1096 | this._key = _key;
|
1097 | this.__v_isRef = true;
|
1098 | }
|
1099 | get value() {
|
1100 | return this._object[this._key];
|
1101 | }
|
1102 | set value(newVal) {
|
1103 | this._object[this._key] = newVal;
|
1104 | }
|
1105 | }
|
1106 | function toRef(object, key) {
|
1107 | return isRef(object[key])
|
1108 | ? object[key]
|
1109 | : new ObjectRefImpl(object, key);
|
1110 | }
|
1111 |
|
1112 | class ComputedRefImpl {
|
1113 | constructor(getter, _setter, isReadonly) {
|
1114 | this._setter = _setter;
|
1115 | this._dirty = true;
|
1116 | this.__v_isRef = true;
|
1117 | this.effect = effect(getter, {
|
1118 | lazy: true,
|
1119 | scheduler: () => {
|
1120 | if (!this._dirty) {
|
1121 | this._dirty = true;
|
1122 | trigger(toRaw(this), "set" , 'value');
|
1123 | }
|
1124 | }
|
1125 | });
|
1126 | this["__v_isReadonly" ] = isReadonly;
|
1127 | }
|
1128 | get value() {
|
1129 | if (this._dirty) {
|
1130 | this._value = this.effect();
|
1131 | this._dirty = false;
|
1132 | }
|
1133 | track(toRaw(this), "get" , 'value');
|
1134 | return this._value;
|
1135 | }
|
1136 | set value(newValue) {
|
1137 | this._setter(newValue);
|
1138 | }
|
1139 | }
|
1140 | function computed(getterOrOptions) {
|
1141 | let getter;
|
1142 | let setter;
|
1143 | if (isFunction(getterOrOptions)) {
|
1144 | getter = getterOrOptions;
|
1145 | setter = () => {
|
1146 | console.warn('Write operation failed: computed value is readonly');
|
1147 | }
|
1148 | ;
|
1149 | }
|
1150 | else {
|
1151 | getter = getterOrOptions.get;
|
1152 | setter = getterOrOptions.set;
|
1153 | }
|
1154 | return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
|
1155 | }
|
1156 |
|
1157 | const stack = [];
|
1158 | function pushWarningContext(vnode) {
|
1159 | stack.push(vnode);
|
1160 | }
|
1161 | function popWarningContext() {
|
1162 | stack.pop();
|
1163 | }
|
1164 | function warn(msg, ...args) {
|
1165 |
|
1166 |
|
1167 | pauseTracking();
|
1168 | const instance = stack.length ? stack[stack.length - 1].component : null;
|
1169 | const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
1170 | const trace = getComponentTrace();
|
1171 | if (appWarnHandler) {
|
1172 | callWithErrorHandling(appWarnHandler, instance, 11 , [
|
1173 | msg + args.join(''),
|
1174 | instance && instance.proxy,
|
1175 | trace
|
1176 | .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
|
1177 | .join('\n'),
|
1178 | trace
|
1179 | ]);
|
1180 | }
|
1181 | else {
|
1182 | const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
1183 |
|
1184 | if (trace.length &&
|
1185 |
|
1186 | !false) {
|
1187 | warnArgs.push(`\n`, ...formatTrace(trace));
|
1188 | }
|
1189 | console.warn(...warnArgs);
|
1190 | }
|
1191 | resetTracking();
|
1192 | }
|
1193 | function getComponentTrace() {
|
1194 | let currentVNode = stack[stack.length - 1];
|
1195 | if (!currentVNode) {
|
1196 | return [];
|
1197 | }
|
1198 |
|
1199 |
|
1200 |
|
1201 | const normalizedStack = [];
|
1202 | while (currentVNode) {
|
1203 | const last = normalizedStack[0];
|
1204 | if (last && last.vnode === currentVNode) {
|
1205 | last.recurseCount++;
|
1206 | }
|
1207 | else {
|
1208 | normalizedStack.push({
|
1209 | vnode: currentVNode,
|
1210 | recurseCount: 0
|
1211 | });
|
1212 | }
|
1213 | const parentInstance = currentVNode.component && currentVNode.component.parent;
|
1214 | currentVNode = parentInstance && parentInstance.vnode;
|
1215 | }
|
1216 | return normalizedStack;
|
1217 | }
|
1218 |
|
1219 | function formatTrace(trace) {
|
1220 | const logs = [];
|
1221 | trace.forEach((entry, i) => {
|
1222 | logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
|
1223 | });
|
1224 | return logs;
|
1225 | }
|
1226 | function formatTraceEntry({ vnode, recurseCount }) {
|
1227 | const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
1228 | const isRoot = vnode.component ? vnode.component.parent == null : false;
|
1229 | const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
1230 | const close = `>` + postfix;
|
1231 | return vnode.props
|
1232 | ? [open, ...formatProps(vnode.props), close]
|
1233 | : [open + close];
|
1234 | }
|
1235 |
|
1236 | function formatProps(props) {
|
1237 | const res = [];
|
1238 | const keys = Object.keys(props);
|
1239 | keys.slice(0, 3).forEach(key => {
|
1240 | res.push(...formatProp(key, props[key]));
|
1241 | });
|
1242 | if (keys.length > 3) {
|
1243 | res.push(` ...`);
|
1244 | }
|
1245 | return res;
|
1246 | }
|
1247 |
|
1248 | function formatProp(key, value, raw) {
|
1249 | if (isString(value)) {
|
1250 | value = JSON.stringify(value);
|
1251 | return raw ? value : [`${key}=${value}`];
|
1252 | }
|
1253 | else if (typeof value === 'number' ||
|
1254 | typeof value === 'boolean' ||
|
1255 | value == null) {
|
1256 | return raw ? value : [`${key}=${value}`];
|
1257 | }
|
1258 | else if (isRef(value)) {
|
1259 | value = formatProp(key, toRaw(value.value), true);
|
1260 | return raw ? value : [`${key}=Ref<`, value, `>`];
|
1261 | }
|
1262 | else if (isFunction(value)) {
|
1263 | return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
1264 | }
|
1265 | else {
|
1266 | value = toRaw(value);
|
1267 | return raw ? value : [`${key}=`, value];
|
1268 | }
|
1269 | }
|
1270 |
|
1271 | const ErrorTypeStrings = {
|
1272 | ["bc" ]: 'beforeCreate hook',
|
1273 | ["c" ]: 'created hook',
|
1274 | ["bm" ]: 'beforeMount hook',
|
1275 | ["m" ]: 'mounted hook',
|
1276 | ["bu" ]: 'beforeUpdate hook',
|
1277 | ["u" ]: 'updated',
|
1278 | ["bum" ]: 'beforeUnmount hook',
|
1279 | ["um" ]: 'unmounted hook',
|
1280 | ["a" ]: 'activated hook',
|
1281 | ["da" ]: 'deactivated hook',
|
1282 | ["ec" ]: 'errorCaptured hook',
|
1283 | ["rtc" ]: 'renderTracked hook',
|
1284 | ["rtg" ]: 'renderTriggered hook',
|
1285 | [0 ]: 'setup function',
|
1286 | [1 ]: 'render function',
|
1287 | [2 ]: 'watcher getter',
|
1288 | [3 ]: 'watcher callback',
|
1289 | [4 ]: 'watcher cleanup function',
|
1290 | [5 ]: 'native event handler',
|
1291 | [6 ]: 'component event handler',
|
1292 | [7 ]: 'vnode hook',
|
1293 | [8 ]: 'directive hook',
|
1294 | [9 ]: 'transition hook',
|
1295 | [10 ]: 'app errorHandler',
|
1296 | [11 ]: 'app warnHandler',
|
1297 | [12 ]: 'ref function',
|
1298 | [13 ]: 'async component loader',
|
1299 | [14 ]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
1300 | 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
|
1301 | };
|
1302 | function callWithErrorHandling(fn, instance, type, args) {
|
1303 | let res;
|
1304 | try {
|
1305 | res = args ? fn(...args) : fn();
|
1306 | }
|
1307 | catch (err) {
|
1308 | handleError(err, instance, type);
|
1309 | }
|
1310 | return res;
|
1311 | }
|
1312 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
1313 | if (isFunction(fn)) {
|
1314 | const res = callWithErrorHandling(fn, instance, type, args);
|
1315 | if (res && isPromise(res)) {
|
1316 | res.catch(err => {
|
1317 | handleError(err, instance, type);
|
1318 | });
|
1319 | }
|
1320 | return res;
|
1321 | }
|
1322 | const values = [];
|
1323 | for (let i = 0; i < fn.length; i++) {
|
1324 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
1325 | }
|
1326 | return values;
|
1327 | }
|
1328 | function handleError(err, instance, type, throwInDev = true) {
|
1329 | const contextVNode = instance ? instance.vnode : null;
|
1330 | if (instance) {
|
1331 | let cur = instance.parent;
|
1332 |
|
1333 | const exposedInstance = instance.proxy;
|
1334 |
|
1335 | const errorInfo = ErrorTypeStrings[type] ;
|
1336 | while (cur) {
|
1337 | const errorCapturedHooks = cur.ec;
|
1338 | if (errorCapturedHooks) {
|
1339 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
1340 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
1341 | return;
|
1342 | }
|
1343 | }
|
1344 | }
|
1345 | cur = cur.parent;
|
1346 | }
|
1347 |
|
1348 | const appErrorHandler = instance.appContext.config.errorHandler;
|
1349 | if (appErrorHandler) {
|
1350 | callWithErrorHandling(appErrorHandler, null, 10 , [err, exposedInstance, errorInfo]);
|
1351 | return;
|
1352 | }
|
1353 | }
|
1354 | logError(err, type, contextVNode, throwInDev);
|
1355 | }
|
1356 | function logError(err, type, contextVNode, throwInDev = true) {
|
1357 | {
|
1358 | const info = ErrorTypeStrings[type];
|
1359 | if (contextVNode) {
|
1360 | pushWarningContext(contextVNode);
|
1361 | }
|
1362 | warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
1363 | if (contextVNode) {
|
1364 | popWarningContext();
|
1365 | }
|
1366 |
|
1367 | if (throwInDev) {
|
1368 | throw err;
|
1369 | }
|
1370 | else {
|
1371 | console.error(err);
|
1372 | }
|
1373 | }
|
1374 | }
|
1375 |
|
1376 | let isFlushing = false;
|
1377 | let isFlushPending = false;
|
1378 | const queue = [];
|
1379 | let flushIndex = 0;
|
1380 | const pendingPreFlushCbs = [];
|
1381 | let activePreFlushCbs = null;
|
1382 | let preFlushIndex = 0;
|
1383 | const pendingPostFlushCbs = [];
|
1384 | let activePostFlushCbs = null;
|
1385 | let postFlushIndex = 0;
|
1386 | const resolvedPromise = Promise.resolve();
|
1387 | let currentFlushPromise = null;
|
1388 | let currentPreFlushParentJob = null;
|
1389 | const RECURSION_LIMIT = 100;
|
1390 | function nextTick(fn) {
|
1391 | const p = currentFlushPromise || resolvedPromise;
|
1392 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
1393 | }
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 | function findInsertionIndex(job) {
|
1399 |
|
1400 | let start = flushIndex + 1;
|
1401 | let end = queue.length;
|
1402 | const jobId = getId(job);
|
1403 | while (start < end) {
|
1404 | const middle = (start + end) >>> 1;
|
1405 | const middleJobId = getId(queue[middle]);
|
1406 | middleJobId < jobId ? (start = middle + 1) : (end = middle);
|
1407 | }
|
1408 | return start;
|
1409 | }
|
1410 | function queueJob(job) {
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 | if ((!queue.length ||
|
1418 | !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
|
1419 | job !== currentPreFlushParentJob) {
|
1420 | const pos = findInsertionIndex(job);
|
1421 | if (pos > -1) {
|
1422 | queue.splice(pos, 0, job);
|
1423 | }
|
1424 | else {
|
1425 | queue.push(job);
|
1426 | }
|
1427 | queueFlush();
|
1428 | }
|
1429 | }
|
1430 | function queueFlush() {
|
1431 | if (!isFlushing && !isFlushPending) {
|
1432 | isFlushPending = true;
|
1433 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
1434 | }
|
1435 | }
|
1436 | function invalidateJob(job) {
|
1437 | const i = queue.indexOf(job);
|
1438 | if (i > -1) {
|
1439 | queue.splice(i, 1);
|
1440 | }
|
1441 | }
|
1442 | function queueCb(cb, activeQueue, pendingQueue, index) {
|
1443 | if (!isArray(cb)) {
|
1444 | if (!activeQueue ||
|
1445 | !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
|
1446 | pendingQueue.push(cb);
|
1447 | }
|
1448 | }
|
1449 | else {
|
1450 |
|
1451 |
|
1452 |
|
1453 | pendingQueue.push(...cb);
|
1454 | }
|
1455 | queueFlush();
|
1456 | }
|
1457 | function queuePreFlushCb(cb) {
|
1458 | queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
|
1459 | }
|
1460 | function queuePostFlushCb(cb) {
|
1461 | queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
|
1462 | }
|
1463 | function flushPreFlushCbs(seen, parentJob = null) {
|
1464 | if (pendingPreFlushCbs.length) {
|
1465 | currentPreFlushParentJob = parentJob;
|
1466 | activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
1467 | pendingPreFlushCbs.length = 0;
|
1468 | {
|
1469 | seen = seen || new Map();
|
1470 | }
|
1471 | for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
1472 | {
|
1473 | checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex]);
|
1474 | }
|
1475 | activePreFlushCbs[preFlushIndex]();
|
1476 | }
|
1477 | activePreFlushCbs = null;
|
1478 | preFlushIndex = 0;
|
1479 | currentPreFlushParentJob = null;
|
1480 |
|
1481 | flushPreFlushCbs(seen, parentJob);
|
1482 | }
|
1483 | }
|
1484 | function flushPostFlushCbs(seen) {
|
1485 | if (pendingPostFlushCbs.length) {
|
1486 | const deduped = [...new Set(pendingPostFlushCbs)];
|
1487 | pendingPostFlushCbs.length = 0;
|
1488 |
|
1489 | if (activePostFlushCbs) {
|
1490 | activePostFlushCbs.push(...deduped);
|
1491 | return;
|
1492 | }
|
1493 | activePostFlushCbs = deduped;
|
1494 | {
|
1495 | seen = seen || new Map();
|
1496 | }
|
1497 | activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
|
1498 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
1499 | {
|
1500 | checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex]);
|
1501 | }
|
1502 | activePostFlushCbs[postFlushIndex]();
|
1503 | }
|
1504 | activePostFlushCbs = null;
|
1505 | postFlushIndex = 0;
|
1506 | }
|
1507 | }
|
1508 | const getId = (job) => job.id == null ? Infinity : job.id;
|
1509 | function flushJobs(seen) {
|
1510 | isFlushPending = false;
|
1511 | isFlushing = true;
|
1512 | {
|
1513 | seen = seen || new Map();
|
1514 | }
|
1515 | flushPreFlushCbs(seen);
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 | queue.sort((a, b) => getId(a) - getId(b));
|
1524 | try {
|
1525 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
1526 | const job = queue[flushIndex];
|
1527 | if (job) {
|
1528 | if (true) {
|
1529 | checkRecursiveUpdates(seen, job);
|
1530 | }
|
1531 | callWithErrorHandling(job, null, 14 );
|
1532 | }
|
1533 | }
|
1534 | }
|
1535 | finally {
|
1536 | flushIndex = 0;
|
1537 | queue.length = 0;
|
1538 | flushPostFlushCbs(seen);
|
1539 | isFlushing = false;
|
1540 | currentFlushPromise = null;
|
1541 |
|
1542 |
|
1543 | if (queue.length || pendingPostFlushCbs.length) {
|
1544 | flushJobs(seen);
|
1545 | }
|
1546 | }
|
1547 | }
|
1548 | function checkRecursiveUpdates(seen, fn) {
|
1549 | if (!seen.has(fn)) {
|
1550 | seen.set(fn, 1);
|
1551 | }
|
1552 | else {
|
1553 | const count = seen.get(fn);
|
1554 | if (count > RECURSION_LIMIT) {
|
1555 | throw new Error(`Maximum recursive updates exceeded. ` +
|
1556 | `This means you have a reactive effect that is mutating its own ` +
|
1557 | `dependencies and thus recursively triggering itself. Possible sources ` +
|
1558 | `include component template, render function, updated hook or ` +
|
1559 | `watcher source function.`);
|
1560 | }
|
1561 | else {
|
1562 | seen.set(fn, count + 1);
|
1563 | }
|
1564 | }
|
1565 | }
|
1566 |
|
1567 |
|
1568 | let isHmrUpdating = false;
|
1569 | const hmrDirtyComponents = new Set();
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 | {
|
1576 | const globalObject = typeof global !== 'undefined'
|
1577 | ? global
|
1578 | : typeof self !== 'undefined'
|
1579 | ? self
|
1580 | : typeof window !== 'undefined'
|
1581 | ? window
|
1582 | : {};
|
1583 | globalObject.__VUE_HMR_RUNTIME__ = {
|
1584 | createRecord: tryWrap(createRecord),
|
1585 | rerender: tryWrap(rerender),
|
1586 | reload: tryWrap(reload)
|
1587 | };
|
1588 | }
|
1589 | const map = new Map();
|
1590 | function registerHMR(instance) {
|
1591 | const id = instance.type.__hmrId;
|
1592 | let record = map.get(id);
|
1593 | if (!record) {
|
1594 | createRecord(id, instance.type);
|
1595 | record = map.get(id);
|
1596 | }
|
1597 | record.instances.add(instance);
|
1598 | }
|
1599 | function unregisterHMR(instance) {
|
1600 | map.get(instance.type.__hmrId).instances.delete(instance);
|
1601 | }
|
1602 | function createRecord(id, component) {
|
1603 | if (!component) {
|
1604 | warn(`HMR API usage is out of date.\n` +
|
1605 | `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
|
1606 | `dependency that handles Vue SFC compilation.`);
|
1607 | component = {};
|
1608 | }
|
1609 | if (map.has(id)) {
|
1610 | return false;
|
1611 | }
|
1612 | map.set(id, {
|
1613 | component: isClassComponent(component) ? component.__vccOpts : component,
|
1614 | instances: new Set()
|
1615 | });
|
1616 | return true;
|
1617 | }
|
1618 | function rerender(id, newRender) {
|
1619 | const record = map.get(id);
|
1620 | if (!record)
|
1621 | return;
|
1622 | if (newRender)
|
1623 | record.component.render = newRender;
|
1624 |
|
1625 |
|
1626 | Array.from(record.instances).forEach(instance => {
|
1627 | if (newRender) {
|
1628 | instance.render = newRender;
|
1629 | }
|
1630 | instance.renderCache = [];
|
1631 |
|
1632 | isHmrUpdating = true;
|
1633 | instance.update();
|
1634 | isHmrUpdating = false;
|
1635 | });
|
1636 | }
|
1637 | function reload(id, newComp) {
|
1638 | const record = map.get(id);
|
1639 | if (!record)
|
1640 | return;
|
1641 |
|
1642 |
|
1643 | const { component, instances } = record;
|
1644 | if (!hmrDirtyComponents.has(component)) {
|
1645 |
|
1646 | newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
|
1647 | extend(component, newComp);
|
1648 | for (const key in component) {
|
1649 | if (!(key in newComp)) {
|
1650 | delete component[key];
|
1651 | }
|
1652 | }
|
1653 |
|
1654 |
|
1655 | hmrDirtyComponents.add(component);
|
1656 |
|
1657 | queuePostFlushCb(() => {
|
1658 | hmrDirtyComponents.delete(component);
|
1659 | });
|
1660 | }
|
1661 | Array.from(instances).forEach(instance => {
|
1662 | if (instance.parent) {
|
1663 |
|
1664 |
|
1665 |
|
1666 | queueJob(instance.parent.update);
|
1667 | }
|
1668 | else if (instance.appContext.reload) {
|
1669 |
|
1670 | instance.appContext.reload();
|
1671 | }
|
1672 | else if (typeof window !== 'undefined') {
|
1673 |
|
1674 | window.location.reload();
|
1675 | }
|
1676 | else {
|
1677 | console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
|
1678 | }
|
1679 | });
|
1680 | }
|
1681 | function tryWrap(fn) {
|
1682 | return (id, arg) => {
|
1683 | try {
|
1684 | return fn(id, arg);
|
1685 | }
|
1686 | catch (e) {
|
1687 | console.error(e);
|
1688 | console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +
|
1689 | `Full reload required.`);
|
1690 | }
|
1691 | };
|
1692 | }
|
1693 |
|
1694 | function setDevtoolsHook(hook) {
|
1695 | exports.devtools = hook;
|
1696 | }
|
1697 | function devtoolsInitApp(app, version) {
|
1698 |
|
1699 | if (!exports.devtools)
|
1700 | return;
|
1701 | exports.devtools.emit("app:init" , app, version, {
|
1702 | Fragment,
|
1703 | Text,
|
1704 | Comment,
|
1705 | Static
|
1706 | });
|
1707 | }
|
1708 | function devtoolsUnmountApp(app) {
|
1709 | if (!exports.devtools)
|
1710 | return;
|
1711 | exports.devtools.emit("app:unmount" , app);
|
1712 | }
|
1713 | const devtoolsComponentAdded = createDevtoolsComponentHook("component:added" );
|
1714 | const devtoolsComponentUpdated = createDevtoolsComponentHook("component:updated" );
|
1715 | const devtoolsComponentRemoved = createDevtoolsComponentHook("component:removed" );
|
1716 | function createDevtoolsComponentHook(hook) {
|
1717 | return (component) => {
|
1718 | if (!exports.devtools)
|
1719 | return;
|
1720 | exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
1721 | };
|
1722 | }
|
1723 | function devtoolsComponentEmit(component, event, params) {
|
1724 | if (!exports.devtools)
|
1725 | return;
|
1726 | exports.devtools.emit("component:emit" , component.appContext.app, component, event, params);
|
1727 | }
|
1728 |
|
1729 | function emit(instance, event, ...rawArgs) {
|
1730 | const props = instance.vnode.props || EMPTY_OBJ;
|
1731 | {
|
1732 | const { emitsOptions, propsOptions: [propsOptions] } = instance;
|
1733 | if (emitsOptions) {
|
1734 | if (!(event in emitsOptions)) {
|
1735 | if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
1736 | warn(`Component emitted event "${event}" but it is neither declared in ` +
|
1737 | `the emits option nor as an "${toHandlerKey(event)}" prop.`);
|
1738 | }
|
1739 | }
|
1740 | else {
|
1741 | const validator = emitsOptions[event];
|
1742 | if (isFunction(validator)) {
|
1743 | const isValid = validator(...rawArgs);
|
1744 | if (!isValid) {
|
1745 | warn(`Invalid event arguments: event validation failed for event "${event}".`);
|
1746 | }
|
1747 | }
|
1748 | }
|
1749 | }
|
1750 | }
|
1751 | let args = rawArgs;
|
1752 | const isModelListener = event.startsWith('update:');
|
1753 |
|
1754 | const modelArg = isModelListener && event.slice(7);
|
1755 | if (modelArg && modelArg in props) {
|
1756 | const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
|
1757 | const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
|
1758 | if (trim) {
|
1759 | args = rawArgs.map(a => a.trim());
|
1760 | }
|
1761 | else if (number) {
|
1762 | args = rawArgs.map(toNumber);
|
1763 | }
|
1764 | }
|
1765 | {
|
1766 | devtoolsComponentEmit(instance, event, args);
|
1767 | }
|
1768 | {
|
1769 | const lowerCaseEvent = event.toLowerCase();
|
1770 | if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
1771 | warn(`Event "${lowerCaseEvent}" is emitted in component ` +
|
1772 | `${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". ` +
|
1773 | `Note that HTML attributes are case-insensitive and you cannot use ` +
|
1774 | `v-on to listen to camelCase events when using in-DOM templates. ` +
|
1775 | `You should probably use "${hyphenate(event)}" instead of "${event}".`);
|
1776 | }
|
1777 | }
|
1778 |
|
1779 | let handlerName = toHandlerKey(camelize(event));
|
1780 | let handler = props[handlerName];
|
1781 |
|
1782 |
|
1783 | if (!handler && isModelListener) {
|
1784 | handlerName = toHandlerKey(hyphenate(event));
|
1785 | handler = props[handlerName];
|
1786 | }
|
1787 | if (handler) {
|
1788 | callWithAsyncErrorHandling(handler, instance, 6 , args);
|
1789 | }
|
1790 | const onceHandler = props[handlerName + `Once`];
|
1791 | if (onceHandler) {
|
1792 | if (!instance.emitted) {
|
1793 | (instance.emitted = {})[handlerName] = true;
|
1794 | }
|
1795 | else if (instance.emitted[handlerName]) {
|
1796 | return;
|
1797 | }
|
1798 | callWithAsyncErrorHandling(onceHandler, instance, 6 , args);
|
1799 | }
|
1800 | }
|
1801 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
1802 | if (!appContext.deopt && comp.__emits !== undefined) {
|
1803 | return comp.__emits;
|
1804 | }
|
1805 | const raw = comp.emits;
|
1806 | let normalized = {};
|
1807 |
|
1808 | let hasExtends = false;
|
1809 | if (!isFunction(comp)) {
|
1810 | const extendEmits = (raw) => {
|
1811 | hasExtends = true;
|
1812 | extend(normalized, normalizeEmitsOptions(raw, appContext, true));
|
1813 | };
|
1814 | if (!asMixin && appContext.mixins.length) {
|
1815 | appContext.mixins.forEach(extendEmits);
|
1816 | }
|
1817 | if (comp.extends) {
|
1818 | extendEmits(comp.extends);
|
1819 | }
|
1820 | if (comp.mixins) {
|
1821 | comp.mixins.forEach(extendEmits);
|
1822 | }
|
1823 | }
|
1824 | if (!raw && !hasExtends) {
|
1825 | return (comp.__emits = null);
|
1826 | }
|
1827 | if (isArray(raw)) {
|
1828 | raw.forEach(key => (normalized[key] = null));
|
1829 | }
|
1830 | else {
|
1831 | extend(normalized, raw);
|
1832 | }
|
1833 | return (comp.__emits = normalized);
|
1834 | }
|
1835 |
|
1836 |
|
1837 |
|
1838 | function isEmitListener(options, key) {
|
1839 | if (!options || !isOn(key)) {
|
1840 | return false;
|
1841 | }
|
1842 | key = key.slice(2).replace(/Once$/, '');
|
1843 | return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
|
1844 | hasOwn(options, hyphenate(key)) ||
|
1845 | hasOwn(options, key));
|
1846 | }
|
1847 |
|
1848 | |
1849 |
|
1850 |
|
1851 |
|
1852 | let currentRenderingInstance = null;
|
1853 | function setCurrentRenderingInstance(instance) {
|
1854 | currentRenderingInstance = instance;
|
1855 | }
|
1856 | |
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 | let accessedAttrs = false;
|
1862 | function markAttrsAccessed() {
|
1863 | accessedAttrs = true;
|
1864 | }
|
1865 | function renderComponentRoot(instance) {
|
1866 | const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;
|
1867 | let result;
|
1868 | currentRenderingInstance = instance;
|
1869 | {
|
1870 | accessedAttrs = false;
|
1871 | }
|
1872 | try {
|
1873 | let fallthroughAttrs;
|
1874 | if (vnode.shapeFlag & 4 ) {
|
1875 |
|
1876 |
|
1877 | const proxyToUse = withProxy || proxy;
|
1878 | result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
|
1879 | fallthroughAttrs = attrs;
|
1880 | }
|
1881 | else {
|
1882 |
|
1883 | const render = Component;
|
1884 |
|
1885 | if (true && attrs === props) {
|
1886 | markAttrsAccessed();
|
1887 | }
|
1888 | result = normalizeVNode(render.length > 1
|
1889 | ? render(props, true
|
1890 | ? {
|
1891 | get attrs() {
|
1892 | markAttrsAccessed();
|
1893 | return attrs;
|
1894 | },
|
1895 | slots,
|
1896 | emit
|
1897 | }
|
1898 | : { attrs, slots, emit })
|
1899 | : render(props, null ));
|
1900 | fallthroughAttrs = Component.props
|
1901 | ? attrs
|
1902 | : getFunctionalFallthrough(attrs);
|
1903 | }
|
1904 |
|
1905 |
|
1906 |
|
1907 | let root = result;
|
1908 | let setRoot = undefined;
|
1909 | if (true &&
|
1910 | result.patchFlag > 0 &&
|
1911 | result.patchFlag & 2048 ) {
|
1912 | ;
|
1913 | [root, setRoot] = getChildRoot(result);
|
1914 | }
|
1915 | if (Component.inheritAttrs !== false && fallthroughAttrs) {
|
1916 | const keys = Object.keys(fallthroughAttrs);
|
1917 | const { shapeFlag } = root;
|
1918 | if (keys.length) {
|
1919 | if (shapeFlag & 1 ||
|
1920 | shapeFlag & 6 ) {
|
1921 | if (propsOptions && keys.some(isModelListener)) {
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 | fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
1927 | }
|
1928 | root = cloneVNode(root, fallthroughAttrs);
|
1929 | }
|
1930 | else if (true && !accessedAttrs && root.type !== Comment) {
|
1931 | const allAttrs = Object.keys(attrs);
|
1932 | const eventAttrs = [];
|
1933 | const extraAttrs = [];
|
1934 | for (let i = 0, l = allAttrs.length; i < l; i++) {
|
1935 | const key = allAttrs[i];
|
1936 | if (isOn(key)) {
|
1937 |
|
1938 | if (!isModelListener(key)) {
|
1939 |
|
1940 |
|
1941 | eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
1942 | }
|
1943 | }
|
1944 | else {
|
1945 | extraAttrs.push(key);
|
1946 | }
|
1947 | }
|
1948 | if (extraAttrs.length) {
|
1949 | warn(`Extraneous non-props attributes (` +
|
1950 | `${extraAttrs.join(', ')}) ` +
|
1951 | `were passed to component but could not be automatically inherited ` +
|
1952 | `because component renders fragment or text root nodes.`);
|
1953 | }
|
1954 | if (eventAttrs.length) {
|
1955 | warn(`Extraneous non-emits event listeners (` +
|
1956 | `${eventAttrs.join(', ')}) ` +
|
1957 | `were passed to component but could not be automatically inherited ` +
|
1958 | `because component renders fragment or text root nodes. ` +
|
1959 | `If the listener is intended to be a component custom event listener only, ` +
|
1960 | `declare it using the "emits" option.`);
|
1961 | }
|
1962 | }
|
1963 | }
|
1964 | }
|
1965 |
|
1966 | if (vnode.dirs) {
|
1967 | if (true && !isElementRoot(root)) {
|
1968 | warn(`Runtime directive used on component with non-element root node. ` +
|
1969 | `The directives will not function as intended.`);
|
1970 | }
|
1971 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
1972 | }
|
1973 |
|
1974 | if (vnode.transition) {
|
1975 | if (true && !isElementRoot(root)) {
|
1976 | warn(`Component inside <Transition> renders non-element root node ` +
|
1977 | `that cannot be animated.`);
|
1978 | }
|
1979 | root.transition = vnode.transition;
|
1980 | }
|
1981 | if (true && setRoot) {
|
1982 | setRoot(root);
|
1983 | }
|
1984 | else {
|
1985 | result = root;
|
1986 | }
|
1987 | }
|
1988 | catch (err) {
|
1989 | handleError(err, instance, 1 );
|
1990 | result = createVNode(Comment);
|
1991 | }
|
1992 | currentRenderingInstance = null;
|
1993 | return result;
|
1994 | }
|
1995 | |
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 | const getChildRoot = (vnode) => {
|
2002 | const rawChildren = vnode.children;
|
2003 | const dynamicChildren = vnode.dynamicChildren;
|
2004 | const childRoot = filterSingleRoot(rawChildren);
|
2005 | if (!childRoot) {
|
2006 | return [vnode, undefined];
|
2007 | }
|
2008 | const index = rawChildren.indexOf(childRoot);
|
2009 | const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
2010 | const setRoot = (updatedRoot) => {
|
2011 | rawChildren[index] = updatedRoot;
|
2012 | if (dynamicChildren) {
|
2013 | if (dynamicIndex > -1) {
|
2014 | dynamicChildren[dynamicIndex] = updatedRoot;
|
2015 | }
|
2016 | else if (updatedRoot.patchFlag > 0) {
|
2017 | vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
2018 | }
|
2019 | }
|
2020 | };
|
2021 | return [normalizeVNode(childRoot), setRoot];
|
2022 | };
|
2023 | function filterSingleRoot(children) {
|
2024 | let singleRoot;
|
2025 | for (let i = 0; i < children.length; i++) {
|
2026 | const child = children[i];
|
2027 | if (isVNode(child)) {
|
2028 |
|
2029 | if (child.type !== Comment || child.children === 'v-if') {
|
2030 | if (singleRoot) {
|
2031 |
|
2032 | return;
|
2033 | }
|
2034 | else {
|
2035 | singleRoot = child;
|
2036 | }
|
2037 | }
|
2038 | }
|
2039 | else {
|
2040 | return;
|
2041 | }
|
2042 | }
|
2043 | return singleRoot;
|
2044 | }
|
2045 | const getFunctionalFallthrough = (attrs) => {
|
2046 | let res;
|
2047 | for (const key in attrs) {
|
2048 | if (key === 'class' || key === 'style' || isOn(key)) {
|
2049 | (res || (res = {}))[key] = attrs[key];
|
2050 | }
|
2051 | }
|
2052 | return res;
|
2053 | };
|
2054 | const filterModelListeners = (attrs, props) => {
|
2055 | const res = {};
|
2056 | for (const key in attrs) {
|
2057 | if (!isModelListener(key) || !(key.slice(9) in props)) {
|
2058 | res[key] = attrs[key];
|
2059 | }
|
2060 | }
|
2061 | return res;
|
2062 | };
|
2063 | const isElementRoot = (vnode) => {
|
2064 | return (vnode.shapeFlag & 6 ||
|
2065 | vnode.shapeFlag & 1 ||
|
2066 | vnode.type === Comment
|
2067 | );
|
2068 | };
|
2069 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
2070 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
2071 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
2072 | const emits = component.emitsOptions;
|
2073 |
|
2074 |
|
2075 |
|
2076 | if ((prevChildren || nextChildren) && isHmrUpdating) {
|
2077 | return true;
|
2078 | }
|
2079 |
|
2080 | if (nextVNode.dirs || nextVNode.transition) {
|
2081 | return true;
|
2082 | }
|
2083 | if (optimized && patchFlag >= 0) {
|
2084 | if (patchFlag & 1024 ) {
|
2085 |
|
2086 |
|
2087 | return true;
|
2088 | }
|
2089 | if (patchFlag & 16 ) {
|
2090 | if (!prevProps) {
|
2091 | return !!nextProps;
|
2092 | }
|
2093 |
|
2094 | return hasPropsChanged(prevProps, nextProps, emits);
|
2095 | }
|
2096 | else if (patchFlag & 8 ) {
|
2097 | const dynamicProps = nextVNode.dynamicProps;
|
2098 | for (let i = 0; i < dynamicProps.length; i++) {
|
2099 | const key = dynamicProps[i];
|
2100 | if (nextProps[key] !== prevProps[key] &&
|
2101 | !isEmitListener(emits, key)) {
|
2102 | return true;
|
2103 | }
|
2104 | }
|
2105 | }
|
2106 | }
|
2107 | else {
|
2108 |
|
2109 |
|
2110 | if (prevChildren || nextChildren) {
|
2111 | if (!nextChildren || !nextChildren.$stable) {
|
2112 | return true;
|
2113 | }
|
2114 | }
|
2115 | if (prevProps === nextProps) {
|
2116 | return false;
|
2117 | }
|
2118 | if (!prevProps) {
|
2119 | return !!nextProps;
|
2120 | }
|
2121 | if (!nextProps) {
|
2122 | return true;
|
2123 | }
|
2124 | return hasPropsChanged(prevProps, nextProps, emits);
|
2125 | }
|
2126 | return false;
|
2127 | }
|
2128 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
2129 | const nextKeys = Object.keys(nextProps);
|
2130 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
2131 | return true;
|
2132 | }
|
2133 | for (let i = 0; i < nextKeys.length; i++) {
|
2134 | const key = nextKeys[i];
|
2135 | if (nextProps[key] !== prevProps[key] &&
|
2136 | !isEmitListener(emitsOptions, key)) {
|
2137 | return true;
|
2138 | }
|
2139 | }
|
2140 | return false;
|
2141 | }
|
2142 | function updateHOCHostEl({ vnode, parent }, el // HostNode
|
2143 | ) {
|
2144 | while (parent && parent.subTree === vnode) {
|
2145 | (vnode = parent.vnode).el = el;
|
2146 | parent = parent.parent;
|
2147 | }
|
2148 | }
|
2149 |
|
2150 | const isSuspense = (type) => type.__isSuspense;
|
2151 |
|
2152 |
|
2153 |
|
2154 | const SuspenseImpl = {
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 | __isSuspense: true,
|
2160 | process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized,
|
2161 |
|
2162 | rendererInternals) {
|
2163 | if (n1 == null) {
|
2164 | mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals);
|
2165 | }
|
2166 | else {
|
2167 | patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, rendererInternals);
|
2168 | }
|
2169 | },
|
2170 | hydrate: hydrateSuspense,
|
2171 | create: createSuspenseBoundary
|
2172 | };
|
2173 |
|
2174 | const Suspense = (SuspenseImpl
|
2175 | );
|
2176 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals) {
|
2177 | const { p: patch, o: { createElement } } = rendererInternals;
|
2178 | const hiddenContainer = createElement('div');
|
2179 | const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals));
|
2180 |
|
2181 | patch(null, (suspense.pendingBranch = vnode.ssContent), hiddenContainer, null, parentComponent, suspense, isSVG);
|
2182 |
|
2183 | if (suspense.deps > 0) {
|
2184 |
|
2185 |
|
2186 | patch(null, vnode.ssFallback, container, anchor, parentComponent, null,
|
2187 | isSVG);
|
2188 | setActiveBranch(suspense, vnode.ssFallback);
|
2189 | }
|
2190 | else {
|
2191 |
|
2192 | suspense.resolve();
|
2193 | }
|
2194 | }
|
2195 | function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, { p: patch, um: unmount, o: { createElement } }) {
|
2196 | const suspense = (n2.suspense = n1.suspense);
|
2197 | suspense.vnode = n2;
|
2198 | n2.el = n1.el;
|
2199 | const newBranch = n2.ssContent;
|
2200 | const newFallback = n2.ssFallback;
|
2201 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
2202 | if (pendingBranch) {
|
2203 | suspense.pendingBranch = newBranch;
|
2204 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
2205 |
|
2206 | patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
|
2207 | if (suspense.deps <= 0) {
|
2208 | suspense.resolve();
|
2209 | }
|
2210 | else if (isInFallback) {
|
2211 | patch(activeBranch, newFallback, container, anchor, parentComponent, null,
|
2212 | isSVG);
|
2213 | setActiveBranch(suspense, newFallback);
|
2214 | }
|
2215 | }
|
2216 | else {
|
2217 |
|
2218 | suspense.pendingId++;
|
2219 | if (isHydrating) {
|
2220 |
|
2221 |
|
2222 |
|
2223 | suspense.isHydrating = false;
|
2224 | suspense.activeBranch = pendingBranch;
|
2225 | }
|
2226 | else {
|
2227 | unmount(pendingBranch, parentComponent, suspense);
|
2228 | }
|
2229 |
|
2230 |
|
2231 | suspense.deps = 0;
|
2232 |
|
2233 | suspense.effects.length = 0;
|
2234 |
|
2235 | suspense.hiddenContainer = createElement('div');
|
2236 | if (isInFallback) {
|
2237 |
|
2238 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
|
2239 | if (suspense.deps <= 0) {
|
2240 | suspense.resolve();
|
2241 | }
|
2242 | else {
|
2243 | patch(activeBranch, newFallback, container, anchor, parentComponent, null,
|
2244 | isSVG);
|
2245 | setActiveBranch(suspense, newFallback);
|
2246 | }
|
2247 | }
|
2248 | else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2249 |
|
2250 | patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);
|
2251 |
|
2252 | suspense.resolve(true);
|
2253 | }
|
2254 | else {
|
2255 |
|
2256 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
|
2257 | if (suspense.deps <= 0) {
|
2258 | suspense.resolve();
|
2259 | }
|
2260 | }
|
2261 | }
|
2262 | }
|
2263 | else {
|
2264 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2265 |
|
2266 | patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);
|
2267 | setActiveBranch(suspense, newBranch);
|
2268 | }
|
2269 | else {
|
2270 |
|
2271 |
|
2272 | const onPending = n2.props && n2.props.onPending;
|
2273 | if (isFunction(onPending)) {
|
2274 | onPending();
|
2275 | }
|
2276 |
|
2277 | suspense.pendingBranch = newBranch;
|
2278 | suspense.pendingId++;
|
2279 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
|
2280 | if (suspense.deps <= 0) {
|
2281 |
|
2282 | suspense.resolve();
|
2283 | }
|
2284 | else {
|
2285 | const { timeout, pendingId } = suspense;
|
2286 | if (timeout > 0) {
|
2287 | setTimeout(() => {
|
2288 | if (suspense.pendingId === pendingId) {
|
2289 | suspense.fallback(newFallback);
|
2290 | }
|
2291 | }, timeout);
|
2292 | }
|
2293 | else if (timeout === 0) {
|
2294 | suspense.fallback(newFallback);
|
2295 | }
|
2296 | }
|
2297 | }
|
2298 | }
|
2299 | }
|
2300 | let hasWarned = false;
|
2301 | function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals, isHydrating = false) {
|
2302 |
|
2303 | if (!hasWarned) {
|
2304 | hasWarned = true;
|
2305 |
|
2306 | console[console.info ? 'info' : 'log'](`<Suspense> is an experimental feature and its API will likely change.`);
|
2307 | }
|
2308 | const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;
|
2309 | const timeout = toNumber(vnode.props && vnode.props.timeout);
|
2310 | const suspense = {
|
2311 | vnode,
|
2312 | parent,
|
2313 | parentComponent,
|
2314 | isSVG,
|
2315 | container,
|
2316 | hiddenContainer,
|
2317 | anchor,
|
2318 | deps: 0,
|
2319 | pendingId: 0,
|
2320 | timeout: typeof timeout === 'number' ? timeout : -1,
|
2321 | activeBranch: null,
|
2322 | pendingBranch: null,
|
2323 | isInFallback: true,
|
2324 | isHydrating,
|
2325 | isUnmounted: false,
|
2326 | effects: [],
|
2327 | resolve(resume = false) {
|
2328 | {
|
2329 | if (!resume && !suspense.pendingBranch) {
|
2330 | throw new Error(`suspense.resolve() is called without a pending branch.`);
|
2331 | }
|
2332 | if (suspense.isUnmounted) {
|
2333 | throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`);
|
2334 | }
|
2335 | }
|
2336 | const { vnode, activeBranch, pendingBranch, pendingId, effects, parentComponent, container } = suspense;
|
2337 | if (suspense.isHydrating) {
|
2338 | suspense.isHydrating = false;
|
2339 | }
|
2340 | else if (!resume) {
|
2341 | const delayEnter = activeBranch &&
|
2342 | pendingBranch.transition &&
|
2343 | pendingBranch.transition.mode === 'out-in';
|
2344 | if (delayEnter) {
|
2345 | activeBranch.transition.afterLeave = () => {
|
2346 | if (pendingId === suspense.pendingId) {
|
2347 | move(pendingBranch, container, anchor, 0 );
|
2348 | }
|
2349 | };
|
2350 | }
|
2351 |
|
2352 | let { anchor } = suspense;
|
2353 |
|
2354 | if (activeBranch) {
|
2355 |
|
2356 |
|
2357 | anchor = next(activeBranch);
|
2358 | unmount(activeBranch, parentComponent, suspense, true);
|
2359 | }
|
2360 | if (!delayEnter) {
|
2361 |
|
2362 | move(pendingBranch, container, anchor, 0 );
|
2363 | }
|
2364 | }
|
2365 | setActiveBranch(suspense, pendingBranch);
|
2366 | suspense.pendingBranch = null;
|
2367 | suspense.isInFallback = false;
|
2368 |
|
2369 |
|
2370 | let parent = suspense.parent;
|
2371 | let hasUnresolvedAncestor = false;
|
2372 | while (parent) {
|
2373 | if (parent.pendingBranch) {
|
2374 |
|
2375 |
|
2376 | parent.effects.push(...effects);
|
2377 | hasUnresolvedAncestor = true;
|
2378 | break;
|
2379 | }
|
2380 | parent = parent.parent;
|
2381 | }
|
2382 |
|
2383 | if (!hasUnresolvedAncestor) {
|
2384 | queuePostFlushCb(effects);
|
2385 | }
|
2386 | suspense.effects = [];
|
2387 |
|
2388 | const onResolve = vnode.props && vnode.props.onResolve;
|
2389 | if (isFunction(onResolve)) {
|
2390 | onResolve();
|
2391 | }
|
2392 | },
|
2393 | fallback(fallbackVNode) {
|
2394 | if (!suspense.pendingBranch) {
|
2395 | return;
|
2396 | }
|
2397 | const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
|
2398 |
|
2399 | const onFallback = vnode.props && vnode.props.onFallback;
|
2400 | if (isFunction(onFallback)) {
|
2401 | onFallback();
|
2402 | }
|
2403 | const anchor = next(activeBranch);
|
2404 | const mountFallback = () => {
|
2405 | if (!suspense.isInFallback) {
|
2406 | return;
|
2407 | }
|
2408 |
|
2409 | patch(null, fallbackVNode, container, anchor, parentComponent, null,
|
2410 | isSVG);
|
2411 | setActiveBranch(suspense, fallbackVNode);
|
2412 | };
|
2413 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
|
2414 | if (delayEnter) {
|
2415 | activeBranch.transition.afterLeave = mountFallback;
|
2416 | }
|
2417 |
|
2418 | unmount(activeBranch, parentComponent, null,
|
2419 | true
|
2420 | );
|
2421 | suspense.isInFallback = true;
|
2422 | if (!delayEnter) {
|
2423 | mountFallback();
|
2424 | }
|
2425 | },
|
2426 | move(container, anchor, type) {
|
2427 | suspense.activeBranch &&
|
2428 | move(suspense.activeBranch, container, anchor, type);
|
2429 | suspense.container = container;
|
2430 | },
|
2431 | next() {
|
2432 | return suspense.activeBranch && next(suspense.activeBranch);
|
2433 | },
|
2434 | registerDep(instance, setupRenderEffect) {
|
2435 | const isInPendingSuspense = !!suspense.pendingBranch;
|
2436 | if (isInPendingSuspense) {
|
2437 | suspense.deps++;
|
2438 | }
|
2439 | const hydratedEl = instance.vnode.el;
|
2440 | instance
|
2441 | .asyncDep.catch(err => {
|
2442 | handleError(err, instance, 0 );
|
2443 | })
|
2444 | .then(asyncSetupResult => {
|
2445 |
|
2446 |
|
2447 | if (instance.isUnmounted ||
|
2448 | suspense.isUnmounted ||
|
2449 | suspense.pendingId !== instance.suspenseId) {
|
2450 | return;
|
2451 | }
|
2452 |
|
2453 | instance.asyncResolved = true;
|
2454 | const { vnode } = instance;
|
2455 | {
|
2456 | pushWarningContext(vnode);
|
2457 | }
|
2458 | handleSetupResult(instance, asyncSetupResult);
|
2459 | if (hydratedEl) {
|
2460 |
|
2461 |
|
2462 | vnode.el = hydratedEl;
|
2463 | }
|
2464 | const placeholder = !hydratedEl && instance.subTree.el;
|
2465 | setupRenderEffect(instance, vnode,
|
2466 |
|
2467 |
|
2468 |
|
2469 | parentNode(hydratedEl || instance.subTree.el),
|
2470 |
|
2471 |
|
2472 | hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);
|
2473 | if (placeholder) {
|
2474 | remove(placeholder);
|
2475 | }
|
2476 | updateHOCHostEl(instance, vnode.el);
|
2477 | {
|
2478 | popWarningContext();
|
2479 | }
|
2480 |
|
2481 | if (isInPendingSuspense && --suspense.deps === 0) {
|
2482 | suspense.resolve();
|
2483 | }
|
2484 | });
|
2485 | },
|
2486 | unmount(parentSuspense, doRemove) {
|
2487 | suspense.isUnmounted = true;
|
2488 | if (suspense.activeBranch) {
|
2489 | unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
|
2490 | }
|
2491 | if (suspense.pendingBranch) {
|
2492 | unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
|
2493 | }
|
2494 | }
|
2495 | };
|
2496 | return suspense;
|
2497 | }
|
2498 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, optimized, rendererInternals, hydrateNode) {
|
2499 |
|
2500 | const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, optimized, rendererInternals, true ));
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 | const result = hydrateNode(node, (suspense.pendingBranch = vnode.ssContent), parentComponent, suspense, optimized);
|
2508 | if (suspense.deps === 0) {
|
2509 | suspense.resolve();
|
2510 | }
|
2511 | return result;
|
2512 |
|
2513 | }
|
2514 | function normalizeSuspenseChildren(vnode) {
|
2515 | const { shapeFlag, children } = vnode;
|
2516 | let content;
|
2517 | let fallback;
|
2518 | if (shapeFlag & 32 ) {
|
2519 | content = normalizeSuspenseSlot(children.default);
|
2520 | fallback = normalizeSuspenseSlot(children.fallback);
|
2521 | }
|
2522 | else {
|
2523 | content = normalizeSuspenseSlot(children);
|
2524 | fallback = normalizeVNode(null);
|
2525 | }
|
2526 | return {
|
2527 | content,
|
2528 | fallback
|
2529 | };
|
2530 | }
|
2531 | function normalizeSuspenseSlot(s) {
|
2532 | if (isFunction(s)) {
|
2533 | s = s();
|
2534 | }
|
2535 | if (isArray(s)) {
|
2536 | const singleChild = filterSingleRoot(s);
|
2537 | if (!singleChild) {
|
2538 | warn(`<Suspense> slots expect a single root node.`);
|
2539 | }
|
2540 | s = singleChild;
|
2541 | }
|
2542 | return normalizeVNode(s);
|
2543 | }
|
2544 | function queueEffectWithSuspense(fn, suspense) {
|
2545 | if (suspense && suspense.pendingBranch) {
|
2546 | if (isArray(fn)) {
|
2547 | suspense.effects.push(...fn);
|
2548 | }
|
2549 | else {
|
2550 | suspense.effects.push(fn);
|
2551 | }
|
2552 | }
|
2553 | else {
|
2554 | queuePostFlushCb(fn);
|
2555 | }
|
2556 | }
|
2557 | function setActiveBranch(suspense, branch) {
|
2558 | suspense.activeBranch = branch;
|
2559 | const { vnode, parentComponent } = suspense;
|
2560 | const el = (vnode.el = branch.el);
|
2561 |
|
2562 |
|
2563 | if (parentComponent && parentComponent.subTree === vnode) {
|
2564 | parentComponent.vnode.el = el;
|
2565 | updateHOCHostEl(parentComponent, el);
|
2566 | }
|
2567 | }
|
2568 |
|
2569 | let isRenderingCompiledSlot = 0;
|
2570 | const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);
|
2571 | |
2572 |
|
2573 |
|
2574 |
|
2575 | function renderSlot(slots, name, props = {},
|
2576 | // this is not a user-facing function, so the fallback is always generated by
|
2577 | // the compiler and guaranteed to be a function returning an array
|
2578 | fallback) {
|
2579 | let slot = slots[name];
|
2580 | if (slot && slot.length > 1) {
|
2581 | warn(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
2582 | `function. You need to mark this component with $dynamic-slots in the ` +
|
2583 | `parent template.`);
|
2584 | slot = () => [];
|
2585 | }
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 | isRenderingCompiledSlot++;
|
2591 | openBlock();
|
2592 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
2593 | const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1
|
2594 | ? 64
|
2595 | : -2 );
|
2596 | isRenderingCompiledSlot--;
|
2597 | return rendered;
|
2598 | }
|
2599 | function ensureValidVNode(vnodes) {
|
2600 | return vnodes.some(child => {
|
2601 | if (!isVNode(child))
|
2602 | return true;
|
2603 | if (child.type === Comment)
|
2604 | return false;
|
2605 | if (child.type === Fragment &&
|
2606 | !ensureValidVNode(child.children))
|
2607 | return false;
|
2608 | return true;
|
2609 | })
|
2610 | ? vnodes
|
2611 | : null;
|
2612 | }
|
2613 |
|
2614 | |
2615 |
|
2616 |
|
2617 |
|
2618 | function withCtx(fn, ctx = currentRenderingInstance) {
|
2619 | if (!ctx)
|
2620 | return fn;
|
2621 | const renderFnWithContext = (...args) => {
|
2622 |
|
2623 |
|
2624 |
|
2625 | if (!isRenderingCompiledSlot) {
|
2626 | openBlock(true );
|
2627 | }
|
2628 | const owner = currentRenderingInstance;
|
2629 | setCurrentRenderingInstance(ctx);
|
2630 | const res = fn(...args);
|
2631 | setCurrentRenderingInstance(owner);
|
2632 | if (!isRenderingCompiledSlot) {
|
2633 | closeBlock();
|
2634 | }
|
2635 | return res;
|
2636 | };
|
2637 | renderFnWithContext._c = true;
|
2638 | return renderFnWithContext;
|
2639 | }
|
2640 |
|
2641 |
|
2642 | let currentScopeId = null;
|
2643 | const scopeIdStack = [];
|
2644 | |
2645 |
|
2646 |
|
2647 | function pushScopeId(id) {
|
2648 | scopeIdStack.push((currentScopeId = id));
|
2649 | }
|
2650 | |
2651 |
|
2652 |
|
2653 | function popScopeId() {
|
2654 | scopeIdStack.pop();
|
2655 | currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null;
|
2656 | }
|
2657 | |
2658 |
|
2659 |
|
2660 | function withScopeId(id) {
|
2661 | return ((fn) => withCtx(function () {
|
2662 | pushScopeId(id);
|
2663 | const res = fn.apply(this, arguments);
|
2664 | popScopeId();
|
2665 | return res;
|
2666 | }));
|
2667 | }
|
2668 |
|
2669 | function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
2670 | isSSR = false) {
|
2671 | const props = {};
|
2672 | const attrs = {};
|
2673 | def(attrs, InternalObjectKey, 1);
|
2674 | setFullProps(instance, rawProps, props, attrs);
|
2675 |
|
2676 | {
|
2677 | validateProps(props, instance);
|
2678 | }
|
2679 | if (isStateful) {
|
2680 |
|
2681 | instance.props = isSSR ? props : shallowReactive(props);
|
2682 | }
|
2683 | else {
|
2684 | if (!instance.type.props) {
|
2685 |
|
2686 | instance.props = attrs;
|
2687 | }
|
2688 | else {
|
2689 |
|
2690 | instance.props = props;
|
2691 | }
|
2692 | }
|
2693 | instance.attrs = attrs;
|
2694 | }
|
2695 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
2696 | const { props, attrs, vnode: { patchFlag } } = instance;
|
2697 | const rawCurrentProps = toRaw(props);
|
2698 | const [options] = instance.propsOptions;
|
2699 | if (
|
2700 |
|
2701 |
|
2702 |
|
2703 | !((instance.type.__hmrId ||
|
2704 | (instance.parent && instance.parent.type.__hmrId))) &&
|
2705 | (optimized || patchFlag > 0) &&
|
2706 | !(patchFlag & 16 )) {
|
2707 | if (patchFlag & 8 ) {
|
2708 |
|
2709 |
|
2710 | const propsToUpdate = instance.vnode.dynamicProps;
|
2711 | for (let i = 0; i < propsToUpdate.length; i++) {
|
2712 | const key = propsToUpdate[i];
|
2713 |
|
2714 | const value = rawProps[key];
|
2715 | if (options) {
|
2716 |
|
2717 |
|
2718 | if (hasOwn(attrs, key)) {
|
2719 | attrs[key] = value;
|
2720 | }
|
2721 | else {
|
2722 | const camelizedKey = camelize(key);
|
2723 | props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance);
|
2724 | }
|
2725 | }
|
2726 | else {
|
2727 | attrs[key] = value;
|
2728 | }
|
2729 | }
|
2730 | }
|
2731 | }
|
2732 | else {
|
2733 |
|
2734 | setFullProps(instance, rawProps, props, attrs);
|
2735 |
|
2736 |
|
2737 | let kebabKey;
|
2738 | for (const key in rawCurrentProps) {
|
2739 | if (!rawProps ||
|
2740 |
|
2741 | (!hasOwn(rawProps, key) &&
|
2742 |
|
2743 |
|
2744 | ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
2745 | if (options) {
|
2746 | if (rawPrevProps &&
|
2747 |
|
2748 | (rawPrevProps[key] !== undefined ||
|
2749 |
|
2750 | rawPrevProps[kebabKey] !== undefined)) {
|
2751 | props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance);
|
2752 | }
|
2753 | }
|
2754 | else {
|
2755 | delete props[key];
|
2756 | }
|
2757 | }
|
2758 | }
|
2759 |
|
2760 |
|
2761 | if (attrs !== rawCurrentProps) {
|
2762 | for (const key in attrs) {
|
2763 | if (!rawProps || !hasOwn(rawProps, key)) {
|
2764 | delete attrs[key];
|
2765 | }
|
2766 | }
|
2767 | }
|
2768 | }
|
2769 |
|
2770 | trigger(instance, "set" , '$attrs');
|
2771 | if (rawProps) {
|
2772 | validateProps(props, instance);
|
2773 | }
|
2774 | }
|
2775 | function setFullProps(instance, rawProps, props, attrs) {
|
2776 | const [options, needCastKeys] = instance.propsOptions;
|
2777 | if (rawProps) {
|
2778 | for (const key in rawProps) {
|
2779 | const value = rawProps[key];
|
2780 |
|
2781 | if (isReservedProp(key)) {
|
2782 | continue;
|
2783 | }
|
2784 |
|
2785 |
|
2786 | let camelKey;
|
2787 | if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
2788 | props[camelKey] = value;
|
2789 | }
|
2790 | else if (!isEmitListener(instance.emitsOptions, key)) {
|
2791 |
|
2792 |
|
2793 |
|
2794 | attrs[key] = value;
|
2795 | }
|
2796 | }
|
2797 | }
|
2798 | if (needCastKeys) {
|
2799 | const rawCurrentProps = toRaw(props);
|
2800 | for (let i = 0; i < needCastKeys.length; i++) {
|
2801 | const key = needCastKeys[i];
|
2802 | props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance);
|
2803 | }
|
2804 | }
|
2805 | }
|
2806 | function resolvePropValue(options, props, key, value, instance) {
|
2807 | const opt = options[key];
|
2808 | if (opt != null) {
|
2809 | const hasDefault = hasOwn(opt, 'default');
|
2810 |
|
2811 | if (hasDefault && value === undefined) {
|
2812 | const defaultValue = opt.default;
|
2813 | if (opt.type !== Function && isFunction(defaultValue)) {
|
2814 | setCurrentInstance(instance);
|
2815 | value = defaultValue(props);
|
2816 | setCurrentInstance(null);
|
2817 | }
|
2818 | else {
|
2819 | value = defaultValue;
|
2820 | }
|
2821 | }
|
2822 |
|
2823 | if (opt[0 ]) {
|
2824 | if (!hasOwn(props, key) && !hasDefault) {
|
2825 | value = false;
|
2826 | }
|
2827 | else if (opt[1 ] &&
|
2828 | (value === '' || value === hyphenate(key))) {
|
2829 | value = true;
|
2830 | }
|
2831 | }
|
2832 | }
|
2833 | return value;
|
2834 | }
|
2835 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
2836 | if (!appContext.deopt && comp.__props) {
|
2837 | return comp.__props;
|
2838 | }
|
2839 | const raw = comp.props;
|
2840 | const normalized = {};
|
2841 | const needCastKeys = [];
|
2842 |
|
2843 | let hasExtends = false;
|
2844 | if (!isFunction(comp)) {
|
2845 | const extendProps = (raw) => {
|
2846 | hasExtends = true;
|
2847 | const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
2848 | extend(normalized, props);
|
2849 | if (keys)
|
2850 | needCastKeys.push(...keys);
|
2851 | };
|
2852 | if (!asMixin && appContext.mixins.length) {
|
2853 | appContext.mixins.forEach(extendProps);
|
2854 | }
|
2855 | if (comp.extends) {
|
2856 | extendProps(comp.extends);
|
2857 | }
|
2858 | if (comp.mixins) {
|
2859 | comp.mixins.forEach(extendProps);
|
2860 | }
|
2861 | }
|
2862 | if (!raw && !hasExtends) {
|
2863 | return (comp.__props = EMPTY_ARR);
|
2864 | }
|
2865 | if (isArray(raw)) {
|
2866 | for (let i = 0; i < raw.length; i++) {
|
2867 | if (!isString(raw[i])) {
|
2868 | warn(`props must be strings when using array syntax.`, raw[i]);
|
2869 | }
|
2870 | const normalizedKey = camelize(raw[i]);
|
2871 | if (validatePropName(normalizedKey)) {
|
2872 | normalized[normalizedKey] = EMPTY_OBJ;
|
2873 | }
|
2874 | }
|
2875 | }
|
2876 | else if (raw) {
|
2877 | if (!isObject(raw)) {
|
2878 | warn(`invalid props options`, raw);
|
2879 | }
|
2880 | for (const key in raw) {
|
2881 | const normalizedKey = camelize(key);
|
2882 | if (validatePropName(normalizedKey)) {
|
2883 | const opt = raw[key];
|
2884 | const prop = (normalized[normalizedKey] =
|
2885 | isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
2886 | if (prop) {
|
2887 | const booleanIndex = getTypeIndex(Boolean, prop.type);
|
2888 | const stringIndex = getTypeIndex(String, prop.type);
|
2889 | prop[0 ] = booleanIndex > -1;
|
2890 | prop[1 ] =
|
2891 | stringIndex < 0 || booleanIndex < stringIndex;
|
2892 |
|
2893 | if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
2894 | needCastKeys.push(normalizedKey);
|
2895 | }
|
2896 | }
|
2897 | }
|
2898 | }
|
2899 | }
|
2900 | return (comp.__props = [normalized, needCastKeys]);
|
2901 | }
|
2902 | function validatePropName(key) {
|
2903 | if (key[0] !== '$') {
|
2904 | return true;
|
2905 | }
|
2906 | else {
|
2907 | warn(`Invalid prop name: "${key}" is a reserved property.`);
|
2908 | }
|
2909 | return false;
|
2910 | }
|
2911 |
|
2912 |
|
2913 | function getType(ctor) {
|
2914 | const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
2915 | return match ? match[1] : '';
|
2916 | }
|
2917 | function isSameType(a, b) {
|
2918 | return getType(a) === getType(b);
|
2919 | }
|
2920 | function getTypeIndex(type, expectedTypes) {
|
2921 | if (isArray(expectedTypes)) {
|
2922 | for (let i = 0, len = expectedTypes.length; i < len; i++) {
|
2923 | if (isSameType(expectedTypes[i], type)) {
|
2924 | return i;
|
2925 | }
|
2926 | }
|
2927 | }
|
2928 | else if (isFunction(expectedTypes)) {
|
2929 | return isSameType(expectedTypes, type) ? 0 : -1;
|
2930 | }
|
2931 | return -1;
|
2932 | }
|
2933 | |
2934 |
|
2935 |
|
2936 | function validateProps(props, instance) {
|
2937 | const rawValues = toRaw(props);
|
2938 | const options = instance.propsOptions[0];
|
2939 | for (const key in options) {
|
2940 | let opt = options[key];
|
2941 | if (opt == null)
|
2942 | continue;
|
2943 | validateProp(key, rawValues[key], opt, !hasOwn(rawValues, key));
|
2944 | }
|
2945 | }
|
2946 | |
2947 |
|
2948 |
|
2949 | function validateProp(name, value, prop, isAbsent) {
|
2950 | const { type, required, validator } = prop;
|
2951 |
|
2952 | if (required && isAbsent) {
|
2953 | warn('Missing required prop: "' + name + '"');
|
2954 | return;
|
2955 | }
|
2956 |
|
2957 | if (value == null && !prop.required) {
|
2958 | return;
|
2959 | }
|
2960 |
|
2961 | if (type != null && type !== true) {
|
2962 | let isValid = false;
|
2963 | const types = isArray(type) ? type : [type];
|
2964 | const expectedTypes = [];
|
2965 |
|
2966 | for (let i = 0; i < types.length && !isValid; i++) {
|
2967 | const { valid, expectedType } = assertType(value, types[i]);
|
2968 | expectedTypes.push(expectedType || '');
|
2969 | isValid = valid;
|
2970 | }
|
2971 | if (!isValid) {
|
2972 | warn(getInvalidTypeMessage(name, value, expectedTypes));
|
2973 | return;
|
2974 | }
|
2975 | }
|
2976 |
|
2977 | if (validator && !validator(value)) {
|
2978 | warn('Invalid prop: custom validator check failed for prop "' + name + '".');
|
2979 | }
|
2980 | }
|
2981 | const isSimpleType = makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
2982 | |
2983 |
|
2984 |
|
2985 | function assertType(value, type) {
|
2986 | let valid;
|
2987 | const expectedType = getType(type);
|
2988 | if (isSimpleType(expectedType)) {
|
2989 | const t = typeof value;
|
2990 | valid = t === expectedType.toLowerCase();
|
2991 |
|
2992 | if (!valid && t === 'object') {
|
2993 | valid = value instanceof type;
|
2994 | }
|
2995 | }
|
2996 | else if (expectedType === 'Object') {
|
2997 | valid = isObject(value);
|
2998 | }
|
2999 | else if (expectedType === 'Array') {
|
3000 | valid = isArray(value);
|
3001 | }
|
3002 | else {
|
3003 | valid = value instanceof type;
|
3004 | }
|
3005 | return {
|
3006 | valid,
|
3007 | expectedType
|
3008 | };
|
3009 | }
|
3010 | |
3011 |
|
3012 |
|
3013 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
3014 | let message = `Invalid prop: type check failed for prop "${name}".` +
|
3015 | ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
|
3016 | const expectedType = expectedTypes[0];
|
3017 | const receivedType = toRawType(value);
|
3018 | const expectedValue = styleValue(value, expectedType);
|
3019 | const receivedValue = styleValue(value, receivedType);
|
3020 |
|
3021 | if (expectedTypes.length === 1 &&
|
3022 | isExplicable(expectedType) &&
|
3023 | !isBoolean(expectedType, receivedType)) {
|
3024 | message += ` with value ${expectedValue}`;
|
3025 | }
|
3026 | message += `, got ${receivedType} `;
|
3027 |
|
3028 | if (isExplicable(receivedType)) {
|
3029 | message += `with value ${receivedValue}.`;
|
3030 | }
|
3031 | return message;
|
3032 | }
|
3033 | |
3034 |
|
3035 |
|
3036 | function styleValue(value, type) {
|
3037 | if (type === 'String') {
|
3038 | return `"${value}"`;
|
3039 | }
|
3040 | else if (type === 'Number') {
|
3041 | return `${Number(value)}`;
|
3042 | }
|
3043 | else {
|
3044 | return `${value}`;
|
3045 | }
|
3046 | }
|
3047 | |
3048 |
|
3049 |
|
3050 | function isExplicable(type) {
|
3051 | const explicitTypes = ['string', 'number', 'boolean'];
|
3052 | return explicitTypes.some(elem => type.toLowerCase() === elem);
|
3053 | }
|
3054 | |
3055 |
|
3056 |
|
3057 | function isBoolean(...args) {
|
3058 | return args.some(elem => elem.toLowerCase() === 'boolean');
|
3059 | }
|
3060 |
|
3061 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
3062 | if (target) {
|
3063 | const hooks = target[type] || (target[type] = []);
|
3064 |
|
3065 |
|
3066 |
|
3067 | const wrappedHook = hook.__weh ||
|
3068 | (hook.__weh = (...args) => {
|
3069 | if (target.isUnmounted) {
|
3070 | return;
|
3071 | }
|
3072 |
|
3073 |
|
3074 | pauseTracking();
|
3075 |
|
3076 |
|
3077 |
|
3078 | setCurrentInstance(target);
|
3079 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
3080 | setCurrentInstance(null);
|
3081 | resetTracking();
|
3082 | return res;
|
3083 | });
|
3084 | if (prepend) {
|
3085 | hooks.unshift(wrappedHook);
|
3086 | }
|
3087 | else {
|
3088 | hooks.push(wrappedHook);
|
3089 | }
|
3090 | return wrappedHook;
|
3091 | }
|
3092 | else {
|
3093 | const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));
|
3094 | warn(`${apiName} is called when there is no active component instance to be ` +
|
3095 | `associated with. ` +
|
3096 | `Lifecycle injection APIs can only be used during execution of setup().` +
|
3097 | (` If you are using async setup(), make sure to register lifecycle ` +
|
3098 | `hooks before the first await statement.`
|
3099 | ));
|
3100 | }
|
3101 | }
|
3102 | const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
3103 |
|
3104 | !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
|
3105 | const onBeforeMount = createHook("bm" );
|
3106 | const onMounted = createHook("m" );
|
3107 | const onBeforeUpdate = createHook("bu" );
|
3108 | const onUpdated = createHook("u" );
|
3109 | const onBeforeUnmount = createHook("bum" );
|
3110 | const onUnmounted = createHook("um" );
|
3111 | const onRenderTriggered = createHook("rtg" );
|
3112 | const onRenderTracked = createHook("rtc" );
|
3113 | const onErrorCaptured = (hook, target = currentInstance) => {
|
3114 | injectHook("ec" , hook, target);
|
3115 | };
|
3116 |
|
3117 |
|
3118 | function watchEffect(effect, options) {
|
3119 | return doWatch(effect, null, options);
|
3120 | }
|
3121 |
|
3122 | const INITIAL_WATCHER_VALUE = {};
|
3123 |
|
3124 | function watch(source, cb, options) {
|
3125 | if (!isFunction(cb)) {
|
3126 | warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
|
3127 | `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
|
3128 | `supports \`watch(source, cb, options?) signature.`);
|
3129 | }
|
3130 | return doWatch(source, cb, options);
|
3131 | }
|
3132 | function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {
|
3133 | if (!cb) {
|
3134 | if (immediate !== undefined) {
|
3135 | warn(`watch() "immediate" option is only respected when using the ` +
|
3136 | `watch(source, callback, options?) signature.`);
|
3137 | }
|
3138 | if (deep !== undefined) {
|
3139 | warn(`watch() "deep" option is only respected when using the ` +
|
3140 | `watch(source, callback, options?) signature.`);
|
3141 | }
|
3142 | }
|
3143 | const warnInvalidSource = (s) => {
|
3144 | warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
|
3145 | `a reactive object, or an array of these types.`);
|
3146 | };
|
3147 | let getter;
|
3148 | let forceTrigger = false;
|
3149 | if (isRef(source)) {
|
3150 | getter = () => source.value;
|
3151 | forceTrigger = !!source._shallow;
|
3152 | }
|
3153 | else if (isReactive(source)) {
|
3154 | getter = () => source;
|
3155 | deep = true;
|
3156 | }
|
3157 | else if (isArray(source)) {
|
3158 | getter = () => source.map(s => {
|
3159 | if (isRef(s)) {
|
3160 | return s.value;
|
3161 | }
|
3162 | else if (isReactive(s)) {
|
3163 | return traverse(s);
|
3164 | }
|
3165 | else if (isFunction(s)) {
|
3166 | return callWithErrorHandling(s, instance, 2 , [
|
3167 | instance && instance.proxy
|
3168 | ]);
|
3169 | }
|
3170 | else {
|
3171 | warnInvalidSource(s);
|
3172 | }
|
3173 | });
|
3174 | }
|
3175 | else if (isFunction(source)) {
|
3176 | if (cb) {
|
3177 |
|
3178 | getter = () => callWithErrorHandling(source, instance, 2 , [
|
3179 | instance && instance.proxy
|
3180 | ]);
|
3181 | }
|
3182 | else {
|
3183 |
|
3184 | getter = () => {
|
3185 | if (instance && instance.isUnmounted) {
|
3186 | return;
|
3187 | }
|
3188 | if (cleanup) {
|
3189 | cleanup();
|
3190 | }
|
3191 | return callWithErrorHandling(source, instance, 3 , [onInvalidate]);
|
3192 | };
|
3193 | }
|
3194 | }
|
3195 | else {
|
3196 | getter = NOOP;
|
3197 | warnInvalidSource(source);
|
3198 | }
|
3199 | if (cb && deep) {
|
3200 | const baseGetter = getter;
|
3201 | getter = () => traverse(baseGetter());
|
3202 | }
|
3203 | let cleanup;
|
3204 | const onInvalidate = (fn) => {
|
3205 | cleanup = runner.options.onStop = () => {
|
3206 | callWithErrorHandling(fn, instance, 4 );
|
3207 | };
|
3208 | };
|
3209 | let oldValue = isArray(source) ? [] : INITIAL_WATCHER_VALUE;
|
3210 | const job = () => {
|
3211 | if (!runner.active) {
|
3212 | return;
|
3213 | }
|
3214 | if (cb) {
|
3215 |
|
3216 | const newValue = runner();
|
3217 | if (deep || forceTrigger || hasChanged(newValue, oldValue)) {
|
3218 |
|
3219 | if (cleanup) {
|
3220 | cleanup();
|
3221 | }
|
3222 | callWithAsyncErrorHandling(cb, instance, 3 , [
|
3223 | newValue,
|
3224 |
|
3225 | oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
3226 | onInvalidate
|
3227 | ]);
|
3228 | oldValue = newValue;
|
3229 | }
|
3230 | }
|
3231 | else {
|
3232 |
|
3233 | runner();
|
3234 | }
|
3235 | };
|
3236 |
|
3237 |
|
3238 | job.allowRecurse = !!cb;
|
3239 | let scheduler;
|
3240 | if (flush === 'sync') {
|
3241 | scheduler = job;
|
3242 | }
|
3243 | else if (flush === 'post') {
|
3244 | scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
3245 | }
|
3246 | else {
|
3247 |
|
3248 | scheduler = () => {
|
3249 | if (!instance || instance.isMounted) {
|
3250 | queuePreFlushCb(job);
|
3251 | }
|
3252 | else {
|
3253 |
|
3254 |
|
3255 | job();
|
3256 | }
|
3257 | };
|
3258 | }
|
3259 | const runner = effect(getter, {
|
3260 | lazy: true,
|
3261 | onTrack,
|
3262 | onTrigger,
|
3263 | scheduler
|
3264 | });
|
3265 | recordInstanceBoundEffect(runner, instance);
|
3266 |
|
3267 | if (cb) {
|
3268 | if (immediate) {
|
3269 | job();
|
3270 | }
|
3271 | else {
|
3272 | oldValue = runner();
|
3273 | }
|
3274 | }
|
3275 | else if (flush === 'post') {
|
3276 | queuePostRenderEffect(runner, instance && instance.suspense);
|
3277 | }
|
3278 | else {
|
3279 | runner();
|
3280 | }
|
3281 | return () => {
|
3282 | stop(runner);
|
3283 | if (instance) {
|
3284 | remove(instance.effects, runner);
|
3285 | }
|
3286 | };
|
3287 | }
|
3288 |
|
3289 | function instanceWatch(source, cb, options) {
|
3290 | const publicThis = this.proxy;
|
3291 | const getter = isString(source)
|
3292 | ? () => publicThis[source]
|
3293 | : source.bind(publicThis);
|
3294 | return doWatch(getter, cb.bind(publicThis), options, this);
|
3295 | }
|
3296 | function traverse(value, seen = new Set()) {
|
3297 | if (!isObject(value) || seen.has(value)) {
|
3298 | return value;
|
3299 | }
|
3300 | seen.add(value);
|
3301 | if (isRef(value)) {
|
3302 | traverse(value.value, seen);
|
3303 | }
|
3304 | else if (isArray(value)) {
|
3305 | for (let i = 0; i < value.length; i++) {
|
3306 | traverse(value[i], seen);
|
3307 | }
|
3308 | }
|
3309 | else if (isSet(value) || isMap(value)) {
|
3310 | value.forEach((v) => {
|
3311 | traverse(v, seen);
|
3312 | });
|
3313 | }
|
3314 | else {
|
3315 | for (const key in value) {
|
3316 | traverse(value[key], seen);
|
3317 | }
|
3318 | }
|
3319 | return value;
|
3320 | }
|
3321 |
|
3322 | function useTransitionState() {
|
3323 | const state = {
|
3324 | isMounted: false,
|
3325 | isLeaving: false,
|
3326 | isUnmounting: false,
|
3327 | leavingVNodes: new Map()
|
3328 | };
|
3329 | onMounted(() => {
|
3330 | state.isMounted = true;
|
3331 | });
|
3332 | onBeforeUnmount(() => {
|
3333 | state.isUnmounting = true;
|
3334 | });
|
3335 | return state;
|
3336 | }
|
3337 | const TransitionHookValidator = [Function, Array];
|
3338 | const BaseTransitionImpl = {
|
3339 | name: `BaseTransition`,
|
3340 | props: {
|
3341 | mode: String,
|
3342 | appear: Boolean,
|
3343 | persisted: Boolean,
|
3344 |
|
3345 | onBeforeEnter: TransitionHookValidator,
|
3346 | onEnter: TransitionHookValidator,
|
3347 | onAfterEnter: TransitionHookValidator,
|
3348 | onEnterCancelled: TransitionHookValidator,
|
3349 |
|
3350 | onBeforeLeave: TransitionHookValidator,
|
3351 | onLeave: TransitionHookValidator,
|
3352 | onAfterLeave: TransitionHookValidator,
|
3353 | onLeaveCancelled: TransitionHookValidator,
|
3354 |
|
3355 | onBeforeAppear: TransitionHookValidator,
|
3356 | onAppear: TransitionHookValidator,
|
3357 | onAfterAppear: TransitionHookValidator,
|
3358 | onAppearCancelled: TransitionHookValidator
|
3359 | },
|
3360 | setup(props, { slots }) {
|
3361 | const instance = getCurrentInstance();
|
3362 | const state = useTransitionState();
|
3363 | let prevTransitionKey;
|
3364 | return () => {
|
3365 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
3366 | if (!children || !children.length) {
|
3367 | return;
|
3368 | }
|
3369 |
|
3370 | if (children.length > 1) {
|
3371 | warn('<transition> can only be used on a single element or component. Use ' +
|
3372 | '<transition-group> for lists.');
|
3373 | }
|
3374 |
|
3375 |
|
3376 | const rawProps = toRaw(props);
|
3377 | const { mode } = rawProps;
|
3378 |
|
3379 | if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
|
3380 | warn(`invalid <transition> mode: ${mode}`);
|
3381 | }
|
3382 |
|
3383 | const child = children[0];
|
3384 | if (state.isLeaving) {
|
3385 | return emptyPlaceholder(child);
|
3386 | }
|
3387 |
|
3388 |
|
3389 | const innerChild = getKeepAliveChild(child);
|
3390 | if (!innerChild) {
|
3391 | return emptyPlaceholder(child);
|
3392 | }
|
3393 | const enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);
|
3394 | setTransitionHooks(innerChild, enterHooks);
|
3395 | const oldChild = instance.subTree;
|
3396 | const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
3397 | let transitionKeyChanged = false;
|
3398 | const { getTransitionKey } = innerChild.type;
|
3399 | if (getTransitionKey) {
|
3400 | const key = getTransitionKey();
|
3401 | if (prevTransitionKey === undefined) {
|
3402 | prevTransitionKey = key;
|
3403 | }
|
3404 | else if (key !== prevTransitionKey) {
|
3405 | prevTransitionKey = key;
|
3406 | transitionKeyChanged = true;
|
3407 | }
|
3408 | }
|
3409 |
|
3410 | if (oldInnerChild &&
|
3411 | oldInnerChild.type !== Comment &&
|
3412 | (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
|
3413 | const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
|
3414 |
|
3415 | setTransitionHooks(oldInnerChild, leavingHooks);
|
3416 |
|
3417 | if (mode === 'out-in') {
|
3418 | state.isLeaving = true;
|
3419 |
|
3420 | leavingHooks.afterLeave = () => {
|
3421 | state.isLeaving = false;
|
3422 | instance.update();
|
3423 | };
|
3424 | return emptyPlaceholder(child);
|
3425 | }
|
3426 | else if (mode === 'in-out') {
|
3427 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
3428 | const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
|
3429 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
3430 |
|
3431 | el._leaveCb = () => {
|
3432 | earlyRemove();
|
3433 | el._leaveCb = undefined;
|
3434 | delete enterHooks.delayedLeave;
|
3435 | };
|
3436 | enterHooks.delayedLeave = delayedLeave;
|
3437 | };
|
3438 | }
|
3439 | }
|
3440 | return child;
|
3441 | };
|
3442 | }
|
3443 | };
|
3444 |
|
3445 |
|
3446 | const BaseTransition = BaseTransitionImpl;
|
3447 | function getLeavingNodesForType(state, vnode) {
|
3448 | const { leavingVNodes } = state;
|
3449 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
3450 | if (!leavingVNodesCache) {
|
3451 | leavingVNodesCache = Object.create(null);
|
3452 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
3453 | }
|
3454 | return leavingVNodesCache;
|
3455 | }
|
3456 |
|
3457 |
|
3458 | function resolveTransitionHooks(vnode, props, state, instance) {
|
3459 | const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props;
|
3460 | const key = String(vnode.key);
|
3461 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
3462 | const callHook = (hook, args) => {
|
3463 | hook &&
|
3464 | callWithAsyncErrorHandling(hook, instance, 9 , args);
|
3465 | };
|
3466 | const hooks = {
|
3467 | mode,
|
3468 | persisted,
|
3469 | beforeEnter(el) {
|
3470 | let hook = onBeforeEnter;
|
3471 | if (!state.isMounted) {
|
3472 | if (appear) {
|
3473 | hook = onBeforeAppear || onBeforeEnter;
|
3474 | }
|
3475 | else {
|
3476 | return;
|
3477 | }
|
3478 | }
|
3479 |
|
3480 | if (el._leaveCb) {
|
3481 | el._leaveCb(true );
|
3482 | }
|
3483 |
|
3484 | const leavingVNode = leavingVNodesCache[key];
|
3485 | if (leavingVNode &&
|
3486 | isSameVNodeType(vnode, leavingVNode) &&
|
3487 | leavingVNode.el._leaveCb) {
|
3488 |
|
3489 | leavingVNode.el._leaveCb();
|
3490 | }
|
3491 | callHook(hook, [el]);
|
3492 | },
|
3493 | enter(el) {
|
3494 | let hook = onEnter;
|
3495 | let afterHook = onAfterEnter;
|
3496 | let cancelHook = onEnterCancelled;
|
3497 | if (!state.isMounted) {
|
3498 | if (appear) {
|
3499 | hook = onAppear || onEnter;
|
3500 | afterHook = onAfterAppear || onAfterEnter;
|
3501 | cancelHook = onAppearCancelled || onEnterCancelled;
|
3502 | }
|
3503 | else {
|
3504 | return;
|
3505 | }
|
3506 | }
|
3507 | let called = false;
|
3508 | const done = (el._enterCb = (cancelled) => {
|
3509 | if (called)
|
3510 | return;
|
3511 | called = true;
|
3512 | if (cancelled) {
|
3513 | callHook(cancelHook, [el]);
|
3514 | }
|
3515 | else {
|
3516 | callHook(afterHook, [el]);
|
3517 | }
|
3518 | if (hooks.delayedLeave) {
|
3519 | hooks.delayedLeave();
|
3520 | }
|
3521 | el._enterCb = undefined;
|
3522 | });
|
3523 | if (hook) {
|
3524 | hook(el, done);
|
3525 | if (hook.length <= 1) {
|
3526 | done();
|
3527 | }
|
3528 | }
|
3529 | else {
|
3530 | done();
|
3531 | }
|
3532 | },
|
3533 | leave(el, remove) {
|
3534 | const key = String(vnode.key);
|
3535 | if (el._enterCb) {
|
3536 | el._enterCb(true );
|
3537 | }
|
3538 | if (state.isUnmounting) {
|
3539 | return remove();
|
3540 | }
|
3541 | callHook(onBeforeLeave, [el]);
|
3542 | let called = false;
|
3543 | const done = (el._leaveCb = (cancelled) => {
|
3544 | if (called)
|
3545 | return;
|
3546 | called = true;
|
3547 | remove();
|
3548 | if (cancelled) {
|
3549 | callHook(onLeaveCancelled, [el]);
|
3550 | }
|
3551 | else {
|
3552 | callHook(onAfterLeave, [el]);
|
3553 | }
|
3554 | el._leaveCb = undefined;
|
3555 | if (leavingVNodesCache[key] === vnode) {
|
3556 | delete leavingVNodesCache[key];
|
3557 | }
|
3558 | });
|
3559 | leavingVNodesCache[key] = vnode;
|
3560 | if (onLeave) {
|
3561 | onLeave(el, done);
|
3562 | if (onLeave.length <= 1) {
|
3563 | done();
|
3564 | }
|
3565 | }
|
3566 | else {
|
3567 | done();
|
3568 | }
|
3569 | },
|
3570 | clone(vnode) {
|
3571 | return resolveTransitionHooks(vnode, props, state, instance);
|
3572 | }
|
3573 | };
|
3574 | return hooks;
|
3575 | }
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 | function emptyPlaceholder(vnode) {
|
3581 | if (isKeepAlive(vnode)) {
|
3582 | vnode = cloneVNode(vnode);
|
3583 | vnode.children = null;
|
3584 | return vnode;
|
3585 | }
|
3586 | }
|
3587 | function getKeepAliveChild(vnode) {
|
3588 | return isKeepAlive(vnode)
|
3589 | ? vnode.children
|
3590 | ? vnode.children[0]
|
3591 | : undefined
|
3592 | : vnode;
|
3593 | }
|
3594 | function setTransitionHooks(vnode, hooks) {
|
3595 | if (vnode.shapeFlag & 6 && vnode.component) {
|
3596 | setTransitionHooks(vnode.component.subTree, hooks);
|
3597 | }
|
3598 | else if (vnode.shapeFlag & 128 ) {
|
3599 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
3600 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
3601 | }
|
3602 | else {
|
3603 | vnode.transition = hooks;
|
3604 | }
|
3605 | }
|
3606 | function getTransitionRawChildren(children, keepComment = false) {
|
3607 | let ret = [];
|
3608 | let keyedFragmentCount = 0;
|
3609 | for (let i = 0; i < children.length; i++) {
|
3610 | const child = children[i];
|
3611 |
|
3612 | if (child.type === Fragment) {
|
3613 | if (child.patchFlag & 128 )
|
3614 | keyedFragmentCount++;
|
3615 | ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
|
3616 | }
|
3617 |
|
3618 | else if (keepComment || child.type !== Comment) {
|
3619 | ret.push(child);
|
3620 | }
|
3621 | }
|
3622 |
|
3623 |
|
3624 |
|
3625 |
|
3626 | if (keyedFragmentCount > 1) {
|
3627 | for (let i = 0; i < ret.length; i++) {
|
3628 | ret[i].patchFlag = -2 ;
|
3629 | }
|
3630 | }
|
3631 | return ret;
|
3632 | }
|
3633 |
|
3634 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
3635 | const KeepAliveImpl = {
|
3636 | name: `KeepAlive`,
|
3637 |
|
3638 |
|
3639 |
|
3640 | __isKeepAlive: true,
|
3641 | props: {
|
3642 | include: [String, RegExp, Array],
|
3643 | exclude: [String, RegExp, Array],
|
3644 | max: [String, Number]
|
3645 | },
|
3646 | setup(props, { slots }) {
|
3647 | const cache = new Map();
|
3648 | const keys = new Set();
|
3649 | let current = null;
|
3650 | const instance = getCurrentInstance();
|
3651 | const parentSuspense = instance.suspense;
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 | const sharedContext = instance.ctx;
|
3658 | const { renderer: { p: patch, m: move, um: _unmount, o: { createElement } } } = sharedContext;
|
3659 | const storageContainer = createElement('div');
|
3660 | sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
3661 | const instance = vnode.component;
|
3662 | move(vnode, container, anchor, 0 , parentSuspense);
|
3663 |
|
3664 | patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, optimized);
|
3665 | queuePostRenderEffect(() => {
|
3666 | instance.isDeactivated = false;
|
3667 | if (instance.a) {
|
3668 | invokeArrayFns(instance.a);
|
3669 | }
|
3670 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
3671 | if (vnodeHook) {
|
3672 | invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
3673 | }
|
3674 | }, parentSuspense);
|
3675 | };
|
3676 | sharedContext.deactivate = (vnode) => {
|
3677 | const instance = vnode.component;
|
3678 | move(vnode, storageContainer, null, 1 , parentSuspense);
|
3679 | queuePostRenderEffect(() => {
|
3680 | if (instance.da) {
|
3681 | invokeArrayFns(instance.da);
|
3682 | }
|
3683 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
3684 | if (vnodeHook) {
|
3685 | invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
3686 | }
|
3687 | instance.isDeactivated = true;
|
3688 | }, parentSuspense);
|
3689 | };
|
3690 | function unmount(vnode) {
|
3691 |
|
3692 | resetShapeFlag(vnode);
|
3693 | _unmount(vnode, instance, parentSuspense);
|
3694 | }
|
3695 | function pruneCache(filter) {
|
3696 | cache.forEach((vnode, key) => {
|
3697 | const name = getComponentName(vnode.type);
|
3698 | if (name && (!filter || !filter(name))) {
|
3699 | pruneCacheEntry(key);
|
3700 | }
|
3701 | });
|
3702 | }
|
3703 | function pruneCacheEntry(key) {
|
3704 | const cached = cache.get(key);
|
3705 | if (!current || cached.type !== current.type) {
|
3706 | unmount(cached);
|
3707 | }
|
3708 | else if (current) {
|
3709 |
|
3710 |
|
3711 | resetShapeFlag(current);
|
3712 | }
|
3713 | cache.delete(key);
|
3714 | keys.delete(key);
|
3715 | }
|
3716 |
|
3717 | watch(() => [props.include, props.exclude], ([include, exclude]) => {
|
3718 | include && pruneCache(name => matches(include, name));
|
3719 | exclude && pruneCache(name => !matches(exclude, name));
|
3720 | },
|
3721 |
|
3722 | { flush: 'post', deep: true });
|
3723 |
|
3724 | let pendingCacheKey = null;
|
3725 | const cacheSubtree = () => {
|
3726 |
|
3727 | if (pendingCacheKey != null) {
|
3728 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
3729 | }
|
3730 | };
|
3731 | onMounted(cacheSubtree);
|
3732 | onUpdated(cacheSubtree);
|
3733 | onBeforeUnmount(() => {
|
3734 | cache.forEach(cached => {
|
3735 | const { subTree, suspense } = instance;
|
3736 | const vnode = getInnerChild(subTree);
|
3737 | if (cached.type === vnode.type) {
|
3738 |
|
3739 | resetShapeFlag(vnode);
|
3740 |
|
3741 | const da = vnode.component.da;
|
3742 | da && queuePostRenderEffect(da, suspense);
|
3743 | return;
|
3744 | }
|
3745 | unmount(cached);
|
3746 | });
|
3747 | });
|
3748 | return () => {
|
3749 | pendingCacheKey = null;
|
3750 | if (!slots.default) {
|
3751 | return null;
|
3752 | }
|
3753 | const children = slots.default();
|
3754 | const rawVNode = children[0];
|
3755 | if (children.length > 1) {
|
3756 | {
|
3757 | warn(`KeepAlive should contain exactly one component child.`);
|
3758 | }
|
3759 | current = null;
|
3760 | return children;
|
3761 | }
|
3762 | else if (!isVNode(rawVNode) ||
|
3763 | (!(rawVNode.shapeFlag & 4 ) &&
|
3764 | !(rawVNode.shapeFlag & 128 ))) {
|
3765 | current = null;
|
3766 | return rawVNode;
|
3767 | }
|
3768 | let vnode = getInnerChild(rawVNode);
|
3769 | const comp = vnode.type;
|
3770 | const name = getComponentName(comp);
|
3771 | const { include, exclude, max } = props;
|
3772 | if ((include && (!name || !matches(include, name))) ||
|
3773 | (exclude && name && matches(exclude, name))) {
|
3774 | current = vnode;
|
3775 | return rawVNode;
|
3776 | }
|
3777 | const key = vnode.key == null ? comp : vnode.key;
|
3778 | const cachedVNode = cache.get(key);
|
3779 |
|
3780 | if (vnode.el) {
|
3781 | vnode = cloneVNode(vnode);
|
3782 | if (rawVNode.shapeFlag & 128 ) {
|
3783 | rawVNode.ssContent = vnode;
|
3784 | }
|
3785 | }
|
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 | pendingCacheKey = key;
|
3792 | if (cachedVNode) {
|
3793 |
|
3794 | vnode.el = cachedVNode.el;
|
3795 | vnode.component = cachedVNode.component;
|
3796 | if (vnode.transition) {
|
3797 |
|
3798 | setTransitionHooks(vnode, vnode.transition);
|
3799 | }
|
3800 |
|
3801 | vnode.shapeFlag |= 512 ;
|
3802 |
|
3803 | keys.delete(key);
|
3804 | keys.add(key);
|
3805 | }
|
3806 | else {
|
3807 | keys.add(key);
|
3808 |
|
3809 | if (max && keys.size > parseInt(max, 10)) {
|
3810 | pruneCacheEntry(keys.values().next().value);
|
3811 | }
|
3812 | }
|
3813 |
|
3814 | vnode.shapeFlag |= 256 ;
|
3815 | current = vnode;
|
3816 | return rawVNode;
|
3817 | };
|
3818 | }
|
3819 | };
|
3820 |
|
3821 |
|
3822 | const KeepAlive = KeepAliveImpl;
|
3823 | function matches(pattern, name) {
|
3824 | if (isArray(pattern)) {
|
3825 | return pattern.some((p) => matches(p, name));
|
3826 | }
|
3827 | else if (isString(pattern)) {
|
3828 | return pattern.split(',').indexOf(name) > -1;
|
3829 | }
|
3830 | else if (pattern.test) {
|
3831 | return pattern.test(name);
|
3832 | }
|
3833 |
|
3834 | return false;
|
3835 | }
|
3836 | function onActivated(hook, target) {
|
3837 | registerKeepAliveHook(hook, "a" , target);
|
3838 | }
|
3839 | function onDeactivated(hook, target) {
|
3840 | registerKeepAliveHook(hook, "da" , target);
|
3841 | }
|
3842 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
3843 |
|
3844 |
|
3845 |
|
3846 | const wrappedHook = hook.__wdc ||
|
3847 | (hook.__wdc = () => {
|
3848 |
|
3849 | let current = target;
|
3850 | while (current) {
|
3851 | if (current.isDeactivated) {
|
3852 | return;
|
3853 | }
|
3854 | current = current.parent;
|
3855 | }
|
3856 | hook();
|
3857 | });
|
3858 | injectHook(type, wrappedHook, target);
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 | if (target) {
|
3865 | let current = target.parent;
|
3866 | while (current && current.parent) {
|
3867 | if (isKeepAlive(current.parent.vnode)) {
|
3868 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
3869 | }
|
3870 | current = current.parent;
|
3871 | }
|
3872 | }
|
3873 | }
|
3874 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
3875 |
|
3876 |
|
3877 | const injected = injectHook(type, hook, keepAliveRoot, true );
|
3878 | onUnmounted(() => {
|
3879 | remove(keepAliveRoot[type], injected);
|
3880 | }, target);
|
3881 | }
|
3882 | function resetShapeFlag(vnode) {
|
3883 | let shapeFlag = vnode.shapeFlag;
|
3884 | if (shapeFlag & 256 ) {
|
3885 | shapeFlag -= 256 ;
|
3886 | }
|
3887 | if (shapeFlag & 512 ) {
|
3888 | shapeFlag -= 512 ;
|
3889 | }
|
3890 | vnode.shapeFlag = shapeFlag;
|
3891 | }
|
3892 | function getInnerChild(vnode) {
|
3893 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
3894 | }
|
3895 |
|
3896 | const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
3897 | const normalizeSlotValue = (value) => isArray(value)
|
3898 | ? value.map(normalizeVNode)
|
3899 | : [normalizeVNode(value)];
|
3900 | const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => {
|
3901 | if (currentInstance) {
|
3902 | warn(`Slot "${key}" invoked outside of the render function: ` +
|
3903 | `this will not track dependencies used in the slot. ` +
|
3904 | `Invoke the slot function inside the render function instead.`);
|
3905 | }
|
3906 | return normalizeSlotValue(rawSlot(props));
|
3907 | }, ctx);
|
3908 | const normalizeObjectSlots = (rawSlots, slots) => {
|
3909 | const ctx = rawSlots._ctx;
|
3910 | for (const key in rawSlots) {
|
3911 | if (isInternalKey(key))
|
3912 | continue;
|
3913 | const value = rawSlots[key];
|
3914 | if (isFunction(value)) {
|
3915 | slots[key] = normalizeSlot(key, value, ctx);
|
3916 | }
|
3917 | else if (value != null) {
|
3918 | {
|
3919 | warn(`Non-function value encountered for slot "${key}". ` +
|
3920 | `Prefer function slots for better performance.`);
|
3921 | }
|
3922 | const normalized = normalizeSlotValue(value);
|
3923 | slots[key] = () => normalized;
|
3924 | }
|
3925 | }
|
3926 | };
|
3927 | const normalizeVNodeSlots = (instance, children) => {
|
3928 | if (!isKeepAlive(instance.vnode)) {
|
3929 | warn(`Non-function value encountered for default slot. ` +
|
3930 | `Prefer function slots for better performance.`);
|
3931 | }
|
3932 | const normalized = normalizeSlotValue(children);
|
3933 | instance.slots.default = () => normalized;
|
3934 | };
|
3935 | const initSlots = (instance, children) => {
|
3936 | if (instance.vnode.shapeFlag & 32 ) {
|
3937 | const type = children._;
|
3938 | if (type) {
|
3939 | instance.slots = children;
|
3940 |
|
3941 | def(children, '_', type);
|
3942 | }
|
3943 | else {
|
3944 | normalizeObjectSlots(children, (instance.slots = {}));
|
3945 | }
|
3946 | }
|
3947 | else {
|
3948 | instance.slots = {};
|
3949 | if (children) {
|
3950 | normalizeVNodeSlots(instance, children);
|
3951 | }
|
3952 | }
|
3953 | def(instance.slots, InternalObjectKey, 1);
|
3954 | };
|
3955 | const updateSlots = (instance, children) => {
|
3956 | const { vnode, slots } = instance;
|
3957 | let needDeletionCheck = true;
|
3958 | let deletionComparisonTarget = EMPTY_OBJ;
|
3959 | if (vnode.shapeFlag & 32 ) {
|
3960 | const type = children._;
|
3961 | if (type) {
|
3962 |
|
3963 | if (isHmrUpdating) {
|
3964 |
|
3965 |
|
3966 | extend(slots, children);
|
3967 | }
|
3968 | else if (type === 1 ) {
|
3969 |
|
3970 |
|
3971 | needDeletionCheck = false;
|
3972 | }
|
3973 | else {
|
3974 |
|
3975 |
|
3976 | extend(slots, children);
|
3977 | }
|
3978 | }
|
3979 | else {
|
3980 | needDeletionCheck = !children.$stable;
|
3981 | normalizeObjectSlots(children, slots);
|
3982 | }
|
3983 | deletionComparisonTarget = children;
|
3984 | }
|
3985 | else if (children) {
|
3986 |
|
3987 | normalizeVNodeSlots(instance, children);
|
3988 | deletionComparisonTarget = { default: 1 };
|
3989 | }
|
3990 |
|
3991 | if (needDeletionCheck) {
|
3992 | for (const key in slots) {
|
3993 | if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
3994 | delete slots[key];
|
3995 | }
|
3996 | }
|
3997 | }
|
3998 | };
|
3999 |
|
4000 | |
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 | const isBuiltInDirective = makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
|
4013 | function validateDirectiveName(name) {
|
4014 | if (isBuiltInDirective(name)) {
|
4015 | warn('Do not use built-in directive ids as custom directive id: ' + name);
|
4016 | }
|
4017 | }
|
4018 | |
4019 |
|
4020 |
|
4021 | function withDirectives(vnode, directives) {
|
4022 | const internalInstance = currentRenderingInstance;
|
4023 | if (internalInstance === null) {
|
4024 | warn(`withDirectives can only be used inside render functions.`);
|
4025 | return vnode;
|
4026 | }
|
4027 | const instance = internalInstance.proxy;
|
4028 | const bindings = vnode.dirs || (vnode.dirs = []);
|
4029 | for (let i = 0; i < directives.length; i++) {
|
4030 | let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
4031 | if (isFunction(dir)) {
|
4032 | dir = {
|
4033 | mounted: dir,
|
4034 | updated: dir
|
4035 | };
|
4036 | }
|
4037 | bindings.push({
|
4038 | dir,
|
4039 | instance,
|
4040 | value,
|
4041 | oldValue: void 0,
|
4042 | arg,
|
4043 | modifiers
|
4044 | });
|
4045 | }
|
4046 | return vnode;
|
4047 | }
|
4048 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
4049 | const bindings = vnode.dirs;
|
4050 | const oldBindings = prevVNode && prevVNode.dirs;
|
4051 | for (let i = 0; i < bindings.length; i++) {
|
4052 | const binding = bindings[i];
|
4053 | if (oldBindings) {
|
4054 | binding.oldValue = oldBindings[i].value;
|
4055 | }
|
4056 | const hook = binding.dir[name];
|
4057 | if (hook) {
|
4058 | callWithAsyncErrorHandling(hook, instance, 8 , [
|
4059 | vnode.el,
|
4060 | binding,
|
4061 | vnode,
|
4062 | prevVNode
|
4063 | ]);
|
4064 | }
|
4065 | }
|
4066 | }
|
4067 |
|
4068 | function createAppContext() {
|
4069 | return {
|
4070 | app: null,
|
4071 | config: {
|
4072 | isNativeTag: NO,
|
4073 | performance: false,
|
4074 | globalProperties: {},
|
4075 | optionMergeStrategies: {},
|
4076 | isCustomElement: NO,
|
4077 | errorHandler: undefined,
|
4078 | warnHandler: undefined
|
4079 | },
|
4080 | mixins: [],
|
4081 | components: {},
|
4082 | directives: {},
|
4083 | provides: Object.create(null)
|
4084 | };
|
4085 | }
|
4086 | let uid$1 = 0;
|
4087 | function createAppAPI(render, hydrate) {
|
4088 | return function createApp(rootComponent, rootProps = null) {
|
4089 | if (rootProps != null && !isObject(rootProps)) {
|
4090 | warn(`root props passed to app.mount() must be an object.`);
|
4091 | rootProps = null;
|
4092 | }
|
4093 | const context = createAppContext();
|
4094 | const installedPlugins = new Set();
|
4095 | let isMounted = false;
|
4096 | const app = (context.app = {
|
4097 | _uid: uid$1++,
|
4098 | _component: rootComponent,
|
4099 | _props: rootProps,
|
4100 | _container: null,
|
4101 | _context: context,
|
4102 | version,
|
4103 | get config() {
|
4104 | return context.config;
|
4105 | },
|
4106 | set config(v) {
|
4107 | {
|
4108 | warn(`app.config cannot be replaced. Modify individual options instead.`);
|
4109 | }
|
4110 | },
|
4111 | use(plugin, ...options) {
|
4112 | if (installedPlugins.has(plugin)) {
|
4113 | warn(`Plugin has already been applied to target app.`);
|
4114 | }
|
4115 | else if (plugin && isFunction(plugin.install)) {
|
4116 | installedPlugins.add(plugin);
|
4117 | plugin.install(app, ...options);
|
4118 | }
|
4119 | else if (isFunction(plugin)) {
|
4120 | installedPlugins.add(plugin);
|
4121 | plugin(app, ...options);
|
4122 | }
|
4123 | else {
|
4124 | warn(`A plugin must either be a function or an object with an "install" ` +
|
4125 | `function.`);
|
4126 | }
|
4127 | return app;
|
4128 | },
|
4129 | mixin(mixin) {
|
4130 | {
|
4131 | if (!context.mixins.includes(mixin)) {
|
4132 | context.mixins.push(mixin);
|
4133 |
|
4134 |
|
4135 | if (mixin.props || mixin.emits) {
|
4136 | context.deopt = true;
|
4137 | }
|
4138 | }
|
4139 | else {
|
4140 | warn('Mixin has already been applied to target app' +
|
4141 | (mixin.name ? `: ${mixin.name}` : ''));
|
4142 | }
|
4143 | }
|
4144 | return app;
|
4145 | },
|
4146 | component(name, component) {
|
4147 | {
|
4148 | validateComponentName(name, context.config);
|
4149 | }
|
4150 | if (!component) {
|
4151 | return context.components[name];
|
4152 | }
|
4153 | if (context.components[name]) {
|
4154 | warn(`Component "${name}" has already been registered in target app.`);
|
4155 | }
|
4156 | context.components[name] = component;
|
4157 | return app;
|
4158 | },
|
4159 | directive(name, directive) {
|
4160 | {
|
4161 | validateDirectiveName(name);
|
4162 | }
|
4163 | if (!directive) {
|
4164 | return context.directives[name];
|
4165 | }
|
4166 | if (context.directives[name]) {
|
4167 | warn(`Directive "${name}" has already been registered in target app.`);
|
4168 | }
|
4169 | context.directives[name] = directive;
|
4170 | return app;
|
4171 | },
|
4172 | mount(rootContainer, isHydrate) {
|
4173 | if (!isMounted) {
|
4174 | const vnode = createVNode(rootComponent, rootProps);
|
4175 |
|
4176 |
|
4177 | vnode.appContext = context;
|
4178 |
|
4179 | {
|
4180 | context.reload = () => {
|
4181 | render(cloneVNode(vnode), rootContainer);
|
4182 | };
|
4183 | }
|
4184 | if (isHydrate && hydrate) {
|
4185 | hydrate(vnode, rootContainer);
|
4186 | }
|
4187 | else {
|
4188 | render(vnode, rootContainer);
|
4189 | }
|
4190 | isMounted = true;
|
4191 | app._container = rootContainer;
|
4192 | rootContainer.__vue_app__ = app;
|
4193 | {
|
4194 | devtoolsInitApp(app, version);
|
4195 | }
|
4196 | return vnode.component.proxy;
|
4197 | }
|
4198 | else {
|
4199 | warn(`App has already been mounted.\n` +
|
4200 | `If you want to remount the same app, move your app creation logic ` +
|
4201 | `into a factory function and create fresh app instances for each ` +
|
4202 | `mount - e.g. \`const createMyApp = () => createApp(App)\``);
|
4203 | }
|
4204 | },
|
4205 | unmount() {
|
4206 | if (isMounted) {
|
4207 | render(null, app._container);
|
4208 | {
|
4209 | devtoolsUnmountApp(app);
|
4210 | }
|
4211 | delete app._container.__vue_app__;
|
4212 | }
|
4213 | else {
|
4214 | warn(`Cannot unmount an app that is not mounted.`);
|
4215 | }
|
4216 | },
|
4217 | provide(key, value) {
|
4218 | if (key in context.provides) {
|
4219 | warn(`App already provides property with key "${String(key)}". ` +
|
4220 | `It will be overwritten with the new value.`);
|
4221 | }
|
4222 |
|
4223 |
|
4224 | context.provides[key] = value;
|
4225 | return app;
|
4226 | }
|
4227 | });
|
4228 | return app;
|
4229 | };
|
4230 | }
|
4231 |
|
4232 | let hasMismatch = false;
|
4233 | const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
4234 | const isComment = (node) => node.nodeType === 8 ;
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 | function createHydrationFunctions(rendererInternals) {
|
4241 | const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
4242 | const hydrate = (vnode, container) => {
|
4243 | if (!container.hasChildNodes()) {
|
4244 | warn(`Attempting to hydrate existing markup but container is empty. ` +
|
4245 | `Performing full mount instead.`);
|
4246 | patch(null, vnode, container);
|
4247 | return;
|
4248 | }
|
4249 | hasMismatch = false;
|
4250 | hydrateNode(container.firstChild, vnode, null, null);
|
4251 | flushPostFlushCbs();
|
4252 | if (hasMismatch && !false) {
|
4253 |
|
4254 | console.error(`Hydration completed but contains mismatches.`);
|
4255 | }
|
4256 | };
|
4257 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, optimized = false) => {
|
4258 | const isFragmentStart = isComment(node) && node.data === '[';
|
4259 | const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, isFragmentStart);
|
4260 | const { type, ref, shapeFlag } = vnode;
|
4261 | const domType = node.nodeType;
|
4262 | vnode.el = node;
|
4263 | let nextNode = null;
|
4264 | switch (type) {
|
4265 | case Text:
|
4266 | if (domType !== 3 ) {
|
4267 | nextNode = onMismatch();
|
4268 | }
|
4269 | else {
|
4270 | if (node.data !== vnode.children) {
|
4271 | hasMismatch = true;
|
4272 | warn(`Hydration text mismatch:` +
|
4273 | `\n- Client: ${JSON.stringify(node.data)}` +
|
4274 | `\n- Server: ${JSON.stringify(vnode.children)}`);
|
4275 | node.data = vnode.children;
|
4276 | }
|
4277 | nextNode = nextSibling(node);
|
4278 | }
|
4279 | break;
|
4280 | case Comment:
|
4281 | if (domType !== 8 || isFragmentStart) {
|
4282 | nextNode = onMismatch();
|
4283 | }
|
4284 | else {
|
4285 | nextNode = nextSibling(node);
|
4286 | }
|
4287 | break;
|
4288 | case Static:
|
4289 | if (domType !== 1 ) {
|
4290 | nextNode = onMismatch();
|
4291 | }
|
4292 | else {
|
4293 |
|
4294 | nextNode = node;
|
4295 |
|
4296 |
|
4297 | const needToAdoptContent = !vnode.children.length;
|
4298 | for (let i = 0; i < vnode.staticCount; i++) {
|
4299 | if (needToAdoptContent)
|
4300 | vnode.children += nextNode.outerHTML;
|
4301 | if (i === vnode.staticCount - 1) {
|
4302 | vnode.anchor = nextNode;
|
4303 | }
|
4304 | nextNode = nextSibling(nextNode);
|
4305 | }
|
4306 | return nextNode;
|
4307 | }
|
4308 | break;
|
4309 | case Fragment:
|
4310 | if (!isFragmentStart) {
|
4311 | nextNode = onMismatch();
|
4312 | }
|
4313 | else {
|
4314 | nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, optimized);
|
4315 | }
|
4316 | break;
|
4317 | default:
|
4318 | if (shapeFlag & 1 ) {
|
4319 | if (domType !== 1 ||
|
4320 | vnode.type !== node.tagName.toLowerCase()) {
|
4321 | nextNode = onMismatch();
|
4322 | }
|
4323 | else {
|
4324 | nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, optimized);
|
4325 | }
|
4326 | }
|
4327 | else if (shapeFlag & 6 ) {
|
4328 |
|
4329 |
|
4330 |
|
4331 | const container = parentNode(node);
|
4332 | const hydrateComponent = () => {
|
4333 | mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);
|
4334 | };
|
4335 |
|
4336 | const loadAsync = vnode.type.__asyncLoader;
|
4337 | if (loadAsync) {
|
4338 | loadAsync().then(hydrateComponent);
|
4339 | }
|
4340 | else {
|
4341 | hydrateComponent();
|
4342 | }
|
4343 |
|
4344 |
|
4345 |
|
4346 | nextNode = isFragmentStart
|
4347 | ? locateClosingAsyncAnchor(node)
|
4348 | : nextSibling(node);
|
4349 | }
|
4350 | else if (shapeFlag & 64 ) {
|
4351 | if (domType !== 8 ) {
|
4352 | nextNode = onMismatch();
|
4353 | }
|
4354 | else {
|
4355 | nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, optimized, rendererInternals, hydrateChildren);
|
4356 | }
|
4357 | }
|
4358 | else if (shapeFlag & 128 ) {
|
4359 | nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), optimized, rendererInternals, hydrateNode);
|
4360 | }
|
4361 | else {
|
4362 | warn('Invalid HostVNode type:', type, `(${typeof type})`);
|
4363 | }
|
4364 | }
|
4365 | if (ref != null) {
|
4366 | setRef(ref, null, parentSuspense, vnode);
|
4367 | }
|
4368 | return nextNode;
|
4369 | };
|
4370 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, optimized) => {
|
4371 | optimized = optimized || !!vnode.dynamicChildren;
|
4372 | const { props, patchFlag, shapeFlag, dirs } = vnode;
|
4373 |
|
4374 | if (patchFlag !== -1 ) {
|
4375 | if (dirs) {
|
4376 | invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
4377 | }
|
4378 |
|
4379 | if (props) {
|
4380 | if (!optimized ||
|
4381 | (patchFlag & 16 ||
|
4382 | patchFlag & 32 )) {
|
4383 | for (const key in props) {
|
4384 | if (!isReservedProp(key) && isOn(key)) {
|
4385 | patchProp(el, key, null, props[key]);
|
4386 | }
|
4387 | }
|
4388 | }
|
4389 | else if (props.onClick) {
|
4390 |
|
4391 |
|
4392 | patchProp(el, 'onClick', null, props.onClick);
|
4393 | }
|
4394 | }
|
4395 |
|
4396 | let vnodeHooks;
|
4397 | if ((vnodeHooks = props && props.onVnodeBeforeMount)) {
|
4398 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
4399 | }
|
4400 | if (dirs) {
|
4401 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
|
4402 | }
|
4403 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
|
4404 | queueEffectWithSuspense(() => {
|
4405 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
4406 | dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
|
4407 | }, parentSuspense);
|
4408 | }
|
4409 |
|
4410 | if (shapeFlag & 16 &&
|
4411 |
|
4412 | !(props && (props.innerHTML || props.textContent))) {
|
4413 | let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, optimized);
|
4414 | let hasWarned = false;
|
4415 | while (next) {
|
4416 | hasMismatch = true;
|
4417 | if (!hasWarned) {
|
4418 | warn(`Hydration children mismatch in <${vnode.type}>: ` +
|
4419 | `server rendered element contains more child nodes than client vdom.`);
|
4420 | hasWarned = true;
|
4421 | }
|
4422 |
|
4423 | const cur = next;
|
4424 | next = next.nextSibling;
|
4425 | remove(cur);
|
4426 | }
|
4427 | }
|
4428 | else if (shapeFlag & 8 ) {
|
4429 | if (el.textContent !== vnode.children) {
|
4430 | hasMismatch = true;
|
4431 | warn(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
4432 | `- Client: ${el.textContent}\n` +
|
4433 | `- Server: ${vnode.children}`);
|
4434 | el.textContent = vnode.children;
|
4435 | }
|
4436 | }
|
4437 | }
|
4438 | return el.nextSibling;
|
4439 | };
|
4440 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, optimized) => {
|
4441 | optimized = optimized || !!parentVNode.dynamicChildren;
|
4442 | const children = parentVNode.children;
|
4443 | const l = children.length;
|
4444 | let hasWarned = false;
|
4445 | for (let i = 0; i < l; i++) {
|
4446 | const vnode = optimized
|
4447 | ? children[i]
|
4448 | : (children[i] = normalizeVNode(children[i]));
|
4449 | if (node) {
|
4450 | node = hydrateNode(node, vnode, parentComponent, parentSuspense, optimized);
|
4451 | }
|
4452 | else {
|
4453 | hasMismatch = true;
|
4454 | if (!hasWarned) {
|
4455 | warn(`Hydration children mismatch in <${container.tagName.toLowerCase()}>: ` +
|
4456 | `server rendered element contains fewer child nodes than client vdom.`);
|
4457 | hasWarned = true;
|
4458 | }
|
4459 |
|
4460 | patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container));
|
4461 | }
|
4462 | }
|
4463 | return node;
|
4464 | };
|
4465 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, optimized) => {
|
4466 | const container = parentNode(node);
|
4467 | const next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, optimized);
|
4468 | if (next && isComment(next) && next.data === ']') {
|
4469 | return nextSibling((vnode.anchor = next));
|
4470 | }
|
4471 | else {
|
4472 |
|
4473 |
|
4474 | hasMismatch = true;
|
4475 |
|
4476 | insert((vnode.anchor = createComment(`]`)), container, next);
|
4477 | return next;
|
4478 | }
|
4479 | };
|
4480 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, isFragment) => {
|
4481 | hasMismatch = true;
|
4482 | warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3
|
4483 | ? `(text)`
|
4484 | : isComment(node) && node.data === '['
|
4485 | ? `(start of fragment)`
|
4486 | : ``);
|
4487 | vnode.el = null;
|
4488 | if (isFragment) {
|
4489 |
|
4490 | const end = locateClosingAsyncAnchor(node);
|
4491 | while (true) {
|
4492 | const next = nextSibling(node);
|
4493 | if (next && next !== end) {
|
4494 | remove(next);
|
4495 | }
|
4496 | else {
|
4497 | break;
|
4498 | }
|
4499 | }
|
4500 | }
|
4501 | const next = nextSibling(node);
|
4502 | const container = parentNode(node);
|
4503 | remove(node);
|
4504 | patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container));
|
4505 | return next;
|
4506 | };
|
4507 | const locateClosingAsyncAnchor = (node) => {
|
4508 | let match = 0;
|
4509 | while (node) {
|
4510 | node = nextSibling(node);
|
4511 | if (node && isComment(node)) {
|
4512 | if (node.data === '[')
|
4513 | match++;
|
4514 | if (node.data === ']') {
|
4515 | if (match === 0) {
|
4516 | return nextSibling(node);
|
4517 | }
|
4518 | else {
|
4519 | match--;
|
4520 | }
|
4521 | }
|
4522 | }
|
4523 | }
|
4524 | return node;
|
4525 | };
|
4526 | return [hydrate, hydrateNode];
|
4527 | }
|
4528 |
|
4529 | let supported;
|
4530 | let perf;
|
4531 | function startMeasure(instance, type) {
|
4532 | if (instance.appContext.config.performance && isSupported()) {
|
4533 | perf.mark(`vue-${type}-${instance.uid}`);
|
4534 | }
|
4535 | }
|
4536 | function endMeasure(instance, type) {
|
4537 | if (instance.appContext.config.performance && isSupported()) {
|
4538 | const startTag = `vue-${type}-${instance.uid}`;
|
4539 | const endTag = startTag + `:end`;
|
4540 | perf.mark(endTag);
|
4541 | perf.measure(`<${formatComponentName(instance, instance.type)}> ${type}`, startTag, endTag);
|
4542 | perf.clearMarks(startTag);
|
4543 | perf.clearMarks(endTag);
|
4544 | }
|
4545 | }
|
4546 | function isSupported() {
|
4547 | if (supported !== undefined) {
|
4548 | return supported;
|
4549 | }
|
4550 |
|
4551 | if (typeof window !== 'undefined' && window.performance) {
|
4552 | supported = true;
|
4553 | perf = window.performance;
|
4554 | }
|
4555 | else {
|
4556 | supported = false;
|
4557 | }
|
4558 |
|
4559 | return supported;
|
4560 | }
|
4561 |
|
4562 |
|
4563 | function defineComponent(options) {
|
4564 | return isFunction(options) ? { setup: options, name: options.name } : options;
|
4565 | }
|
4566 |
|
4567 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
4568 | function defineAsyncComponent(source) {
|
4569 | if (isFunction(source)) {
|
4570 | source = { loader: source };
|
4571 | }
|
4572 | const { loader, loadingComponent, errorComponent, delay = 200, timeout,
|
4573 | suspensible = true, onError: userOnError } = source;
|
4574 | let pendingRequest = null;
|
4575 | let resolvedComp;
|
4576 | let retries = 0;
|
4577 | const retry = () => {
|
4578 | retries++;
|
4579 | pendingRequest = null;
|
4580 | return load();
|
4581 | };
|
4582 | const load = () => {
|
4583 | let thisRequest;
|
4584 | return (pendingRequest ||
|
4585 | (thisRequest = pendingRequest = loader()
|
4586 | .catch(err => {
|
4587 | err = err instanceof Error ? err : new Error(String(err));
|
4588 | if (userOnError) {
|
4589 | return new Promise((resolve, reject) => {
|
4590 | const userRetry = () => resolve(retry());
|
4591 | const userFail = () => reject(err);
|
4592 | userOnError(err, userRetry, userFail, retries + 1);
|
4593 | });
|
4594 | }
|
4595 | else {
|
4596 | throw err;
|
4597 | }
|
4598 | })
|
4599 | .then((comp) => {
|
4600 | if (thisRequest !== pendingRequest && pendingRequest) {
|
4601 | return pendingRequest;
|
4602 | }
|
4603 | if (!comp) {
|
4604 | warn(`Async component loader resolved to undefined. ` +
|
4605 | `If you are using retry(), make sure to return its return value.`);
|
4606 | }
|
4607 |
|
4608 | if (comp &&
|
4609 | (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
4610 | comp = comp.default;
|
4611 | }
|
4612 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
4613 | throw new Error(`Invalid async component load result: ${comp}`);
|
4614 | }
|
4615 | resolvedComp = comp;
|
4616 | return comp;
|
4617 | })));
|
4618 | };
|
4619 | return defineComponent({
|
4620 | __asyncLoader: load,
|
4621 | name: 'AsyncComponentWrapper',
|
4622 | setup() {
|
4623 | const instance = currentInstance;
|
4624 |
|
4625 | if (resolvedComp) {
|
4626 | return () => createInnerComp(resolvedComp, instance);
|
4627 | }
|
4628 | const onError = (err) => {
|
4629 | pendingRequest = null;
|
4630 | handleError(err, instance, 13 , !errorComponent );
|
4631 | };
|
4632 |
|
4633 | if ((suspensible && instance.suspense) ||
|
4634 | (false )) {
|
4635 | return load()
|
4636 | .then(comp => {
|
4637 | return () => createInnerComp(comp, instance);
|
4638 | })
|
4639 | .catch(err => {
|
4640 | onError(err);
|
4641 | return () => errorComponent
|
4642 | ? createVNode(errorComponent, {
|
4643 | error: err
|
4644 | })
|
4645 | : null;
|
4646 | });
|
4647 | }
|
4648 | const loaded = ref(false);
|
4649 | const error = ref();
|
4650 | const delayed = ref(!!delay);
|
4651 | if (delay) {
|
4652 | setTimeout(() => {
|
4653 | delayed.value = false;
|
4654 | }, delay);
|
4655 | }
|
4656 | if (timeout != null) {
|
4657 | setTimeout(() => {
|
4658 | if (!loaded.value && !error.value) {
|
4659 | const err = new Error(`Async component timed out after ${timeout}ms.`);
|
4660 | onError(err);
|
4661 | error.value = err;
|
4662 | }
|
4663 | }, timeout);
|
4664 | }
|
4665 | load()
|
4666 | .then(() => {
|
4667 | loaded.value = true;
|
4668 | })
|
4669 | .catch(err => {
|
4670 | onError(err);
|
4671 | error.value = err;
|
4672 | });
|
4673 | return () => {
|
4674 | if (loaded.value && resolvedComp) {
|
4675 | return createInnerComp(resolvedComp, instance);
|
4676 | }
|
4677 | else if (error.value && errorComponent) {
|
4678 | return createVNode(errorComponent, {
|
4679 | error: error.value
|
4680 | });
|
4681 | }
|
4682 | else if (loadingComponent && !delayed.value) {
|
4683 | return createVNode(loadingComponent);
|
4684 | }
|
4685 | };
|
4686 | }
|
4687 | });
|
4688 | }
|
4689 | function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
4690 | const vnode = createVNode(comp, props, children);
|
4691 |
|
4692 | vnode.ref = ref;
|
4693 | return vnode;
|
4694 | }
|
4695 |
|
4696 | function createDevEffectOptions(instance) {
|
4697 | return {
|
4698 | scheduler: queueJob,
|
4699 | allowRecurse: true,
|
4700 | onTrack: instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0,
|
4701 | onTrigger: instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0
|
4702 | };
|
4703 | }
|
4704 | const queuePostRenderEffect = queueEffectWithSuspense
|
4705 | ;
|
4706 | const setRef = (rawRef, oldRawRef, parentSuspense, vnode) => {
|
4707 | if (isArray(rawRef)) {
|
4708 | rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode));
|
4709 | return;
|
4710 | }
|
4711 | let value;
|
4712 | if (!vnode || isAsyncWrapper(vnode)) {
|
4713 | value = null;
|
4714 | }
|
4715 | else {
|
4716 | if (vnode.shapeFlag & 4 ) {
|
4717 | value = vnode.component.exposed || vnode.component.proxy;
|
4718 | }
|
4719 | else {
|
4720 | value = vnode.el;
|
4721 | }
|
4722 | }
|
4723 | const { i: owner, r: ref } = rawRef;
|
4724 | if (!owner) {
|
4725 | warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
4726 | `A vnode with ref must be created inside the render function.`);
|
4727 | return;
|
4728 | }
|
4729 | const oldRef = oldRawRef && oldRawRef.r;
|
4730 | const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
4731 | const setupState = owner.setupState;
|
4732 |
|
4733 | if (oldRef != null && oldRef !== ref) {
|
4734 | if (isString(oldRef)) {
|
4735 | refs[oldRef] = null;
|
4736 | if (hasOwn(setupState, oldRef)) {
|
4737 | setupState[oldRef] = null;
|
4738 | }
|
4739 | }
|
4740 | else if (isRef(oldRef)) {
|
4741 | oldRef.value = null;
|
4742 | }
|
4743 | }
|
4744 | if (isString(ref)) {
|
4745 | const doSet = () => {
|
4746 | refs[ref] = value;
|
4747 | if (hasOwn(setupState, ref)) {
|
4748 | setupState[ref] = value;
|
4749 | }
|
4750 | };
|
4751 |
|
4752 |
|
4753 |
|
4754 | if (value) {
|
4755 | doSet.id = -1;
|
4756 | queuePostRenderEffect(doSet, parentSuspense);
|
4757 | }
|
4758 | else {
|
4759 | doSet();
|
4760 | }
|
4761 | }
|
4762 | else if (isRef(ref)) {
|
4763 | const doSet = () => {
|
4764 | ref.value = value;
|
4765 | };
|
4766 | if (value) {
|
4767 | doSet.id = -1;
|
4768 | queuePostRenderEffect(doSet, parentSuspense);
|
4769 | }
|
4770 | else {
|
4771 | doSet();
|
4772 | }
|
4773 | }
|
4774 | else if (isFunction(ref)) {
|
4775 | callWithErrorHandling(ref, owner, 12 , [value, refs]);
|
4776 | }
|
4777 | else {
|
4778 | warn('Invalid template ref type:', value, `(${typeof value})`);
|
4779 | }
|
4780 | };
|
4781 | |
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 | function createRenderer(options) {
|
4797 | return baseCreateRenderer(options);
|
4798 | }
|
4799 |
|
4800 |
|
4801 |
|
4802 | function createHydrationRenderer(options) {
|
4803 | return baseCreateRenderer(options, createHydrationFunctions);
|
4804 | }
|
4805 |
|
4806 | function baseCreateRenderer(options, createHydrationFns) {
|
4807 | {
|
4808 | const target = getGlobalThis();
|
4809 | target.__VUE__ = true;
|
4810 | setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
|
4811 | }
|
4812 | const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
|
4813 |
|
4814 |
|
4815 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, optimized = false) => {
|
4816 |
|
4817 | if (n1 && !isSameVNodeType(n1, n2)) {
|
4818 | anchor = getNextHostNode(n1);
|
4819 | unmount(n1, parentComponent, parentSuspense, true);
|
4820 | n1 = null;
|
4821 | }
|
4822 | if (n2.patchFlag === -2 ) {
|
4823 | optimized = false;
|
4824 | n2.dynamicChildren = null;
|
4825 | }
|
4826 | const { type, ref, shapeFlag } = n2;
|
4827 | switch (type) {
|
4828 | case Text:
|
4829 | processText(n1, n2, container, anchor);
|
4830 | break;
|
4831 | case Comment:
|
4832 | processCommentNode(n1, n2, container, anchor);
|
4833 | break;
|
4834 | case Static:
|
4835 | if (n1 == null) {
|
4836 | mountStaticNode(n2, container, anchor, isSVG);
|
4837 | }
|
4838 | else {
|
4839 | patchStaticNode(n1, n2, container, isSVG);
|
4840 | }
|
4841 | break;
|
4842 | case Fragment:
|
4843 | processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
4844 | break;
|
4845 | default:
|
4846 | if (shapeFlag & 1 ) {
|
4847 | processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
4848 | }
|
4849 | else if (shapeFlag & 6 ) {
|
4850 | processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
4851 | }
|
4852 | else if (shapeFlag & 64 ) {
|
4853 | type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);
|
4854 | }
|
4855 | else if (shapeFlag & 128 ) {
|
4856 | type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);
|
4857 | }
|
4858 | else {
|
4859 | warn('Invalid VNode type:', type, `(${typeof type})`);
|
4860 | }
|
4861 | }
|
4862 |
|
4863 | if (ref != null && parentComponent) {
|
4864 | setRef(ref, n1 && n1.ref, parentSuspense, n2);
|
4865 | }
|
4866 | };
|
4867 | const processText = (n1, n2, container, anchor) => {
|
4868 | if (n1 == null) {
|
4869 | hostInsert((n2.el = hostCreateText(n2.children)), container, anchor);
|
4870 | }
|
4871 | else {
|
4872 | const el = (n2.el = n1.el);
|
4873 | if (n2.children !== n1.children) {
|
4874 | hostSetText(el, n2.children);
|
4875 | }
|
4876 | }
|
4877 | };
|
4878 | const processCommentNode = (n1, n2, container, anchor) => {
|
4879 | if (n1 == null) {
|
4880 | hostInsert((n2.el = hostCreateComment(n2.children || '')), container, anchor);
|
4881 | }
|
4882 | else {
|
4883 |
|
4884 | n2.el = n1.el;
|
4885 | }
|
4886 | };
|
4887 | const mountStaticNode = (n2, container, anchor, isSVG) => {
|
4888 | [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
|
4889 | };
|
4890 | |
4891 |
|
4892 |
|
4893 | const patchStaticNode = (n1, n2, container, isSVG) => {
|
4894 |
|
4895 | if (n2.children !== n1.children) {
|
4896 | const anchor = hostNextSibling(n1.anchor);
|
4897 |
|
4898 | removeStaticNode(n1);
|
4899 | [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
|
4900 | }
|
4901 | else {
|
4902 | n2.el = n1.el;
|
4903 | n2.anchor = n1.anchor;
|
4904 | }
|
4905 | };
|
4906 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
4907 | let next;
|
4908 | while (el && el !== anchor) {
|
4909 | next = hostNextSibling(el);
|
4910 | hostInsert(el, container, nextSibling);
|
4911 | el = next;
|
4912 | }
|
4913 | hostInsert(anchor, container, nextSibling);
|
4914 | };
|
4915 | const removeStaticNode = ({ el, anchor }) => {
|
4916 | let next;
|
4917 | while (el && el !== anchor) {
|
4918 | next = hostNextSibling(el);
|
4919 | hostRemove(el);
|
4920 | el = next;
|
4921 | }
|
4922 | hostRemove(anchor);
|
4923 | };
|
4924 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
4925 | isSVG = isSVG || n2.type === 'svg';
|
4926 | if (n1 == null) {
|
4927 | mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
4928 | }
|
4929 | else {
|
4930 | patchElement(n1, n2, parentComponent, parentSuspense, isSVG, optimized);
|
4931 | }
|
4932 | };
|
4933 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
4934 | let el;
|
4935 | let vnodeHook;
|
4936 | const { type, props, shapeFlag, transition, scopeId, patchFlag, dirs } = vnode;
|
4937 | {
|
4938 | el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is);
|
4939 |
|
4940 |
|
4941 | if (shapeFlag & 8 ) {
|
4942 | hostSetElementText(el, vnode.children);
|
4943 | }
|
4944 | else if (shapeFlag & 16 ) {
|
4945 | mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', optimized || !!vnode.dynamicChildren);
|
4946 | }
|
4947 | if (dirs) {
|
4948 | invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
4949 | }
|
4950 |
|
4951 | if (props) {
|
4952 | for (const key in props) {
|
4953 | if (!isReservedProp(key)) {
|
4954 | hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
4955 | }
|
4956 | }
|
4957 | if ((vnodeHook = props.onVnodeBeforeMount)) {
|
4958 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
4959 | }
|
4960 | }
|
4961 |
|
4962 | setScopeId(el, scopeId, vnode, parentComponent);
|
4963 | }
|
4964 | {
|
4965 | Object.defineProperty(el, '__vnode', {
|
4966 | value: vnode,
|
4967 | enumerable: false
|
4968 | });
|
4969 | Object.defineProperty(el, '__vueParentComponent', {
|
4970 | value: parentComponent,
|
4971 | enumerable: false
|
4972 | });
|
4973 | }
|
4974 | if (dirs) {
|
4975 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
|
4976 | }
|
4977 |
|
4978 |
|
4979 | const needCallTransitionHooks = (!parentSuspense || (parentSuspense && !parentSuspense.pendingBranch)) &&
|
4980 | transition &&
|
4981 | !transition.persisted;
|
4982 | if (needCallTransitionHooks) {
|
4983 | transition.beforeEnter(el);
|
4984 | }
|
4985 | hostInsert(el, container, anchor);
|
4986 | if ((vnodeHook = props && props.onVnodeMounted) ||
|
4987 | needCallTransitionHooks ||
|
4988 | dirs) {
|
4989 | queuePostRenderEffect(() => {
|
4990 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
4991 | needCallTransitionHooks && transition.enter(el);
|
4992 | dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
|
4993 | }, parentSuspense);
|
4994 | }
|
4995 | };
|
4996 | const setScopeId = (el, scopeId, vnode, parentComponent) => {
|
4997 | if (scopeId) {
|
4998 | hostSetScopeId(el, scopeId);
|
4999 | }
|
5000 | if (parentComponent) {
|
5001 | const treeOwnerId = parentComponent.type.__scopeId;
|
5002 |
|
5003 |
|
5004 | if (treeOwnerId && treeOwnerId !== scopeId) {
|
5005 | hostSetScopeId(el, treeOwnerId + '-s');
|
5006 | }
|
5007 | let subTree = parentComponent.subTree;
|
5008 | if (subTree.type === Fragment) {
|
5009 | subTree =
|
5010 | filterSingleRoot(subTree.children) || subTree;
|
5011 | }
|
5012 | if (vnode === subTree) {
|
5013 | setScopeId(el, parentComponent.vnode.scopeId, parentComponent.vnode, parentComponent.parent);
|
5014 | }
|
5015 | }
|
5016 | };
|
5017 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, optimized, start = 0) => {
|
5018 | for (let i = start; i < children.length; i++) {
|
5019 | const child = (children[i] = optimized
|
5020 | ? cloneIfMounted(children[i])
|
5021 | : normalizeVNode(children[i]));
|
5022 | patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5023 | }
|
5024 | };
|
5025 | const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, optimized) => {
|
5026 | const el = (n2.el = n1.el);
|
5027 | let { patchFlag, dynamicChildren, dirs } = n2;
|
5028 |
|
5029 |
|
5030 | patchFlag |= n1.patchFlag & 16 ;
|
5031 | const oldProps = n1.props || EMPTY_OBJ;
|
5032 | const newProps = n2.props || EMPTY_OBJ;
|
5033 | let vnodeHook;
|
5034 | if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
5035 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
5036 | }
|
5037 | if (dirs) {
|
5038 | invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
5039 | }
|
5040 | if (isHmrUpdating) {
|
5041 |
|
5042 | patchFlag = 0;
|
5043 | optimized = false;
|
5044 | dynamicChildren = null;
|
5045 | }
|
5046 | if (patchFlag > 0) {
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 | if (patchFlag & 16 ) {
|
5052 |
|
5053 | patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
5054 | }
|
5055 | else {
|
5056 |
|
5057 |
|
5058 | if (patchFlag & 2 ) {
|
5059 | if (oldProps.class !== newProps.class) {
|
5060 | hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
5061 | }
|
5062 | }
|
5063 |
|
5064 |
|
5065 | if (patchFlag & 4 ) {
|
5066 | hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
5067 | }
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 | if (patchFlag & 8 ) {
|
5075 |
|
5076 | const propsToUpdate = n2.dynamicProps;
|
5077 | for (let i = 0; i < propsToUpdate.length; i++) {
|
5078 | const key = propsToUpdate[i];
|
5079 | const prev = oldProps[key];
|
5080 | const next = newProps[key];
|
5081 | if (next !== prev ||
|
5082 | (hostForcePatchProp && hostForcePatchProp(el, key))) {
|
5083 | hostPatchProp(el, key, prev, next, isSVG, n1.children, parentComponent, parentSuspense, unmountChildren);
|
5084 | }
|
5085 | }
|
5086 | }
|
5087 | }
|
5088 |
|
5089 |
|
5090 | if (patchFlag & 1 ) {
|
5091 | if (n1.children !== n2.children) {
|
5092 | hostSetElementText(el, n2.children);
|
5093 | }
|
5094 | }
|
5095 | }
|
5096 | else if (!optimized && dynamicChildren == null) {
|
5097 |
|
5098 | patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
5099 | }
|
5100 | const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
|
5101 | if (dynamicChildren) {
|
5102 | patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG);
|
5103 | if (parentComponent && parentComponent.type.__hmrId) {
|
5104 | traverseStaticChildren(n1, n2);
|
5105 | }
|
5106 | }
|
5107 | else if (!optimized) {
|
5108 |
|
5109 | patchChildren(n1, n2, el, null, parentComponent, parentSuspense, areChildrenSVG);
|
5110 | }
|
5111 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
5112 | queuePostRenderEffect(() => {
|
5113 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
5114 | dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated');
|
5115 | }, parentSuspense);
|
5116 | }
|
5117 | };
|
5118 |
|
5119 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG) => {
|
5120 | for (let i = 0; i < newChildren.length; i++) {
|
5121 | const oldVNode = oldChildren[i];
|
5122 | const newVNode = newChildren[i];
|
5123 |
|
5124 | const container =
|
5125 |
|
5126 |
|
5127 | oldVNode.type === Fragment ||
|
5128 |
|
5129 |
|
5130 | !isSameVNodeType(oldVNode, newVNode) ||
|
5131 |
|
5132 | oldVNode.shapeFlag & 6 ||
|
5133 | oldVNode.shapeFlag & 64
|
5134 | ? hostParentNode(oldVNode.el)
|
5135 | :
|
5136 |
|
5137 | fallbackContainer;
|
5138 | patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, true);
|
5139 | }
|
5140 | };
|
5141 | const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
5142 | if (oldProps !== newProps) {
|
5143 | for (const key in newProps) {
|
5144 |
|
5145 | if (isReservedProp(key))
|
5146 | continue;
|
5147 | const next = newProps[key];
|
5148 | const prev = oldProps[key];
|
5149 | if (next !== prev ||
|
5150 | (hostForcePatchProp && hostForcePatchProp(el, key))) {
|
5151 | hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
5152 | }
|
5153 | }
|
5154 | if (oldProps !== EMPTY_OBJ) {
|
5155 | for (const key in oldProps) {
|
5156 | if (!isReservedProp(key) && !(key in newProps)) {
|
5157 | hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
5158 | }
|
5159 | }
|
5160 | }
|
5161 | }
|
5162 | };
|
5163 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
5164 | const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
5165 | const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
5166 | let { patchFlag, dynamicChildren } = n2;
|
5167 | if (patchFlag > 0) {
|
5168 | optimized = true;
|
5169 | }
|
5170 | if (isHmrUpdating) {
|
5171 |
|
5172 | patchFlag = 0;
|
5173 | optimized = false;
|
5174 | dynamicChildren = null;
|
5175 | }
|
5176 | if (n1 == null) {
|
5177 | hostInsert(fragmentStartAnchor, container, anchor);
|
5178 | hostInsert(fragmentEndAnchor, container, anchor);
|
5179 |
|
5180 |
|
5181 |
|
5182 | mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, optimized);
|
5183 | }
|
5184 | else {
|
5185 | if (patchFlag > 0 &&
|
5186 | patchFlag & 64 &&
|
5187 | dynamicChildren &&
|
5188 |
|
5189 |
|
5190 | n1.dynamicChildren) {
|
5191 |
|
5192 |
|
5193 | patchBlockChildren(n1.dynamicChildren, dynamicChildren, container, parentComponent, parentSuspense, isSVG);
|
5194 | if (parentComponent && parentComponent.type.__hmrId) {
|
5195 | traverseStaticChildren(n1, n2);
|
5196 | }
|
5197 | else if (
|
5198 |
|
5199 |
|
5200 |
|
5201 |
|
5202 | n2.key != null ||
|
5203 | (parentComponent && n2 === parentComponent.subTree)) {
|
5204 | traverseStaticChildren(n1, n2, true );
|
5205 | }
|
5206 | }
|
5207 | else {
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 | patchChildren(n1, n2, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, optimized);
|
5213 | }
|
5214 | }
|
5215 | };
|
5216 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
5217 | if (n1 == null) {
|
5218 | if (n2.shapeFlag & 512 ) {
|
5219 | parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
5220 | }
|
5221 | else {
|
5222 | mountComponent(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5223 | }
|
5224 | }
|
5225 | else {
|
5226 | updateComponent(n1, n2, optimized);
|
5227 | }
|
5228 | };
|
5229 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
5230 | const instance = (initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense));
|
5231 | if (instance.type.__hmrId) {
|
5232 | registerHMR(instance);
|
5233 | }
|
5234 | {
|
5235 | pushWarningContext(initialVNode);
|
5236 | startMeasure(instance, `mount`);
|
5237 | }
|
5238 |
|
5239 | if (isKeepAlive(initialVNode)) {
|
5240 | instance.ctx.renderer = internals;
|
5241 | }
|
5242 |
|
5243 | {
|
5244 | startMeasure(instance, `init`);
|
5245 | }
|
5246 | setupComponent(instance);
|
5247 | {
|
5248 | endMeasure(instance, `init`);
|
5249 | }
|
5250 |
|
5251 |
|
5252 | if (instance.asyncDep) {
|
5253 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
|
5254 |
|
5255 |
|
5256 | if (!initialVNode.el) {
|
5257 | const placeholder = (instance.subTree = createVNode(Comment));
|
5258 | processCommentNode(null, placeholder, container, anchor);
|
5259 | }
|
5260 | return;
|
5261 | }
|
5262 | setupRenderEffect(instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized);
|
5263 | {
|
5264 | popWarningContext();
|
5265 | endMeasure(instance, `mount`);
|
5266 | }
|
5267 | };
|
5268 | const updateComponent = (n1, n2, optimized) => {
|
5269 | const instance = (n2.component = n1.component);
|
5270 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
5271 | if (instance.asyncDep &&
|
5272 | !instance.asyncResolved) {
|
5273 |
|
5274 |
|
5275 | {
|
5276 | pushWarningContext(n2);
|
5277 | }
|
5278 | updateComponentPreRender(instance, n2, optimized);
|
5279 | {
|
5280 | popWarningContext();
|
5281 | }
|
5282 | return;
|
5283 | }
|
5284 | else {
|
5285 |
|
5286 | instance.next = n2;
|
5287 |
|
5288 |
|
5289 | invalidateJob(instance.update);
|
5290 |
|
5291 | instance.update();
|
5292 | }
|
5293 | }
|
5294 | else {
|
5295 |
|
5296 | n2.component = n1.component;
|
5297 | n2.el = n1.el;
|
5298 | instance.vnode = n2;
|
5299 | }
|
5300 | };
|
5301 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
|
5302 |
|
5303 | instance.update = effect(function componentEffect() {
|
5304 | if (!instance.isMounted) {
|
5305 | let vnodeHook;
|
5306 | const { el, props } = initialVNode;
|
5307 | const { bm, m, parent } = instance;
|
5308 |
|
5309 | if (bm) {
|
5310 | invokeArrayFns(bm);
|
5311 | }
|
5312 |
|
5313 | if ((vnodeHook = props && props.onVnodeBeforeMount)) {
|
5314 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
5315 | }
|
5316 |
|
5317 | {
|
5318 | startMeasure(instance, `render`);
|
5319 | }
|
5320 | const subTree = (instance.subTree = renderComponentRoot(instance));
|
5321 | {
|
5322 | endMeasure(instance, `render`);
|
5323 | }
|
5324 | if (el && hydrateNode) {
|
5325 | {
|
5326 | startMeasure(instance, `hydrate`);
|
5327 | }
|
5328 |
|
5329 | hydrateNode(initialVNode.el, subTree, instance, parentSuspense);
|
5330 | {
|
5331 | endMeasure(instance, `hydrate`);
|
5332 | }
|
5333 | }
|
5334 | else {
|
5335 | {
|
5336 | startMeasure(instance, `patch`);
|
5337 | }
|
5338 | patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
|
5339 | {
|
5340 | endMeasure(instance, `patch`);
|
5341 | }
|
5342 | initialVNode.el = subTree.el;
|
5343 | }
|
5344 |
|
5345 | if (m) {
|
5346 | queuePostRenderEffect(m, parentSuspense);
|
5347 | }
|
5348 |
|
5349 | if ((vnodeHook = props && props.onVnodeMounted)) {
|
5350 | const scopedInitialVNode = initialVNode;
|
5351 | queuePostRenderEffect(() => {
|
5352 | invokeVNodeHook(vnodeHook, parent, scopedInitialVNode);
|
5353 | }, parentSuspense);
|
5354 | }
|
5355 |
|
5356 |
|
5357 |
|
5358 | const { a } = instance;
|
5359 | if (a &&
|
5360 | initialVNode.shapeFlag & 256 ) {
|
5361 | queuePostRenderEffect(a, parentSuspense);
|
5362 | }
|
5363 | instance.isMounted = true;
|
5364 | {
|
5365 | devtoolsComponentAdded(instance);
|
5366 | }
|
5367 |
|
5368 | initialVNode = container = anchor = null;
|
5369 | }
|
5370 | else {
|
5371 |
|
5372 |
|
5373 |
|
5374 | let { next, bu, u, parent, vnode } = instance;
|
5375 | let originNext = next;
|
5376 | let vnodeHook;
|
5377 | {
|
5378 | pushWarningContext(next || instance.vnode);
|
5379 | }
|
5380 | if (next) {
|
5381 | next.el = vnode.el;
|
5382 | updateComponentPreRender(instance, next, optimized);
|
5383 | }
|
5384 | else {
|
5385 | next = vnode;
|
5386 | }
|
5387 |
|
5388 | if (bu) {
|
5389 | invokeArrayFns(bu);
|
5390 | }
|
5391 |
|
5392 | if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
5393 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
5394 | }
|
5395 |
|
5396 | {
|
5397 | startMeasure(instance, `render`);
|
5398 | }
|
5399 | const nextTree = renderComponentRoot(instance);
|
5400 | {
|
5401 | endMeasure(instance, `render`);
|
5402 | }
|
5403 | const prevTree = instance.subTree;
|
5404 | instance.subTree = nextTree;
|
5405 | {
|
5406 | startMeasure(instance, `patch`);
|
5407 | }
|
5408 | patch(prevTree, nextTree,
|
5409 |
|
5410 | hostParentNode(prevTree.el),
|
5411 |
|
5412 | getNextHostNode(prevTree), instance, parentSuspense, isSVG);
|
5413 | {
|
5414 | endMeasure(instance, `patch`);
|
5415 | }
|
5416 | next.el = nextTree.el;
|
5417 | if (originNext === null) {
|
5418 |
|
5419 |
|
5420 |
|
5421 | updateHOCHostEl(instance, nextTree.el);
|
5422 | }
|
5423 |
|
5424 | if (u) {
|
5425 | queuePostRenderEffect(u, parentSuspense);
|
5426 | }
|
5427 |
|
5428 | if ((vnodeHook = next.props && next.props.onVnodeUpdated)) {
|
5429 | queuePostRenderEffect(() => {
|
5430 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
5431 | }, parentSuspense);
|
5432 | }
|
5433 | {
|
5434 | devtoolsComponentUpdated(instance);
|
5435 | }
|
5436 | {
|
5437 | popWarningContext();
|
5438 | }
|
5439 | }
|
5440 | }, createDevEffectOptions(instance) );
|
5441 | };
|
5442 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
5443 | nextVNode.component = instance;
|
5444 | const prevProps = instance.vnode.props;
|
5445 | instance.vnode = nextVNode;
|
5446 | instance.next = null;
|
5447 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
5448 | updateSlots(instance, nextVNode.children);
|
5449 |
|
5450 |
|
5451 | flushPreFlushCbs(undefined, instance.update);
|
5452 | };
|
5453 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized = false) => {
|
5454 | const c1 = n1 && n1.children;
|
5455 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
5456 | const c2 = n2.children;
|
5457 | const { patchFlag, shapeFlag } = n2;
|
5458 |
|
5459 | if (patchFlag > 0) {
|
5460 | if (patchFlag & 128 ) {
|
5461 |
|
5462 |
|
5463 | patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5464 | return;
|
5465 | }
|
5466 | else if (patchFlag & 256 ) {
|
5467 |
|
5468 | patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5469 | return;
|
5470 | }
|
5471 | }
|
5472 |
|
5473 | if (shapeFlag & 8 ) {
|
5474 |
|
5475 | if (prevShapeFlag & 16 ) {
|
5476 | unmountChildren(c1, parentComponent, parentSuspense);
|
5477 | }
|
5478 | if (c2 !== c1) {
|
5479 | hostSetElementText(container, c2);
|
5480 | }
|
5481 | }
|
5482 | else {
|
5483 | if (prevShapeFlag & 16 ) {
|
5484 |
|
5485 | if (shapeFlag & 16 ) {
|
5486 |
|
5487 | patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5488 | }
|
5489 | else {
|
5490 |
|
5491 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
5492 | }
|
5493 | }
|
5494 | else {
|
5495 |
|
5496 |
|
5497 | if (prevShapeFlag & 8 ) {
|
5498 | hostSetElementText(container, '');
|
5499 | }
|
5500 |
|
5501 | if (shapeFlag & 16 ) {
|
5502 | mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
5503 | }
|
5504 | }
|
5505 | }
|
5506 | };
|
5507 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
5508 | c1 = c1 || EMPTY_ARR;
|
5509 | c2 = c2 || EMPTY_ARR;
|
5510 | const oldLength = c1.length;
|
5511 | const newLength = c2.length;
|
5512 | const commonLength = Math.min(oldLength, newLength);
|
5513 | let i;
|
5514 | for (i = 0; i < commonLength; i++) {
|
5515 | const nextChild = (c2[i] = optimized
|
5516 | ? cloneIfMounted(c2[i])
|
5517 | : normalizeVNode(c2[i]));
|
5518 | patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, optimized);
|
5519 | }
|
5520 | if (oldLength > newLength) {
|
5521 |
|
5522 | unmountChildren(c1, parentComponent, parentSuspense, true, false, commonLength);
|
5523 | }
|
5524 | else {
|
5525 |
|
5526 | mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, commonLength);
|
5527 | }
|
5528 | };
|
5529 |
|
5530 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
5531 | let i = 0;
|
5532 | const l2 = c2.length;
|
5533 | let e1 = c1.length - 1;
|
5534 | let e2 = l2 - 1;
|
5535 |
|
5536 |
|
5537 |
|
5538 | while (i <= e1 && i <= e2) {
|
5539 | const n1 = c1[i];
|
5540 | const n2 = (c2[i] = optimized
|
5541 | ? cloneIfMounted(c2[i])
|
5542 | : normalizeVNode(c2[i]));
|
5543 | if (isSameVNodeType(n1, n2)) {
|
5544 | patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, optimized);
|
5545 | }
|
5546 | else {
|
5547 | break;
|
5548 | }
|
5549 | i++;
|
5550 | }
|
5551 |
|
5552 |
|
5553 |
|
5554 | while (i <= e1 && i <= e2) {
|
5555 | const n1 = c1[e1];
|
5556 | const n2 = (c2[e2] = optimized
|
5557 | ? cloneIfMounted(c2[e2])
|
5558 | : normalizeVNode(c2[e2]));
|
5559 | if (isSameVNodeType(n1, n2)) {
|
5560 | patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, optimized);
|
5561 | }
|
5562 | else {
|
5563 | break;
|
5564 | }
|
5565 | e1--;
|
5566 | e2--;
|
5567 | }
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 | if (i > e1) {
|
5576 | if (i <= e2) {
|
5577 | const nextPos = e2 + 1;
|
5578 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
5579 | while (i <= e2) {
|
5580 | patch(null, (c2[i] = optimized
|
5581 | ? cloneIfMounted(c2[i])
|
5582 | : normalizeVNode(c2[i])), container, anchor, parentComponent, parentSuspense, isSVG);
|
5583 | i++;
|
5584 | }
|
5585 | }
|
5586 | }
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 | else if (i > e2) {
|
5595 | while (i <= e1) {
|
5596 | unmount(c1[i], parentComponent, parentSuspense, true);
|
5597 | i++;
|
5598 | }
|
5599 | }
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 | else {
|
5605 | const s1 = i;
|
5606 | const s2 = i;
|
5607 |
|
5608 | const keyToNewIndexMap = new Map();
|
5609 | for (i = s2; i <= e2; i++) {
|
5610 | const nextChild = (c2[i] = optimized
|
5611 | ? cloneIfMounted(c2[i])
|
5612 | : normalizeVNode(c2[i]));
|
5613 | if (nextChild.key != null) {
|
5614 | if (keyToNewIndexMap.has(nextChild.key)) {
|
5615 | warn(`Duplicate keys found during update:`, JSON.stringify(nextChild.key), `Make sure keys are unique.`);
|
5616 | }
|
5617 | keyToNewIndexMap.set(nextChild.key, i);
|
5618 | }
|
5619 | }
|
5620 |
|
5621 |
|
5622 | let j;
|
5623 | let patched = 0;
|
5624 | const toBePatched = e2 - s2 + 1;
|
5625 | let moved = false;
|
5626 |
|
5627 | let maxNewIndexSoFar = 0;
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 | const newIndexToOldIndexMap = new Array(toBePatched);
|
5634 | for (i = 0; i < toBePatched; i++)
|
5635 | newIndexToOldIndexMap[i] = 0;
|
5636 | for (i = s1; i <= e1; i++) {
|
5637 | const prevChild = c1[i];
|
5638 | if (patched >= toBePatched) {
|
5639 |
|
5640 | unmount(prevChild, parentComponent, parentSuspense, true);
|
5641 | continue;
|
5642 | }
|
5643 | let newIndex;
|
5644 | if (prevChild.key != null) {
|
5645 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
5646 | }
|
5647 | else {
|
5648 |
|
5649 | for (j = s2; j <= e2; j++) {
|
5650 | if (newIndexToOldIndexMap[j - s2] === 0 &&
|
5651 | isSameVNodeType(prevChild, c2[j])) {
|
5652 | newIndex = j;
|
5653 | break;
|
5654 | }
|
5655 | }
|
5656 | }
|
5657 | if (newIndex === undefined) {
|
5658 | unmount(prevChild, parentComponent, parentSuspense, true);
|
5659 | }
|
5660 | else {
|
5661 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
5662 | if (newIndex >= maxNewIndexSoFar) {
|
5663 | maxNewIndexSoFar = newIndex;
|
5664 | }
|
5665 | else {
|
5666 | moved = true;
|
5667 | }
|
5668 | patch(prevChild, c2[newIndex], container, null, parentComponent, parentSuspense, isSVG, optimized);
|
5669 | patched++;
|
5670 | }
|
5671 | }
|
5672 |
|
5673 |
|
5674 | const increasingNewIndexSequence = moved
|
5675 | ? getSequence(newIndexToOldIndexMap)
|
5676 | : EMPTY_ARR;
|
5677 | j = increasingNewIndexSequence.length - 1;
|
5678 |
|
5679 | for (i = toBePatched - 1; i >= 0; i--) {
|
5680 | const nextIndex = s2 + i;
|
5681 | const nextChild = c2[nextIndex];
|
5682 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
5683 | if (newIndexToOldIndexMap[i] === 0) {
|
5684 |
|
5685 | patch(null, nextChild, container, anchor, parentComponent, parentSuspense, isSVG);
|
5686 | }
|
5687 | else if (moved) {
|
5688 |
|
5689 |
|
5690 |
|
5691 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
5692 | move(nextChild, container, anchor, 2 );
|
5693 | }
|
5694 | else {
|
5695 | j--;
|
5696 | }
|
5697 | }
|
5698 | }
|
5699 | }
|
5700 | };
|
5701 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
5702 | const { el, type, transition, children, shapeFlag } = vnode;
|
5703 | if (shapeFlag & 6 ) {
|
5704 | move(vnode.component.subTree, container, anchor, moveType);
|
5705 | return;
|
5706 | }
|
5707 | if (shapeFlag & 128 ) {
|
5708 | vnode.suspense.move(container, anchor, moveType);
|
5709 | return;
|
5710 | }
|
5711 | if (shapeFlag & 64 ) {
|
5712 | type.move(vnode, container, anchor, internals);
|
5713 | return;
|
5714 | }
|
5715 | if (type === Fragment) {
|
5716 | hostInsert(el, container, anchor);
|
5717 | for (let i = 0; i < children.length; i++) {
|
5718 | move(children[i], container, anchor, moveType);
|
5719 | }
|
5720 | hostInsert(vnode.anchor, container, anchor);
|
5721 | return;
|
5722 | }
|
5723 | if (type === Static) {
|
5724 | moveStaticNode(vnode, container, anchor);
|
5725 | return;
|
5726 | }
|
5727 |
|
5728 | const needTransition = moveType !== 2 &&
|
5729 | shapeFlag & 1 &&
|
5730 | transition;
|
5731 | if (needTransition) {
|
5732 | if (moveType === 0 ) {
|
5733 | transition.beforeEnter(el);
|
5734 | hostInsert(el, container, anchor);
|
5735 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
5736 | }
|
5737 | else {
|
5738 | const { leave, delayLeave, afterLeave } = transition;
|
5739 | const remove = () => hostInsert(el, container, anchor);
|
5740 | const performLeave = () => {
|
5741 | leave(el, () => {
|
5742 | remove();
|
5743 | afterLeave && afterLeave();
|
5744 | });
|
5745 | };
|
5746 | if (delayLeave) {
|
5747 | delayLeave(el, remove, performLeave);
|
5748 | }
|
5749 | else {
|
5750 | performLeave();
|
5751 | }
|
5752 | }
|
5753 | }
|
5754 | else {
|
5755 | hostInsert(el, container, anchor);
|
5756 | }
|
5757 | };
|
5758 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
5759 | const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs } = vnode;
|
5760 |
|
5761 | if (ref != null) {
|
5762 | setRef(ref, null, parentSuspense, null);
|
5763 | }
|
5764 | if (shapeFlag & 256 ) {
|
5765 | parentComponent.ctx.deactivate(vnode);
|
5766 | return;
|
5767 | }
|
5768 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
5769 | let vnodeHook;
|
5770 | if ((vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
5771 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
5772 | }
|
5773 | if (shapeFlag & 6 ) {
|
5774 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
5775 | }
|
5776 | else {
|
5777 | if (shapeFlag & 128 ) {
|
5778 | vnode.suspense.unmount(parentSuspense, doRemove);
|
5779 | return;
|
5780 | }
|
5781 | if (shouldInvokeDirs) {
|
5782 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
5783 | }
|
5784 | if (dynamicChildren &&
|
5785 |
|
5786 | (type !== Fragment ||
|
5787 | (patchFlag > 0 && patchFlag & 64 ))) {
|
5788 |
|
5789 | unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
5790 | }
|
5791 | else if ((type === Fragment &&
|
5792 | (patchFlag & 128 ||
|
5793 | patchFlag & 256 )) ||
|
5794 | (!optimized && shapeFlag & 16 )) {
|
5795 | unmountChildren(children, parentComponent, parentSuspense);
|
5796 | }
|
5797 |
|
5798 | if (shapeFlag & 64 &&
|
5799 | (doRemove || !isTeleportDisabled(vnode.props))) {
|
5800 | vnode.type.remove(vnode, internals);
|
5801 | }
|
5802 | if (doRemove) {
|
5803 | remove(vnode);
|
5804 | }
|
5805 | }
|
5806 | if ((vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
5807 | queuePostRenderEffect(() => {
|
5808 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
5809 | shouldInvokeDirs &&
|
5810 | invokeDirectiveHook(vnode, null, parentComponent, 'unmounted');
|
5811 | }, parentSuspense);
|
5812 | }
|
5813 | };
|
5814 | const remove = vnode => {
|
5815 | const { type, el, anchor, transition } = vnode;
|
5816 | if (type === Fragment) {
|
5817 | removeFragment(el, anchor);
|
5818 | return;
|
5819 | }
|
5820 | if (type === Static) {
|
5821 | removeStaticNode(vnode);
|
5822 | return;
|
5823 | }
|
5824 | const performRemove = () => {
|
5825 | hostRemove(el);
|
5826 | if (transition && !transition.persisted && transition.afterLeave) {
|
5827 | transition.afterLeave();
|
5828 | }
|
5829 | };
|
5830 | if (vnode.shapeFlag & 1 &&
|
5831 | transition &&
|
5832 | !transition.persisted) {
|
5833 | const { leave, delayLeave } = transition;
|
5834 | const performLeave = () => leave(el, performRemove);
|
5835 | if (delayLeave) {
|
5836 | delayLeave(vnode.el, performRemove, performLeave);
|
5837 | }
|
5838 | else {
|
5839 | performLeave();
|
5840 | }
|
5841 | }
|
5842 | else {
|
5843 | performRemove();
|
5844 | }
|
5845 | };
|
5846 | const removeFragment = (cur, end) => {
|
5847 |
|
5848 |
|
5849 | let next;
|
5850 | while (cur !== end) {
|
5851 | next = hostNextSibling(cur);
|
5852 | hostRemove(cur);
|
5853 | cur = next;
|
5854 | }
|
5855 | hostRemove(end);
|
5856 | };
|
5857 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
5858 | if (instance.type.__hmrId) {
|
5859 | unregisterHMR(instance);
|
5860 | }
|
5861 | const { bum, effects, update, subTree, um } = instance;
|
5862 |
|
5863 | if (bum) {
|
5864 | invokeArrayFns(bum);
|
5865 | }
|
5866 | if (effects) {
|
5867 | for (let i = 0; i < effects.length; i++) {
|
5868 | stop(effects[i]);
|
5869 | }
|
5870 | }
|
5871 |
|
5872 |
|
5873 | if (update) {
|
5874 | stop(update);
|
5875 | unmount(subTree, instance, parentSuspense, doRemove);
|
5876 | }
|
5877 |
|
5878 | if (um) {
|
5879 | queuePostRenderEffect(um, parentSuspense);
|
5880 | }
|
5881 | queuePostRenderEffect(() => {
|
5882 | instance.isUnmounted = true;
|
5883 | }, parentSuspense);
|
5884 |
|
5885 |
|
5886 |
|
5887 | if (parentSuspense &&
|
5888 | parentSuspense.pendingBranch &&
|
5889 | !parentSuspense.isUnmounted &&
|
5890 | instance.asyncDep &&
|
5891 | !instance.asyncResolved &&
|
5892 | instance.suspenseId === parentSuspense.pendingId) {
|
5893 | parentSuspense.deps--;
|
5894 | if (parentSuspense.deps === 0) {
|
5895 | parentSuspense.resolve();
|
5896 | }
|
5897 | }
|
5898 | {
|
5899 | devtoolsComponentRemoved(instance);
|
5900 | }
|
5901 | };
|
5902 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
5903 | for (let i = start; i < children.length; i++) {
|
5904 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
5905 | }
|
5906 | };
|
5907 | const getNextHostNode = vnode => {
|
5908 | if (vnode.shapeFlag & 6 ) {
|
5909 | return getNextHostNode(vnode.component.subTree);
|
5910 | }
|
5911 | if (vnode.shapeFlag & 128 ) {
|
5912 | return vnode.suspense.next();
|
5913 | }
|
5914 | return hostNextSibling((vnode.anchor || vnode.el));
|
5915 | };
|
5916 | const render = (vnode, container) => {
|
5917 | if (vnode == null) {
|
5918 | if (container._vnode) {
|
5919 | unmount(container._vnode, null, null, true);
|
5920 | }
|
5921 | }
|
5922 | else {
|
5923 | patch(container._vnode || null, vnode, container);
|
5924 | }
|
5925 | flushPostFlushCbs();
|
5926 | container._vnode = vnode;
|
5927 | };
|
5928 | const internals = {
|
5929 | p: patch,
|
5930 | um: unmount,
|
5931 | m: move,
|
5932 | r: remove,
|
5933 | mt: mountComponent,
|
5934 | mc: mountChildren,
|
5935 | pc: patchChildren,
|
5936 | pbc: patchBlockChildren,
|
5937 | n: getNextHostNode,
|
5938 | o: options
|
5939 | };
|
5940 | let hydrate;
|
5941 | let hydrateNode;
|
5942 | if (createHydrationFns) {
|
5943 | [hydrate, hydrateNode] = createHydrationFns(internals);
|
5944 | }
|
5945 | return {
|
5946 | render,
|
5947 | hydrate,
|
5948 | createApp: createAppAPI(render, hydrate)
|
5949 | };
|
5950 | }
|
5951 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
5952 | callWithAsyncErrorHandling(hook, instance, 7 , [
|
5953 | vnode,
|
5954 | prevVNode
|
5955 | ]);
|
5956 | }
|
5957 | |
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 | function traverseStaticChildren(n1, n2, shallow = false) {
|
5969 | const ch1 = n1.children;
|
5970 | const ch2 = n2.children;
|
5971 | if (isArray(ch1) && isArray(ch2)) {
|
5972 | for (let i = 0; i < ch1.length; i++) {
|
5973 |
|
5974 |
|
5975 | const c1 = ch1[i];
|
5976 | let c2 = ch2[i];
|
5977 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
5978 | if (c2.patchFlag <= 0 || c2.patchFlag === 32 ) {
|
5979 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
5980 | c2.el = c1.el;
|
5981 | }
|
5982 | if (!shallow)
|
5983 | traverseStaticChildren(c1, c2);
|
5984 | }
|
5985 |
|
5986 |
|
5987 | if (c2.type === Comment && !c2.el) {
|
5988 | c2.el = c1.el;
|
5989 | }
|
5990 | }
|
5991 | }
|
5992 | }
|
5993 |
|
5994 | function getSequence(arr) {
|
5995 | const p = arr.slice();
|
5996 | const result = [0];
|
5997 | let i, j, u, v, c;
|
5998 | const len = arr.length;
|
5999 | for (i = 0; i < len; i++) {
|
6000 | const arrI = arr[i];
|
6001 | if (arrI !== 0) {
|
6002 | j = result[result.length - 1];
|
6003 | if (arr[j] < arrI) {
|
6004 | p[i] = j;
|
6005 | result.push(i);
|
6006 | continue;
|
6007 | }
|
6008 | u = 0;
|
6009 | v = result.length - 1;
|
6010 | while (u < v) {
|
6011 | c = ((u + v) / 2) | 0;
|
6012 | if (arr[result[c]] < arrI) {
|
6013 | u = c + 1;
|
6014 | }
|
6015 | else {
|
6016 | v = c;
|
6017 | }
|
6018 | }
|
6019 | if (arrI < arr[result[u]]) {
|
6020 | if (u > 0) {
|
6021 | p[i] = result[u - 1];
|
6022 | }
|
6023 | result[u] = i;
|
6024 | }
|
6025 | }
|
6026 | }
|
6027 | u = result.length;
|
6028 | v = result[u - 1];
|
6029 | while (u-- > 0) {
|
6030 | result[u] = v;
|
6031 | v = p[v];
|
6032 | }
|
6033 | return result;
|
6034 | }
|
6035 |
|
6036 | const isTeleport = (type) => type.__isTeleport;
|
6037 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === '');
|
6038 | const isTargetSVG = (target) => typeof SVGElement !== 'undefined' && target instanceof SVGElement;
|
6039 | const resolveTarget = (props, select) => {
|
6040 | const targetSelector = props && props.to;
|
6041 | if (isString(targetSelector)) {
|
6042 | if (!select) {
|
6043 | warn(`Current renderer does not support string target for Teleports. ` +
|
6044 | `(missing querySelector renderer option)`);
|
6045 | return null;
|
6046 | }
|
6047 | else {
|
6048 | const target = select(targetSelector);
|
6049 | if (!target) {
|
6050 | warn(`Failed to locate Teleport target with selector "${targetSelector}". ` +
|
6051 | `Note the target element must exist before the component is mounted - ` +
|
6052 | `i.e. the target cannot be rendered by the component itself, and ` +
|
6053 | `ideally should be outside of the entire Vue component tree.`);
|
6054 | }
|
6055 | return target;
|
6056 | }
|
6057 | }
|
6058 | else {
|
6059 | if (!targetSelector && !isTeleportDisabled(props)) {
|
6060 | warn(`Invalid Teleport target: ${targetSelector}`);
|
6061 | }
|
6062 | return targetSelector;
|
6063 | }
|
6064 | };
|
6065 | const TeleportImpl = {
|
6066 | __isTeleport: true,
|
6067 | process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals) {
|
6068 | const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
6069 | const disabled = isTeleportDisabled(n2.props);
|
6070 | const { shapeFlag, children } = n2;
|
6071 | if (n1 == null) {
|
6072 |
|
6073 | const placeholder = (n2.el = createComment('teleport start')
|
6074 | );
|
6075 | const mainAnchor = (n2.anchor = createComment('teleport end')
|
6076 | );
|
6077 | insert(placeholder, container, anchor);
|
6078 | insert(mainAnchor, container, anchor);
|
6079 | const target = (n2.target = resolveTarget(n2.props, querySelector));
|
6080 | const targetAnchor = (n2.targetAnchor = createText(''));
|
6081 | if (target) {
|
6082 | insert(targetAnchor, target);
|
6083 |
|
6084 | isSVG = isSVG || isTargetSVG(target);
|
6085 | }
|
6086 | else if (!disabled) {
|
6087 | warn('Invalid Teleport target on mount:', target, `(${typeof target})`);
|
6088 | }
|
6089 | const mount = (container, anchor) => {
|
6090 |
|
6091 |
|
6092 | if (shapeFlag & 16 ) {
|
6093 | mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
6094 | }
|
6095 | };
|
6096 | if (disabled) {
|
6097 | mount(container, mainAnchor);
|
6098 | }
|
6099 | else if (target) {
|
6100 | mount(target, targetAnchor);
|
6101 | }
|
6102 | }
|
6103 | else {
|
6104 |
|
6105 | n2.el = n1.el;
|
6106 | const mainAnchor = (n2.anchor = n1.anchor);
|
6107 | const target = (n2.target = n1.target);
|
6108 | const targetAnchor = (n2.targetAnchor = n1.targetAnchor);
|
6109 | const wasDisabled = isTeleportDisabled(n1.props);
|
6110 | const currentContainer = wasDisabled ? container : target;
|
6111 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
6112 | isSVG = isSVG || isTargetSVG(target);
|
6113 | if (n2.dynamicChildren) {
|
6114 |
|
6115 | patchBlockChildren(n1.dynamicChildren, n2.dynamicChildren, currentContainer, parentComponent, parentSuspense, isSVG);
|
6116 |
|
6117 |
|
6118 |
|
6119 | traverseStaticChildren(n1, n2, true);
|
6120 | }
|
6121 | else if (!optimized) {
|
6122 | patchChildren(n1, n2, currentContainer, currentAnchor, parentComponent, parentSuspense, isSVG);
|
6123 | }
|
6124 | if (disabled) {
|
6125 | if (!wasDisabled) {
|
6126 |
|
6127 |
|
6128 | moveTeleport(n2, container, mainAnchor, internals, 1 );
|
6129 | }
|
6130 | }
|
6131 | else {
|
6132 |
|
6133 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
6134 | const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
6135 | if (nextTarget) {
|
6136 | moveTeleport(n2, nextTarget, null, internals, 0 );
|
6137 | }
|
6138 | else {
|
6139 | warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
6140 | }
|
6141 | }
|
6142 | else if (wasDisabled) {
|
6143 |
|
6144 |
|
6145 | moveTeleport(n2, target, targetAnchor, internals, 1 );
|
6146 | }
|
6147 | }
|
6148 | }
|
6149 | },
|
6150 | remove(vnode, { r: remove, o: { remove: hostRemove } }) {
|
6151 | const { shapeFlag, children, anchor } = vnode;
|
6152 | hostRemove(anchor);
|
6153 | if (shapeFlag & 16 ) {
|
6154 | for (let i = 0; i < children.length; i++) {
|
6155 | remove(children[i]);
|
6156 | }
|
6157 | }
|
6158 | },
|
6159 | move: moveTeleport,
|
6160 | hydrate: hydrateTeleport
|
6161 | };
|
6162 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
6163 |
|
6164 | if (moveType === 0 ) {
|
6165 | insert(vnode.targetAnchor, container, parentAnchor);
|
6166 | }
|
6167 | const { el, anchor, shapeFlag, children, props } = vnode;
|
6168 | const isReorder = moveType === 2 ;
|
6169 |
|
6170 | if (isReorder) {
|
6171 | insert(el, container, parentAnchor);
|
6172 | }
|
6173 |
|
6174 |
|
6175 |
|
6176 | if (!isReorder || isTeleportDisabled(props)) {
|
6177 |
|
6178 | if (shapeFlag & 16 ) {
|
6179 | for (let i = 0; i < children.length; i++) {
|
6180 | move(children[i], container, parentAnchor, 2 );
|
6181 | }
|
6182 | }
|
6183 | }
|
6184 |
|
6185 | if (isReorder) {
|
6186 | insert(anchor, container, parentAnchor);
|
6187 | }
|
6188 | }
|
6189 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, optimized, { o: { nextSibling, parentNode, querySelector } }, hydrateChildren) {
|
6190 | const target = (vnode.target = resolveTarget(vnode.props, querySelector));
|
6191 | if (target) {
|
6192 |
|
6193 |
|
6194 | const targetNode = target._lpa || target.firstChild;
|
6195 | if (vnode.shapeFlag & 16 ) {
|
6196 | if (isTeleportDisabled(vnode.props)) {
|
6197 | vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, optimized);
|
6198 | vnode.targetAnchor = targetNode;
|
6199 | }
|
6200 | else {
|
6201 | vnode.anchor = nextSibling(node);
|
6202 | vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, optimized);
|
6203 | }
|
6204 | target._lpa =
|
6205 | vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
6206 | }
|
6207 | }
|
6208 | return vnode.anchor && nextSibling(vnode.anchor);
|
6209 | }
|
6210 |
|
6211 | const Teleport = TeleportImpl;
|
6212 |
|
6213 | const COMPONENTS = 'components';
|
6214 | const DIRECTIVES = 'directives';
|
6215 | |
6216 |
|
6217 |
|
6218 | function resolveComponent(name) {
|
6219 | return resolveAsset(COMPONENTS, name) || name;
|
6220 | }
|
6221 | const NULL_DYNAMIC_COMPONENT = Symbol();
|
6222 | |
6223 |
|
6224 |
|
6225 | function resolveDynamicComponent(component) {
|
6226 | if (isString(component)) {
|
6227 | return resolveAsset(COMPONENTS, component, false) || component;
|
6228 | }
|
6229 | else {
|
6230 |
|
6231 | return (component || NULL_DYNAMIC_COMPONENT);
|
6232 | }
|
6233 | }
|
6234 | |
6235 |
|
6236 |
|
6237 | function resolveDirective(name) {
|
6238 | return resolveAsset(DIRECTIVES, name);
|
6239 | }
|
6240 |
|
6241 | function resolveAsset(type, name, warnMissing = true) {
|
6242 | const instance = currentRenderingInstance || currentInstance;
|
6243 | if (instance) {
|
6244 | const Component = instance.type;
|
6245 |
|
6246 | if (type === COMPONENTS) {
|
6247 |
|
6248 |
|
6249 | if (name === `_self`) {
|
6250 | return Component;
|
6251 | }
|
6252 | const selfName = getComponentName(Component);
|
6253 | if (selfName &&
|
6254 | (selfName === name ||
|
6255 | selfName === camelize(name) ||
|
6256 | selfName === capitalize(camelize(name)))) {
|
6257 | return Component;
|
6258 | }
|
6259 | }
|
6260 | const res =
|
6261 |
|
6262 |
|
6263 | resolve(instance[type] || Component[type], name) ||
|
6264 |
|
6265 | resolve(instance.appContext[type], name);
|
6266 | if (warnMissing && !res) {
|
6267 | warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
|
6268 | }
|
6269 | return res;
|
6270 | }
|
6271 | else {
|
6272 | warn(`resolve${capitalize(type.slice(0, -1))} ` +
|
6273 | `can only be used in render() or setup().`);
|
6274 | }
|
6275 | }
|
6276 | function resolve(registry, name) {
|
6277 | return (registry &&
|
6278 | (registry[name] ||
|
6279 | registry[camelize(name)] ||
|
6280 | registry[capitalize(camelize(name))]));
|
6281 | }
|
6282 |
|
6283 | const Fragment = Symbol('Fragment' );
|
6284 | const Text = Symbol('Text' );
|
6285 | const Comment = Symbol('Comment' );
|
6286 | const Static = Symbol('Static' );
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 | const blockStack = [];
|
6293 | let currentBlock = null;
|
6294 | |
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 | function openBlock(disableTracking = false) {
|
6311 | blockStack.push((currentBlock = disableTracking ? null : []));
|
6312 | }
|
6313 | function closeBlock() {
|
6314 | blockStack.pop();
|
6315 | currentBlock = blockStack[blockStack.length - 1] || null;
|
6316 | }
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 | let shouldTrack$1 = 1;
|
6322 | |
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 |
|
6338 | function setBlockTracking(value) {
|
6339 | shouldTrack$1 += value;
|
6340 | }
|
6341 | |
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
6349 | const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true );
|
6350 |
|
6351 | vnode.dynamicChildren = currentBlock || EMPTY_ARR;
|
6352 |
|
6353 | closeBlock();
|
6354 |
|
6355 |
|
6356 | if (shouldTrack$1 > 0 && currentBlock) {
|
6357 | currentBlock.push(vnode);
|
6358 | }
|
6359 | return vnode;
|
6360 | }
|
6361 | function isVNode(value) {
|
6362 | return value ? value.__v_isVNode === true : false;
|
6363 | }
|
6364 | function isSameVNodeType(n1, n2) {
|
6365 | if (n2.shapeFlag & 6 &&
|
6366 | hmrDirtyComponents.has(n2.type)) {
|
6367 |
|
6368 | return false;
|
6369 | }
|
6370 | return n1.type === n2.type && n1.key === n2.key;
|
6371 | }
|
6372 | let vnodeArgsTransformer;
|
6373 | |
6374 |
|
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 | function transformVNodeArgs(transformer) {
|
6380 | vnodeArgsTransformer = transformer;
|
6381 | }
|
6382 | const createVNodeWithArgsTransform = (...args) => {
|
6383 | return _createVNode(...(vnodeArgsTransformer
|
6384 | ? vnodeArgsTransformer(args, currentRenderingInstance)
|
6385 | : args));
|
6386 | };
|
6387 | const InternalObjectKey = `__vInternal`;
|
6388 | const normalizeKey = ({ key }) => key != null ? key : null;
|
6389 | const normalizeRef = ({ ref }) => {
|
6390 | return (ref != null
|
6391 | ? isString(ref) || isRef(ref) || isFunction(ref)
|
6392 | ? { i: currentRenderingInstance, r: ref }
|
6393 | : ref
|
6394 | : null);
|
6395 | };
|
6396 | const createVNode = (createVNodeWithArgsTransform
|
6397 | );
|
6398 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
6399 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
6400 | if (!type) {
|
6401 | warn(`Invalid vnode type when creating vnode: ${type}.`);
|
6402 | }
|
6403 | type = Comment;
|
6404 | }
|
6405 | if (isVNode(type)) {
|
6406 |
|
6407 |
|
6408 |
|
6409 | const cloned = cloneVNode(type, props, true );
|
6410 | if (children) {
|
6411 | normalizeChildren(cloned, children);
|
6412 | }
|
6413 | return cloned;
|
6414 | }
|
6415 |
|
6416 | if (isClassComponent(type)) {
|
6417 | type = type.__vccOpts;
|
6418 | }
|
6419 |
|
6420 | if (props) {
|
6421 |
|
6422 | if (isProxy(props) || InternalObjectKey in props) {
|
6423 | props = extend({}, props);
|
6424 | }
|
6425 | let { class: klass, style } = props;
|
6426 | if (klass && !isString(klass)) {
|
6427 | props.class = normalizeClass(klass);
|
6428 | }
|
6429 | if (isObject(style)) {
|
6430 |
|
6431 |
|
6432 | if (isProxy(style) && !isArray(style)) {
|
6433 | style = extend({}, style);
|
6434 | }
|
6435 | props.style = normalizeStyle(style);
|
6436 | }
|
6437 | }
|
6438 |
|
6439 | const shapeFlag = isString(type)
|
6440 | ? 1
|
6441 | : isSuspense(type)
|
6442 | ? 128
|
6443 | : isTeleport(type)
|
6444 | ? 64
|
6445 | : isObject(type)
|
6446 | ? 4
|
6447 | : isFunction(type)
|
6448 | ? 2
|
6449 | : 0;
|
6450 | if (shapeFlag & 4 && isProxy(type)) {
|
6451 | type = toRaw(type);
|
6452 | warn(`Vue received a Component which was made a reactive object. This can ` +
|
6453 | `lead to unnecessary performance overhead, and should be avoided by ` +
|
6454 | `marking the component with \`markRaw\` or using \`shallowRef\` ` +
|
6455 | `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
|
6456 | }
|
6457 | const vnode = {
|
6458 | __v_isVNode: true,
|
6459 | ["__v_skip" ]: true,
|
6460 | type,
|
6461 | props,
|
6462 | key: props && normalizeKey(props),
|
6463 | ref: props && normalizeRef(props),
|
6464 | scopeId: currentScopeId,
|
6465 | children: null,
|
6466 | component: null,
|
6467 | suspense: null,
|
6468 | ssContent: null,
|
6469 | ssFallback: null,
|
6470 | dirs: null,
|
6471 | transition: null,
|
6472 | el: null,
|
6473 | anchor: null,
|
6474 | target: null,
|
6475 | targetAnchor: null,
|
6476 | staticCount: 0,
|
6477 | shapeFlag,
|
6478 | patchFlag,
|
6479 | dynamicProps,
|
6480 | dynamicChildren: null,
|
6481 | appContext: null
|
6482 | };
|
6483 |
|
6484 | if (vnode.key !== vnode.key) {
|
6485 | warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
6486 | }
|
6487 | normalizeChildren(vnode, children);
|
6488 |
|
6489 | if (shapeFlag & 128 ) {
|
6490 | const { content, fallback } = normalizeSuspenseChildren(vnode);
|
6491 | vnode.ssContent = content;
|
6492 | vnode.ssFallback = fallback;
|
6493 | }
|
6494 | if (shouldTrack$1 > 0 &&
|
6495 |
|
6496 | !isBlockNode &&
|
6497 |
|
6498 | currentBlock &&
|
6499 |
|
6500 |
|
6501 |
|
6502 |
|
6503 | (patchFlag > 0 || shapeFlag & 6 ) &&
|
6504 |
|
6505 |
|
6506 | patchFlag !== 32 ) {
|
6507 | currentBlock.push(vnode);
|
6508 | }
|
6509 | return vnode;
|
6510 | }
|
6511 | function cloneVNode(vnode, extraProps, mergeRef = false) {
|
6512 |
|
6513 |
|
6514 | const { props, ref, patchFlag, children } = vnode;
|
6515 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
6516 | return {
|
6517 | __v_isVNode: true,
|
6518 | ["__v_skip" ]: true,
|
6519 | type: vnode.type,
|
6520 | props: mergedProps,
|
6521 | key: mergedProps && normalizeKey(mergedProps),
|
6522 | ref: extraProps && extraProps.ref
|
6523 | ?
|
6524 |
|
6525 |
|
6526 | mergeRef && ref
|
6527 | ? isArray(ref)
|
6528 | ? ref.concat(normalizeRef(extraProps))
|
6529 | : [ref, normalizeRef(extraProps)]
|
6530 | : normalizeRef(extraProps)
|
6531 | : ref,
|
6532 | scopeId: vnode.scopeId,
|
6533 | children: patchFlag === -1 && isArray(children)
|
6534 | ? children.map(deepCloneVNode)
|
6535 | : children,
|
6536 | target: vnode.target,
|
6537 | targetAnchor: vnode.targetAnchor,
|
6538 | staticCount: vnode.staticCount,
|
6539 | shapeFlag: vnode.shapeFlag,
|
6540 |
|
6541 |
|
6542 |
|
6543 |
|
6544 | patchFlag: extraProps && vnode.type !== Fragment
|
6545 | ? patchFlag === -1
|
6546 | ? 16
|
6547 | : patchFlag | 16
|
6548 | : patchFlag,
|
6549 | dynamicProps: vnode.dynamicProps,
|
6550 | dynamicChildren: vnode.dynamicChildren,
|
6551 | appContext: vnode.appContext,
|
6552 | dirs: vnode.dirs,
|
6553 | transition: vnode.transition,
|
6554 |
|
6555 |
|
6556 |
|
6557 |
|
6558 | component: vnode.component,
|
6559 | suspense: vnode.suspense,
|
6560 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
6561 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
6562 | el: vnode.el,
|
6563 | anchor: vnode.anchor
|
6564 | };
|
6565 | }
|
6566 | |
6567 |
|
6568 |
|
6569 |
|
6570 | function deepCloneVNode(vnode) {
|
6571 | const cloned = cloneVNode(vnode);
|
6572 | if (isArray(vnode.children)) {
|
6573 | cloned.children = vnode.children.map(deepCloneVNode);
|
6574 | }
|
6575 | return cloned;
|
6576 | }
|
6577 | |
6578 |
|
6579 |
|
6580 | function createTextVNode(text = ' ', flag = 0) {
|
6581 | return createVNode(Text, null, text, flag);
|
6582 | }
|
6583 | |
6584 |
|
6585 |
|
6586 | function createStaticVNode(content, numberOfNodes) {
|
6587 |
|
6588 |
|
6589 | const vnode = createVNode(Static, null, content);
|
6590 | vnode.staticCount = numberOfNodes;
|
6591 | return vnode;
|
6592 | }
|
6593 | |
6594 |
|
6595 |
|
6596 | function createCommentVNode(text = '',
|
6597 | // when used as the v-else branch, the comment node must be created as a
|
6598 | // block to ensure correct updates.
|
6599 | asBlock = false) {
|
6600 | return asBlock
|
6601 | ? (openBlock(), createBlock(Comment, null, text))
|
6602 | : createVNode(Comment, null, text);
|
6603 | }
|
6604 | function normalizeVNode(child) {
|
6605 | if (child == null || typeof child === 'boolean') {
|
6606 |
|
6607 | return createVNode(Comment);
|
6608 | }
|
6609 | else if (isArray(child)) {
|
6610 |
|
6611 | return createVNode(Fragment, null, child);
|
6612 | }
|
6613 | else if (typeof child === 'object') {
|
6614 |
|
6615 |
|
6616 | return child.el === null ? child : cloneVNode(child);
|
6617 | }
|
6618 | else {
|
6619 |
|
6620 | return createVNode(Text, null, String(child));
|
6621 | }
|
6622 | }
|
6623 |
|
6624 | function cloneIfMounted(child) {
|
6625 | return child.el === null ? child : cloneVNode(child);
|
6626 | }
|
6627 | function normalizeChildren(vnode, children) {
|
6628 | let type = 0;
|
6629 | const { shapeFlag } = vnode;
|
6630 | if (children == null) {
|
6631 | children = null;
|
6632 | }
|
6633 | else if (isArray(children)) {
|
6634 | type = 16 ;
|
6635 | }
|
6636 | else if (typeof children === 'object') {
|
6637 | if (shapeFlag & 1 || shapeFlag & 64 ) {
|
6638 |
|
6639 | const slot = children.default;
|
6640 | if (slot) {
|
6641 |
|
6642 | slot._c && setCompiledSlotRendering(1);
|
6643 | normalizeChildren(vnode, slot());
|
6644 | slot._c && setCompiledSlotRendering(-1);
|
6645 | }
|
6646 | return;
|
6647 | }
|
6648 | else {
|
6649 | type = 32 ;
|
6650 | const slotFlag = children._;
|
6651 | if (!slotFlag && !(InternalObjectKey in children)) {
|
6652 | children._ctx = currentRenderingInstance;
|
6653 | }
|
6654 | else if (slotFlag === 3 && currentRenderingInstance) {
|
6655 |
|
6656 |
|
6657 | if (currentRenderingInstance.vnode.patchFlag & 1024 ) {
|
6658 | children._ = 2 ;
|
6659 | vnode.patchFlag |= 1024 ;
|
6660 | }
|
6661 | else {
|
6662 | children._ = 1 ;
|
6663 | }
|
6664 | }
|
6665 | }
|
6666 | }
|
6667 | else if (isFunction(children)) {
|
6668 | children = { default: children, _ctx: currentRenderingInstance };
|
6669 | type = 32 ;
|
6670 | }
|
6671 | else {
|
6672 | children = String(children);
|
6673 |
|
6674 | if (shapeFlag & 64 ) {
|
6675 | type = 16 ;
|
6676 | children = [createTextVNode(children)];
|
6677 | }
|
6678 | else {
|
6679 | type = 8 ;
|
6680 | }
|
6681 | }
|
6682 | vnode.children = children;
|
6683 | vnode.shapeFlag |= type;
|
6684 | }
|
6685 | function mergeProps(...args) {
|
6686 | const ret = extend({}, args[0]);
|
6687 | for (let i = 1; i < args.length; i++) {
|
6688 | const toMerge = args[i];
|
6689 | for (const key in toMerge) {
|
6690 | if (key === 'class') {
|
6691 | if (ret.class !== toMerge.class) {
|
6692 | ret.class = normalizeClass([ret.class, toMerge.class]);
|
6693 | }
|
6694 | }
|
6695 | else if (key === 'style') {
|
6696 | ret.style = normalizeStyle([ret.style, toMerge.style]);
|
6697 | }
|
6698 | else if (isOn(key)) {
|
6699 | const existing = ret[key];
|
6700 | const incoming = toMerge[key];
|
6701 | if (existing !== incoming) {
|
6702 | ret[key] = existing
|
6703 | ? [].concat(existing, toMerge[key])
|
6704 | : incoming;
|
6705 | }
|
6706 | }
|
6707 | else if (key !== '') {
|
6708 | ret[key] = toMerge[key];
|
6709 | }
|
6710 | }
|
6711 | }
|
6712 | return ret;
|
6713 | }
|
6714 |
|
6715 | function provide(key, value) {
|
6716 | if (!currentInstance) {
|
6717 | {
|
6718 | warn(`provide() can only be used inside setup().`);
|
6719 | }
|
6720 | }
|
6721 | else {
|
6722 | let provides = currentInstance.provides;
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
6729 | if (parentProvides === provides) {
|
6730 | provides = currentInstance.provides = Object.create(parentProvides);
|
6731 | }
|
6732 |
|
6733 | provides[key] = value;
|
6734 | }
|
6735 | }
|
6736 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
6737 |
|
6738 |
|
6739 | const instance = currentInstance || currentRenderingInstance;
|
6740 | if (instance) {
|
6741 |
|
6742 |
|
6743 |
|
6744 | const provides = instance.parent == null
|
6745 | ? instance.vnode.appContext && instance.vnode.appContext.provides
|
6746 | : instance.parent.provides;
|
6747 | if (provides && key in provides) {
|
6748 |
|
6749 | return provides[key];
|
6750 | }
|
6751 | else if (arguments.length > 1) {
|
6752 | return treatDefaultAsFactory && isFunction(defaultValue)
|
6753 | ? defaultValue()
|
6754 | : defaultValue;
|
6755 | }
|
6756 | else {
|
6757 | warn(`injection "${String(key)}" not found.`);
|
6758 | }
|
6759 | }
|
6760 | else {
|
6761 | warn(`inject() can only be used inside setup() or functional components.`);
|
6762 | }
|
6763 | }
|
6764 |
|
6765 | function createDuplicateChecker() {
|
6766 | const cache = Object.create(null);
|
6767 | return (type, key) => {
|
6768 | if (cache[key]) {
|
6769 | warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
6770 | }
|
6771 | else {
|
6772 | cache[key] = type;
|
6773 | }
|
6774 | };
|
6775 | }
|
6776 | let isInBeforeCreate = false;
|
6777 | function applyOptions(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
|
6778 | const {
|
6779 |
|
6780 | mixins, extends: extendsOptions,
|
6781 |
|
6782 | data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
6783 |
|
6784 | components, directives,
|
6785 |
|
6786 | beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured,
|
6787 |
|
6788 | expose } = options;
|
6789 | const publicThis = instance.proxy;
|
6790 | const ctx = instance.ctx;
|
6791 | const globalMixins = instance.appContext.mixins;
|
6792 | if (asMixin && render && instance.render === NOOP) {
|
6793 | instance.render = render;
|
6794 | }
|
6795 |
|
6796 | if (!asMixin) {
|
6797 | isInBeforeCreate = true;
|
6798 | callSyncHook('beforeCreate', "bc" , options, instance, globalMixins);
|
6799 | isInBeforeCreate = false;
|
6800 |
|
6801 | applyMixins(instance, globalMixins, deferredData, deferredWatch, deferredProvide);
|
6802 | }
|
6803 |
|
6804 | if (extendsOptions) {
|
6805 | applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
|
6806 | }
|
6807 |
|
6808 | if (mixins) {
|
6809 | applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide);
|
6810 | }
|
6811 | const checkDuplicateProperties = createDuplicateChecker() ;
|
6812 | {
|
6813 | const [propsOptions] = instance.propsOptions;
|
6814 | if (propsOptions) {
|
6815 | for (const key in propsOptions) {
|
6816 | checkDuplicateProperties("Props" , key);
|
6817 | }
|
6818 | }
|
6819 | }
|
6820 |
|
6821 |
|
6822 |
|
6823 |
|
6824 |
|
6825 |
|
6826 |
|
6827 | if (injectOptions) {
|
6828 | if (isArray(injectOptions)) {
|
6829 | for (let i = 0; i < injectOptions.length; i++) {
|
6830 | const key = injectOptions[i];
|
6831 | ctx[key] = inject(key);
|
6832 | {
|
6833 | checkDuplicateProperties("Inject" , key);
|
6834 | }
|
6835 | }
|
6836 | }
|
6837 | else {
|
6838 | for (const key in injectOptions) {
|
6839 | const opt = injectOptions[key];
|
6840 | if (isObject(opt)) {
|
6841 | ctx[key] = inject(opt.from || key, opt.default, true );
|
6842 | }
|
6843 | else {
|
6844 | ctx[key] = inject(opt);
|
6845 | }
|
6846 | {
|
6847 | checkDuplicateProperties("Inject" , key);
|
6848 | }
|
6849 | }
|
6850 | }
|
6851 | }
|
6852 | if (methods) {
|
6853 | for (const key in methods) {
|
6854 | const methodHandler = methods[key];
|
6855 | if (isFunction(methodHandler)) {
|
6856 |
|
6857 |
|
6858 | {
|
6859 | Object.defineProperty(ctx, key, {
|
6860 | value: methodHandler.bind(publicThis),
|
6861 | configurable: true,
|
6862 | enumerable: true,
|
6863 | writable: true
|
6864 | });
|
6865 | }
|
6866 | {
|
6867 | checkDuplicateProperties("Methods" , key);
|
6868 | }
|
6869 | }
|
6870 | else {
|
6871 | warn(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
6872 | `Did you reference the function correctly?`);
|
6873 | }
|
6874 | }
|
6875 | }
|
6876 | if (!asMixin) {
|
6877 | if (deferredData.length) {
|
6878 | deferredData.forEach(dataFn => resolveData(instance, dataFn, publicThis));
|
6879 | }
|
6880 | if (dataOptions) {
|
6881 |
|
6882 | resolveData(instance, dataOptions, publicThis);
|
6883 | }
|
6884 | {
|
6885 | const rawData = toRaw(instance.data);
|
6886 | for (const key in rawData) {
|
6887 | checkDuplicateProperties("Data" , key);
|
6888 |
|
6889 | if (key[0] !== '$' && key[0] !== '_') {
|
6890 | Object.defineProperty(ctx, key, {
|
6891 | configurable: true,
|
6892 | enumerable: true,
|
6893 | get: () => rawData[key],
|
6894 | set: NOOP
|
6895 | });
|
6896 | }
|
6897 | }
|
6898 | }
|
6899 | }
|
6900 | else if (dataOptions) {
|
6901 | deferredData.push(dataOptions);
|
6902 | }
|
6903 | if (computedOptions) {
|
6904 | for (const key in computedOptions) {
|
6905 | const opt = computedOptions[key];
|
6906 | const get = isFunction(opt)
|
6907 | ? opt.bind(publicThis, publicThis)
|
6908 | : isFunction(opt.get)
|
6909 | ? opt.get.bind(publicThis, publicThis)
|
6910 | : NOOP;
|
6911 | if (get === NOOP) {
|
6912 | warn(`Computed property "${key}" has no getter.`);
|
6913 | }
|
6914 | const set = !isFunction(opt) && isFunction(opt.set)
|
6915 | ? opt.set.bind(publicThis)
|
6916 | : () => {
|
6917 | warn(`Write operation failed: computed property "${key}" is readonly.`);
|
6918 | }
|
6919 | ;
|
6920 | const c = computed$1({
|
6921 | get,
|
6922 | set
|
6923 | });
|
6924 | Object.defineProperty(ctx, key, {
|
6925 | enumerable: true,
|
6926 | configurable: true,
|
6927 | get: () => c.value,
|
6928 | set: v => (c.value = v)
|
6929 | });
|
6930 | {
|
6931 | checkDuplicateProperties("Computed" , key);
|
6932 | }
|
6933 | }
|
6934 | }
|
6935 | if (watchOptions) {
|
6936 | deferredWatch.push(watchOptions);
|
6937 | }
|
6938 | if (!asMixin && deferredWatch.length) {
|
6939 | deferredWatch.forEach(watchOptions => {
|
6940 | for (const key in watchOptions) {
|
6941 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
6942 | }
|
6943 | });
|
6944 | }
|
6945 | if (provideOptions) {
|
6946 | deferredProvide.push(provideOptions);
|
6947 | }
|
6948 | if (!asMixin && deferredProvide.length) {
|
6949 | deferredProvide.forEach(provideOptions => {
|
6950 | const provides = isFunction(provideOptions)
|
6951 | ? provideOptions.call(publicThis)
|
6952 | : provideOptions;
|
6953 | Reflect.ownKeys(provides).forEach(key => {
|
6954 | provide(key, provides[key]);
|
6955 | });
|
6956 | });
|
6957 | }
|
6958 |
|
6959 |
|
6960 |
|
6961 | if (asMixin) {
|
6962 | if (components) {
|
6963 | extend(instance.components ||
|
6964 | (instance.components = extend({}, instance.type.components)), components);
|
6965 | }
|
6966 | if (directives) {
|
6967 | extend(instance.directives ||
|
6968 | (instance.directives = extend({}, instance.type.directives)), directives);
|
6969 | }
|
6970 | }
|
6971 |
|
6972 | if (!asMixin) {
|
6973 | callSyncHook('created', "c" , options, instance, globalMixins);
|
6974 | }
|
6975 | if (beforeMount) {
|
6976 | onBeforeMount(beforeMount.bind(publicThis));
|
6977 | }
|
6978 | if (mounted) {
|
6979 | onMounted(mounted.bind(publicThis));
|
6980 | }
|
6981 | if (beforeUpdate) {
|
6982 | onBeforeUpdate(beforeUpdate.bind(publicThis));
|
6983 | }
|
6984 | if (updated) {
|
6985 | onUpdated(updated.bind(publicThis));
|
6986 | }
|
6987 | if (activated) {
|
6988 | onActivated(activated.bind(publicThis));
|
6989 | }
|
6990 | if (deactivated) {
|
6991 | onDeactivated(deactivated.bind(publicThis));
|
6992 | }
|
6993 | if (errorCaptured) {
|
6994 | onErrorCaptured(errorCaptured.bind(publicThis));
|
6995 | }
|
6996 | if (renderTracked) {
|
6997 | onRenderTracked(renderTracked.bind(publicThis));
|
6998 | }
|
6999 | if (renderTriggered) {
|
7000 | onRenderTriggered(renderTriggered.bind(publicThis));
|
7001 | }
|
7002 | if (beforeDestroy) {
|
7003 | warn(`\`beforeDestroy\` has been renamed to \`beforeUnmount\`.`);
|
7004 | }
|
7005 | if (beforeUnmount) {
|
7006 | onBeforeUnmount(beforeUnmount.bind(publicThis));
|
7007 | }
|
7008 | if (destroyed) {
|
7009 | warn(`\`destroyed\` has been renamed to \`unmounted\`.`);
|
7010 | }
|
7011 | if (unmounted) {
|
7012 | onUnmounted(unmounted.bind(publicThis));
|
7013 | }
|
7014 | if (isArray(expose)) {
|
7015 | if (!asMixin) {
|
7016 | if (expose.length) {
|
7017 | const exposed = instance.exposed || (instance.exposed = proxyRefs({}));
|
7018 | expose.forEach(key => {
|
7019 | exposed[key] = toRef(publicThis, key);
|
7020 | });
|
7021 | }
|
7022 | else if (!instance.exposed) {
|
7023 | instance.exposed = EMPTY_OBJ;
|
7024 | }
|
7025 | }
|
7026 | else {
|
7027 | warn(`The \`expose\` option is ignored when used in mixins.`);
|
7028 | }
|
7029 | }
|
7030 | }
|
7031 | function callSyncHook(name, type, options, instance, globalMixins) {
|
7032 | callHookFromMixins(name, type, globalMixins, instance);
|
7033 | const { extends: base, mixins } = options;
|
7034 | if (base) {
|
7035 | callHookFromExtends(name, type, base, instance);
|
7036 | }
|
7037 | if (mixins) {
|
7038 | callHookFromMixins(name, type, mixins, instance);
|
7039 | }
|
7040 | const selfHook = options[name];
|
7041 | if (selfHook) {
|
7042 | callWithAsyncErrorHandling(selfHook.bind(instance.proxy), instance, type);
|
7043 | }
|
7044 | }
|
7045 | function callHookFromExtends(name, type, base, instance) {
|
7046 | if (base.extends) {
|
7047 | callHookFromExtends(name, type, base.extends, instance);
|
7048 | }
|
7049 | const baseHook = base[name];
|
7050 | if (baseHook) {
|
7051 | callWithAsyncErrorHandling(baseHook.bind(instance.proxy), instance, type);
|
7052 | }
|
7053 | }
|
7054 | function callHookFromMixins(name, type, mixins, instance) {
|
7055 | for (let i = 0; i < mixins.length; i++) {
|
7056 | const chainedMixins = mixins[i].mixins;
|
7057 | if (chainedMixins) {
|
7058 | callHookFromMixins(name, type, chainedMixins, instance);
|
7059 | }
|
7060 | const fn = mixins[i][name];
|
7061 | if (fn) {
|
7062 | callWithAsyncErrorHandling(fn.bind(instance.proxy), instance, type);
|
7063 | }
|
7064 | }
|
7065 | }
|
7066 | function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
|
7067 | for (let i = 0; i < mixins.length; i++) {
|
7068 | applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
|
7069 | }
|
7070 | }
|
7071 | function resolveData(instance, dataFn, publicThis) {
|
7072 | if (!isFunction(dataFn)) {
|
7073 | warn(`The data option must be a function. ` +
|
7074 | `Plain object usage is no longer supported.`);
|
7075 | }
|
7076 | const data = dataFn.call(publicThis, publicThis);
|
7077 | if (isPromise(data)) {
|
7078 | warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
7079 | `intend to perform data fetching before component renders, use ` +
|
7080 | `async setup() + <Suspense>.`);
|
7081 | }
|
7082 | if (!isObject(data)) {
|
7083 | warn(`data() should return an object.`);
|
7084 | }
|
7085 | else if (instance.data === EMPTY_OBJ) {
|
7086 | instance.data = reactive(data);
|
7087 | }
|
7088 | else {
|
7089 |
|
7090 | extend(instance.data, data);
|
7091 | }
|
7092 | }
|
7093 | function createWatcher(raw, ctx, publicThis, key) {
|
7094 | const getter = key.includes('.')
|
7095 | ? createPathGetter(publicThis, key)
|
7096 | : () => publicThis[key];
|
7097 | if (isString(raw)) {
|
7098 | const handler = ctx[raw];
|
7099 | if (isFunction(handler)) {
|
7100 | watch(getter, handler);
|
7101 | }
|
7102 | else {
|
7103 | warn(`Invalid watch handler specified by key "${raw}"`, handler);
|
7104 | }
|
7105 | }
|
7106 | else if (isFunction(raw)) {
|
7107 | watch(getter, raw.bind(publicThis));
|
7108 | }
|
7109 | else if (isObject(raw)) {
|
7110 | if (isArray(raw)) {
|
7111 | raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
7112 | }
|
7113 | else {
|
7114 | const handler = isFunction(raw.handler)
|
7115 | ? raw.handler.bind(publicThis)
|
7116 | : ctx[raw.handler];
|
7117 | if (isFunction(handler)) {
|
7118 | watch(getter, handler, raw);
|
7119 | }
|
7120 | else {
|
7121 | warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
7122 | }
|
7123 | }
|
7124 | }
|
7125 | else {
|
7126 | warn(`Invalid watch option: "${key}"`, raw);
|
7127 | }
|
7128 | }
|
7129 | function createPathGetter(ctx, path) {
|
7130 | const segments = path.split('.');
|
7131 | return () => {
|
7132 | let cur = ctx;
|
7133 | for (let i = 0; i < segments.length && cur; i++) {
|
7134 | cur = cur[segments[i]];
|
7135 | }
|
7136 | return cur;
|
7137 | };
|
7138 | }
|
7139 | function resolveMergedOptions(instance) {
|
7140 | const raw = instance.type;
|
7141 | const { __merged, mixins, extends: extendsOptions } = raw;
|
7142 | if (__merged)
|
7143 | return __merged;
|
7144 | const globalMixins = instance.appContext.mixins;
|
7145 | if (!globalMixins.length && !mixins && !extendsOptions)
|
7146 | return raw;
|
7147 | const options = {};
|
7148 | globalMixins.forEach(m => mergeOptions(options, m, instance));
|
7149 | mergeOptions(options, raw, instance);
|
7150 | return (raw.__merged = options);
|
7151 | }
|
7152 | function mergeOptions(to, from, instance) {
|
7153 | const strats = instance.appContext.config.optionMergeStrategies;
|
7154 | const { mixins, extends: extendsOptions } = from;
|
7155 | extendsOptions && mergeOptions(to, extendsOptions, instance);
|
7156 | mixins &&
|
7157 | mixins.forEach((m) => mergeOptions(to, m, instance));
|
7158 | for (const key in from) {
|
7159 | if (strats && hasOwn(strats, key)) {
|
7160 | to[key] = strats[key](to[key], from[key], instance.proxy, key);
|
7161 | }
|
7162 | else {
|
7163 | to[key] = from[key];
|
7164 | }
|
7165 | }
|
7166 | }
|
7167 |
|
7168 | |
7169 |
|
7170 |
|
7171 |
|
7172 |
|
7173 | const getPublicInstance = (i) => {
|
7174 | if (!i)
|
7175 | return null;
|
7176 | if (isStatefulComponent(i))
|
7177 | return i.exposed ? i.exposed : i.proxy;
|
7178 | return getPublicInstance(i.parent);
|
7179 | };
|
7180 | const publicPropertiesMap = extend(Object.create(null), {
|
7181 | $: i => i,
|
7182 | $el: i => i.vnode.el,
|
7183 | $data: i => i.data,
|
7184 | $props: i => (shallowReadonly(i.props) ),
|
7185 | $attrs: i => (shallowReadonly(i.attrs) ),
|
7186 | $slots: i => (shallowReadonly(i.slots) ),
|
7187 | $refs: i => (shallowReadonly(i.refs) ),
|
7188 | $parent: i => getPublicInstance(i.parent),
|
7189 | $root: i => getPublicInstance(i.root),
|
7190 | $emit: i => i.emit,
|
7191 | $options: i => (resolveMergedOptions(i) ),
|
7192 | $forceUpdate: i => () => queueJob(i.update),
|
7193 | $nextTick: i => nextTick.bind(i.proxy),
|
7194 | $watch: i => (instanceWatch.bind(i) )
|
7195 | });
|
7196 | const PublicInstanceProxyHandlers = {
|
7197 | get({ _: instance }, key) {
|
7198 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
7199 |
|
7200 | if (key === "__v_skip" ) {
|
7201 | return true;
|
7202 | }
|
7203 |
|
7204 | if (key === '__isVue') {
|
7205 | return true;
|
7206 | }
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 |
|
7213 | let normalizedProps;
|
7214 | if (key[0] !== '$') {
|
7215 | const n = accessCache[key];
|
7216 | if (n !== undefined) {
|
7217 | switch (n) {
|
7218 | case 0 :
|
7219 | return setupState[key];
|
7220 | case 1 :
|
7221 | return data[key];
|
7222 | case 3 :
|
7223 | return ctx[key];
|
7224 | case 2 :
|
7225 | return props[key];
|
7226 |
|
7227 | }
|
7228 | }
|
7229 | else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
7230 | accessCache[key] = 0 ;
|
7231 | return setupState[key];
|
7232 | }
|
7233 | else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
7234 | accessCache[key] = 1 ;
|
7235 | return data[key];
|
7236 | }
|
7237 | else if (
|
7238 |
|
7239 |
|
7240 | (normalizedProps = instance.propsOptions[0]) &&
|
7241 | hasOwn(normalizedProps, key)) {
|
7242 | accessCache[key] = 2 ;
|
7243 | return props[key];
|
7244 | }
|
7245 | else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
7246 | accessCache[key] = 3 ;
|
7247 | return ctx[key];
|
7248 | }
|
7249 | else if (!isInBeforeCreate) {
|
7250 | accessCache[key] = 4 ;
|
7251 | }
|
7252 | }
|
7253 | const publicGetter = publicPropertiesMap[key];
|
7254 | let cssModule, globalProperties;
|
7255 |
|
7256 | if (publicGetter) {
|
7257 | if (key === '$attrs') {
|
7258 | track(instance, "get" , key);
|
7259 | markAttrsAccessed();
|
7260 | }
|
7261 | return publicGetter(instance);
|
7262 | }
|
7263 | else if (
|
7264 |
|
7265 | (cssModule = type.__cssModules) &&
|
7266 | (cssModule = cssModule[key])) {
|
7267 | return cssModule;
|
7268 | }
|
7269 | else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
7270 |
|
7271 | accessCache[key] = 3 ;
|
7272 | return ctx[key];
|
7273 | }
|
7274 | else if (
|
7275 |
|
7276 | ((globalProperties = appContext.config.globalProperties),
|
7277 | hasOwn(globalProperties, key))) {
|
7278 | return globalProperties[key];
|
7279 | }
|
7280 | else if (currentRenderingInstance &&
|
7281 | (!isString(key) ||
|
7282 |
|
7283 |
|
7284 | key.indexOf('__v') !== 0)) {
|
7285 | if (data !== EMPTY_OBJ &&
|
7286 | (key[0] === '$' || key[0] === '_') &&
|
7287 | hasOwn(data, key)) {
|
7288 | warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
7289 | `character ("$" or "_") and is not proxied on the render context.`);
|
7290 | }
|
7291 | else if (instance === currentRenderingInstance) {
|
7292 | warn(`Property ${JSON.stringify(key)} was accessed during render ` +
|
7293 | `but is not defined on instance.`);
|
7294 | }
|
7295 | }
|
7296 | },
|
7297 | set({ _: instance }, key, value) {
|
7298 | const { data, setupState, ctx } = instance;
|
7299 | if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
7300 | setupState[key] = value;
|
7301 | }
|
7302 | else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
7303 | data[key] = value;
|
7304 | }
|
7305 | else if (hasOwn(instance.props, key)) {
|
7306 | warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
7307 | return false;
|
7308 | }
|
7309 | if (key[0] === '$' && key.slice(1) in instance) {
|
7310 | warn(`Attempting to mutate public property "${key}". ` +
|
7311 | `Properties starting with $ are reserved and readonly.`, instance);
|
7312 | return false;
|
7313 | }
|
7314 | else {
|
7315 | if (key in instance.appContext.config.globalProperties) {
|
7316 | Object.defineProperty(ctx, key, {
|
7317 | enumerable: true,
|
7318 | configurable: true,
|
7319 | value
|
7320 | });
|
7321 | }
|
7322 | else {
|
7323 | ctx[key] = value;
|
7324 | }
|
7325 | }
|
7326 | return true;
|
7327 | },
|
7328 | has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
7329 | let normalizedProps;
|
7330 | return (accessCache[key] !== undefined ||
|
7331 | (data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
7332 | (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
7333 | ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
7334 | hasOwn(ctx, key) ||
|
7335 | hasOwn(publicPropertiesMap, key) ||
|
7336 | hasOwn(appContext.config.globalProperties, key));
|
7337 | }
|
7338 | };
|
7339 | {
|
7340 | PublicInstanceProxyHandlers.ownKeys = (target) => {
|
7341 | warn(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
7342 | `The keys will be empty in production mode to avoid performance overhead.`);
|
7343 | return Reflect.ownKeys(target);
|
7344 | };
|
7345 | }
|
7346 | const RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, {
|
7347 | get(target, key) {
|
7348 |
|
7349 | if (key === Symbol.unscopables) {
|
7350 | return;
|
7351 | }
|
7352 | return PublicInstanceProxyHandlers.get(target, key, target);
|
7353 | },
|
7354 | has(_, key) {
|
7355 | const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
7356 | if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
7357 | warn(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
7358 | }
|
7359 | return has;
|
7360 | }
|
7361 | });
|
7362 |
|
7363 |
|
7364 |
|
7365 | function createRenderContext(instance) {
|
7366 | const target = {};
|
7367 |
|
7368 | Object.defineProperty(target, `_`, {
|
7369 | configurable: true,
|
7370 | enumerable: false,
|
7371 | get: () => instance
|
7372 | });
|
7373 | // expose public properties
|
7374 | Object.keys(publicPropertiesMap).forEach(key => {
|
7375 | Object.defineProperty(target, key, {
|
7376 | configurable: true,
|
7377 | enumerable: false,
|
7378 | get: () => publicPropertiesMap[key](instance),
|
7379 | // intercepted by the proxy so no need for implementation,
|
7380 | // but needed to prevent set errors
|
7381 | set: NOOP
|
7382 | });
|
7383 | });
|
7384 | // expose global properties
|
7385 | const { globalProperties } = instance.appContext.config;
|
7386 | Object.keys(globalProperties).forEach(key => {
|
7387 | Object.defineProperty(target, key, {
|
7388 | configurable: true,
|
7389 | enumerable: false,
|
7390 | get: () => globalProperties[key],
|
7391 | set: NOOP
|
7392 | });
|
7393 | });
|
7394 | return target;
|
7395 | }
|
7396 | // dev only
|
7397 | function exposePropsOnRenderContext(instance) {
|
7398 | const { ctx, propsOptions: [propsOptions] } = instance;
|
7399 | if (propsOptions) {
|
7400 | Object.keys(propsOptions).forEach(key => {
|
7401 | Object.defineProperty(ctx, key, {
|
7402 | enumerable: true,
|
7403 | configurable: true,
|
7404 | get: () => instance.props[key],
|
7405 | set: NOOP
|
7406 | });
|
7407 | });
|
7408 | }
|
7409 | }
|
7410 | // dev only
|
7411 | function exposeSetupStateOnRenderContext(instance) {
|
7412 | const { ctx, setupState } = instance;
|
7413 | Object.keys(toRaw(setupState)).forEach(key => {
|
7414 | if (key[0] === '$' || key[0] === '_') {
|
7415 | warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
7416 | `which are reserved prefixes for Vue internals.`);
|
7417 | return;
|
7418 | }
|
7419 | Object.defineProperty(ctx, key, {
|
7420 | enumerable: true,
|
7421 | configurable: true,
|
7422 | get: () => setupState[key],
|
7423 | set: NOOP
|
7424 | });
|
7425 | });
|
7426 | }
|
7427 |
|
7428 | const emptyAppContext = createAppContext();
|
7429 | let uid$2 = 0;
|
7430 | function createComponentInstance(vnode, parent, suspense) {
|
7431 | const type = vnode.type;
|
7432 |
|
7433 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
7434 | const instance = {
|
7435 | uid: uid$2++,
|
7436 | vnode,
|
7437 | type,
|
7438 | parent,
|
7439 | appContext,
|
7440 | root: null,
|
7441 | next: null,
|
7442 | subTree: null,
|
7443 | update: null,
|
7444 | render: null,
|
7445 | proxy: null,
|
7446 | exposed: null,
|
7447 | withProxy: null,
|
7448 | effects: null,
|
7449 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
7450 | accessCache: null,
|
7451 | renderCache: [],
|
7452 |
|
7453 | components: null,
|
7454 | directives: null,
|
7455 |
|
7456 | propsOptions: normalizePropsOptions(type, appContext),
|
7457 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
7458 |
|
7459 | emit: null,
|
7460 | emitted: null,
|
7461 |
|
7462 | ctx: EMPTY_OBJ,
|
7463 | data: EMPTY_OBJ,
|
7464 | props: EMPTY_OBJ,
|
7465 | attrs: EMPTY_OBJ,
|
7466 | slots: EMPTY_OBJ,
|
7467 | refs: EMPTY_OBJ,
|
7468 | setupState: EMPTY_OBJ,
|
7469 | setupContext: null,
|
7470 |
|
7471 | suspense,
|
7472 | suspenseId: suspense ? suspense.pendingId : 0,
|
7473 | asyncDep: null,
|
7474 | asyncResolved: false,
|
7475 |
|
7476 |
|
7477 | isMounted: false,
|
7478 | isUnmounted: false,
|
7479 | isDeactivated: false,
|
7480 | bc: null,
|
7481 | c: null,
|
7482 | bm: null,
|
7483 | m: null,
|
7484 | bu: null,
|
7485 | u: null,
|
7486 | um: null,
|
7487 | bum: null,
|
7488 | da: null,
|
7489 | a: null,
|
7490 | rtg: null,
|
7491 | rtc: null,
|
7492 | ec: null
|
7493 | };
|
7494 | {
|
7495 | instance.ctx = createRenderContext(instance);
|
7496 | }
|
7497 | instance.root = parent ? parent.root : instance;
|
7498 | instance.emit = emit.bind(null, instance);
|
7499 | return instance;
|
7500 | }
|
7501 | let currentInstance = null;
|
7502 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
7503 | const setCurrentInstance = (instance) => {
|
7504 | currentInstance = instance;
|
7505 | };
|
7506 | const isBuiltInTag = makeMap('slot,component');
|
7507 | function validateComponentName(name, config) {
|
7508 | const appIsNativeTag = config.isNativeTag || NO;
|
7509 | if (isBuiltInTag(name) || appIsNativeTag(name)) {
|
7510 | warn('Do not use built-in or reserved HTML elements as component id: ' + name);
|
7511 | }
|
7512 | }
|
7513 | function isStatefulComponent(instance) {
|
7514 | return instance.vnode.shapeFlag & 4 ;
|
7515 | }
|
7516 | let isInSSRComponentSetup = false;
|
7517 | function setupComponent(instance, isSSR = false) {
|
7518 | isInSSRComponentSetup = isSSR;
|
7519 | const { props, children } = instance.vnode;
|
7520 | const isStateful = isStatefulComponent(instance);
|
7521 | initProps(instance, props, isStateful, isSSR);
|
7522 | initSlots(instance, children);
|
7523 | const setupResult = isStateful
|
7524 | ? setupStatefulComponent(instance, isSSR)
|
7525 | : undefined;
|
7526 | isInSSRComponentSetup = false;
|
7527 | return setupResult;
|
7528 | }
|
7529 | function setupStatefulComponent(instance, isSSR) {
|
7530 | const Component = instance.type;
|
7531 | {
|
7532 | if (Component.name) {
|
7533 | validateComponentName(Component.name, instance.appContext.config);
|
7534 | }
|
7535 | if (Component.components) {
|
7536 | const names = Object.keys(Component.components);
|
7537 | for (let i = 0; i < names.length; i++) {
|
7538 | validateComponentName(names[i], instance.appContext.config);
|
7539 | }
|
7540 | }
|
7541 | if (Component.directives) {
|
7542 | const names = Object.keys(Component.directives);
|
7543 | for (let i = 0; i < names.length; i++) {
|
7544 | validateDirectiveName(names[i]);
|
7545 | }
|
7546 | }
|
7547 | }
|
7548 |
|
7549 | instance.accessCache = Object.create(null);
|
7550 |
|
7551 |
|
7552 | instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
7553 | {
|
7554 | exposePropsOnRenderContext(instance);
|
7555 | }
|
7556 |
|
7557 | const { setup } = Component;
|
7558 | if (setup) {
|
7559 | const setupContext = (instance.setupContext =
|
7560 | setup.length > 1 ? createSetupContext(instance) : null);
|
7561 | currentInstance = instance;
|
7562 | pauseTracking();
|
7563 | const setupResult = callWithErrorHandling(setup, instance, 0 , [shallowReadonly(instance.props) , setupContext]);
|
7564 | resetTracking();
|
7565 | currentInstance = null;
|
7566 | if (isPromise(setupResult)) {
|
7567 | if (isSSR) {
|
7568 |
|
7569 | return setupResult.then((resolvedResult) => {
|
7570 | handleSetupResult(instance, resolvedResult);
|
7571 | });
|
7572 | }
|
7573 | else {
|
7574 |
|
7575 |
|
7576 | instance.asyncDep = setupResult;
|
7577 | }
|
7578 | }
|
7579 | else {
|
7580 | handleSetupResult(instance, setupResult);
|
7581 | }
|
7582 | }
|
7583 | else {
|
7584 | finishComponentSetup(instance);
|
7585 | }
|
7586 | }
|
7587 | function handleSetupResult(instance, setupResult, isSSR) {
|
7588 | if (isFunction(setupResult)) {
|
7589 |
|
7590 | {
|
7591 | instance.render = setupResult;
|
7592 | }
|
7593 | }
|
7594 | else if (isObject(setupResult)) {
|
7595 | if (isVNode(setupResult)) {
|
7596 | warn(`setup() should not return VNodes directly - ` +
|
7597 | `return a render function instead.`);
|
7598 | }
|
7599 |
|
7600 |
|
7601 | {
|
7602 | instance.devtoolsRawSetupState = setupResult;
|
7603 | }
|
7604 | instance.setupState = proxyRefs(setupResult);
|
7605 | {
|
7606 | exposeSetupStateOnRenderContext(instance);
|
7607 | }
|
7608 | }
|
7609 | else if (setupResult !== undefined) {
|
7610 | warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`);
|
7611 | }
|
7612 | finishComponentSetup(instance);
|
7613 | }
|
7614 | let compile;
|
7615 |
|
7616 | const isRuntimeOnly = () => !compile;
|
7617 | |
7618 |
|
7619 |
|
7620 |
|
7621 | function registerRuntimeCompiler(_compile) {
|
7622 | compile = _compile;
|
7623 | }
|
7624 | function finishComponentSetup(instance, isSSR) {
|
7625 | const Component = instance.type;
|
7626 |
|
7627 | if (!instance.render) {
|
7628 |
|
7629 | if (compile && Component.template && !Component.render) {
|
7630 | {
|
7631 | startMeasure(instance, `compile`);
|
7632 | }
|
7633 | Component.render = compile(Component.template, {
|
7634 | isCustomElement: instance.appContext.config.isCustomElement,
|
7635 | delimiters: Component.delimiters
|
7636 | });
|
7637 | {
|
7638 | endMeasure(instance, `compile`);
|
7639 | }
|
7640 | }
|
7641 | instance.render = (Component.render || NOOP);
|
7642 |
|
7643 |
|
7644 |
|
7645 | if (instance.render._rc) {
|
7646 | instance.withProxy = new Proxy(instance.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
7647 | }
|
7648 | }
|
7649 |
|
7650 | {
|
7651 | currentInstance = instance;
|
7652 | pauseTracking();
|
7653 | applyOptions(instance, Component);
|
7654 | resetTracking();
|
7655 | currentInstance = null;
|
7656 | }
|
7657 |
|
7658 | if (!Component.render && instance.render === NOOP) {
|
7659 |
|
7660 | if (!compile && Component.template) {
|
7661 | warn(`Component provided template option but ` +
|
7662 | `runtime compilation is not supported in this build of Vue.` +
|
7663 | (` Use "vue.global.js" instead.`
|
7664 | ) );
|
7665 | }
|
7666 | else {
|
7667 | warn(`Component is missing template or render function.`);
|
7668 | }
|
7669 | }
|
7670 | }
|
7671 | const attrHandlers = {
|
7672 | get: (target, key) => {
|
7673 | {
|
7674 | markAttrsAccessed();
|
7675 | }
|
7676 | return target[key];
|
7677 | },
|
7678 | set: () => {
|
7679 | warn(`setupContext.attrs is readonly.`);
|
7680 | return false;
|
7681 | },
|
7682 | deleteProperty: () => {
|
7683 | warn(`setupContext.attrs is readonly.`);
|
7684 | return false;
|
7685 | }
|
7686 | };
|
7687 | function createSetupContext(instance) {
|
7688 | const expose = exposed => {
|
7689 | if (instance.exposed) {
|
7690 | warn(`expose() should be called only once per setup().`);
|
7691 | }
|
7692 | instance.exposed = proxyRefs(exposed);
|
7693 | };
|
7694 | {
|
7695 |
|
7696 |
|
7697 | return Object.freeze({
|
7698 | get props() {
|
7699 | return instance.props;
|
7700 | },
|
7701 | get attrs() {
|
7702 | return new Proxy(instance.attrs, attrHandlers);
|
7703 | },
|
7704 | get slots() {
|
7705 | return shallowReadonly(instance.slots);
|
7706 | },
|
7707 | get emit() {
|
7708 | return (event, ...args) => instance.emit(event, ...args);
|
7709 | },
|
7710 | expose
|
7711 | });
|
7712 | }
|
7713 | }
|
7714 |
|
7715 |
|
7716 | function recordInstanceBoundEffect(effect, instance = currentInstance) {
|
7717 | if (instance) {
|
7718 | (instance.effects || (instance.effects = [])).push(effect);
|
7719 | }
|
7720 | }
|
7721 | const classifyRE = /(?:^|[-_])(\w)/g;
|
7722 | const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
7723 | function getComponentName(Component) {
|
7724 | return isFunction(Component)
|
7725 | ? Component.displayName || Component.name
|
7726 | : Component.name;
|
7727 | }
|
7728 |
|
7729 | function formatComponentName(instance, Component, isRoot = false) {
|
7730 | let name = getComponentName(Component);
|
7731 | if (!name && Component.__file) {
|
7732 | const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
7733 | if (match) {
|
7734 | name = match[1];
|
7735 | }
|
7736 | }
|
7737 | if (!name && instance && instance.parent) {
|
7738 |
|
7739 | const inferFromRegistry = (registry) => {
|
7740 | for (const key in registry) {
|
7741 | if (registry[key] === Component) {
|
7742 | return key;
|
7743 | }
|
7744 | }
|
7745 | };
|
7746 | name =
|
7747 | inferFromRegistry(instance.components ||
|
7748 | instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
7749 | }
|
7750 | return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
7751 | }
|
7752 | function isClassComponent(value) {
|
7753 | return isFunction(value) && '__vccOpts' in value;
|
7754 | }
|
7755 |
|
7756 | function computed$1(getterOrOptions) {
|
7757 | const c = computed(getterOrOptions);
|
7758 | recordInstanceBoundEffect(c.effect);
|
7759 | return c;
|
7760 | }
|
7761 |
|
7762 |
|
7763 | function defineProps() {
|
7764 | {
|
7765 | warn(`defineProps() is a compiler-hint helper that is only usable inside ` +
|
7766 | `<script setup> of a single file component. Its arguments should be ` +
|
7767 | `compiled away and passing it at runtime has no effect.`);
|
7768 | }
|
7769 | return null;
|
7770 | }
|
7771 |
|
7772 | function defineEmit() {
|
7773 | {
|
7774 | warn(`defineEmit() is a compiler-hint helper that is only usable inside ` +
|
7775 | `<script setup> of a single file component. Its arguments should be ` +
|
7776 | `compiled away and passing it at runtime has no effect.`);
|
7777 | }
|
7778 | return null;
|
7779 | }
|
7780 | function useContext() {
|
7781 | const i = getCurrentInstance();
|
7782 | if (!i) {
|
7783 | warn(`useContext() called without active instance.`);
|
7784 | }
|
7785 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
7786 | }
|
7787 |
|
7788 |
|
7789 | function h(type, propsOrChildren, children) {
|
7790 | const l = arguments.length;
|
7791 | if (l === 2) {
|
7792 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
7793 |
|
7794 | if (isVNode(propsOrChildren)) {
|
7795 | return createVNode(type, null, [propsOrChildren]);
|
7796 | }
|
7797 |
|
7798 | return createVNode(type, propsOrChildren);
|
7799 | }
|
7800 | else {
|
7801 |
|
7802 | return createVNode(type, null, propsOrChildren);
|
7803 | }
|
7804 | }
|
7805 | else {
|
7806 | if (l > 3) {
|
7807 | children = Array.prototype.slice.call(arguments, 2);
|
7808 | }
|
7809 | else if (l === 3 && isVNode(children)) {
|
7810 | children = [children];
|
7811 | }
|
7812 | return createVNode(type, propsOrChildren, children);
|
7813 | }
|
7814 | }
|
7815 |
|
7816 | const ssrContextKey = Symbol(`ssrContext` );
|
7817 | const useSSRContext = () => {
|
7818 | {
|
7819 | warn(`useSSRContext() is not supported in the global build.`);
|
7820 | }
|
7821 | };
|
7822 |
|
7823 | function initCustomFormatter() {
|
7824 |
|
7825 | if (typeof window === 'undefined') {
|
7826 | return;
|
7827 | }
|
7828 | const vueStyle = { style: 'color:#3ba776' };
|
7829 | const numberStyle = { style: 'color:#0b1bc9' };
|
7830 | const stringStyle = { style: 'color:#b62e24' };
|
7831 | const keywordStyle = { style: 'color:#9d288c' };
|
7832 |
|
7833 |
|
7834 | const formatter = {
|
7835 | header(obj) {
|
7836 |
|
7837 | if (!isObject(obj)) {
|
7838 | return null;
|
7839 | }
|
7840 | if (obj.__isVue) {
|
7841 | return ['div', vueStyle, `VueInstance`];
|
7842 | }
|
7843 | else if (isRef(obj)) {
|
7844 | return [
|
7845 | 'div',
|
7846 | {},
|
7847 | ['span', vueStyle, genRefFlag(obj)],
|
7848 | '<',
|
7849 | formatValue(obj.value),
|
7850 | `>`
|
7851 | ];
|
7852 | }
|
7853 | else if (isReactive(obj)) {
|
7854 | return [
|
7855 | 'div',
|
7856 | {},
|
7857 | ['span', vueStyle, 'Reactive'],
|
7858 | '<',
|
7859 | formatValue(obj),
|
7860 | `>${isReadonly(obj) ? ` (readonly)` : ``}`
|
7861 | ];
|
7862 | }
|
7863 | else if (isReadonly(obj)) {
|
7864 | return [
|
7865 | 'div',
|
7866 | {},
|
7867 | ['span', vueStyle, 'Readonly'],
|
7868 | '<',
|
7869 | formatValue(obj),
|
7870 | '>'
|
7871 | ];
|
7872 | }
|
7873 | return null;
|
7874 | },
|
7875 | hasBody(obj) {
|
7876 | return obj && obj.__isVue;
|
7877 | },
|
7878 | body(obj) {
|
7879 | if (obj && obj.__isVue) {
|
7880 | return [
|
7881 | 'div',
|
7882 | {},
|
7883 | ...formatInstance(obj.$)
|
7884 | ];
|
7885 | }
|
7886 | }
|
7887 | };
|
7888 | function formatInstance(instance) {
|
7889 | const blocks = [];
|
7890 | if (instance.type.props && instance.props) {
|
7891 | blocks.push(createInstanceBlock('props', toRaw(instance.props)));
|
7892 | }
|
7893 | if (instance.setupState !== EMPTY_OBJ) {
|
7894 | blocks.push(createInstanceBlock('setup', instance.setupState));
|
7895 | }
|
7896 | if (instance.data !== EMPTY_OBJ) {
|
7897 | blocks.push(createInstanceBlock('data', toRaw(instance.data)));
|
7898 | }
|
7899 | const computed = extractKeys(instance, 'computed');
|
7900 | if (computed) {
|
7901 | blocks.push(createInstanceBlock('computed', computed));
|
7902 | }
|
7903 | const injected = extractKeys(instance, 'inject');
|
7904 | if (injected) {
|
7905 | blocks.push(createInstanceBlock('injected', injected));
|
7906 | }
|
7907 | blocks.push([
|
7908 | 'div',
|
7909 | {},
|
7910 | [
|
7911 | 'span',
|
7912 | {
|
7913 | style: keywordStyle.style + ';opacity:0.66'
|
7914 | },
|
7915 | '$ (internal): '
|
7916 | ],
|
7917 | ['object', { object: instance }]
|
7918 | ]);
|
7919 | return blocks;
|
7920 | }
|
7921 | function createInstanceBlock(type, target) {
|
7922 | target = extend({}, target);
|
7923 | if (!Object.keys(target).length) {
|
7924 | return ['span', {}];
|
7925 | }
|
7926 | return [
|
7927 | 'div',
|
7928 | { style: 'line-height:1.25em;margin-bottom:0.6em' },
|
7929 | [
|
7930 | 'div',
|
7931 | {
|
7932 | style: 'color:#476582'
|
7933 | },
|
7934 | type
|
7935 | ],
|
7936 | [
|
7937 | 'div',
|
7938 | {
|
7939 | style: 'padding-left:1.25em'
|
7940 | },
|
7941 | ...Object.keys(target).map(key => {
|
7942 | return [
|
7943 | 'div',
|
7944 | {},
|
7945 | ['span', keywordStyle, key + ': '],
|
7946 | formatValue(target[key], false)
|
7947 | ];
|
7948 | })
|
7949 | ]
|
7950 | ];
|
7951 | }
|
7952 | function formatValue(v, asRaw = true) {
|
7953 | if (typeof v === 'number') {
|
7954 | return ['span', numberStyle, v];
|
7955 | }
|
7956 | else if (typeof v === 'string') {
|
7957 | return ['span', stringStyle, JSON.stringify(v)];
|
7958 | }
|
7959 | else if (typeof v === 'boolean') {
|
7960 | return ['span', keywordStyle, v];
|
7961 | }
|
7962 | else if (isObject(v)) {
|
7963 | return ['object', { object: asRaw ? toRaw(v) : v }];
|
7964 | }
|
7965 | else {
|
7966 | return ['span', stringStyle, String(v)];
|
7967 | }
|
7968 | }
|
7969 | function extractKeys(instance, type) {
|
7970 | const Comp = instance.type;
|
7971 | if (isFunction(Comp)) {
|
7972 | return;
|
7973 | }
|
7974 | const extracted = {};
|
7975 | for (const key in instance.ctx) {
|
7976 | if (isKeyOfType(Comp, key, type)) {
|
7977 | extracted[key] = instance.ctx[key];
|
7978 | }
|
7979 | }
|
7980 | return extracted;
|
7981 | }
|
7982 | function isKeyOfType(Comp, key, type) {
|
7983 | const opts = Comp[type];
|
7984 | if ((isArray(opts) && opts.includes(key)) ||
|
7985 | (isObject(opts) && key in opts)) {
|
7986 | return true;
|
7987 | }
|
7988 | if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
7989 | return true;
|
7990 | }
|
7991 | if (Comp.mixins && Comp.mixins.some(m => isKeyOfType(m, key, type))) {
|
7992 | return true;
|
7993 | }
|
7994 | }
|
7995 | function genRefFlag(v) {
|
7996 | if (v._shallow) {
|
7997 | return `ShallowRef`;
|
7998 | }
|
7999 | if (v.effect) {
|
8000 | return `ComputedRef`;
|
8001 | }
|
8002 | return `Ref`;
|
8003 | }
|
8004 | if (window.devtoolsFormatters) {
|
8005 | window.devtoolsFormatters.push(formatter);
|
8006 | }
|
8007 | else {
|
8008 | window.devtoolsFormatters = [formatter];
|
8009 | }
|
8010 | }
|
8011 |
|
8012 | |
8013 |
|
8014 |
|
8015 | function renderList(source, renderItem) {
|
8016 | let ret;
|
8017 | if (isArray(source) || isString(source)) {
|
8018 | ret = new Array(source.length);
|
8019 | for (let i = 0, l = source.length; i < l; i++) {
|
8020 | ret[i] = renderItem(source[i], i);
|
8021 | }
|
8022 | }
|
8023 | else if (typeof source === 'number') {
|
8024 | if (!Number.isInteger(source)) {
|
8025 | warn(`The v-for range expect an integer value but got ${source}.`);
|
8026 | return [];
|
8027 | }
|
8028 | ret = new Array(source);
|
8029 | for (let i = 0; i < source; i++) {
|
8030 | ret[i] = renderItem(i + 1, i);
|
8031 | }
|
8032 | }
|
8033 | else if (isObject(source)) {
|
8034 | if (source[Symbol.iterator]) {
|
8035 | ret = Array.from(source, renderItem);
|
8036 | }
|
8037 | else {
|
8038 | const keys = Object.keys(source);
|
8039 | ret = new Array(keys.length);
|
8040 | for (let i = 0, l = keys.length; i < l; i++) {
|
8041 | const key = keys[i];
|
8042 | ret[i] = renderItem(source[key], key, i);
|
8043 | }
|
8044 | }
|
8045 | }
|
8046 | else {
|
8047 | ret = [];
|
8048 | }
|
8049 | return ret;
|
8050 | }
|
8051 |
|
8052 | |
8053 |
|
8054 |
|
8055 |
|
8056 | function toHandlers(obj) {
|
8057 | const ret = {};
|
8058 | if (!isObject(obj)) {
|
8059 | warn(`v-on with no argument expects an object value.`);
|
8060 | return ret;
|
8061 | }
|
8062 | for (const key in obj) {
|
8063 | ret[toHandlerKey(key)] = obj[key];
|
8064 | }
|
8065 | return ret;
|
8066 | }
|
8067 |
|
8068 | |
8069 |
|
8070 |
|
8071 |
|
8072 | function createSlots(slots, dynamicSlots) {
|
8073 | for (let i = 0; i < dynamicSlots.length; i++) {
|
8074 | const slot = dynamicSlots[i];
|
8075 |
|
8076 | if (isArray(slot)) {
|
8077 | for (let j = 0; j < slot.length; j++) {
|
8078 | slots[slot[j].name] = slot[j].fn;
|
8079 | }
|
8080 | }
|
8081 | else if (slot) {
|
8082 |
|
8083 | slots[slot.name] = slot.fn;
|
8084 | }
|
8085 | }
|
8086 | return slots;
|
8087 | }
|
8088 |
|
8089 |
|
8090 | const version = "3.0.7";
|
8091 | |
8092 |
|
8093 |
|
8094 |
|
8095 | const ssrUtils = (null);
|
8096 |
|
8097 | const svgNS = 'http://www.w3.org/2000/svg';
|
8098 | const doc = (typeof document !== 'undefined' ? document : null);
|
8099 | let tempContainer;
|
8100 | let tempSVGContainer;
|
8101 | const nodeOps = {
|
8102 | insert: (child, parent, anchor) => {
|
8103 | parent.insertBefore(child, anchor || null);
|
8104 | },
|
8105 | remove: child => {
|
8106 | const parent = child.parentNode;
|
8107 | if (parent) {
|
8108 | parent.removeChild(child);
|
8109 | }
|
8110 | },
|
8111 | createElement: (tag, isSVG, is) => isSVG
|
8112 | ? doc.createElementNS(svgNS, tag)
|
8113 | : doc.createElement(tag, is ? { is } : undefined),
|
8114 | createText: text => doc.createTextNode(text),
|
8115 | createComment: text => doc.createComment(text),
|
8116 | setText: (node, text) => {
|
8117 | node.nodeValue = text;
|
8118 | },
|
8119 | setElementText: (el, text) => {
|
8120 | el.textContent = text;
|
8121 | },
|
8122 | parentNode: node => node.parentNode,
|
8123 | nextSibling: node => node.nextSibling,
|
8124 | querySelector: selector => doc.querySelector(selector),
|
8125 | setScopeId(el, id) {
|
8126 | el.setAttribute(id, '');
|
8127 | },
|
8128 | cloneNode(el) {
|
8129 | return el.cloneNode(true);
|
8130 | },
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 | insertStaticContent(content, parent, anchor, isSVG) {
|
8136 | const temp = isSVG
|
8137 | ? tempSVGContainer ||
|
8138 | (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
|
8139 | : tempContainer || (tempContainer = doc.createElement('div'));
|
8140 | temp.innerHTML = content;
|
8141 | const first = temp.firstChild;
|
8142 | let node = first;
|
8143 | let last = node;
|
8144 | while (node) {
|
8145 | last = node;
|
8146 | nodeOps.insert(node, parent, anchor);
|
8147 | node = temp.firstChild;
|
8148 | }
|
8149 | return [first, last];
|
8150 | }
|
8151 | };
|
8152 |
|
8153 |
|
8154 |
|
8155 | function patchClass(el, value, isSVG) {
|
8156 | if (value == null) {
|
8157 | value = '';
|
8158 | }
|
8159 | if (isSVG) {
|
8160 | el.setAttribute('class', value);
|
8161 | }
|
8162 | else {
|
8163 |
|
8164 |
|
8165 |
|
8166 | const transitionClasses = el._vtc;
|
8167 | if (transitionClasses) {
|
8168 | value = (value
|
8169 | ? [value, ...transitionClasses]
|
8170 | : [...transitionClasses]).join(' ');
|
8171 | }
|
8172 | el.className = value;
|
8173 | }
|
8174 | }
|
8175 |
|
8176 | function patchStyle(el, prev, next) {
|
8177 | const style = el.style;
|
8178 | if (!next) {
|
8179 | el.removeAttribute('style');
|
8180 | }
|
8181 | else if (isString(next)) {
|
8182 | if (prev !== next) {
|
8183 | const current = style.display;
|
8184 | style.cssText = next;
|
8185 |
|
8186 |
|
8187 |
|
8188 | if ('_vod' in el) {
|
8189 | style.display = current;
|
8190 | }
|
8191 | }
|
8192 | }
|
8193 | else {
|
8194 | for (const key in next) {
|
8195 | setStyle(style, key, next[key]);
|
8196 | }
|
8197 | if (prev && !isString(prev)) {
|
8198 | for (const key in prev) {
|
8199 | if (next[key] == null) {
|
8200 | setStyle(style, key, '');
|
8201 | }
|
8202 | }
|
8203 | }
|
8204 | }
|
8205 | }
|
8206 | const importantRE = /\s*!important$/;
|
8207 | function setStyle(style, name, val) {
|
8208 | if (isArray(val)) {
|
8209 | val.forEach(v => setStyle(style, name, v));
|
8210 | }
|
8211 | else {
|
8212 | if (name.startsWith('--')) {
|
8213 |
|
8214 | style.setProperty(name, val);
|
8215 | }
|
8216 | else {
|
8217 | const prefixed = autoPrefix(style, name);
|
8218 | if (importantRE.test(val)) {
|
8219 |
|
8220 | style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
|
8221 | }
|
8222 | else {
|
8223 | style[prefixed] = val;
|
8224 | }
|
8225 | }
|
8226 | }
|
8227 | }
|
8228 | const prefixes = ['Webkit', 'Moz', 'ms'];
|
8229 | const prefixCache = {};
|
8230 | function autoPrefix(style, rawName) {
|
8231 | const cached = prefixCache[rawName];
|
8232 | if (cached) {
|
8233 | return cached;
|
8234 | }
|
8235 | let name = camelize(rawName);
|
8236 | if (name !== 'filter' && name in style) {
|
8237 | return (prefixCache[rawName] = name);
|
8238 | }
|
8239 | name = capitalize(name);
|
8240 | for (let i = 0; i < prefixes.length; i++) {
|
8241 | const prefixed = prefixes[i] + name;
|
8242 | if (prefixed in style) {
|
8243 | return (prefixCache[rawName] = prefixed);
|
8244 | }
|
8245 | }
|
8246 | return rawName;
|
8247 | }
|
8248 |
|
8249 | const xlinkNS = 'http://www.w3.org/1999/xlink';
|
8250 | function patchAttr(el, key, value, isSVG) {
|
8251 | if (isSVG && key.startsWith('xlink:')) {
|
8252 | if (value == null) {
|
8253 | el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
8254 | }
|
8255 | else {
|
8256 | el.setAttributeNS(xlinkNS, key, value);
|
8257 | }
|
8258 | }
|
8259 | else {
|
8260 |
|
8261 |
|
8262 | const isBoolean = isSpecialBooleanAttr(key);
|
8263 | if (value == null || (isBoolean && value === false)) {
|
8264 | el.removeAttribute(key);
|
8265 | }
|
8266 | else {
|
8267 | el.setAttribute(key, isBoolean ? '' : value);
|
8268 | }
|
8269 | }
|
8270 | }
|
8271 |
|
8272 |
|
8273 |
|
8274 | function patchDOMProp(el, key, value,
|
8275 | // the following args are passed only due to potential innerHTML/textContent
|
8276 |
|
8277 |
|
8278 | prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
8279 | if (key === 'innerHTML' || key === 'textContent') {
|
8280 | if (prevChildren) {
|
8281 | unmountChildren(prevChildren, parentComponent, parentSuspense);
|
8282 | }
|
8283 | el[key] = value == null ? '' : value;
|
8284 | return;
|
8285 | }
|
8286 | if (key === 'value' && el.tagName !== 'PROGRESS') {
|
8287 |
|
8288 |
|
8289 | el._value = value;
|
8290 | const newValue = value == null ? '' : value;
|
8291 | if (el.value !== newValue) {
|
8292 | el.value = newValue;
|
8293 | }
|
8294 | return;
|
8295 | }
|
8296 | if (value === '' || value == null) {
|
8297 | const type = typeof el[key];
|
8298 | if (value === '' && type === 'boolean') {
|
8299 |
|
8300 | el[key] = true;
|
8301 | return;
|
8302 | }
|
8303 | else if (value == null && type === 'string') {
|
8304 |
|
8305 | el[key] = '';
|
8306 | el.removeAttribute(key);
|
8307 | return;
|
8308 | }
|
8309 | else if (type === 'number') {
|
8310 |
|
8311 | el[key] = 0;
|
8312 | el.removeAttribute(key);
|
8313 | return;
|
8314 | }
|
8315 | }
|
8316 |
|
8317 | try {
|
8318 | el[key] = value;
|
8319 | }
|
8320 | catch (e) {
|
8321 | {
|
8322 | warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
8323 | `value ${value} is invalid.`, e);
|
8324 | }
|
8325 | }
|
8326 | }
|
8327 |
|
8328 |
|
8329 | let _getNow = Date.now;
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 | if (typeof document !== 'undefined' &&
|
8335 | _getNow() > document.createEvent('Event').timeStamp) {
|
8336 |
|
8337 |
|
8338 |
|
8339 | _getNow = () => performance.now();
|
8340 | }
|
8341 |
|
8342 |
|
8343 | let cachedNow = 0;
|
8344 | const p = Promise.resolve();
|
8345 | const reset = () => {
|
8346 | cachedNow = 0;
|
8347 | };
|
8348 | const getNow = () => cachedNow || (p.then(reset), (cachedNow = _getNow()));
|
8349 | function addEventListener(el, event, handler, options) {
|
8350 | el.addEventListener(event, handler, options);
|
8351 | }
|
8352 | function removeEventListener(el, event, handler, options) {
|
8353 | el.removeEventListener(event, handler, options);
|
8354 | }
|
8355 | function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
8356 |
|
8357 | const invokers = el._vei || (el._vei = {});
|
8358 | const existingInvoker = invokers[rawName];
|
8359 | if (nextValue && existingInvoker) {
|
8360 |
|
8361 | existingInvoker.value = nextValue;
|
8362 | }
|
8363 | else {
|
8364 | const [name, options] = parseName(rawName);
|
8365 | if (nextValue) {
|
8366 |
|
8367 | const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
|
8368 | addEventListener(el, name, invoker, options);
|
8369 | }
|
8370 | else if (existingInvoker) {
|
8371 |
|
8372 | removeEventListener(el, name, existingInvoker, options);
|
8373 | invokers[rawName] = undefined;
|
8374 | }
|
8375 | }
|
8376 | }
|
8377 | const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
8378 | function parseName(name) {
|
8379 | let options;
|
8380 | if (optionsModifierRE.test(name)) {
|
8381 | options = {};
|
8382 | let m;
|
8383 | while ((m = name.match(optionsModifierRE))) {
|
8384 | name = name.slice(0, name.length - m[0].length);
|
8385 | options[m[0].toLowerCase()] = true;
|
8386 | }
|
8387 | }
|
8388 | return [hyphenate(name.slice(2)), options];
|
8389 | }
|
8390 | function createInvoker(initialValue, instance) {
|
8391 | const invoker = (e) => {
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 | const timeStamp = e.timeStamp || _getNow();
|
8399 | if (timeStamp >= invoker.attached - 1) {
|
8400 | callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 , [e]);
|
8401 | }
|
8402 | };
|
8403 | invoker.value = initialValue;
|
8404 | invoker.attached = getNow();
|
8405 | return invoker;
|
8406 | }
|
8407 | function patchStopImmediatePropagation(e, value) {
|
8408 | if (isArray(value)) {
|
8409 | const originalStop = e.stopImmediatePropagation;
|
8410 | e.stopImmediatePropagation = () => {
|
8411 | originalStop.call(e);
|
8412 | e._stopped = true;
|
8413 | };
|
8414 | return value.map(fn => (e) => !e._stopped && fn(e));
|
8415 | }
|
8416 | else {
|
8417 | return value;
|
8418 | }
|
8419 | }
|
8420 |
|
8421 | const nativeOnRE = /^on[a-z]/;
|
8422 | const forcePatchProp = (_, key) => key === 'value';
|
8423 | const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
8424 | switch (key) {
|
8425 |
|
8426 | case 'class':
|
8427 | patchClass(el, nextValue, isSVG);
|
8428 | break;
|
8429 | case 'style':
|
8430 | patchStyle(el, prevValue, nextValue);
|
8431 | break;
|
8432 | default:
|
8433 | if (isOn(key)) {
|
8434 |
|
8435 | if (!isModelListener(key)) {
|
8436 | patchEvent(el, key, prevValue, nextValue, parentComponent);
|
8437 | }
|
8438 | }
|
8439 | else if (shouldSetAsProp(el, key, nextValue, isSVG)) {
|
8440 | patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
|
8441 | }
|
8442 | else {
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 | if (key === 'true-value') {
|
8448 | el._trueValue = nextValue;
|
8449 | }
|
8450 | else if (key === 'false-value') {
|
8451 | el._falseValue = nextValue;
|
8452 | }
|
8453 | patchAttr(el, key, nextValue, isSVG);
|
8454 | }
|
8455 | break;
|
8456 | }
|
8457 | };
|
8458 | function shouldSetAsProp(el, key, value, isSVG) {
|
8459 | if (isSVG) {
|
8460 |
|
8461 |
|
8462 | if (key === 'innerHTML') {
|
8463 | return true;
|
8464 | }
|
8465 |
|
8466 | if (key in el && nativeOnRE.test(key) && isFunction(value)) {
|
8467 | return true;
|
8468 | }
|
8469 | return false;
|
8470 | }
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 | if (key === 'spellcheck' || key === 'draggable') {
|
8478 | return false;
|
8479 | }
|
8480 |
|
8481 |
|
8482 | if (key === 'form') {
|
8483 | return false;
|
8484 | }
|
8485 |
|
8486 | if (key === 'list' && el.tagName === 'INPUT') {
|
8487 | return false;
|
8488 | }
|
8489 |
|
8490 | if (key === 'type' && el.tagName === 'TEXTAREA') {
|
8491 | return false;
|
8492 | }
|
8493 |
|
8494 | if (nativeOnRE.test(key) && isString(value)) {
|
8495 | return false;
|
8496 | }
|
8497 | return key in el;
|
8498 | }
|
8499 |
|
8500 | function useCssModule(name = '$style') {
|
8501 |
|
8502 | {
|
8503 | {
|
8504 | warn(`useCssModule() is not supported in the global build.`);
|
8505 | }
|
8506 | return EMPTY_OBJ;
|
8507 | }
|
8508 | }
|
8509 |
|
8510 | |
8511 |
|
8512 |
|
8513 |
|
8514 | function useCssVars(getter) {
|
8515 | const instance = getCurrentInstance();
|
8516 |
|
8517 | if (!instance) {
|
8518 | warn(`useCssVars is called without current active component instance.`);
|
8519 | return;
|
8520 | }
|
8521 | const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
|
8522 | onMounted(() => watchEffect(setVars, { flush: 'post' }));
|
8523 | onUpdated(setVars);
|
8524 | }
|
8525 | function setVarsOnVNode(vnode, vars) {
|
8526 | if (vnode.shapeFlag & 128 ) {
|
8527 | const suspense = vnode.suspense;
|
8528 | vnode = suspense.activeBranch;
|
8529 | if (suspense.pendingBranch && !suspense.isHydrating) {
|
8530 | suspense.effects.push(() => {
|
8531 | setVarsOnVNode(suspense.activeBranch, vars);
|
8532 | });
|
8533 | }
|
8534 | }
|
8535 |
|
8536 | while (vnode.component) {
|
8537 | vnode = vnode.component.subTree;
|
8538 | }
|
8539 | if (vnode.shapeFlag & 1 && vnode.el) {
|
8540 | const style = vnode.el.style;
|
8541 | for (const key in vars) {
|
8542 | style.setProperty(`--${key}`, vars[key]);
|
8543 | }
|
8544 | }
|
8545 | else if (vnode.type === Fragment) {
|
8546 | vnode.children.forEach(c => setVarsOnVNode(c, vars));
|
8547 | }
|
8548 | }
|
8549 |
|
8550 | const TRANSITION = 'transition';
|
8551 | const ANIMATION = 'animation';
|
8552 |
|
8553 |
|
8554 | const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
|
8555 | Transition.displayName = 'Transition';
|
8556 | const DOMTransitionPropsValidators = {
|
8557 | name: String,
|
8558 | type: String,
|
8559 | css: {
|
8560 | type: Boolean,
|
8561 | default: true
|
8562 | },
|
8563 | duration: [String, Number, Object],
|
8564 | enterFromClass: String,
|
8565 | enterActiveClass: String,
|
8566 | enterToClass: String,
|
8567 | appearFromClass: String,
|
8568 | appearActiveClass: String,
|
8569 | appearToClass: String,
|
8570 | leaveFromClass: String,
|
8571 | leaveActiveClass: String,
|
8572 | leaveToClass: String
|
8573 | };
|
8574 | const TransitionPropsValidators = (Transition.props = extend({}, BaseTransition.props, DOMTransitionPropsValidators));
|
8575 | function resolveTransitionProps(rawProps) {
|
8576 | let { name = 'v', type, css = true, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
|
8577 | const baseProps = {};
|
8578 | for (const key in rawProps) {
|
8579 | if (!(key in DOMTransitionPropsValidators)) {
|
8580 | baseProps[key] = rawProps[key];
|
8581 | }
|
8582 | }
|
8583 | if (!css) {
|
8584 | return baseProps;
|
8585 | }
|
8586 | const durations = normalizeDuration(duration);
|
8587 | const enterDuration = durations && durations[0];
|
8588 | const leaveDuration = durations && durations[1];
|
8589 | const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
|
8590 | const finishEnter = (el, isAppear, done) => {
|
8591 | removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
8592 | removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
8593 | done && done();
|
8594 | };
|
8595 | const finishLeave = (el, done) => {
|
8596 | removeTransitionClass(el, leaveToClass);
|
8597 | removeTransitionClass(el, leaveActiveClass);
|
8598 | done && done();
|
8599 | };
|
8600 | const makeEnterHook = (isAppear) => {
|
8601 | return (el, done) => {
|
8602 | const hook = isAppear ? onAppear : onEnter;
|
8603 | const resolve = () => finishEnter(el, isAppear, done);
|
8604 | hook && hook(el, resolve);
|
8605 | nextFrame(() => {
|
8606 | removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
8607 | addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
8608 | if (!(hook && hook.length > 1)) {
|
8609 | whenTransitionEnds(el, type, enterDuration, resolve);
|
8610 | }
|
8611 | });
|
8612 | };
|
8613 | };
|
8614 | return extend(baseProps, {
|
8615 | onBeforeEnter(el) {
|
8616 | onBeforeEnter && onBeforeEnter(el);
|
8617 | addTransitionClass(el, enterFromClass);
|
8618 | addTransitionClass(el, enterActiveClass);
|
8619 | },
|
8620 | onBeforeAppear(el) {
|
8621 | onBeforeAppear && onBeforeAppear(el);
|
8622 | addTransitionClass(el, appearFromClass);
|
8623 | addTransitionClass(el, appearActiveClass);
|
8624 | },
|
8625 | onEnter: makeEnterHook(false),
|
8626 | onAppear: makeEnterHook(true),
|
8627 | onLeave(el, done) {
|
8628 | const resolve = () => finishLeave(el, done);
|
8629 | addTransitionClass(el, leaveFromClass);
|
8630 |
|
8631 | forceReflow();
|
8632 | addTransitionClass(el, leaveActiveClass);
|
8633 | nextFrame(() => {
|
8634 | removeTransitionClass(el, leaveFromClass);
|
8635 | addTransitionClass(el, leaveToClass);
|
8636 | if (!(onLeave && onLeave.length > 1)) {
|
8637 | whenTransitionEnds(el, type, leaveDuration, resolve);
|
8638 | }
|
8639 | });
|
8640 | onLeave && onLeave(el, resolve);
|
8641 | },
|
8642 | onEnterCancelled(el) {
|
8643 | finishEnter(el, false);
|
8644 | onEnterCancelled && onEnterCancelled(el);
|
8645 | },
|
8646 | onAppearCancelled(el) {
|
8647 | finishEnter(el, true);
|
8648 | onAppearCancelled && onAppearCancelled(el);
|
8649 | },
|
8650 | onLeaveCancelled(el) {
|
8651 | finishLeave(el);
|
8652 | onLeaveCancelled && onLeaveCancelled(el);
|
8653 | }
|
8654 | });
|
8655 | }
|
8656 | function normalizeDuration(duration) {
|
8657 | if (duration == null) {
|
8658 | return null;
|
8659 | }
|
8660 | else if (isObject(duration)) {
|
8661 | return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
8662 | }
|
8663 | else {
|
8664 | const n = NumberOf(duration);
|
8665 | return [n, n];
|
8666 | }
|
8667 | }
|
8668 | function NumberOf(val) {
|
8669 | const res = toNumber(val);
|
8670 | validateDuration(res);
|
8671 | return res;
|
8672 | }
|
8673 | function validateDuration(val) {
|
8674 | if (typeof val !== 'number') {
|
8675 | warn(`<transition> explicit duration is not a valid number - ` +
|
8676 | `got ${JSON.stringify(val)}.`);
|
8677 | }
|
8678 | else if (isNaN(val)) {
|
8679 | warn(`<transition> explicit duration is NaN - ` +
|
8680 | 'the duration expression might be incorrect.');
|
8681 | }
|
8682 | }
|
8683 | function addTransitionClass(el, cls) {
|
8684 | cls.split(/\s+/).forEach(c => c && el.classList.add(c));
|
8685 | (el._vtc ||
|
8686 | (el._vtc = new Set())).add(cls);
|
8687 | }
|
8688 | function removeTransitionClass(el, cls) {
|
8689 | cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
|
8690 | const { _vtc } = el;
|
8691 | if (_vtc) {
|
8692 | _vtc.delete(cls);
|
8693 | if (!_vtc.size) {
|
8694 | el._vtc = undefined;
|
8695 | }
|
8696 | }
|
8697 | }
|
8698 | function nextFrame(cb) {
|
8699 | requestAnimationFrame(() => {
|
8700 | requestAnimationFrame(cb);
|
8701 | });
|
8702 | }
|
8703 | let endId = 0;
|
8704 | function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
8705 | const id = (el._endId = ++endId);
|
8706 | const resolveIfNotStale = () => {
|
8707 | if (id === el._endId) {
|
8708 | resolve();
|
8709 | }
|
8710 | };
|
8711 | if (explicitTimeout) {
|
8712 | return setTimeout(resolveIfNotStale, explicitTimeout);
|
8713 | }
|
8714 | const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
8715 | if (!type) {
|
8716 | return resolve();
|
8717 | }
|
8718 | const endEvent = type + 'end';
|
8719 | let ended = 0;
|
8720 | const end = () => {
|
8721 | el.removeEventListener(endEvent, onEnd);
|
8722 | resolveIfNotStale();
|
8723 | };
|
8724 | const onEnd = (e) => {
|
8725 | if (e.target === el && ++ended >= propCount) {
|
8726 | end();
|
8727 | }
|
8728 | };
|
8729 | setTimeout(() => {
|
8730 | if (ended < propCount) {
|
8731 | end();
|
8732 | }
|
8733 | }, timeout + 1);
|
8734 | el.addEventListener(endEvent, onEnd);
|
8735 | }
|
8736 | function getTransitionInfo(el, expectedType) {
|
8737 | const styles = window.getComputedStyle(el);
|
8738 |
|
8739 | const getStyleProperties = (key) => (styles[key] || '').split(', ');
|
8740 | const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
|
8741 | const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
|
8742 | const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8743 | const animationDelays = getStyleProperties(ANIMATION + 'Delay');
|
8744 | const animationDurations = getStyleProperties(ANIMATION + 'Duration');
|
8745 | const animationTimeout = getTimeout(animationDelays, animationDurations);
|
8746 | let type = null;
|
8747 | let timeout = 0;
|
8748 | let propCount = 0;
|
8749 |
|
8750 | if (expectedType === TRANSITION) {
|
8751 | if (transitionTimeout > 0) {
|
8752 | type = TRANSITION;
|
8753 | timeout = transitionTimeout;
|
8754 | propCount = transitionDurations.length;
|
8755 | }
|
8756 | }
|
8757 | else if (expectedType === ANIMATION) {
|
8758 | if (animationTimeout > 0) {
|
8759 | type = ANIMATION;
|
8760 | timeout = animationTimeout;
|
8761 | propCount = animationDurations.length;
|
8762 | }
|
8763 | }
|
8764 | else {
|
8765 | timeout = Math.max(transitionTimeout, animationTimeout);
|
8766 | type =
|
8767 | timeout > 0
|
8768 | ? transitionTimeout > animationTimeout
|
8769 | ? TRANSITION
|
8770 | : ANIMATION
|
8771 | : null;
|
8772 | propCount = type
|
8773 | ? type === TRANSITION
|
8774 | ? transitionDurations.length
|
8775 | : animationDurations.length
|
8776 | : 0;
|
8777 | }
|
8778 | const hasTransform = type === TRANSITION &&
|
8779 | /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
|
8780 | return {
|
8781 | type,
|
8782 | timeout,
|
8783 | propCount,
|
8784 | hasTransform
|
8785 | };
|
8786 | }
|
8787 | function getTimeout(delays, durations) {
|
8788 | while (delays.length < durations.length) {
|
8789 | delays = delays.concat(delays);
|
8790 | }
|
8791 | return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
8792 | }
|
8793 |
|
8794 |
|
8795 |
|
8796 |
|
8797 | function toMs(s) {
|
8798 | return Number(s.slice(0, -1).replace(',', '.')) * 1000;
|
8799 | }
|
8800 |
|
8801 | function forceReflow() {
|
8802 | return document.body.offsetHeight;
|
8803 | }
|
8804 |
|
8805 | const positionMap = new WeakMap();
|
8806 | const newPositionMap = new WeakMap();
|
8807 | const TransitionGroupImpl = {
|
8808 | name: 'TransitionGroup',
|
8809 | props: extend({}, TransitionPropsValidators, {
|
8810 | tag: String,
|
8811 | moveClass: String
|
8812 | }),
|
8813 | setup(props, { slots }) {
|
8814 | const instance = getCurrentInstance();
|
8815 | const state = useTransitionState();
|
8816 | let prevChildren;
|
8817 | let children;
|
8818 | onUpdated(() => {
|
8819 |
|
8820 | if (!prevChildren.length) {
|
8821 | return;
|
8822 | }
|
8823 | const moveClass = props.moveClass || `${props.name || 'v'}-move`;
|
8824 | if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
|
8825 | return;
|
8826 | }
|
8827 |
|
8828 |
|
8829 | prevChildren.forEach(callPendingCbs);
|
8830 | prevChildren.forEach(recordPosition);
|
8831 | const movedChildren = prevChildren.filter(applyTranslation);
|
8832 |
|
8833 | forceReflow();
|
8834 | movedChildren.forEach(c => {
|
8835 | const el = c.el;
|
8836 | const style = el.style;
|
8837 | addTransitionClass(el, moveClass);
|
8838 | style.transform = style.webkitTransform = style.transitionDuration = '';
|
8839 | const cb = (el._moveCb = (e) => {
|
8840 | if (e && e.target !== el) {
|
8841 | return;
|
8842 | }
|
8843 | if (!e || /transform$/.test(e.propertyName)) {
|
8844 | el.removeEventListener('transitionend', cb);
|
8845 | el._moveCb = null;
|
8846 | removeTransitionClass(el, moveClass);
|
8847 | }
|
8848 | });
|
8849 | el.addEventListener('transitionend', cb);
|
8850 | });
|
8851 | });
|
8852 | return () => {
|
8853 | const rawProps = toRaw(props);
|
8854 | const cssTransitionProps = resolveTransitionProps(rawProps);
|
8855 | const tag = rawProps.tag || Fragment;
|
8856 | prevChildren = children;
|
8857 | children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
8858 | for (let i = 0; i < children.length; i++) {
|
8859 | const child = children[i];
|
8860 | if (child.key != null) {
|
8861 | setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
8862 | }
|
8863 | else {
|
8864 | warn(`<TransitionGroup> children must be keyed.`);
|
8865 | }
|
8866 | }
|
8867 | if (prevChildren) {
|
8868 | for (let i = 0; i < prevChildren.length; i++) {
|
8869 | const child = prevChildren[i];
|
8870 | setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
8871 | positionMap.set(child, child.el.getBoundingClientRect());
|
8872 | }
|
8873 | }
|
8874 | return createVNode(tag, null, children);
|
8875 | };
|
8876 | }
|
8877 | };
|
8878 | const TransitionGroup = TransitionGroupImpl;
|
8879 | function callPendingCbs(c) {
|
8880 | const el = c.el;
|
8881 | if (el._moveCb) {
|
8882 | el._moveCb();
|
8883 | }
|
8884 | if (el._enterCb) {
|
8885 | el._enterCb();
|
8886 | }
|
8887 | }
|
8888 | function recordPosition(c) {
|
8889 | newPositionMap.set(c, c.el.getBoundingClientRect());
|
8890 | }
|
8891 | function applyTranslation(c) {
|
8892 | const oldPos = positionMap.get(c);
|
8893 | const newPos = newPositionMap.get(c);
|
8894 | const dx = oldPos.left - newPos.left;
|
8895 | const dy = oldPos.top - newPos.top;
|
8896 | if (dx || dy) {
|
8897 | const s = c.el.style;
|
8898 | s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
8899 | s.transitionDuration = '0s';
|
8900 | return c;
|
8901 | }
|
8902 | }
|
8903 | function hasCSSTransform(el, root, moveClass) {
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 | const clone = el.cloneNode();
|
8910 | if (el._vtc) {
|
8911 | el._vtc.forEach(cls => {
|
8912 | cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
|
8913 | });
|
8914 | }
|
8915 | moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
|
8916 | clone.style.display = 'none';
|
8917 | const container = (root.nodeType === 1
|
8918 | ? root
|
8919 | : root.parentNode);
|
8920 | container.appendChild(clone);
|
8921 | const { hasTransform } = getTransitionInfo(clone);
|
8922 | container.removeChild(clone);
|
8923 | return hasTransform;
|
8924 | }
|
8925 |
|
8926 | const getModelAssigner = (vnode) => {
|
8927 | const fn = vnode.props['onUpdate:modelValue'];
|
8928 | return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
8929 | };
|
8930 | function onCompositionStart(e) {
|
8931 | e.target.composing = true;
|
8932 | }
|
8933 | function onCompositionEnd(e) {
|
8934 | const target = e.target;
|
8935 | if (target.composing) {
|
8936 | target.composing = false;
|
8937 | trigger$1(target, 'input');
|
8938 | }
|
8939 | }
|
8940 | function trigger$1(el, type) {
|
8941 | const e = document.createEvent('HTMLEvents');
|
8942 | e.initEvent(type, true, true);
|
8943 | el.dispatchEvent(e);
|
8944 | }
|
8945 |
|
8946 |
|
8947 | const vModelText = {
|
8948 | created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
8949 | el._assign = getModelAssigner(vnode);
|
8950 | const castToNumber = number || el.type === 'number';
|
8951 | addEventListener(el, lazy ? 'change' : 'input', e => {
|
8952 | if (e.target.composing)
|
8953 | return;
|
8954 | let domValue = el.value;
|
8955 | if (trim) {
|
8956 | domValue = domValue.trim();
|
8957 | }
|
8958 | else if (castToNumber) {
|
8959 | domValue = toNumber(domValue);
|
8960 | }
|
8961 | el._assign(domValue);
|
8962 | });
|
8963 | if (trim) {
|
8964 | addEventListener(el, 'change', () => {
|
8965 | el.value = el.value.trim();
|
8966 | });
|
8967 | }
|
8968 | if (!lazy) {
|
8969 | addEventListener(el, 'compositionstart', onCompositionStart);
|
8970 | addEventListener(el, 'compositionend', onCompositionEnd);
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 | addEventListener(el, 'change', onCompositionEnd);
|
8976 | }
|
8977 | },
|
8978 |
|
8979 | mounted(el, { value }) {
|
8980 | el.value = value == null ? '' : value;
|
8981 | },
|
8982 | beforeUpdate(el, { value, modifiers: { trim, number } }, vnode) {
|
8983 | el._assign = getModelAssigner(vnode);
|
8984 |
|
8985 | if (el.composing)
|
8986 | return;
|
8987 | if (document.activeElement === el) {
|
8988 | if (trim && el.value.trim() === value) {
|
8989 | return;
|
8990 | }
|
8991 | if ((number || el.type === 'number') && toNumber(el.value) === value) {
|
8992 | return;
|
8993 | }
|
8994 | }
|
8995 | const newValue = value == null ? '' : value;
|
8996 | if (el.value !== newValue) {
|
8997 | el.value = newValue;
|
8998 | }
|
8999 | }
|
9000 | };
|
9001 | const vModelCheckbox = {
|
9002 | created(el, _, vnode) {
|
9003 | el._assign = getModelAssigner(vnode);
|
9004 | addEventListener(el, 'change', () => {
|
9005 | const modelValue = el._modelValue;
|
9006 | const elementValue = getValue(el);
|
9007 | const checked = el.checked;
|
9008 | const assign = el._assign;
|
9009 | if (isArray(modelValue)) {
|
9010 | const index = looseIndexOf(modelValue, elementValue);
|
9011 | const found = index !== -1;
|
9012 | if (checked && !found) {
|
9013 | assign(modelValue.concat(elementValue));
|
9014 | }
|
9015 | else if (!checked && found) {
|
9016 | const filtered = [...modelValue];
|
9017 | filtered.splice(index, 1);
|
9018 | assign(filtered);
|
9019 | }
|
9020 | }
|
9021 | else if (isSet(modelValue)) {
|
9022 | const cloned = new Set(modelValue);
|
9023 | if (checked) {
|
9024 | cloned.add(elementValue);
|
9025 | }
|
9026 | else {
|
9027 | cloned.delete(elementValue);
|
9028 | }
|
9029 | assign(cloned);
|
9030 | }
|
9031 | else {
|
9032 | assign(getCheckboxValue(el, checked));
|
9033 | }
|
9034 | });
|
9035 | },
|
9036 |
|
9037 | mounted: setChecked,
|
9038 | beforeUpdate(el, binding, vnode) {
|
9039 | el._assign = getModelAssigner(vnode);
|
9040 | setChecked(el, binding, vnode);
|
9041 | }
|
9042 | };
|
9043 | function setChecked(el, { value, oldValue }, vnode) {
|
9044 | el._modelValue = value;
|
9045 | if (isArray(value)) {
|
9046 | el.checked = looseIndexOf(value, vnode.props.value) > -1;
|
9047 | }
|
9048 | else if (isSet(value)) {
|
9049 | el.checked = value.has(vnode.props.value);
|
9050 | }
|
9051 | else if (value !== oldValue) {
|
9052 | el.checked = looseEqual(value, getCheckboxValue(el, true));
|
9053 | }
|
9054 | }
|
9055 | const vModelRadio = {
|
9056 | created(el, { value }, vnode) {
|
9057 | el.checked = looseEqual(value, vnode.props.value);
|
9058 | el._assign = getModelAssigner(vnode);
|
9059 | addEventListener(el, 'change', () => {
|
9060 | el._assign(getValue(el));
|
9061 | });
|
9062 | },
|
9063 | beforeUpdate(el, { value, oldValue }, vnode) {
|
9064 | el._assign = getModelAssigner(vnode);
|
9065 | if (value !== oldValue) {
|
9066 | el.checked = looseEqual(value, vnode.props.value);
|
9067 | }
|
9068 | }
|
9069 | };
|
9070 | const vModelSelect = {
|
9071 | created(el, { value, modifiers: { number } }, vnode) {
|
9072 | const isSetModel = isSet(value);
|
9073 | addEventListener(el, 'change', () => {
|
9074 | const selectedVal = Array.prototype.filter
|
9075 | .call(el.options, (o) => o.selected)
|
9076 | .map((o) => number ? toNumber(getValue(o)) : getValue(o));
|
9077 | el._assign(el.multiple
|
9078 | ? isSetModel
|
9079 | ? new Set(selectedVal)
|
9080 | : selectedVal
|
9081 | : selectedVal[0]);
|
9082 | });
|
9083 | el._assign = getModelAssigner(vnode);
|
9084 | },
|
9085 |
|
9086 |
|
9087 | mounted(el, { value }) {
|
9088 | setSelected(el, value);
|
9089 | },
|
9090 | beforeUpdate(el, _binding, vnode) {
|
9091 | el._assign = getModelAssigner(vnode);
|
9092 | },
|
9093 | updated(el, { value }) {
|
9094 | setSelected(el, value);
|
9095 | }
|
9096 | };
|
9097 | function setSelected(el, value) {
|
9098 | const isMultiple = el.multiple;
|
9099 | if (isMultiple && !isArray(value) && !isSet(value)) {
|
9100 | warn(`<select multiple v-model> expects an Array or Set value for its binding, ` +
|
9101 | `but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
|
9102 | return;
|
9103 | }
|
9104 | for (let i = 0, l = el.options.length; i < l; i++) {
|
9105 | const option = el.options[i];
|
9106 | const optionValue = getValue(option);
|
9107 | if (isMultiple) {
|
9108 | if (isArray(value)) {
|
9109 | option.selected = looseIndexOf(value, optionValue) > -1;
|
9110 | }
|
9111 | else {
|
9112 | option.selected = value.has(optionValue);
|
9113 | }
|
9114 | }
|
9115 | else {
|
9116 | if (looseEqual(getValue(option), value)) {
|
9117 | el.selectedIndex = i;
|
9118 | return;
|
9119 | }
|
9120 | }
|
9121 | }
|
9122 | if (!isMultiple) {
|
9123 | el.selectedIndex = -1;
|
9124 | }
|
9125 | }
|
9126 |
|
9127 | function getValue(el) {
|
9128 | return '_value' in el ? el._value : el.value;
|
9129 | }
|
9130 |
|
9131 | function getCheckboxValue(el, checked) {
|
9132 | const key = checked ? '_trueValue' : '_falseValue';
|
9133 | return key in el ? el[key] : checked;
|
9134 | }
|
9135 | const vModelDynamic = {
|
9136 | created(el, binding, vnode) {
|
9137 | callModelHook(el, binding, vnode, null, 'created');
|
9138 | },
|
9139 | mounted(el, binding, vnode) {
|
9140 | callModelHook(el, binding, vnode, null, 'mounted');
|
9141 | },
|
9142 | beforeUpdate(el, binding, vnode, prevVNode) {
|
9143 | callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate');
|
9144 | },
|
9145 | updated(el, binding, vnode, prevVNode) {
|
9146 | callModelHook(el, binding, vnode, prevVNode, 'updated');
|
9147 | }
|
9148 | };
|
9149 | function callModelHook(el, binding, vnode, prevVNode, hook) {
|
9150 | let modelToUse;
|
9151 | switch (el.tagName) {
|
9152 | case 'SELECT':
|
9153 | modelToUse = vModelSelect;
|
9154 | break;
|
9155 | case 'TEXTAREA':
|
9156 | modelToUse = vModelText;
|
9157 | break;
|
9158 | default:
|
9159 | switch (vnode.props && vnode.props.type) {
|
9160 | case 'checkbox':
|
9161 | modelToUse = vModelCheckbox;
|
9162 | break;
|
9163 | case 'radio':
|
9164 | modelToUse = vModelRadio;
|
9165 | break;
|
9166 | default:
|
9167 | modelToUse = vModelText;
|
9168 | }
|
9169 | }
|
9170 | const fn = modelToUse[hook];
|
9171 | fn && fn(el, binding, vnode, prevVNode);
|
9172 | }
|
9173 |
|
9174 | const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
|
9175 | const modifierGuards = {
|
9176 | stop: e => e.stopPropagation(),
|
9177 | prevent: e => e.preventDefault(),
|
9178 | self: e => e.target !== e.currentTarget,
|
9179 | ctrl: e => !e.ctrlKey,
|
9180 | shift: e => !e.shiftKey,
|
9181 | alt: e => !e.altKey,
|
9182 | meta: e => !e.metaKey,
|
9183 | left: e => 'button' in e && e.button !== 0,
|
9184 | middle: e => 'button' in e && e.button !== 1,
|
9185 | right: e => 'button' in e && e.button !== 2,
|
9186 | exact: (e, modifiers) => systemModifiers.some(m => e[`${m}Key`] && !modifiers.includes(m))
|
9187 | };
|
9188 | |
9189 |
|
9190 |
|
9191 | const withModifiers = (fn, modifiers) => {
|
9192 | return (event, ...args) => {
|
9193 | for (let i = 0; i < modifiers.length; i++) {
|
9194 | const guard = modifierGuards[modifiers[i]];
|
9195 | if (guard && guard(event, modifiers))
|
9196 | return;
|
9197 | }
|
9198 | return fn(event, ...args);
|
9199 | };
|
9200 | };
|
9201 |
|
9202 |
|
9203 | const keyNames = {
|
9204 | esc: 'escape',
|
9205 | space: ' ',
|
9206 | up: 'arrow-up',
|
9207 | left: 'arrow-left',
|
9208 | right: 'arrow-right',
|
9209 | down: 'arrow-down',
|
9210 | delete: 'backspace'
|
9211 | };
|
9212 | |
9213 |
|
9214 |
|
9215 | const withKeys = (fn, modifiers) => {
|
9216 | return (event) => {
|
9217 | if (!('key' in event))
|
9218 | return;
|
9219 | const eventKey = hyphenate(event.key);
|
9220 | if (
|
9221 |
|
9222 | !modifiers.some(k => k === eventKey || keyNames[k] === eventKey)) {
|
9223 | return;
|
9224 | }
|
9225 | return fn(event);
|
9226 | };
|
9227 | };
|
9228 |
|
9229 | const vShow = {
|
9230 | beforeMount(el, { value }, { transition }) {
|
9231 | el._vod = el.style.display === 'none' ? '' : el.style.display;
|
9232 | if (transition && value) {
|
9233 | transition.beforeEnter(el);
|
9234 | }
|
9235 | else {
|
9236 | setDisplay(el, value);
|
9237 | }
|
9238 | },
|
9239 | mounted(el, { value }, { transition }) {
|
9240 | if (transition && value) {
|
9241 | transition.enter(el);
|
9242 | }
|
9243 | },
|
9244 | updated(el, { value, oldValue }, { transition }) {
|
9245 | if (!value === !oldValue)
|
9246 | return;
|
9247 | if (transition) {
|
9248 | if (value) {
|
9249 | transition.beforeEnter(el);
|
9250 | setDisplay(el, true);
|
9251 | transition.enter(el);
|
9252 | }
|
9253 | else {
|
9254 | transition.leave(el, () => {
|
9255 | setDisplay(el, false);
|
9256 | });
|
9257 | }
|
9258 | }
|
9259 | else {
|
9260 | setDisplay(el, value);
|
9261 | }
|
9262 | },
|
9263 | beforeUnmount(el, { value }) {
|
9264 | setDisplay(el, value);
|
9265 | }
|
9266 | };
|
9267 | function setDisplay(el, value) {
|
9268 | el.style.display = value ? el._vod : 'none';
|
9269 | }
|
9270 |
|
9271 | const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
|
9272 |
|
9273 |
|
9274 | let renderer;
|
9275 | let enabledHydration = false;
|
9276 | function ensureRenderer() {
|
9277 | return renderer || (renderer = createRenderer(rendererOptions));
|
9278 | }
|
9279 | function ensureHydrationRenderer() {
|
9280 | renderer = enabledHydration
|
9281 | ? renderer
|
9282 | : createHydrationRenderer(rendererOptions);
|
9283 | enabledHydration = true;
|
9284 | return renderer;
|
9285 | }
|
9286 |
|
9287 | const render = ((...args) => {
|
9288 | ensureRenderer().render(...args);
|
9289 | });
|
9290 | const hydrate = ((...args) => {
|
9291 | ensureHydrationRenderer().hydrate(...args);
|
9292 | });
|
9293 | const createApp = ((...args) => {
|
9294 | const app = ensureRenderer().createApp(...args);
|
9295 | {
|
9296 | injectNativeTagCheck(app);
|
9297 | injectCustomElementCheck(app);
|
9298 | }
|
9299 | const { mount } = app;
|
9300 | app.mount = (containerOrSelector) => {
|
9301 | const container = normalizeContainer(containerOrSelector);
|
9302 | if (!container)
|
9303 | return;
|
9304 | const component = app._component;
|
9305 | if (!isFunction(component) && !component.render && !component.template) {
|
9306 | component.template = container.innerHTML;
|
9307 | }
|
9308 |
|
9309 | container.innerHTML = '';
|
9310 | const proxy = mount(container);
|
9311 | if (container instanceof Element) {
|
9312 | container.removeAttribute('v-cloak');
|
9313 | container.setAttribute('data-v-app', '');
|
9314 | }
|
9315 | return proxy;
|
9316 | };
|
9317 | return app;
|
9318 | });
|
9319 | const createSSRApp = ((...args) => {
|
9320 | const app = ensureHydrationRenderer().createApp(...args);
|
9321 | {
|
9322 | injectNativeTagCheck(app);
|
9323 | injectCustomElementCheck(app);
|
9324 | }
|
9325 | const { mount } = app;
|
9326 | app.mount = (containerOrSelector) => {
|
9327 | const container = normalizeContainer(containerOrSelector);
|
9328 | if (container) {
|
9329 | return mount(container, true);
|
9330 | }
|
9331 | };
|
9332 | return app;
|
9333 | });
|
9334 | function injectNativeTagCheck(app) {
|
9335 |
|
9336 |
|
9337 | Object.defineProperty(app.config, 'isNativeTag', {
|
9338 | value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
9339 | writable: false
|
9340 | });
|
9341 | }
|
9342 |
|
9343 | function injectCustomElementCheck(app) {
|
9344 | if (isRuntimeOnly()) {
|
9345 | const value = app.config.isCustomElement;
|
9346 | Object.defineProperty(app.config, 'isCustomElement', {
|
9347 | get() {
|
9348 | return value;
|
9349 | },
|
9350 | set() {
|
9351 | warn(`The \`isCustomElement\` config option is only respected when using the runtime compiler.` +
|
9352 | `If you are using the runtime-only build, \`isCustomElement\` must be passed to \`@vue/compiler-dom\` in the build setup instead` +
|
9353 | `- for example, via the \`compilerOptions\` option in vue-loader: https://vue-loader.vuejs.org/options.html#compileroptions.`);
|
9354 | }
|
9355 | });
|
9356 | }
|
9357 | }
|
9358 | function normalizeContainer(container) {
|
9359 | if (isString(container)) {
|
9360 | const res = document.querySelector(container);
|
9361 | if (!res) {
|
9362 | warn(`Failed to mount app: mount target selector "${container}" returned null.`);
|
9363 | }
|
9364 | return res;
|
9365 | }
|
9366 | if (container instanceof window.ShadowRoot &&
|
9367 | container.mode === 'closed') {
|
9368 | warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
9369 | }
|
9370 | return container;
|
9371 | }
|
9372 |
|
9373 | function initDev() {
|
9374 | {
|
9375 | {
|
9376 | console.info(`You are running a development build of Vue.\n` +
|
9377 | `Make sure to use the production build (*.prod.js) when deploying for production.`);
|
9378 | }
|
9379 | initCustomFormatter();
|
9380 | }
|
9381 | }
|
9382 |
|
9383 |
|
9384 | {
|
9385 | initDev();
|
9386 | }
|
9387 | const compile$1 = () => {
|
9388 | {
|
9389 | warn(`Runtime compilation is not supported in this build of Vue.` +
|
9390 | (` Use "vue.global.js" instead.`
|
9391 | ) );
|
9392 | }
|
9393 | };
|
9394 |
|
9395 | exports.BaseTransition = BaseTransition;
|
9396 | exports.Comment = Comment;
|
9397 | exports.Fragment = Fragment;
|
9398 | exports.KeepAlive = KeepAlive;
|
9399 | exports.Static = Static;
|
9400 | exports.Suspense = Suspense;
|
9401 | exports.Teleport = Teleport;
|
9402 | exports.Text = Text;
|
9403 | exports.Transition = Transition;
|
9404 | exports.TransitionGroup = TransitionGroup;
|
9405 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
9406 | exports.callWithErrorHandling = callWithErrorHandling;
|
9407 | exports.camelize = camelize;
|
9408 | exports.capitalize = capitalize;
|
9409 | exports.cloneVNode = cloneVNode;
|
9410 | exports.compile = compile$1;
|
9411 | exports.computed = computed$1;
|
9412 | exports.createApp = createApp;
|
9413 | exports.createBlock = createBlock;
|
9414 | exports.createCommentVNode = createCommentVNode;
|
9415 | exports.createHydrationRenderer = createHydrationRenderer;
|
9416 | exports.createRenderer = createRenderer;
|
9417 | exports.createSSRApp = createSSRApp;
|
9418 | exports.createSlots = createSlots;
|
9419 | exports.createStaticVNode = createStaticVNode;
|
9420 | exports.createTextVNode = createTextVNode;
|
9421 | exports.createVNode = createVNode;
|
9422 | exports.customRef = customRef;
|
9423 | exports.defineAsyncComponent = defineAsyncComponent;
|
9424 | exports.defineComponent = defineComponent;
|
9425 | exports.defineEmit = defineEmit;
|
9426 | exports.defineProps = defineProps;
|
9427 | exports.getCurrentInstance = getCurrentInstance;
|
9428 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
9429 | exports.h = h;
|
9430 | exports.handleError = handleError;
|
9431 | exports.hydrate = hydrate;
|
9432 | exports.initCustomFormatter = initCustomFormatter;
|
9433 | exports.inject = inject;
|
9434 | exports.isProxy = isProxy;
|
9435 | exports.isReactive = isReactive;
|
9436 | exports.isReadonly = isReadonly;
|
9437 | exports.isRef = isRef;
|
9438 | exports.isRuntimeOnly = isRuntimeOnly;
|
9439 | exports.isVNode = isVNode;
|
9440 | exports.markRaw = markRaw;
|
9441 | exports.mergeProps = mergeProps;
|
9442 | exports.nextTick = nextTick;
|
9443 | exports.onActivated = onActivated;
|
9444 | exports.onBeforeMount = onBeforeMount;
|
9445 | exports.onBeforeUnmount = onBeforeUnmount;
|
9446 | exports.onBeforeUpdate = onBeforeUpdate;
|
9447 | exports.onDeactivated = onDeactivated;
|
9448 | exports.onErrorCaptured = onErrorCaptured;
|
9449 | exports.onMounted = onMounted;
|
9450 | exports.onRenderTracked = onRenderTracked;
|
9451 | exports.onRenderTriggered = onRenderTriggered;
|
9452 | exports.onUnmounted = onUnmounted;
|
9453 | exports.onUpdated = onUpdated;
|
9454 | exports.openBlock = openBlock;
|
9455 | exports.popScopeId = popScopeId;
|
9456 | exports.provide = provide;
|
9457 | exports.proxyRefs = proxyRefs;
|
9458 | exports.pushScopeId = pushScopeId;
|
9459 | exports.queuePostFlushCb = queuePostFlushCb;
|
9460 | exports.reactive = reactive;
|
9461 | exports.readonly = readonly;
|
9462 | exports.ref = ref;
|
9463 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
9464 | exports.render = render;
|
9465 | exports.renderList = renderList;
|
9466 | exports.renderSlot = renderSlot;
|
9467 | exports.resolveComponent = resolveComponent;
|
9468 | exports.resolveDirective = resolveDirective;
|
9469 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
9470 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
9471 | exports.setBlockTracking = setBlockTracking;
|
9472 | exports.setDevtoolsHook = setDevtoolsHook;
|
9473 | exports.setTransitionHooks = setTransitionHooks;
|
9474 | exports.shallowReactive = shallowReactive;
|
9475 | exports.shallowReadonly = shallowReadonly;
|
9476 | exports.shallowRef = shallowRef;
|
9477 | exports.ssrContextKey = ssrContextKey;
|
9478 | exports.ssrUtils = ssrUtils;
|
9479 | exports.toDisplayString = toDisplayString;
|
9480 | exports.toHandlerKey = toHandlerKey;
|
9481 | exports.toHandlers = toHandlers;
|
9482 | exports.toRaw = toRaw;
|
9483 | exports.toRef = toRef;
|
9484 | exports.toRefs = toRefs;
|
9485 | exports.transformVNodeArgs = transformVNodeArgs;
|
9486 | exports.triggerRef = triggerRef;
|
9487 | exports.unref = unref;
|
9488 | exports.useContext = useContext;
|
9489 | exports.useCssModule = useCssModule;
|
9490 | exports.useCssVars = useCssVars;
|
9491 | exports.useSSRContext = useSSRContext;
|
9492 | exports.useTransitionState = useTransitionState;
|
9493 | exports.vModelCheckbox = vModelCheckbox;
|
9494 | exports.vModelDynamic = vModelDynamic;
|
9495 | exports.vModelRadio = vModelRadio;
|
9496 | exports.vModelSelect = vModelSelect;
|
9497 | exports.vModelText = vModelText;
|
9498 | exports.vShow = vShow;
|
9499 | exports.version = version;
|
9500 | exports.warn = warn;
|
9501 | exports.watch = watch;
|
9502 | exports.watchEffect = watchEffect;
|
9503 | exports.withCtx = withCtx;
|
9504 | exports.withDirectives = withDirectives;
|
9505 | exports.withKeys = withKeys;
|
9506 | exports.withModifiers = withModifiers;
|
9507 | exports.withScopeId = withScopeId;
|
9508 |
|
9509 | Object.defineProperty(exports, '__esModule', { value: true });
|
9510 |
|
9511 | return exports;
|
9512 |
|
9513 | }({}));
|