UNPKG

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