UNPKG

223 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.12
3 * (c) 2014-2020 Evan You
4 * Released under the MIT License.
5 */
6'use strict';
7
8/* */
9
10var emptyObject = Object.freeze({});
11
12// These helpers produce better VM code in JS engines due to their
13// explicitness and function inlining.
14function isUndef (v) {
15 return v === undefined || v === null
16}
17
18function isDef (v) {
19 return v !== undefined && v !== null
20}
21
22function isTrue (v) {
23 return v === true
24}
25
26function isFalse (v) {
27 return v === false
28}
29
30/**
31 * Check if value is primitive.
32 */
33function isPrimitive (value) {
34 return (
35 typeof value === 'string' ||
36 typeof value === 'number' ||
37 // $flow-disable-line
38 typeof value === 'symbol' ||
39 typeof value === 'boolean'
40 )
41}
42
43/**
44 * Quick object check - this is primarily used to tell
45 * Objects from primitive values when we know the value
46 * is a JSON-compliant type.
47 */
48function isObject (obj) {
49 return obj !== null && typeof obj === 'object'
50}
51
52/**
53 * Get the raw type string of a value, e.g., [object Object].
54 */
55var _toString = Object.prototype.toString;
56
57function toRawType (value) {
58 return _toString.call(value).slice(8, -1)
59}
60
61/**
62 * Strict object type check. Only returns true
63 * for plain JavaScript objects.
64 */
65function isPlainObject (obj) {
66 return _toString.call(obj) === '[object Object]'
67}
68
69function isRegExp (v) {
70 return _toString.call(v) === '[object RegExp]'
71}
72
73/**
74 * Check if val is a valid array index.
75 */
76function isValidArrayIndex (val) {
77 var n = parseFloat(String(val));
78 return n >= 0 && Math.floor(n) === n && isFinite(val)
79}
80
81function isPromise (val) {
82 return (
83 isDef(val) &&
84 typeof val.then === 'function' &&
85 typeof val.catch === 'function'
86 )
87}
88
89/**
90 * Convert a value to a string that is actually rendered.
91 */
92function toString (val) {
93 return val == null
94 ? ''
95 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
96 ? JSON.stringify(val, null, 2)
97 : String(val)
98}
99
100/**
101 * Convert an input value to a number for persistence.
102 * If the conversion fails, return original string.
103 */
104function toNumber (val) {
105 var n = parseFloat(val);
106 return isNaN(n) ? val : n
107}
108
109/**
110 * Make a map and return a function for checking if a key
111 * is in that map.
112 */
113function makeMap (
114 str,
115 expectsLowerCase
116) {
117 var map = Object.create(null);
118 var list = str.split(',');
119 for (var i = 0; i < list.length; i++) {
120 map[list[i]] = true;
121 }
122 return expectsLowerCase
123 ? function (val) { return map[val.toLowerCase()]; }
124 : function (val) { return map[val]; }
125}
126
127/**
128 * Check if a tag is a built-in tag.
129 */
130var isBuiltInTag = makeMap('slot,component', true);
131
132/**
133 * Check if an attribute is a reserved attribute.
134 */
135var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
136
137/**
138 * Remove an item from an array.
139 */
140function remove (arr, item) {
141 if (arr.length) {
142 var index = arr.indexOf(item);
143 if (index > -1) {
144 return arr.splice(index, 1)
145 }
146 }
147}
148
149/**
150 * Check whether an object has the property.
151 */
152var hasOwnProperty = Object.prototype.hasOwnProperty;
153function hasOwn (obj, key) {
154 return hasOwnProperty.call(obj, key)
155}
156
157/**
158 * Create a cached version of a pure function.
159 */
160function cached (fn) {
161 var cache = Object.create(null);
162 return (function cachedFn (str) {
163 var hit = cache[str];
164 return hit || (cache[str] = fn(str))
165 })
166}
167
168/**
169 * Camelize a hyphen-delimited string.
170 */
171var camelizeRE = /-(\w)/g;
172var camelize = cached(function (str) {
173 return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
174});
175
176/**
177 * Capitalize a string.
178 */
179var capitalize = cached(function (str) {
180 return str.charAt(0).toUpperCase() + str.slice(1)
181});
182
183/**
184 * Hyphenate a camelCase string.
185 */
186var hyphenateRE = /\B([A-Z])/g;
187var hyphenate = cached(function (str) {
188 return str.replace(hyphenateRE, '-$1').toLowerCase()
189});
190
191/**
192 * Simple bind polyfill for environments that do not support it,
193 * e.g., PhantomJS 1.x. Technically, we don't need this anymore
194 * since native bind is now performant enough in most browsers.
195 * But removing it would mean breaking code that was able to run in
196 * PhantomJS 1.x, so this must be kept for backward compatibility.
197 */
198
199/* istanbul ignore next */
200function polyfillBind (fn, ctx) {
201 function boundFn (a) {
202 var l = arguments.length;
203 return l
204 ? l > 1
205 ? fn.apply(ctx, arguments)
206 : fn.call(ctx, a)
207 : fn.call(ctx)
208 }
209
210 boundFn._length = fn.length;
211 return boundFn
212}
213
214function nativeBind (fn, ctx) {
215 return fn.bind(ctx)
216}
217
218var bind = Function.prototype.bind
219 ? nativeBind
220 : polyfillBind;
221
222/**
223 * Convert an Array-like object to a real Array.
224 */
225function toArray (list, start) {
226 start = start || 0;
227 var i = list.length - start;
228 var ret = new Array(i);
229 while (i--) {
230 ret[i] = list[i + start];
231 }
232 return ret
233}
234
235/**
236 * Mix properties into target object.
237 */
238function extend (to, _from) {
239 for (var key in _from) {
240 to[key] = _from[key];
241 }
242 return to
243}
244
245/**
246 * Merge an Array of Objects into a single Object.
247 */
248function toObject (arr) {
249 var res = {};
250 for (var i = 0; i < arr.length; i++) {
251 if (arr[i]) {
252 extend(res, arr[i]);
253 }
254 }
255 return res
256}
257
258/* eslint-disable no-unused-vars */
259
260/**
261 * Perform no operation.
262 * Stubbing args to make Flow happy without leaving useless transpiled code
263 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
264 */
265function noop (a, b, c) {}
266
267/**
268 * Always return false.
269 */
270var no = function (a, b, c) { return false; };
271
272/* eslint-enable no-unused-vars */
273
274/**
275 * Return the same value.
276 */
277var identity = function (_) { return _; };
278
279/**
280 * Check if two values are loosely equal - that is,
281 * if they are plain objects, do they have the same shape?
282 */
283function looseEqual (a, b) {
284 if (a === b) { return true }
285 var isObjectA = isObject(a);
286 var isObjectB = isObject(b);
287 if (isObjectA && isObjectB) {
288 try {
289 var isArrayA = Array.isArray(a);
290 var isArrayB = Array.isArray(b);
291 if (isArrayA && isArrayB) {
292 return a.length === b.length && a.every(function (e, i) {
293 return looseEqual(e, b[i])
294 })
295 } else if (a instanceof Date && b instanceof Date) {
296 return a.getTime() === b.getTime()
297 } else if (!isArrayA && !isArrayB) {
298 var keysA = Object.keys(a);
299 var keysB = Object.keys(b);
300 return keysA.length === keysB.length && keysA.every(function (key) {
301 return looseEqual(a[key], b[key])
302 })
303 } else {
304 /* istanbul ignore next */
305 return false
306 }
307 } catch (e) {
308 /* istanbul ignore next */
309 return false
310 }
311 } else if (!isObjectA && !isObjectB) {
312 return String(a) === String(b)
313 } else {
314 return false
315 }
316}
317
318/**
319 * Return the first index at which a loosely equal value can be
320 * found in the array (if value is a plain object, the array must
321 * contain an object of the same shape), or -1 if it is not present.
322 */
323function looseIndexOf (arr, val) {
324 for (var i = 0; i < arr.length; i++) {
325 if (looseEqual(arr[i], val)) { return i }
326 }
327 return -1
328}
329
330/**
331 * Ensure a function is called only once.
332 */
333function once (fn) {
334 var called = false;
335 return function () {
336 if (!called) {
337 called = true;
338 fn.apply(this, arguments);
339 }
340 }
341}
342
343var SSR_ATTR = 'data-server-rendered';
344
345var ASSET_TYPES = [
346 'component',
347 'directive',
348 'filter'
349];
350
351var LIFECYCLE_HOOKS = [
352 'beforeCreate',
353 'created',
354 'beforeMount',
355 'mounted',
356 'beforeUpdate',
357 'updated',
358 'beforeDestroy',
359 'destroyed',
360 'activated',
361 'deactivated',
362 'errorCaptured',
363 'serverPrefetch'
364];
365
366/* */
367
368
369
370var config = ({
371 /**
372 * Option merge strategies (used in core/util/options)
373 */
374 // $flow-disable-line
375 optionMergeStrategies: Object.create(null),
376
377 /**
378 * Whether to suppress warnings.
379 */
380 silent: false,
381
382 /**
383 * Show production mode tip message on boot?
384 */
385 productionTip: "development" !== 'production',
386
387 /**
388 * Whether to enable devtools
389 */
390 devtools: "development" !== 'production',
391
392 /**
393 * Whether to record perf
394 */
395 performance: false,
396
397 /**
398 * Error handler for watcher errors
399 */
400 errorHandler: null,
401
402 /**
403 * Warn handler for watcher warns
404 */
405 warnHandler: null,
406
407 /**
408 * Ignore certain custom elements
409 */
410 ignoredElements: [],
411
412 /**
413 * Custom user key aliases for v-on
414 */
415 // $flow-disable-line
416 keyCodes: Object.create(null),
417
418 /**
419 * Check if a tag is reserved so that it cannot be registered as a
420 * component. This is platform-dependent and may be overwritten.
421 */
422 isReservedTag: no,
423
424 /**
425 * Check if an attribute is reserved so that it cannot be used as a component
426 * prop. This is platform-dependent and may be overwritten.
427 */
428 isReservedAttr: no,
429
430 /**
431 * Check if a tag is an unknown element.
432 * Platform-dependent.
433 */
434 isUnknownElement: no,
435
436 /**
437 * Get the namespace of an element
438 */
439 getTagNamespace: noop,
440
441 /**
442 * Parse the real tag name for the specific platform.
443 */
444 parsePlatformTagName: identity,
445
446 /**
447 * Check if an attribute must be bound using property, e.g. value
448 * Platform-dependent.
449 */
450 mustUseProp: no,
451
452 /**
453 * Perform updates asynchronously. Intended to be used by Vue Test Utils
454 * This will significantly reduce performance if set to false.
455 */
456 async: true,
457
458 /**
459 * Exposed for legacy reasons
460 */
461 _lifecycleHooks: LIFECYCLE_HOOKS
462});
463
464/* */
465
466/**
467 * unicode letters used for parsing html tags, component names and property paths.
468 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
469 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
470 */
471var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
472
473/**
474 * Check if a string starts with $ or _
475 */
476function isReserved (str) {
477 var c = (str + '').charCodeAt(0);
478 return c === 0x24 || c === 0x5F
479}
480
481/**
482 * Define a property.
483 */
484function def (obj, key, val, enumerable) {
485 Object.defineProperty(obj, key, {
486 value: val,
487 enumerable: !!enumerable,
488 writable: true,
489 configurable: true
490 });
491}
492
493/**
494 * Parse simple path.
495 */
496var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
497function parsePath (path) {
498 if (bailRE.test(path)) {
499 return
500 }
501 var segments = path.split('.');
502 return function (obj) {
503 for (var i = 0; i < segments.length; i++) {
504 if (!obj) { return }
505 obj = obj[segments[i]];
506 }
507 return obj
508 }
509}
510
511/* */
512
513// can we use __proto__?
514var hasProto = '__proto__' in {};
515
516// Browser environment sniffing
517var inBrowser = typeof window !== 'undefined';
518var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
519var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
520var UA = inBrowser && window.navigator.userAgent.toLowerCase();
521var isIE = UA && /msie|trident/.test(UA);
522var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
523var isEdge = UA && UA.indexOf('edge/') > 0;
524var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
525var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
526var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
527var isPhantomJS = UA && /phantomjs/.test(UA);
528var isFF = UA && UA.match(/firefox\/(\d+)/);
529
530// Firefox has a "watch" function on Object.prototype...
531var nativeWatch = ({}).watch;
532
533var supportsPassive = false;
534if (inBrowser) {
535 try {
536 var opts = {};
537 Object.defineProperty(opts, 'passive', ({
538 get: function get () {
539 /* istanbul ignore next */
540 supportsPassive = true;
541 }
542 })); // https://github.com/facebook/flow/issues/285
543 window.addEventListener('test-passive', null, opts);
544 } catch (e) {}
545}
546
547// this needs to be lazy-evaled because vue may be required before
548// vue-server-renderer can set VUE_ENV
549var _isServer;
550var isServerRendering = function () {
551 if (_isServer === undefined) {
552 /* istanbul ignore if */
553 if (!inBrowser && !inWeex && typeof global !== 'undefined') {
554 // detect presence of vue-server-renderer and avoid
555 // Webpack shimming the process
556 _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
557 } else {
558 _isServer = false;
559 }
560 }
561 return _isServer
562};
563
564// detect devtools
565var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
566
567/* istanbul ignore next */
568function isNative (Ctor) {
569 return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
570}
571
572var hasSymbol =
573 typeof Symbol !== 'undefined' && isNative(Symbol) &&
574 typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
575
576var _Set;
577/* istanbul ignore if */ // $flow-disable-line
578if (typeof Set !== 'undefined' && isNative(Set)) {
579 // use native Set when available.
580 _Set = Set;
581} else {
582 // a non-standard Set polyfill that only works with primitive keys.
583 _Set = /*@__PURE__*/(function () {
584 function Set () {
585 this.set = Object.create(null);
586 }
587 Set.prototype.has = function has (key) {
588 return this.set[key] === true
589 };
590 Set.prototype.add = function add (key) {
591 this.set[key] = true;
592 };
593 Set.prototype.clear = function clear () {
594 this.set = Object.create(null);
595 };
596
597 return Set;
598 }());
599}
600
601/* */
602
603var warn = noop;
604var tip = noop;
605var generateComponentTrace = (noop); // work around flow check
606var formatComponentName = (noop);
607
608{
609 var hasConsole = typeof console !== 'undefined';
610 var classifyRE = /(?:^|[-_])(\w)/g;
611 var classify = function (str) { return str
612 .replace(classifyRE, function (c) { return c.toUpperCase(); })
613 .replace(/[-_]/g, ''); };
614
615 warn = function (msg, vm) {
616 var trace = vm ? generateComponentTrace(vm) : '';
617
618 if (config.warnHandler) {
619 config.warnHandler.call(null, msg, vm, trace);
620 } else if (hasConsole && (!config.silent)) {
621 console.error(("[Vue warn]: " + msg + trace));
622 }
623 };
624
625 tip = function (msg, vm) {
626 if (hasConsole && (!config.silent)) {
627 console.warn("[Vue tip]: " + msg + (
628 vm ? generateComponentTrace(vm) : ''
629 ));
630 }
631 };
632
633 formatComponentName = function (vm, includeFile) {
634 if (vm.$root === vm) {
635 return '<Root>'
636 }
637 var options = typeof vm === 'function' && vm.cid != null
638 ? vm.options
639 : vm._isVue
640 ? vm.$options || vm.constructor.options
641 : vm;
642 var name = options.name || options._componentTag;
643 var file = options.__file;
644 if (!name && file) {
645 var match = file.match(/([^/\\]+)\.vue$/);
646 name = match && match[1];
647 }
648
649 return (
650 (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
651 (file && includeFile !== false ? (" at " + file) : '')
652 )
653 };
654
655 var repeat = function (str, n) {
656 var res = '';
657 while (n) {
658 if (n % 2 === 1) { res += str; }
659 if (n > 1) { str += str; }
660 n >>= 1;
661 }
662 return res
663 };
664
665 generateComponentTrace = function (vm) {
666 if (vm._isVue && vm.$parent) {
667 var tree = [];
668 var currentRecursiveSequence = 0;
669 while (vm) {
670 if (tree.length > 0) {
671 var last = tree[tree.length - 1];
672 if (last.constructor === vm.constructor) {
673 currentRecursiveSequence++;
674 vm = vm.$parent;
675 continue
676 } else if (currentRecursiveSequence > 0) {
677 tree[tree.length - 1] = [last, currentRecursiveSequence];
678 currentRecursiveSequence = 0;
679 }
680 }
681 tree.push(vm);
682 vm = vm.$parent;
683 }
684 return '\n\nfound in\n\n' + tree
685 .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
686 ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
687 : formatComponentName(vm))); })
688 .join('\n')
689 } else {
690 return ("\n\n(found in " + (formatComponentName(vm)) + ")")
691 }
692 };
693}
694
695/* */
696
697var uid = 0;
698
699/**
700 * A dep is an observable that can have multiple
701 * directives subscribing to it.
702 */
703var Dep = function Dep () {
704 this.id = uid++;
705 this.subs = [];
706};
707
708Dep.prototype.addSub = function addSub (sub) {
709 this.subs.push(sub);
710};
711
712Dep.prototype.removeSub = function removeSub (sub) {
713 remove(this.subs, sub);
714};
715
716Dep.prototype.depend = function depend () {
717 if (Dep.target) {
718 Dep.target.addDep(this);
719 }
720};
721
722Dep.prototype.notify = function notify () {
723 // stabilize the subscriber list first
724 var subs = this.subs.slice();
725 if (!config.async) {
726 // subs aren't sorted in scheduler if not running async
727 // we need to sort them now to make sure they fire in correct
728 // order
729 subs.sort(function (a, b) { return a.id - b.id; });
730 }
731 for (var i = 0, l = subs.length; i < l; i++) {
732 subs[i].update();
733 }
734};
735
736// The current target watcher being evaluated.
737// This is globally unique because only one watcher
738// can be evaluated at a time.
739Dep.target = null;
740var targetStack = [];
741
742function pushTarget (target) {
743 targetStack.push(target);
744 Dep.target = target;
745}
746
747function popTarget () {
748 targetStack.pop();
749 Dep.target = targetStack[targetStack.length - 1];
750}
751
752/* */
753
754var VNode = function VNode (
755 tag,
756 data,
757 children,
758 text,
759 elm,
760 context,
761 componentOptions,
762 asyncFactory
763) {
764 this.tag = tag;
765 this.data = data;
766 this.children = children;
767 this.text = text;
768 this.elm = elm;
769 this.ns = undefined;
770 this.context = context;
771 this.fnContext = undefined;
772 this.fnOptions = undefined;
773 this.fnScopeId = undefined;
774 this.key = data && data.key;
775 this.componentOptions = componentOptions;
776 this.componentInstance = undefined;
777 this.parent = undefined;
778 this.raw = false;
779 this.isStatic = false;
780 this.isRootInsert = true;
781 this.isComment = false;
782 this.isCloned = false;
783 this.isOnce = false;
784 this.asyncFactory = asyncFactory;
785 this.asyncMeta = undefined;
786 this.isAsyncPlaceholder = false;
787};
788
789var prototypeAccessors = { child: { configurable: true } };
790
791// DEPRECATED: alias for componentInstance for backwards compat.
792/* istanbul ignore next */
793prototypeAccessors.child.get = function () {
794 return this.componentInstance
795};
796
797Object.defineProperties( VNode.prototype, prototypeAccessors );
798
799var createEmptyVNode = function (text) {
800 if ( text === void 0 ) text = '';
801
802 var node = new VNode();
803 node.text = text;
804 node.isComment = true;
805 return node
806};
807
808function createTextVNode (val) {
809 return new VNode(undefined, undefined, undefined, String(val))
810}
811
812// optimized shallow clone
813// used for static nodes and slot nodes because they may be reused across
814// multiple renders, cloning them avoids errors when DOM manipulations rely
815// on their elm reference.
816function cloneVNode (vnode) {
817 var cloned = new VNode(
818 vnode.tag,
819 vnode.data,
820 // #7975
821 // clone children array to avoid mutating original in case of cloning
822 // a child.
823 vnode.children && vnode.children.slice(),
824 vnode.text,
825 vnode.elm,
826 vnode.context,
827 vnode.componentOptions,
828 vnode.asyncFactory
829 );
830 cloned.ns = vnode.ns;
831 cloned.isStatic = vnode.isStatic;
832 cloned.key = vnode.key;
833 cloned.isComment = vnode.isComment;
834 cloned.fnContext = vnode.fnContext;
835 cloned.fnOptions = vnode.fnOptions;
836 cloned.fnScopeId = vnode.fnScopeId;
837 cloned.asyncMeta = vnode.asyncMeta;
838 cloned.isCloned = true;
839 return cloned
840}
841
842/*
843 * not type checking this file because flow doesn't play well with
844 * dynamically accessing methods on Array prototype
845 */
846
847var arrayProto = Array.prototype;
848var arrayMethods = Object.create(arrayProto);
849
850var methodsToPatch = [
851 'push',
852 'pop',
853 'shift',
854 'unshift',
855 'splice',
856 'sort',
857 'reverse'
858];
859
860/**
861 * Intercept mutating methods and emit events
862 */
863methodsToPatch.forEach(function (method) {
864 // cache original method
865 var original = arrayProto[method];
866 def(arrayMethods, method, function mutator () {
867 var args = [], len = arguments.length;
868 while ( len-- ) args[ len ] = arguments[ len ];
869
870 var result = original.apply(this, args);
871 var ob = this.__ob__;
872 var inserted;
873 switch (method) {
874 case 'push':
875 case 'unshift':
876 inserted = args;
877 break
878 case 'splice':
879 inserted = args.slice(2);
880 break
881 }
882 if (inserted) { ob.observeArray(inserted); }
883 // notify change
884 ob.dep.notify();
885 return result
886 });
887});
888
889/* */
890
891var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
892
893/**
894 * In some cases we may want to disable observation inside a component's
895 * update computation.
896 */
897var shouldObserve = true;
898
899function toggleObserving (value) {
900 shouldObserve = value;
901}
902
903/**
904 * Observer class that is attached to each observed
905 * object. Once attached, the observer converts the target
906 * object's property keys into getter/setters that
907 * collect dependencies and dispatch updates.
908 */
909var Observer = function Observer (value) {
910 this.value = value;
911 this.dep = new Dep();
912 this.vmCount = 0;
913 def(value, '__ob__', this);
914 if (Array.isArray(value)) {
915 if (hasProto) {
916 protoAugment(value, arrayMethods);
917 } else {
918 copyAugment(value, arrayMethods, arrayKeys);
919 }
920 this.observeArray(value);
921 } else {
922 this.walk(value);
923 }
924};
925
926/**
927 * Walk through all properties and convert them into
928 * getter/setters. This method should only be called when
929 * value type is Object.
930 */
931Observer.prototype.walk = function walk (obj) {
932 var keys = Object.keys(obj);
933 for (var i = 0; i < keys.length; i++) {
934 defineReactive$$1(obj, keys[i]);
935 }
936};
937
938/**
939 * Observe a list of Array items.
940 */
941Observer.prototype.observeArray = function observeArray (items) {
942 for (var i = 0, l = items.length; i < l; i++) {
943 observe(items[i]);
944 }
945};
946
947// helpers
948
949/**
950 * Augment a target Object or Array by intercepting
951 * the prototype chain using __proto__
952 */
953function protoAugment (target, src) {
954 /* eslint-disable no-proto */
955 target.__proto__ = src;
956 /* eslint-enable no-proto */
957}
958
959/**
960 * Augment a target Object or Array by defining
961 * hidden properties.
962 */
963/* istanbul ignore next */
964function copyAugment (target, src, keys) {
965 for (var i = 0, l = keys.length; i < l; i++) {
966 var key = keys[i];
967 def(target, key, src[key]);
968 }
969}
970
971/**
972 * Attempt to create an observer instance for a value,
973 * returns the new observer if successfully observed,
974 * or the existing observer if the value already has one.
975 */
976function observe (value, asRootData) {
977 if (!isObject(value) || value instanceof VNode) {
978 return
979 }
980 var ob;
981 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
982 ob = value.__ob__;
983 } else if (
984 shouldObserve &&
985 !isServerRendering() &&
986 (Array.isArray(value) || isPlainObject(value)) &&
987 Object.isExtensible(value) &&
988 !value._isVue
989 ) {
990 ob = new Observer(value);
991 }
992 if (asRootData && ob) {
993 ob.vmCount++;
994 }
995 return ob
996}
997
998/**
999 * Define a reactive property on an Object.
1000 */
1001function defineReactive$$1 (
1002 obj,
1003 key,
1004 val,
1005 customSetter,
1006 shallow
1007) {
1008 var dep = new Dep();
1009
1010 var property = Object.getOwnPropertyDescriptor(obj, key);
1011 if (property && property.configurable === false) {
1012 return
1013 }
1014
1015 // cater for pre-defined getter/setters
1016 var getter = property && property.get;
1017 var setter = property && property.set;
1018 if ((!getter || setter) && arguments.length === 2) {
1019 val = obj[key];
1020 }
1021
1022 var childOb = !shallow && observe(val);
1023 Object.defineProperty(obj, key, {
1024 enumerable: true,
1025 configurable: true,
1026 get: function reactiveGetter () {
1027 var value = getter ? getter.call(obj) : val;
1028 if (Dep.target) {
1029 dep.depend();
1030 if (childOb) {
1031 childOb.dep.depend();
1032 if (Array.isArray(value)) {
1033 dependArray(value);
1034 }
1035 }
1036 }
1037 return value
1038 },
1039 set: function reactiveSetter (newVal) {
1040 var value = getter ? getter.call(obj) : val;
1041 /* eslint-disable no-self-compare */
1042 if (newVal === value || (newVal !== newVal && value !== value)) {
1043 return
1044 }
1045 /* eslint-enable no-self-compare */
1046 if (customSetter) {
1047 customSetter();
1048 }
1049 // #7981: for accessor properties without setter
1050 if (getter && !setter) { return }
1051 if (setter) {
1052 setter.call(obj, newVal);
1053 } else {
1054 val = newVal;
1055 }
1056 childOb = !shallow && observe(newVal);
1057 dep.notify();
1058 }
1059 });
1060}
1061
1062/**
1063 * Set a property on an object. Adds the new property and
1064 * triggers change notification if the property doesn't
1065 * already exist.
1066 */
1067function set (target, key, val) {
1068 if (isUndef(target) || isPrimitive(target)
1069 ) {
1070 warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
1071 }
1072 if (Array.isArray(target) && isValidArrayIndex(key)) {
1073 target.length = Math.max(target.length, key);
1074 target.splice(key, 1, val);
1075 return val
1076 }
1077 if (key in target && !(key in Object.prototype)) {
1078 target[key] = val;
1079 return val
1080 }
1081 var ob = (target).__ob__;
1082 if (target._isVue || (ob && ob.vmCount)) {
1083 warn(
1084 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1085 'at runtime - declare it upfront in the data option.'
1086 );
1087 return val
1088 }
1089 if (!ob) {
1090 target[key] = val;
1091 return val
1092 }
1093 defineReactive$$1(ob.value, key, val);
1094 ob.dep.notify();
1095 return val
1096}
1097
1098/**
1099 * Delete a property and trigger change if necessary.
1100 */
1101function del (target, key) {
1102 if (isUndef(target) || isPrimitive(target)
1103 ) {
1104 warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
1105 }
1106 if (Array.isArray(target) && isValidArrayIndex(key)) {
1107 target.splice(key, 1);
1108 return
1109 }
1110 var ob = (target).__ob__;
1111 if (target._isVue || (ob && ob.vmCount)) {
1112 warn(
1113 'Avoid deleting properties on a Vue instance or its root $data ' +
1114 '- just set it to null.'
1115 );
1116 return
1117 }
1118 if (!hasOwn(target, key)) {
1119 return
1120 }
1121 delete target[key];
1122 if (!ob) {
1123 return
1124 }
1125 ob.dep.notify();
1126}
1127
1128/**
1129 * Collect dependencies on array elements when the array is touched, since
1130 * we cannot intercept array element access like property getters.
1131 */
1132function dependArray (value) {
1133 for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1134 e = value[i];
1135 e && e.__ob__ && e.__ob__.dep.depend();
1136 if (Array.isArray(e)) {
1137 dependArray(e);
1138 }
1139 }
1140}
1141
1142/* */
1143
1144/**
1145 * Option overwriting strategies are functions that handle
1146 * how to merge a parent option value and a child option
1147 * value into the final value.
1148 */
1149var strats = config.optionMergeStrategies;
1150
1151/**
1152 * Options with restrictions
1153 */
1154{
1155 strats.el = strats.propsData = function (parent, child, vm, key) {
1156 if (!vm) {
1157 warn(
1158 "option \"" + key + "\" can only be used during instance " +
1159 'creation with the `new` keyword.'
1160 );
1161 }
1162 return defaultStrat(parent, child)
1163 };
1164}
1165
1166/**
1167 * Helper that recursively merges two data objects together.
1168 */
1169function mergeData (to, from) {
1170 if (!from) { return to }
1171 var key, toVal, fromVal;
1172
1173 var keys = hasSymbol
1174 ? Reflect.ownKeys(from)
1175 : Object.keys(from);
1176
1177 for (var i = 0; i < keys.length; i++) {
1178 key = keys[i];
1179 // in case the object is already observed...
1180 if (key === '__ob__') { continue }
1181 toVal = to[key];
1182 fromVal = from[key];
1183 if (!hasOwn(to, key)) {
1184 set(to, key, fromVal);
1185 } else if (
1186 toVal !== fromVal &&
1187 isPlainObject(toVal) &&
1188 isPlainObject(fromVal)
1189 ) {
1190 mergeData(toVal, fromVal);
1191 }
1192 }
1193 return to
1194}
1195
1196/**
1197 * Data
1198 */
1199function mergeDataOrFn (
1200 parentVal,
1201 childVal,
1202 vm
1203) {
1204 if (!vm) {
1205 // in a Vue.extend merge, both should be functions
1206 if (!childVal) {
1207 return parentVal
1208 }
1209 if (!parentVal) {
1210 return childVal
1211 }
1212 // when parentVal & childVal are both present,
1213 // we need to return a function that returns the
1214 // merged result of both functions... no need to
1215 // check if parentVal is a function here because
1216 // it has to be a function to pass previous merges.
1217 return function mergedDataFn () {
1218 return mergeData(
1219 typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1220 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1221 )
1222 }
1223 } else {
1224 return function mergedInstanceDataFn () {
1225 // instance merge
1226 var instanceData = typeof childVal === 'function'
1227 ? childVal.call(vm, vm)
1228 : childVal;
1229 var defaultData = typeof parentVal === 'function'
1230 ? parentVal.call(vm, vm)
1231 : parentVal;
1232 if (instanceData) {
1233 return mergeData(instanceData, defaultData)
1234 } else {
1235 return defaultData
1236 }
1237 }
1238 }
1239}
1240
1241strats.data = function (
1242 parentVal,
1243 childVal,
1244 vm
1245) {
1246 if (!vm) {
1247 if (childVal && typeof childVal !== 'function') {
1248 warn(
1249 'The "data" option should be a function ' +
1250 'that returns a per-instance value in component ' +
1251 'definitions.',
1252 vm
1253 );
1254
1255 return parentVal
1256 }
1257 return mergeDataOrFn(parentVal, childVal)
1258 }
1259
1260 return mergeDataOrFn(parentVal, childVal, vm)
1261};
1262
1263/**
1264 * Hooks and props are merged as arrays.
1265 */
1266function mergeHook (
1267 parentVal,
1268 childVal
1269) {
1270 var res = childVal
1271 ? parentVal
1272 ? parentVal.concat(childVal)
1273 : Array.isArray(childVal)
1274 ? childVal
1275 : [childVal]
1276 : parentVal;
1277 return res
1278 ? dedupeHooks(res)
1279 : res
1280}
1281
1282function dedupeHooks (hooks) {
1283 var res = [];
1284 for (var i = 0; i < hooks.length; i++) {
1285 if (res.indexOf(hooks[i]) === -1) {
1286 res.push(hooks[i]);
1287 }
1288 }
1289 return res
1290}
1291
1292LIFECYCLE_HOOKS.forEach(function (hook) {
1293 strats[hook] = mergeHook;
1294});
1295
1296/**
1297 * Assets
1298 *
1299 * When a vm is present (instance creation), we need to do
1300 * a three-way merge between constructor options, instance
1301 * options and parent options.
1302 */
1303function mergeAssets (
1304 parentVal,
1305 childVal,
1306 vm,
1307 key
1308) {
1309 var res = Object.create(parentVal || null);
1310 if (childVal) {
1311 assertObjectType(key, childVal, vm);
1312 return extend(res, childVal)
1313 } else {
1314 return res
1315 }
1316}
1317
1318ASSET_TYPES.forEach(function (type) {
1319 strats[type + 's'] = mergeAssets;
1320});
1321
1322/**
1323 * Watchers.
1324 *
1325 * Watchers hashes should not overwrite one
1326 * another, so we merge them as arrays.
1327 */
1328strats.watch = function (
1329 parentVal,
1330 childVal,
1331 vm,
1332 key
1333) {
1334 // work around Firefox's Object.prototype.watch...
1335 if (parentVal === nativeWatch) { parentVal = undefined; }
1336 if (childVal === nativeWatch) { childVal = undefined; }
1337 /* istanbul ignore if */
1338 if (!childVal) { return Object.create(parentVal || null) }
1339 {
1340 assertObjectType(key, childVal, vm);
1341 }
1342 if (!parentVal) { return childVal }
1343 var ret = {};
1344 extend(ret, parentVal);
1345 for (var key$1 in childVal) {
1346 var parent = ret[key$1];
1347 var child = childVal[key$1];
1348 if (parent && !Array.isArray(parent)) {
1349 parent = [parent];
1350 }
1351 ret[key$1] = parent
1352 ? parent.concat(child)
1353 : Array.isArray(child) ? child : [child];
1354 }
1355 return ret
1356};
1357
1358/**
1359 * Other object hashes.
1360 */
1361strats.props =
1362strats.methods =
1363strats.inject =
1364strats.computed = function (
1365 parentVal,
1366 childVal,
1367 vm,
1368 key
1369) {
1370 if (childVal && "development" !== 'production') {
1371 assertObjectType(key, childVal, vm);
1372 }
1373 if (!parentVal) { return childVal }
1374 var ret = Object.create(null);
1375 extend(ret, parentVal);
1376 if (childVal) { extend(ret, childVal); }
1377 return ret
1378};
1379strats.provide = mergeDataOrFn;
1380
1381/**
1382 * Default strategy.
1383 */
1384var defaultStrat = function (parentVal, childVal) {
1385 return childVal === undefined
1386 ? parentVal
1387 : childVal
1388};
1389
1390/**
1391 * Validate component names
1392 */
1393function checkComponents (options) {
1394 for (var key in options.components) {
1395 validateComponentName(key);
1396 }
1397}
1398
1399function validateComponentName (name) {
1400 if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1401 warn(
1402 'Invalid component name: "' + name + '". Component names ' +
1403 'should conform to valid custom element name in html5 specification.'
1404 );
1405 }
1406 if (isBuiltInTag(name) || config.isReservedTag(name)) {
1407 warn(
1408 'Do not use built-in or reserved HTML elements as component ' +
1409 'id: ' + name
1410 );
1411 }
1412}
1413
1414/**
1415 * Ensure all props option syntax are normalized into the
1416 * Object-based format.
1417 */
1418function normalizeProps (options, vm) {
1419 var props = options.props;
1420 if (!props) { return }
1421 var res = {};
1422 var i, val, name;
1423 if (Array.isArray(props)) {
1424 i = props.length;
1425 while (i--) {
1426 val = props[i];
1427 if (typeof val === 'string') {
1428 name = camelize(val);
1429 res[name] = { type: null };
1430 } else {
1431 warn('props must be strings when using array syntax.');
1432 }
1433 }
1434 } else if (isPlainObject(props)) {
1435 for (var key in props) {
1436 val = props[key];
1437 name = camelize(key);
1438 res[name] = isPlainObject(val)
1439 ? val
1440 : { type: val };
1441 }
1442 } else {
1443 warn(
1444 "Invalid value for option \"props\": expected an Array or an Object, " +
1445 "but got " + (toRawType(props)) + ".",
1446 vm
1447 );
1448 }
1449 options.props = res;
1450}
1451
1452/**
1453 * Normalize all injections into Object-based format
1454 */
1455function normalizeInject (options, vm) {
1456 var inject = options.inject;
1457 if (!inject) { return }
1458 var normalized = options.inject = {};
1459 if (Array.isArray(inject)) {
1460 for (var i = 0; i < inject.length; i++) {
1461 normalized[inject[i]] = { from: inject[i] };
1462 }
1463 } else if (isPlainObject(inject)) {
1464 for (var key in inject) {
1465 var val = inject[key];
1466 normalized[key] = isPlainObject(val)
1467 ? extend({ from: key }, val)
1468 : { from: val };
1469 }
1470 } else {
1471 warn(
1472 "Invalid value for option \"inject\": expected an Array or an Object, " +
1473 "but got " + (toRawType(inject)) + ".",
1474 vm
1475 );
1476 }
1477}
1478
1479/**
1480 * Normalize raw function directives into object format.
1481 */
1482function normalizeDirectives (options) {
1483 var dirs = options.directives;
1484 if (dirs) {
1485 for (var key in dirs) {
1486 var def$$1 = dirs[key];
1487 if (typeof def$$1 === 'function') {
1488 dirs[key] = { bind: def$$1, update: def$$1 };
1489 }
1490 }
1491 }
1492}
1493
1494function assertObjectType (name, value, vm) {
1495 if (!isPlainObject(value)) {
1496 warn(
1497 "Invalid value for option \"" + name + "\": expected an Object, " +
1498 "but got " + (toRawType(value)) + ".",
1499 vm
1500 );
1501 }
1502}
1503
1504/**
1505 * Merge two option objects into a new one.
1506 * Core utility used in both instantiation and inheritance.
1507 */
1508function mergeOptions (
1509 parent,
1510 child,
1511 vm
1512) {
1513 {
1514 checkComponents(child);
1515 }
1516
1517 if (typeof child === 'function') {
1518 child = child.options;
1519 }
1520
1521 normalizeProps(child, vm);
1522 normalizeInject(child, vm);
1523 normalizeDirectives(child);
1524
1525 // Apply extends and mixins on the child options,
1526 // but only if it is a raw options object that isn't
1527 // the result of another mergeOptions call.
1528 // Only merged options has the _base property.
1529 if (!child._base) {
1530 if (child.extends) {
1531 parent = mergeOptions(parent, child.extends, vm);
1532 }
1533 if (child.mixins) {
1534 for (var i = 0, l = child.mixins.length; i < l; i++) {
1535 parent = mergeOptions(parent, child.mixins[i], vm);
1536 }
1537 }
1538 }
1539
1540 var options = {};
1541 var key;
1542 for (key in parent) {
1543 mergeField(key);
1544 }
1545 for (key in child) {
1546 if (!hasOwn(parent, key)) {
1547 mergeField(key);
1548 }
1549 }
1550 function mergeField (key) {
1551 var strat = strats[key] || defaultStrat;
1552 options[key] = strat(parent[key], child[key], vm, key);
1553 }
1554 return options
1555}
1556
1557/**
1558 * Resolve an asset.
1559 * This function is used because child instances need access
1560 * to assets defined in its ancestor chain.
1561 */
1562function resolveAsset (
1563 options,
1564 type,
1565 id,
1566 warnMissing
1567) {
1568 /* istanbul ignore if */
1569 if (typeof id !== 'string') {
1570 return
1571 }
1572 var assets = options[type];
1573 // check local registration variations first
1574 if (hasOwn(assets, id)) { return assets[id] }
1575 var camelizedId = camelize(id);
1576 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1577 var PascalCaseId = capitalize(camelizedId);
1578 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1579 // fallback to prototype chain
1580 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1581 if (warnMissing && !res) {
1582 warn(
1583 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1584 options
1585 );
1586 }
1587 return res
1588}
1589
1590/* */
1591
1592
1593
1594function validateProp (
1595 key,
1596 propOptions,
1597 propsData,
1598 vm
1599) {
1600 var prop = propOptions[key];
1601 var absent = !hasOwn(propsData, key);
1602 var value = propsData[key];
1603 // boolean casting
1604 var booleanIndex = getTypeIndex(Boolean, prop.type);
1605 if (booleanIndex > -1) {
1606 if (absent && !hasOwn(prop, 'default')) {
1607 value = false;
1608 } else if (value === '' || value === hyphenate(key)) {
1609 // only cast empty string / same name to boolean if
1610 // boolean has higher priority
1611 var stringIndex = getTypeIndex(String, prop.type);
1612 if (stringIndex < 0 || booleanIndex < stringIndex) {
1613 value = true;
1614 }
1615 }
1616 }
1617 // check default value
1618 if (value === undefined) {
1619 value = getPropDefaultValue(vm, prop, key);
1620 // since the default value is a fresh copy,
1621 // make sure to observe it.
1622 var prevShouldObserve = shouldObserve;
1623 toggleObserving(true);
1624 observe(value);
1625 toggleObserving(prevShouldObserve);
1626 }
1627 {
1628 assertProp(prop, key, value, vm, absent);
1629 }
1630 return value
1631}
1632
1633/**
1634 * Get the default value of a prop.
1635 */
1636function getPropDefaultValue (vm, prop, key) {
1637 // no default, return undefined
1638 if (!hasOwn(prop, 'default')) {
1639 return undefined
1640 }
1641 var def = prop.default;
1642 // warn against non-factory defaults for Object & Array
1643 if (isObject(def)) {
1644 warn(
1645 'Invalid default value for prop "' + key + '": ' +
1646 'Props with type Object/Array must use a factory function ' +
1647 'to return the default value.',
1648 vm
1649 );
1650 }
1651 // the raw prop value was also undefined from previous render,
1652 // return previous default value to avoid unnecessary watcher trigger
1653 if (vm && vm.$options.propsData &&
1654 vm.$options.propsData[key] === undefined &&
1655 vm._props[key] !== undefined
1656 ) {
1657 return vm._props[key]
1658 }
1659 // call factory function for non-Function types
1660 // a value is Function if its prototype is function even across different execution context
1661 return typeof def === 'function' && getType(prop.type) !== 'Function'
1662 ? def.call(vm)
1663 : def
1664}
1665
1666/**
1667 * Assert whether a prop is valid.
1668 */
1669function assertProp (
1670 prop,
1671 name,
1672 value,
1673 vm,
1674 absent
1675) {
1676 if (prop.required && absent) {
1677 warn(
1678 'Missing required prop: "' + name + '"',
1679 vm
1680 );
1681 return
1682 }
1683 if (value == null && !prop.required) {
1684 return
1685 }
1686 var type = prop.type;
1687 var valid = !type || type === true;
1688 var expectedTypes = [];
1689 if (type) {
1690 if (!Array.isArray(type)) {
1691 type = [type];
1692 }
1693 for (var i = 0; i < type.length && !valid; i++) {
1694 var assertedType = assertType(value, type[i]);
1695 expectedTypes.push(assertedType.expectedType || '');
1696 valid = assertedType.valid;
1697 }
1698 }
1699
1700 if (!valid) {
1701 warn(
1702 getInvalidTypeMessage(name, value, expectedTypes),
1703 vm
1704 );
1705 return
1706 }
1707 var validator = prop.validator;
1708 if (validator) {
1709 if (!validator(value)) {
1710 warn(
1711 'Invalid prop: custom validator check failed for prop "' + name + '".',
1712 vm
1713 );
1714 }
1715 }
1716}
1717
1718var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1719
1720function assertType (value, type) {
1721 var valid;
1722 var expectedType = getType(type);
1723 if (simpleCheckRE.test(expectedType)) {
1724 var t = typeof value;
1725 valid = t === expectedType.toLowerCase();
1726 // for primitive wrapper objects
1727 if (!valid && t === 'object') {
1728 valid = value instanceof type;
1729 }
1730 } else if (expectedType === 'Object') {
1731 valid = isPlainObject(value);
1732 } else if (expectedType === 'Array') {
1733 valid = Array.isArray(value);
1734 } else {
1735 valid = value instanceof type;
1736 }
1737 return {
1738 valid: valid,
1739 expectedType: expectedType
1740 }
1741}
1742
1743/**
1744 * Use function string name to check built-in types,
1745 * because a simple equality check will fail when running
1746 * across different vms / iframes.
1747 */
1748function getType (fn) {
1749 var match = fn && fn.toString().match(/^\s*function (\w+)/);
1750 return match ? match[1] : ''
1751}
1752
1753function isSameType (a, b) {
1754 return getType(a) === getType(b)
1755}
1756
1757function getTypeIndex (type, expectedTypes) {
1758 if (!Array.isArray(expectedTypes)) {
1759 return isSameType(expectedTypes, type) ? 0 : -1
1760 }
1761 for (var i = 0, len = expectedTypes.length; i < len; i++) {
1762 if (isSameType(expectedTypes[i], type)) {
1763 return i
1764 }
1765 }
1766 return -1
1767}
1768
1769function getInvalidTypeMessage (name, value, expectedTypes) {
1770 var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
1771 " Expected " + (expectedTypes.map(capitalize).join(', '));
1772 var expectedType = expectedTypes[0];
1773 var receivedType = toRawType(value);
1774 var expectedValue = styleValue(value, expectedType);
1775 var receivedValue = styleValue(value, receivedType);
1776 // check if we need to specify expected value
1777 if (expectedTypes.length === 1 &&
1778 isExplicable(expectedType) &&
1779 !isBoolean(expectedType, receivedType)) {
1780 message += " with value " + expectedValue;
1781 }
1782 message += ", got " + receivedType + " ";
1783 // check if we need to specify received value
1784 if (isExplicable(receivedType)) {
1785 message += "with value " + receivedValue + ".";
1786 }
1787 return message
1788}
1789
1790function styleValue (value, type) {
1791 if (type === 'String') {
1792 return ("\"" + value + "\"")
1793 } else if (type === 'Number') {
1794 return ("" + (Number(value)))
1795 } else {
1796 return ("" + value)
1797 }
1798}
1799
1800function isExplicable (value) {
1801 var explicitTypes = ['string', 'number', 'boolean'];
1802 return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
1803}
1804
1805function isBoolean () {
1806 var args = [], len = arguments.length;
1807 while ( len-- ) args[ len ] = arguments[ len ];
1808
1809 return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
1810}
1811
1812/* */
1813
1814function handleError (err, vm, info) {
1815 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1816 // See: https://github.com/vuejs/vuex/issues/1505
1817 pushTarget();
1818 try {
1819 if (vm) {
1820 var cur = vm;
1821 while ((cur = cur.$parent)) {
1822 var hooks = cur.$options.errorCaptured;
1823 if (hooks) {
1824 for (var i = 0; i < hooks.length; i++) {
1825 try {
1826 var capture = hooks[i].call(cur, err, vm, info) === false;
1827 if (capture) { return }
1828 } catch (e) {
1829 globalHandleError(e, cur, 'errorCaptured hook');
1830 }
1831 }
1832 }
1833 }
1834 }
1835 globalHandleError(err, vm, info);
1836 } finally {
1837 popTarget();
1838 }
1839}
1840
1841function invokeWithErrorHandling (
1842 handler,
1843 context,
1844 args,
1845 vm,
1846 info
1847) {
1848 var res;
1849 try {
1850 res = args ? handler.apply(context, args) : handler.call(context);
1851 if (res && !res._isVue && isPromise(res) && !res._handled) {
1852 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1853 // issue #9511
1854 // avoid catch triggering multiple times when nested calls
1855 res._handled = true;
1856 }
1857 } catch (e) {
1858 handleError(e, vm, info);
1859 }
1860 return res
1861}
1862
1863function globalHandleError (err, vm, info) {
1864 if (config.errorHandler) {
1865 try {
1866 return config.errorHandler.call(null, err, vm, info)
1867 } catch (e) {
1868 // if the user intentionally throws the original error in the handler,
1869 // do not log it twice
1870 if (e !== err) {
1871 logError(e, null, 'config.errorHandler');
1872 }
1873 }
1874 }
1875 logError(err, vm, info);
1876}
1877
1878function logError (err, vm, info) {
1879 {
1880 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1881 }
1882 /* istanbul ignore else */
1883 if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1884 console.error(err);
1885 } else {
1886 throw err
1887 }
1888}
1889
1890/* */
1891
1892var isUsingMicroTask = false;
1893
1894var callbacks = [];
1895var pending = false;
1896
1897function flushCallbacks () {
1898 pending = false;
1899 var copies = callbacks.slice(0);
1900 callbacks.length = 0;
1901 for (var i = 0; i < copies.length; i++) {
1902 copies[i]();
1903 }
1904}
1905
1906// Here we have async deferring wrappers using microtasks.
1907// In 2.5 we used (macro) tasks (in combination with microtasks).
1908// However, it has subtle problems when state is changed right before repaint
1909// (e.g. #6813, out-in transitions).
1910// Also, using (macro) tasks in event handler would cause some weird behaviors
1911// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
1912// So we now use microtasks everywhere, again.
1913// A major drawback of this tradeoff is that there are some scenarios
1914// where microtasks have too high a priority and fire in between supposedly
1915// sequential events (e.g. #4521, #6690, which have workarounds)
1916// or even between bubbling of the same event (#6566).
1917var timerFunc;
1918
1919// The nextTick behavior leverages the microtask queue, which can be accessed
1920// via either native Promise.then or MutationObserver.
1921// MutationObserver has wider support, however it is seriously bugged in
1922// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
1923// completely stops working after triggering a few times... so, if native
1924// Promise is available, we will use it:
1925/* istanbul ignore next, $flow-disable-line */
1926if (typeof Promise !== 'undefined' && isNative(Promise)) {
1927 var p = Promise.resolve();
1928 timerFunc = function () {
1929 p.then(flushCallbacks);
1930 // In problematic UIWebViews, Promise.then doesn't completely break, but
1931 // it can get stuck in a weird state where callbacks are pushed into the
1932 // microtask queue but the queue isn't being flushed, until the browser
1933 // needs to do some other work, e.g. handle a timer. Therefore we can
1934 // "force" the microtask queue to be flushed by adding an empty timer.
1935 if (isIOS) { setTimeout(noop); }
1936 };
1937 isUsingMicroTask = true;
1938} else if (!isIE && typeof MutationObserver !== 'undefined' && (
1939 isNative(MutationObserver) ||
1940 // PhantomJS and iOS 7.x
1941 MutationObserver.toString() === '[object MutationObserverConstructor]'
1942)) {
1943 // Use MutationObserver where native Promise is not available,
1944 // e.g. PhantomJS, iOS7, Android 4.4
1945 // (#6466 MutationObserver is unreliable in IE11)
1946 var counter = 1;
1947 var observer = new MutationObserver(flushCallbacks);
1948 var textNode = document.createTextNode(String(counter));
1949 observer.observe(textNode, {
1950 characterData: true
1951 });
1952 timerFunc = function () {
1953 counter = (counter + 1) % 2;
1954 textNode.data = String(counter);
1955 };
1956 isUsingMicroTask = true;
1957} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1958 // Fallback to setImmediate.
1959 // Technically it leverages the (macro) task queue,
1960 // but it is still a better choice than setTimeout.
1961 timerFunc = function () {
1962 setImmediate(flushCallbacks);
1963 };
1964} else {
1965 // Fallback to setTimeout.
1966 timerFunc = function () {
1967 setTimeout(flushCallbacks, 0);
1968 };
1969}
1970
1971function nextTick (cb, ctx) {
1972 var _resolve;
1973 callbacks.push(function () {
1974 if (cb) {
1975 try {
1976 cb.call(ctx);
1977 } catch (e) {
1978 handleError(e, ctx, 'nextTick');
1979 }
1980 } else if (_resolve) {
1981 _resolve(ctx);
1982 }
1983 });
1984 if (!pending) {
1985 pending = true;
1986 timerFunc();
1987 }
1988 // $flow-disable-line
1989 if (!cb && typeof Promise !== 'undefined') {
1990 return new Promise(function (resolve) {
1991 _resolve = resolve;
1992 })
1993 }
1994}
1995
1996/* */
1997
1998/* not type checking this file because flow doesn't play well with Proxy */
1999
2000var initProxy;
2001
2002{
2003 var allowedGlobals = makeMap(
2004 'Infinity,undefined,NaN,isFinite,isNaN,' +
2005 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2006 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2007 'require' // for Webpack/Browserify
2008 );
2009
2010 var warnNonPresent = function (target, key) {
2011 warn(
2012 "Property or method \"" + key + "\" is not defined on the instance but " +
2013 'referenced during render. Make sure that this property is reactive, ' +
2014 'either in the data option, or for class-based components, by ' +
2015 'initializing the property. ' +
2016 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2017 target
2018 );
2019 };
2020
2021 var warnReservedPrefix = function (target, key) {
2022 warn(
2023 "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2024 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2025 'prevent conflicts with Vue internals. ' +
2026 'See: https://vuejs.org/v2/api/#data',
2027 target
2028 );
2029 };
2030
2031 var hasProxy =
2032 typeof Proxy !== 'undefined' && isNative(Proxy);
2033
2034 if (hasProxy) {
2035 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2036 config.keyCodes = new Proxy(config.keyCodes, {
2037 set: function set (target, key, value) {
2038 if (isBuiltInModifier(key)) {
2039 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2040 return false
2041 } else {
2042 target[key] = value;
2043 return true
2044 }
2045 }
2046 });
2047 }
2048
2049 var hasHandler = {
2050 has: function has (target, key) {
2051 var has = key in target;
2052 var isAllowed = allowedGlobals(key) ||
2053 (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2054 if (!has && !isAllowed) {
2055 if (key in target.$data) { warnReservedPrefix(target, key); }
2056 else { warnNonPresent(target, key); }
2057 }
2058 return has || !isAllowed
2059 }
2060 };
2061
2062 var getHandler = {
2063 get: function get (target, key) {
2064 if (typeof key === 'string' && !(key in target)) {
2065 if (key in target.$data) { warnReservedPrefix(target, key); }
2066 else { warnNonPresent(target, key); }
2067 }
2068 return target[key]
2069 }
2070 };
2071
2072 initProxy = function initProxy (vm) {
2073 if (hasProxy) {
2074 // determine which proxy handler to use
2075 var options = vm.$options;
2076 var handlers = options.render && options.render._withStripped
2077 ? getHandler
2078 : hasHandler;
2079 vm._renderProxy = new Proxy(vm, handlers);
2080 } else {
2081 vm._renderProxy = vm;
2082 }
2083 };
2084}
2085
2086/* */
2087
2088var seenObjects = new _Set();
2089
2090/**
2091 * Recursively traverse an object to evoke all converted
2092 * getters, so that every nested property inside the object
2093 * is collected as a "deep" dependency.
2094 */
2095function traverse (val) {
2096 _traverse(val, seenObjects);
2097 seenObjects.clear();
2098}
2099
2100function _traverse (val, seen) {
2101 var i, keys;
2102 var isA = Array.isArray(val);
2103 if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2104 return
2105 }
2106 if (val.__ob__) {
2107 var depId = val.__ob__.dep.id;
2108 if (seen.has(depId)) {
2109 return
2110 }
2111 seen.add(depId);
2112 }
2113 if (isA) {
2114 i = val.length;
2115 while (i--) { _traverse(val[i], seen); }
2116 } else {
2117 keys = Object.keys(val);
2118 i = keys.length;
2119 while (i--) { _traverse(val[keys[i]], seen); }
2120 }
2121}
2122
2123var mark;
2124var measure;
2125
2126{
2127 var perf = inBrowser && window.performance;
2128 /* istanbul ignore if */
2129 if (
2130 perf &&
2131 perf.mark &&
2132 perf.measure &&
2133 perf.clearMarks &&
2134 perf.clearMeasures
2135 ) {
2136 mark = function (tag) { return perf.mark(tag); };
2137 measure = function (name, startTag, endTag) {
2138 perf.measure(name, startTag, endTag);
2139 perf.clearMarks(startTag);
2140 perf.clearMarks(endTag);
2141 // perf.clearMeasures(name)
2142 };
2143 }
2144}
2145
2146/* */
2147
2148var normalizeEvent = cached(function (name) {
2149 var passive = name.charAt(0) === '&';
2150 name = passive ? name.slice(1) : name;
2151 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2152 name = once$$1 ? name.slice(1) : name;
2153 var capture = name.charAt(0) === '!';
2154 name = capture ? name.slice(1) : name;
2155 return {
2156 name: name,
2157 once: once$$1,
2158 capture: capture,
2159 passive: passive
2160 }
2161});
2162
2163function createFnInvoker (fns, vm) {
2164 function invoker () {
2165 var arguments$1 = arguments;
2166
2167 var fns = invoker.fns;
2168 if (Array.isArray(fns)) {
2169 var cloned = fns.slice();
2170 for (var i = 0; i < cloned.length; i++) {
2171 invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2172 }
2173 } else {
2174 // return handler return value for single handlers
2175 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2176 }
2177 }
2178 invoker.fns = fns;
2179 return invoker
2180}
2181
2182function updateListeners (
2183 on,
2184 oldOn,
2185 add,
2186 remove$$1,
2187 createOnceHandler,
2188 vm
2189) {
2190 var name, def$$1, cur, old, event;
2191 for (name in on) {
2192 def$$1 = cur = on[name];
2193 old = oldOn[name];
2194 event = normalizeEvent(name);
2195 if (isUndef(cur)) {
2196 warn(
2197 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2198 vm
2199 );
2200 } else if (isUndef(old)) {
2201 if (isUndef(cur.fns)) {
2202 cur = on[name] = createFnInvoker(cur, vm);
2203 }
2204 if (isTrue(event.once)) {
2205 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2206 }
2207 add(event.name, cur, event.capture, event.passive, event.params);
2208 } else if (cur !== old) {
2209 old.fns = cur;
2210 on[name] = old;
2211 }
2212 }
2213 for (name in oldOn) {
2214 if (isUndef(on[name])) {
2215 event = normalizeEvent(name);
2216 remove$$1(event.name, oldOn[name], event.capture);
2217 }
2218 }
2219}
2220
2221/* */
2222
2223function mergeVNodeHook (def, hookKey, hook) {
2224 if (def instanceof VNode) {
2225 def = def.data.hook || (def.data.hook = {});
2226 }
2227 var invoker;
2228 var oldHook = def[hookKey];
2229
2230 function wrappedHook () {
2231 hook.apply(this, arguments);
2232 // important: remove merged hook to ensure it's called only once
2233 // and prevent memory leak
2234 remove(invoker.fns, wrappedHook);
2235 }
2236
2237 if (isUndef(oldHook)) {
2238 // no existing hook
2239 invoker = createFnInvoker([wrappedHook]);
2240 } else {
2241 /* istanbul ignore if */
2242 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2243 // already a merged invoker
2244 invoker = oldHook;
2245 invoker.fns.push(wrappedHook);
2246 } else {
2247 // existing plain hook
2248 invoker = createFnInvoker([oldHook, wrappedHook]);
2249 }
2250 }
2251
2252 invoker.merged = true;
2253 def[hookKey] = invoker;
2254}
2255
2256/* */
2257
2258function extractPropsFromVNodeData (
2259 data,
2260 Ctor,
2261 tag
2262) {
2263 // we are only extracting raw values here.
2264 // validation and default values are handled in the child
2265 // component itself.
2266 var propOptions = Ctor.options.props;
2267 if (isUndef(propOptions)) {
2268 return
2269 }
2270 var res = {};
2271 var attrs = data.attrs;
2272 var props = data.props;
2273 if (isDef(attrs) || isDef(props)) {
2274 for (var key in propOptions) {
2275 var altKey = hyphenate(key);
2276 {
2277 var keyInLowerCase = key.toLowerCase();
2278 if (
2279 key !== keyInLowerCase &&
2280 attrs && hasOwn(attrs, keyInLowerCase)
2281 ) {
2282 tip(
2283 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2284 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2285 " \"" + key + "\". " +
2286 "Note that HTML attributes are case-insensitive and camelCased " +
2287 "props need to use their kebab-case equivalents when using in-DOM " +
2288 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2289 );
2290 }
2291 }
2292 checkProp(res, props, key, altKey, true) ||
2293 checkProp(res, attrs, key, altKey, false);
2294 }
2295 }
2296 return res
2297}
2298
2299function checkProp (
2300 res,
2301 hash,
2302 key,
2303 altKey,
2304 preserve
2305) {
2306 if (isDef(hash)) {
2307 if (hasOwn(hash, key)) {
2308 res[key] = hash[key];
2309 if (!preserve) {
2310 delete hash[key];
2311 }
2312 return true
2313 } else if (hasOwn(hash, altKey)) {
2314 res[key] = hash[altKey];
2315 if (!preserve) {
2316 delete hash[altKey];
2317 }
2318 return true
2319 }
2320 }
2321 return false
2322}
2323
2324/* */
2325
2326// The template compiler attempts to minimize the need for normalization by
2327// statically analyzing the template at compile time.
2328//
2329// For plain HTML markup, normalization can be completely skipped because the
2330// generated render function is guaranteed to return Array<VNode>. There are
2331// two cases where extra normalization is needed:
2332
2333// 1. When the children contains components - because a functional component
2334// may return an Array instead of a single root. In this case, just a simple
2335// normalization is needed - if any child is an Array, we flatten the whole
2336// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2337// because functional components already normalize their own children.
2338function simpleNormalizeChildren (children) {
2339 for (var i = 0; i < children.length; i++) {
2340 if (Array.isArray(children[i])) {
2341 return Array.prototype.concat.apply([], children)
2342 }
2343 }
2344 return children
2345}
2346
2347// 2. When the children contains constructs that always generated nested Arrays,
2348// e.g. <template>, <slot>, v-for, or when the children is provided by user
2349// with hand-written render functions / JSX. In such cases a full normalization
2350// is needed to cater to all possible types of children values.
2351function normalizeChildren (children) {
2352 return isPrimitive(children)
2353 ? [createTextVNode(children)]
2354 : Array.isArray(children)
2355 ? normalizeArrayChildren(children)
2356 : undefined
2357}
2358
2359function isTextNode (node) {
2360 return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2361}
2362
2363function normalizeArrayChildren (children, nestedIndex) {
2364 var res = [];
2365 var i, c, lastIndex, last;
2366 for (i = 0; i < children.length; i++) {
2367 c = children[i];
2368 if (isUndef(c) || typeof c === 'boolean') { continue }
2369 lastIndex = res.length - 1;
2370 last = res[lastIndex];
2371 // nested
2372 if (Array.isArray(c)) {
2373 if (c.length > 0) {
2374 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2375 // merge adjacent text nodes
2376 if (isTextNode(c[0]) && isTextNode(last)) {
2377 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2378 c.shift();
2379 }
2380 res.push.apply(res, c);
2381 }
2382 } else if (isPrimitive(c)) {
2383 if (isTextNode(last)) {
2384 // merge adjacent text nodes
2385 // this is necessary for SSR hydration because text nodes are
2386 // essentially merged when rendered to HTML strings
2387 res[lastIndex] = createTextVNode(last.text + c);
2388 } else if (c !== '') {
2389 // convert primitive to vnode
2390 res.push(createTextVNode(c));
2391 }
2392 } else {
2393 if (isTextNode(c) && isTextNode(last)) {
2394 // merge adjacent text nodes
2395 res[lastIndex] = createTextVNode(last.text + c.text);
2396 } else {
2397 // default key for nested array children (likely generated by v-for)
2398 if (isTrue(children._isVList) &&
2399 isDef(c.tag) &&
2400 isUndef(c.key) &&
2401 isDef(nestedIndex)) {
2402 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2403 }
2404 res.push(c);
2405 }
2406 }
2407 }
2408 return res
2409}
2410
2411/* */
2412
2413function initProvide (vm) {
2414 var provide = vm.$options.provide;
2415 if (provide) {
2416 vm._provided = typeof provide === 'function'
2417 ? provide.call(vm)
2418 : provide;
2419 }
2420}
2421
2422function initInjections (vm) {
2423 var result = resolveInject(vm.$options.inject, vm);
2424 if (result) {
2425 toggleObserving(false);
2426 Object.keys(result).forEach(function (key) {
2427 /* istanbul ignore else */
2428 {
2429 defineReactive$$1(vm, key, result[key], function () {
2430 warn(
2431 "Avoid mutating an injected value directly since the changes will be " +
2432 "overwritten whenever the provided component re-renders. " +
2433 "injection being mutated: \"" + key + "\"",
2434 vm
2435 );
2436 });
2437 }
2438 });
2439 toggleObserving(true);
2440 }
2441}
2442
2443function resolveInject (inject, vm) {
2444 if (inject) {
2445 // inject is :any because flow is not smart enough to figure out cached
2446 var result = Object.create(null);
2447 var keys = hasSymbol
2448 ? Reflect.ownKeys(inject)
2449 : Object.keys(inject);
2450
2451 for (var i = 0; i < keys.length; i++) {
2452 var key = keys[i];
2453 // #6574 in case the inject object is observed...
2454 if (key === '__ob__') { continue }
2455 var provideKey = inject[key].from;
2456 var source = vm;
2457 while (source) {
2458 if (source._provided && hasOwn(source._provided, provideKey)) {
2459 result[key] = source._provided[provideKey];
2460 break
2461 }
2462 source = source.$parent;
2463 }
2464 if (!source) {
2465 if ('default' in inject[key]) {
2466 var provideDefault = inject[key].default;
2467 result[key] = typeof provideDefault === 'function'
2468 ? provideDefault.call(vm)
2469 : provideDefault;
2470 } else {
2471 warn(("Injection \"" + key + "\" not found"), vm);
2472 }
2473 }
2474 }
2475 return result
2476 }
2477}
2478
2479/* */
2480
2481
2482
2483/**
2484 * Runtime helper for resolving raw children VNodes into a slot object.
2485 */
2486function resolveSlots (
2487 children,
2488 context
2489) {
2490 if (!children || !children.length) {
2491 return {}
2492 }
2493 var slots = {};
2494 for (var i = 0, l = children.length; i < l; i++) {
2495 var child = children[i];
2496 var data = child.data;
2497 // remove slot attribute if the node is resolved as a Vue slot node
2498 if (data && data.attrs && data.attrs.slot) {
2499 delete data.attrs.slot;
2500 }
2501 // named slots should only be respected if the vnode was rendered in the
2502 // same context.
2503 if ((child.context === context || child.fnContext === context) &&
2504 data && data.slot != null
2505 ) {
2506 var name = data.slot;
2507 var slot = (slots[name] || (slots[name] = []));
2508 if (child.tag === 'template') {
2509 slot.push.apply(slot, child.children || []);
2510 } else {
2511 slot.push(child);
2512 }
2513 } else {
2514 (slots.default || (slots.default = [])).push(child);
2515 }
2516 }
2517 // ignore slots that contains only whitespace
2518 for (var name$1 in slots) {
2519 if (slots[name$1].every(isWhitespace)) {
2520 delete slots[name$1];
2521 }
2522 }
2523 return slots
2524}
2525
2526function isWhitespace (node) {
2527 return (node.isComment && !node.asyncFactory) || node.text === ' '
2528}
2529
2530/* */
2531
2532function normalizeScopedSlots (
2533 slots,
2534 normalSlots,
2535 prevSlots
2536) {
2537 var res;
2538 var hasNormalSlots = Object.keys(normalSlots).length > 0;
2539 var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2540 var key = slots && slots.$key;
2541 if (!slots) {
2542 res = {};
2543 } else if (slots._normalized) {
2544 // fast path 1: child component re-render only, parent did not change
2545 return slots._normalized
2546 } else if (
2547 isStable &&
2548 prevSlots &&
2549 prevSlots !== emptyObject &&
2550 key === prevSlots.$key &&
2551 !hasNormalSlots &&
2552 !prevSlots.$hasNormal
2553 ) {
2554 // fast path 2: stable scoped slots w/ no normal slots to proxy,
2555 // only need to normalize once
2556 return prevSlots
2557 } else {
2558 res = {};
2559 for (var key$1 in slots) {
2560 if (slots[key$1] && key$1[0] !== '$') {
2561 res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2562 }
2563 }
2564 }
2565 // expose normal slots on scopedSlots
2566 for (var key$2 in normalSlots) {
2567 if (!(key$2 in res)) {
2568 res[key$2] = proxyNormalSlot(normalSlots, key$2);
2569 }
2570 }
2571 // avoriaz seems to mock a non-extensible $scopedSlots object
2572 // and when that is passed down this would cause an error
2573 if (slots && Object.isExtensible(slots)) {
2574 (slots)._normalized = res;
2575 }
2576 def(res, '$stable', isStable);
2577 def(res, '$key', key);
2578 def(res, '$hasNormal', hasNormalSlots);
2579 return res
2580}
2581
2582function normalizeScopedSlot(normalSlots, key, fn) {
2583 var normalized = function () {
2584 var res = arguments.length ? fn.apply(null, arguments) : fn({});
2585 res = res && typeof res === 'object' && !Array.isArray(res)
2586 ? [res] // single vnode
2587 : normalizeChildren(res);
2588 return res && (
2589 res.length === 0 ||
2590 (res.length === 1 && res[0].isComment) // #9658
2591 ) ? undefined
2592 : res
2593 };
2594 // this is a slot using the new v-slot syntax without scope. although it is
2595 // compiled as a scoped slot, render fn users would expect it to be present
2596 // on this.$slots because the usage is semantically a normal slot.
2597 if (fn.proxy) {
2598 Object.defineProperty(normalSlots, key, {
2599 get: normalized,
2600 enumerable: true,
2601 configurable: true
2602 });
2603 }
2604 return normalized
2605}
2606
2607function proxyNormalSlot(slots, key) {
2608 return function () { return slots[key]; }
2609}
2610
2611/* */
2612
2613/**
2614 * Runtime helper for rendering v-for lists.
2615 */
2616function renderList (
2617 val,
2618 render
2619) {
2620 var ret, i, l, keys, key;
2621 if (Array.isArray(val) || typeof val === 'string') {
2622 ret = new Array(val.length);
2623 for (i = 0, l = val.length; i < l; i++) {
2624 ret[i] = render(val[i], i);
2625 }
2626 } else if (typeof val === 'number') {
2627 ret = new Array(val);
2628 for (i = 0; i < val; i++) {
2629 ret[i] = render(i + 1, i);
2630 }
2631 } else if (isObject(val)) {
2632 if (hasSymbol && val[Symbol.iterator]) {
2633 ret = [];
2634 var iterator = val[Symbol.iterator]();
2635 var result = iterator.next();
2636 while (!result.done) {
2637 ret.push(render(result.value, ret.length));
2638 result = iterator.next();
2639 }
2640 } else {
2641 keys = Object.keys(val);
2642 ret = new Array(keys.length);
2643 for (i = 0, l = keys.length; i < l; i++) {
2644 key = keys[i];
2645 ret[i] = render(val[key], key, i);
2646 }
2647 }
2648 }
2649 if (!isDef(ret)) {
2650 ret = [];
2651 }
2652 (ret)._isVList = true;
2653 return ret
2654}
2655
2656/* */
2657
2658/**
2659 * Runtime helper for rendering <slot>
2660 */
2661function renderSlot (
2662 name,
2663 fallback,
2664 props,
2665 bindObject
2666) {
2667 var scopedSlotFn = this.$scopedSlots[name];
2668 var nodes;
2669 if (scopedSlotFn) { // scoped slot
2670 props = props || {};
2671 if (bindObject) {
2672 if (!isObject(bindObject)) {
2673 warn(
2674 'slot v-bind without argument expects an Object',
2675 this
2676 );
2677 }
2678 props = extend(extend({}, bindObject), props);
2679 }
2680 nodes = scopedSlotFn(props) || fallback;
2681 } else {
2682 nodes = this.$slots[name] || fallback;
2683 }
2684
2685 var target = props && props.slot;
2686 if (target) {
2687 return this.$createElement('template', { slot: target }, nodes)
2688 } else {
2689 return nodes
2690 }
2691}
2692
2693/* */
2694
2695/**
2696 * Runtime helper for resolving filters
2697 */
2698function resolveFilter (id) {
2699 return resolveAsset(this.$options, 'filters', id, true) || identity
2700}
2701
2702/* */
2703
2704function isKeyNotMatch (expect, actual) {
2705 if (Array.isArray(expect)) {
2706 return expect.indexOf(actual) === -1
2707 } else {
2708 return expect !== actual
2709 }
2710}
2711
2712/**
2713 * Runtime helper for checking keyCodes from config.
2714 * exposed as Vue.prototype._k
2715 * passing in eventKeyName as last argument separately for backwards compat
2716 */
2717function checkKeyCodes (
2718 eventKeyCode,
2719 key,
2720 builtInKeyCode,
2721 eventKeyName,
2722 builtInKeyName
2723) {
2724 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2725 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2726 return isKeyNotMatch(builtInKeyName, eventKeyName)
2727 } else if (mappedKeyCode) {
2728 return isKeyNotMatch(mappedKeyCode, eventKeyCode)
2729 } else if (eventKeyName) {
2730 return hyphenate(eventKeyName) !== key
2731 }
2732}
2733
2734/* */
2735
2736/**
2737 * Runtime helper for merging v-bind="object" into a VNode's data.
2738 */
2739function bindObjectProps (
2740 data,
2741 tag,
2742 value,
2743 asProp,
2744 isSync
2745) {
2746 if (value) {
2747 if (!isObject(value)) {
2748 warn(
2749 'v-bind without argument expects an Object or Array value',
2750 this
2751 );
2752 } else {
2753 if (Array.isArray(value)) {
2754 value = toObject(value);
2755 }
2756 var hash;
2757 var loop = function ( key ) {
2758 if (
2759 key === 'class' ||
2760 key === 'style' ||
2761 isReservedAttribute(key)
2762 ) {
2763 hash = data;
2764 } else {
2765 var type = data.attrs && data.attrs.type;
2766 hash = asProp || config.mustUseProp(tag, type, key)
2767 ? data.domProps || (data.domProps = {})
2768 : data.attrs || (data.attrs = {});
2769 }
2770 var camelizedKey = camelize(key);
2771 var hyphenatedKey = hyphenate(key);
2772 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2773 hash[key] = value[key];
2774
2775 if (isSync) {
2776 var on = data.on || (data.on = {});
2777 on[("update:" + key)] = function ($event) {
2778 value[key] = $event;
2779 };
2780 }
2781 }
2782 };
2783
2784 for (var key in value) loop( key );
2785 }
2786 }
2787 return data
2788}
2789
2790/* */
2791
2792/**
2793 * Runtime helper for rendering static trees.
2794 */
2795function renderStatic (
2796 index,
2797 isInFor
2798) {
2799 var cached = this._staticTrees || (this._staticTrees = []);
2800 var tree = cached[index];
2801 // if has already-rendered static tree and not inside v-for,
2802 // we can reuse the same tree.
2803 if (tree && !isInFor) {
2804 return tree
2805 }
2806 // otherwise, render a fresh tree.
2807 tree = cached[index] = this.$options.staticRenderFns[index].call(
2808 this._renderProxy,
2809 null,
2810 this // for render fns generated for functional component templates
2811 );
2812 markStatic(tree, ("__static__" + index), false);
2813 return tree
2814}
2815
2816/**
2817 * Runtime helper for v-once.
2818 * Effectively it means marking the node as static with a unique key.
2819 */
2820function markOnce (
2821 tree,
2822 index,
2823 key
2824) {
2825 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
2826 return tree
2827}
2828
2829function markStatic (
2830 tree,
2831 key,
2832 isOnce
2833) {
2834 if (Array.isArray(tree)) {
2835 for (var i = 0; i < tree.length; i++) {
2836 if (tree[i] && typeof tree[i] !== 'string') {
2837 markStaticNode(tree[i], (key + "_" + i), isOnce);
2838 }
2839 }
2840 } else {
2841 markStaticNode(tree, key, isOnce);
2842 }
2843}
2844
2845function markStaticNode (node, key, isOnce) {
2846 node.isStatic = true;
2847 node.key = key;
2848 node.isOnce = isOnce;
2849}
2850
2851/* */
2852
2853function bindObjectListeners (data, value) {
2854 if (value) {
2855 if (!isPlainObject(value)) {
2856 warn(
2857 'v-on without argument expects an Object value',
2858 this
2859 );
2860 } else {
2861 var on = data.on = data.on ? extend({}, data.on) : {};
2862 for (var key in value) {
2863 var existing = on[key];
2864 var ours = value[key];
2865 on[key] = existing ? [].concat(existing, ours) : ours;
2866 }
2867 }
2868 }
2869 return data
2870}
2871
2872/* */
2873
2874function resolveScopedSlots (
2875 fns, // see flow/vnode
2876 res,
2877 // the following are added in 2.6
2878 hasDynamicKeys,
2879 contentHashKey
2880) {
2881 res = res || { $stable: !hasDynamicKeys };
2882 for (var i = 0; i < fns.length; i++) {
2883 var slot = fns[i];
2884 if (Array.isArray(slot)) {
2885 resolveScopedSlots(slot, res, hasDynamicKeys);
2886 } else if (slot) {
2887 // marker for reverse proxying v-slot without scope on this.$slots
2888 if (slot.proxy) {
2889 slot.fn.proxy = true;
2890 }
2891 res[slot.key] = slot.fn;
2892 }
2893 }
2894 if (contentHashKey) {
2895 (res).$key = contentHashKey;
2896 }
2897 return res
2898}
2899
2900/* */
2901
2902function bindDynamicKeys (baseObj, values) {
2903 for (var i = 0; i < values.length; i += 2) {
2904 var key = values[i];
2905 if (typeof key === 'string' && key) {
2906 baseObj[values[i]] = values[i + 1];
2907 } else if (key !== '' && key !== null) {
2908 // null is a special value for explicitly removing a binding
2909 warn(
2910 ("Invalid value for dynamic directive argument (expected string or null): " + key),
2911 this
2912 );
2913 }
2914 }
2915 return baseObj
2916}
2917
2918// helper to dynamically append modifier runtime markers to event names.
2919// ensure only append when value is already string, otherwise it will be cast
2920// to string and cause the type check to miss.
2921function prependModifier (value, symbol) {
2922 return typeof value === 'string' ? symbol + value : value
2923}
2924
2925/* */
2926
2927function installRenderHelpers (target) {
2928 target._o = markOnce;
2929 target._n = toNumber;
2930 target._s = toString;
2931 target._l = renderList;
2932 target._t = renderSlot;
2933 target._q = looseEqual;
2934 target._i = looseIndexOf;
2935 target._m = renderStatic;
2936 target._f = resolveFilter;
2937 target._k = checkKeyCodes;
2938 target._b = bindObjectProps;
2939 target._v = createTextVNode;
2940 target._e = createEmptyVNode;
2941 target._u = resolveScopedSlots;
2942 target._g = bindObjectListeners;
2943 target._d = bindDynamicKeys;
2944 target._p = prependModifier;
2945}
2946
2947/* */
2948
2949function FunctionalRenderContext (
2950 data,
2951 props,
2952 children,
2953 parent,
2954 Ctor
2955) {
2956 var this$1 = this;
2957
2958 var options = Ctor.options;
2959 // ensure the createElement function in functional components
2960 // gets a unique context - this is necessary for correct named slot check
2961 var contextVm;
2962 if (hasOwn(parent, '_uid')) {
2963 contextVm = Object.create(parent);
2964 // $flow-disable-line
2965 contextVm._original = parent;
2966 } else {
2967 // the context vm passed in is a functional context as well.
2968 // in this case we want to make sure we are able to get a hold to the
2969 // real context instance.
2970 contextVm = parent;
2971 // $flow-disable-line
2972 parent = parent._original;
2973 }
2974 var isCompiled = isTrue(options._compiled);
2975 var needNormalization = !isCompiled;
2976
2977 this.data = data;
2978 this.props = props;
2979 this.children = children;
2980 this.parent = parent;
2981 this.listeners = data.on || emptyObject;
2982 this.injections = resolveInject(options.inject, parent);
2983 this.slots = function () {
2984 if (!this$1.$slots) {
2985 normalizeScopedSlots(
2986 data.scopedSlots,
2987 this$1.$slots = resolveSlots(children, parent)
2988 );
2989 }
2990 return this$1.$slots
2991 };
2992
2993 Object.defineProperty(this, 'scopedSlots', ({
2994 enumerable: true,
2995 get: function get () {
2996 return normalizeScopedSlots(data.scopedSlots, this.slots())
2997 }
2998 }));
2999
3000 // support for compiled functional template
3001 if (isCompiled) {
3002 // exposing $options for renderStatic()
3003 this.$options = options;
3004 // pre-resolve slots for renderSlot()
3005 this.$slots = this.slots();
3006 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
3007 }
3008
3009 if (options._scopeId) {
3010 this._c = function (a, b, c, d) {
3011 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3012 if (vnode && !Array.isArray(vnode)) {
3013 vnode.fnScopeId = options._scopeId;
3014 vnode.fnContext = parent;
3015 }
3016 return vnode
3017 };
3018 } else {
3019 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
3020 }
3021}
3022
3023installRenderHelpers(FunctionalRenderContext.prototype);
3024
3025function createFunctionalComponent (
3026 Ctor,
3027 propsData,
3028 data,
3029 contextVm,
3030 children
3031) {
3032 var options = Ctor.options;
3033 var props = {};
3034 var propOptions = options.props;
3035 if (isDef(propOptions)) {
3036 for (var key in propOptions) {
3037 props[key] = validateProp(key, propOptions, propsData || emptyObject);
3038 }
3039 } else {
3040 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3041 if (isDef(data.props)) { mergeProps(props, data.props); }
3042 }
3043
3044 var renderContext = new FunctionalRenderContext(
3045 data,
3046 props,
3047 children,
3048 contextVm,
3049 Ctor
3050 );
3051
3052 var vnode = options.render.call(null, renderContext._c, renderContext);
3053
3054 if (vnode instanceof VNode) {
3055 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
3056 } else if (Array.isArray(vnode)) {
3057 var vnodes = normalizeChildren(vnode) || [];
3058 var res = new Array(vnodes.length);
3059 for (var i = 0; i < vnodes.length; i++) {
3060 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3061 }
3062 return res
3063 }
3064}
3065
3066function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
3067 // #7817 clone node before setting fnContext, otherwise if the node is reused
3068 // (e.g. it was from a cached normal slot) the fnContext causes named slots
3069 // that should not be matched to match.
3070 var clone = cloneVNode(vnode);
3071 clone.fnContext = contextVm;
3072 clone.fnOptions = options;
3073 {
3074 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
3075 }
3076 if (data.slot) {
3077 (clone.data || (clone.data = {})).slot = data.slot;
3078 }
3079 return clone
3080}
3081
3082function mergeProps (to, from) {
3083 for (var key in from) {
3084 to[camelize(key)] = from[key];
3085 }
3086}
3087
3088/* */
3089
3090/* */
3091
3092/* */
3093
3094/* */
3095
3096// inline hooks to be invoked on component VNodes during patch
3097var componentVNodeHooks = {
3098 init: function init (vnode, hydrating) {
3099 if (
3100 vnode.componentInstance &&
3101 !vnode.componentInstance._isDestroyed &&
3102 vnode.data.keepAlive
3103 ) {
3104 // kept-alive components, treat as a patch
3105 var mountedNode = vnode; // work around flow
3106 componentVNodeHooks.prepatch(mountedNode, mountedNode);
3107 } else {
3108 var child = vnode.componentInstance = createComponentInstanceForVnode(
3109 vnode,
3110 activeInstance
3111 );
3112 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
3113 }
3114 },
3115
3116 prepatch: function prepatch (oldVnode, vnode) {
3117 var options = vnode.componentOptions;
3118 var child = vnode.componentInstance = oldVnode.componentInstance;
3119 updateChildComponent(
3120 child,
3121 options.propsData, // updated props
3122 options.listeners, // updated listeners
3123 vnode, // new parent vnode
3124 options.children // new children
3125 );
3126 },
3127
3128 insert: function insert (vnode) {
3129 var context = vnode.context;
3130 var componentInstance = vnode.componentInstance;
3131 if (!componentInstance._isMounted) {
3132 componentInstance._isMounted = true;
3133 callHook(componentInstance, 'mounted');
3134 }
3135 if (vnode.data.keepAlive) {
3136 if (context._isMounted) {
3137 // vue-router#1212
3138 // During updates, a kept-alive component's child components may
3139 // change, so directly walking the tree here may call activated hooks
3140 // on incorrect children. Instead we push them into a queue which will
3141 // be processed after the whole patch process ended.
3142 queueActivatedComponent(componentInstance);
3143 } else {
3144 activateChildComponent(componentInstance, true /* direct */);
3145 }
3146 }
3147 },
3148
3149 destroy: function destroy (vnode) {
3150 var componentInstance = vnode.componentInstance;
3151 if (!componentInstance._isDestroyed) {
3152 if (!vnode.data.keepAlive) {
3153 componentInstance.$destroy();
3154 } else {
3155 deactivateChildComponent(componentInstance, true /* direct */);
3156 }
3157 }
3158 }
3159};
3160
3161var hooksToMerge = Object.keys(componentVNodeHooks);
3162
3163function createComponent (
3164 Ctor,
3165 data,
3166 context,
3167 children,
3168 tag
3169) {
3170 if (isUndef(Ctor)) {
3171 return
3172 }
3173
3174 var baseCtor = context.$options._base;
3175
3176 // plain options object: turn it into a constructor
3177 if (isObject(Ctor)) {
3178 Ctor = baseCtor.extend(Ctor);
3179 }
3180
3181 // if at this stage it's not a constructor or an async component factory,
3182 // reject.
3183 if (typeof Ctor !== 'function') {
3184 {
3185 warn(("Invalid Component definition: " + (String(Ctor))), context);
3186 }
3187 return
3188 }
3189
3190 // async component
3191 var asyncFactory;
3192 if (isUndef(Ctor.cid)) {
3193 asyncFactory = Ctor;
3194 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3195 if (Ctor === undefined) {
3196 // return a placeholder node for async component, which is rendered
3197 // as a comment node but preserves all the raw information for the node.
3198 // the information will be used for async server-rendering and hydration.
3199 return createAsyncPlaceholder(
3200 asyncFactory,
3201 data,
3202 context,
3203 children,
3204 tag
3205 )
3206 }
3207 }
3208
3209 data = data || {};
3210
3211 // resolve constructor options in case global mixins are applied after
3212 // component constructor creation
3213 resolveConstructorOptions(Ctor);
3214
3215 // transform component v-model data into props & events
3216 if (isDef(data.model)) {
3217 transformModel(Ctor.options, data);
3218 }
3219
3220 // extract props
3221 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
3222
3223 // functional component
3224 if (isTrue(Ctor.options.functional)) {
3225 return createFunctionalComponent(Ctor, propsData, data, context, children)
3226 }
3227
3228 // extract listeners, since these needs to be treated as
3229 // child component listeners instead of DOM listeners
3230 var listeners = data.on;
3231 // replace with listeners with .native modifier
3232 // so it gets processed during parent component patch.
3233 data.on = data.nativeOn;
3234
3235 if (isTrue(Ctor.options.abstract)) {
3236 // abstract components do not keep anything
3237 // other than props & listeners & slot
3238
3239 // work around flow
3240 var slot = data.slot;
3241 data = {};
3242 if (slot) {
3243 data.slot = slot;
3244 }
3245 }
3246
3247 // install component management hooks onto the placeholder node
3248 installComponentHooks(data);
3249
3250 // return a placeholder vnode
3251 var name = Ctor.options.name || tag;
3252 var vnode = new VNode(
3253 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
3254 data, undefined, undefined, undefined, context,
3255 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
3256 asyncFactory
3257 );
3258
3259 return vnode
3260}
3261
3262function createComponentInstanceForVnode (
3263 vnode, // we know it's MountedComponentVNode but flow doesn't
3264 parent // activeInstance in lifecycle state
3265) {
3266 var options = {
3267 _isComponent: true,
3268 _parentVnode: vnode,
3269 parent: parent
3270 };
3271 // check inline-template render functions
3272 var inlineTemplate = vnode.data.inlineTemplate;
3273 if (isDef(inlineTemplate)) {
3274 options.render = inlineTemplate.render;
3275 options.staticRenderFns = inlineTemplate.staticRenderFns;
3276 }
3277 return new vnode.componentOptions.Ctor(options)
3278}
3279
3280function installComponentHooks (data) {
3281 var hooks = data.hook || (data.hook = {});
3282 for (var i = 0; i < hooksToMerge.length; i++) {
3283 var key = hooksToMerge[i];
3284 var existing = hooks[key];
3285 var toMerge = componentVNodeHooks[key];
3286 if (existing !== toMerge && !(existing && existing._merged)) {
3287 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
3288 }
3289 }
3290}
3291
3292function mergeHook$1 (f1, f2) {
3293 var merged = function (a, b) {
3294 // flow complains about extra args which is why we use any
3295 f1(a, b);
3296 f2(a, b);
3297 };
3298 merged._merged = true;
3299 return merged
3300}
3301
3302// transform component v-model info (value and callback) into
3303// prop and event handler respectively.
3304function transformModel (options, data) {
3305 var prop = (options.model && options.model.prop) || 'value';
3306 var event = (options.model && options.model.event) || 'input'
3307 ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
3308 var on = data.on || (data.on = {});
3309 var existing = on[event];
3310 var callback = data.model.callback;
3311 if (isDef(existing)) {
3312 if (
3313 Array.isArray(existing)
3314 ? existing.indexOf(callback) === -1
3315 : existing !== callback
3316 ) {
3317 on[event] = [callback].concat(existing);
3318 }
3319 } else {
3320 on[event] = callback;
3321 }
3322}
3323
3324/* */
3325
3326var SIMPLE_NORMALIZE = 1;
3327var ALWAYS_NORMALIZE = 2;
3328
3329// wrapper function for providing a more flexible interface
3330// without getting yelled at by flow
3331function createElement (
3332 context,
3333 tag,
3334 data,
3335 children,
3336 normalizationType,
3337 alwaysNormalize
3338) {
3339 if (Array.isArray(data) || isPrimitive(data)) {
3340 normalizationType = children;
3341 children = data;
3342 data = undefined;
3343 }
3344 if (isTrue(alwaysNormalize)) {
3345 normalizationType = ALWAYS_NORMALIZE;
3346 }
3347 return _createElement(context, tag, data, children, normalizationType)
3348}
3349
3350function _createElement (
3351 context,
3352 tag,
3353 data,
3354 children,
3355 normalizationType
3356) {
3357 if (isDef(data) && isDef((data).__ob__)) {
3358 warn(
3359 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
3360 'Always create fresh vnode data objects in each render!',
3361 context
3362 );
3363 return createEmptyVNode()
3364 }
3365 // object syntax in v-bind
3366 if (isDef(data) && isDef(data.is)) {
3367 tag = data.is;
3368 }
3369 if (!tag) {
3370 // in case of component :is set to falsy value
3371 return createEmptyVNode()
3372 }
3373 // warn against non-primitive key
3374 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
3375 ) {
3376 {
3377 warn(
3378 'Avoid using non-primitive value as key, ' +
3379 'use string/number value instead.',
3380 context
3381 );
3382 }
3383 }
3384 // support single function children as default scoped slot
3385 if (Array.isArray(children) &&
3386 typeof children[0] === 'function'
3387 ) {
3388 data = data || {};
3389 data.scopedSlots = { default: children[0] };
3390 children.length = 0;
3391 }
3392 if (normalizationType === ALWAYS_NORMALIZE) {
3393 children = normalizeChildren(children);
3394 } else if (normalizationType === SIMPLE_NORMALIZE) {
3395 children = simpleNormalizeChildren(children);
3396 }
3397 var vnode, ns;
3398 if (typeof tag === 'string') {
3399 var Ctor;
3400 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3401 if (config.isReservedTag(tag)) {
3402 // platform built-in elements
3403 if (isDef(data) && isDef(data.nativeOn)) {
3404 warn(
3405 ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3406 context
3407 );
3408 }
3409 vnode = new VNode(
3410 config.parsePlatformTagName(tag), data, children,
3411 undefined, undefined, context
3412 );
3413 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3414 // component
3415 vnode = createComponent(Ctor, data, context, children, tag);
3416 } else {
3417 // unknown or unlisted namespaced elements
3418 // check at runtime because it may get assigned a namespace when its
3419 // parent normalizes children
3420 vnode = new VNode(
3421 tag, data, children,
3422 undefined, undefined, context
3423 );
3424 }
3425 } else {
3426 // direct component options / constructor
3427 vnode = createComponent(tag, data, context, children);
3428 }
3429 if (Array.isArray(vnode)) {
3430 return vnode
3431 } else if (isDef(vnode)) {
3432 if (isDef(ns)) { applyNS(vnode, ns); }
3433 if (isDef(data)) { registerDeepBindings(data); }
3434 return vnode
3435 } else {
3436 return createEmptyVNode()
3437 }
3438}
3439
3440function applyNS (vnode, ns, force) {
3441 vnode.ns = ns;
3442 if (vnode.tag === 'foreignObject') {
3443 // use default namespace inside foreignObject
3444 ns = undefined;
3445 force = true;
3446 }
3447 if (isDef(vnode.children)) {
3448 for (var i = 0, l = vnode.children.length; i < l; i++) {
3449 var child = vnode.children[i];
3450 if (isDef(child.tag) && (
3451 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3452 applyNS(child, ns, force);
3453 }
3454 }
3455 }
3456}
3457
3458// ref #5318
3459// necessary to ensure parent re-render when deep bindings like :style and
3460// :class are used on slot nodes
3461function registerDeepBindings (data) {
3462 if (isObject(data.style)) {
3463 traverse(data.style);
3464 }
3465 if (isObject(data.class)) {
3466 traverse(data.class);
3467 }
3468}
3469
3470/* */
3471
3472function initRender (vm) {
3473 vm._vnode = null; // the root of the child tree
3474 vm._staticTrees = null; // v-once cached trees
3475 var options = vm.$options;
3476 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3477 var renderContext = parentVnode && parentVnode.context;
3478 vm.$slots = resolveSlots(options._renderChildren, renderContext);
3479 vm.$scopedSlots = emptyObject;
3480 // bind the createElement fn to this instance
3481 // so that we get proper render context inside it.
3482 // args order: tag, data, children, normalizationType, alwaysNormalize
3483 // internal version is used by render functions compiled from templates
3484 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3485 // normalization is always applied for the public version, used in
3486 // user-written render functions.
3487 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3488
3489 // $attrs & $listeners are exposed for easier HOC creation.
3490 // they need to be reactive so that HOCs using them are always updated
3491 var parentData = parentVnode && parentVnode.data;
3492
3493 /* istanbul ignore else */
3494 {
3495 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3496 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3497 }, true);
3498 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3499 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3500 }, true);
3501 }
3502}
3503
3504var currentRenderingInstance = null;
3505
3506function renderMixin (Vue) {
3507 // install runtime convenience helpers
3508 installRenderHelpers(Vue.prototype);
3509
3510 Vue.prototype.$nextTick = function (fn) {
3511 return nextTick(fn, this)
3512 };
3513
3514 Vue.prototype._render = function () {
3515 var vm = this;
3516 var ref = vm.$options;
3517 var render = ref.render;
3518 var _parentVnode = ref._parentVnode;
3519
3520 if (_parentVnode) {
3521 vm.$scopedSlots = normalizeScopedSlots(
3522 _parentVnode.data.scopedSlots,
3523 vm.$slots,
3524 vm.$scopedSlots
3525 );
3526 }
3527
3528 // set parent vnode. this allows render functions to have access
3529 // to the data on the placeholder node.
3530 vm.$vnode = _parentVnode;
3531 // render self
3532 var vnode;
3533 try {
3534 // There's no need to maintain a stack because all render fns are called
3535 // separately from one another. Nested component's render fns are called
3536 // when parent component is patched.
3537 currentRenderingInstance = vm;
3538 vnode = render.call(vm._renderProxy, vm.$createElement);
3539 } catch (e) {
3540 handleError(e, vm, "render");
3541 // return error render result,
3542 // or previous vnode to prevent render error causing blank component
3543 /* istanbul ignore else */
3544 if (vm.$options.renderError) {
3545 try {
3546 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3547 } catch (e) {
3548 handleError(e, vm, "renderError");
3549 vnode = vm._vnode;
3550 }
3551 } else {
3552 vnode = vm._vnode;
3553 }
3554 } finally {
3555 currentRenderingInstance = null;
3556 }
3557 // if the returned array contains only a single node, allow it
3558 if (Array.isArray(vnode) && vnode.length === 1) {
3559 vnode = vnode[0];
3560 }
3561 // return empty vnode in case the render function errored out
3562 if (!(vnode instanceof VNode)) {
3563 if (Array.isArray(vnode)) {
3564 warn(
3565 'Multiple root nodes returned from render function. Render function ' +
3566 'should return a single root node.',
3567 vm
3568 );
3569 }
3570 vnode = createEmptyVNode();
3571 }
3572 // set parent
3573 vnode.parent = _parentVnode;
3574 return vnode
3575 };
3576}
3577
3578/* */
3579
3580function ensureCtor (comp, base) {
3581 if (
3582 comp.__esModule ||
3583 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3584 ) {
3585 comp = comp.default;
3586 }
3587 return isObject(comp)
3588 ? base.extend(comp)
3589 : comp
3590}
3591
3592function createAsyncPlaceholder (
3593 factory,
3594 data,
3595 context,
3596 children,
3597 tag
3598) {
3599 var node = createEmptyVNode();
3600 node.asyncFactory = factory;
3601 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3602 return node
3603}
3604
3605function resolveAsyncComponent (
3606 factory,
3607 baseCtor
3608) {
3609 if (isTrue(factory.error) && isDef(factory.errorComp)) {
3610 return factory.errorComp
3611 }
3612
3613 if (isDef(factory.resolved)) {
3614 return factory.resolved
3615 }
3616
3617 var owner = currentRenderingInstance;
3618 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3619 // already pending
3620 factory.owners.push(owner);
3621 }
3622
3623 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3624 return factory.loadingComp
3625 }
3626
3627 if (owner && !isDef(factory.owners)) {
3628 var owners = factory.owners = [owner];
3629 var sync = true;
3630 var timerLoading = null;
3631 var timerTimeout = null
3632
3633 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3634
3635 var forceRender = function (renderCompleted) {
3636 for (var i = 0, l = owners.length; i < l; i++) {
3637 (owners[i]).$forceUpdate();
3638 }
3639
3640 if (renderCompleted) {
3641 owners.length = 0;
3642 if (timerLoading !== null) {
3643 clearTimeout(timerLoading);
3644 timerLoading = null;
3645 }
3646 if (timerTimeout !== null) {
3647 clearTimeout(timerTimeout);
3648 timerTimeout = null;
3649 }
3650 }
3651 };
3652
3653 var resolve = once(function (res) {
3654 // cache resolved
3655 factory.resolved = ensureCtor(res, baseCtor);
3656 // invoke callbacks only if this is not a synchronous resolve
3657 // (async resolves are shimmed as synchronous during SSR)
3658 if (!sync) {
3659 forceRender(true);
3660 } else {
3661 owners.length = 0;
3662 }
3663 });
3664
3665 var reject = once(function (reason) {
3666 warn(
3667 "Failed to resolve async component: " + (String(factory)) +
3668 (reason ? ("\nReason: " + reason) : '')
3669 );
3670 if (isDef(factory.errorComp)) {
3671 factory.error = true;
3672 forceRender(true);
3673 }
3674 });
3675
3676 var res = factory(resolve, reject);
3677
3678 if (isObject(res)) {
3679 if (isPromise(res)) {
3680 // () => Promise
3681 if (isUndef(factory.resolved)) {
3682 res.then(resolve, reject);
3683 }
3684 } else if (isPromise(res.component)) {
3685 res.component.then(resolve, reject);
3686
3687 if (isDef(res.error)) {
3688 factory.errorComp = ensureCtor(res.error, baseCtor);
3689 }
3690
3691 if (isDef(res.loading)) {
3692 factory.loadingComp = ensureCtor(res.loading, baseCtor);
3693 if (res.delay === 0) {
3694 factory.loading = true;
3695 } else {
3696 timerLoading = setTimeout(function () {
3697 timerLoading = null;
3698 if (isUndef(factory.resolved) && isUndef(factory.error)) {
3699 factory.loading = true;
3700 forceRender(false);
3701 }
3702 }, res.delay || 200);
3703 }
3704 }
3705
3706 if (isDef(res.timeout)) {
3707 timerTimeout = setTimeout(function () {
3708 timerTimeout = null;
3709 if (isUndef(factory.resolved)) {
3710 reject(
3711 "timeout (" + (res.timeout) + "ms)"
3712 );
3713 }
3714 }, res.timeout);
3715 }
3716 }
3717 }
3718
3719 sync = false;
3720 // return in case resolved synchronously
3721 return factory.loading
3722 ? factory.loadingComp
3723 : factory.resolved
3724 }
3725}
3726
3727/* */
3728
3729function isAsyncPlaceholder (node) {
3730 return node.isComment && node.asyncFactory
3731}
3732
3733/* */
3734
3735function getFirstComponentChild (children) {
3736 if (Array.isArray(children)) {
3737 for (var i = 0; i < children.length; i++) {
3738 var c = children[i];
3739 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3740 return c
3741 }
3742 }
3743 }
3744}
3745
3746/* */
3747
3748/* */
3749
3750function initEvents (vm) {
3751 vm._events = Object.create(null);
3752 vm._hasHookEvent = false;
3753 // init parent attached events
3754 var listeners = vm.$options._parentListeners;
3755 if (listeners) {
3756 updateComponentListeners(vm, listeners);
3757 }
3758}
3759
3760var target;
3761
3762function add (event, fn) {
3763 target.$on(event, fn);
3764}
3765
3766function remove$1 (event, fn) {
3767 target.$off(event, fn);
3768}
3769
3770function createOnceHandler (event, fn) {
3771 var _target = target;
3772 return function onceHandler () {
3773 var res = fn.apply(null, arguments);
3774 if (res !== null) {
3775 _target.$off(event, onceHandler);
3776 }
3777 }
3778}
3779
3780function updateComponentListeners (
3781 vm,
3782 listeners,
3783 oldListeners
3784) {
3785 target = vm;
3786 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3787 target = undefined;
3788}
3789
3790function eventsMixin (Vue) {
3791 var hookRE = /^hook:/;
3792 Vue.prototype.$on = function (event, fn) {
3793 var vm = this;
3794 if (Array.isArray(event)) {
3795 for (var i = 0, l = event.length; i < l; i++) {
3796 vm.$on(event[i], fn);
3797 }
3798 } else {
3799 (vm._events[event] || (vm._events[event] = [])).push(fn);
3800 // optimize hook:event cost by using a boolean flag marked at registration
3801 // instead of a hash lookup
3802 if (hookRE.test(event)) {
3803 vm._hasHookEvent = true;
3804 }
3805 }
3806 return vm
3807 };
3808
3809 Vue.prototype.$once = function (event, fn) {
3810 var vm = this;
3811 function on () {
3812 vm.$off(event, on);
3813 fn.apply(vm, arguments);
3814 }
3815 on.fn = fn;
3816 vm.$on(event, on);
3817 return vm
3818 };
3819
3820 Vue.prototype.$off = function (event, fn) {
3821 var vm = this;
3822 // all
3823 if (!arguments.length) {
3824 vm._events = Object.create(null);
3825 return vm
3826 }
3827 // array of events
3828 if (Array.isArray(event)) {
3829 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3830 vm.$off(event[i$1], fn);
3831 }
3832 return vm
3833 }
3834 // specific event
3835 var cbs = vm._events[event];
3836 if (!cbs) {
3837 return vm
3838 }
3839 if (!fn) {
3840 vm._events[event] = null;
3841 return vm
3842 }
3843 // specific handler
3844 var cb;
3845 var i = cbs.length;
3846 while (i--) {
3847 cb = cbs[i];
3848 if (cb === fn || cb.fn === fn) {
3849 cbs.splice(i, 1);
3850 break
3851 }
3852 }
3853 return vm
3854 };
3855
3856 Vue.prototype.$emit = function (event) {
3857 var vm = this;
3858 {
3859 var lowerCaseEvent = event.toLowerCase();
3860 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3861 tip(
3862 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3863 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3864 "Note that HTML attributes are case-insensitive and you cannot use " +
3865 "v-on to listen to camelCase events when using in-DOM templates. " +
3866 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3867 );
3868 }
3869 }
3870 var cbs = vm._events[event];
3871 if (cbs) {
3872 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3873 var args = toArray(arguments, 1);
3874 var info = "event handler for \"" + event + "\"";
3875 for (var i = 0, l = cbs.length; i < l; i++) {
3876 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3877 }
3878 }
3879 return vm
3880 };
3881}
3882
3883/* */
3884
3885var activeInstance = null;
3886var isUpdatingChildComponent = false;
3887
3888function setActiveInstance(vm) {
3889 var prevActiveInstance = activeInstance;
3890 activeInstance = vm;
3891 return function () {
3892 activeInstance = prevActiveInstance;
3893 }
3894}
3895
3896function initLifecycle (vm) {
3897 var options = vm.$options;
3898
3899 // locate first non-abstract parent
3900 var parent = options.parent;
3901 if (parent && !options.abstract) {
3902 while (parent.$options.abstract && parent.$parent) {
3903 parent = parent.$parent;
3904 }
3905 parent.$children.push(vm);
3906 }
3907
3908 vm.$parent = parent;
3909 vm.$root = parent ? parent.$root : vm;
3910
3911 vm.$children = [];
3912 vm.$refs = {};
3913
3914 vm._watcher = null;
3915 vm._inactive = null;
3916 vm._directInactive = false;
3917 vm._isMounted = false;
3918 vm._isDestroyed = false;
3919 vm._isBeingDestroyed = false;
3920}
3921
3922function lifecycleMixin (Vue) {
3923 Vue.prototype._update = function (vnode, hydrating) {
3924 var vm = this;
3925 var prevEl = vm.$el;
3926 var prevVnode = vm._vnode;
3927 var restoreActiveInstance = setActiveInstance(vm);
3928 vm._vnode = vnode;
3929 // Vue.prototype.__patch__ is injected in entry points
3930 // based on the rendering backend used.
3931 if (!prevVnode) {
3932 // initial render
3933 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3934 } else {
3935 // updates
3936 vm.$el = vm.__patch__(prevVnode, vnode);
3937 }
3938 restoreActiveInstance();
3939 // update __vue__ reference
3940 if (prevEl) {
3941 prevEl.__vue__ = null;
3942 }
3943 if (vm.$el) {
3944 vm.$el.__vue__ = vm;
3945 }
3946 // if parent is an HOC, update its $el as well
3947 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3948 vm.$parent.$el = vm.$el;
3949 }
3950 // updated hook is called by the scheduler to ensure that children are
3951 // updated in a parent's updated hook.
3952 };
3953
3954 Vue.prototype.$forceUpdate = function () {
3955 var vm = this;
3956 if (vm._watcher) {
3957 vm._watcher.update();
3958 }
3959 };
3960
3961 Vue.prototype.$destroy = function () {
3962 var vm = this;
3963 if (vm._isBeingDestroyed) {
3964 return
3965 }
3966 callHook(vm, 'beforeDestroy');
3967 vm._isBeingDestroyed = true;
3968 // remove self from parent
3969 var parent = vm.$parent;
3970 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3971 remove(parent.$children, vm);
3972 }
3973 // teardown watchers
3974 if (vm._watcher) {
3975 vm._watcher.teardown();
3976 }
3977 var i = vm._watchers.length;
3978 while (i--) {
3979 vm._watchers[i].teardown();
3980 }
3981 // remove reference from data ob
3982 // frozen object may not have observer.
3983 if (vm._data.__ob__) {
3984 vm._data.__ob__.vmCount--;
3985 }
3986 // call the last hook...
3987 vm._isDestroyed = true;
3988 // invoke destroy hooks on current rendered tree
3989 vm.__patch__(vm._vnode, null);
3990 // fire destroyed hook
3991 callHook(vm, 'destroyed');
3992 // turn off all instance listeners.
3993 vm.$off();
3994 // remove __vue__ reference
3995 if (vm.$el) {
3996 vm.$el.__vue__ = null;
3997 }
3998 // release circular reference (#6759)
3999 if (vm.$vnode) {
4000 vm.$vnode.parent = null;
4001 }
4002 };
4003}
4004
4005function mountComponent (
4006 vm,
4007 el,
4008 hydrating
4009) {
4010 vm.$el = el;
4011 if (!vm.$options.render) {
4012 vm.$options.render = createEmptyVNode;
4013 {
4014 /* istanbul ignore if */
4015 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
4016 vm.$options.el || el) {
4017 warn(
4018 'You are using the runtime-only build of Vue where the template ' +
4019 'compiler is not available. Either pre-compile the templates into ' +
4020 'render functions, or use the compiler-included build.',
4021 vm
4022 );
4023 } else {
4024 warn(
4025 'Failed to mount component: template or render function not defined.',
4026 vm
4027 );
4028 }
4029 }
4030 }
4031 callHook(vm, 'beforeMount');
4032
4033 var updateComponent;
4034 /* istanbul ignore if */
4035 if (config.performance && mark) {
4036 updateComponent = function () {
4037 var name = vm._name;
4038 var id = vm._uid;
4039 var startTag = "vue-perf-start:" + id;
4040 var endTag = "vue-perf-end:" + id;
4041
4042 mark(startTag);
4043 var vnode = vm._render();
4044 mark(endTag);
4045 measure(("vue " + name + " render"), startTag, endTag);
4046
4047 mark(startTag);
4048 vm._update(vnode, hydrating);
4049 mark(endTag);
4050 measure(("vue " + name + " patch"), startTag, endTag);
4051 };
4052 } else {
4053 updateComponent = function () {
4054 vm._update(vm._render(), hydrating);
4055 };
4056 }
4057
4058 // we set this to vm._watcher inside the watcher's constructor
4059 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4060 // component's mounted hook), which relies on vm._watcher being already defined
4061 new Watcher(vm, updateComponent, noop, {
4062 before: function before () {
4063 if (vm._isMounted && !vm._isDestroyed) {
4064 callHook(vm, 'beforeUpdate');
4065 }
4066 }
4067 }, true /* isRenderWatcher */);
4068 hydrating = false;
4069
4070 // manually mounted instance, call mounted on self
4071 // mounted is called for render-created child components in its inserted hook
4072 if (vm.$vnode == null) {
4073 vm._isMounted = true;
4074 callHook(vm, 'mounted');
4075 }
4076 return vm
4077}
4078
4079function updateChildComponent (
4080 vm,
4081 propsData,
4082 listeners,
4083 parentVnode,
4084 renderChildren
4085) {
4086 {
4087 isUpdatingChildComponent = true;
4088 }
4089
4090 // determine whether component has slot children
4091 // we need to do this before overwriting $options._renderChildren.
4092
4093 // check if there are dynamic scopedSlots (hand-written or compiled but with
4094 // dynamic slot names). Static scoped slots compiled from template has the
4095 // "$stable" marker.
4096 var newScopedSlots = parentVnode.data.scopedSlots;
4097 var oldScopedSlots = vm.$scopedSlots;
4098 var hasDynamicScopedSlot = !!(
4099 (newScopedSlots && !newScopedSlots.$stable) ||
4100 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4101 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4102 );
4103
4104 // Any static slot children from the parent may have changed during parent's
4105 // update. Dynamic scoped slots may also have changed. In such cases, a forced
4106 // update is necessary to ensure correctness.
4107 var needsForceUpdate = !!(
4108 renderChildren || // has new static slots
4109 vm.$options._renderChildren || // has old static slots
4110 hasDynamicScopedSlot
4111 );
4112
4113 vm.$options._parentVnode = parentVnode;
4114 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4115
4116 if (vm._vnode) { // update child tree's parent
4117 vm._vnode.parent = parentVnode;
4118 }
4119 vm.$options._renderChildren = renderChildren;
4120
4121 // update $attrs and $listeners hash
4122 // these are also reactive so they may trigger child update if the child
4123 // used them during render
4124 vm.$attrs = parentVnode.data.attrs || emptyObject;
4125 vm.$listeners = listeners || emptyObject;
4126
4127 // update props
4128 if (propsData && vm.$options.props) {
4129 toggleObserving(false);
4130 var props = vm._props;
4131 var propKeys = vm.$options._propKeys || [];
4132 for (var i = 0; i < propKeys.length; i++) {
4133 var key = propKeys[i];
4134 var propOptions = vm.$options.props; // wtf flow?
4135 props[key] = validateProp(key, propOptions, propsData, vm);
4136 }
4137 toggleObserving(true);
4138 // keep a copy of raw propsData
4139 vm.$options.propsData = propsData;
4140 }
4141
4142 // update listeners
4143 listeners = listeners || emptyObject;
4144 var oldListeners = vm.$options._parentListeners;
4145 vm.$options._parentListeners = listeners;
4146 updateComponentListeners(vm, listeners, oldListeners);
4147
4148 // resolve slots + force update if has children
4149 if (needsForceUpdate) {
4150 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4151 vm.$forceUpdate();
4152 }
4153
4154 {
4155 isUpdatingChildComponent = false;
4156 }
4157}
4158
4159function isInInactiveTree (vm) {
4160 while (vm && (vm = vm.$parent)) {
4161 if (vm._inactive) { return true }
4162 }
4163 return false
4164}
4165
4166function activateChildComponent (vm, direct) {
4167 if (direct) {
4168 vm._directInactive = false;
4169 if (isInInactiveTree(vm)) {
4170 return
4171 }
4172 } else if (vm._directInactive) {
4173 return
4174 }
4175 if (vm._inactive || vm._inactive === null) {
4176 vm._inactive = false;
4177 for (var i = 0; i < vm.$children.length; i++) {
4178 activateChildComponent(vm.$children[i]);
4179 }
4180 callHook(vm, 'activated');
4181 }
4182}
4183
4184function deactivateChildComponent (vm, direct) {
4185 if (direct) {
4186 vm._directInactive = true;
4187 if (isInInactiveTree(vm)) {
4188 return
4189 }
4190 }
4191 if (!vm._inactive) {
4192 vm._inactive = true;
4193 for (var i = 0; i < vm.$children.length; i++) {
4194 deactivateChildComponent(vm.$children[i]);
4195 }
4196 callHook(vm, 'deactivated');
4197 }
4198}
4199
4200function callHook (vm, hook) {
4201 // #7573 disable dep collection when invoking lifecycle hooks
4202 pushTarget();
4203 var handlers = vm.$options[hook];
4204 var info = hook + " hook";
4205 if (handlers) {
4206 for (var i = 0, j = handlers.length; i < j; i++) {
4207 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4208 }
4209 }
4210 if (vm._hasHookEvent) {
4211 vm.$emit('hook:' + hook);
4212 }
4213 popTarget();
4214}
4215
4216/* */
4217
4218var MAX_UPDATE_COUNT = 100;
4219
4220var queue = [];
4221var activatedChildren = [];
4222var has = {};
4223var circular = {};
4224var waiting = false;
4225var flushing = false;
4226var index = 0;
4227
4228/**
4229 * Reset the scheduler's state.
4230 */
4231function resetSchedulerState () {
4232 index = queue.length = activatedChildren.length = 0;
4233 has = {};
4234 {
4235 circular = {};
4236 }
4237 waiting = flushing = false;
4238}
4239
4240// Async edge case #6566 requires saving the timestamp when event listeners are
4241// attached. However, calling performance.now() has a perf overhead especially
4242// if the page has thousands of event listeners. Instead, we take a timestamp
4243// every time the scheduler flushes and use that for all event listeners
4244// attached during that flush.
4245var currentFlushTimestamp = 0;
4246
4247// Async edge case fix requires storing an event listener's attach timestamp.
4248var getNow = Date.now;
4249
4250// Determine what event timestamp the browser is using. Annoyingly, the
4251// timestamp can either be hi-res (relative to page load) or low-res
4252// (relative to UNIX epoch), so in order to compare time we have to use the
4253// same timestamp type when saving the flush timestamp.
4254// All IE versions use low-res event timestamps, and have problematic clock
4255// implementations (#9632)
4256if (inBrowser && !isIE) {
4257 var performance = window.performance;
4258 if (
4259 performance &&
4260 typeof performance.now === 'function' &&
4261 getNow() > document.createEvent('Event').timeStamp
4262 ) {
4263 // if the event timestamp, although evaluated AFTER the Date.now(), is
4264 // smaller than it, it means the event is using a hi-res timestamp,
4265 // and we need to use the hi-res version for event listener timestamps as
4266 // well.
4267 getNow = function () { return performance.now(); };
4268 }
4269}
4270
4271/**
4272 * Flush both queues and run the watchers.
4273 */
4274function flushSchedulerQueue () {
4275 currentFlushTimestamp = getNow();
4276 flushing = true;
4277 var watcher, id;
4278
4279 // Sort queue before flush.
4280 // This ensures that:
4281 // 1. Components are updated from parent to child. (because parent is always
4282 // created before the child)
4283 // 2. A component's user watchers are run before its render watcher (because
4284 // user watchers are created before the render watcher)
4285 // 3. If a component is destroyed during a parent component's watcher run,
4286 // its watchers can be skipped.
4287 queue.sort(function (a, b) { return a.id - b.id; });
4288
4289 // do not cache length because more watchers might be pushed
4290 // as we run existing watchers
4291 for (index = 0; index < queue.length; index++) {
4292 watcher = queue[index];
4293 if (watcher.before) {
4294 watcher.before();
4295 }
4296 id = watcher.id;
4297 has[id] = null;
4298 watcher.run();
4299 // in dev build, check and stop circular updates.
4300 if (has[id] != null) {
4301 circular[id] = (circular[id] || 0) + 1;
4302 if (circular[id] > MAX_UPDATE_COUNT) {
4303 warn(
4304 'You may have an infinite update loop ' + (
4305 watcher.user
4306 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4307 : "in a component render function."
4308 ),
4309 watcher.vm
4310 );
4311 break
4312 }
4313 }
4314 }
4315
4316 // keep copies of post queues before resetting state
4317 var activatedQueue = activatedChildren.slice();
4318 var updatedQueue = queue.slice();
4319
4320 resetSchedulerState();
4321
4322 // call component updated and activated hooks
4323 callActivatedHooks(activatedQueue);
4324 callUpdatedHooks(updatedQueue);
4325
4326 // devtool hook
4327 /* istanbul ignore if */
4328 if (devtools && config.devtools) {
4329 devtools.emit('flush');
4330 }
4331}
4332
4333function callUpdatedHooks (queue) {
4334 var i = queue.length;
4335 while (i--) {
4336 var watcher = queue[i];
4337 var vm = watcher.vm;
4338 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4339 callHook(vm, 'updated');
4340 }
4341 }
4342}
4343
4344/**
4345 * Queue a kept-alive component that was activated during patch.
4346 * The queue will be processed after the entire tree has been patched.
4347 */
4348function queueActivatedComponent (vm) {
4349 // setting _inactive to false here so that a render function can
4350 // rely on checking whether it's in an inactive tree (e.g. router-view)
4351 vm._inactive = false;
4352 activatedChildren.push(vm);
4353}
4354
4355function callActivatedHooks (queue) {
4356 for (var i = 0; i < queue.length; i++) {
4357 queue[i]._inactive = true;
4358 activateChildComponent(queue[i], true /* true */);
4359 }
4360}
4361
4362/**
4363 * Push a watcher into the watcher queue.
4364 * Jobs with duplicate IDs will be skipped unless it's
4365 * pushed when the queue is being flushed.
4366 */
4367function queueWatcher (watcher) {
4368 var id = watcher.id;
4369 if (has[id] == null) {
4370 has[id] = true;
4371 if (!flushing) {
4372 queue.push(watcher);
4373 } else {
4374 // if already flushing, splice the watcher based on its id
4375 // if already past its id, it will be run next immediately.
4376 var i = queue.length - 1;
4377 while (i > index && queue[i].id > watcher.id) {
4378 i--;
4379 }
4380 queue.splice(i + 1, 0, watcher);
4381 }
4382 // queue the flush
4383 if (!waiting) {
4384 waiting = true;
4385
4386 if (!config.async) {
4387 flushSchedulerQueue();
4388 return
4389 }
4390 nextTick(flushSchedulerQueue);
4391 }
4392 }
4393}
4394
4395/* */
4396
4397
4398
4399var uid$2 = 0;
4400
4401/**
4402 * A watcher parses an expression, collects dependencies,
4403 * and fires callback when the expression value changes.
4404 * This is used for both the $watch() api and directives.
4405 */
4406var Watcher = function Watcher (
4407 vm,
4408 expOrFn,
4409 cb,
4410 options,
4411 isRenderWatcher
4412) {
4413 this.vm = vm;
4414 if (isRenderWatcher) {
4415 vm._watcher = this;
4416 }
4417 vm._watchers.push(this);
4418 // options
4419 if (options) {
4420 this.deep = !!options.deep;
4421 this.user = !!options.user;
4422 this.lazy = !!options.lazy;
4423 this.sync = !!options.sync;
4424 this.before = options.before;
4425 } else {
4426 this.deep = this.user = this.lazy = this.sync = false;
4427 }
4428 this.cb = cb;
4429 this.id = ++uid$2; // uid for batching
4430 this.active = true;
4431 this.dirty = this.lazy; // for lazy watchers
4432 this.deps = [];
4433 this.newDeps = [];
4434 this.depIds = new _Set();
4435 this.newDepIds = new _Set();
4436 this.expression = expOrFn.toString();
4437 // parse expression for getter
4438 if (typeof expOrFn === 'function') {
4439 this.getter = expOrFn;
4440 } else {
4441 this.getter = parsePath(expOrFn);
4442 if (!this.getter) {
4443 this.getter = noop;
4444 warn(
4445 "Failed watching path: \"" + expOrFn + "\" " +
4446 'Watcher only accepts simple dot-delimited paths. ' +
4447 'For full control, use a function instead.',
4448 vm
4449 );
4450 }
4451 }
4452 this.value = this.lazy
4453 ? undefined
4454 : this.get();
4455};
4456
4457/**
4458 * Evaluate the getter, and re-collect dependencies.
4459 */
4460Watcher.prototype.get = function get () {
4461 pushTarget(this);
4462 var value;
4463 var vm = this.vm;
4464 try {
4465 value = this.getter.call(vm, vm);
4466 } catch (e) {
4467 if (this.user) {
4468 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4469 } else {
4470 throw e
4471 }
4472 } finally {
4473 // "touch" every property so they are all tracked as
4474 // dependencies for deep watching
4475 if (this.deep) {
4476 traverse(value);
4477 }
4478 popTarget();
4479 this.cleanupDeps();
4480 }
4481 return value
4482};
4483
4484/**
4485 * Add a dependency to this directive.
4486 */
4487Watcher.prototype.addDep = function addDep (dep) {
4488 var id = dep.id;
4489 if (!this.newDepIds.has(id)) {
4490 this.newDepIds.add(id);
4491 this.newDeps.push(dep);
4492 if (!this.depIds.has(id)) {
4493 dep.addSub(this);
4494 }
4495 }
4496};
4497
4498/**
4499 * Clean up for dependency collection.
4500 */
4501Watcher.prototype.cleanupDeps = function cleanupDeps () {
4502 var i = this.deps.length;
4503 while (i--) {
4504 var dep = this.deps[i];
4505 if (!this.newDepIds.has(dep.id)) {
4506 dep.removeSub(this);
4507 }
4508 }
4509 var tmp = this.depIds;
4510 this.depIds = this.newDepIds;
4511 this.newDepIds = tmp;
4512 this.newDepIds.clear();
4513 tmp = this.deps;
4514 this.deps = this.newDeps;
4515 this.newDeps = tmp;
4516 this.newDeps.length = 0;
4517};
4518
4519/**
4520 * Subscriber interface.
4521 * Will be called when a dependency changes.
4522 */
4523Watcher.prototype.update = function update () {
4524 /* istanbul ignore else */
4525 if (this.lazy) {
4526 this.dirty = true;
4527 } else if (this.sync) {
4528 this.run();
4529 } else {
4530 queueWatcher(this);
4531 }
4532};
4533
4534/**
4535 * Scheduler job interface.
4536 * Will be called by the scheduler.
4537 */
4538Watcher.prototype.run = function run () {
4539 if (this.active) {
4540 var value = this.get();
4541 if (
4542 value !== this.value ||
4543 // Deep watchers and watchers on Object/Arrays should fire even
4544 // when the value is the same, because the value may
4545 // have mutated.
4546 isObject(value) ||
4547 this.deep
4548 ) {
4549 // set new value
4550 var oldValue = this.value;
4551 this.value = value;
4552 if (this.user) {
4553 try {
4554 this.cb.call(this.vm, value, oldValue);
4555 } catch (e) {
4556 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4557 }
4558 } else {
4559 this.cb.call(this.vm, value, oldValue);
4560 }
4561 }
4562 }
4563};
4564
4565/**
4566 * Evaluate the value of the watcher.
4567 * This only gets called for lazy watchers.
4568 */
4569Watcher.prototype.evaluate = function evaluate () {
4570 this.value = this.get();
4571 this.dirty = false;
4572};
4573
4574/**
4575 * Depend on all deps collected by this watcher.
4576 */
4577Watcher.prototype.depend = function depend () {
4578 var i = this.deps.length;
4579 while (i--) {
4580 this.deps[i].depend();
4581 }
4582};
4583
4584/**
4585 * Remove self from all dependencies' subscriber list.
4586 */
4587Watcher.prototype.teardown = function teardown () {
4588 if (this.active) {
4589 // remove self from vm's watcher list
4590 // this is a somewhat expensive operation so we skip it
4591 // if the vm is being destroyed.
4592 if (!this.vm._isBeingDestroyed) {
4593 remove(this.vm._watchers, this);
4594 }
4595 var i = this.deps.length;
4596 while (i--) {
4597 this.deps[i].removeSub(this);
4598 }
4599 this.active = false;
4600 }
4601};
4602
4603/* */
4604
4605var sharedPropertyDefinition = {
4606 enumerable: true,
4607 configurable: true,
4608 get: noop,
4609 set: noop
4610};
4611
4612function proxy (target, sourceKey, key) {
4613 sharedPropertyDefinition.get = function proxyGetter () {
4614 return this[sourceKey][key]
4615 };
4616 sharedPropertyDefinition.set = function proxySetter (val) {
4617 this[sourceKey][key] = val;
4618 };
4619 Object.defineProperty(target, key, sharedPropertyDefinition);
4620}
4621
4622function initState (vm) {
4623 vm._watchers = [];
4624 var opts = vm.$options;
4625 if (opts.props) { initProps(vm, opts.props); }
4626 if (opts.methods) { initMethods(vm, opts.methods); }
4627 if (opts.data) {
4628 initData(vm);
4629 } else {
4630 observe(vm._data = {}, true /* asRootData */);
4631 }
4632 if (opts.computed) { initComputed(vm, opts.computed); }
4633 if (opts.watch && opts.watch !== nativeWatch) {
4634 initWatch(vm, opts.watch);
4635 }
4636}
4637
4638function initProps (vm, propsOptions) {
4639 var propsData = vm.$options.propsData || {};
4640 var props = vm._props = {};
4641 // cache prop keys so that future props updates can iterate using Array
4642 // instead of dynamic object key enumeration.
4643 var keys = vm.$options._propKeys = [];
4644 var isRoot = !vm.$parent;
4645 // root instance props should be converted
4646 if (!isRoot) {
4647 toggleObserving(false);
4648 }
4649 var loop = function ( key ) {
4650 keys.push(key);
4651 var value = validateProp(key, propsOptions, propsData, vm);
4652 /* istanbul ignore else */
4653 {
4654 var hyphenatedKey = hyphenate(key);
4655 if (isReservedAttribute(hyphenatedKey) ||
4656 config.isReservedAttr(hyphenatedKey)) {
4657 warn(
4658 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4659 vm
4660 );
4661 }
4662 defineReactive$$1(props, key, value, function () {
4663 if (!isRoot && !isUpdatingChildComponent) {
4664 warn(
4665 "Avoid mutating a prop directly since the value will be " +
4666 "overwritten whenever the parent component re-renders. " +
4667 "Instead, use a data or computed property based on the prop's " +
4668 "value. Prop being mutated: \"" + key + "\"",
4669 vm
4670 );
4671 }
4672 });
4673 }
4674 // static props are already proxied on the component's prototype
4675 // during Vue.extend(). We only need to proxy props defined at
4676 // instantiation here.
4677 if (!(key in vm)) {
4678 proxy(vm, "_props", key);
4679 }
4680 };
4681
4682 for (var key in propsOptions) loop( key );
4683 toggleObserving(true);
4684}
4685
4686function initData (vm) {
4687 var data = vm.$options.data;
4688 data = vm._data = typeof data === 'function'
4689 ? getData(data, vm)
4690 : data || {};
4691 if (!isPlainObject(data)) {
4692 data = {};
4693 warn(
4694 'data functions should return an object:\n' +
4695 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4696 vm
4697 );
4698 }
4699 // proxy data on instance
4700 var keys = Object.keys(data);
4701 var props = vm.$options.props;
4702 var methods = vm.$options.methods;
4703 var i = keys.length;
4704 while (i--) {
4705 var key = keys[i];
4706 {
4707 if (methods && hasOwn(methods, key)) {
4708 warn(
4709 ("Method \"" + key + "\" has already been defined as a data property."),
4710 vm
4711 );
4712 }
4713 }
4714 if (props && hasOwn(props, key)) {
4715 warn(
4716 "The data property \"" + key + "\" is already declared as a prop. " +
4717 "Use prop default value instead.",
4718 vm
4719 );
4720 } else if (!isReserved(key)) {
4721 proxy(vm, "_data", key);
4722 }
4723 }
4724 // observe data
4725 observe(data, true /* asRootData */);
4726}
4727
4728function getData (data, vm) {
4729 // #7573 disable dep collection when invoking data getters
4730 pushTarget();
4731 try {
4732 return data.call(vm, vm)
4733 } catch (e) {
4734 handleError(e, vm, "data()");
4735 return {}
4736 } finally {
4737 popTarget();
4738 }
4739}
4740
4741var computedWatcherOptions = { lazy: true };
4742
4743function initComputed (vm, computed) {
4744 // $flow-disable-line
4745 var watchers = vm._computedWatchers = Object.create(null);
4746 // computed properties are just getters during SSR
4747 var isSSR = isServerRendering();
4748
4749 for (var key in computed) {
4750 var userDef = computed[key];
4751 var getter = typeof userDef === 'function' ? userDef : userDef.get;
4752 if (getter == null) {
4753 warn(
4754 ("Getter is missing for computed property \"" + key + "\"."),
4755 vm
4756 );
4757 }
4758
4759 if (!isSSR) {
4760 // create internal watcher for the computed property.
4761 watchers[key] = new Watcher(
4762 vm,
4763 getter || noop,
4764 noop,
4765 computedWatcherOptions
4766 );
4767 }
4768
4769 // component-defined computed properties are already defined on the
4770 // component prototype. We only need to define computed properties defined
4771 // at instantiation here.
4772 if (!(key in vm)) {
4773 defineComputed(vm, key, userDef);
4774 } else {
4775 if (key in vm.$data) {
4776 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4777 } else if (vm.$options.props && key in vm.$options.props) {
4778 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4779 }
4780 }
4781 }
4782}
4783
4784function defineComputed (
4785 target,
4786 key,
4787 userDef
4788) {
4789 var shouldCache = !isServerRendering();
4790 if (typeof userDef === 'function') {
4791 sharedPropertyDefinition.get = shouldCache
4792 ? createComputedGetter(key)
4793 : createGetterInvoker(userDef);
4794 sharedPropertyDefinition.set = noop;
4795 } else {
4796 sharedPropertyDefinition.get = userDef.get
4797 ? shouldCache && userDef.cache !== false
4798 ? createComputedGetter(key)
4799 : createGetterInvoker(userDef.get)
4800 : noop;
4801 sharedPropertyDefinition.set = userDef.set || noop;
4802 }
4803 if (sharedPropertyDefinition.set === noop) {
4804 sharedPropertyDefinition.set = function () {
4805 warn(
4806 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4807 this
4808 );
4809 };
4810 }
4811 Object.defineProperty(target, key, sharedPropertyDefinition);
4812}
4813
4814function createComputedGetter (key) {
4815 return function computedGetter () {
4816 var watcher = this._computedWatchers && this._computedWatchers[key];
4817 if (watcher) {
4818 if (watcher.dirty) {
4819 watcher.evaluate();
4820 }
4821 if (Dep.target) {
4822 watcher.depend();
4823 }
4824 return watcher.value
4825 }
4826 }
4827}
4828
4829function createGetterInvoker(fn) {
4830 return function computedGetter () {
4831 return fn.call(this, this)
4832 }
4833}
4834
4835function initMethods (vm, methods) {
4836 var props = vm.$options.props;
4837 for (var key in methods) {
4838 {
4839 if (typeof methods[key] !== 'function') {
4840 warn(
4841 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4842 "Did you reference the function correctly?",
4843 vm
4844 );
4845 }
4846 if (props && hasOwn(props, key)) {
4847 warn(
4848 ("Method \"" + key + "\" has already been defined as a prop."),
4849 vm
4850 );
4851 }
4852 if ((key in vm) && isReserved(key)) {
4853 warn(
4854 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4855 "Avoid defining component methods that start with _ or $."
4856 );
4857 }
4858 }
4859 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4860 }
4861}
4862
4863function initWatch (vm, watch) {
4864 for (var key in watch) {
4865 var handler = watch[key];
4866 if (Array.isArray(handler)) {
4867 for (var i = 0; i < handler.length; i++) {
4868 createWatcher(vm, key, handler[i]);
4869 }
4870 } else {
4871 createWatcher(vm, key, handler);
4872 }
4873 }
4874}
4875
4876function createWatcher (
4877 vm,
4878 expOrFn,
4879 handler,
4880 options
4881) {
4882 if (isPlainObject(handler)) {
4883 options = handler;
4884 handler = handler.handler;
4885 }
4886 if (typeof handler === 'string') {
4887 handler = vm[handler];
4888 }
4889 return vm.$watch(expOrFn, handler, options)
4890}
4891
4892function stateMixin (Vue) {
4893 // flow somehow has problems with directly declared definition object
4894 // when using Object.defineProperty, so we have to procedurally build up
4895 // the object here.
4896 var dataDef = {};
4897 dataDef.get = function () { return this._data };
4898 var propsDef = {};
4899 propsDef.get = function () { return this._props };
4900 {
4901 dataDef.set = function () {
4902 warn(
4903 'Avoid replacing instance root $data. ' +
4904 'Use nested data properties instead.',
4905 this
4906 );
4907 };
4908 propsDef.set = function () {
4909 warn("$props is readonly.", this);
4910 };
4911 }
4912 Object.defineProperty(Vue.prototype, '$data', dataDef);
4913 Object.defineProperty(Vue.prototype, '$props', propsDef);
4914
4915 Vue.prototype.$set = set;
4916 Vue.prototype.$delete = del;
4917
4918 Vue.prototype.$watch = function (
4919 expOrFn,
4920 cb,
4921 options
4922 ) {
4923 var vm = this;
4924 if (isPlainObject(cb)) {
4925 return createWatcher(vm, expOrFn, cb, options)
4926 }
4927 options = options || {};
4928 options.user = true;
4929 var watcher = new Watcher(vm, expOrFn, cb, options);
4930 if (options.immediate) {
4931 try {
4932 cb.call(vm, watcher.value);
4933 } catch (error) {
4934 handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4935 }
4936 }
4937 return function unwatchFn () {
4938 watcher.teardown();
4939 }
4940 };
4941}
4942
4943/* */
4944
4945var uid$3 = 0;
4946
4947function initMixin (Vue) {
4948 Vue.prototype._init = function (options) {
4949 var vm = this;
4950 // a uid
4951 vm._uid = uid$3++;
4952
4953 var startTag, endTag;
4954 /* istanbul ignore if */
4955 if (config.performance && mark) {
4956 startTag = "vue-perf-start:" + (vm._uid);
4957 endTag = "vue-perf-end:" + (vm._uid);
4958 mark(startTag);
4959 }
4960
4961 // a flag to avoid this being observed
4962 vm._isVue = true;
4963 // merge options
4964 if (options && options._isComponent) {
4965 // optimize internal component instantiation
4966 // since dynamic options merging is pretty slow, and none of the
4967 // internal component options needs special treatment.
4968 initInternalComponent(vm, options);
4969 } else {
4970 vm.$options = mergeOptions(
4971 resolveConstructorOptions(vm.constructor),
4972 options || {},
4973 vm
4974 );
4975 }
4976 /* istanbul ignore else */
4977 {
4978 initProxy(vm);
4979 }
4980 // expose real self
4981 vm._self = vm;
4982 initLifecycle(vm);
4983 initEvents(vm);
4984 initRender(vm);
4985 callHook(vm, 'beforeCreate');
4986 initInjections(vm); // resolve injections before data/props
4987 initState(vm);
4988 initProvide(vm); // resolve provide after data/props
4989 callHook(vm, 'created');
4990
4991 /* istanbul ignore if */
4992 if (config.performance && mark) {
4993 vm._name = formatComponentName(vm, false);
4994 mark(endTag);
4995 measure(("vue " + (vm._name) + " init"), startTag, endTag);
4996 }
4997
4998 if (vm.$options.el) {
4999 vm.$mount(vm.$options.el);
5000 }
5001 };
5002}
5003
5004function initInternalComponent (vm, options) {
5005 var opts = vm.$options = Object.create(vm.constructor.options);
5006 // doing this because it's faster than dynamic enumeration.
5007 var parentVnode = options._parentVnode;
5008 opts.parent = options.parent;
5009 opts._parentVnode = parentVnode;
5010
5011 var vnodeComponentOptions = parentVnode.componentOptions;
5012 opts.propsData = vnodeComponentOptions.propsData;
5013 opts._parentListeners = vnodeComponentOptions.listeners;
5014 opts._renderChildren = vnodeComponentOptions.children;
5015 opts._componentTag = vnodeComponentOptions.tag;
5016
5017 if (options.render) {
5018 opts.render = options.render;
5019 opts.staticRenderFns = options.staticRenderFns;
5020 }
5021}
5022
5023function resolveConstructorOptions (Ctor) {
5024 var options = Ctor.options;
5025 if (Ctor.super) {
5026 var superOptions = resolveConstructorOptions(Ctor.super);
5027 var cachedSuperOptions = Ctor.superOptions;
5028 if (superOptions !== cachedSuperOptions) {
5029 // super option changed,
5030 // need to resolve new options.
5031 Ctor.superOptions = superOptions;
5032 // check if there are any late-modified/attached options (#4976)
5033 var modifiedOptions = resolveModifiedOptions(Ctor);
5034 // update base extend options
5035 if (modifiedOptions) {
5036 extend(Ctor.extendOptions, modifiedOptions);
5037 }
5038 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5039 if (options.name) {
5040 options.components[options.name] = Ctor;
5041 }
5042 }
5043 }
5044 return options
5045}
5046
5047function resolveModifiedOptions (Ctor) {
5048 var modified;
5049 var latest = Ctor.options;
5050 var sealed = Ctor.sealedOptions;
5051 for (var key in latest) {
5052 if (latest[key] !== sealed[key]) {
5053 if (!modified) { modified = {}; }
5054 modified[key] = latest[key];
5055 }
5056 }
5057 return modified
5058}
5059
5060function Vue (options) {
5061 if (!(this instanceof Vue)
5062 ) {
5063 warn('Vue is a constructor and should be called with the `new` keyword');
5064 }
5065 this._init(options);
5066}
5067
5068initMixin(Vue);
5069stateMixin(Vue);
5070eventsMixin(Vue);
5071lifecycleMixin(Vue);
5072renderMixin(Vue);
5073
5074/* */
5075
5076function initUse (Vue) {
5077 Vue.use = function (plugin) {
5078 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5079 if (installedPlugins.indexOf(plugin) > -1) {
5080 return this
5081 }
5082
5083 // additional parameters
5084 var args = toArray(arguments, 1);
5085 args.unshift(this);
5086 if (typeof plugin.install === 'function') {
5087 plugin.install.apply(plugin, args);
5088 } else if (typeof plugin === 'function') {
5089 plugin.apply(null, args);
5090 }
5091 installedPlugins.push(plugin);
5092 return this
5093 };
5094}
5095
5096/* */
5097
5098function initMixin$1 (Vue) {
5099 Vue.mixin = function (mixin) {
5100 this.options = mergeOptions(this.options, mixin);
5101 return this
5102 };
5103}
5104
5105/* */
5106
5107function initExtend (Vue) {
5108 /**
5109 * Each instance constructor, including Vue, has a unique
5110 * cid. This enables us to create wrapped "child
5111 * constructors" for prototypal inheritance and cache them.
5112 */
5113 Vue.cid = 0;
5114 var cid = 1;
5115
5116 /**
5117 * Class inheritance
5118 */
5119 Vue.extend = function (extendOptions) {
5120 extendOptions = extendOptions || {};
5121 var Super = this;
5122 var SuperId = Super.cid;
5123 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5124 if (cachedCtors[SuperId]) {
5125 return cachedCtors[SuperId]
5126 }
5127
5128 var name = extendOptions.name || Super.options.name;
5129 if (name) {
5130 validateComponentName(name);
5131 }
5132
5133 var Sub = function VueComponent (options) {
5134 this._init(options);
5135 };
5136 Sub.prototype = Object.create(Super.prototype);
5137 Sub.prototype.constructor = Sub;
5138 Sub.cid = cid++;
5139 Sub.options = mergeOptions(
5140 Super.options,
5141 extendOptions
5142 );
5143 Sub['super'] = Super;
5144
5145 // For props and computed properties, we define the proxy getters on
5146 // the Vue instances at extension time, on the extended prototype. This
5147 // avoids Object.defineProperty calls for each instance created.
5148 if (Sub.options.props) {
5149 initProps$1(Sub);
5150 }
5151 if (Sub.options.computed) {
5152 initComputed$1(Sub);
5153 }
5154
5155 // allow further extension/mixin/plugin usage
5156 Sub.extend = Super.extend;
5157 Sub.mixin = Super.mixin;
5158 Sub.use = Super.use;
5159
5160 // create asset registers, so extended classes
5161 // can have their private assets too.
5162 ASSET_TYPES.forEach(function (type) {
5163 Sub[type] = Super[type];
5164 });
5165 // enable recursive self-lookup
5166 if (name) {
5167 Sub.options.components[name] = Sub;
5168 }
5169
5170 // keep a reference to the super options at extension time.
5171 // later at instantiation we can check if Super's options have
5172 // been updated.
5173 Sub.superOptions = Super.options;
5174 Sub.extendOptions = extendOptions;
5175 Sub.sealedOptions = extend({}, Sub.options);
5176
5177 // cache constructor
5178 cachedCtors[SuperId] = Sub;
5179 return Sub
5180 };
5181}
5182
5183function initProps$1 (Comp) {
5184 var props = Comp.options.props;
5185 for (var key in props) {
5186 proxy(Comp.prototype, "_props", key);
5187 }
5188}
5189
5190function initComputed$1 (Comp) {
5191 var computed = Comp.options.computed;
5192 for (var key in computed) {
5193 defineComputed(Comp.prototype, key, computed[key]);
5194 }
5195}
5196
5197/* */
5198
5199function initAssetRegisters (Vue) {
5200 /**
5201 * Create asset registration methods.
5202 */
5203 ASSET_TYPES.forEach(function (type) {
5204 Vue[type] = function (
5205 id,
5206 definition
5207 ) {
5208 if (!definition) {
5209 return this.options[type + 's'][id]
5210 } else {
5211 /* istanbul ignore if */
5212 if (type === 'component') {
5213 validateComponentName(id);
5214 }
5215 if (type === 'component' && isPlainObject(definition)) {
5216 definition.name = definition.name || id;
5217 definition = this.options._base.extend(definition);
5218 }
5219 if (type === 'directive' && typeof definition === 'function') {
5220 definition = { bind: definition, update: definition };
5221 }
5222 this.options[type + 's'][id] = definition;
5223 return definition
5224 }
5225 };
5226 });
5227}
5228
5229/* */
5230
5231
5232
5233function getComponentName (opts) {
5234 return opts && (opts.Ctor.options.name || opts.tag)
5235}
5236
5237function matches (pattern, name) {
5238 if (Array.isArray(pattern)) {
5239 return pattern.indexOf(name) > -1
5240 } else if (typeof pattern === 'string') {
5241 return pattern.split(',').indexOf(name) > -1
5242 } else if (isRegExp(pattern)) {
5243 return pattern.test(name)
5244 }
5245 /* istanbul ignore next */
5246 return false
5247}
5248
5249function pruneCache (keepAliveInstance, filter) {
5250 var cache = keepAliveInstance.cache;
5251 var keys = keepAliveInstance.keys;
5252 var _vnode = keepAliveInstance._vnode;
5253 for (var key in cache) {
5254 var cachedNode = cache[key];
5255 if (cachedNode) {
5256 var name = getComponentName(cachedNode.componentOptions);
5257 if (name && !filter(name)) {
5258 pruneCacheEntry(cache, key, keys, _vnode);
5259 }
5260 }
5261 }
5262}
5263
5264function pruneCacheEntry (
5265 cache,
5266 key,
5267 keys,
5268 current
5269) {
5270 var cached$$1 = cache[key];
5271 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5272 cached$$1.componentInstance.$destroy();
5273 }
5274 cache[key] = null;
5275 remove(keys, key);
5276}
5277
5278var patternTypes = [String, RegExp, Array];
5279
5280var KeepAlive = {
5281 name: 'keep-alive',
5282 abstract: true,
5283
5284 props: {
5285 include: patternTypes,
5286 exclude: patternTypes,
5287 max: [String, Number]
5288 },
5289
5290 created: function created () {
5291 this.cache = Object.create(null);
5292 this.keys = [];
5293 },
5294
5295 destroyed: function destroyed () {
5296 for (var key in this.cache) {
5297 pruneCacheEntry(this.cache, key, this.keys);
5298 }
5299 },
5300
5301 mounted: function mounted () {
5302 var this$1 = this;
5303
5304 this.$watch('include', function (val) {
5305 pruneCache(this$1, function (name) { return matches(val, name); });
5306 });
5307 this.$watch('exclude', function (val) {
5308 pruneCache(this$1, function (name) { return !matches(val, name); });
5309 });
5310 },
5311
5312 render: function render () {
5313 var slot = this.$slots.default;
5314 var vnode = getFirstComponentChild(slot);
5315 var componentOptions = vnode && vnode.componentOptions;
5316 if (componentOptions) {
5317 // check pattern
5318 var name = getComponentName(componentOptions);
5319 var ref = this;
5320 var include = ref.include;
5321 var exclude = ref.exclude;
5322 if (
5323 // not included
5324 (include && (!name || !matches(include, name))) ||
5325 // excluded
5326 (exclude && name && matches(exclude, name))
5327 ) {
5328 return vnode
5329 }
5330
5331 var ref$1 = this;
5332 var cache = ref$1.cache;
5333 var keys = ref$1.keys;
5334 var key = vnode.key == null
5335 // same constructor may get registered as different local components
5336 // so cid alone is not enough (#3269)
5337 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5338 : vnode.key;
5339 if (cache[key]) {
5340 vnode.componentInstance = cache[key].componentInstance;
5341 // make current key freshest
5342 remove(keys, key);
5343 keys.push(key);
5344 } else {
5345 cache[key] = vnode;
5346 keys.push(key);
5347 // prune oldest entry
5348 if (this.max && keys.length > parseInt(this.max)) {
5349 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5350 }
5351 }
5352
5353 vnode.data.keepAlive = true;
5354 }
5355 return vnode || (slot && slot[0])
5356 }
5357};
5358
5359var builtInComponents = {
5360 KeepAlive: KeepAlive
5361};
5362
5363/* */
5364
5365function initGlobalAPI (Vue) {
5366 // config
5367 var configDef = {};
5368 configDef.get = function () { return config; };
5369 {
5370 configDef.set = function () {
5371 warn(
5372 'Do not replace the Vue.config object, set individual fields instead.'
5373 );
5374 };
5375 }
5376 Object.defineProperty(Vue, 'config', configDef);
5377
5378 // exposed util methods.
5379 // NOTE: these are not considered part of the public API - avoid relying on
5380 // them unless you are aware of the risk.
5381 Vue.util = {
5382 warn: warn,
5383 extend: extend,
5384 mergeOptions: mergeOptions,
5385 defineReactive: defineReactive$$1
5386 };
5387
5388 Vue.set = set;
5389 Vue.delete = del;
5390 Vue.nextTick = nextTick;
5391
5392 // 2.6 explicit observable API
5393 Vue.observable = function (obj) {
5394 observe(obj);
5395 return obj
5396 };
5397
5398 Vue.options = Object.create(null);
5399 ASSET_TYPES.forEach(function (type) {
5400 Vue.options[type + 's'] = Object.create(null);
5401 });
5402
5403 // this is used to identify the "base" constructor to extend all plain-object
5404 // components with in Weex's multi-instance scenarios.
5405 Vue.options._base = Vue;
5406
5407 extend(Vue.options.components, builtInComponents);
5408
5409 initUse(Vue);
5410 initMixin$1(Vue);
5411 initExtend(Vue);
5412 initAssetRegisters(Vue);
5413}
5414
5415initGlobalAPI(Vue);
5416
5417Object.defineProperty(Vue.prototype, '$isServer', {
5418 get: isServerRendering
5419});
5420
5421Object.defineProperty(Vue.prototype, '$ssrContext', {
5422 get: function get () {
5423 /* istanbul ignore next */
5424 return this.$vnode && this.$vnode.ssrContext
5425 }
5426});
5427
5428// expose FunctionalRenderContext for ssr runtime helper installation
5429Object.defineProperty(Vue, 'FunctionalRenderContext', {
5430 value: FunctionalRenderContext
5431});
5432
5433Vue.version = '2.6.12';
5434
5435/* */
5436
5437// these are reserved for web because they are directly compiled away
5438// during template compilation
5439var isReservedAttr = makeMap('style,class');
5440
5441// attributes that should be using props for binding
5442var acceptValue = makeMap('input,textarea,option,select,progress');
5443var mustUseProp = function (tag, type, attr) {
5444 return (
5445 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5446 (attr === 'selected' && tag === 'option') ||
5447 (attr === 'checked' && tag === 'input') ||
5448 (attr === 'muted' && tag === 'video')
5449 )
5450};
5451
5452var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5453
5454var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5455
5456var convertEnumeratedValue = function (key, value) {
5457 return isFalsyAttrValue(value) || value === 'false'
5458 ? 'false'
5459 // allow arbitrary string value for contenteditable
5460 : key === 'contenteditable' && isValidContentEditableValue(value)
5461 ? value
5462 : 'true'
5463};
5464
5465var isBooleanAttr = makeMap(
5466 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5467 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5468 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5469 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5470 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5471 'truespeed,typemustmatch,visible'
5472);
5473
5474var xlinkNS = 'http://www.w3.org/1999/xlink';
5475
5476var isXlink = function (name) {
5477 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5478};
5479
5480var getXlinkProp = function (name) {
5481 return isXlink(name) ? name.slice(6, name.length) : ''
5482};
5483
5484var isFalsyAttrValue = function (val) {
5485 return val == null || val === false
5486};
5487
5488/* */
5489
5490function genClassForVnode (vnode) {
5491 var data = vnode.data;
5492 var parentNode = vnode;
5493 var childNode = vnode;
5494 while (isDef(childNode.componentInstance)) {
5495 childNode = childNode.componentInstance._vnode;
5496 if (childNode && childNode.data) {
5497 data = mergeClassData(childNode.data, data);
5498 }
5499 }
5500 while (isDef(parentNode = parentNode.parent)) {
5501 if (parentNode && parentNode.data) {
5502 data = mergeClassData(data, parentNode.data);
5503 }
5504 }
5505 return renderClass(data.staticClass, data.class)
5506}
5507
5508function mergeClassData (child, parent) {
5509 return {
5510 staticClass: concat(child.staticClass, parent.staticClass),
5511 class: isDef(child.class)
5512 ? [child.class, parent.class]
5513 : parent.class
5514 }
5515}
5516
5517function renderClass (
5518 staticClass,
5519 dynamicClass
5520) {
5521 if (isDef(staticClass) || isDef(dynamicClass)) {
5522 return concat(staticClass, stringifyClass(dynamicClass))
5523 }
5524 /* istanbul ignore next */
5525 return ''
5526}
5527
5528function concat (a, b) {
5529 return a ? b ? (a + ' ' + b) : a : (b || '')
5530}
5531
5532function stringifyClass (value) {
5533 if (Array.isArray(value)) {
5534 return stringifyArray(value)
5535 }
5536 if (isObject(value)) {
5537 return stringifyObject(value)
5538 }
5539 if (typeof value === 'string') {
5540 return value
5541 }
5542 /* istanbul ignore next */
5543 return ''
5544}
5545
5546function stringifyArray (value) {
5547 var res = '';
5548 var stringified;
5549 for (var i = 0, l = value.length; i < l; i++) {
5550 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5551 if (res) { res += ' '; }
5552 res += stringified;
5553 }
5554 }
5555 return res
5556}
5557
5558function stringifyObject (value) {
5559 var res = '';
5560 for (var key in value) {
5561 if (value[key]) {
5562 if (res) { res += ' '; }
5563 res += key;
5564 }
5565 }
5566 return res
5567}
5568
5569/* */
5570
5571var namespaceMap = {
5572 svg: 'http://www.w3.org/2000/svg',
5573 math: 'http://www.w3.org/1998/Math/MathML'
5574};
5575
5576var isHTMLTag = makeMap(
5577 'html,body,base,head,link,meta,style,title,' +
5578 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5579 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5580 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5581 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5582 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5583 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5584 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5585 'output,progress,select,textarea,' +
5586 'details,dialog,menu,menuitem,summary,' +
5587 'content,element,shadow,template,blockquote,iframe,tfoot'
5588);
5589
5590// this map is intentionally selective, only covering SVG elements that may
5591// contain child elements.
5592var isSVG = makeMap(
5593 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5594 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5595 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5596 true
5597);
5598
5599var isReservedTag = function (tag) {
5600 return isHTMLTag(tag) || isSVG(tag)
5601};
5602
5603function getTagNamespace (tag) {
5604 if (isSVG(tag)) {
5605 return 'svg'
5606 }
5607 // basic support for MathML
5608 // note it doesn't support other MathML elements being component roots
5609 if (tag === 'math') {
5610 return 'math'
5611 }
5612}
5613
5614var unknownElementCache = Object.create(null);
5615function isUnknownElement (tag) {
5616 /* istanbul ignore if */
5617 if (!inBrowser) {
5618 return true
5619 }
5620 if (isReservedTag(tag)) {
5621 return false
5622 }
5623 tag = tag.toLowerCase();
5624 /* istanbul ignore if */
5625 if (unknownElementCache[tag] != null) {
5626 return unknownElementCache[tag]
5627 }
5628 var el = document.createElement(tag);
5629 if (tag.indexOf('-') > -1) {
5630 // http://stackoverflow.com/a/28210364/1070244
5631 return (unknownElementCache[tag] = (
5632 el.constructor === window.HTMLUnknownElement ||
5633 el.constructor === window.HTMLElement
5634 ))
5635 } else {
5636 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5637 }
5638}
5639
5640var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5641
5642/* */
5643
5644/**
5645 * Query an element selector if it's not an element already.
5646 */
5647function query (el) {
5648 if (typeof el === 'string') {
5649 var selected = document.querySelector(el);
5650 if (!selected) {
5651 warn(
5652 'Cannot find element: ' + el
5653 );
5654 return document.createElement('div')
5655 }
5656 return selected
5657 } else {
5658 return el
5659 }
5660}
5661
5662/* */
5663
5664function createElement$1 (tagName, vnode) {
5665 var elm = document.createElement(tagName);
5666 if (tagName !== 'select') {
5667 return elm
5668 }
5669 // false or null will remove the attribute but undefined will not
5670 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5671 elm.setAttribute('multiple', 'multiple');
5672 }
5673 return elm
5674}
5675
5676function createElementNS (namespace, tagName) {
5677 return document.createElementNS(namespaceMap[namespace], tagName)
5678}
5679
5680function createTextNode (text) {
5681 return document.createTextNode(text)
5682}
5683
5684function createComment (text) {
5685 return document.createComment(text)
5686}
5687
5688function insertBefore (parentNode, newNode, referenceNode) {
5689 parentNode.insertBefore(newNode, referenceNode);
5690}
5691
5692function removeChild (node, child) {
5693 node.removeChild(child);
5694}
5695
5696function appendChild (node, child) {
5697 node.appendChild(child);
5698}
5699
5700function parentNode (node) {
5701 return node.parentNode
5702}
5703
5704function nextSibling (node) {
5705 return node.nextSibling
5706}
5707
5708function tagName (node) {
5709 return node.tagName
5710}
5711
5712function setTextContent (node, text) {
5713 node.textContent = text;
5714}
5715
5716function setStyleScope (node, scopeId) {
5717 node.setAttribute(scopeId, '');
5718}
5719
5720var nodeOps = /*#__PURE__*/Object.freeze({
5721 createElement: createElement$1,
5722 createElementNS: createElementNS,
5723 createTextNode: createTextNode,
5724 createComment: createComment,
5725 insertBefore: insertBefore,
5726 removeChild: removeChild,
5727 appendChild: appendChild,
5728 parentNode: parentNode,
5729 nextSibling: nextSibling,
5730 tagName: tagName,
5731 setTextContent: setTextContent,
5732 setStyleScope: setStyleScope
5733});
5734
5735/* */
5736
5737var ref = {
5738 create: function create (_, vnode) {
5739 registerRef(vnode);
5740 },
5741 update: function update (oldVnode, vnode) {
5742 if (oldVnode.data.ref !== vnode.data.ref) {
5743 registerRef(oldVnode, true);
5744 registerRef(vnode);
5745 }
5746 },
5747 destroy: function destroy (vnode) {
5748 registerRef(vnode, true);
5749 }
5750};
5751
5752function registerRef (vnode, isRemoval) {
5753 var key = vnode.data.ref;
5754 if (!isDef(key)) { return }
5755
5756 var vm = vnode.context;
5757 var ref = vnode.componentInstance || vnode.elm;
5758 var refs = vm.$refs;
5759 if (isRemoval) {
5760 if (Array.isArray(refs[key])) {
5761 remove(refs[key], ref);
5762 } else if (refs[key] === ref) {
5763 refs[key] = undefined;
5764 }
5765 } else {
5766 if (vnode.data.refInFor) {
5767 if (!Array.isArray(refs[key])) {
5768 refs[key] = [ref];
5769 } else if (refs[key].indexOf(ref) < 0) {
5770 // $flow-disable-line
5771 refs[key].push(ref);
5772 }
5773 } else {
5774 refs[key] = ref;
5775 }
5776 }
5777}
5778
5779/**
5780 * Virtual DOM patching algorithm based on Snabbdom by
5781 * Simon Friis Vindum (@paldepind)
5782 * Licensed under the MIT License
5783 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5784 *
5785 * modified by Evan You (@yyx990803)
5786 *
5787 * Not type-checking this because this file is perf-critical and the cost
5788 * of making flow understand it is not worth it.
5789 */
5790
5791var emptyNode = new VNode('', {}, []);
5792
5793var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5794
5795function sameVnode (a, b) {
5796 return (
5797 a.key === b.key && (
5798 (
5799 a.tag === b.tag &&
5800 a.isComment === b.isComment &&
5801 isDef(a.data) === isDef(b.data) &&
5802 sameInputType(a, b)
5803 ) || (
5804 isTrue(a.isAsyncPlaceholder) &&
5805 a.asyncFactory === b.asyncFactory &&
5806 isUndef(b.asyncFactory.error)
5807 )
5808 )
5809 )
5810}
5811
5812function sameInputType (a, b) {
5813 if (a.tag !== 'input') { return true }
5814 var i;
5815 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5816 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5817 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5818}
5819
5820function createKeyToOldIdx (children, beginIdx, endIdx) {
5821 var i, key;
5822 var map = {};
5823 for (i = beginIdx; i <= endIdx; ++i) {
5824 key = children[i].key;
5825 if (isDef(key)) { map[key] = i; }
5826 }
5827 return map
5828}
5829
5830function createPatchFunction (backend) {
5831 var i, j;
5832 var cbs = {};
5833
5834 var modules = backend.modules;
5835 var nodeOps = backend.nodeOps;
5836
5837 for (i = 0; i < hooks.length; ++i) {
5838 cbs[hooks[i]] = [];
5839 for (j = 0; j < modules.length; ++j) {
5840 if (isDef(modules[j][hooks[i]])) {
5841 cbs[hooks[i]].push(modules[j][hooks[i]]);
5842 }
5843 }
5844 }
5845
5846 function emptyNodeAt (elm) {
5847 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5848 }
5849
5850 function createRmCb (childElm, listeners) {
5851 function remove$$1 () {
5852 if (--remove$$1.listeners === 0) {
5853 removeNode(childElm);
5854 }
5855 }
5856 remove$$1.listeners = listeners;
5857 return remove$$1
5858 }
5859
5860 function removeNode (el) {
5861 var parent = nodeOps.parentNode(el);
5862 // element may have already been removed due to v-html / v-text
5863 if (isDef(parent)) {
5864 nodeOps.removeChild(parent, el);
5865 }
5866 }
5867
5868 function isUnknownElement$$1 (vnode, inVPre) {
5869 return (
5870 !inVPre &&
5871 !vnode.ns &&
5872 !(
5873 config.ignoredElements.length &&
5874 config.ignoredElements.some(function (ignore) {
5875 return isRegExp(ignore)
5876 ? ignore.test(vnode.tag)
5877 : ignore === vnode.tag
5878 })
5879 ) &&
5880 config.isUnknownElement(vnode.tag)
5881 )
5882 }
5883
5884 var creatingElmInVPre = 0;
5885
5886 function createElm (
5887 vnode,
5888 insertedVnodeQueue,
5889 parentElm,
5890 refElm,
5891 nested,
5892 ownerArray,
5893 index
5894 ) {
5895 if (isDef(vnode.elm) && isDef(ownerArray)) {
5896 // This vnode was used in a previous render!
5897 // now it's used as a new node, overwriting its elm would cause
5898 // potential patch errors down the road when it's used as an insertion
5899 // reference node. Instead, we clone the node on-demand before creating
5900 // associated DOM element for it.
5901 vnode = ownerArray[index] = cloneVNode(vnode);
5902 }
5903
5904 vnode.isRootInsert = !nested; // for transition enter check
5905 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5906 return
5907 }
5908
5909 var data = vnode.data;
5910 var children = vnode.children;
5911 var tag = vnode.tag;
5912 if (isDef(tag)) {
5913 {
5914 if (data && data.pre) {
5915 creatingElmInVPre++;
5916 }
5917 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5918 warn(
5919 'Unknown custom element: <' + tag + '> - did you ' +
5920 'register the component correctly? For recursive components, ' +
5921 'make sure to provide the "name" option.',
5922 vnode.context
5923 );
5924 }
5925 }
5926
5927 vnode.elm = vnode.ns
5928 ? nodeOps.createElementNS(vnode.ns, tag)
5929 : nodeOps.createElement(tag, vnode);
5930 setScope(vnode);
5931
5932 /* istanbul ignore if */
5933 {
5934 createChildren(vnode, children, insertedVnodeQueue);
5935 if (isDef(data)) {
5936 invokeCreateHooks(vnode, insertedVnodeQueue);
5937 }
5938 insert(parentElm, vnode.elm, refElm);
5939 }
5940
5941 if (data && data.pre) {
5942 creatingElmInVPre--;
5943 }
5944 } else if (isTrue(vnode.isComment)) {
5945 vnode.elm = nodeOps.createComment(vnode.text);
5946 insert(parentElm, vnode.elm, refElm);
5947 } else {
5948 vnode.elm = nodeOps.createTextNode(vnode.text);
5949 insert(parentElm, vnode.elm, refElm);
5950 }
5951 }
5952
5953 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5954 var i = vnode.data;
5955 if (isDef(i)) {
5956 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5957 if (isDef(i = i.hook) && isDef(i = i.init)) {
5958 i(vnode, false /* hydrating */);
5959 }
5960 // after calling the init hook, if the vnode is a child component
5961 // it should've created a child instance and mounted it. the child
5962 // component also has set the placeholder vnode's elm.
5963 // in that case we can just return the element and be done.
5964 if (isDef(vnode.componentInstance)) {
5965 initComponent(vnode, insertedVnodeQueue);
5966 insert(parentElm, vnode.elm, refElm);
5967 if (isTrue(isReactivated)) {
5968 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5969 }
5970 return true
5971 }
5972 }
5973 }
5974
5975 function initComponent (vnode, insertedVnodeQueue) {
5976 if (isDef(vnode.data.pendingInsert)) {
5977 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5978 vnode.data.pendingInsert = null;
5979 }
5980 vnode.elm = vnode.componentInstance.$el;
5981 if (isPatchable(vnode)) {
5982 invokeCreateHooks(vnode, insertedVnodeQueue);
5983 setScope(vnode);
5984 } else {
5985 // empty component root.
5986 // skip all element-related modules except for ref (#3455)
5987 registerRef(vnode);
5988 // make sure to invoke the insert hook
5989 insertedVnodeQueue.push(vnode);
5990 }
5991 }
5992
5993 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5994 var i;
5995 // hack for #4339: a reactivated component with inner transition
5996 // does not trigger because the inner node's created hooks are not called
5997 // again. It's not ideal to involve module-specific logic in here but
5998 // there doesn't seem to be a better way to do it.
5999 var innerNode = vnode;
6000 while (innerNode.componentInstance) {
6001 innerNode = innerNode.componentInstance._vnode;
6002 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6003 for (i = 0; i < cbs.activate.length; ++i) {
6004 cbs.activate[i](emptyNode, innerNode);
6005 }
6006 insertedVnodeQueue.push(innerNode);
6007 break
6008 }
6009 }
6010 // unlike a newly created component,
6011 // a reactivated keep-alive component doesn't insert itself
6012 insert(parentElm, vnode.elm, refElm);
6013 }
6014
6015 function insert (parent, elm, ref$$1) {
6016 if (isDef(parent)) {
6017 if (isDef(ref$$1)) {
6018 if (nodeOps.parentNode(ref$$1) === parent) {
6019 nodeOps.insertBefore(parent, elm, ref$$1);
6020 }
6021 } else {
6022 nodeOps.appendChild(parent, elm);
6023 }
6024 }
6025 }
6026
6027 function createChildren (vnode, children, insertedVnodeQueue) {
6028 if (Array.isArray(children)) {
6029 {
6030 checkDuplicateKeys(children);
6031 }
6032 for (var i = 0; i < children.length; ++i) {
6033 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6034 }
6035 } else if (isPrimitive(vnode.text)) {
6036 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6037 }
6038 }
6039
6040 function isPatchable (vnode) {
6041 while (vnode.componentInstance) {
6042 vnode = vnode.componentInstance._vnode;
6043 }
6044 return isDef(vnode.tag)
6045 }
6046
6047 function invokeCreateHooks (vnode, insertedVnodeQueue) {
6048 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6049 cbs.create[i$1](emptyNode, vnode);
6050 }
6051 i = vnode.data.hook; // Reuse variable
6052 if (isDef(i)) {
6053 if (isDef(i.create)) { i.create(emptyNode, vnode); }
6054 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6055 }
6056 }
6057
6058 // set scope id attribute for scoped CSS.
6059 // this is implemented as a special case to avoid the overhead
6060 // of going through the normal attribute patching process.
6061 function setScope (vnode) {
6062 var i;
6063 if (isDef(i = vnode.fnScopeId)) {
6064 nodeOps.setStyleScope(vnode.elm, i);
6065 } else {
6066 var ancestor = vnode;
6067 while (ancestor) {
6068 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6069 nodeOps.setStyleScope(vnode.elm, i);
6070 }
6071 ancestor = ancestor.parent;
6072 }
6073 }
6074 // for slot content they should also get the scopeId from the host instance.
6075 if (isDef(i = activeInstance) &&
6076 i !== vnode.context &&
6077 i !== vnode.fnContext &&
6078 isDef(i = i.$options._scopeId)
6079 ) {
6080 nodeOps.setStyleScope(vnode.elm, i);
6081 }
6082 }
6083
6084 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6085 for (; startIdx <= endIdx; ++startIdx) {
6086 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6087 }
6088 }
6089
6090 function invokeDestroyHook (vnode) {
6091 var i, j;
6092 var data = vnode.data;
6093 if (isDef(data)) {
6094 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6095 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6096 }
6097 if (isDef(i = vnode.children)) {
6098 for (j = 0; j < vnode.children.length; ++j) {
6099 invokeDestroyHook(vnode.children[j]);
6100 }
6101 }
6102 }
6103
6104 function removeVnodes (vnodes, startIdx, endIdx) {
6105 for (; startIdx <= endIdx; ++startIdx) {
6106 var ch = vnodes[startIdx];
6107 if (isDef(ch)) {
6108 if (isDef(ch.tag)) {
6109 removeAndInvokeRemoveHook(ch);
6110 invokeDestroyHook(ch);
6111 } else { // Text node
6112 removeNode(ch.elm);
6113 }
6114 }
6115 }
6116 }
6117
6118 function removeAndInvokeRemoveHook (vnode, rm) {
6119 if (isDef(rm) || isDef(vnode.data)) {
6120 var i;
6121 var listeners = cbs.remove.length + 1;
6122 if (isDef(rm)) {
6123 // we have a recursively passed down rm callback
6124 // increase the listeners count
6125 rm.listeners += listeners;
6126 } else {
6127 // directly removing
6128 rm = createRmCb(vnode.elm, listeners);
6129 }
6130 // recursively invoke hooks on child component root node
6131 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6132 removeAndInvokeRemoveHook(i, rm);
6133 }
6134 for (i = 0; i < cbs.remove.length; ++i) {
6135 cbs.remove[i](vnode, rm);
6136 }
6137 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6138 i(vnode, rm);
6139 } else {
6140 rm();
6141 }
6142 } else {
6143 removeNode(vnode.elm);
6144 }
6145 }
6146
6147 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6148 var oldStartIdx = 0;
6149 var newStartIdx = 0;
6150 var oldEndIdx = oldCh.length - 1;
6151 var oldStartVnode = oldCh[0];
6152 var oldEndVnode = oldCh[oldEndIdx];
6153 var newEndIdx = newCh.length - 1;
6154 var newStartVnode = newCh[0];
6155 var newEndVnode = newCh[newEndIdx];
6156 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6157
6158 // removeOnly is a special flag used only by <transition-group>
6159 // to ensure removed elements stay in correct relative positions
6160 // during leaving transitions
6161 var canMove = !removeOnly;
6162
6163 {
6164 checkDuplicateKeys(newCh);
6165 }
6166
6167 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6168 if (isUndef(oldStartVnode)) {
6169 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6170 } else if (isUndef(oldEndVnode)) {
6171 oldEndVnode = oldCh[--oldEndIdx];
6172 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6173 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6174 oldStartVnode = oldCh[++oldStartIdx];
6175 newStartVnode = newCh[++newStartIdx];
6176 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6177 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6178 oldEndVnode = oldCh[--oldEndIdx];
6179 newEndVnode = newCh[--newEndIdx];
6180 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6181 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6182 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6183 oldStartVnode = oldCh[++oldStartIdx];
6184 newEndVnode = newCh[--newEndIdx];
6185 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6186 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6187 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6188 oldEndVnode = oldCh[--oldEndIdx];
6189 newStartVnode = newCh[++newStartIdx];
6190 } else {
6191 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6192 idxInOld = isDef(newStartVnode.key)
6193 ? oldKeyToIdx[newStartVnode.key]
6194 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6195 if (isUndef(idxInOld)) { // New element
6196 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6197 } else {
6198 vnodeToMove = oldCh[idxInOld];
6199 if (sameVnode(vnodeToMove, newStartVnode)) {
6200 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6201 oldCh[idxInOld] = undefined;
6202 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6203 } else {
6204 // same key but different element. treat as new element
6205 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6206 }
6207 }
6208 newStartVnode = newCh[++newStartIdx];
6209 }
6210 }
6211 if (oldStartIdx > oldEndIdx) {
6212 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6213 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6214 } else if (newStartIdx > newEndIdx) {
6215 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6216 }
6217 }
6218
6219 function checkDuplicateKeys (children) {
6220 var seenKeys = {};
6221 for (var i = 0; i < children.length; i++) {
6222 var vnode = children[i];
6223 var key = vnode.key;
6224 if (isDef(key)) {
6225 if (seenKeys[key]) {
6226 warn(
6227 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6228 vnode.context
6229 );
6230 } else {
6231 seenKeys[key] = true;
6232 }
6233 }
6234 }
6235 }
6236
6237 function findIdxInOld (node, oldCh, start, end) {
6238 for (var i = start; i < end; i++) {
6239 var c = oldCh[i];
6240 if (isDef(c) && sameVnode(node, c)) { return i }
6241 }
6242 }
6243
6244 function patchVnode (
6245 oldVnode,
6246 vnode,
6247 insertedVnodeQueue,
6248 ownerArray,
6249 index,
6250 removeOnly
6251 ) {
6252 if (oldVnode === vnode) {
6253 return
6254 }
6255
6256 if (isDef(vnode.elm) && isDef(ownerArray)) {
6257 // clone reused vnode
6258 vnode = ownerArray[index] = cloneVNode(vnode);
6259 }
6260
6261 var elm = vnode.elm = oldVnode.elm;
6262
6263 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6264 if (isDef(vnode.asyncFactory.resolved)) {
6265 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6266 } else {
6267 vnode.isAsyncPlaceholder = true;
6268 }
6269 return
6270 }
6271
6272 // reuse element for static trees.
6273 // note we only do this if the vnode is cloned -
6274 // if the new node is not cloned it means the render functions have been
6275 // reset by the hot-reload-api and we need to do a proper re-render.
6276 if (isTrue(vnode.isStatic) &&
6277 isTrue(oldVnode.isStatic) &&
6278 vnode.key === oldVnode.key &&
6279 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6280 ) {
6281 vnode.componentInstance = oldVnode.componentInstance;
6282 return
6283 }
6284
6285 var i;
6286 var data = vnode.data;
6287 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6288 i(oldVnode, vnode);
6289 }
6290
6291 var oldCh = oldVnode.children;
6292 var ch = vnode.children;
6293 if (isDef(data) && isPatchable(vnode)) {
6294 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6295 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6296 }
6297 if (isUndef(vnode.text)) {
6298 if (isDef(oldCh) && isDef(ch)) {
6299 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6300 } else if (isDef(ch)) {
6301 {
6302 checkDuplicateKeys(ch);
6303 }
6304 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6305 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6306 } else if (isDef(oldCh)) {
6307 removeVnodes(oldCh, 0, oldCh.length - 1);
6308 } else if (isDef(oldVnode.text)) {
6309 nodeOps.setTextContent(elm, '');
6310 }
6311 } else if (oldVnode.text !== vnode.text) {
6312 nodeOps.setTextContent(elm, vnode.text);
6313 }
6314 if (isDef(data)) {
6315 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6316 }
6317 }
6318
6319 function invokeInsertHook (vnode, queue, initial) {
6320 // delay insert hooks for component root nodes, invoke them after the
6321 // element is really inserted
6322 if (isTrue(initial) && isDef(vnode.parent)) {
6323 vnode.parent.data.pendingInsert = queue;
6324 } else {
6325 for (var i = 0; i < queue.length; ++i) {
6326 queue[i].data.hook.insert(queue[i]);
6327 }
6328 }
6329 }
6330
6331 var hydrationBailed = false;
6332 // list of modules that can skip create hook during hydration because they
6333 // are already rendered on the client or has no need for initialization
6334 // Note: style is excluded because it relies on initial clone for future
6335 // deep updates (#7063).
6336 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6337
6338 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6339 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6340 var i;
6341 var tag = vnode.tag;
6342 var data = vnode.data;
6343 var children = vnode.children;
6344 inVPre = inVPre || (data && data.pre);
6345 vnode.elm = elm;
6346
6347 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6348 vnode.isAsyncPlaceholder = true;
6349 return true
6350 }
6351 // assert node match
6352 {
6353 if (!assertNodeMatch(elm, vnode, inVPre)) {
6354 return false
6355 }
6356 }
6357 if (isDef(data)) {
6358 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6359 if (isDef(i = vnode.componentInstance)) {
6360 // child component. it should have hydrated its own tree.
6361 initComponent(vnode, insertedVnodeQueue);
6362 return true
6363 }
6364 }
6365 if (isDef(tag)) {
6366 if (isDef(children)) {
6367 // empty element, allow client to pick up and populate children
6368 if (!elm.hasChildNodes()) {
6369 createChildren(vnode, children, insertedVnodeQueue);
6370 } else {
6371 // v-html and domProps: innerHTML
6372 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6373 if (i !== elm.innerHTML) {
6374 /* istanbul ignore if */
6375 if (typeof console !== 'undefined' &&
6376 !hydrationBailed
6377 ) {
6378 hydrationBailed = true;
6379 console.warn('Parent: ', elm);
6380 console.warn('server innerHTML: ', i);
6381 console.warn('client innerHTML: ', elm.innerHTML);
6382 }
6383 return false
6384 }
6385 } else {
6386 // iterate and compare children lists
6387 var childrenMatch = true;
6388 var childNode = elm.firstChild;
6389 for (var i$1 = 0; i$1 < children.length; i$1++) {
6390 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6391 childrenMatch = false;
6392 break
6393 }
6394 childNode = childNode.nextSibling;
6395 }
6396 // if childNode is not null, it means the actual childNodes list is
6397 // longer than the virtual children list.
6398 if (!childrenMatch || childNode) {
6399 /* istanbul ignore if */
6400 if (typeof console !== 'undefined' &&
6401 !hydrationBailed
6402 ) {
6403 hydrationBailed = true;
6404 console.warn('Parent: ', elm);
6405 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6406 }
6407 return false
6408 }
6409 }
6410 }
6411 }
6412 if (isDef(data)) {
6413 var fullInvoke = false;
6414 for (var key in data) {
6415 if (!isRenderedModule(key)) {
6416 fullInvoke = true;
6417 invokeCreateHooks(vnode, insertedVnodeQueue);
6418 break
6419 }
6420 }
6421 if (!fullInvoke && data['class']) {
6422 // ensure collecting deps for deep class bindings for future updates
6423 traverse(data['class']);
6424 }
6425 }
6426 } else if (elm.data !== vnode.text) {
6427 elm.data = vnode.text;
6428 }
6429 return true
6430 }
6431
6432 function assertNodeMatch (node, vnode, inVPre) {
6433 if (isDef(vnode.tag)) {
6434 return vnode.tag.indexOf('vue-component') === 0 || (
6435 !isUnknownElement$$1(vnode, inVPre) &&
6436 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6437 )
6438 } else {
6439 return node.nodeType === (vnode.isComment ? 8 : 3)
6440 }
6441 }
6442
6443 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6444 if (isUndef(vnode)) {
6445 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6446 return
6447 }
6448
6449 var isInitialPatch = false;
6450 var insertedVnodeQueue = [];
6451
6452 if (isUndef(oldVnode)) {
6453 // empty mount (likely as component), create new root element
6454 isInitialPatch = true;
6455 createElm(vnode, insertedVnodeQueue);
6456 } else {
6457 var isRealElement = isDef(oldVnode.nodeType);
6458 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6459 // patch existing root node
6460 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6461 } else {
6462 if (isRealElement) {
6463 // mounting to a real element
6464 // check if this is server-rendered content and if we can perform
6465 // a successful hydration.
6466 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6467 oldVnode.removeAttribute(SSR_ATTR);
6468 hydrating = true;
6469 }
6470 if (isTrue(hydrating)) {
6471 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6472 invokeInsertHook(vnode, insertedVnodeQueue, true);
6473 return oldVnode
6474 } else {
6475 warn(
6476 'The client-side rendered virtual DOM tree is not matching ' +
6477 'server-rendered content. This is likely caused by incorrect ' +
6478 'HTML markup, for example nesting block-level elements inside ' +
6479 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6480 'full client-side render.'
6481 );
6482 }
6483 }
6484 // either not server-rendered, or hydration failed.
6485 // create an empty node and replace it
6486 oldVnode = emptyNodeAt(oldVnode);
6487 }
6488
6489 // replacing existing element
6490 var oldElm = oldVnode.elm;
6491 var parentElm = nodeOps.parentNode(oldElm);
6492
6493 // create new node
6494 createElm(
6495 vnode,
6496 insertedVnodeQueue,
6497 // extremely rare edge case: do not insert if old element is in a
6498 // leaving transition. Only happens when combining transition +
6499 // keep-alive + HOCs. (#4590)
6500 oldElm._leaveCb ? null : parentElm,
6501 nodeOps.nextSibling(oldElm)
6502 );
6503
6504 // update parent placeholder node element, recursively
6505 if (isDef(vnode.parent)) {
6506 var ancestor = vnode.parent;
6507 var patchable = isPatchable(vnode);
6508 while (ancestor) {
6509 for (var i = 0; i < cbs.destroy.length; ++i) {
6510 cbs.destroy[i](ancestor);
6511 }
6512 ancestor.elm = vnode.elm;
6513 if (patchable) {
6514 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6515 cbs.create[i$1](emptyNode, ancestor);
6516 }
6517 // #6513
6518 // invoke insert hooks that may have been merged by create hooks.
6519 // e.g. for directives that uses the "inserted" hook.
6520 var insert = ancestor.data.hook.insert;
6521 if (insert.merged) {
6522 // start at index 1 to avoid re-invoking component mounted hook
6523 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6524 insert.fns[i$2]();
6525 }
6526 }
6527 } else {
6528 registerRef(ancestor);
6529 }
6530 ancestor = ancestor.parent;
6531 }
6532 }
6533
6534 // destroy old node
6535 if (isDef(parentElm)) {
6536 removeVnodes([oldVnode], 0, 0);
6537 } else if (isDef(oldVnode.tag)) {
6538 invokeDestroyHook(oldVnode);
6539 }
6540 }
6541 }
6542
6543 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6544 return vnode.elm
6545 }
6546}
6547
6548/* */
6549
6550var directives = {
6551 create: updateDirectives,
6552 update: updateDirectives,
6553 destroy: function unbindDirectives (vnode) {
6554 updateDirectives(vnode, emptyNode);
6555 }
6556};
6557
6558function updateDirectives (oldVnode, vnode) {
6559 if (oldVnode.data.directives || vnode.data.directives) {
6560 _update(oldVnode, vnode);
6561 }
6562}
6563
6564function _update (oldVnode, vnode) {
6565 var isCreate = oldVnode === emptyNode;
6566 var isDestroy = vnode === emptyNode;
6567 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6568 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6569
6570 var dirsWithInsert = [];
6571 var dirsWithPostpatch = [];
6572
6573 var key, oldDir, dir;
6574 for (key in newDirs) {
6575 oldDir = oldDirs[key];
6576 dir = newDirs[key];
6577 if (!oldDir) {
6578 // new directive, bind
6579 callHook$1(dir, 'bind', vnode, oldVnode);
6580 if (dir.def && dir.def.inserted) {
6581 dirsWithInsert.push(dir);
6582 }
6583 } else {
6584 // existing directive, update
6585 dir.oldValue = oldDir.value;
6586 dir.oldArg = oldDir.arg;
6587 callHook$1(dir, 'update', vnode, oldVnode);
6588 if (dir.def && dir.def.componentUpdated) {
6589 dirsWithPostpatch.push(dir);
6590 }
6591 }
6592 }
6593
6594 if (dirsWithInsert.length) {
6595 var callInsert = function () {
6596 for (var i = 0; i < dirsWithInsert.length; i++) {
6597 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6598 }
6599 };
6600 if (isCreate) {
6601 mergeVNodeHook(vnode, 'insert', callInsert);
6602 } else {
6603 callInsert();
6604 }
6605 }
6606
6607 if (dirsWithPostpatch.length) {
6608 mergeVNodeHook(vnode, 'postpatch', function () {
6609 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6610 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6611 }
6612 });
6613 }
6614
6615 if (!isCreate) {
6616 for (key in oldDirs) {
6617 if (!newDirs[key]) {
6618 // no longer present, unbind
6619 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6620 }
6621 }
6622 }
6623}
6624
6625var emptyModifiers = Object.create(null);
6626
6627function normalizeDirectives$1 (
6628 dirs,
6629 vm
6630) {
6631 var res = Object.create(null);
6632 if (!dirs) {
6633 // $flow-disable-line
6634 return res
6635 }
6636 var i, dir;
6637 for (i = 0; i < dirs.length; i++) {
6638 dir = dirs[i];
6639 if (!dir.modifiers) {
6640 // $flow-disable-line
6641 dir.modifiers = emptyModifiers;
6642 }
6643 res[getRawDirName(dir)] = dir;
6644 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6645 }
6646 // $flow-disable-line
6647 return res
6648}
6649
6650function getRawDirName (dir) {
6651 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6652}
6653
6654function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6655 var fn = dir.def && dir.def[hook];
6656 if (fn) {
6657 try {
6658 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6659 } catch (e) {
6660 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6661 }
6662 }
6663}
6664
6665var baseModules = [
6666 ref,
6667 directives
6668];
6669
6670/* */
6671
6672function updateAttrs (oldVnode, vnode) {
6673 var opts = vnode.componentOptions;
6674 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6675 return
6676 }
6677 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6678 return
6679 }
6680 var key, cur, old;
6681 var elm = vnode.elm;
6682 var oldAttrs = oldVnode.data.attrs || {};
6683 var attrs = vnode.data.attrs || {};
6684 // clone observed objects, as the user probably wants to mutate it
6685 if (isDef(attrs.__ob__)) {
6686 attrs = vnode.data.attrs = extend({}, attrs);
6687 }
6688
6689 for (key in attrs) {
6690 cur = attrs[key];
6691 old = oldAttrs[key];
6692 if (old !== cur) {
6693 setAttr(elm, key, cur);
6694 }
6695 }
6696 // #4391: in IE9, setting type can reset value for input[type=radio]
6697 // #6666: IE/Edge forces progress value down to 1 before setting a max
6698 /* istanbul ignore if */
6699 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6700 setAttr(elm, 'value', attrs.value);
6701 }
6702 for (key in oldAttrs) {
6703 if (isUndef(attrs[key])) {
6704 if (isXlink(key)) {
6705 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6706 } else if (!isEnumeratedAttr(key)) {
6707 elm.removeAttribute(key);
6708 }
6709 }
6710 }
6711}
6712
6713function setAttr (el, key, value) {
6714 if (el.tagName.indexOf('-') > -1) {
6715 baseSetAttr(el, key, value);
6716 } else if (isBooleanAttr(key)) {
6717 // set attribute for blank value
6718 // e.g. <option disabled>Select one</option>
6719 if (isFalsyAttrValue(value)) {
6720 el.removeAttribute(key);
6721 } else {
6722 // technically allowfullscreen is a boolean attribute for <iframe>,
6723 // but Flash expects a value of "true" when used on <embed> tag
6724 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6725 ? 'true'
6726 : key;
6727 el.setAttribute(key, value);
6728 }
6729 } else if (isEnumeratedAttr(key)) {
6730 el.setAttribute(key, convertEnumeratedValue(key, value));
6731 } else if (isXlink(key)) {
6732 if (isFalsyAttrValue(value)) {
6733 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6734 } else {
6735 el.setAttributeNS(xlinkNS, key, value);
6736 }
6737 } else {
6738 baseSetAttr(el, key, value);
6739 }
6740}
6741
6742function baseSetAttr (el, key, value) {
6743 if (isFalsyAttrValue(value)) {
6744 el.removeAttribute(key);
6745 } else {
6746 // #7138: IE10 & 11 fires input event when setting placeholder on
6747 // <textarea>... block the first input event and remove the blocker
6748 // immediately.
6749 /* istanbul ignore if */
6750 if (
6751 isIE && !isIE9 &&
6752 el.tagName === 'TEXTAREA' &&
6753 key === 'placeholder' && value !== '' && !el.__ieph
6754 ) {
6755 var blocker = function (e) {
6756 e.stopImmediatePropagation();
6757 el.removeEventListener('input', blocker);
6758 };
6759 el.addEventListener('input', blocker);
6760 // $flow-disable-line
6761 el.__ieph = true; /* IE placeholder patched */
6762 }
6763 el.setAttribute(key, value);
6764 }
6765}
6766
6767var attrs = {
6768 create: updateAttrs,
6769 update: updateAttrs
6770};
6771
6772/* */
6773
6774function updateClass (oldVnode, vnode) {
6775 var el = vnode.elm;
6776 var data = vnode.data;
6777 var oldData = oldVnode.data;
6778 if (
6779 isUndef(data.staticClass) &&
6780 isUndef(data.class) && (
6781 isUndef(oldData) || (
6782 isUndef(oldData.staticClass) &&
6783 isUndef(oldData.class)
6784 )
6785 )
6786 ) {
6787 return
6788 }
6789
6790 var cls = genClassForVnode(vnode);
6791
6792 // handle transition classes
6793 var transitionClass = el._transitionClasses;
6794 if (isDef(transitionClass)) {
6795 cls = concat(cls, stringifyClass(transitionClass));
6796 }
6797
6798 // set the class
6799 if (cls !== el._prevClass) {
6800 el.setAttribute('class', cls);
6801 el._prevClass = cls;
6802 }
6803}
6804
6805var klass = {
6806 create: updateClass,
6807 update: updateClass
6808};
6809
6810/* */
6811
6812/* */
6813
6814/* */
6815
6816/* */
6817
6818// in some cases, the event used has to be determined at runtime
6819// so we used some reserved tokens during compile.
6820var RANGE_TOKEN = '__r';
6821var CHECKBOX_RADIO_TOKEN = '__c';
6822
6823/* */
6824
6825// normalize v-model event tokens that can only be determined at runtime.
6826// it's important to place the event as the first in the array because
6827// the whole point is ensuring the v-model callback gets called before
6828// user-attached handlers.
6829function normalizeEvents (on) {
6830 /* istanbul ignore if */
6831 if (isDef(on[RANGE_TOKEN])) {
6832 // IE input[type=range] only supports `change` event
6833 var event = isIE ? 'change' : 'input';
6834 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6835 delete on[RANGE_TOKEN];
6836 }
6837 // This was originally intended to fix #4521 but no longer necessary
6838 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6839 /* istanbul ignore if */
6840 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6841 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6842 delete on[CHECKBOX_RADIO_TOKEN];
6843 }
6844}
6845
6846var target$1;
6847
6848function createOnceHandler$1 (event, handler, capture) {
6849 var _target = target$1; // save current target element in closure
6850 return function onceHandler () {
6851 var res = handler.apply(null, arguments);
6852 if (res !== null) {
6853 remove$2(event, onceHandler, capture, _target);
6854 }
6855 }
6856}
6857
6858// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
6859// implementation and does not fire microtasks in between event propagation, so
6860// safe to exclude.
6861var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
6862
6863function add$1 (
6864 name,
6865 handler,
6866 capture,
6867 passive
6868) {
6869 // async edge case #6566: inner click event triggers patch, event handler
6870 // attached to outer element during patch, and triggered again. This
6871 // happens because browsers fire microtask ticks between event propagation.
6872 // the solution is simple: we save the timestamp when a handler is attached,
6873 // and the handler would only fire if the event passed to it was fired
6874 // AFTER it was attached.
6875 if (useMicrotaskFix) {
6876 var attachedTimestamp = currentFlushTimestamp;
6877 var original = handler;
6878 handler = original._wrapper = function (e) {
6879 if (
6880 // no bubbling, should always fire.
6881 // this is just a safety net in case event.timeStamp is unreliable in
6882 // certain weird environments...
6883 e.target === e.currentTarget ||
6884 // event is fired after handler attachment
6885 e.timeStamp >= attachedTimestamp ||
6886 // bail for environments that have buggy event.timeStamp implementations
6887 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6888 // #9681 QtWebEngine event.timeStamp is negative value
6889 e.timeStamp <= 0 ||
6890 // #9448 bail if event is fired in another document in a multi-page
6891 // electron/nw.js app, since event.timeStamp will be using a different
6892 // starting reference
6893 e.target.ownerDocument !== document
6894 ) {
6895 return original.apply(this, arguments)
6896 }
6897 };
6898 }
6899 target$1.addEventListener(
6900 name,
6901 handler,
6902 supportsPassive
6903 ? { capture: capture, passive: passive }
6904 : capture
6905 );
6906}
6907
6908function remove$2 (
6909 name,
6910 handler,
6911 capture,
6912 _target
6913) {
6914 (_target || target$1).removeEventListener(
6915 name,
6916 handler._wrapper || handler,
6917 capture
6918 );
6919}
6920
6921function updateDOMListeners (oldVnode, vnode) {
6922 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6923 return
6924 }
6925 var on = vnode.data.on || {};
6926 var oldOn = oldVnode.data.on || {};
6927 target$1 = vnode.elm;
6928 normalizeEvents(on);
6929 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
6930 target$1 = undefined;
6931}
6932
6933var events = {
6934 create: updateDOMListeners,
6935 update: updateDOMListeners
6936};
6937
6938/* */
6939
6940var svgContainer;
6941
6942function updateDOMProps (oldVnode, vnode) {
6943 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6944 return
6945 }
6946 var key, cur;
6947 var elm = vnode.elm;
6948 var oldProps = oldVnode.data.domProps || {};
6949 var props = vnode.data.domProps || {};
6950 // clone observed objects, as the user probably wants to mutate it
6951 if (isDef(props.__ob__)) {
6952 props = vnode.data.domProps = extend({}, props);
6953 }
6954
6955 for (key in oldProps) {
6956 if (!(key in props)) {
6957 elm[key] = '';
6958 }
6959 }
6960
6961 for (key in props) {
6962 cur = props[key];
6963 // ignore children if the node has textContent or innerHTML,
6964 // as these will throw away existing DOM nodes and cause removal errors
6965 // on subsequent patches (#3360)
6966 if (key === 'textContent' || key === 'innerHTML') {
6967 if (vnode.children) { vnode.children.length = 0; }
6968 if (cur === oldProps[key]) { continue }
6969 // #6601 work around Chrome version <= 55 bug where single textNode
6970 // replaced by innerHTML/textContent retains its parentNode property
6971 if (elm.childNodes.length === 1) {
6972 elm.removeChild(elm.childNodes[0]);
6973 }
6974 }
6975
6976 if (key === 'value' && elm.tagName !== 'PROGRESS') {
6977 // store value as _value as well since
6978 // non-string values will be stringified
6979 elm._value = cur;
6980 // avoid resetting cursor position when value is the same
6981 var strCur = isUndef(cur) ? '' : String(cur);
6982 if (shouldUpdateValue(elm, strCur)) {
6983 elm.value = strCur;
6984 }
6985 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
6986 // IE doesn't support innerHTML for SVG elements
6987 svgContainer = svgContainer || document.createElement('div');
6988 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
6989 var svg = svgContainer.firstChild;
6990 while (elm.firstChild) {
6991 elm.removeChild(elm.firstChild);
6992 }
6993 while (svg.firstChild) {
6994 elm.appendChild(svg.firstChild);
6995 }
6996 } else if (
6997 // skip the update if old and new VDOM state is the same.
6998 // `value` is handled separately because the DOM value may be temporarily
6999 // out of sync with VDOM state due to focus, composition and modifiers.
7000 // This #4521 by skipping the unnecessary `checked` update.
7001 cur !== oldProps[key]
7002 ) {
7003 // some property updates can throw
7004 // e.g. `value` on <progress> w/ non-finite value
7005 try {
7006 elm[key] = cur;
7007 } catch (e) {}
7008 }
7009 }
7010}
7011
7012// check platforms/web/util/attrs.js acceptValue
7013
7014
7015function shouldUpdateValue (elm, checkVal) {
7016 return (!elm.composing && (
7017 elm.tagName === 'OPTION' ||
7018 isNotInFocusAndDirty(elm, checkVal) ||
7019 isDirtyWithModifiers(elm, checkVal)
7020 ))
7021}
7022
7023function isNotInFocusAndDirty (elm, checkVal) {
7024 // return true when textbox (.number and .trim) loses focus and its value is
7025 // not equal to the updated value
7026 var notInFocus = true;
7027 // #6157
7028 // work around IE bug when accessing document.activeElement in an iframe
7029 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7030 return notInFocus && elm.value !== checkVal
7031}
7032
7033function isDirtyWithModifiers (elm, newVal) {
7034 var value = elm.value;
7035 var modifiers = elm._vModifiers; // injected by v-model runtime
7036 if (isDef(modifiers)) {
7037 if (modifiers.number) {
7038 return toNumber(value) !== toNumber(newVal)
7039 }
7040 if (modifiers.trim) {
7041 return value.trim() !== newVal.trim()
7042 }
7043 }
7044 return value !== newVal
7045}
7046
7047var domProps = {
7048 create: updateDOMProps,
7049 update: updateDOMProps
7050};
7051
7052/* */
7053
7054var parseStyleText = cached(function (cssText) {
7055 var res = {};
7056 var listDelimiter = /;(?![^(]*\))/g;
7057 var propertyDelimiter = /:(.+)/;
7058 cssText.split(listDelimiter).forEach(function (item) {
7059 if (item) {
7060 var tmp = item.split(propertyDelimiter);
7061 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7062 }
7063 });
7064 return res
7065});
7066
7067// merge static and dynamic style data on the same vnode
7068function normalizeStyleData (data) {
7069 var style = normalizeStyleBinding(data.style);
7070 // static style is pre-processed into an object during compilation
7071 // and is always a fresh object, so it's safe to merge into it
7072 return data.staticStyle
7073 ? extend(data.staticStyle, style)
7074 : style
7075}
7076
7077// normalize possible array / string values into Object
7078function normalizeStyleBinding (bindingStyle) {
7079 if (Array.isArray(bindingStyle)) {
7080 return toObject(bindingStyle)
7081 }
7082 if (typeof bindingStyle === 'string') {
7083 return parseStyleText(bindingStyle)
7084 }
7085 return bindingStyle
7086}
7087
7088/**
7089 * parent component style should be after child's
7090 * so that parent component's style could override it
7091 */
7092function getStyle (vnode, checkChild) {
7093 var res = {};
7094 var styleData;
7095
7096 if (checkChild) {
7097 var childNode = vnode;
7098 while (childNode.componentInstance) {
7099 childNode = childNode.componentInstance._vnode;
7100 if (
7101 childNode && childNode.data &&
7102 (styleData = normalizeStyleData(childNode.data))
7103 ) {
7104 extend(res, styleData);
7105 }
7106 }
7107 }
7108
7109 if ((styleData = normalizeStyleData(vnode.data))) {
7110 extend(res, styleData);
7111 }
7112
7113 var parentNode = vnode;
7114 while ((parentNode = parentNode.parent)) {
7115 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7116 extend(res, styleData);
7117 }
7118 }
7119 return res
7120}
7121
7122/* */
7123
7124var cssVarRE = /^--/;
7125var importantRE = /\s*!important$/;
7126var setProp = function (el, name, val) {
7127 /* istanbul ignore if */
7128 if (cssVarRE.test(name)) {
7129 el.style.setProperty(name, val);
7130 } else if (importantRE.test(val)) {
7131 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7132 } else {
7133 var normalizedName = normalize(name);
7134 if (Array.isArray(val)) {
7135 // Support values array created by autoprefixer, e.g.
7136 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7137 // Set them one by one, and the browser will only set those it can recognize
7138 for (var i = 0, len = val.length; i < len; i++) {
7139 el.style[normalizedName] = val[i];
7140 }
7141 } else {
7142 el.style[normalizedName] = val;
7143 }
7144 }
7145};
7146
7147var vendorNames = ['Webkit', 'Moz', 'ms'];
7148
7149var emptyStyle;
7150var normalize = cached(function (prop) {
7151 emptyStyle = emptyStyle || document.createElement('div').style;
7152 prop = camelize(prop);
7153 if (prop !== 'filter' && (prop in emptyStyle)) {
7154 return prop
7155 }
7156 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7157 for (var i = 0; i < vendorNames.length; i++) {
7158 var name = vendorNames[i] + capName;
7159 if (name in emptyStyle) {
7160 return name
7161 }
7162 }
7163});
7164
7165function updateStyle (oldVnode, vnode) {
7166 var data = vnode.data;
7167 var oldData = oldVnode.data;
7168
7169 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7170 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7171 ) {
7172 return
7173 }
7174
7175 var cur, name;
7176 var el = vnode.elm;
7177 var oldStaticStyle = oldData.staticStyle;
7178 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7179
7180 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7181 var oldStyle = oldStaticStyle || oldStyleBinding;
7182
7183 var style = normalizeStyleBinding(vnode.data.style) || {};
7184
7185 // store normalized style under a different key for next diff
7186 // make sure to clone it if it's reactive, since the user likely wants
7187 // to mutate it.
7188 vnode.data.normalizedStyle = isDef(style.__ob__)
7189 ? extend({}, style)
7190 : style;
7191
7192 var newStyle = getStyle(vnode, true);
7193
7194 for (name in oldStyle) {
7195 if (isUndef(newStyle[name])) {
7196 setProp(el, name, '');
7197 }
7198 }
7199 for (name in newStyle) {
7200 cur = newStyle[name];
7201 if (cur !== oldStyle[name]) {
7202 // ie9 setting to null has no effect, must use empty string
7203 setProp(el, name, cur == null ? '' : cur);
7204 }
7205 }
7206}
7207
7208var style = {
7209 create: updateStyle,
7210 update: updateStyle
7211};
7212
7213/* */
7214
7215var whitespaceRE = /\s+/;
7216
7217/**
7218 * Add class with compatibility for SVG since classList is not supported on
7219 * SVG elements in IE
7220 */
7221function addClass (el, cls) {
7222 /* istanbul ignore if */
7223 if (!cls || !(cls = cls.trim())) {
7224 return
7225 }
7226
7227 /* istanbul ignore else */
7228 if (el.classList) {
7229 if (cls.indexOf(' ') > -1) {
7230 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7231 } else {
7232 el.classList.add(cls);
7233 }
7234 } else {
7235 var cur = " " + (el.getAttribute('class') || '') + " ";
7236 if (cur.indexOf(' ' + cls + ' ') < 0) {
7237 el.setAttribute('class', (cur + cls).trim());
7238 }
7239 }
7240}
7241
7242/**
7243 * Remove class with compatibility for SVG since classList is not supported on
7244 * SVG elements in IE
7245 */
7246function removeClass (el, cls) {
7247 /* istanbul ignore if */
7248 if (!cls || !(cls = cls.trim())) {
7249 return
7250 }
7251
7252 /* istanbul ignore else */
7253 if (el.classList) {
7254 if (cls.indexOf(' ') > -1) {
7255 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7256 } else {
7257 el.classList.remove(cls);
7258 }
7259 if (!el.classList.length) {
7260 el.removeAttribute('class');
7261 }
7262 } else {
7263 var cur = " " + (el.getAttribute('class') || '') + " ";
7264 var tar = ' ' + cls + ' ';
7265 while (cur.indexOf(tar) >= 0) {
7266 cur = cur.replace(tar, ' ');
7267 }
7268 cur = cur.trim();
7269 if (cur) {
7270 el.setAttribute('class', cur);
7271 } else {
7272 el.removeAttribute('class');
7273 }
7274 }
7275}
7276
7277/* */
7278
7279function resolveTransition (def$$1) {
7280 if (!def$$1) {
7281 return
7282 }
7283 /* istanbul ignore else */
7284 if (typeof def$$1 === 'object') {
7285 var res = {};
7286 if (def$$1.css !== false) {
7287 extend(res, autoCssTransition(def$$1.name || 'v'));
7288 }
7289 extend(res, def$$1);
7290 return res
7291 } else if (typeof def$$1 === 'string') {
7292 return autoCssTransition(def$$1)
7293 }
7294}
7295
7296var autoCssTransition = cached(function (name) {
7297 return {
7298 enterClass: (name + "-enter"),
7299 enterToClass: (name + "-enter-to"),
7300 enterActiveClass: (name + "-enter-active"),
7301 leaveClass: (name + "-leave"),
7302 leaveToClass: (name + "-leave-to"),
7303 leaveActiveClass: (name + "-leave-active")
7304 }
7305});
7306
7307var hasTransition = inBrowser && !isIE9;
7308var TRANSITION = 'transition';
7309var ANIMATION = 'animation';
7310
7311// Transition property/event sniffing
7312var transitionProp = 'transition';
7313var transitionEndEvent = 'transitionend';
7314var animationProp = 'animation';
7315var animationEndEvent = 'animationend';
7316if (hasTransition) {
7317 /* istanbul ignore if */
7318 if (window.ontransitionend === undefined &&
7319 window.onwebkittransitionend !== undefined
7320 ) {
7321 transitionProp = 'WebkitTransition';
7322 transitionEndEvent = 'webkitTransitionEnd';
7323 }
7324 if (window.onanimationend === undefined &&
7325 window.onwebkitanimationend !== undefined
7326 ) {
7327 animationProp = 'WebkitAnimation';
7328 animationEndEvent = 'webkitAnimationEnd';
7329 }
7330}
7331
7332// binding to window is necessary to make hot reload work in IE in strict mode
7333var raf = inBrowser
7334 ? window.requestAnimationFrame
7335 ? window.requestAnimationFrame.bind(window)
7336 : setTimeout
7337 : /* istanbul ignore next */ function (fn) { return fn(); };
7338
7339function nextFrame (fn) {
7340 raf(function () {
7341 raf(fn);
7342 });
7343}
7344
7345function addTransitionClass (el, cls) {
7346 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7347 if (transitionClasses.indexOf(cls) < 0) {
7348 transitionClasses.push(cls);
7349 addClass(el, cls);
7350 }
7351}
7352
7353function removeTransitionClass (el, cls) {
7354 if (el._transitionClasses) {
7355 remove(el._transitionClasses, cls);
7356 }
7357 removeClass(el, cls);
7358}
7359
7360function whenTransitionEnds (
7361 el,
7362 expectedType,
7363 cb
7364) {
7365 var ref = getTransitionInfo(el, expectedType);
7366 var type = ref.type;
7367 var timeout = ref.timeout;
7368 var propCount = ref.propCount;
7369 if (!type) { return cb() }
7370 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7371 var ended = 0;
7372 var end = function () {
7373 el.removeEventListener(event, onEnd);
7374 cb();
7375 };
7376 var onEnd = function (e) {
7377 if (e.target === el) {
7378 if (++ended >= propCount) {
7379 end();
7380 }
7381 }
7382 };
7383 setTimeout(function () {
7384 if (ended < propCount) {
7385 end();
7386 }
7387 }, timeout + 1);
7388 el.addEventListener(event, onEnd);
7389}
7390
7391var transformRE = /\b(transform|all)(,|$)/;
7392
7393function getTransitionInfo (el, expectedType) {
7394 var styles = window.getComputedStyle(el);
7395 // JSDOM may return undefined for transition properties
7396 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7397 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7398 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7399 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7400 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7401 var animationTimeout = getTimeout(animationDelays, animationDurations);
7402
7403 var type;
7404 var timeout = 0;
7405 var propCount = 0;
7406 /* istanbul ignore if */
7407 if (expectedType === TRANSITION) {
7408 if (transitionTimeout > 0) {
7409 type = TRANSITION;
7410 timeout = transitionTimeout;
7411 propCount = transitionDurations.length;
7412 }
7413 } else if (expectedType === ANIMATION) {
7414 if (animationTimeout > 0) {
7415 type = ANIMATION;
7416 timeout = animationTimeout;
7417 propCount = animationDurations.length;
7418 }
7419 } else {
7420 timeout = Math.max(transitionTimeout, animationTimeout);
7421 type = timeout > 0
7422 ? transitionTimeout > animationTimeout
7423 ? TRANSITION
7424 : ANIMATION
7425 : null;
7426 propCount = type
7427 ? type === TRANSITION
7428 ? transitionDurations.length
7429 : animationDurations.length
7430 : 0;
7431 }
7432 var hasTransform =
7433 type === TRANSITION &&
7434 transformRE.test(styles[transitionProp + 'Property']);
7435 return {
7436 type: type,
7437 timeout: timeout,
7438 propCount: propCount,
7439 hasTransform: hasTransform
7440 }
7441}
7442
7443function getTimeout (delays, durations) {
7444 /* istanbul ignore next */
7445 while (delays.length < durations.length) {
7446 delays = delays.concat(delays);
7447 }
7448
7449 return Math.max.apply(null, durations.map(function (d, i) {
7450 return toMs(d) + toMs(delays[i])
7451 }))
7452}
7453
7454// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7455// in a locale-dependent way, using a comma instead of a dot.
7456// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7457// as a floor function) causing unexpected behaviors
7458function toMs (s) {
7459 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7460}
7461
7462/* */
7463
7464function enter (vnode, toggleDisplay) {
7465 var el = vnode.elm;
7466
7467 // call leave callback now
7468 if (isDef(el._leaveCb)) {
7469 el._leaveCb.cancelled = true;
7470 el._leaveCb();
7471 }
7472
7473 var data = resolveTransition(vnode.data.transition);
7474 if (isUndef(data)) {
7475 return
7476 }
7477
7478 /* istanbul ignore if */
7479 if (isDef(el._enterCb) || el.nodeType !== 1) {
7480 return
7481 }
7482
7483 var css = data.css;
7484 var type = data.type;
7485 var enterClass = data.enterClass;
7486 var enterToClass = data.enterToClass;
7487 var enterActiveClass = data.enterActiveClass;
7488 var appearClass = data.appearClass;
7489 var appearToClass = data.appearToClass;
7490 var appearActiveClass = data.appearActiveClass;
7491 var beforeEnter = data.beforeEnter;
7492 var enter = data.enter;
7493 var afterEnter = data.afterEnter;
7494 var enterCancelled = data.enterCancelled;
7495 var beforeAppear = data.beforeAppear;
7496 var appear = data.appear;
7497 var afterAppear = data.afterAppear;
7498 var appearCancelled = data.appearCancelled;
7499 var duration = data.duration;
7500
7501 // activeInstance will always be the <transition> component managing this
7502 // transition. One edge case to check is when the <transition> is placed
7503 // as the root node of a child component. In that case we need to check
7504 // <transition>'s parent for appear check.
7505 var context = activeInstance;
7506 var transitionNode = activeInstance.$vnode;
7507 while (transitionNode && transitionNode.parent) {
7508 context = transitionNode.context;
7509 transitionNode = transitionNode.parent;
7510 }
7511
7512 var isAppear = !context._isMounted || !vnode.isRootInsert;
7513
7514 if (isAppear && !appear && appear !== '') {
7515 return
7516 }
7517
7518 var startClass = isAppear && appearClass
7519 ? appearClass
7520 : enterClass;
7521 var activeClass = isAppear && appearActiveClass
7522 ? appearActiveClass
7523 : enterActiveClass;
7524 var toClass = isAppear && appearToClass
7525 ? appearToClass
7526 : enterToClass;
7527
7528 var beforeEnterHook = isAppear
7529 ? (beforeAppear || beforeEnter)
7530 : beforeEnter;
7531 var enterHook = isAppear
7532 ? (typeof appear === 'function' ? appear : enter)
7533 : enter;
7534 var afterEnterHook = isAppear
7535 ? (afterAppear || afterEnter)
7536 : afterEnter;
7537 var enterCancelledHook = isAppear
7538 ? (appearCancelled || enterCancelled)
7539 : enterCancelled;
7540
7541 var explicitEnterDuration = toNumber(
7542 isObject(duration)
7543 ? duration.enter
7544 : duration
7545 );
7546
7547 if (explicitEnterDuration != null) {
7548 checkDuration(explicitEnterDuration, 'enter', vnode);
7549 }
7550
7551 var expectsCSS = css !== false && !isIE9;
7552 var userWantsControl = getHookArgumentsLength(enterHook);
7553
7554 var cb = el._enterCb = once(function () {
7555 if (expectsCSS) {
7556 removeTransitionClass(el, toClass);
7557 removeTransitionClass(el, activeClass);
7558 }
7559 if (cb.cancelled) {
7560 if (expectsCSS) {
7561 removeTransitionClass(el, startClass);
7562 }
7563 enterCancelledHook && enterCancelledHook(el);
7564 } else {
7565 afterEnterHook && afterEnterHook(el);
7566 }
7567 el._enterCb = null;
7568 });
7569
7570 if (!vnode.data.show) {
7571 // remove pending leave element on enter by injecting an insert hook
7572 mergeVNodeHook(vnode, 'insert', function () {
7573 var parent = el.parentNode;
7574 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7575 if (pendingNode &&
7576 pendingNode.tag === vnode.tag &&
7577 pendingNode.elm._leaveCb
7578 ) {
7579 pendingNode.elm._leaveCb();
7580 }
7581 enterHook && enterHook(el, cb);
7582 });
7583 }
7584
7585 // start enter transition
7586 beforeEnterHook && beforeEnterHook(el);
7587 if (expectsCSS) {
7588 addTransitionClass(el, startClass);
7589 addTransitionClass(el, activeClass);
7590 nextFrame(function () {
7591 removeTransitionClass(el, startClass);
7592 if (!cb.cancelled) {
7593 addTransitionClass(el, toClass);
7594 if (!userWantsControl) {
7595 if (isValidDuration(explicitEnterDuration)) {
7596 setTimeout(cb, explicitEnterDuration);
7597 } else {
7598 whenTransitionEnds(el, type, cb);
7599 }
7600 }
7601 }
7602 });
7603 }
7604
7605 if (vnode.data.show) {
7606 toggleDisplay && toggleDisplay();
7607 enterHook && enterHook(el, cb);
7608 }
7609
7610 if (!expectsCSS && !userWantsControl) {
7611 cb();
7612 }
7613}
7614
7615function leave (vnode, rm) {
7616 var el = vnode.elm;
7617
7618 // call enter callback now
7619 if (isDef(el._enterCb)) {
7620 el._enterCb.cancelled = true;
7621 el._enterCb();
7622 }
7623
7624 var data = resolveTransition(vnode.data.transition);
7625 if (isUndef(data) || el.nodeType !== 1) {
7626 return rm()
7627 }
7628
7629 /* istanbul ignore if */
7630 if (isDef(el._leaveCb)) {
7631 return
7632 }
7633
7634 var css = data.css;
7635 var type = data.type;
7636 var leaveClass = data.leaveClass;
7637 var leaveToClass = data.leaveToClass;
7638 var leaveActiveClass = data.leaveActiveClass;
7639 var beforeLeave = data.beforeLeave;
7640 var leave = data.leave;
7641 var afterLeave = data.afterLeave;
7642 var leaveCancelled = data.leaveCancelled;
7643 var delayLeave = data.delayLeave;
7644 var duration = data.duration;
7645
7646 var expectsCSS = css !== false && !isIE9;
7647 var userWantsControl = getHookArgumentsLength(leave);
7648
7649 var explicitLeaveDuration = toNumber(
7650 isObject(duration)
7651 ? duration.leave
7652 : duration
7653 );
7654
7655 if (isDef(explicitLeaveDuration)) {
7656 checkDuration(explicitLeaveDuration, 'leave', vnode);
7657 }
7658
7659 var cb = el._leaveCb = once(function () {
7660 if (el.parentNode && el.parentNode._pending) {
7661 el.parentNode._pending[vnode.key] = null;
7662 }
7663 if (expectsCSS) {
7664 removeTransitionClass(el, leaveToClass);
7665 removeTransitionClass(el, leaveActiveClass);
7666 }
7667 if (cb.cancelled) {
7668 if (expectsCSS) {
7669 removeTransitionClass(el, leaveClass);
7670 }
7671 leaveCancelled && leaveCancelled(el);
7672 } else {
7673 rm();
7674 afterLeave && afterLeave(el);
7675 }
7676 el._leaveCb = null;
7677 });
7678
7679 if (delayLeave) {
7680 delayLeave(performLeave);
7681 } else {
7682 performLeave();
7683 }
7684
7685 function performLeave () {
7686 // the delayed leave may have already been cancelled
7687 if (cb.cancelled) {
7688 return
7689 }
7690 // record leaving element
7691 if (!vnode.data.show && el.parentNode) {
7692 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7693 }
7694 beforeLeave && beforeLeave(el);
7695 if (expectsCSS) {
7696 addTransitionClass(el, leaveClass);
7697 addTransitionClass(el, leaveActiveClass);
7698 nextFrame(function () {
7699 removeTransitionClass(el, leaveClass);
7700 if (!cb.cancelled) {
7701 addTransitionClass(el, leaveToClass);
7702 if (!userWantsControl) {
7703 if (isValidDuration(explicitLeaveDuration)) {
7704 setTimeout(cb, explicitLeaveDuration);
7705 } else {
7706 whenTransitionEnds(el, type, cb);
7707 }
7708 }
7709 }
7710 });
7711 }
7712 leave && leave(el, cb);
7713 if (!expectsCSS && !userWantsControl) {
7714 cb();
7715 }
7716 }
7717}
7718
7719// only used in dev mode
7720function checkDuration (val, name, vnode) {
7721 if (typeof val !== 'number') {
7722 warn(
7723 "<transition> explicit " + name + " duration is not a valid number - " +
7724 "got " + (JSON.stringify(val)) + ".",
7725 vnode.context
7726 );
7727 } else if (isNaN(val)) {
7728 warn(
7729 "<transition> explicit " + name + " duration is NaN - " +
7730 'the duration expression might be incorrect.',
7731 vnode.context
7732 );
7733 }
7734}
7735
7736function isValidDuration (val) {
7737 return typeof val === 'number' && !isNaN(val)
7738}
7739
7740/**
7741 * Normalize a transition hook's argument length. The hook may be:
7742 * - a merged hook (invoker) with the original in .fns
7743 * - a wrapped component method (check ._length)
7744 * - a plain function (.length)
7745 */
7746function getHookArgumentsLength (fn) {
7747 if (isUndef(fn)) {
7748 return false
7749 }
7750 var invokerFns = fn.fns;
7751 if (isDef(invokerFns)) {
7752 // invoker
7753 return getHookArgumentsLength(
7754 Array.isArray(invokerFns)
7755 ? invokerFns[0]
7756 : invokerFns
7757 )
7758 } else {
7759 return (fn._length || fn.length) > 1
7760 }
7761}
7762
7763function _enter (_, vnode) {
7764 if (vnode.data.show !== true) {
7765 enter(vnode);
7766 }
7767}
7768
7769var transition = inBrowser ? {
7770 create: _enter,
7771 activate: _enter,
7772 remove: function remove$$1 (vnode, rm) {
7773 /* istanbul ignore else */
7774 if (vnode.data.show !== true) {
7775 leave(vnode, rm);
7776 } else {
7777 rm();
7778 }
7779 }
7780} : {};
7781
7782var platformModules = [
7783 attrs,
7784 klass,
7785 events,
7786 domProps,
7787 style,
7788 transition
7789];
7790
7791/* */
7792
7793// the directive module should be applied last, after all
7794// built-in modules have been applied.
7795var modules = platformModules.concat(baseModules);
7796
7797var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7798
7799/**
7800 * Not type checking this file because flow doesn't like attaching
7801 * properties to Elements.
7802 */
7803
7804/* istanbul ignore if */
7805if (isIE9) {
7806 // http://www.matts411.com/post/internet-explorer-9-oninput/
7807 document.addEventListener('selectionchange', function () {
7808 var el = document.activeElement;
7809 if (el && el.vmodel) {
7810 trigger(el, 'input');
7811 }
7812 });
7813}
7814
7815var directive = {
7816 inserted: function inserted (el, binding, vnode, oldVnode) {
7817 if (vnode.tag === 'select') {
7818 // #6903
7819 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7820 mergeVNodeHook(vnode, 'postpatch', function () {
7821 directive.componentUpdated(el, binding, vnode);
7822 });
7823 } else {
7824 setSelected(el, binding, vnode.context);
7825 }
7826 el._vOptions = [].map.call(el.options, getValue);
7827 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7828 el._vModifiers = binding.modifiers;
7829 if (!binding.modifiers.lazy) {
7830 el.addEventListener('compositionstart', onCompositionStart);
7831 el.addEventListener('compositionend', onCompositionEnd);
7832 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7833 // switching focus before confirming composition choice
7834 // this also fixes the issue where some browsers e.g. iOS Chrome
7835 // fires "change" instead of "input" on autocomplete.
7836 el.addEventListener('change', onCompositionEnd);
7837 /* istanbul ignore if */
7838 if (isIE9) {
7839 el.vmodel = true;
7840 }
7841 }
7842 }
7843 },
7844
7845 componentUpdated: function componentUpdated (el, binding, vnode) {
7846 if (vnode.tag === 'select') {
7847 setSelected(el, binding, vnode.context);
7848 // in case the options rendered by v-for have changed,
7849 // it's possible that the value is out-of-sync with the rendered options.
7850 // detect such cases and filter out values that no longer has a matching
7851 // option in the DOM.
7852 var prevOptions = el._vOptions;
7853 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7854 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7855 // trigger change event if
7856 // no matching option found for at least one value
7857 var needReset = el.multiple
7858 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7859 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7860 if (needReset) {
7861 trigger(el, 'change');
7862 }
7863 }
7864 }
7865 }
7866};
7867
7868function setSelected (el, binding, vm) {
7869 actuallySetSelected(el, binding, vm);
7870 /* istanbul ignore if */
7871 if (isIE || isEdge) {
7872 setTimeout(function () {
7873 actuallySetSelected(el, binding, vm);
7874 }, 0);
7875 }
7876}
7877
7878function actuallySetSelected (el, binding, vm) {
7879 var value = binding.value;
7880 var isMultiple = el.multiple;
7881 if (isMultiple && !Array.isArray(value)) {
7882 warn(
7883 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7884 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7885 vm
7886 );
7887 return
7888 }
7889 var selected, option;
7890 for (var i = 0, l = el.options.length; i < l; i++) {
7891 option = el.options[i];
7892 if (isMultiple) {
7893 selected = looseIndexOf(value, getValue(option)) > -1;
7894 if (option.selected !== selected) {
7895 option.selected = selected;
7896 }
7897 } else {
7898 if (looseEqual(getValue(option), value)) {
7899 if (el.selectedIndex !== i) {
7900 el.selectedIndex = i;
7901 }
7902 return
7903 }
7904 }
7905 }
7906 if (!isMultiple) {
7907 el.selectedIndex = -1;
7908 }
7909}
7910
7911function hasNoMatchingOption (value, options) {
7912 return options.every(function (o) { return !looseEqual(o, value); })
7913}
7914
7915function getValue (option) {
7916 return '_value' in option
7917 ? option._value
7918 : option.value
7919}
7920
7921function onCompositionStart (e) {
7922 e.target.composing = true;
7923}
7924
7925function onCompositionEnd (e) {
7926 // prevent triggering an input event for no reason
7927 if (!e.target.composing) { return }
7928 e.target.composing = false;
7929 trigger(e.target, 'input');
7930}
7931
7932function trigger (el, type) {
7933 var e = document.createEvent('HTMLEvents');
7934 e.initEvent(type, true, true);
7935 el.dispatchEvent(e);
7936}
7937
7938/* */
7939
7940// recursively search for possible transition defined inside the component root
7941function locateNode (vnode) {
7942 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7943 ? locateNode(vnode.componentInstance._vnode)
7944 : vnode
7945}
7946
7947var show = {
7948 bind: function bind (el, ref, vnode) {
7949 var value = ref.value;
7950
7951 vnode = locateNode(vnode);
7952 var transition$$1 = vnode.data && vnode.data.transition;
7953 var originalDisplay = el.__vOriginalDisplay =
7954 el.style.display === 'none' ? '' : el.style.display;
7955 if (value && transition$$1) {
7956 vnode.data.show = true;
7957 enter(vnode, function () {
7958 el.style.display = originalDisplay;
7959 });
7960 } else {
7961 el.style.display = value ? originalDisplay : 'none';
7962 }
7963 },
7964
7965 update: function update (el, ref, vnode) {
7966 var value = ref.value;
7967 var oldValue = ref.oldValue;
7968
7969 /* istanbul ignore if */
7970 if (!value === !oldValue) { return }
7971 vnode = locateNode(vnode);
7972 var transition$$1 = vnode.data && vnode.data.transition;
7973 if (transition$$1) {
7974 vnode.data.show = true;
7975 if (value) {
7976 enter(vnode, function () {
7977 el.style.display = el.__vOriginalDisplay;
7978 });
7979 } else {
7980 leave(vnode, function () {
7981 el.style.display = 'none';
7982 });
7983 }
7984 } else {
7985 el.style.display = value ? el.__vOriginalDisplay : 'none';
7986 }
7987 },
7988
7989 unbind: function unbind (
7990 el,
7991 binding,
7992 vnode,
7993 oldVnode,
7994 isDestroy
7995 ) {
7996 if (!isDestroy) {
7997 el.style.display = el.__vOriginalDisplay;
7998 }
7999 }
8000};
8001
8002var platformDirectives = {
8003 model: directive,
8004 show: show
8005};
8006
8007/* */
8008
8009var transitionProps = {
8010 name: String,
8011 appear: Boolean,
8012 css: Boolean,
8013 mode: String,
8014 type: String,
8015 enterClass: String,
8016 leaveClass: String,
8017 enterToClass: String,
8018 leaveToClass: String,
8019 enterActiveClass: String,
8020 leaveActiveClass: String,
8021 appearClass: String,
8022 appearActiveClass: String,
8023 appearToClass: String,
8024 duration: [Number, String, Object]
8025};
8026
8027// in case the child is also an abstract component, e.g. <keep-alive>
8028// we want to recursively retrieve the real component to be rendered
8029function getRealChild (vnode) {
8030 var compOptions = vnode && vnode.componentOptions;
8031 if (compOptions && compOptions.Ctor.options.abstract) {
8032 return getRealChild(getFirstComponentChild(compOptions.children))
8033 } else {
8034 return vnode
8035 }
8036}
8037
8038function extractTransitionData (comp) {
8039 var data = {};
8040 var options = comp.$options;
8041 // props
8042 for (var key in options.propsData) {
8043 data[key] = comp[key];
8044 }
8045 // events.
8046 // extract listeners and pass them directly to the transition methods
8047 var listeners = options._parentListeners;
8048 for (var key$1 in listeners) {
8049 data[camelize(key$1)] = listeners[key$1];
8050 }
8051 return data
8052}
8053
8054function placeholder (h, rawChild) {
8055 if (/\d-keep-alive$/.test(rawChild.tag)) {
8056 return h('keep-alive', {
8057 props: rawChild.componentOptions.propsData
8058 })
8059 }
8060}
8061
8062function hasParentTransition (vnode) {
8063 while ((vnode = vnode.parent)) {
8064 if (vnode.data.transition) {
8065 return true
8066 }
8067 }
8068}
8069
8070function isSameChild (child, oldChild) {
8071 return oldChild.key === child.key && oldChild.tag === child.tag
8072}
8073
8074var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8075
8076var isVShowDirective = function (d) { return d.name === 'show'; };
8077
8078var Transition = {
8079 name: 'transition',
8080 props: transitionProps,
8081 abstract: true,
8082
8083 render: function render (h) {
8084 var this$1 = this;
8085
8086 var children = this.$slots.default;
8087 if (!children) {
8088 return
8089 }
8090
8091 // filter out text nodes (possible whitespaces)
8092 children = children.filter(isNotTextNode);
8093 /* istanbul ignore if */
8094 if (!children.length) {
8095 return
8096 }
8097
8098 // warn multiple elements
8099 if (children.length > 1) {
8100 warn(
8101 '<transition> can only be used on a single element. Use ' +
8102 '<transition-group> for lists.',
8103 this.$parent
8104 );
8105 }
8106
8107 var mode = this.mode;
8108
8109 // warn invalid mode
8110 if (mode && mode !== 'in-out' && mode !== 'out-in'
8111 ) {
8112 warn(
8113 'invalid <transition> mode: ' + mode,
8114 this.$parent
8115 );
8116 }
8117
8118 var rawChild = children[0];
8119
8120 // if this is a component root node and the component's
8121 // parent container node also has transition, skip.
8122 if (hasParentTransition(this.$vnode)) {
8123 return rawChild
8124 }
8125
8126 // apply transition data to child
8127 // use getRealChild() to ignore abstract components e.g. keep-alive
8128 var child = getRealChild(rawChild);
8129 /* istanbul ignore if */
8130 if (!child) {
8131 return rawChild
8132 }
8133
8134 if (this._leaving) {
8135 return placeholder(h, rawChild)
8136 }
8137
8138 // ensure a key that is unique to the vnode type and to this transition
8139 // component instance. This key will be used to remove pending leaving nodes
8140 // during entering.
8141 var id = "__transition-" + (this._uid) + "-";
8142 child.key = child.key == null
8143 ? child.isComment
8144 ? id + 'comment'
8145 : id + child.tag
8146 : isPrimitive(child.key)
8147 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8148 : child.key;
8149
8150 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8151 var oldRawChild = this._vnode;
8152 var oldChild = getRealChild(oldRawChild);
8153
8154 // mark v-show
8155 // so that the transition module can hand over the control to the directive
8156 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8157 child.data.show = true;
8158 }
8159
8160 if (
8161 oldChild &&
8162 oldChild.data &&
8163 !isSameChild(child, oldChild) &&
8164 !isAsyncPlaceholder(oldChild) &&
8165 // #6687 component root is a comment node
8166 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8167 ) {
8168 // replace old child transition data with fresh one
8169 // important for dynamic transitions!
8170 var oldData = oldChild.data.transition = extend({}, data);
8171 // handle transition mode
8172 if (mode === 'out-in') {
8173 // return placeholder node and queue update when leave finishes
8174 this._leaving = true;
8175 mergeVNodeHook(oldData, 'afterLeave', function () {
8176 this$1._leaving = false;
8177 this$1.$forceUpdate();
8178 });
8179 return placeholder(h, rawChild)
8180 } else if (mode === 'in-out') {
8181 if (isAsyncPlaceholder(child)) {
8182 return oldRawChild
8183 }
8184 var delayedLeave;
8185 var performLeave = function () { delayedLeave(); };
8186 mergeVNodeHook(data, 'afterEnter', performLeave);
8187 mergeVNodeHook(data, 'enterCancelled', performLeave);
8188 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8189 }
8190 }
8191
8192 return rawChild
8193 }
8194};
8195
8196/* */
8197
8198var props = extend({
8199 tag: String,
8200 moveClass: String
8201}, transitionProps);
8202
8203delete props.mode;
8204
8205var TransitionGroup = {
8206 props: props,
8207
8208 beforeMount: function beforeMount () {
8209 var this$1 = this;
8210
8211 var update = this._update;
8212 this._update = function (vnode, hydrating) {
8213 var restoreActiveInstance = setActiveInstance(this$1);
8214 // force removing pass
8215 this$1.__patch__(
8216 this$1._vnode,
8217 this$1.kept,
8218 false, // hydrating
8219 true // removeOnly (!important, avoids unnecessary moves)
8220 );
8221 this$1._vnode = this$1.kept;
8222 restoreActiveInstance();
8223 update.call(this$1, vnode, hydrating);
8224 };
8225 },
8226
8227 render: function render (h) {
8228 var tag = this.tag || this.$vnode.data.tag || 'span';
8229 var map = Object.create(null);
8230 var prevChildren = this.prevChildren = this.children;
8231 var rawChildren = this.$slots.default || [];
8232 var children = this.children = [];
8233 var transitionData = extractTransitionData(this);
8234
8235 for (var i = 0; i < rawChildren.length; i++) {
8236 var c = rawChildren[i];
8237 if (c.tag) {
8238 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8239 children.push(c);
8240 map[c.key] = c
8241 ;(c.data || (c.data = {})).transition = transitionData;
8242 } else {
8243 var opts = c.componentOptions;
8244 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8245 warn(("<transition-group> children must be keyed: <" + name + ">"));
8246 }
8247 }
8248 }
8249
8250 if (prevChildren) {
8251 var kept = [];
8252 var removed = [];
8253 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8254 var c$1 = prevChildren[i$1];
8255 c$1.data.transition = transitionData;
8256 c$1.data.pos = c$1.elm.getBoundingClientRect();
8257 if (map[c$1.key]) {
8258 kept.push(c$1);
8259 } else {
8260 removed.push(c$1);
8261 }
8262 }
8263 this.kept = h(tag, null, kept);
8264 this.removed = removed;
8265 }
8266
8267 return h(tag, null, children)
8268 },
8269
8270 updated: function updated () {
8271 var children = this.prevChildren;
8272 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8273 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8274 return
8275 }
8276
8277 // we divide the work into three loops to avoid mixing DOM reads and writes
8278 // in each iteration - which helps prevent layout thrashing.
8279 children.forEach(callPendingCbs);
8280 children.forEach(recordPosition);
8281 children.forEach(applyTranslation);
8282
8283 // force reflow to put everything in position
8284 // assign to this to avoid being removed in tree-shaking
8285 // $flow-disable-line
8286 this._reflow = document.body.offsetHeight;
8287
8288 children.forEach(function (c) {
8289 if (c.data.moved) {
8290 var el = c.elm;
8291 var s = el.style;
8292 addTransitionClass(el, moveClass);
8293 s.transform = s.WebkitTransform = s.transitionDuration = '';
8294 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8295 if (e && e.target !== el) {
8296 return
8297 }
8298 if (!e || /transform$/.test(e.propertyName)) {
8299 el.removeEventListener(transitionEndEvent, cb);
8300 el._moveCb = null;
8301 removeTransitionClass(el, moveClass);
8302 }
8303 });
8304 }
8305 });
8306 },
8307
8308 methods: {
8309 hasMove: function hasMove (el, moveClass) {
8310 /* istanbul ignore if */
8311 if (!hasTransition) {
8312 return false
8313 }
8314 /* istanbul ignore if */
8315 if (this._hasMove) {
8316 return this._hasMove
8317 }
8318 // Detect whether an element with the move class applied has
8319 // CSS transitions. Since the element may be inside an entering
8320 // transition at this very moment, we make a clone of it and remove
8321 // all other transition classes applied to ensure only the move class
8322 // is applied.
8323 var clone = el.cloneNode();
8324 if (el._transitionClasses) {
8325 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8326 }
8327 addClass(clone, moveClass);
8328 clone.style.display = 'none';
8329 this.$el.appendChild(clone);
8330 var info = getTransitionInfo(clone);
8331 this.$el.removeChild(clone);
8332 return (this._hasMove = info.hasTransform)
8333 }
8334 }
8335};
8336
8337function callPendingCbs (c) {
8338 /* istanbul ignore if */
8339 if (c.elm._moveCb) {
8340 c.elm._moveCb();
8341 }
8342 /* istanbul ignore if */
8343 if (c.elm._enterCb) {
8344 c.elm._enterCb();
8345 }
8346}
8347
8348function recordPosition (c) {
8349 c.data.newPos = c.elm.getBoundingClientRect();
8350}
8351
8352function applyTranslation (c) {
8353 var oldPos = c.data.pos;
8354 var newPos = c.data.newPos;
8355 var dx = oldPos.left - newPos.left;
8356 var dy = oldPos.top - newPos.top;
8357 if (dx || dy) {
8358 c.data.moved = true;
8359 var s = c.elm.style;
8360 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8361 s.transitionDuration = '0s';
8362 }
8363}
8364
8365var platformComponents = {
8366 Transition: Transition,
8367 TransitionGroup: TransitionGroup
8368};
8369
8370/* */
8371
8372// install platform specific utils
8373Vue.config.mustUseProp = mustUseProp;
8374Vue.config.isReservedTag = isReservedTag;
8375Vue.config.isReservedAttr = isReservedAttr;
8376Vue.config.getTagNamespace = getTagNamespace;
8377Vue.config.isUnknownElement = isUnknownElement;
8378
8379// install platform runtime directives & components
8380extend(Vue.options.directives, platformDirectives);
8381extend(Vue.options.components, platformComponents);
8382
8383// install platform patch function
8384Vue.prototype.__patch__ = inBrowser ? patch : noop;
8385
8386// public mount method
8387Vue.prototype.$mount = function (
8388 el,
8389 hydrating
8390) {
8391 el = el && inBrowser ? query(el) : undefined;
8392 return mountComponent(this, el, hydrating)
8393};
8394
8395// devtools global hook
8396/* istanbul ignore next */
8397if (inBrowser) {
8398 setTimeout(function () {
8399 if (config.devtools) {
8400 if (devtools) {
8401 devtools.emit('init', Vue);
8402 } else {
8403 console[console.info ? 'info' : 'log'](
8404 'Download the Vue Devtools extension for a better development experience:\n' +
8405 'https://github.com/vuejs/vue-devtools'
8406 );
8407 }
8408 }
8409 if (config.productionTip !== false &&
8410 typeof console !== 'undefined'
8411 ) {
8412 console[console.info ? 'info' : 'log'](
8413 "You are running Vue in development mode.\n" +
8414 "Make sure to turn on production mode when deploying for production.\n" +
8415 "See more tips at https://vuejs.org/guide/deployment.html"
8416 );
8417 }
8418 }, 0);
8419}
8420
8421/* */
8422
8423module.exports = Vue;