UNPKG

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