UNPKG

222 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.9
3 * (c) 2014-2019 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 // Techinically 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 isStable = slots ? !!slots.$stable : true;
2539 var hasNormalSlots = Object.keys(normalSlots).length > 0;
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 speical 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 vnode = new VNode(
3404 config.parsePlatformTagName(tag), data, children,
3405 undefined, undefined, context
3406 );
3407 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3408 // component
3409 vnode = createComponent(Ctor, data, context, children, tag);
3410 } else {
3411 // unknown or unlisted namespaced elements
3412 // check at runtime because it may get assigned a namespace when its
3413 // parent normalizes children
3414 vnode = new VNode(
3415 tag, data, children,
3416 undefined, undefined, context
3417 );
3418 }
3419 } else {
3420 // direct component options / constructor
3421 vnode = createComponent(tag, data, context, children);
3422 }
3423 if (Array.isArray(vnode)) {
3424 return vnode
3425 } else if (isDef(vnode)) {
3426 if (isDef(ns)) { applyNS(vnode, ns); }
3427 if (isDef(data)) { registerDeepBindings(data); }
3428 return vnode
3429 } else {
3430 return createEmptyVNode()
3431 }
3432}
3433
3434function applyNS (vnode, ns, force) {
3435 vnode.ns = ns;
3436 if (vnode.tag === 'foreignObject') {
3437 // use default namespace inside foreignObject
3438 ns = undefined;
3439 force = true;
3440 }
3441 if (isDef(vnode.children)) {
3442 for (var i = 0, l = vnode.children.length; i < l; i++) {
3443 var child = vnode.children[i];
3444 if (isDef(child.tag) && (
3445 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3446 applyNS(child, ns, force);
3447 }
3448 }
3449 }
3450}
3451
3452// ref #5318
3453// necessary to ensure parent re-render when deep bindings like :style and
3454// :class are used on slot nodes
3455function registerDeepBindings (data) {
3456 if (isObject(data.style)) {
3457 traverse(data.style);
3458 }
3459 if (isObject(data.class)) {
3460 traverse(data.class);
3461 }
3462}
3463
3464/* */
3465
3466function initRender (vm) {
3467 vm._vnode = null; // the root of the child tree
3468 vm._staticTrees = null; // v-once cached trees
3469 var options = vm.$options;
3470 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3471 var renderContext = parentVnode && parentVnode.context;
3472 vm.$slots = resolveSlots(options._renderChildren, renderContext);
3473 vm.$scopedSlots = emptyObject;
3474 // bind the createElement fn to this instance
3475 // so that we get proper render context inside it.
3476 // args order: tag, data, children, normalizationType, alwaysNormalize
3477 // internal version is used by render functions compiled from templates
3478 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3479 // normalization is always applied for the public version, used in
3480 // user-written render functions.
3481 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3482
3483 // $attrs & $listeners are exposed for easier HOC creation.
3484 // they need to be reactive so that HOCs using them are always updated
3485 var parentData = parentVnode && parentVnode.data;
3486
3487 /* istanbul ignore else */
3488 {
3489 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3490 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3491 }, true);
3492 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3493 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3494 }, true);
3495 }
3496}
3497
3498var currentRenderingInstance = null;
3499
3500function renderMixin (Vue) {
3501 // install runtime convenience helpers
3502 installRenderHelpers(Vue.prototype);
3503
3504 Vue.prototype.$nextTick = function (fn) {
3505 return nextTick(fn, this)
3506 };
3507
3508 Vue.prototype._render = function () {
3509 var vm = this;
3510 var ref = vm.$options;
3511 var render = ref.render;
3512 var _parentVnode = ref._parentVnode;
3513
3514 if (_parentVnode) {
3515 vm.$scopedSlots = normalizeScopedSlots(
3516 _parentVnode.data.scopedSlots,
3517 vm.$slots,
3518 vm.$scopedSlots
3519 );
3520 }
3521
3522 // set parent vnode. this allows render functions to have access
3523 // to the data on the placeholder node.
3524 vm.$vnode = _parentVnode;
3525 // render self
3526 var vnode;
3527 try {
3528 // There's no need to maintain a stack becaues all render fns are called
3529 // separately from one another. Nested component's render fns are called
3530 // when parent component is patched.
3531 currentRenderingInstance = vm;
3532 vnode = render.call(vm._renderProxy, vm.$createElement);
3533 } catch (e) {
3534 handleError(e, vm, "render");
3535 // return error render result,
3536 // or previous vnode to prevent render error causing blank component
3537 /* istanbul ignore else */
3538 if (vm.$options.renderError) {
3539 try {
3540 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3541 } catch (e) {
3542 handleError(e, vm, "renderError");
3543 vnode = vm._vnode;
3544 }
3545 } else {
3546 vnode = vm._vnode;
3547 }
3548 } finally {
3549 currentRenderingInstance = null;
3550 }
3551 // if the returned array contains only a single node, allow it
3552 if (Array.isArray(vnode) && vnode.length === 1) {
3553 vnode = vnode[0];
3554 }
3555 // return empty vnode in case the render function errored out
3556 if (!(vnode instanceof VNode)) {
3557 if (Array.isArray(vnode)) {
3558 warn(
3559 'Multiple root nodes returned from render function. Render function ' +
3560 'should return a single root node.',
3561 vm
3562 );
3563 }
3564 vnode = createEmptyVNode();
3565 }
3566 // set parent
3567 vnode.parent = _parentVnode;
3568 return vnode
3569 };
3570}
3571
3572/* */
3573
3574function ensureCtor (comp, base) {
3575 if (
3576 comp.__esModule ||
3577 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3578 ) {
3579 comp = comp.default;
3580 }
3581 return isObject(comp)
3582 ? base.extend(comp)
3583 : comp
3584}
3585
3586function createAsyncPlaceholder (
3587 factory,
3588 data,
3589 context,
3590 children,
3591 tag
3592) {
3593 var node = createEmptyVNode();
3594 node.asyncFactory = factory;
3595 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3596 return node
3597}
3598
3599function resolveAsyncComponent (
3600 factory,
3601 baseCtor
3602) {
3603 if (isTrue(factory.error) && isDef(factory.errorComp)) {
3604 return factory.errorComp
3605 }
3606
3607 if (isDef(factory.resolved)) {
3608 return factory.resolved
3609 }
3610
3611 var owner = currentRenderingInstance;
3612 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3613 // already pending
3614 factory.owners.push(owner);
3615 }
3616
3617 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3618 return factory.loadingComp
3619 }
3620
3621 if (owner && !isDef(factory.owners)) {
3622 var owners = factory.owners = [owner];
3623 var sync = true
3624
3625 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3626
3627 var forceRender = function (renderCompleted) {
3628 for (var i = 0, l = owners.length; i < l; i++) {
3629 (owners[i]).$forceUpdate();
3630 }
3631
3632 if (renderCompleted) {
3633 owners.length = 0;
3634 }
3635 };
3636
3637 var resolve = once(function (res) {
3638 // cache resolved
3639 factory.resolved = ensureCtor(res, baseCtor);
3640 // invoke callbacks only if this is not a synchronous resolve
3641 // (async resolves are shimmed as synchronous during SSR)
3642 if (!sync) {
3643 forceRender(true);
3644 } else {
3645 owners.length = 0;
3646 }
3647 });
3648
3649 var reject = once(function (reason) {
3650 warn(
3651 "Failed to resolve async component: " + (String(factory)) +
3652 (reason ? ("\nReason: " + reason) : '')
3653 );
3654 if (isDef(factory.errorComp)) {
3655 factory.error = true;
3656 forceRender(true);
3657 }
3658 });
3659
3660 var res = factory(resolve, reject);
3661
3662 if (isObject(res)) {
3663 if (isPromise(res)) {
3664 // () => Promise
3665 if (isUndef(factory.resolved)) {
3666 res.then(resolve, reject);
3667 }
3668 } else if (isPromise(res.component)) {
3669 res.component.then(resolve, reject);
3670
3671 if (isDef(res.error)) {
3672 factory.errorComp = ensureCtor(res.error, baseCtor);
3673 }
3674
3675 if (isDef(res.loading)) {
3676 factory.loadingComp = ensureCtor(res.loading, baseCtor);
3677 if (res.delay === 0) {
3678 factory.loading = true;
3679 } else {
3680 setTimeout(function () {
3681 if (isUndef(factory.resolved) && isUndef(factory.error)) {
3682 factory.loading = true;
3683 forceRender(false);
3684 }
3685 }, res.delay || 200);
3686 }
3687 }
3688
3689 if (isDef(res.timeout)) {
3690 setTimeout(function () {
3691 if (isUndef(factory.resolved)) {
3692 reject(
3693 "timeout (" + (res.timeout) + "ms)"
3694 );
3695 }
3696 }, res.timeout);
3697 }
3698 }
3699 }
3700
3701 sync = false;
3702 // return in case resolved synchronously
3703 return factory.loading
3704 ? factory.loadingComp
3705 : factory.resolved
3706 }
3707}
3708
3709/* */
3710
3711function isAsyncPlaceholder (node) {
3712 return node.isComment && node.asyncFactory
3713}
3714
3715/* */
3716
3717function getFirstComponentChild (children) {
3718 if (Array.isArray(children)) {
3719 for (var i = 0; i < children.length; i++) {
3720 var c = children[i];
3721 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3722 return c
3723 }
3724 }
3725 }
3726}
3727
3728/* */
3729
3730/* */
3731
3732function initEvents (vm) {
3733 vm._events = Object.create(null);
3734 vm._hasHookEvent = false;
3735 // init parent attached events
3736 var listeners = vm.$options._parentListeners;
3737 if (listeners) {
3738 updateComponentListeners(vm, listeners);
3739 }
3740}
3741
3742var target;
3743
3744function add (event, fn) {
3745 target.$on(event, fn);
3746}
3747
3748function remove$1 (event, fn) {
3749 target.$off(event, fn);
3750}
3751
3752function createOnceHandler (event, fn) {
3753 var _target = target;
3754 return function onceHandler () {
3755 var res = fn.apply(null, arguments);
3756 if (res !== null) {
3757 _target.$off(event, onceHandler);
3758 }
3759 }
3760}
3761
3762function updateComponentListeners (
3763 vm,
3764 listeners,
3765 oldListeners
3766) {
3767 target = vm;
3768 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3769 target = undefined;
3770}
3771
3772function eventsMixin (Vue) {
3773 var hookRE = /^hook:/;
3774 Vue.prototype.$on = function (event, fn) {
3775 var vm = this;
3776 if (Array.isArray(event)) {
3777 for (var i = 0, l = event.length; i < l; i++) {
3778 vm.$on(event[i], fn);
3779 }
3780 } else {
3781 (vm._events[event] || (vm._events[event] = [])).push(fn);
3782 // optimize hook:event cost by using a boolean flag marked at registration
3783 // instead of a hash lookup
3784 if (hookRE.test(event)) {
3785 vm._hasHookEvent = true;
3786 }
3787 }
3788 return vm
3789 };
3790
3791 Vue.prototype.$once = function (event, fn) {
3792 var vm = this;
3793 function on () {
3794 vm.$off(event, on);
3795 fn.apply(vm, arguments);
3796 }
3797 on.fn = fn;
3798 vm.$on(event, on);
3799 return vm
3800 };
3801
3802 Vue.prototype.$off = function (event, fn) {
3803 var vm = this;
3804 // all
3805 if (!arguments.length) {
3806 vm._events = Object.create(null);
3807 return vm
3808 }
3809 // array of events
3810 if (Array.isArray(event)) {
3811 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3812 vm.$off(event[i$1], fn);
3813 }
3814 return vm
3815 }
3816 // specific event
3817 var cbs = vm._events[event];
3818 if (!cbs) {
3819 return vm
3820 }
3821 if (!fn) {
3822 vm._events[event] = null;
3823 return vm
3824 }
3825 // specific handler
3826 var cb;
3827 var i = cbs.length;
3828 while (i--) {
3829 cb = cbs[i];
3830 if (cb === fn || cb.fn === fn) {
3831 cbs.splice(i, 1);
3832 break
3833 }
3834 }
3835 return vm
3836 };
3837
3838 Vue.prototype.$emit = function (event) {
3839 var vm = this;
3840 {
3841 var lowerCaseEvent = event.toLowerCase();
3842 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3843 tip(
3844 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3845 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3846 "Note that HTML attributes are case-insensitive and you cannot use " +
3847 "v-on to listen to camelCase events when using in-DOM templates. " +
3848 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3849 );
3850 }
3851 }
3852 var cbs = vm._events[event];
3853 if (cbs) {
3854 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3855 var args = toArray(arguments, 1);
3856 var info = "event handler for \"" + event + "\"";
3857 for (var i = 0, l = cbs.length; i < l; i++) {
3858 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3859 }
3860 }
3861 return vm
3862 };
3863}
3864
3865/* */
3866
3867var activeInstance = null;
3868var isUpdatingChildComponent = false;
3869
3870function setActiveInstance(vm) {
3871 var prevActiveInstance = activeInstance;
3872 activeInstance = vm;
3873 return function () {
3874 activeInstance = prevActiveInstance;
3875 }
3876}
3877
3878function initLifecycle (vm) {
3879 var options = vm.$options;
3880
3881 // locate first non-abstract parent
3882 var parent = options.parent;
3883 if (parent && !options.abstract) {
3884 while (parent.$options.abstract && parent.$parent) {
3885 parent = parent.$parent;
3886 }
3887 parent.$children.push(vm);
3888 }
3889
3890 vm.$parent = parent;
3891 vm.$root = parent ? parent.$root : vm;
3892
3893 vm.$children = [];
3894 vm.$refs = {};
3895
3896 vm._watcher = null;
3897 vm._inactive = null;
3898 vm._directInactive = false;
3899 vm._isMounted = false;
3900 vm._isDestroyed = false;
3901 vm._isBeingDestroyed = false;
3902}
3903
3904function lifecycleMixin (Vue) {
3905 Vue.prototype._update = function (vnode, hydrating) {
3906 var vm = this;
3907 var prevEl = vm.$el;
3908 var prevVnode = vm._vnode;
3909 var restoreActiveInstance = setActiveInstance(vm);
3910 vm._vnode = vnode;
3911 // Vue.prototype.__patch__ is injected in entry points
3912 // based on the rendering backend used.
3913 if (!prevVnode) {
3914 // initial render
3915 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3916 } else {
3917 // updates
3918 vm.$el = vm.__patch__(prevVnode, vnode);
3919 }
3920 restoreActiveInstance();
3921 // update __vue__ reference
3922 if (prevEl) {
3923 prevEl.__vue__ = null;
3924 }
3925 if (vm.$el) {
3926 vm.$el.__vue__ = vm;
3927 }
3928 // if parent is an HOC, update its $el as well
3929 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3930 vm.$parent.$el = vm.$el;
3931 }
3932 // updated hook is called by the scheduler to ensure that children are
3933 // updated in a parent's updated hook.
3934 };
3935
3936 Vue.prototype.$forceUpdate = function () {
3937 var vm = this;
3938 if (vm._watcher) {
3939 vm._watcher.update();
3940 }
3941 };
3942
3943 Vue.prototype.$destroy = function () {
3944 var vm = this;
3945 if (vm._isBeingDestroyed) {
3946 return
3947 }
3948 callHook(vm, 'beforeDestroy');
3949 vm._isBeingDestroyed = true;
3950 // remove self from parent
3951 var parent = vm.$parent;
3952 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3953 remove(parent.$children, vm);
3954 }
3955 // teardown watchers
3956 if (vm._watcher) {
3957 vm._watcher.teardown();
3958 }
3959 var i = vm._watchers.length;
3960 while (i--) {
3961 vm._watchers[i].teardown();
3962 }
3963 // remove reference from data ob
3964 // frozen object may not have observer.
3965 if (vm._data.__ob__) {
3966 vm._data.__ob__.vmCount--;
3967 }
3968 // call the last hook...
3969 vm._isDestroyed = true;
3970 // invoke destroy hooks on current rendered tree
3971 vm.__patch__(vm._vnode, null);
3972 // fire destroyed hook
3973 callHook(vm, 'destroyed');
3974 // turn off all instance listeners.
3975 vm.$off();
3976 // remove __vue__ reference
3977 if (vm.$el) {
3978 vm.$el.__vue__ = null;
3979 }
3980 // release circular reference (#6759)
3981 if (vm.$vnode) {
3982 vm.$vnode.parent = null;
3983 }
3984 };
3985}
3986
3987function mountComponent (
3988 vm,
3989 el,
3990 hydrating
3991) {
3992 vm.$el = el;
3993 if (!vm.$options.render) {
3994 vm.$options.render = createEmptyVNode;
3995 {
3996 /* istanbul ignore if */
3997 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
3998 vm.$options.el || el) {
3999 warn(
4000 'You are using the runtime-only build of Vue where the template ' +
4001 'compiler is not available. Either pre-compile the templates into ' +
4002 'render functions, or use the compiler-included build.',
4003 vm
4004 );
4005 } else {
4006 warn(
4007 'Failed to mount component: template or render function not defined.',
4008 vm
4009 );
4010 }
4011 }
4012 }
4013 callHook(vm, 'beforeMount');
4014
4015 var updateComponent;
4016 /* istanbul ignore if */
4017 if (config.performance && mark) {
4018 updateComponent = function () {
4019 var name = vm._name;
4020 var id = vm._uid;
4021 var startTag = "vue-perf-start:" + id;
4022 var endTag = "vue-perf-end:" + id;
4023
4024 mark(startTag);
4025 var vnode = vm._render();
4026 mark(endTag);
4027 measure(("vue " + name + " render"), startTag, endTag);
4028
4029 mark(startTag);
4030 vm._update(vnode, hydrating);
4031 mark(endTag);
4032 measure(("vue " + name + " patch"), startTag, endTag);
4033 };
4034 } else {
4035 updateComponent = function () {
4036 vm._update(vm._render(), hydrating);
4037 };
4038 }
4039
4040 // we set this to vm._watcher inside the watcher's constructor
4041 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4042 // component's mounted hook), which relies on vm._watcher being already defined
4043 new Watcher(vm, updateComponent, noop, {
4044 before: function before () {
4045 if (vm._isMounted && !vm._isDestroyed) {
4046 callHook(vm, 'beforeUpdate');
4047 }
4048 }
4049 }, true /* isRenderWatcher */);
4050 hydrating = false;
4051
4052 // manually mounted instance, call mounted on self
4053 // mounted is called for render-created child components in its inserted hook
4054 if (vm.$vnode == null) {
4055 vm._isMounted = true;
4056 callHook(vm, 'mounted');
4057 }
4058 return vm
4059}
4060
4061function updateChildComponent (
4062 vm,
4063 propsData,
4064 listeners,
4065 parentVnode,
4066 renderChildren
4067) {
4068 {
4069 isUpdatingChildComponent = true;
4070 }
4071
4072 // determine whether component has slot children
4073 // we need to do this before overwriting $options._renderChildren.
4074
4075 // check if there are dynamic scopedSlots (hand-written or compiled but with
4076 // dynamic slot names). Static scoped slots compiled from template has the
4077 // "$stable" marker.
4078 var newScopedSlots = parentVnode.data.scopedSlots;
4079 var oldScopedSlots = vm.$scopedSlots;
4080 var hasDynamicScopedSlot = !!(
4081 (newScopedSlots && !newScopedSlots.$stable) ||
4082 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4083 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4084 );
4085
4086 // Any static slot children from the parent may have changed during parent's
4087 // update. Dynamic scoped slots may also have changed. In such cases, a forced
4088 // update is necessary to ensure correctness.
4089 var needsForceUpdate = !!(
4090 renderChildren || // has new static slots
4091 vm.$options._renderChildren || // has old static slots
4092 hasDynamicScopedSlot
4093 );
4094
4095 vm.$options._parentVnode = parentVnode;
4096 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4097
4098 if (vm._vnode) { // update child tree's parent
4099 vm._vnode.parent = parentVnode;
4100 }
4101 vm.$options._renderChildren = renderChildren;
4102
4103 // update $attrs and $listeners hash
4104 // these are also reactive so they may trigger child update if the child
4105 // used them during render
4106 vm.$attrs = parentVnode.data.attrs || emptyObject;
4107 vm.$listeners = listeners || emptyObject;
4108
4109 // update props
4110 if (propsData && vm.$options.props) {
4111 toggleObserving(false);
4112 var props = vm._props;
4113 var propKeys = vm.$options._propKeys || [];
4114 for (var i = 0; i < propKeys.length; i++) {
4115 var key = propKeys[i];
4116 var propOptions = vm.$options.props; // wtf flow?
4117 props[key] = validateProp(key, propOptions, propsData, vm);
4118 }
4119 toggleObserving(true);
4120 // keep a copy of raw propsData
4121 vm.$options.propsData = propsData;
4122 }
4123
4124 // update listeners
4125 listeners = listeners || emptyObject;
4126 var oldListeners = vm.$options._parentListeners;
4127 vm.$options._parentListeners = listeners;
4128 updateComponentListeners(vm, listeners, oldListeners);
4129
4130 // resolve slots + force update if has children
4131 if (needsForceUpdate) {
4132 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4133 vm.$forceUpdate();
4134 }
4135
4136 {
4137 isUpdatingChildComponent = false;
4138 }
4139}
4140
4141function isInInactiveTree (vm) {
4142 while (vm && (vm = vm.$parent)) {
4143 if (vm._inactive) { return true }
4144 }
4145 return false
4146}
4147
4148function activateChildComponent (vm, direct) {
4149 if (direct) {
4150 vm._directInactive = false;
4151 if (isInInactiveTree(vm)) {
4152 return
4153 }
4154 } else if (vm._directInactive) {
4155 return
4156 }
4157 if (vm._inactive || vm._inactive === null) {
4158 vm._inactive = false;
4159 for (var i = 0; i < vm.$children.length; i++) {
4160 activateChildComponent(vm.$children[i]);
4161 }
4162 callHook(vm, 'activated');
4163 }
4164}
4165
4166function deactivateChildComponent (vm, direct) {
4167 if (direct) {
4168 vm._directInactive = true;
4169 if (isInInactiveTree(vm)) {
4170 return
4171 }
4172 }
4173 if (!vm._inactive) {
4174 vm._inactive = true;
4175 for (var i = 0; i < vm.$children.length; i++) {
4176 deactivateChildComponent(vm.$children[i]);
4177 }
4178 callHook(vm, 'deactivated');
4179 }
4180}
4181
4182function callHook (vm, hook) {
4183 // #7573 disable dep collection when invoking lifecycle hooks
4184 pushTarget();
4185 var handlers = vm.$options[hook];
4186 var info = hook + " hook";
4187 if (handlers) {
4188 for (var i = 0, j = handlers.length; i < j; i++) {
4189 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4190 }
4191 }
4192 if (vm._hasHookEvent) {
4193 vm.$emit('hook:' + hook);
4194 }
4195 popTarget();
4196}
4197
4198/* */
4199
4200var MAX_UPDATE_COUNT = 100;
4201
4202var queue = [];
4203var activatedChildren = [];
4204var has = {};
4205var circular = {};
4206var waiting = false;
4207var flushing = false;
4208var index = 0;
4209
4210/**
4211 * Reset the scheduler's state.
4212 */
4213function resetSchedulerState () {
4214 index = queue.length = activatedChildren.length = 0;
4215 has = {};
4216 {
4217 circular = {};
4218 }
4219 waiting = flushing = false;
4220}
4221
4222// Async edge case #6566 requires saving the timestamp when event listeners are
4223// attached. However, calling performance.now() has a perf overhead especially
4224// if the page has thousands of event listeners. Instead, we take a timestamp
4225// every time the scheduler flushes and use that for all event listeners
4226// attached during that flush.
4227var currentFlushTimestamp = 0;
4228
4229// Async edge case fix requires storing an event listener's attach timestamp.
4230var getNow = Date.now;
4231
4232// Determine what event timestamp the browser is using. Annoyingly, the
4233// timestamp can either be hi-res (relative to page load) or low-res
4234// (relative to UNIX epoch), so in order to compare time we have to use the
4235// same timestamp type when saving the flush timestamp.
4236if (
4237 inBrowser &&
4238 window.performance &&
4239 typeof performance.now === 'function' &&
4240 document.createEvent('Event').timeStamp <= performance.now()
4241) {
4242 // if the event timestamp is bigger than the hi-res timestamp
4243 // (which is evaluated AFTER) it means the event is using a lo-res timestamp,
4244 // and we need to use the lo-res version for event listeners as well.
4245 getNow = function () { return performance.now(); };
4246}
4247
4248/**
4249 * Flush both queues and run the watchers.
4250 */
4251function flushSchedulerQueue () {
4252 currentFlushTimestamp = getNow();
4253 flushing = true;
4254 var watcher, id;
4255
4256 // Sort queue before flush.
4257 // This ensures that:
4258 // 1. Components are updated from parent to child. (because parent is always
4259 // created before the child)
4260 // 2. A component's user watchers are run before its render watcher (because
4261 // user watchers are created before the render watcher)
4262 // 3. If a component is destroyed during a parent component's watcher run,
4263 // its watchers can be skipped.
4264 queue.sort(function (a, b) { return a.id - b.id; });
4265
4266 // do not cache length because more watchers might be pushed
4267 // as we run existing watchers
4268 for (index = 0; index < queue.length; index++) {
4269 watcher = queue[index];
4270 if (watcher.before) {
4271 watcher.before();
4272 }
4273 id = watcher.id;
4274 has[id] = null;
4275 watcher.run();
4276 // in dev build, check and stop circular updates.
4277 if (has[id] != null) {
4278 circular[id] = (circular[id] || 0) + 1;
4279 if (circular[id] > MAX_UPDATE_COUNT) {
4280 warn(
4281 'You may have an infinite update loop ' + (
4282 watcher.user
4283 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4284 : "in a component render function."
4285 ),
4286 watcher.vm
4287 );
4288 break
4289 }
4290 }
4291 }
4292
4293 // keep copies of post queues before resetting state
4294 var activatedQueue = activatedChildren.slice();
4295 var updatedQueue = queue.slice();
4296
4297 resetSchedulerState();
4298
4299 // call component updated and activated hooks
4300 callActivatedHooks(activatedQueue);
4301 callUpdatedHooks(updatedQueue);
4302
4303 // devtool hook
4304 /* istanbul ignore if */
4305 if (devtools && config.devtools) {
4306 devtools.emit('flush');
4307 }
4308}
4309
4310function callUpdatedHooks (queue) {
4311 var i = queue.length;
4312 while (i--) {
4313 var watcher = queue[i];
4314 var vm = watcher.vm;
4315 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4316 callHook(vm, 'updated');
4317 }
4318 }
4319}
4320
4321/**
4322 * Queue a kept-alive component that was activated during patch.
4323 * The queue will be processed after the entire tree has been patched.
4324 */
4325function queueActivatedComponent (vm) {
4326 // setting _inactive to false here so that a render function can
4327 // rely on checking whether it's in an inactive tree (e.g. router-view)
4328 vm._inactive = false;
4329 activatedChildren.push(vm);
4330}
4331
4332function callActivatedHooks (queue) {
4333 for (var i = 0; i < queue.length; i++) {
4334 queue[i]._inactive = true;
4335 activateChildComponent(queue[i], true /* true */);
4336 }
4337}
4338
4339/**
4340 * Push a watcher into the watcher queue.
4341 * Jobs with duplicate IDs will be skipped unless it's
4342 * pushed when the queue is being flushed.
4343 */
4344function queueWatcher (watcher) {
4345 var id = watcher.id;
4346 if (has[id] == null) {
4347 has[id] = true;
4348 if (!flushing) {
4349 queue.push(watcher);
4350 } else {
4351 // if already flushing, splice the watcher based on its id
4352 // if already past its id, it will be run next immediately.
4353 var i = queue.length - 1;
4354 while (i > index && queue[i].id > watcher.id) {
4355 i--;
4356 }
4357 queue.splice(i + 1, 0, watcher);
4358 }
4359 // queue the flush
4360 if (!waiting) {
4361 waiting = true;
4362
4363 if (!config.async) {
4364 flushSchedulerQueue();
4365 return
4366 }
4367 nextTick(flushSchedulerQueue);
4368 }
4369 }
4370}
4371
4372/* */
4373
4374
4375
4376var uid$2 = 0;
4377
4378/**
4379 * A watcher parses an expression, collects dependencies,
4380 * and fires callback when the expression value changes.
4381 * This is used for both the $watch() api and directives.
4382 */
4383var Watcher = function Watcher (
4384 vm,
4385 expOrFn,
4386 cb,
4387 options,
4388 isRenderWatcher
4389) {
4390 this.vm = vm;
4391 if (isRenderWatcher) {
4392 vm._watcher = this;
4393 }
4394 vm._watchers.push(this);
4395 // options
4396 if (options) {
4397 this.deep = !!options.deep;
4398 this.user = !!options.user;
4399 this.lazy = !!options.lazy;
4400 this.sync = !!options.sync;
4401 this.before = options.before;
4402 } else {
4403 this.deep = this.user = this.lazy = this.sync = false;
4404 }
4405 this.cb = cb;
4406 this.id = ++uid$2; // uid for batching
4407 this.active = true;
4408 this.dirty = this.lazy; // for lazy watchers
4409 this.deps = [];
4410 this.newDeps = [];
4411 this.depIds = new _Set();
4412 this.newDepIds = new _Set();
4413 this.expression = expOrFn.toString();
4414 // parse expression for getter
4415 if (typeof expOrFn === 'function') {
4416 this.getter = expOrFn;
4417 } else {
4418 this.getter = parsePath(expOrFn);
4419 if (!this.getter) {
4420 this.getter = noop;
4421 warn(
4422 "Failed watching path: \"" + expOrFn + "\" " +
4423 'Watcher only accepts simple dot-delimited paths. ' +
4424 'For full control, use a function instead.',
4425 vm
4426 );
4427 }
4428 }
4429 this.value = this.lazy
4430 ? undefined
4431 : this.get();
4432};
4433
4434/**
4435 * Evaluate the getter, and re-collect dependencies.
4436 */
4437Watcher.prototype.get = function get () {
4438 pushTarget(this);
4439 var value;
4440 var vm = this.vm;
4441 try {
4442 value = this.getter.call(vm, vm);
4443 } catch (e) {
4444 if (this.user) {
4445 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4446 } else {
4447 throw e
4448 }
4449 } finally {
4450 // "touch" every property so they are all tracked as
4451 // dependencies for deep watching
4452 if (this.deep) {
4453 traverse(value);
4454 }
4455 popTarget();
4456 this.cleanupDeps();
4457 }
4458 return value
4459};
4460
4461/**
4462 * Add a dependency to this directive.
4463 */
4464Watcher.prototype.addDep = function addDep (dep) {
4465 var id = dep.id;
4466 if (!this.newDepIds.has(id)) {
4467 this.newDepIds.add(id);
4468 this.newDeps.push(dep);
4469 if (!this.depIds.has(id)) {
4470 dep.addSub(this);
4471 }
4472 }
4473};
4474
4475/**
4476 * Clean up for dependency collection.
4477 */
4478Watcher.prototype.cleanupDeps = function cleanupDeps () {
4479 var i = this.deps.length;
4480 while (i--) {
4481 var dep = this.deps[i];
4482 if (!this.newDepIds.has(dep.id)) {
4483 dep.removeSub(this);
4484 }
4485 }
4486 var tmp = this.depIds;
4487 this.depIds = this.newDepIds;
4488 this.newDepIds = tmp;
4489 this.newDepIds.clear();
4490 tmp = this.deps;
4491 this.deps = this.newDeps;
4492 this.newDeps = tmp;
4493 this.newDeps.length = 0;
4494};
4495
4496/**
4497 * Subscriber interface.
4498 * Will be called when a dependency changes.
4499 */
4500Watcher.prototype.update = function update () {
4501 /* istanbul ignore else */
4502 if (this.lazy) {
4503 this.dirty = true;
4504 } else if (this.sync) {
4505 this.run();
4506 } else {
4507 queueWatcher(this);
4508 }
4509};
4510
4511/**
4512 * Scheduler job interface.
4513 * Will be called by the scheduler.
4514 */
4515Watcher.prototype.run = function run () {
4516 if (this.active) {
4517 var value = this.get();
4518 if (
4519 value !== this.value ||
4520 // Deep watchers and watchers on Object/Arrays should fire even
4521 // when the value is the same, because the value may
4522 // have mutated.
4523 isObject(value) ||
4524 this.deep
4525 ) {
4526 // set new value
4527 var oldValue = this.value;
4528 this.value = value;
4529 if (this.user) {
4530 try {
4531 this.cb.call(this.vm, value, oldValue);
4532 } catch (e) {
4533 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4534 }
4535 } else {
4536 this.cb.call(this.vm, value, oldValue);
4537 }
4538 }
4539 }
4540};
4541
4542/**
4543 * Evaluate the value of the watcher.
4544 * This only gets called for lazy watchers.
4545 */
4546Watcher.prototype.evaluate = function evaluate () {
4547 this.value = this.get();
4548 this.dirty = false;
4549};
4550
4551/**
4552 * Depend on all deps collected by this watcher.
4553 */
4554Watcher.prototype.depend = function depend () {
4555 var i = this.deps.length;
4556 while (i--) {
4557 this.deps[i].depend();
4558 }
4559};
4560
4561/**
4562 * Remove self from all dependencies' subscriber list.
4563 */
4564Watcher.prototype.teardown = function teardown () {
4565 if (this.active) {
4566 // remove self from vm's watcher list
4567 // this is a somewhat expensive operation so we skip it
4568 // if the vm is being destroyed.
4569 if (!this.vm._isBeingDestroyed) {
4570 remove(this.vm._watchers, this);
4571 }
4572 var i = this.deps.length;
4573 while (i--) {
4574 this.deps[i].removeSub(this);
4575 }
4576 this.active = false;
4577 }
4578};
4579
4580/* */
4581
4582var sharedPropertyDefinition = {
4583 enumerable: true,
4584 configurable: true,
4585 get: noop,
4586 set: noop
4587};
4588
4589function proxy (target, sourceKey, key) {
4590 sharedPropertyDefinition.get = function proxyGetter () {
4591 return this[sourceKey][key]
4592 };
4593 sharedPropertyDefinition.set = function proxySetter (val) {
4594 this[sourceKey][key] = val;
4595 };
4596 Object.defineProperty(target, key, sharedPropertyDefinition);
4597}
4598
4599function initState (vm) {
4600 vm._watchers = [];
4601 var opts = vm.$options;
4602 if (opts.props) { initProps(vm, opts.props); }
4603 if (opts.methods) { initMethods(vm, opts.methods); }
4604 if (opts.data) {
4605 initData(vm);
4606 } else {
4607 observe(vm._data = {}, true /* asRootData */);
4608 }
4609 if (opts.computed) { initComputed(vm, opts.computed); }
4610 if (opts.watch && opts.watch !== nativeWatch) {
4611 initWatch(vm, opts.watch);
4612 }
4613}
4614
4615function initProps (vm, propsOptions) {
4616 var propsData = vm.$options.propsData || {};
4617 var props = vm._props = {};
4618 // cache prop keys so that future props updates can iterate using Array
4619 // instead of dynamic object key enumeration.
4620 var keys = vm.$options._propKeys = [];
4621 var isRoot = !vm.$parent;
4622 // root instance props should be converted
4623 if (!isRoot) {
4624 toggleObserving(false);
4625 }
4626 var loop = function ( key ) {
4627 keys.push(key);
4628 var value = validateProp(key, propsOptions, propsData, vm);
4629 /* istanbul ignore else */
4630 {
4631 var hyphenatedKey = hyphenate(key);
4632 if (isReservedAttribute(hyphenatedKey) ||
4633 config.isReservedAttr(hyphenatedKey)) {
4634 warn(
4635 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4636 vm
4637 );
4638 }
4639 defineReactive$$1(props, key, value, function () {
4640 if (!isRoot && !isUpdatingChildComponent) {
4641 warn(
4642 "Avoid mutating a prop directly since the value will be " +
4643 "overwritten whenever the parent component re-renders. " +
4644 "Instead, use a data or computed property based on the prop's " +
4645 "value. Prop being mutated: \"" + key + "\"",
4646 vm
4647 );
4648 }
4649 });
4650 }
4651 // static props are already proxied on the component's prototype
4652 // during Vue.extend(). We only need to proxy props defined at
4653 // instantiation here.
4654 if (!(key in vm)) {
4655 proxy(vm, "_props", key);
4656 }
4657 };
4658
4659 for (var key in propsOptions) loop( key );
4660 toggleObserving(true);
4661}
4662
4663function initData (vm) {
4664 var data = vm.$options.data;
4665 data = vm._data = typeof data === 'function'
4666 ? getData(data, vm)
4667 : data || {};
4668 if (!isPlainObject(data)) {
4669 data = {};
4670 warn(
4671 'data functions should return an object:\n' +
4672 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4673 vm
4674 );
4675 }
4676 // proxy data on instance
4677 var keys = Object.keys(data);
4678 var props = vm.$options.props;
4679 var methods = vm.$options.methods;
4680 var i = keys.length;
4681 while (i--) {
4682 var key = keys[i];
4683 {
4684 if (methods && hasOwn(methods, key)) {
4685 warn(
4686 ("Method \"" + key + "\" has already been defined as a data property."),
4687 vm
4688 );
4689 }
4690 }
4691 if (props && hasOwn(props, key)) {
4692 warn(
4693 "The data property \"" + key + "\" is already declared as a prop. " +
4694 "Use prop default value instead.",
4695 vm
4696 );
4697 } else if (!isReserved(key)) {
4698 proxy(vm, "_data", key);
4699 }
4700 }
4701 // observe data
4702 observe(data, true /* asRootData */);
4703}
4704
4705function getData (data, vm) {
4706 // #7573 disable dep collection when invoking data getters
4707 pushTarget();
4708 try {
4709 return data.call(vm, vm)
4710 } catch (e) {
4711 handleError(e, vm, "data()");
4712 return {}
4713 } finally {
4714 popTarget();
4715 }
4716}
4717
4718var computedWatcherOptions = { lazy: true };
4719
4720function initComputed (vm, computed) {
4721 // $flow-disable-line
4722 var watchers = vm._computedWatchers = Object.create(null);
4723 // computed properties are just getters during SSR
4724 var isSSR = isServerRendering();
4725
4726 for (var key in computed) {
4727 var userDef = computed[key];
4728 var getter = typeof userDef === 'function' ? userDef : userDef.get;
4729 if (getter == null) {
4730 warn(
4731 ("Getter is missing for computed property \"" + key + "\"."),
4732 vm
4733 );
4734 }
4735
4736 if (!isSSR) {
4737 // create internal watcher for the computed property.
4738 watchers[key] = new Watcher(
4739 vm,
4740 getter || noop,
4741 noop,
4742 computedWatcherOptions
4743 );
4744 }
4745
4746 // component-defined computed properties are already defined on the
4747 // component prototype. We only need to define computed properties defined
4748 // at instantiation here.
4749 if (!(key in vm)) {
4750 defineComputed(vm, key, userDef);
4751 } else {
4752 if (key in vm.$data) {
4753 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4754 } else if (vm.$options.props && key in vm.$options.props) {
4755 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4756 }
4757 }
4758 }
4759}
4760
4761function defineComputed (
4762 target,
4763 key,
4764 userDef
4765) {
4766 var shouldCache = !isServerRendering();
4767 if (typeof userDef === 'function') {
4768 sharedPropertyDefinition.get = shouldCache
4769 ? createComputedGetter(key)
4770 : createGetterInvoker(userDef);
4771 sharedPropertyDefinition.set = noop;
4772 } else {
4773 sharedPropertyDefinition.get = userDef.get
4774 ? shouldCache && userDef.cache !== false
4775 ? createComputedGetter(key)
4776 : createGetterInvoker(userDef.get)
4777 : noop;
4778 sharedPropertyDefinition.set = userDef.set || noop;
4779 }
4780 if (sharedPropertyDefinition.set === noop) {
4781 sharedPropertyDefinition.set = function () {
4782 warn(
4783 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4784 this
4785 );
4786 };
4787 }
4788 Object.defineProperty(target, key, sharedPropertyDefinition);
4789}
4790
4791function createComputedGetter (key) {
4792 return function computedGetter () {
4793 var watcher = this._computedWatchers && this._computedWatchers[key];
4794 if (watcher) {
4795 if (watcher.dirty) {
4796 watcher.evaluate();
4797 }
4798 if (Dep.target) {
4799 watcher.depend();
4800 }
4801 return watcher.value
4802 }
4803 }
4804}
4805
4806function createGetterInvoker(fn) {
4807 return function computedGetter () {
4808 return fn.call(this, this)
4809 }
4810}
4811
4812function initMethods (vm, methods) {
4813 var props = vm.$options.props;
4814 for (var key in methods) {
4815 {
4816 if (typeof methods[key] !== 'function') {
4817 warn(
4818 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4819 "Did you reference the function correctly?",
4820 vm
4821 );
4822 }
4823 if (props && hasOwn(props, key)) {
4824 warn(
4825 ("Method \"" + key + "\" has already been defined as a prop."),
4826 vm
4827 );
4828 }
4829 if ((key in vm) && isReserved(key)) {
4830 warn(
4831 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4832 "Avoid defining component methods that start with _ or $."
4833 );
4834 }
4835 }
4836 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4837 }
4838}
4839
4840function initWatch (vm, watch) {
4841 for (var key in watch) {
4842 var handler = watch[key];
4843 if (Array.isArray(handler)) {
4844 for (var i = 0; i < handler.length; i++) {
4845 createWatcher(vm, key, handler[i]);
4846 }
4847 } else {
4848 createWatcher(vm, key, handler);
4849 }
4850 }
4851}
4852
4853function createWatcher (
4854 vm,
4855 expOrFn,
4856 handler,
4857 options
4858) {
4859 if (isPlainObject(handler)) {
4860 options = handler;
4861 handler = handler.handler;
4862 }
4863 if (typeof handler === 'string') {
4864 handler = vm[handler];
4865 }
4866 return vm.$watch(expOrFn, handler, options)
4867}
4868
4869function stateMixin (Vue) {
4870 // flow somehow has problems with directly declared definition object
4871 // when using Object.defineProperty, so we have to procedurally build up
4872 // the object here.
4873 var dataDef = {};
4874 dataDef.get = function () { return this._data };
4875 var propsDef = {};
4876 propsDef.get = function () { return this._props };
4877 {
4878 dataDef.set = function () {
4879 warn(
4880 'Avoid replacing instance root $data. ' +
4881 'Use nested data properties instead.',
4882 this
4883 );
4884 };
4885 propsDef.set = function () {
4886 warn("$props is readonly.", this);
4887 };
4888 }
4889 Object.defineProperty(Vue.prototype, '$data', dataDef);
4890 Object.defineProperty(Vue.prototype, '$props', propsDef);
4891
4892 Vue.prototype.$set = set;
4893 Vue.prototype.$delete = del;
4894
4895 Vue.prototype.$watch = function (
4896 expOrFn,
4897 cb,
4898 options
4899 ) {
4900 var vm = this;
4901 if (isPlainObject(cb)) {
4902 return createWatcher(vm, expOrFn, cb, options)
4903 }
4904 options = options || {};
4905 options.user = true;
4906 var watcher = new Watcher(vm, expOrFn, cb, options);
4907 if (options.immediate) {
4908 try {
4909 cb.call(vm, watcher.value);
4910 } catch (error) {
4911 handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4912 }
4913 }
4914 return function unwatchFn () {
4915 watcher.teardown();
4916 }
4917 };
4918}
4919
4920/* */
4921
4922var uid$3 = 0;
4923
4924function initMixin (Vue) {
4925 Vue.prototype._init = function (options) {
4926 var vm = this;
4927 // a uid
4928 vm._uid = uid$3++;
4929
4930 var startTag, endTag;
4931 /* istanbul ignore if */
4932 if (config.performance && mark) {
4933 startTag = "vue-perf-start:" + (vm._uid);
4934 endTag = "vue-perf-end:" + (vm._uid);
4935 mark(startTag);
4936 }
4937
4938 // a flag to avoid this being observed
4939 vm._isVue = true;
4940 // merge options
4941 if (options && options._isComponent) {
4942 // optimize internal component instantiation
4943 // since dynamic options merging is pretty slow, and none of the
4944 // internal component options needs special treatment.
4945 initInternalComponent(vm, options);
4946 } else {
4947 vm.$options = mergeOptions(
4948 resolveConstructorOptions(vm.constructor),
4949 options || {},
4950 vm
4951 );
4952 }
4953 /* istanbul ignore else */
4954 {
4955 initProxy(vm);
4956 }
4957 // expose real self
4958 vm._self = vm;
4959 initLifecycle(vm);
4960 initEvents(vm);
4961 initRender(vm);
4962 callHook(vm, 'beforeCreate');
4963 initInjections(vm); // resolve injections before data/props
4964 initState(vm);
4965 initProvide(vm); // resolve provide after data/props
4966 callHook(vm, 'created');
4967
4968 /* istanbul ignore if */
4969 if (config.performance && mark) {
4970 vm._name = formatComponentName(vm, false);
4971 mark(endTag);
4972 measure(("vue " + (vm._name) + " init"), startTag, endTag);
4973 }
4974
4975 if (vm.$options.el) {
4976 vm.$mount(vm.$options.el);
4977 }
4978 };
4979}
4980
4981function initInternalComponent (vm, options) {
4982 var opts = vm.$options = Object.create(vm.constructor.options);
4983 // doing this because it's faster than dynamic enumeration.
4984 var parentVnode = options._parentVnode;
4985 opts.parent = options.parent;
4986 opts._parentVnode = parentVnode;
4987
4988 var vnodeComponentOptions = parentVnode.componentOptions;
4989 opts.propsData = vnodeComponentOptions.propsData;
4990 opts._parentListeners = vnodeComponentOptions.listeners;
4991 opts._renderChildren = vnodeComponentOptions.children;
4992 opts._componentTag = vnodeComponentOptions.tag;
4993
4994 if (options.render) {
4995 opts.render = options.render;
4996 opts.staticRenderFns = options.staticRenderFns;
4997 }
4998}
4999
5000function resolveConstructorOptions (Ctor) {
5001 var options = Ctor.options;
5002 if (Ctor.super) {
5003 var superOptions = resolveConstructorOptions(Ctor.super);
5004 var cachedSuperOptions = Ctor.superOptions;
5005 if (superOptions !== cachedSuperOptions) {
5006 // super option changed,
5007 // need to resolve new options.
5008 Ctor.superOptions = superOptions;
5009 // check if there are any late-modified/attached options (#4976)
5010 var modifiedOptions = resolveModifiedOptions(Ctor);
5011 // update base extend options
5012 if (modifiedOptions) {
5013 extend(Ctor.extendOptions, modifiedOptions);
5014 }
5015 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5016 if (options.name) {
5017 options.components[options.name] = Ctor;
5018 }
5019 }
5020 }
5021 return options
5022}
5023
5024function resolveModifiedOptions (Ctor) {
5025 var modified;
5026 var latest = Ctor.options;
5027 var sealed = Ctor.sealedOptions;
5028 for (var key in latest) {
5029 if (latest[key] !== sealed[key]) {
5030 if (!modified) { modified = {}; }
5031 modified[key] = latest[key];
5032 }
5033 }
5034 return modified
5035}
5036
5037function Vue (options) {
5038 if (!(this instanceof Vue)
5039 ) {
5040 warn('Vue is a constructor and should be called with the `new` keyword');
5041 }
5042 this._init(options);
5043}
5044
5045initMixin(Vue);
5046stateMixin(Vue);
5047eventsMixin(Vue);
5048lifecycleMixin(Vue);
5049renderMixin(Vue);
5050
5051/* */
5052
5053function initUse (Vue) {
5054 Vue.use = function (plugin) {
5055 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5056 if (installedPlugins.indexOf(plugin) > -1) {
5057 return this
5058 }
5059
5060 // additional parameters
5061 var args = toArray(arguments, 1);
5062 args.unshift(this);
5063 if (typeof plugin.install === 'function') {
5064 plugin.install.apply(plugin, args);
5065 } else if (typeof plugin === 'function') {
5066 plugin.apply(null, args);
5067 }
5068 installedPlugins.push(plugin);
5069 return this
5070 };
5071}
5072
5073/* */
5074
5075function initMixin$1 (Vue) {
5076 Vue.mixin = function (mixin) {
5077 this.options = mergeOptions(this.options, mixin);
5078 return this
5079 };
5080}
5081
5082/* */
5083
5084function initExtend (Vue) {
5085 /**
5086 * Each instance constructor, including Vue, has a unique
5087 * cid. This enables us to create wrapped "child
5088 * constructors" for prototypal inheritance and cache them.
5089 */
5090 Vue.cid = 0;
5091 var cid = 1;
5092
5093 /**
5094 * Class inheritance
5095 */
5096 Vue.extend = function (extendOptions) {
5097 extendOptions = extendOptions || {};
5098 var Super = this;
5099 var SuperId = Super.cid;
5100 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5101 if (cachedCtors[SuperId]) {
5102 return cachedCtors[SuperId]
5103 }
5104
5105 var name = extendOptions.name || Super.options.name;
5106 if (name) {
5107 validateComponentName(name);
5108 }
5109
5110 var Sub = function VueComponent (options) {
5111 this._init(options);
5112 };
5113 Sub.prototype = Object.create(Super.prototype);
5114 Sub.prototype.constructor = Sub;
5115 Sub.cid = cid++;
5116 Sub.options = mergeOptions(
5117 Super.options,
5118 extendOptions
5119 );
5120 Sub['super'] = Super;
5121
5122 // For props and computed properties, we define the proxy getters on
5123 // the Vue instances at extension time, on the extended prototype. This
5124 // avoids Object.defineProperty calls for each instance created.
5125 if (Sub.options.props) {
5126 initProps$1(Sub);
5127 }
5128 if (Sub.options.computed) {
5129 initComputed$1(Sub);
5130 }
5131
5132 // allow further extension/mixin/plugin usage
5133 Sub.extend = Super.extend;
5134 Sub.mixin = Super.mixin;
5135 Sub.use = Super.use;
5136
5137 // create asset registers, so extended classes
5138 // can have their private assets too.
5139 ASSET_TYPES.forEach(function (type) {
5140 Sub[type] = Super[type];
5141 });
5142 // enable recursive self-lookup
5143 if (name) {
5144 Sub.options.components[name] = Sub;
5145 }
5146
5147 // keep a reference to the super options at extension time.
5148 // later at instantiation we can check if Super's options have
5149 // been updated.
5150 Sub.superOptions = Super.options;
5151 Sub.extendOptions = extendOptions;
5152 Sub.sealedOptions = extend({}, Sub.options);
5153
5154 // cache constructor
5155 cachedCtors[SuperId] = Sub;
5156 return Sub
5157 };
5158}
5159
5160function initProps$1 (Comp) {
5161 var props = Comp.options.props;
5162 for (var key in props) {
5163 proxy(Comp.prototype, "_props", key);
5164 }
5165}
5166
5167function initComputed$1 (Comp) {
5168 var computed = Comp.options.computed;
5169 for (var key in computed) {
5170 defineComputed(Comp.prototype, key, computed[key]);
5171 }
5172}
5173
5174/* */
5175
5176function initAssetRegisters (Vue) {
5177 /**
5178 * Create asset registration methods.
5179 */
5180 ASSET_TYPES.forEach(function (type) {
5181 Vue[type] = function (
5182 id,
5183 definition
5184 ) {
5185 if (!definition) {
5186 return this.options[type + 's'][id]
5187 } else {
5188 /* istanbul ignore if */
5189 if (type === 'component') {
5190 validateComponentName(id);
5191 }
5192 if (type === 'component' && isPlainObject(definition)) {
5193 definition.name = definition.name || id;
5194 definition = this.options._base.extend(definition);
5195 }
5196 if (type === 'directive' && typeof definition === 'function') {
5197 definition = { bind: definition, update: definition };
5198 }
5199 this.options[type + 's'][id] = definition;
5200 return definition
5201 }
5202 };
5203 });
5204}
5205
5206/* */
5207
5208
5209
5210function getComponentName (opts) {
5211 return opts && (opts.Ctor.options.name || opts.tag)
5212}
5213
5214function matches (pattern, name) {
5215 if (Array.isArray(pattern)) {
5216 return pattern.indexOf(name) > -1
5217 } else if (typeof pattern === 'string') {
5218 return pattern.split(',').indexOf(name) > -1
5219 } else if (isRegExp(pattern)) {
5220 return pattern.test(name)
5221 }
5222 /* istanbul ignore next */
5223 return false
5224}
5225
5226function pruneCache (keepAliveInstance, filter) {
5227 var cache = keepAliveInstance.cache;
5228 var keys = keepAliveInstance.keys;
5229 var _vnode = keepAliveInstance._vnode;
5230 for (var key in cache) {
5231 var cachedNode = cache[key];
5232 if (cachedNode) {
5233 var name = getComponentName(cachedNode.componentOptions);
5234 if (name && !filter(name)) {
5235 pruneCacheEntry(cache, key, keys, _vnode);
5236 }
5237 }
5238 }
5239}
5240
5241function pruneCacheEntry (
5242 cache,
5243 key,
5244 keys,
5245 current
5246) {
5247 var cached$$1 = cache[key];
5248 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5249 cached$$1.componentInstance.$destroy();
5250 }
5251 cache[key] = null;
5252 remove(keys, key);
5253}
5254
5255var patternTypes = [String, RegExp, Array];
5256
5257var KeepAlive = {
5258 name: 'keep-alive',
5259 abstract: true,
5260
5261 props: {
5262 include: patternTypes,
5263 exclude: patternTypes,
5264 max: [String, Number]
5265 },
5266
5267 created: function created () {
5268 this.cache = Object.create(null);
5269 this.keys = [];
5270 },
5271
5272 destroyed: function destroyed () {
5273 for (var key in this.cache) {
5274 pruneCacheEntry(this.cache, key, this.keys);
5275 }
5276 },
5277
5278 mounted: function mounted () {
5279 var this$1 = this;
5280
5281 this.$watch('include', function (val) {
5282 pruneCache(this$1, function (name) { return matches(val, name); });
5283 });
5284 this.$watch('exclude', function (val) {
5285 pruneCache(this$1, function (name) { return !matches(val, name); });
5286 });
5287 },
5288
5289 render: function render () {
5290 var slot = this.$slots.default;
5291 var vnode = getFirstComponentChild(slot);
5292 var componentOptions = vnode && vnode.componentOptions;
5293 if (componentOptions) {
5294 // check pattern
5295 var name = getComponentName(componentOptions);
5296 var ref = this;
5297 var include = ref.include;
5298 var exclude = ref.exclude;
5299 if (
5300 // not included
5301 (include && (!name || !matches(include, name))) ||
5302 // excluded
5303 (exclude && name && matches(exclude, name))
5304 ) {
5305 return vnode
5306 }
5307
5308 var ref$1 = this;
5309 var cache = ref$1.cache;
5310 var keys = ref$1.keys;
5311 var key = vnode.key == null
5312 // same constructor may get registered as different local components
5313 // so cid alone is not enough (#3269)
5314 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5315 : vnode.key;
5316 if (cache[key]) {
5317 vnode.componentInstance = cache[key].componentInstance;
5318 // make current key freshest
5319 remove(keys, key);
5320 keys.push(key);
5321 } else {
5322 cache[key] = vnode;
5323 keys.push(key);
5324 // prune oldest entry
5325 if (this.max && keys.length > parseInt(this.max)) {
5326 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5327 }
5328 }
5329
5330 vnode.data.keepAlive = true;
5331 }
5332 return vnode || (slot && slot[0])
5333 }
5334};
5335
5336var builtInComponents = {
5337 KeepAlive: KeepAlive
5338};
5339
5340/* */
5341
5342function initGlobalAPI (Vue) {
5343 // config
5344 var configDef = {};
5345 configDef.get = function () { return config; };
5346 {
5347 configDef.set = function () {
5348 warn(
5349 'Do not replace the Vue.config object, set individual fields instead.'
5350 );
5351 };
5352 }
5353 Object.defineProperty(Vue, 'config', configDef);
5354
5355 // exposed util methods.
5356 // NOTE: these are not considered part of the public API - avoid relying on
5357 // them unless you are aware of the risk.
5358 Vue.util = {
5359 warn: warn,
5360 extend: extend,
5361 mergeOptions: mergeOptions,
5362 defineReactive: defineReactive$$1
5363 };
5364
5365 Vue.set = set;
5366 Vue.delete = del;
5367 Vue.nextTick = nextTick;
5368
5369 // 2.6 explicit observable API
5370 Vue.observable = function (obj) {
5371 observe(obj);
5372 return obj
5373 };
5374
5375 Vue.options = Object.create(null);
5376 ASSET_TYPES.forEach(function (type) {
5377 Vue.options[type + 's'] = Object.create(null);
5378 });
5379
5380 // this is used to identify the "base" constructor to extend all plain-object
5381 // components with in Weex's multi-instance scenarios.
5382 Vue.options._base = Vue;
5383
5384 extend(Vue.options.components, builtInComponents);
5385
5386 initUse(Vue);
5387 initMixin$1(Vue);
5388 initExtend(Vue);
5389 initAssetRegisters(Vue);
5390}
5391
5392initGlobalAPI(Vue);
5393
5394Object.defineProperty(Vue.prototype, '$isServer', {
5395 get: isServerRendering
5396});
5397
5398Object.defineProperty(Vue.prototype, '$ssrContext', {
5399 get: function get () {
5400 /* istanbul ignore next */
5401 return this.$vnode && this.$vnode.ssrContext
5402 }
5403});
5404
5405// expose FunctionalRenderContext for ssr runtime helper installation
5406Object.defineProperty(Vue, 'FunctionalRenderContext', {
5407 value: FunctionalRenderContext
5408});
5409
5410Vue.version = '2.6.9';
5411
5412/* */
5413
5414// these are reserved for web because they are directly compiled away
5415// during template compilation
5416var isReservedAttr = makeMap('style,class');
5417
5418// attributes that should be using props for binding
5419var acceptValue = makeMap('input,textarea,option,select,progress');
5420var mustUseProp = function (tag, type, attr) {
5421 return (
5422 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5423 (attr === 'selected' && tag === 'option') ||
5424 (attr === 'checked' && tag === 'input') ||
5425 (attr === 'muted' && tag === 'video')
5426 )
5427};
5428
5429var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5430
5431var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5432
5433var convertEnumeratedValue = function (key, value) {
5434 return isFalsyAttrValue(value) || value === 'false'
5435 ? 'false'
5436 // allow arbitrary string value for contenteditable
5437 : key === 'contenteditable' && isValidContentEditableValue(value)
5438 ? value
5439 : 'true'
5440};
5441
5442var isBooleanAttr = makeMap(
5443 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5444 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5445 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5446 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5447 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5448 'truespeed,typemustmatch,visible'
5449);
5450
5451var xlinkNS = 'http://www.w3.org/1999/xlink';
5452
5453var isXlink = function (name) {
5454 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5455};
5456
5457var getXlinkProp = function (name) {
5458 return isXlink(name) ? name.slice(6, name.length) : ''
5459};
5460
5461var isFalsyAttrValue = function (val) {
5462 return val == null || val === false
5463};
5464
5465/* */
5466
5467function genClassForVnode (vnode) {
5468 var data = vnode.data;
5469 var parentNode = vnode;
5470 var childNode = vnode;
5471 while (isDef(childNode.componentInstance)) {
5472 childNode = childNode.componentInstance._vnode;
5473 if (childNode && childNode.data) {
5474 data = mergeClassData(childNode.data, data);
5475 }
5476 }
5477 while (isDef(parentNode = parentNode.parent)) {
5478 if (parentNode && parentNode.data) {
5479 data = mergeClassData(data, parentNode.data);
5480 }
5481 }
5482 return renderClass(data.staticClass, data.class)
5483}
5484
5485function mergeClassData (child, parent) {
5486 return {
5487 staticClass: concat(child.staticClass, parent.staticClass),
5488 class: isDef(child.class)
5489 ? [child.class, parent.class]
5490 : parent.class
5491 }
5492}
5493
5494function renderClass (
5495 staticClass,
5496 dynamicClass
5497) {
5498 if (isDef(staticClass) || isDef(dynamicClass)) {
5499 return concat(staticClass, stringifyClass(dynamicClass))
5500 }
5501 /* istanbul ignore next */
5502 return ''
5503}
5504
5505function concat (a, b) {
5506 return a ? b ? (a + ' ' + b) : a : (b || '')
5507}
5508
5509function stringifyClass (value) {
5510 if (Array.isArray(value)) {
5511 return stringifyArray(value)
5512 }
5513 if (isObject(value)) {
5514 return stringifyObject(value)
5515 }
5516 if (typeof value === 'string') {
5517 return value
5518 }
5519 /* istanbul ignore next */
5520 return ''
5521}
5522
5523function stringifyArray (value) {
5524 var res = '';
5525 var stringified;
5526 for (var i = 0, l = value.length; i < l; i++) {
5527 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5528 if (res) { res += ' '; }
5529 res += stringified;
5530 }
5531 }
5532 return res
5533}
5534
5535function stringifyObject (value) {
5536 var res = '';
5537 for (var key in value) {
5538 if (value[key]) {
5539 if (res) { res += ' '; }
5540 res += key;
5541 }
5542 }
5543 return res
5544}
5545
5546/* */
5547
5548var namespaceMap = {
5549 svg: 'http://www.w3.org/2000/svg',
5550 math: 'http://www.w3.org/1998/Math/MathML'
5551};
5552
5553var isHTMLTag = makeMap(
5554 'html,body,base,head,link,meta,style,title,' +
5555 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5556 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5557 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5558 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5559 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5560 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5561 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5562 'output,progress,select,textarea,' +
5563 'details,dialog,menu,menuitem,summary,' +
5564 'content,element,shadow,template,blockquote,iframe,tfoot'
5565);
5566
5567// this map is intentionally selective, only covering SVG elements that may
5568// contain child elements.
5569var isSVG = makeMap(
5570 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5571 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5572 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5573 true
5574);
5575
5576var isReservedTag = function (tag) {
5577 return isHTMLTag(tag) || isSVG(tag)
5578};
5579
5580function getTagNamespace (tag) {
5581 if (isSVG(tag)) {
5582 return 'svg'
5583 }
5584 // basic support for MathML
5585 // note it doesn't support other MathML elements being component roots
5586 if (tag === 'math') {
5587 return 'math'
5588 }
5589}
5590
5591var unknownElementCache = Object.create(null);
5592function isUnknownElement (tag) {
5593 /* istanbul ignore if */
5594 if (!inBrowser) {
5595 return true
5596 }
5597 if (isReservedTag(tag)) {
5598 return false
5599 }
5600 tag = tag.toLowerCase();
5601 /* istanbul ignore if */
5602 if (unknownElementCache[tag] != null) {
5603 return unknownElementCache[tag]
5604 }
5605 var el = document.createElement(tag);
5606 if (tag.indexOf('-') > -1) {
5607 // http://stackoverflow.com/a/28210364/1070244
5608 return (unknownElementCache[tag] = (
5609 el.constructor === window.HTMLUnknownElement ||
5610 el.constructor === window.HTMLElement
5611 ))
5612 } else {
5613 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5614 }
5615}
5616
5617var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5618
5619/* */
5620
5621/**
5622 * Query an element selector if it's not an element already.
5623 */
5624function query (el) {
5625 if (typeof el === 'string') {
5626 var selected = document.querySelector(el);
5627 if (!selected) {
5628 warn(
5629 'Cannot find element: ' + el
5630 );
5631 return document.createElement('div')
5632 }
5633 return selected
5634 } else {
5635 return el
5636 }
5637}
5638
5639/* */
5640
5641function createElement$1 (tagName, vnode) {
5642 var elm = document.createElement(tagName);
5643 if (tagName !== 'select') {
5644 return elm
5645 }
5646 // false or null will remove the attribute but undefined will not
5647 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5648 elm.setAttribute('multiple', 'multiple');
5649 }
5650 return elm
5651}
5652
5653function createElementNS (namespace, tagName) {
5654 return document.createElementNS(namespaceMap[namespace], tagName)
5655}
5656
5657function createTextNode (text) {
5658 return document.createTextNode(text)
5659}
5660
5661function createComment (text) {
5662 return document.createComment(text)
5663}
5664
5665function insertBefore (parentNode, newNode, referenceNode) {
5666 parentNode.insertBefore(newNode, referenceNode);
5667}
5668
5669function removeChild (node, child) {
5670 node.removeChild(child);
5671}
5672
5673function appendChild (node, child) {
5674 node.appendChild(child);
5675}
5676
5677function parentNode (node) {
5678 return node.parentNode
5679}
5680
5681function nextSibling (node) {
5682 return node.nextSibling
5683}
5684
5685function tagName (node) {
5686 return node.tagName
5687}
5688
5689function setTextContent (node, text) {
5690 node.textContent = text;
5691}
5692
5693function setStyleScope (node, scopeId) {
5694 node.setAttribute(scopeId, '');
5695}
5696
5697var nodeOps = /*#__PURE__*/Object.freeze({
5698 createElement: createElement$1,
5699 createElementNS: createElementNS,
5700 createTextNode: createTextNode,
5701 createComment: createComment,
5702 insertBefore: insertBefore,
5703 removeChild: removeChild,
5704 appendChild: appendChild,
5705 parentNode: parentNode,
5706 nextSibling: nextSibling,
5707 tagName: tagName,
5708 setTextContent: setTextContent,
5709 setStyleScope: setStyleScope
5710});
5711
5712/* */
5713
5714var ref = {
5715 create: function create (_, vnode) {
5716 registerRef(vnode);
5717 },
5718 update: function update (oldVnode, vnode) {
5719 if (oldVnode.data.ref !== vnode.data.ref) {
5720 registerRef(oldVnode, true);
5721 registerRef(vnode);
5722 }
5723 },
5724 destroy: function destroy (vnode) {
5725 registerRef(vnode, true);
5726 }
5727};
5728
5729function registerRef (vnode, isRemoval) {
5730 var key = vnode.data.ref;
5731 if (!isDef(key)) { return }
5732
5733 var vm = vnode.context;
5734 var ref = vnode.componentInstance || vnode.elm;
5735 var refs = vm.$refs;
5736 if (isRemoval) {
5737 if (Array.isArray(refs[key])) {
5738 remove(refs[key], ref);
5739 } else if (refs[key] === ref) {
5740 refs[key] = undefined;
5741 }
5742 } else {
5743 if (vnode.data.refInFor) {
5744 if (!Array.isArray(refs[key])) {
5745 refs[key] = [ref];
5746 } else if (refs[key].indexOf(ref) < 0) {
5747 // $flow-disable-line
5748 refs[key].push(ref);
5749 }
5750 } else {
5751 refs[key] = ref;
5752 }
5753 }
5754}
5755
5756/**
5757 * Virtual DOM patching algorithm based on Snabbdom by
5758 * Simon Friis Vindum (@paldepind)
5759 * Licensed under the MIT License
5760 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5761 *
5762 * modified by Evan You (@yyx990803)
5763 *
5764 * Not type-checking this because this file is perf-critical and the cost
5765 * of making flow understand it is not worth it.
5766 */
5767
5768var emptyNode = new VNode('', {}, []);
5769
5770var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5771
5772function sameVnode (a, b) {
5773 return (
5774 a.key === b.key && (
5775 (
5776 a.tag === b.tag &&
5777 a.isComment === b.isComment &&
5778 isDef(a.data) === isDef(b.data) &&
5779 sameInputType(a, b)
5780 ) || (
5781 isTrue(a.isAsyncPlaceholder) &&
5782 a.asyncFactory === b.asyncFactory &&
5783 isUndef(b.asyncFactory.error)
5784 )
5785 )
5786 )
5787}
5788
5789function sameInputType (a, b) {
5790 if (a.tag !== 'input') { return true }
5791 var i;
5792 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5793 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5794 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5795}
5796
5797function createKeyToOldIdx (children, beginIdx, endIdx) {
5798 var i, key;
5799 var map = {};
5800 for (i = beginIdx; i <= endIdx; ++i) {
5801 key = children[i].key;
5802 if (isDef(key)) { map[key] = i; }
5803 }
5804 return map
5805}
5806
5807function createPatchFunction (backend) {
5808 var i, j;
5809 var cbs = {};
5810
5811 var modules = backend.modules;
5812 var nodeOps = backend.nodeOps;
5813
5814 for (i = 0; i < hooks.length; ++i) {
5815 cbs[hooks[i]] = [];
5816 for (j = 0; j < modules.length; ++j) {
5817 if (isDef(modules[j][hooks[i]])) {
5818 cbs[hooks[i]].push(modules[j][hooks[i]]);
5819 }
5820 }
5821 }
5822
5823 function emptyNodeAt (elm) {
5824 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5825 }
5826
5827 function createRmCb (childElm, listeners) {
5828 function remove$$1 () {
5829 if (--remove$$1.listeners === 0) {
5830 removeNode(childElm);
5831 }
5832 }
5833 remove$$1.listeners = listeners;
5834 return remove$$1
5835 }
5836
5837 function removeNode (el) {
5838 var parent = nodeOps.parentNode(el);
5839 // element may have already been removed due to v-html / v-text
5840 if (isDef(parent)) {
5841 nodeOps.removeChild(parent, el);
5842 }
5843 }
5844
5845 function isUnknownElement$$1 (vnode, inVPre) {
5846 return (
5847 !inVPre &&
5848 !vnode.ns &&
5849 !(
5850 config.ignoredElements.length &&
5851 config.ignoredElements.some(function (ignore) {
5852 return isRegExp(ignore)
5853 ? ignore.test(vnode.tag)
5854 : ignore === vnode.tag
5855 })
5856 ) &&
5857 config.isUnknownElement(vnode.tag)
5858 )
5859 }
5860
5861 var creatingElmInVPre = 0;
5862
5863 function createElm (
5864 vnode,
5865 insertedVnodeQueue,
5866 parentElm,
5867 refElm,
5868 nested,
5869 ownerArray,
5870 index
5871 ) {
5872 if (isDef(vnode.elm) && isDef(ownerArray)) {
5873 // This vnode was used in a previous render!
5874 // now it's used as a new node, overwriting its elm would cause
5875 // potential patch errors down the road when it's used as an insertion
5876 // reference node. Instead, we clone the node on-demand before creating
5877 // associated DOM element for it.
5878 vnode = ownerArray[index] = cloneVNode(vnode);
5879 }
5880
5881 vnode.isRootInsert = !nested; // for transition enter check
5882 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5883 return
5884 }
5885
5886 var data = vnode.data;
5887 var children = vnode.children;
5888 var tag = vnode.tag;
5889 if (isDef(tag)) {
5890 {
5891 if (data && data.pre) {
5892 creatingElmInVPre++;
5893 }
5894 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5895 warn(
5896 'Unknown custom element: <' + tag + '> - did you ' +
5897 'register the component correctly? For recursive components, ' +
5898 'make sure to provide the "name" option.',
5899 vnode.context
5900 );
5901 }
5902 }
5903
5904 vnode.elm = vnode.ns
5905 ? nodeOps.createElementNS(vnode.ns, tag)
5906 : nodeOps.createElement(tag, vnode);
5907 setScope(vnode);
5908
5909 /* istanbul ignore if */
5910 {
5911 createChildren(vnode, children, insertedVnodeQueue);
5912 if (isDef(data)) {
5913 invokeCreateHooks(vnode, insertedVnodeQueue);
5914 }
5915 insert(parentElm, vnode.elm, refElm);
5916 }
5917
5918 if (data && data.pre) {
5919 creatingElmInVPre--;
5920 }
5921 } else if (isTrue(vnode.isComment)) {
5922 vnode.elm = nodeOps.createComment(vnode.text);
5923 insert(parentElm, vnode.elm, refElm);
5924 } else {
5925 vnode.elm = nodeOps.createTextNode(vnode.text);
5926 insert(parentElm, vnode.elm, refElm);
5927 }
5928 }
5929
5930 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5931 var i = vnode.data;
5932 if (isDef(i)) {
5933 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5934 if (isDef(i = i.hook) && isDef(i = i.init)) {
5935 i(vnode, false /* hydrating */);
5936 }
5937 // after calling the init hook, if the vnode is a child component
5938 // it should've created a child instance and mounted it. the child
5939 // component also has set the placeholder vnode's elm.
5940 // in that case we can just return the element and be done.
5941 if (isDef(vnode.componentInstance)) {
5942 initComponent(vnode, insertedVnodeQueue);
5943 insert(parentElm, vnode.elm, refElm);
5944 if (isTrue(isReactivated)) {
5945 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5946 }
5947 return true
5948 }
5949 }
5950 }
5951
5952 function initComponent (vnode, insertedVnodeQueue) {
5953 if (isDef(vnode.data.pendingInsert)) {
5954 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5955 vnode.data.pendingInsert = null;
5956 }
5957 vnode.elm = vnode.componentInstance.$el;
5958 if (isPatchable(vnode)) {
5959 invokeCreateHooks(vnode, insertedVnodeQueue);
5960 setScope(vnode);
5961 } else {
5962 // empty component root.
5963 // skip all element-related modules except for ref (#3455)
5964 registerRef(vnode);
5965 // make sure to invoke the insert hook
5966 insertedVnodeQueue.push(vnode);
5967 }
5968 }
5969
5970 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5971 var i;
5972 // hack for #4339: a reactivated component with inner transition
5973 // does not trigger because the inner node's created hooks are not called
5974 // again. It's not ideal to involve module-specific logic in here but
5975 // there doesn't seem to be a better way to do it.
5976 var innerNode = vnode;
5977 while (innerNode.componentInstance) {
5978 innerNode = innerNode.componentInstance._vnode;
5979 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
5980 for (i = 0; i < cbs.activate.length; ++i) {
5981 cbs.activate[i](emptyNode, innerNode);
5982 }
5983 insertedVnodeQueue.push(innerNode);
5984 break
5985 }
5986 }
5987 // unlike a newly created component,
5988 // a reactivated keep-alive component doesn't insert itself
5989 insert(parentElm, vnode.elm, refElm);
5990 }
5991
5992 function insert (parent, elm, ref$$1) {
5993 if (isDef(parent)) {
5994 if (isDef(ref$$1)) {
5995 if (nodeOps.parentNode(ref$$1) === parent) {
5996 nodeOps.insertBefore(parent, elm, ref$$1);
5997 }
5998 } else {
5999 nodeOps.appendChild(parent, elm);
6000 }
6001 }
6002 }
6003
6004 function createChildren (vnode, children, insertedVnodeQueue) {
6005 if (Array.isArray(children)) {
6006 {
6007 checkDuplicateKeys(children);
6008 }
6009 for (var i = 0; i < children.length; ++i) {
6010 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6011 }
6012 } else if (isPrimitive(vnode.text)) {
6013 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6014 }
6015 }
6016
6017 function isPatchable (vnode) {
6018 while (vnode.componentInstance) {
6019 vnode = vnode.componentInstance._vnode;
6020 }
6021 return isDef(vnode.tag)
6022 }
6023
6024 function invokeCreateHooks (vnode, insertedVnodeQueue) {
6025 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6026 cbs.create[i$1](emptyNode, vnode);
6027 }
6028 i = vnode.data.hook; // Reuse variable
6029 if (isDef(i)) {
6030 if (isDef(i.create)) { i.create(emptyNode, vnode); }
6031 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6032 }
6033 }
6034
6035 // set scope id attribute for scoped CSS.
6036 // this is implemented as a special case to avoid the overhead
6037 // of going through the normal attribute patching process.
6038 function setScope (vnode) {
6039 var i;
6040 if (isDef(i = vnode.fnScopeId)) {
6041 nodeOps.setStyleScope(vnode.elm, i);
6042 } else {
6043 var ancestor = vnode;
6044 while (ancestor) {
6045 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6046 nodeOps.setStyleScope(vnode.elm, i);
6047 }
6048 ancestor = ancestor.parent;
6049 }
6050 }
6051 // for slot content they should also get the scopeId from the host instance.
6052 if (isDef(i = activeInstance) &&
6053 i !== vnode.context &&
6054 i !== vnode.fnContext &&
6055 isDef(i = i.$options._scopeId)
6056 ) {
6057 nodeOps.setStyleScope(vnode.elm, i);
6058 }
6059 }
6060
6061 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6062 for (; startIdx <= endIdx; ++startIdx) {
6063 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6064 }
6065 }
6066
6067 function invokeDestroyHook (vnode) {
6068 var i, j;
6069 var data = vnode.data;
6070 if (isDef(data)) {
6071 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6072 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6073 }
6074 if (isDef(i = vnode.children)) {
6075 for (j = 0; j < vnode.children.length; ++j) {
6076 invokeDestroyHook(vnode.children[j]);
6077 }
6078 }
6079 }
6080
6081 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6082 for (; startIdx <= endIdx; ++startIdx) {
6083 var ch = vnodes[startIdx];
6084 if (isDef(ch)) {
6085 if (isDef(ch.tag)) {
6086 removeAndInvokeRemoveHook(ch);
6087 invokeDestroyHook(ch);
6088 } else { // Text node
6089 removeNode(ch.elm);
6090 }
6091 }
6092 }
6093 }
6094
6095 function removeAndInvokeRemoveHook (vnode, rm) {
6096 if (isDef(rm) || isDef(vnode.data)) {
6097 var i;
6098 var listeners = cbs.remove.length + 1;
6099 if (isDef(rm)) {
6100 // we have a recursively passed down rm callback
6101 // increase the listeners count
6102 rm.listeners += listeners;
6103 } else {
6104 // directly removing
6105 rm = createRmCb(vnode.elm, listeners);
6106 }
6107 // recursively invoke hooks on child component root node
6108 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6109 removeAndInvokeRemoveHook(i, rm);
6110 }
6111 for (i = 0; i < cbs.remove.length; ++i) {
6112 cbs.remove[i](vnode, rm);
6113 }
6114 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6115 i(vnode, rm);
6116 } else {
6117 rm();
6118 }
6119 } else {
6120 removeNode(vnode.elm);
6121 }
6122 }
6123
6124 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6125 var oldStartIdx = 0;
6126 var newStartIdx = 0;
6127 var oldEndIdx = oldCh.length - 1;
6128 var oldStartVnode = oldCh[0];
6129 var oldEndVnode = oldCh[oldEndIdx];
6130 var newEndIdx = newCh.length - 1;
6131 var newStartVnode = newCh[0];
6132 var newEndVnode = newCh[newEndIdx];
6133 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6134
6135 // removeOnly is a special flag used only by <transition-group>
6136 // to ensure removed elements stay in correct relative positions
6137 // during leaving transitions
6138 var canMove = !removeOnly;
6139
6140 {
6141 checkDuplicateKeys(newCh);
6142 }
6143
6144 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6145 if (isUndef(oldStartVnode)) {
6146 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6147 } else if (isUndef(oldEndVnode)) {
6148 oldEndVnode = oldCh[--oldEndIdx];
6149 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6150 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6151 oldStartVnode = oldCh[++oldStartIdx];
6152 newStartVnode = newCh[++newStartIdx];
6153 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6154 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6155 oldEndVnode = oldCh[--oldEndIdx];
6156 newEndVnode = newCh[--newEndIdx];
6157 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6158 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6159 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6160 oldStartVnode = oldCh[++oldStartIdx];
6161 newEndVnode = newCh[--newEndIdx];
6162 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6163 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6164 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6165 oldEndVnode = oldCh[--oldEndIdx];
6166 newStartVnode = newCh[++newStartIdx];
6167 } else {
6168 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6169 idxInOld = isDef(newStartVnode.key)
6170 ? oldKeyToIdx[newStartVnode.key]
6171 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6172 if (isUndef(idxInOld)) { // New element
6173 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6174 } else {
6175 vnodeToMove = oldCh[idxInOld];
6176 if (sameVnode(vnodeToMove, newStartVnode)) {
6177 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6178 oldCh[idxInOld] = undefined;
6179 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6180 } else {
6181 // same key but different element. treat as new element
6182 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6183 }
6184 }
6185 newStartVnode = newCh[++newStartIdx];
6186 }
6187 }
6188 if (oldStartIdx > oldEndIdx) {
6189 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6190 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6191 } else if (newStartIdx > newEndIdx) {
6192 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6193 }
6194 }
6195
6196 function checkDuplicateKeys (children) {
6197 var seenKeys = {};
6198 for (var i = 0; i < children.length; i++) {
6199 var vnode = children[i];
6200 var key = vnode.key;
6201 if (isDef(key)) {
6202 if (seenKeys[key]) {
6203 warn(
6204 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6205 vnode.context
6206 );
6207 } else {
6208 seenKeys[key] = true;
6209 }
6210 }
6211 }
6212 }
6213
6214 function findIdxInOld (node, oldCh, start, end) {
6215 for (var i = start; i < end; i++) {
6216 var c = oldCh[i];
6217 if (isDef(c) && sameVnode(node, c)) { return i }
6218 }
6219 }
6220
6221 function patchVnode (
6222 oldVnode,
6223 vnode,
6224 insertedVnodeQueue,
6225 ownerArray,
6226 index,
6227 removeOnly
6228 ) {
6229 if (oldVnode === vnode) {
6230 return
6231 }
6232
6233 if (isDef(vnode.elm) && isDef(ownerArray)) {
6234 // clone reused vnode
6235 vnode = ownerArray[index] = cloneVNode(vnode);
6236 }
6237
6238 var elm = vnode.elm = oldVnode.elm;
6239
6240 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6241 if (isDef(vnode.asyncFactory.resolved)) {
6242 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6243 } else {
6244 vnode.isAsyncPlaceholder = true;
6245 }
6246 return
6247 }
6248
6249 // reuse element for static trees.
6250 // note we only do this if the vnode is cloned -
6251 // if the new node is not cloned it means the render functions have been
6252 // reset by the hot-reload-api and we need to do a proper re-render.
6253 if (isTrue(vnode.isStatic) &&
6254 isTrue(oldVnode.isStatic) &&
6255 vnode.key === oldVnode.key &&
6256 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6257 ) {
6258 vnode.componentInstance = oldVnode.componentInstance;
6259 return
6260 }
6261
6262 var i;
6263 var data = vnode.data;
6264 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6265 i(oldVnode, vnode);
6266 }
6267
6268 var oldCh = oldVnode.children;
6269 var ch = vnode.children;
6270 if (isDef(data) && isPatchable(vnode)) {
6271 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6272 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6273 }
6274 if (isUndef(vnode.text)) {
6275 if (isDef(oldCh) && isDef(ch)) {
6276 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6277 } else if (isDef(ch)) {
6278 {
6279 checkDuplicateKeys(ch);
6280 }
6281 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6282 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6283 } else if (isDef(oldCh)) {
6284 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6285 } else if (isDef(oldVnode.text)) {
6286 nodeOps.setTextContent(elm, '');
6287 }
6288 } else if (oldVnode.text !== vnode.text) {
6289 nodeOps.setTextContent(elm, vnode.text);
6290 }
6291 if (isDef(data)) {
6292 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6293 }
6294 }
6295
6296 function invokeInsertHook (vnode, queue, initial) {
6297 // delay insert hooks for component root nodes, invoke them after the
6298 // element is really inserted
6299 if (isTrue(initial) && isDef(vnode.parent)) {
6300 vnode.parent.data.pendingInsert = queue;
6301 } else {
6302 for (var i = 0; i < queue.length; ++i) {
6303 queue[i].data.hook.insert(queue[i]);
6304 }
6305 }
6306 }
6307
6308 var hydrationBailed = false;
6309 // list of modules that can skip create hook during hydration because they
6310 // are already rendered on the client or has no need for initialization
6311 // Note: style is excluded because it relies on initial clone for future
6312 // deep updates (#7063).
6313 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6314
6315 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6316 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6317 var i;
6318 var tag = vnode.tag;
6319 var data = vnode.data;
6320 var children = vnode.children;
6321 inVPre = inVPre || (data && data.pre);
6322 vnode.elm = elm;
6323
6324 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6325 vnode.isAsyncPlaceholder = true;
6326 return true
6327 }
6328 // assert node match
6329 {
6330 if (!assertNodeMatch(elm, vnode, inVPre)) {
6331 return false
6332 }
6333 }
6334 if (isDef(data)) {
6335 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6336 if (isDef(i = vnode.componentInstance)) {
6337 // child component. it should have hydrated its own tree.
6338 initComponent(vnode, insertedVnodeQueue);
6339 return true
6340 }
6341 }
6342 if (isDef(tag)) {
6343 if (isDef(children)) {
6344 // empty element, allow client to pick up and populate children
6345 if (!elm.hasChildNodes()) {
6346 createChildren(vnode, children, insertedVnodeQueue);
6347 } else {
6348 // v-html and domProps: innerHTML
6349 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6350 if (i !== elm.innerHTML) {
6351 /* istanbul ignore if */
6352 if (typeof console !== 'undefined' &&
6353 !hydrationBailed
6354 ) {
6355 hydrationBailed = true;
6356 console.warn('Parent: ', elm);
6357 console.warn('server innerHTML: ', i);
6358 console.warn('client innerHTML: ', elm.innerHTML);
6359 }
6360 return false
6361 }
6362 } else {
6363 // iterate and compare children lists
6364 var childrenMatch = true;
6365 var childNode = elm.firstChild;
6366 for (var i$1 = 0; i$1 < children.length; i$1++) {
6367 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6368 childrenMatch = false;
6369 break
6370 }
6371 childNode = childNode.nextSibling;
6372 }
6373 // if childNode is not null, it means the actual childNodes list is
6374 // longer than the virtual children list.
6375 if (!childrenMatch || childNode) {
6376 /* istanbul ignore if */
6377 if (typeof console !== 'undefined' &&
6378 !hydrationBailed
6379 ) {
6380 hydrationBailed = true;
6381 console.warn('Parent: ', elm);
6382 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6383 }
6384 return false
6385 }
6386 }
6387 }
6388 }
6389 if (isDef(data)) {
6390 var fullInvoke = false;
6391 for (var key in data) {
6392 if (!isRenderedModule(key)) {
6393 fullInvoke = true;
6394 invokeCreateHooks(vnode, insertedVnodeQueue);
6395 break
6396 }
6397 }
6398 if (!fullInvoke && data['class']) {
6399 // ensure collecting deps for deep class bindings for future updates
6400 traverse(data['class']);
6401 }
6402 }
6403 } else if (elm.data !== vnode.text) {
6404 elm.data = vnode.text;
6405 }
6406 return true
6407 }
6408
6409 function assertNodeMatch (node, vnode, inVPre) {
6410 if (isDef(vnode.tag)) {
6411 return vnode.tag.indexOf('vue-component') === 0 || (
6412 !isUnknownElement$$1(vnode, inVPre) &&
6413 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6414 )
6415 } else {
6416 return node.nodeType === (vnode.isComment ? 8 : 3)
6417 }
6418 }
6419
6420 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6421 if (isUndef(vnode)) {
6422 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6423 return
6424 }
6425
6426 var isInitialPatch = false;
6427 var insertedVnodeQueue = [];
6428
6429 if (isUndef(oldVnode)) {
6430 // empty mount (likely as component), create new root element
6431 isInitialPatch = true;
6432 createElm(vnode, insertedVnodeQueue);
6433 } else {
6434 var isRealElement = isDef(oldVnode.nodeType);
6435 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6436 // patch existing root node
6437 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6438 } else {
6439 if (isRealElement) {
6440 // mounting to a real element
6441 // check if this is server-rendered content and if we can perform
6442 // a successful hydration.
6443 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6444 oldVnode.removeAttribute(SSR_ATTR);
6445 hydrating = true;
6446 }
6447 if (isTrue(hydrating)) {
6448 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6449 invokeInsertHook(vnode, insertedVnodeQueue, true);
6450 return oldVnode
6451 } else {
6452 warn(
6453 'The client-side rendered virtual DOM tree is not matching ' +
6454 'server-rendered content. This is likely caused by incorrect ' +
6455 'HTML markup, for example nesting block-level elements inside ' +
6456 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6457 'full client-side render.'
6458 );
6459 }
6460 }
6461 // either not server-rendered, or hydration failed.
6462 // create an empty node and replace it
6463 oldVnode = emptyNodeAt(oldVnode);
6464 }
6465
6466 // replacing existing element
6467 var oldElm = oldVnode.elm;
6468 var parentElm = nodeOps.parentNode(oldElm);
6469
6470 // create new node
6471 createElm(
6472 vnode,
6473 insertedVnodeQueue,
6474 // extremely rare edge case: do not insert if old element is in a
6475 // leaving transition. Only happens when combining transition +
6476 // keep-alive + HOCs. (#4590)
6477 oldElm._leaveCb ? null : parentElm,
6478 nodeOps.nextSibling(oldElm)
6479 );
6480
6481 // update parent placeholder node element, recursively
6482 if (isDef(vnode.parent)) {
6483 var ancestor = vnode.parent;
6484 var patchable = isPatchable(vnode);
6485 while (ancestor) {
6486 for (var i = 0; i < cbs.destroy.length; ++i) {
6487 cbs.destroy[i](ancestor);
6488 }
6489 ancestor.elm = vnode.elm;
6490 if (patchable) {
6491 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6492 cbs.create[i$1](emptyNode, ancestor);
6493 }
6494 // #6513
6495 // invoke insert hooks that may have been merged by create hooks.
6496 // e.g. for directives that uses the "inserted" hook.
6497 var insert = ancestor.data.hook.insert;
6498 if (insert.merged) {
6499 // start at index 1 to avoid re-invoking component mounted hook
6500 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6501 insert.fns[i$2]();
6502 }
6503 }
6504 } else {
6505 registerRef(ancestor);
6506 }
6507 ancestor = ancestor.parent;
6508 }
6509 }
6510
6511 // destroy old node
6512 if (isDef(parentElm)) {
6513 removeVnodes(parentElm, [oldVnode], 0, 0);
6514 } else if (isDef(oldVnode.tag)) {
6515 invokeDestroyHook(oldVnode);
6516 }
6517 }
6518 }
6519
6520 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6521 return vnode.elm
6522 }
6523}
6524
6525/* */
6526
6527var directives = {
6528 create: updateDirectives,
6529 update: updateDirectives,
6530 destroy: function unbindDirectives (vnode) {
6531 updateDirectives(vnode, emptyNode);
6532 }
6533};
6534
6535function updateDirectives (oldVnode, vnode) {
6536 if (oldVnode.data.directives || vnode.data.directives) {
6537 _update(oldVnode, vnode);
6538 }
6539}
6540
6541function _update (oldVnode, vnode) {
6542 var isCreate = oldVnode === emptyNode;
6543 var isDestroy = vnode === emptyNode;
6544 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6545 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6546
6547 var dirsWithInsert = [];
6548 var dirsWithPostpatch = [];
6549
6550 var key, oldDir, dir;
6551 for (key in newDirs) {
6552 oldDir = oldDirs[key];
6553 dir = newDirs[key];
6554 if (!oldDir) {
6555 // new directive, bind
6556 callHook$1(dir, 'bind', vnode, oldVnode);
6557 if (dir.def && dir.def.inserted) {
6558 dirsWithInsert.push(dir);
6559 }
6560 } else {
6561 // existing directive, update
6562 dir.oldValue = oldDir.value;
6563 dir.oldArg = oldDir.arg;
6564 callHook$1(dir, 'update', vnode, oldVnode);
6565 if (dir.def && dir.def.componentUpdated) {
6566 dirsWithPostpatch.push(dir);
6567 }
6568 }
6569 }
6570
6571 if (dirsWithInsert.length) {
6572 var callInsert = function () {
6573 for (var i = 0; i < dirsWithInsert.length; i++) {
6574 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6575 }
6576 };
6577 if (isCreate) {
6578 mergeVNodeHook(vnode, 'insert', callInsert);
6579 } else {
6580 callInsert();
6581 }
6582 }
6583
6584 if (dirsWithPostpatch.length) {
6585 mergeVNodeHook(vnode, 'postpatch', function () {
6586 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6587 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6588 }
6589 });
6590 }
6591
6592 if (!isCreate) {
6593 for (key in oldDirs) {
6594 if (!newDirs[key]) {
6595 // no longer present, unbind
6596 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6597 }
6598 }
6599 }
6600}
6601
6602var emptyModifiers = Object.create(null);
6603
6604function normalizeDirectives$1 (
6605 dirs,
6606 vm
6607) {
6608 var res = Object.create(null);
6609 if (!dirs) {
6610 // $flow-disable-line
6611 return res
6612 }
6613 var i, dir;
6614 for (i = 0; i < dirs.length; i++) {
6615 dir = dirs[i];
6616 if (!dir.modifiers) {
6617 // $flow-disable-line
6618 dir.modifiers = emptyModifiers;
6619 }
6620 res[getRawDirName(dir)] = dir;
6621 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6622 }
6623 // $flow-disable-line
6624 return res
6625}
6626
6627function getRawDirName (dir) {
6628 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6629}
6630
6631function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6632 var fn = dir.def && dir.def[hook];
6633 if (fn) {
6634 try {
6635 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6636 } catch (e) {
6637 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6638 }
6639 }
6640}
6641
6642var baseModules = [
6643 ref,
6644 directives
6645];
6646
6647/* */
6648
6649function updateAttrs (oldVnode, vnode) {
6650 var opts = vnode.componentOptions;
6651 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6652 return
6653 }
6654 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6655 return
6656 }
6657 var key, cur, old;
6658 var elm = vnode.elm;
6659 var oldAttrs = oldVnode.data.attrs || {};
6660 var attrs = vnode.data.attrs || {};
6661 // clone observed objects, as the user probably wants to mutate it
6662 if (isDef(attrs.__ob__)) {
6663 attrs = vnode.data.attrs = extend({}, attrs);
6664 }
6665
6666 for (key in attrs) {
6667 cur = attrs[key];
6668 old = oldAttrs[key];
6669 if (old !== cur) {
6670 setAttr(elm, key, cur);
6671 }
6672 }
6673 // #4391: in IE9, setting type can reset value for input[type=radio]
6674 // #6666: IE/Edge forces progress value down to 1 before setting a max
6675 /* istanbul ignore if */
6676 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6677 setAttr(elm, 'value', attrs.value);
6678 }
6679 for (key in oldAttrs) {
6680 if (isUndef(attrs[key])) {
6681 if (isXlink(key)) {
6682 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6683 } else if (!isEnumeratedAttr(key)) {
6684 elm.removeAttribute(key);
6685 }
6686 }
6687 }
6688}
6689
6690function setAttr (el, key, value) {
6691 if (el.tagName.indexOf('-') > -1) {
6692 baseSetAttr(el, key, value);
6693 } else if (isBooleanAttr(key)) {
6694 // set attribute for blank value
6695 // e.g. <option disabled>Select one</option>
6696 if (isFalsyAttrValue(value)) {
6697 el.removeAttribute(key);
6698 } else {
6699 // technically allowfullscreen is a boolean attribute for <iframe>,
6700 // but Flash expects a value of "true" when used on <embed> tag
6701 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6702 ? 'true'
6703 : key;
6704 el.setAttribute(key, value);
6705 }
6706 } else if (isEnumeratedAttr(key)) {
6707 el.setAttribute(key, convertEnumeratedValue(key, value));
6708 } else if (isXlink(key)) {
6709 if (isFalsyAttrValue(value)) {
6710 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6711 } else {
6712 el.setAttributeNS(xlinkNS, key, value);
6713 }
6714 } else {
6715 baseSetAttr(el, key, value);
6716 }
6717}
6718
6719function baseSetAttr (el, key, value) {
6720 if (isFalsyAttrValue(value)) {
6721 el.removeAttribute(key);
6722 } else {
6723 // #7138: IE10 & 11 fires input event when setting placeholder on
6724 // <textarea>... block the first input event and remove the blocker
6725 // immediately.
6726 /* istanbul ignore if */
6727 if (
6728 isIE && !isIE9 &&
6729 el.tagName === 'TEXTAREA' &&
6730 key === 'placeholder' && value !== '' && !el.__ieph
6731 ) {
6732 var blocker = function (e) {
6733 e.stopImmediatePropagation();
6734 el.removeEventListener('input', blocker);
6735 };
6736 el.addEventListener('input', blocker);
6737 // $flow-disable-line
6738 el.__ieph = true; /* IE placeholder patched */
6739 }
6740 el.setAttribute(key, value);
6741 }
6742}
6743
6744var attrs = {
6745 create: updateAttrs,
6746 update: updateAttrs
6747};
6748
6749/* */
6750
6751function updateClass (oldVnode, vnode) {
6752 var el = vnode.elm;
6753 var data = vnode.data;
6754 var oldData = oldVnode.data;
6755 if (
6756 isUndef(data.staticClass) &&
6757 isUndef(data.class) && (
6758 isUndef(oldData) || (
6759 isUndef(oldData.staticClass) &&
6760 isUndef(oldData.class)
6761 )
6762 )
6763 ) {
6764 return
6765 }
6766
6767 var cls = genClassForVnode(vnode);
6768
6769 // handle transition classes
6770 var transitionClass = el._transitionClasses;
6771 if (isDef(transitionClass)) {
6772 cls = concat(cls, stringifyClass(transitionClass));
6773 }
6774
6775 // set the class
6776 if (cls !== el._prevClass) {
6777 el.setAttribute('class', cls);
6778 el._prevClass = cls;
6779 }
6780}
6781
6782var klass = {
6783 create: updateClass,
6784 update: updateClass
6785};
6786
6787/* */
6788
6789/* */
6790
6791/* */
6792
6793/* */
6794
6795// in some cases, the event used has to be determined at runtime
6796// so we used some reserved tokens during compile.
6797var RANGE_TOKEN = '__r';
6798var CHECKBOX_RADIO_TOKEN = '__c';
6799
6800/* */
6801
6802// normalize v-model event tokens that can only be determined at runtime.
6803// it's important to place the event as the first in the array because
6804// the whole point is ensuring the v-model callback gets called before
6805// user-attached handlers.
6806function normalizeEvents (on) {
6807 /* istanbul ignore if */
6808 if (isDef(on[RANGE_TOKEN])) {
6809 // IE input[type=range] only supports `change` event
6810 var event = isIE ? 'change' : 'input';
6811 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6812 delete on[RANGE_TOKEN];
6813 }
6814 // This was originally intended to fix #4521 but no longer necessary
6815 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6816 /* istanbul ignore if */
6817 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6818 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6819 delete on[CHECKBOX_RADIO_TOKEN];
6820 }
6821}
6822
6823var target$1;
6824
6825function createOnceHandler$1 (event, handler, capture) {
6826 var _target = target$1; // save current target element in closure
6827 return function onceHandler () {
6828 var res = handler.apply(null, arguments);
6829 if (res !== null) {
6830 remove$2(event, onceHandler, capture, _target);
6831 }
6832 }
6833}
6834
6835// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
6836// implementation and does not fire microtasks in between event propagation, so
6837// safe to exclude.
6838var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
6839
6840function add$1 (
6841 name,
6842 handler,
6843 capture,
6844 passive
6845) {
6846 // async edge case #6566: inner click event triggers patch, event handler
6847 // attached to outer element during patch, and triggered again. This
6848 // happens because browsers fire microtask ticks between event propagation.
6849 // the solution is simple: we save the timestamp when a handler is attached,
6850 // and the handler would only fire if the event passed to it was fired
6851 // AFTER it was attached.
6852 if (useMicrotaskFix) {
6853 var attachedTimestamp = currentFlushTimestamp;
6854 var original = handler;
6855 handler = original._wrapper = function (e) {
6856 if (
6857 // no bubbling, should always fire.
6858 // this is just a safety net in case event.timeStamp is unreliable in
6859 // certain weird environments...
6860 e.target === e.currentTarget ||
6861 // event is fired after handler attachment
6862 e.timeStamp >= attachedTimestamp ||
6863 // bail for environments that have buggy event.timeStamp implementations
6864 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6865 // #9681 QtWebEngine event.timeStamp is negative value
6866 e.timeStamp <= 0 ||
6867 // #9448 bail if event is fired in another document in a multi-page
6868 // electron/nw.js app, since event.timeStamp will be using a different
6869 // starting reference
6870 e.target.ownerDocument !== document
6871 ) {
6872 return original.apply(this, arguments)
6873 }
6874 };
6875 }
6876 target$1.addEventListener(
6877 name,
6878 handler,
6879 supportsPassive
6880 ? { capture: capture, passive: passive }
6881 : capture
6882 );
6883}
6884
6885function remove$2 (
6886 name,
6887 handler,
6888 capture,
6889 _target
6890) {
6891 (_target || target$1).removeEventListener(
6892 name,
6893 handler._wrapper || handler,
6894 capture
6895 );
6896}
6897
6898function updateDOMListeners (oldVnode, vnode) {
6899 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6900 return
6901 }
6902 var on = vnode.data.on || {};
6903 var oldOn = oldVnode.data.on || {};
6904 target$1 = vnode.elm;
6905 normalizeEvents(on);
6906 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
6907 target$1 = undefined;
6908}
6909
6910var events = {
6911 create: updateDOMListeners,
6912 update: updateDOMListeners
6913};
6914
6915/* */
6916
6917var svgContainer;
6918
6919function updateDOMProps (oldVnode, vnode) {
6920 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6921 return
6922 }
6923 var key, cur;
6924 var elm = vnode.elm;
6925 var oldProps = oldVnode.data.domProps || {};
6926 var props = vnode.data.domProps || {};
6927 // clone observed objects, as the user probably wants to mutate it
6928 if (isDef(props.__ob__)) {
6929 props = vnode.data.domProps = extend({}, props);
6930 }
6931
6932 for (key in oldProps) {
6933 if (isUndef(props[key])) {
6934 elm[key] = '';
6935 }
6936 }
6937 for (key in props) {
6938 cur = props[key];
6939 // ignore children if the node has textContent or innerHTML,
6940 // as these will throw away existing DOM nodes and cause removal errors
6941 // on subsequent patches (#3360)
6942 if (key === 'textContent' || key === 'innerHTML') {
6943 if (vnode.children) { vnode.children.length = 0; }
6944 if (cur === oldProps[key]) { continue }
6945 // #6601 work around Chrome version <= 55 bug where single textNode
6946 // replaced by innerHTML/textContent retains its parentNode property
6947 if (elm.childNodes.length === 1) {
6948 elm.removeChild(elm.childNodes[0]);
6949 }
6950 }
6951
6952 if (key === 'value' && elm.tagName !== 'PROGRESS') {
6953 // store value as _value as well since
6954 // non-string values will be stringified
6955 elm._value = cur;
6956 // avoid resetting cursor position when value is the same
6957 var strCur = isUndef(cur) ? '' : String(cur);
6958 if (shouldUpdateValue(elm, strCur)) {
6959 elm.value = strCur;
6960 }
6961 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
6962 // IE doesn't support innerHTML for SVG elements
6963 svgContainer = svgContainer || document.createElement('div');
6964 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
6965 var svg = svgContainer.firstChild;
6966 while (elm.firstChild) {
6967 elm.removeChild(elm.firstChild);
6968 }
6969 while (svg.firstChild) {
6970 elm.appendChild(svg.firstChild);
6971 }
6972 } else if (
6973 // skip the update if old and new VDOM state is the same.
6974 // `value` is handled separately because the DOM value may be temporarily
6975 // out of sync with VDOM state due to focus, composition and modifiers.
6976 // This #4521 by skipping the unnecesarry `checked` update.
6977 cur !== oldProps[key]
6978 ) {
6979 // some property updates can throw
6980 // e.g. `value` on <progress> w/ non-finite value
6981 try {
6982 elm[key] = cur;
6983 } catch (e) {}
6984 }
6985 }
6986}
6987
6988// check platforms/web/util/attrs.js acceptValue
6989
6990
6991function shouldUpdateValue (elm, checkVal) {
6992 return (!elm.composing && (
6993 elm.tagName === 'OPTION' ||
6994 isNotInFocusAndDirty(elm, checkVal) ||
6995 isDirtyWithModifiers(elm, checkVal)
6996 ))
6997}
6998
6999function isNotInFocusAndDirty (elm, checkVal) {
7000 // return true when textbox (.number and .trim) loses focus and its value is
7001 // not equal to the updated value
7002 var notInFocus = true;
7003 // #6157
7004 // work around IE bug when accessing document.activeElement in an iframe
7005 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7006 return notInFocus && elm.value !== checkVal
7007}
7008
7009function isDirtyWithModifiers (elm, newVal) {
7010 var value = elm.value;
7011 var modifiers = elm._vModifiers; // injected by v-model runtime
7012 if (isDef(modifiers)) {
7013 if (modifiers.number) {
7014 return toNumber(value) !== toNumber(newVal)
7015 }
7016 if (modifiers.trim) {
7017 return value.trim() !== newVal.trim()
7018 }
7019 }
7020 return value !== newVal
7021}
7022
7023var domProps = {
7024 create: updateDOMProps,
7025 update: updateDOMProps
7026};
7027
7028/* */
7029
7030var parseStyleText = cached(function (cssText) {
7031 var res = {};
7032 var listDelimiter = /;(?![^(]*\))/g;
7033 var propertyDelimiter = /:(.+)/;
7034 cssText.split(listDelimiter).forEach(function (item) {
7035 if (item) {
7036 var tmp = item.split(propertyDelimiter);
7037 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7038 }
7039 });
7040 return res
7041});
7042
7043// merge static and dynamic style data on the same vnode
7044function normalizeStyleData (data) {
7045 var style = normalizeStyleBinding(data.style);
7046 // static style is pre-processed into an object during compilation
7047 // and is always a fresh object, so it's safe to merge into it
7048 return data.staticStyle
7049 ? extend(data.staticStyle, style)
7050 : style
7051}
7052
7053// normalize possible array / string values into Object
7054function normalizeStyleBinding (bindingStyle) {
7055 if (Array.isArray(bindingStyle)) {
7056 return toObject(bindingStyle)
7057 }
7058 if (typeof bindingStyle === 'string') {
7059 return parseStyleText(bindingStyle)
7060 }
7061 return bindingStyle
7062}
7063
7064/**
7065 * parent component style should be after child's
7066 * so that parent component's style could override it
7067 */
7068function getStyle (vnode, checkChild) {
7069 var res = {};
7070 var styleData;
7071
7072 if (checkChild) {
7073 var childNode = vnode;
7074 while (childNode.componentInstance) {
7075 childNode = childNode.componentInstance._vnode;
7076 if (
7077 childNode && childNode.data &&
7078 (styleData = normalizeStyleData(childNode.data))
7079 ) {
7080 extend(res, styleData);
7081 }
7082 }
7083 }
7084
7085 if ((styleData = normalizeStyleData(vnode.data))) {
7086 extend(res, styleData);
7087 }
7088
7089 var parentNode = vnode;
7090 while ((parentNode = parentNode.parent)) {
7091 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7092 extend(res, styleData);
7093 }
7094 }
7095 return res
7096}
7097
7098/* */
7099
7100var cssVarRE = /^--/;
7101var importantRE = /\s*!important$/;
7102var setProp = function (el, name, val) {
7103 /* istanbul ignore if */
7104 if (cssVarRE.test(name)) {
7105 el.style.setProperty(name, val);
7106 } else if (importantRE.test(val)) {
7107 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7108 } else {
7109 var normalizedName = normalize(name);
7110 if (Array.isArray(val)) {
7111 // Support values array created by autoprefixer, e.g.
7112 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7113 // Set them one by one, and the browser will only set those it can recognize
7114 for (var i = 0, len = val.length; i < len; i++) {
7115 el.style[normalizedName] = val[i];
7116 }
7117 } else {
7118 el.style[normalizedName] = val;
7119 }
7120 }
7121};
7122
7123var vendorNames = ['Webkit', 'Moz', 'ms'];
7124
7125var emptyStyle;
7126var normalize = cached(function (prop) {
7127 emptyStyle = emptyStyle || document.createElement('div').style;
7128 prop = camelize(prop);
7129 if (prop !== 'filter' && (prop in emptyStyle)) {
7130 return prop
7131 }
7132 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7133 for (var i = 0; i < vendorNames.length; i++) {
7134 var name = vendorNames[i] + capName;
7135 if (name in emptyStyle) {
7136 return name
7137 }
7138 }
7139});
7140
7141function updateStyle (oldVnode, vnode) {
7142 var data = vnode.data;
7143 var oldData = oldVnode.data;
7144
7145 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7146 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7147 ) {
7148 return
7149 }
7150
7151 var cur, name;
7152 var el = vnode.elm;
7153 var oldStaticStyle = oldData.staticStyle;
7154 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7155
7156 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7157 var oldStyle = oldStaticStyle || oldStyleBinding;
7158
7159 var style = normalizeStyleBinding(vnode.data.style) || {};
7160
7161 // store normalized style under a different key for next diff
7162 // make sure to clone it if it's reactive, since the user likely wants
7163 // to mutate it.
7164 vnode.data.normalizedStyle = isDef(style.__ob__)
7165 ? extend({}, style)
7166 : style;
7167
7168 var newStyle = getStyle(vnode, true);
7169
7170 for (name in oldStyle) {
7171 if (isUndef(newStyle[name])) {
7172 setProp(el, name, '');
7173 }
7174 }
7175 for (name in newStyle) {
7176 cur = newStyle[name];
7177 if (cur !== oldStyle[name]) {
7178 // ie9 setting to null has no effect, must use empty string
7179 setProp(el, name, cur == null ? '' : cur);
7180 }
7181 }
7182}
7183
7184var style = {
7185 create: updateStyle,
7186 update: updateStyle
7187};
7188
7189/* */
7190
7191var whitespaceRE = /\s+/;
7192
7193/**
7194 * Add class with compatibility for SVG since classList is not supported on
7195 * SVG elements in IE
7196 */
7197function addClass (el, cls) {
7198 /* istanbul ignore if */
7199 if (!cls || !(cls = cls.trim())) {
7200 return
7201 }
7202
7203 /* istanbul ignore else */
7204 if (el.classList) {
7205 if (cls.indexOf(' ') > -1) {
7206 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7207 } else {
7208 el.classList.add(cls);
7209 }
7210 } else {
7211 var cur = " " + (el.getAttribute('class') || '') + " ";
7212 if (cur.indexOf(' ' + cls + ' ') < 0) {
7213 el.setAttribute('class', (cur + cls).trim());
7214 }
7215 }
7216}
7217
7218/**
7219 * Remove class with compatibility for SVG since classList is not supported on
7220 * SVG elements in IE
7221 */
7222function removeClass (el, cls) {
7223 /* istanbul ignore if */
7224 if (!cls || !(cls = cls.trim())) {
7225 return
7226 }
7227
7228 /* istanbul ignore else */
7229 if (el.classList) {
7230 if (cls.indexOf(' ') > -1) {
7231 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7232 } else {
7233 el.classList.remove(cls);
7234 }
7235 if (!el.classList.length) {
7236 el.removeAttribute('class');
7237 }
7238 } else {
7239 var cur = " " + (el.getAttribute('class') || '') + " ";
7240 var tar = ' ' + cls + ' ';
7241 while (cur.indexOf(tar) >= 0) {
7242 cur = cur.replace(tar, ' ');
7243 }
7244 cur = cur.trim();
7245 if (cur) {
7246 el.setAttribute('class', cur);
7247 } else {
7248 el.removeAttribute('class');
7249 }
7250 }
7251}
7252
7253/* */
7254
7255function resolveTransition (def$$1) {
7256 if (!def$$1) {
7257 return
7258 }
7259 /* istanbul ignore else */
7260 if (typeof def$$1 === 'object') {
7261 var res = {};
7262 if (def$$1.css !== false) {
7263 extend(res, autoCssTransition(def$$1.name || 'v'));
7264 }
7265 extend(res, def$$1);
7266 return res
7267 } else if (typeof def$$1 === 'string') {
7268 return autoCssTransition(def$$1)
7269 }
7270}
7271
7272var autoCssTransition = cached(function (name) {
7273 return {
7274 enterClass: (name + "-enter"),
7275 enterToClass: (name + "-enter-to"),
7276 enterActiveClass: (name + "-enter-active"),
7277 leaveClass: (name + "-leave"),
7278 leaveToClass: (name + "-leave-to"),
7279 leaveActiveClass: (name + "-leave-active")
7280 }
7281});
7282
7283var hasTransition = inBrowser && !isIE9;
7284var TRANSITION = 'transition';
7285var ANIMATION = 'animation';
7286
7287// Transition property/event sniffing
7288var transitionProp = 'transition';
7289var transitionEndEvent = 'transitionend';
7290var animationProp = 'animation';
7291var animationEndEvent = 'animationend';
7292if (hasTransition) {
7293 /* istanbul ignore if */
7294 if (window.ontransitionend === undefined &&
7295 window.onwebkittransitionend !== undefined
7296 ) {
7297 transitionProp = 'WebkitTransition';
7298 transitionEndEvent = 'webkitTransitionEnd';
7299 }
7300 if (window.onanimationend === undefined &&
7301 window.onwebkitanimationend !== undefined
7302 ) {
7303 animationProp = 'WebkitAnimation';
7304 animationEndEvent = 'webkitAnimationEnd';
7305 }
7306}
7307
7308// binding to window is necessary to make hot reload work in IE in strict mode
7309var raf = inBrowser
7310 ? window.requestAnimationFrame
7311 ? window.requestAnimationFrame.bind(window)
7312 : setTimeout
7313 : /* istanbul ignore next */ function (fn) { return fn(); };
7314
7315function nextFrame (fn) {
7316 raf(function () {
7317 raf(fn);
7318 });
7319}
7320
7321function addTransitionClass (el, cls) {
7322 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7323 if (transitionClasses.indexOf(cls) < 0) {
7324 transitionClasses.push(cls);
7325 addClass(el, cls);
7326 }
7327}
7328
7329function removeTransitionClass (el, cls) {
7330 if (el._transitionClasses) {
7331 remove(el._transitionClasses, cls);
7332 }
7333 removeClass(el, cls);
7334}
7335
7336function whenTransitionEnds (
7337 el,
7338 expectedType,
7339 cb
7340) {
7341 var ref = getTransitionInfo(el, expectedType);
7342 var type = ref.type;
7343 var timeout = ref.timeout;
7344 var propCount = ref.propCount;
7345 if (!type) { return cb() }
7346 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7347 var ended = 0;
7348 var end = function () {
7349 el.removeEventListener(event, onEnd);
7350 cb();
7351 };
7352 var onEnd = function (e) {
7353 if (e.target === el) {
7354 if (++ended >= propCount) {
7355 end();
7356 }
7357 }
7358 };
7359 setTimeout(function () {
7360 if (ended < propCount) {
7361 end();
7362 }
7363 }, timeout + 1);
7364 el.addEventListener(event, onEnd);
7365}
7366
7367var transformRE = /\b(transform|all)(,|$)/;
7368
7369function getTransitionInfo (el, expectedType) {
7370 var styles = window.getComputedStyle(el);
7371 // JSDOM may return undefined for transition properties
7372 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7373 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7374 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7375 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7376 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7377 var animationTimeout = getTimeout(animationDelays, animationDurations);
7378
7379 var type;
7380 var timeout = 0;
7381 var propCount = 0;
7382 /* istanbul ignore if */
7383 if (expectedType === TRANSITION) {
7384 if (transitionTimeout > 0) {
7385 type = TRANSITION;
7386 timeout = transitionTimeout;
7387 propCount = transitionDurations.length;
7388 }
7389 } else if (expectedType === ANIMATION) {
7390 if (animationTimeout > 0) {
7391 type = ANIMATION;
7392 timeout = animationTimeout;
7393 propCount = animationDurations.length;
7394 }
7395 } else {
7396 timeout = Math.max(transitionTimeout, animationTimeout);
7397 type = timeout > 0
7398 ? transitionTimeout > animationTimeout
7399 ? TRANSITION
7400 : ANIMATION
7401 : null;
7402 propCount = type
7403 ? type === TRANSITION
7404 ? transitionDurations.length
7405 : animationDurations.length
7406 : 0;
7407 }
7408 var hasTransform =
7409 type === TRANSITION &&
7410 transformRE.test(styles[transitionProp + 'Property']);
7411 return {
7412 type: type,
7413 timeout: timeout,
7414 propCount: propCount,
7415 hasTransform: hasTransform
7416 }
7417}
7418
7419function getTimeout (delays, durations) {
7420 /* istanbul ignore next */
7421 while (delays.length < durations.length) {
7422 delays = delays.concat(delays);
7423 }
7424
7425 return Math.max.apply(null, durations.map(function (d, i) {
7426 return toMs(d) + toMs(delays[i])
7427 }))
7428}
7429
7430// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7431// in a locale-dependent way, using a comma instead of a dot.
7432// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7433// as a floor function) causing unexpected behaviors
7434function toMs (s) {
7435 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7436}
7437
7438/* */
7439
7440function enter (vnode, toggleDisplay) {
7441 var el = vnode.elm;
7442
7443 // call leave callback now
7444 if (isDef(el._leaveCb)) {
7445 el._leaveCb.cancelled = true;
7446 el._leaveCb();
7447 }
7448
7449 var data = resolveTransition(vnode.data.transition);
7450 if (isUndef(data)) {
7451 return
7452 }
7453
7454 /* istanbul ignore if */
7455 if (isDef(el._enterCb) || el.nodeType !== 1) {
7456 return
7457 }
7458
7459 var css = data.css;
7460 var type = data.type;
7461 var enterClass = data.enterClass;
7462 var enterToClass = data.enterToClass;
7463 var enterActiveClass = data.enterActiveClass;
7464 var appearClass = data.appearClass;
7465 var appearToClass = data.appearToClass;
7466 var appearActiveClass = data.appearActiveClass;
7467 var beforeEnter = data.beforeEnter;
7468 var enter = data.enter;
7469 var afterEnter = data.afterEnter;
7470 var enterCancelled = data.enterCancelled;
7471 var beforeAppear = data.beforeAppear;
7472 var appear = data.appear;
7473 var afterAppear = data.afterAppear;
7474 var appearCancelled = data.appearCancelled;
7475 var duration = data.duration;
7476
7477 // activeInstance will always be the <transition> component managing this
7478 // transition. One edge case to check is when the <transition> is placed
7479 // as the root node of a child component. In that case we need to check
7480 // <transition>'s parent for appear check.
7481 var context = activeInstance;
7482 var transitionNode = activeInstance.$vnode;
7483 while (transitionNode && transitionNode.parent) {
7484 context = transitionNode.context;
7485 transitionNode = transitionNode.parent;
7486 }
7487
7488 var isAppear = !context._isMounted || !vnode.isRootInsert;
7489
7490 if (isAppear && !appear && appear !== '') {
7491 return
7492 }
7493
7494 var startClass = isAppear && appearClass
7495 ? appearClass
7496 : enterClass;
7497 var activeClass = isAppear && appearActiveClass
7498 ? appearActiveClass
7499 : enterActiveClass;
7500 var toClass = isAppear && appearToClass
7501 ? appearToClass
7502 : enterToClass;
7503
7504 var beforeEnterHook = isAppear
7505 ? (beforeAppear || beforeEnter)
7506 : beforeEnter;
7507 var enterHook = isAppear
7508 ? (typeof appear === 'function' ? appear : enter)
7509 : enter;
7510 var afterEnterHook = isAppear
7511 ? (afterAppear || afterEnter)
7512 : afterEnter;
7513 var enterCancelledHook = isAppear
7514 ? (appearCancelled || enterCancelled)
7515 : enterCancelled;
7516
7517 var explicitEnterDuration = toNumber(
7518 isObject(duration)
7519 ? duration.enter
7520 : duration
7521 );
7522
7523 if (explicitEnterDuration != null) {
7524 checkDuration(explicitEnterDuration, 'enter', vnode);
7525 }
7526
7527 var expectsCSS = css !== false && !isIE9;
7528 var userWantsControl = getHookArgumentsLength(enterHook);
7529
7530 var cb = el._enterCb = once(function () {
7531 if (expectsCSS) {
7532 removeTransitionClass(el, toClass);
7533 removeTransitionClass(el, activeClass);
7534 }
7535 if (cb.cancelled) {
7536 if (expectsCSS) {
7537 removeTransitionClass(el, startClass);
7538 }
7539 enterCancelledHook && enterCancelledHook(el);
7540 } else {
7541 afterEnterHook && afterEnterHook(el);
7542 }
7543 el._enterCb = null;
7544 });
7545
7546 if (!vnode.data.show) {
7547 // remove pending leave element on enter by injecting an insert hook
7548 mergeVNodeHook(vnode, 'insert', function () {
7549 var parent = el.parentNode;
7550 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7551 if (pendingNode &&
7552 pendingNode.tag === vnode.tag &&
7553 pendingNode.elm._leaveCb
7554 ) {
7555 pendingNode.elm._leaveCb();
7556 }
7557 enterHook && enterHook(el, cb);
7558 });
7559 }
7560
7561 // start enter transition
7562 beforeEnterHook && beforeEnterHook(el);
7563 if (expectsCSS) {
7564 addTransitionClass(el, startClass);
7565 addTransitionClass(el, activeClass);
7566 nextFrame(function () {
7567 removeTransitionClass(el, startClass);
7568 if (!cb.cancelled) {
7569 addTransitionClass(el, toClass);
7570 if (!userWantsControl) {
7571 if (isValidDuration(explicitEnterDuration)) {
7572 setTimeout(cb, explicitEnterDuration);
7573 } else {
7574 whenTransitionEnds(el, type, cb);
7575 }
7576 }
7577 }
7578 });
7579 }
7580
7581 if (vnode.data.show) {
7582 toggleDisplay && toggleDisplay();
7583 enterHook && enterHook(el, cb);
7584 }
7585
7586 if (!expectsCSS && !userWantsControl) {
7587 cb();
7588 }
7589}
7590
7591function leave (vnode, rm) {
7592 var el = vnode.elm;
7593
7594 // call enter callback now
7595 if (isDef(el._enterCb)) {
7596 el._enterCb.cancelled = true;
7597 el._enterCb();
7598 }
7599
7600 var data = resolveTransition(vnode.data.transition);
7601 if (isUndef(data) || el.nodeType !== 1) {
7602 return rm()
7603 }
7604
7605 /* istanbul ignore if */
7606 if (isDef(el._leaveCb)) {
7607 return
7608 }
7609
7610 var css = data.css;
7611 var type = data.type;
7612 var leaveClass = data.leaveClass;
7613 var leaveToClass = data.leaveToClass;
7614 var leaveActiveClass = data.leaveActiveClass;
7615 var beforeLeave = data.beforeLeave;
7616 var leave = data.leave;
7617 var afterLeave = data.afterLeave;
7618 var leaveCancelled = data.leaveCancelled;
7619 var delayLeave = data.delayLeave;
7620 var duration = data.duration;
7621
7622 var expectsCSS = css !== false && !isIE9;
7623 var userWantsControl = getHookArgumentsLength(leave);
7624
7625 var explicitLeaveDuration = toNumber(
7626 isObject(duration)
7627 ? duration.leave
7628 : duration
7629 );
7630
7631 if (isDef(explicitLeaveDuration)) {
7632 checkDuration(explicitLeaveDuration, 'leave', vnode);
7633 }
7634
7635 var cb = el._leaveCb = once(function () {
7636 if (el.parentNode && el.parentNode._pending) {
7637 el.parentNode._pending[vnode.key] = null;
7638 }
7639 if (expectsCSS) {
7640 removeTransitionClass(el, leaveToClass);
7641 removeTransitionClass(el, leaveActiveClass);
7642 }
7643 if (cb.cancelled) {
7644 if (expectsCSS) {
7645 removeTransitionClass(el, leaveClass);
7646 }
7647 leaveCancelled && leaveCancelled(el);
7648 } else {
7649 rm();
7650 afterLeave && afterLeave(el);
7651 }
7652 el._leaveCb = null;
7653 });
7654
7655 if (delayLeave) {
7656 delayLeave(performLeave);
7657 } else {
7658 performLeave();
7659 }
7660
7661 function performLeave () {
7662 // the delayed leave may have already been cancelled
7663 if (cb.cancelled) {
7664 return
7665 }
7666 // record leaving element
7667 if (!vnode.data.show && el.parentNode) {
7668 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7669 }
7670 beforeLeave && beforeLeave(el);
7671 if (expectsCSS) {
7672 addTransitionClass(el, leaveClass);
7673 addTransitionClass(el, leaveActiveClass);
7674 nextFrame(function () {
7675 removeTransitionClass(el, leaveClass);
7676 if (!cb.cancelled) {
7677 addTransitionClass(el, leaveToClass);
7678 if (!userWantsControl) {
7679 if (isValidDuration(explicitLeaveDuration)) {
7680 setTimeout(cb, explicitLeaveDuration);
7681 } else {
7682 whenTransitionEnds(el, type, cb);
7683 }
7684 }
7685 }
7686 });
7687 }
7688 leave && leave(el, cb);
7689 if (!expectsCSS && !userWantsControl) {
7690 cb();
7691 }
7692 }
7693}
7694
7695// only used in dev mode
7696function checkDuration (val, name, vnode) {
7697 if (typeof val !== 'number') {
7698 warn(
7699 "<transition> explicit " + name + " duration is not a valid number - " +
7700 "got " + (JSON.stringify(val)) + ".",
7701 vnode.context
7702 );
7703 } else if (isNaN(val)) {
7704 warn(
7705 "<transition> explicit " + name + " duration is NaN - " +
7706 'the duration expression might be incorrect.',
7707 vnode.context
7708 );
7709 }
7710}
7711
7712function isValidDuration (val) {
7713 return typeof val === 'number' && !isNaN(val)
7714}
7715
7716/**
7717 * Normalize a transition hook's argument length. The hook may be:
7718 * - a merged hook (invoker) with the original in .fns
7719 * - a wrapped component method (check ._length)
7720 * - a plain function (.length)
7721 */
7722function getHookArgumentsLength (fn) {
7723 if (isUndef(fn)) {
7724 return false
7725 }
7726 var invokerFns = fn.fns;
7727 if (isDef(invokerFns)) {
7728 // invoker
7729 return getHookArgumentsLength(
7730 Array.isArray(invokerFns)
7731 ? invokerFns[0]
7732 : invokerFns
7733 )
7734 } else {
7735 return (fn._length || fn.length) > 1
7736 }
7737}
7738
7739function _enter (_, vnode) {
7740 if (vnode.data.show !== true) {
7741 enter(vnode);
7742 }
7743}
7744
7745var transition = inBrowser ? {
7746 create: _enter,
7747 activate: _enter,
7748 remove: function remove$$1 (vnode, rm) {
7749 /* istanbul ignore else */
7750 if (vnode.data.show !== true) {
7751 leave(vnode, rm);
7752 } else {
7753 rm();
7754 }
7755 }
7756} : {};
7757
7758var platformModules = [
7759 attrs,
7760 klass,
7761 events,
7762 domProps,
7763 style,
7764 transition
7765];
7766
7767/* */
7768
7769// the directive module should be applied last, after all
7770// built-in modules have been applied.
7771var modules = platformModules.concat(baseModules);
7772
7773var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7774
7775/**
7776 * Not type checking this file because flow doesn't like attaching
7777 * properties to Elements.
7778 */
7779
7780/* istanbul ignore if */
7781if (isIE9) {
7782 // http://www.matts411.com/post/internet-explorer-9-oninput/
7783 document.addEventListener('selectionchange', function () {
7784 var el = document.activeElement;
7785 if (el && el.vmodel) {
7786 trigger(el, 'input');
7787 }
7788 });
7789}
7790
7791var directive = {
7792 inserted: function inserted (el, binding, vnode, oldVnode) {
7793 if (vnode.tag === 'select') {
7794 // #6903
7795 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7796 mergeVNodeHook(vnode, 'postpatch', function () {
7797 directive.componentUpdated(el, binding, vnode);
7798 });
7799 } else {
7800 setSelected(el, binding, vnode.context);
7801 }
7802 el._vOptions = [].map.call(el.options, getValue);
7803 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7804 el._vModifiers = binding.modifiers;
7805 if (!binding.modifiers.lazy) {
7806 el.addEventListener('compositionstart', onCompositionStart);
7807 el.addEventListener('compositionend', onCompositionEnd);
7808 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7809 // switching focus before confirming composition choice
7810 // this also fixes the issue where some browsers e.g. iOS Chrome
7811 // fires "change" instead of "input" on autocomplete.
7812 el.addEventListener('change', onCompositionEnd);
7813 /* istanbul ignore if */
7814 if (isIE9) {
7815 el.vmodel = true;
7816 }
7817 }
7818 }
7819 },
7820
7821 componentUpdated: function componentUpdated (el, binding, vnode) {
7822 if (vnode.tag === 'select') {
7823 setSelected(el, binding, vnode.context);
7824 // in case the options rendered by v-for have changed,
7825 // it's possible that the value is out-of-sync with the rendered options.
7826 // detect such cases and filter out values that no longer has a matching
7827 // option in the DOM.
7828 var prevOptions = el._vOptions;
7829 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7830 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7831 // trigger change event if
7832 // no matching option found for at least one value
7833 var needReset = el.multiple
7834 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7835 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7836 if (needReset) {
7837 trigger(el, 'change');
7838 }
7839 }
7840 }
7841 }
7842};
7843
7844function setSelected (el, binding, vm) {
7845 actuallySetSelected(el, binding, vm);
7846 /* istanbul ignore if */
7847 if (isIE || isEdge) {
7848 setTimeout(function () {
7849 actuallySetSelected(el, binding, vm);
7850 }, 0);
7851 }
7852}
7853
7854function actuallySetSelected (el, binding, vm) {
7855 var value = binding.value;
7856 var isMultiple = el.multiple;
7857 if (isMultiple && !Array.isArray(value)) {
7858 warn(
7859 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7860 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7861 vm
7862 );
7863 return
7864 }
7865 var selected, option;
7866 for (var i = 0, l = el.options.length; i < l; i++) {
7867 option = el.options[i];
7868 if (isMultiple) {
7869 selected = looseIndexOf(value, getValue(option)) > -1;
7870 if (option.selected !== selected) {
7871 option.selected = selected;
7872 }
7873 } else {
7874 if (looseEqual(getValue(option), value)) {
7875 if (el.selectedIndex !== i) {
7876 el.selectedIndex = i;
7877 }
7878 return
7879 }
7880 }
7881 }
7882 if (!isMultiple) {
7883 el.selectedIndex = -1;
7884 }
7885}
7886
7887function hasNoMatchingOption (value, options) {
7888 return options.every(function (o) { return !looseEqual(o, value); })
7889}
7890
7891function getValue (option) {
7892 return '_value' in option
7893 ? option._value
7894 : option.value
7895}
7896
7897function onCompositionStart (e) {
7898 e.target.composing = true;
7899}
7900
7901function onCompositionEnd (e) {
7902 // prevent triggering an input event for no reason
7903 if (!e.target.composing) { return }
7904 e.target.composing = false;
7905 trigger(e.target, 'input');
7906}
7907
7908function trigger (el, type) {
7909 var e = document.createEvent('HTMLEvents');
7910 e.initEvent(type, true, true);
7911 el.dispatchEvent(e);
7912}
7913
7914/* */
7915
7916// recursively search for possible transition defined inside the component root
7917function locateNode (vnode) {
7918 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7919 ? locateNode(vnode.componentInstance._vnode)
7920 : vnode
7921}
7922
7923var show = {
7924 bind: function bind (el, ref, vnode) {
7925 var value = ref.value;
7926
7927 vnode = locateNode(vnode);
7928 var transition$$1 = vnode.data && vnode.data.transition;
7929 var originalDisplay = el.__vOriginalDisplay =
7930 el.style.display === 'none' ? '' : el.style.display;
7931 if (value && transition$$1) {
7932 vnode.data.show = true;
7933 enter(vnode, function () {
7934 el.style.display = originalDisplay;
7935 });
7936 } else {
7937 el.style.display = value ? originalDisplay : 'none';
7938 }
7939 },
7940
7941 update: function update (el, ref, vnode) {
7942 var value = ref.value;
7943 var oldValue = ref.oldValue;
7944
7945 /* istanbul ignore if */
7946 if (!value === !oldValue) { return }
7947 vnode = locateNode(vnode);
7948 var transition$$1 = vnode.data && vnode.data.transition;
7949 if (transition$$1) {
7950 vnode.data.show = true;
7951 if (value) {
7952 enter(vnode, function () {
7953 el.style.display = el.__vOriginalDisplay;
7954 });
7955 } else {
7956 leave(vnode, function () {
7957 el.style.display = 'none';
7958 });
7959 }
7960 } else {
7961 el.style.display = value ? el.__vOriginalDisplay : 'none';
7962 }
7963 },
7964
7965 unbind: function unbind (
7966 el,
7967 binding,
7968 vnode,
7969 oldVnode,
7970 isDestroy
7971 ) {
7972 if (!isDestroy) {
7973 el.style.display = el.__vOriginalDisplay;
7974 }
7975 }
7976};
7977
7978var platformDirectives = {
7979 model: directive,
7980 show: show
7981};
7982
7983/* */
7984
7985var transitionProps = {
7986 name: String,
7987 appear: Boolean,
7988 css: Boolean,
7989 mode: String,
7990 type: String,
7991 enterClass: String,
7992 leaveClass: String,
7993 enterToClass: String,
7994 leaveToClass: String,
7995 enterActiveClass: String,
7996 leaveActiveClass: String,
7997 appearClass: String,
7998 appearActiveClass: String,
7999 appearToClass: String,
8000 duration: [Number, String, Object]
8001};
8002
8003// in case the child is also an abstract component, e.g. <keep-alive>
8004// we want to recursively retrieve the real component to be rendered
8005function getRealChild (vnode) {
8006 var compOptions = vnode && vnode.componentOptions;
8007 if (compOptions && compOptions.Ctor.options.abstract) {
8008 return getRealChild(getFirstComponentChild(compOptions.children))
8009 } else {
8010 return vnode
8011 }
8012}
8013
8014function extractTransitionData (comp) {
8015 var data = {};
8016 var options = comp.$options;
8017 // props
8018 for (var key in options.propsData) {
8019 data[key] = comp[key];
8020 }
8021 // events.
8022 // extract listeners and pass them directly to the transition methods
8023 var listeners = options._parentListeners;
8024 for (var key$1 in listeners) {
8025 data[camelize(key$1)] = listeners[key$1];
8026 }
8027 return data
8028}
8029
8030function placeholder (h, rawChild) {
8031 if (/\d-keep-alive$/.test(rawChild.tag)) {
8032 return h('keep-alive', {
8033 props: rawChild.componentOptions.propsData
8034 })
8035 }
8036}
8037
8038function hasParentTransition (vnode) {
8039 while ((vnode = vnode.parent)) {
8040 if (vnode.data.transition) {
8041 return true
8042 }
8043 }
8044}
8045
8046function isSameChild (child, oldChild) {
8047 return oldChild.key === child.key && oldChild.tag === child.tag
8048}
8049
8050var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8051
8052var isVShowDirective = function (d) { return d.name === 'show'; };
8053
8054var Transition = {
8055 name: 'transition',
8056 props: transitionProps,
8057 abstract: true,
8058
8059 render: function render (h) {
8060 var this$1 = this;
8061
8062 var children = this.$slots.default;
8063 if (!children) {
8064 return
8065 }
8066
8067 // filter out text nodes (possible whitespaces)
8068 children = children.filter(isNotTextNode);
8069 /* istanbul ignore if */
8070 if (!children.length) {
8071 return
8072 }
8073
8074 // warn multiple elements
8075 if (children.length > 1) {
8076 warn(
8077 '<transition> can only be used on a single element. Use ' +
8078 '<transition-group> for lists.',
8079 this.$parent
8080 );
8081 }
8082
8083 var mode = this.mode;
8084
8085 // warn invalid mode
8086 if (mode && mode !== 'in-out' && mode !== 'out-in'
8087 ) {
8088 warn(
8089 'invalid <transition> mode: ' + mode,
8090 this.$parent
8091 );
8092 }
8093
8094 var rawChild = children[0];
8095
8096 // if this is a component root node and the component's
8097 // parent container node also has transition, skip.
8098 if (hasParentTransition(this.$vnode)) {
8099 return rawChild
8100 }
8101
8102 // apply transition data to child
8103 // use getRealChild() to ignore abstract components e.g. keep-alive
8104 var child = getRealChild(rawChild);
8105 /* istanbul ignore if */
8106 if (!child) {
8107 return rawChild
8108 }
8109
8110 if (this._leaving) {
8111 return placeholder(h, rawChild)
8112 }
8113
8114 // ensure a key that is unique to the vnode type and to this transition
8115 // component instance. This key will be used to remove pending leaving nodes
8116 // during entering.
8117 var id = "__transition-" + (this._uid) + "-";
8118 child.key = child.key == null
8119 ? child.isComment
8120 ? id + 'comment'
8121 : id + child.tag
8122 : isPrimitive(child.key)
8123 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8124 : child.key;
8125
8126 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8127 var oldRawChild = this._vnode;
8128 var oldChild = getRealChild(oldRawChild);
8129
8130 // mark v-show
8131 // so that the transition module can hand over the control to the directive
8132 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8133 child.data.show = true;
8134 }
8135
8136 if (
8137 oldChild &&
8138 oldChild.data &&
8139 !isSameChild(child, oldChild) &&
8140 !isAsyncPlaceholder(oldChild) &&
8141 // #6687 component root is a comment node
8142 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8143 ) {
8144 // replace old child transition data with fresh one
8145 // important for dynamic transitions!
8146 var oldData = oldChild.data.transition = extend({}, data);
8147 // handle transition mode
8148 if (mode === 'out-in') {
8149 // return placeholder node and queue update when leave finishes
8150 this._leaving = true;
8151 mergeVNodeHook(oldData, 'afterLeave', function () {
8152 this$1._leaving = false;
8153 this$1.$forceUpdate();
8154 });
8155 return placeholder(h, rawChild)
8156 } else if (mode === 'in-out') {
8157 if (isAsyncPlaceholder(child)) {
8158 return oldRawChild
8159 }
8160 var delayedLeave;
8161 var performLeave = function () { delayedLeave(); };
8162 mergeVNodeHook(data, 'afterEnter', performLeave);
8163 mergeVNodeHook(data, 'enterCancelled', performLeave);
8164 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8165 }
8166 }
8167
8168 return rawChild
8169 }
8170};
8171
8172/* */
8173
8174var props = extend({
8175 tag: String,
8176 moveClass: String
8177}, transitionProps);
8178
8179delete props.mode;
8180
8181var TransitionGroup = {
8182 props: props,
8183
8184 beforeMount: function beforeMount () {
8185 var this$1 = this;
8186
8187 var update = this._update;
8188 this._update = function (vnode, hydrating) {
8189 var restoreActiveInstance = setActiveInstance(this$1);
8190 // force removing pass
8191 this$1.__patch__(
8192 this$1._vnode,
8193 this$1.kept,
8194 false, // hydrating
8195 true // removeOnly (!important, avoids unnecessary moves)
8196 );
8197 this$1._vnode = this$1.kept;
8198 restoreActiveInstance();
8199 update.call(this$1, vnode, hydrating);
8200 };
8201 },
8202
8203 render: function render (h) {
8204 var tag = this.tag || this.$vnode.data.tag || 'span';
8205 var map = Object.create(null);
8206 var prevChildren = this.prevChildren = this.children;
8207 var rawChildren = this.$slots.default || [];
8208 var children = this.children = [];
8209 var transitionData = extractTransitionData(this);
8210
8211 for (var i = 0; i < rawChildren.length; i++) {
8212 var c = rawChildren[i];
8213 if (c.tag) {
8214 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8215 children.push(c);
8216 map[c.key] = c
8217 ;(c.data || (c.data = {})).transition = transitionData;
8218 } else {
8219 var opts = c.componentOptions;
8220 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8221 warn(("<transition-group> children must be keyed: <" + name + ">"));
8222 }
8223 }
8224 }
8225
8226 if (prevChildren) {
8227 var kept = [];
8228 var removed = [];
8229 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8230 var c$1 = prevChildren[i$1];
8231 c$1.data.transition = transitionData;
8232 c$1.data.pos = c$1.elm.getBoundingClientRect();
8233 if (map[c$1.key]) {
8234 kept.push(c$1);
8235 } else {
8236 removed.push(c$1);
8237 }
8238 }
8239 this.kept = h(tag, null, kept);
8240 this.removed = removed;
8241 }
8242
8243 return h(tag, null, children)
8244 },
8245
8246 updated: function updated () {
8247 var children = this.prevChildren;
8248 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8249 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8250 return
8251 }
8252
8253 // we divide the work into three loops to avoid mixing DOM reads and writes
8254 // in each iteration - which helps prevent layout thrashing.
8255 children.forEach(callPendingCbs);
8256 children.forEach(recordPosition);
8257 children.forEach(applyTranslation);
8258
8259 // force reflow to put everything in position
8260 // assign to this to avoid being removed in tree-shaking
8261 // $flow-disable-line
8262 this._reflow = document.body.offsetHeight;
8263
8264 children.forEach(function (c) {
8265 if (c.data.moved) {
8266 var el = c.elm;
8267 var s = el.style;
8268 addTransitionClass(el, moveClass);
8269 s.transform = s.WebkitTransform = s.transitionDuration = '';
8270 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8271 if (e && e.target !== el) {
8272 return
8273 }
8274 if (!e || /transform$/.test(e.propertyName)) {
8275 el.removeEventListener(transitionEndEvent, cb);
8276 el._moveCb = null;
8277 removeTransitionClass(el, moveClass);
8278 }
8279 });
8280 }
8281 });
8282 },
8283
8284 methods: {
8285 hasMove: function hasMove (el, moveClass) {
8286 /* istanbul ignore if */
8287 if (!hasTransition) {
8288 return false
8289 }
8290 /* istanbul ignore if */
8291 if (this._hasMove) {
8292 return this._hasMove
8293 }
8294 // Detect whether an element with the move class applied has
8295 // CSS transitions. Since the element may be inside an entering
8296 // transition at this very moment, we make a clone of it and remove
8297 // all other transition classes applied to ensure only the move class
8298 // is applied.
8299 var clone = el.cloneNode();
8300 if (el._transitionClasses) {
8301 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8302 }
8303 addClass(clone, moveClass);
8304 clone.style.display = 'none';
8305 this.$el.appendChild(clone);
8306 var info = getTransitionInfo(clone);
8307 this.$el.removeChild(clone);
8308 return (this._hasMove = info.hasTransform)
8309 }
8310 }
8311};
8312
8313function callPendingCbs (c) {
8314 /* istanbul ignore if */
8315 if (c.elm._moveCb) {
8316 c.elm._moveCb();
8317 }
8318 /* istanbul ignore if */
8319 if (c.elm._enterCb) {
8320 c.elm._enterCb();
8321 }
8322}
8323
8324function recordPosition (c) {
8325 c.data.newPos = c.elm.getBoundingClientRect();
8326}
8327
8328function applyTranslation (c) {
8329 var oldPos = c.data.pos;
8330 var newPos = c.data.newPos;
8331 var dx = oldPos.left - newPos.left;
8332 var dy = oldPos.top - newPos.top;
8333 if (dx || dy) {
8334 c.data.moved = true;
8335 var s = c.elm.style;
8336 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8337 s.transitionDuration = '0s';
8338 }
8339}
8340
8341var platformComponents = {
8342 Transition: Transition,
8343 TransitionGroup: TransitionGroup
8344};
8345
8346/* */
8347
8348// install platform specific utils
8349Vue.config.mustUseProp = mustUseProp;
8350Vue.config.isReservedTag = isReservedTag;
8351Vue.config.isReservedAttr = isReservedAttr;
8352Vue.config.getTagNamespace = getTagNamespace;
8353Vue.config.isUnknownElement = isUnknownElement;
8354
8355// install platform runtime directives & components
8356extend(Vue.options.directives, platformDirectives);
8357extend(Vue.options.components, platformComponents);
8358
8359// install platform patch function
8360Vue.prototype.__patch__ = inBrowser ? patch : noop;
8361
8362// public mount method
8363Vue.prototype.$mount = function (
8364 el,
8365 hydrating
8366) {
8367 el = el && inBrowser ? query(el) : undefined;
8368 return mountComponent(this, el, hydrating)
8369};
8370
8371// devtools global hook
8372/* istanbul ignore next */
8373if (inBrowser) {
8374 setTimeout(function () {
8375 if (config.devtools) {
8376 if (devtools) {
8377 devtools.emit('init', Vue);
8378 } else {
8379 console[console.info ? 'info' : 'log'](
8380 'Download the Vue Devtools extension for a better development experience:\n' +
8381 'https://github.com/vuejs/vue-devtools'
8382 );
8383 }
8384 }
8385 if (config.productionTip !== false &&
8386 typeof console !== 'undefined'
8387 ) {
8388 console[console.info ? 'info' : 'log'](
8389 "You are running Vue in development mode.\n" +
8390 "Make sure to turn on production mode when deploying for production.\n" +
8391 "See more tips at https://vuejs.org/guide/deployment.html"
8392 );
8393 }
8394 }, 0);
8395}
8396
8397/* */
8398
8399module.exports = Vue;