· 8 years ago · Jan 04, 2018, 08:04 AM
1/*!
2 * Vue.js v2.5.13
3 * (c) 2014-2017 Evan You
4 * Released under the MIT License.
5 */
6(function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8 typeof define === 'function' && define.amd ? define(factory) :
9 (global.Vue = factory());
10}(this, (function () { 'use strict';
11
12/* */
13
14var emptyObject = Object.freeze({});
15
16// these helpers produces better vm code in JS engines due to their
17// explicitness and function inlining
18function isUndef (v) {
19 return v === undefined || v === null
20}
21
22function isDef (v) {
23 return v !== undefined && v !== null
24}
25
26function isTrue (v) {
27 return v === true
28}
29
30function isFalse (v) {
31 return v === false
32}
33
34/**
35 * Check if value is primitive
36 */
37function isPrimitive (value) {
38 return (
39 typeof value === 'string' ||
40 typeof value === 'number' ||
41 // $flow-disable-line
42 typeof value === 'symbol' ||
43 typeof value === 'boolean'
44 )
45}
46
47/**
48 * Quick object check - this is primarily used to tell
49 * Objects from primitive values when we know the value
50 * is a JSON-compliant type.
51 */
52function isObject (obj) {
53 return obj !== null && typeof obj === 'object'
54}
55
56/**
57 * Get the raw type string of a value e.g. [object Object]
58 */
59var _toString = Object.prototype.toString;
60
61function toRawType (value) {
62 return _toString.call(value).slice(8, -1)
63}
64
65/**
66 * Strict object type check. Only returns true
67 * for plain JavaScript objects.
68 */
69function isPlainObject (obj) {
70 return _toString.call(obj) === '[object Object]'
71}
72
73function isRegExp (v) {
74 return _toString.call(v) === '[object RegExp]'
75}
76
77/**
78 * Check if val is a valid array index.
79 */
80function isValidArrayIndex (val) {
81 var n = parseFloat(String(val));
82 return n >= 0 && Math.floor(n) === n && isFinite(val)
83}
84
85/**
86 * Convert a value to a string that is actually rendered.
87 */
88function toString (val) {
89 return val == null
90 ? ''
91 : typeof val === 'object'
92 ? JSON.stringify(val, null, 2)
93 : String(val)
94}
95
96/**
97 * Convert a input value to a number for persistence.
98 * If the conversion fails, return original string.
99 */
100function toNumber (val) {
101 var n = parseFloat(val);
102 return isNaN(n) ? val : n
103}
104
105/**
106 * Make a map and return a function for checking if a key
107 * is in that map.
108 */
109function makeMap (
110 str,
111 expectsLowerCase
112) {
113 var map = Object.create(null);
114 var list = str.split(',');
115 for (var i = 0; i < list.length; i++) {
116 map[list[i]] = true;
117 }
118 return expectsLowerCase
119 ? function (val) { return map[val.toLowerCase()]; }
120 : function (val) { return map[val]; }
121}
122
123/**
124 * Check if a tag is a built-in tag.
125 */
126var isBuiltInTag = makeMap('slot,component', true);
127
128/**
129 * Check if a attribute is a reserved attribute.
130 */
131var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
132
133/**
134 * Remove an item from an array
135 */
136function remove (arr, item) {
137 if (arr.length) {
138 var index = arr.indexOf(item);
139 if (index > -1) {
140 return arr.splice(index, 1)
141 }
142 }
143}
144
145/**
146 * Check whether the object has the property.
147 */
148var hasOwnProperty = Object.prototype.hasOwnProperty;
149function hasOwn (obj, key) {
150 return hasOwnProperty.call(obj, key)
151}
152
153/**
154 * Create a cached version of a pure function.
155 */
156function cached (fn) {
157 var cache = Object.create(null);
158 return (function cachedFn (str) {
159 var hit = cache[str];
160 return hit || (cache[str] = fn(str))
161 })
162}
163
164/**
165 * Camelize a hyphen-delimited string.
166 */
167var camelizeRE = /-(\w)/g;
168var camelize = cached(function (str) {
169 return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
170});
171
172/**
173 * Capitalize a string.
174 */
175var capitalize = cached(function (str) {
176 return str.charAt(0).toUpperCase() + str.slice(1)
177});
178
179/**
180 * Hyphenate a camelCase string.
181 */
182var hyphenateRE = /\B([A-Z])/g;
183var hyphenate = cached(function (str) {
184 return str.replace(hyphenateRE, '-$1').toLowerCase()
185});
186
187/**
188 * Simple bind, faster than native
189 */
190function bind (fn, ctx) {
191 function boundFn (a) {
192 var l = arguments.length;
193 return l
194 ? l > 1
195 ? fn.apply(ctx, arguments)
196 : fn.call(ctx, a)
197 : fn.call(ctx)
198 }
199 // record original fn length
200 boundFn._length = fn.length;
201 return boundFn
202}
203
204/**
205 * Convert an Array-like object to a real Array.
206 */
207function toArray (list, start) {
208 start = start || 0;
209 var i = list.length - start;
210 var ret = new Array(i);
211 while (i--) {
212 ret[i] = list[i + start];
213 }
214 return ret
215}
216
217/**
218 * Mix properties into target object.
219 */
220function extend (to, _from) {
221 for (var key in _from) {
222 to[key] = _from[key];
223 }
224 return to
225}
226
227/**
228 * Merge an Array of Objects into a single Object.
229 */
230function toObject (arr) {
231 var res = {};
232 for (var i = 0; i < arr.length; i++) {
233 if (arr[i]) {
234 extend(res, arr[i]);
235 }
236 }
237 return res
238}
239
240/**
241 * Perform no operation.
242 * Stubbing args to make Flow happy without leaving useless transpiled code
243 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
244 */
245function noop (a, b, c) {}
246
247/**
248 * Always return false.
249 */
250var no = function (a, b, c) { return false; };
251
252/**
253 * Return same value
254 */
255var identity = function (_) { return _; };
256
257/**
258 * Generate a static keys string from compiler modules.
259 */
260function genStaticKeys (modules) {
261 return modules.reduce(function (keys, m) {
262 return keys.concat(m.staticKeys || [])
263 }, []).join(',')
264}
265
266/**
267 * Check if two values are loosely equal - that is,
268 * if they are plain objects, do they have the same shape?
269 */
270function looseEqual (a, b) {
271 if (a === b) { return true }
272 var isObjectA = isObject(a);
273 var isObjectB = isObject(b);
274 if (isObjectA && isObjectB) {
275 try {
276 var isArrayA = Array.isArray(a);
277 var isArrayB = Array.isArray(b);
278 if (isArrayA && isArrayB) {
279 return a.length === b.length && a.every(function (e, i) {
280 return looseEqual(e, b[i])
281 })
282 } else if (!isArrayA && !isArrayB) {
283 var keysA = Object.keys(a);
284 var keysB = Object.keys(b);
285 return keysA.length === keysB.length && keysA.every(function (key) {
286 return looseEqual(a[key], b[key])
287 })
288 } else {
289 /* istanbul ignore next */
290 return false
291 }
292 } catch (e) {
293 /* istanbul ignore next */
294 return false
295 }
296 } else if (!isObjectA && !isObjectB) {
297 return String(a) === String(b)
298 } else {
299 return false
300 }
301}
302
303function looseIndexOf (arr, val) {
304 for (var i = 0; i < arr.length; i++) {
305 if (looseEqual(arr[i], val)) { return i }
306 }
307 return -1
308}
309
310/**
311 * Ensure a function is called only once.
312 */
313function once (fn) {
314 var called = false;
315 return function () {
316 if (!called) {
317 called = true;
318 fn.apply(this, arguments);
319 }
320 }
321}
322
323var SSR_ATTR = 'data-server-rendered';
324
325var ASSET_TYPES = [
326 'component',
327 'directive',
328 'filter'
329];
330
331var LIFECYCLE_HOOKS = [
332 'beforeCreate',
333 'created',
334 'beforeMount',
335 'mounted',
336 'beforeUpdate',
337 'updated',
338 'beforeDestroy',
339 'destroyed',
340 'activated',
341 'deactivated',
342 'errorCaptured'
343];
344
345/* */
346
347var config = ({
348 /**
349 * Option merge strategies (used in core/util/options)
350 */
351 // $flow-disable-line
352 optionMergeStrategies: Object.create(null),
353
354 /**
355 * Whether to suppress warnings.
356 */
357 silent: false,
358
359 /**
360 * Show production mode tip message on boot?
361 */
362 productionTip: "development" !== 'production',
363
364 /**
365 * Whether to enable devtools
366 */
367 devtools: "development" !== 'production',
368
369 /**
370 * Whether to record perf
371 */
372 performance: false,
373
374 /**
375 * Error handler for watcher errors
376 */
377 errorHandler: null,
378
379 /**
380 * Warn handler for watcher warns
381 */
382 warnHandler: null,
383
384 /**
385 * Ignore certain custom elements
386 */
387 ignoredElements: [],
388
389 /**
390 * Custom user key aliases for v-on
391 */
392 // $flow-disable-line
393 keyCodes: Object.create(null),
394
395 /**
396 * Check if a tag is reserved so that it cannot be registered as a
397 * component. This is platform-dependent and may be overwritten.
398 */
399 isReservedTag: no,
400
401 /**
402 * Check if an attribute is reserved so that it cannot be used as a component
403 * prop. This is platform-dependent and may be overwritten.
404 */
405 isReservedAttr: no,
406
407 /**
408 * Check if a tag is an unknown element.
409 * Platform-dependent.
410 */
411 isUnknownElement: no,
412
413 /**
414 * Get the namespace of an element
415 */
416 getTagNamespace: noop,
417
418 /**
419 * Parse the real tag name for the specific platform.
420 */
421 parsePlatformTagName: identity,
422
423 /**
424 * Check if an attribute must be bound using property, e.g. value
425 * Platform-dependent.
426 */
427 mustUseProp: no,
428
429 /**
430 * Exposed for legacy reasons
431 */
432 _lifecycleHooks: LIFECYCLE_HOOKS
433});
434
435/* */
436
437/**
438 * Check if a string starts with $ or _
439 */
440function isReserved (str) {
441 var c = (str + '').charCodeAt(0);
442 return c === 0x24 || c === 0x5F
443}
444
445/**
446 * Define a property.
447 */
448function def (obj, key, val, enumerable) {
449 Object.defineProperty(obj, key, {
450 value: val,
451 enumerable: !!enumerable,
452 writable: true,
453 configurable: true
454 });
455}
456
457/**
458 * Parse simple path.
459 */
460var bailRE = /[^\w.$]/;
461function parsePath (path) {
462 if (bailRE.test(path)) {
463 return
464 }
465 var segments = path.split('.');
466 return function (obj) {
467 for (var i = 0; i < segments.length; i++) {
468 if (!obj) { return }
469 obj = obj[segments[i]];
470 }
471 return obj
472 }
473}
474
475/* */
476
477
478// can we use __proto__?
479var hasProto = '__proto__' in {};
480
481// Browser environment sniffing
482var inBrowser = typeof window !== 'undefined';
483var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
484var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
485var UA = inBrowser && window.navigator.userAgent.toLowerCase();
486var isIE = UA && /msie|trident/.test(UA);
487var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
488var isEdge = UA && UA.indexOf('edge/') > 0;
489var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
490var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
491var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
492
493// Firefox has a "watch" function on Object.prototype...
494var nativeWatch = ({}).watch;
495
496var supportsPassive = false;
497if (inBrowser) {
498 try {
499 var opts = {};
500 Object.defineProperty(opts, 'passive', ({
501 get: function get () {
502 /* istanbul ignore next */
503 supportsPassive = true;
504 }
505 })); // https://github.com/facebook/flow/issues/285
506 window.addEventListener('test-passive', null, opts);
507 } catch (e) {}
508}
509
510// this needs to be lazy-evaled because vue may be required before
511// vue-server-renderer can set VUE_ENV
512var _isServer;
513var isServerRendering = function () {
514 if (_isServer === undefined) {
515 /* istanbul ignore if */
516 if (!inBrowser && typeof global !== 'undefined') {
517 // detect presence of vue-server-renderer and avoid
518 // Webpack shimming the process
519 _isServer = global['process'].env.VUE_ENV === 'server';
520 } else {
521 _isServer = false;
522 }
523 }
524 return _isServer
525};
526
527// detect devtools
528var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
529
530/* istanbul ignore next */
531function isNative (Ctor) {
532 return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
533}
534
535var hasSymbol =
536 typeof Symbol !== 'undefined' && isNative(Symbol) &&
537 typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
538
539var _Set;
540/* istanbul ignore if */ // $flow-disable-line
541if (typeof Set !== 'undefined' && isNative(Set)) {
542 // use native Set when available.
543 _Set = Set;
544} else {
545 // a non-standard Set polyfill that only works with primitive keys.
546 _Set = (function () {
547 function Set () {
548 this.set = Object.create(null);
549 }
550 Set.prototype.has = function has (key) {
551 return this.set[key] === true
552 };
553 Set.prototype.add = function add (key) {
554 this.set[key] = true;
555 };
556 Set.prototype.clear = function clear () {
557 this.set = Object.create(null);
558 };
559
560 return Set;
561 }());
562}
563
564/* */
565
566var warn = noop;
567var tip = noop;
568var generateComponentTrace = (noop); // work around flow check
569var formatComponentName = (noop);
570
571{
572 var hasConsole = typeof console !== 'undefined';
573 var classifyRE = /(?:^|[-_])(\w)/g;
574 var classify = function (str) { return str
575 .replace(classifyRE, function (c) { return c.toUpperCase(); })
576 .replace(/[-_]/g, ''); };
577
578 warn = function (msg, vm) {
579 var trace = vm ? generateComponentTrace(vm) : '';
580
581 if (config.warnHandler) {
582 config.warnHandler.call(null, msg, vm, trace);
583 } else if (hasConsole && (!config.silent)) {
584 console.error(("[Vue warn]: " + msg + trace));
585 }
586 };
587
588 tip = function (msg, vm) {
589 if (hasConsole && (!config.silent)) {
590 console.warn("[Vue tip]: " + msg + (
591 vm ? generateComponentTrace(vm) : ''
592 ));
593 }
594 };
595
596 formatComponentName = function (vm, includeFile) {
597 if (vm.$root === vm) {
598 return '<Root>'
599 }
600 var options = typeof vm === 'function' && vm.cid != null
601 ? vm.options
602 : vm._isVue
603 ? vm.$options || vm.constructor.options
604 : vm || {};
605 var name = options.name || options._componentTag;
606 var file = options.__file;
607 if (!name && file) {
608 var match = file.match(/([^/\\]+)\.vue$/);
609 name = match && match[1];
610 }
611
612 return (
613 (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
614 (file && includeFile !== false ? (" at " + file) : '')
615 )
616 };
617
618 var repeat = function (str, n) {
619 var res = '';
620 while (n) {
621 if (n % 2 === 1) { res += str; }
622 if (n > 1) { str += str; }
623 n >>= 1;
624 }
625 return res
626 };
627
628 generateComponentTrace = function (vm) {
629 if (vm._isVue && vm.$parent) {
630 var tree = [];
631 var currentRecursiveSequence = 0;
632 while (vm) {
633 if (tree.length > 0) {
634 var last = tree[tree.length - 1];
635 if (last.constructor === vm.constructor) {
636 currentRecursiveSequence++;
637 vm = vm.$parent;
638 continue
639 } else if (currentRecursiveSequence > 0) {
640 tree[tree.length - 1] = [last, currentRecursiveSequence];
641 currentRecursiveSequence = 0;
642 }
643 }
644 tree.push(vm);
645 vm = vm.$parent;
646 }
647 return '\n\nfound in\n\n' + tree
648 .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
649 ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
650 : formatComponentName(vm))); })
651 .join('\n')
652 } else {
653 return ("\n\n(found in " + (formatComponentName(vm)) + ")")
654 }
655 };
656}
657
658/* */
659
660
661var uid = 0;
662
663/**
664 * A dep is an observable that can have multiple
665 * directives subscribing to it.
666 */
667var Dep = function Dep () {
668 this.id = uid++;
669 this.subs = [];
670};
671
672Dep.prototype.addSub = function addSub (sub) {
673 this.subs.push(sub);
674};
675
676Dep.prototype.removeSub = function removeSub (sub) {
677 remove(this.subs, sub);
678};
679
680Dep.prototype.depend = function depend () {
681 if (Dep.target) {
682 Dep.target.addDep(this);
683 }
684};
685
686Dep.prototype.notify = function notify () {
687 // stabilize the subscriber list first
688 var subs = this.subs.slice();
689 for (var i = 0, l = subs.length; i < l; i++) {
690 subs[i].update();
691 }
692};
693
694// the current target watcher being evaluated.
695// this is globally unique because there could be only one
696// watcher being evaluated at any time.
697Dep.target = null;
698var targetStack = [];
699
700function pushTarget (_target) {
701 if (Dep.target) { targetStack.push(Dep.target); }
702 Dep.target = _target;
703}
704
705function popTarget () {
706 Dep.target = targetStack.pop();
707}
708
709/* */
710
711var VNode = function VNode (
712 tag,
713 data,
714 children,
715 text,
716 elm,
717 context,
718 componentOptions,
719 asyncFactory
720) {
721 this.tag = tag;
722 this.data = data;
723 this.children = children;
724 this.text = text;
725 this.elm = elm;
726 this.ns = undefined;
727 this.context = context;
728 this.fnContext = undefined;
729 this.fnOptions = undefined;
730 this.fnScopeId = undefined;
731 this.key = data && data.key;
732 this.componentOptions = componentOptions;
733 this.componentInstance = undefined;
734 this.parent = undefined;
735 this.raw = false;
736 this.isStatic = false;
737 this.isRootInsert = true;
738 this.isComment = false;
739 this.isCloned = false;
740 this.isOnce = false;
741 this.asyncFactory = asyncFactory;
742 this.asyncMeta = undefined;
743 this.isAsyncPlaceholder = false;
744};
745
746var prototypeAccessors = { child: { configurable: true } };
747
748// DEPRECATED: alias for componentInstance for backwards compat.
749/* istanbul ignore next */
750prototypeAccessors.child.get = function () {
751 return this.componentInstance
752};
753
754Object.defineProperties( VNode.prototype, prototypeAccessors );
755
756var createEmptyVNode = function (text) {
757 if ( text === void 0 ) text = '';
758
759 var node = new VNode();
760 node.text = text;
761 node.isComment = true;
762 return node
763};
764
765function createTextVNode (val) {
766 return new VNode(undefined, undefined, undefined, String(val))
767}
768
769// optimized shallow clone
770// used for static nodes and slot nodes because they may be reused across
771// multiple renders, cloning them avoids errors when DOM manipulations rely
772// on their elm reference.
773function cloneVNode (vnode, deep) {
774 var componentOptions = vnode.componentOptions;
775 var cloned = new VNode(
776 vnode.tag,
777 vnode.data,
778 vnode.children,
779 vnode.text,
780 vnode.elm,
781 vnode.context,
782 componentOptions,
783 vnode.asyncFactory
784 );
785 cloned.ns = vnode.ns;
786 cloned.isStatic = vnode.isStatic;
787 cloned.key = vnode.key;
788 cloned.isComment = vnode.isComment;
789 cloned.fnContext = vnode.fnContext;
790 cloned.fnOptions = vnode.fnOptions;
791 cloned.fnScopeId = vnode.fnScopeId;
792 cloned.isCloned = true;
793 if (deep) {
794 if (vnode.children) {
795 cloned.children = cloneVNodes(vnode.children, true);
796 }
797 if (componentOptions && componentOptions.children) {
798 componentOptions.children = cloneVNodes(componentOptions.children, true);
799 }
800 }
801 return cloned
802}
803
804function cloneVNodes (vnodes, deep) {
805 var len = vnodes.length;
806 var res = new Array(len);
807 for (var i = 0; i < len; i++) {
808 res[i] = cloneVNode(vnodes[i], deep);
809 }
810 return res
811}
812
813/*
814 * not type checking this file because flow doesn't play well with
815 * dynamically accessing methods on Array prototype
816 */
817
818var arrayProto = Array.prototype;
819var arrayMethods = Object.create(arrayProto);[
820 'push',
821 'pop',
822 'shift',
823 'unshift',
824 'splice',
825 'sort',
826 'reverse'
827].forEach(function (method) {
828 // cache original method
829 var original = arrayProto[method];
830 def(arrayMethods, method, function mutator () {
831 var args = [], len = arguments.length;
832 while ( len-- ) args[ len ] = arguments[ len ];
833
834 var result = original.apply(this, args);
835 var ob = this.__ob__;
836 var inserted;
837 switch (method) {
838 case 'push':
839 case 'unshift':
840 inserted = args;
841 break
842 case 'splice':
843 inserted = args.slice(2);
844 break
845 }
846 if (inserted) { ob.observeArray(inserted); }
847 // notify change
848 ob.dep.notify();
849 return result
850 });
851});
852
853/* */
854
855var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
856
857/**
858 * By default, when a reactive property is set, the new value is
859 * also converted to become reactive. However when passing down props,
860 * we don't want to force conversion because the value may be a nested value
861 * under a frozen data structure. Converting it would defeat the optimization.
862 */
863var observerState = {
864 shouldConvert: true
865};
866
867/**
868 * Observer class that are attached to each observed
869 * object. Once attached, the observer converts target
870 * object's property keys into getter/setters that
871 * collect dependencies and dispatches updates.
872 */
873var Observer = function Observer (value) {
874 this.value = value;
875 this.dep = new Dep();
876 this.vmCount = 0;
877 def(value, '__ob__', this);
878 if (Array.isArray(value)) {
879 var augment = hasProto
880 ? protoAugment
881 : copyAugment;
882 augment(value, arrayMethods, arrayKeys);
883 this.observeArray(value);
884 } else {
885 this.walk(value);
886 }
887};
888
889/**
890 * Walk through each property and convert them into
891 * getter/setters. This method should only be called when
892 * value type is Object.
893 */
894Observer.prototype.walk = function walk (obj) {
895 var keys = Object.keys(obj);
896 for (var i = 0; i < keys.length; i++) {
897 defineReactive(obj, keys[i], obj[keys[i]]);
898 }
899};
900
901/**
902 * Observe a list of Array items.
903 */
904Observer.prototype.observeArray = function observeArray (items) {
905 for (var i = 0, l = items.length; i < l; i++) {
906 observe(items[i]);
907 }
908};
909
910// helpers
911
912/**
913 * Augment an target Object or Array by intercepting
914 * the prototype chain using __proto__
915 */
916function protoAugment (target, src, keys) {
917 /* eslint-disable no-proto */
918 target.__proto__ = src;
919 /* eslint-enable no-proto */
920}
921
922/**
923 * Augment an target Object or Array by defining
924 * hidden properties.
925 */
926/* istanbul ignore next */
927function copyAugment (target, src, keys) {
928 for (var i = 0, l = keys.length; i < l; i++) {
929 var key = keys[i];
930 def(target, key, src[key]);
931 }
932}
933
934/**
935 * Attempt to create an observer instance for a value,
936 * returns the new observer if successfully observed,
937 * or the existing observer if the value already has one.
938 */
939function observe (value, asRootData) {
940 if (!isObject(value) || value instanceof VNode) {
941 return
942 }
943 var ob;
944 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
945 ob = value.__ob__;
946 } else if (
947 observerState.shouldConvert &&
948 !isServerRendering() &&
949 (Array.isArray(value) || isPlainObject(value)) &&
950 Object.isExtensible(value) &&
951 !value._isVue
952 ) {
953 ob = new Observer(value);
954 }
955 if (asRootData && ob) {
956 ob.vmCount++;
957 }
958 return ob
959}
960
961/**
962 * Define a reactive property on an Object.
963 */
964function defineReactive (
965 obj,
966 key,
967 val,
968 customSetter,
969 shallow
970) {
971 var dep = new Dep();
972
973 var property = Object.getOwnPropertyDescriptor(obj, key);
974 if (property && property.configurable === false) {
975 return
976 }
977
978 // cater for pre-defined getter/setters
979 var getter = property && property.get;
980 var setter = property && property.set;
981
982 var childOb = !shallow && observe(val);
983 Object.defineProperty(obj, key, {
984 enumerable: true,
985 configurable: true,
986 get: function reactiveGetter () {
987 var value = getter ? getter.call(obj) : val;
988 if (Dep.target) {
989 dep.depend();
990 if (childOb) {
991 childOb.dep.depend();
992 if (Array.isArray(value)) {
993 dependArray(value);
994 }
995 }
996 }
997 return value
998 },
999 set: function reactiveSetter (newVal) {
1000 var value = getter ? getter.call(obj) : val;
1001 /* eslint-disable no-self-compare */
1002 if (newVal === value || (newVal !== newVal && value !== value)) {
1003 return
1004 }
1005 /* eslint-enable no-self-compare */
1006 if ("development" !== 'production' && customSetter) {
1007 customSetter();
1008 }
1009 if (setter) {
1010 setter.call(obj, newVal);
1011 } else {
1012 val = newVal;
1013 }
1014 childOb = !shallow && observe(newVal);
1015 dep.notify();
1016 }
1017 });
1018}
1019
1020/**
1021 * Set a property on an object. Adds the new property and
1022 * triggers change notification if the property doesn't
1023 * already exist.
1024 */
1025function set (target, key, val) {
1026 if (Array.isArray(target) && isValidArrayIndex(key)) {
1027 target.length = Math.max(target.length, key);
1028 target.splice(key, 1, val);
1029 return val
1030 }
1031 if (key in target && !(key in Object.prototype)) {
1032 target[key] = val;
1033 return val
1034 }
1035 var ob = (target).__ob__;
1036 if (target._isVue || (ob && ob.vmCount)) {
1037 "development" !== 'production' && warn(
1038 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1039 'at runtime - declare it upfront in the data option.'
1040 );
1041 return val
1042 }
1043 if (!ob) {
1044 target[key] = val;
1045 return val
1046 }
1047 defineReactive(ob.value, key, val);
1048 ob.dep.notify();
1049 return val
1050}
1051
1052/**
1053 * Delete a property and trigger change if necessary.
1054 */
1055function del (target, key) {
1056 if (Array.isArray(target) && isValidArrayIndex(key)) {
1057 target.splice(key, 1);
1058 return
1059 }
1060 var ob = (target).__ob__;
1061 if (target._isVue || (ob && ob.vmCount)) {
1062 "development" !== 'production' && warn(
1063 'Avoid deleting properties on a Vue instance or its root $data ' +
1064 '- just set it to null.'
1065 );
1066 return
1067 }
1068 if (!hasOwn(target, key)) {
1069 return
1070 }
1071 delete target[key];
1072 if (!ob) {
1073 return
1074 }
1075 ob.dep.notify();
1076}
1077
1078/**
1079 * Collect dependencies on array elements when the array is touched, since
1080 * we cannot intercept array element access like property getters.
1081 */
1082function dependArray (value) {
1083 for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1084 e = value[i];
1085 e && e.__ob__ && e.__ob__.dep.depend();
1086 if (Array.isArray(e)) {
1087 dependArray(e);
1088 }
1089 }
1090}
1091
1092/* */
1093
1094/**
1095 * Option overwriting strategies are functions that handle
1096 * how to merge a parent option value and a child option
1097 * value into the final value.
1098 */
1099var strats = config.optionMergeStrategies;
1100
1101/**
1102 * Options with restrictions
1103 */
1104{
1105 strats.el = strats.propsData = function (parent, child, vm, key) {
1106 if (!vm) {
1107 warn(
1108 "option \"" + key + "\" can only be used during instance " +
1109 'creation with the `new` keyword.'
1110 );
1111 }
1112 return defaultStrat(parent, child)
1113 };
1114}
1115
1116/**
1117 * Helper that recursively merges two data objects together.
1118 */
1119function mergeData (to, from) {
1120 if (!from) { return to }
1121 var key, toVal, fromVal;
1122 var keys = Object.keys(from);
1123 for (var i = 0; i < keys.length; i++) {
1124 key = keys[i];
1125 toVal = to[key];
1126 fromVal = from[key];
1127 if (!hasOwn(to, key)) {
1128 set(to, key, fromVal);
1129 } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
1130 mergeData(toVal, fromVal);
1131 }
1132 }
1133 return to
1134}
1135
1136/**
1137 * Data
1138 */
1139function mergeDataOrFn (
1140 parentVal,
1141 childVal,
1142 vm
1143) {
1144 if (!vm) {
1145 // in a Vue.extend merge, both should be functions
1146 if (!childVal) {
1147 return parentVal
1148 }
1149 if (!parentVal) {
1150 return childVal
1151 }
1152 // when parentVal & childVal are both present,
1153 // we need to return a function that returns the
1154 // merged result of both functions... no need to
1155 // check if parentVal is a function here because
1156 // it has to be a function to pass previous merges.
1157 return function mergedDataFn () {
1158 return mergeData(
1159 typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1160 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1161 )
1162 }
1163 } else {
1164 return function mergedInstanceDataFn () {
1165 // instance merge
1166 var instanceData = typeof childVal === 'function'
1167 ? childVal.call(vm, vm)
1168 : childVal;
1169 var defaultData = typeof parentVal === 'function'
1170 ? parentVal.call(vm, vm)
1171 : parentVal;
1172 if (instanceData) {
1173 return mergeData(instanceData, defaultData)
1174 } else {
1175 return defaultData
1176 }
1177 }
1178 }
1179}
1180
1181strats.data = function (
1182 parentVal,
1183 childVal,
1184 vm
1185) {
1186 if (!vm) {
1187 if (childVal && typeof childVal !== 'function') {
1188 "development" !== 'production' && warn(
1189 'The "data" option should be a function ' +
1190 'that returns a per-instance value in component ' +
1191 'definitions.',
1192 vm
1193 );
1194
1195 return parentVal
1196 }
1197 return mergeDataOrFn(parentVal, childVal)
1198 }
1199
1200 return mergeDataOrFn(parentVal, childVal, vm)
1201};
1202
1203/**
1204 * Hooks and props are merged as arrays.
1205 */
1206function mergeHook (
1207 parentVal,
1208 childVal
1209) {
1210 return childVal
1211 ? parentVal
1212 ? parentVal.concat(childVal)
1213 : Array.isArray(childVal)
1214 ? childVal
1215 : [childVal]
1216 : parentVal
1217}
1218
1219LIFECYCLE_HOOKS.forEach(function (hook) {
1220 strats[hook] = mergeHook;
1221});
1222
1223/**
1224 * Assets
1225 *
1226 * When a vm is present (instance creation), we need to do
1227 * a three-way merge between constructor options, instance
1228 * options and parent options.
1229 */
1230function mergeAssets (
1231 parentVal,
1232 childVal,
1233 vm,
1234 key
1235) {
1236 var res = Object.create(parentVal || null);
1237 if (childVal) {
1238 "development" !== 'production' && assertObjectType(key, childVal, vm);
1239 return extend(res, childVal)
1240 } else {
1241 return res
1242 }
1243}
1244
1245ASSET_TYPES.forEach(function (type) {
1246 strats[type + 's'] = mergeAssets;
1247});
1248
1249/**
1250 * Watchers.
1251 *
1252 * Watchers hashes should not overwrite one
1253 * another, so we merge them as arrays.
1254 */
1255strats.watch = function (
1256 parentVal,
1257 childVal,
1258 vm,
1259 key
1260) {
1261 // work around Firefox's Object.prototype.watch...
1262 if (parentVal === nativeWatch) { parentVal = undefined; }
1263 if (childVal === nativeWatch) { childVal = undefined; }
1264 /* istanbul ignore if */
1265 if (!childVal) { return Object.create(parentVal || null) }
1266 {
1267 assertObjectType(key, childVal, vm);
1268 }
1269 if (!parentVal) { return childVal }
1270 var ret = {};
1271 extend(ret, parentVal);
1272 for (var key$1 in childVal) {
1273 var parent = ret[key$1];
1274 var child = childVal[key$1];
1275 if (parent && !Array.isArray(parent)) {
1276 parent = [parent];
1277 }
1278 ret[key$1] = parent
1279 ? parent.concat(child)
1280 : Array.isArray(child) ? child : [child];
1281 }
1282 return ret
1283};
1284
1285/**
1286 * Other object hashes.
1287 */
1288strats.props =
1289strats.methods =
1290strats.inject =
1291strats.computed = function (
1292 parentVal,
1293 childVal,
1294 vm,
1295 key
1296) {
1297 if (childVal && "development" !== 'production') {
1298 assertObjectType(key, childVal, vm);
1299 }
1300 if (!parentVal) { return childVal }
1301 var ret = Object.create(null);
1302 extend(ret, parentVal);
1303 if (childVal) { extend(ret, childVal); }
1304 return ret
1305};
1306strats.provide = mergeDataOrFn;
1307
1308/**
1309 * Default strategy.
1310 */
1311var defaultStrat = function (parentVal, childVal) {
1312 return childVal === undefined
1313 ? parentVal
1314 : childVal
1315};
1316
1317/**
1318 * Validate component names
1319 */
1320function checkComponents (options) {
1321 for (var key in options.components) {
1322 validateComponentName(key);
1323 }
1324}
1325
1326function validateComponentName (name) {
1327 if (!/^[a-zA-Z][\w-]*$/.test(name)) {
1328 warn(
1329 'Invalid component name: "' + name + '". Component names ' +
1330 'can only contain alphanumeric characters and the hyphen, ' +
1331 'and must start with a letter.'
1332 );
1333 }
1334 if (isBuiltInTag(name) || config.isReservedTag(name)) {
1335 warn(
1336 'Do not use built-in or reserved HTML elements as component ' +
1337 'id: ' + name
1338 );
1339 }
1340}
1341
1342/**
1343 * Ensure all props option syntax are normalized into the
1344 * Object-based format.
1345 */
1346function normalizeProps (options, vm) {
1347 var props = options.props;
1348 if (!props) { return }
1349 var res = {};
1350 var i, val, name;
1351 if (Array.isArray(props)) {
1352 i = props.length;
1353 while (i--) {
1354 val = props[i];
1355 if (typeof val === 'string') {
1356 name = camelize(val);
1357 res[name] = { type: null };
1358 } else {
1359 warn('props must be strings when using array syntax.');
1360 }
1361 }
1362 } else if (isPlainObject(props)) {
1363 for (var key in props) {
1364 val = props[key];
1365 name = camelize(key);
1366 res[name] = isPlainObject(val)
1367 ? val
1368 : { type: val };
1369 }
1370 } else {
1371 warn(
1372 "Invalid value for option \"props\": expected an Array or an Object, " +
1373 "but got " + (toRawType(props)) + ".",
1374 vm
1375 );
1376 }
1377 options.props = res;
1378}
1379
1380/**
1381 * Normalize all injections into Object-based format
1382 */
1383function normalizeInject (options, vm) {
1384 var inject = options.inject;
1385 if (!inject) { return }
1386 var normalized = options.inject = {};
1387 if (Array.isArray(inject)) {
1388 for (var i = 0; i < inject.length; i++) {
1389 normalized[inject[i]] = { from: inject[i] };
1390 }
1391 } else if (isPlainObject(inject)) {
1392 for (var key in inject) {
1393 var val = inject[key];
1394 normalized[key] = isPlainObject(val)
1395 ? extend({ from: key }, val)
1396 : { from: val };
1397 }
1398 } else {
1399 warn(
1400 "Invalid value for option \"inject\": expected an Array or an Object, " +
1401 "but got " + (toRawType(inject)) + ".",
1402 vm
1403 );
1404 }
1405}
1406
1407/**
1408 * Normalize raw function directives into object format.
1409 */
1410function normalizeDirectives (options) {
1411 var dirs = options.directives;
1412 if (dirs) {
1413 for (var key in dirs) {
1414 var def = dirs[key];
1415 if (typeof def === 'function') {
1416 dirs[key] = { bind: def, update: def };
1417 }
1418 }
1419 }
1420}
1421
1422function assertObjectType (name, value, vm) {
1423 if (!isPlainObject(value)) {
1424 warn(
1425 "Invalid value for option \"" + name + "\": expected an Object, " +
1426 "but got " + (toRawType(value)) + ".",
1427 vm
1428 );
1429 }
1430}
1431
1432/**
1433 * Merge two option objects into a new one.
1434 * Core utility used in both instantiation and inheritance.
1435 */
1436function mergeOptions (
1437 parent,
1438 child,
1439 vm
1440) {
1441 {
1442 checkComponents(child);
1443 }
1444
1445 if (typeof child === 'function') {
1446 child = child.options;
1447 }
1448
1449 normalizeProps(child, vm);
1450 normalizeInject(child, vm);
1451 normalizeDirectives(child);
1452 var extendsFrom = child.extends;
1453 if (extendsFrom) {
1454 parent = mergeOptions(parent, extendsFrom, vm);
1455 }
1456 if (child.mixins) {
1457 for (var i = 0, l = child.mixins.length; i < l; i++) {
1458 parent = mergeOptions(parent, child.mixins[i], vm);
1459 }
1460 }
1461 var options = {};
1462 var key;
1463 for (key in parent) {
1464 mergeField(key);
1465 }
1466 for (key in child) {
1467 if (!hasOwn(parent, key)) {
1468 mergeField(key);
1469 }
1470 }
1471 function mergeField (key) {
1472 var strat = strats[key] || defaultStrat;
1473 options[key] = strat(parent[key], child[key], vm, key);
1474 }
1475 return options
1476}
1477
1478/**
1479 * Resolve an asset.
1480 * This function is used because child instances need access
1481 * to assets defined in its ancestor chain.
1482 */
1483function resolveAsset (
1484 options,
1485 type,
1486 id,
1487 warnMissing
1488) {
1489 /* istanbul ignore if */
1490 if (typeof id !== 'string') {
1491 return
1492 }
1493 var assets = options[type];
1494 // check local registration variations first
1495 if (hasOwn(assets, id)) { return assets[id] }
1496 var camelizedId = camelize(id);
1497 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1498 var PascalCaseId = capitalize(camelizedId);
1499 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1500 // fallback to prototype chain
1501 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1502 if ("development" !== 'production' && warnMissing && !res) {
1503 warn(
1504 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1505 options
1506 );
1507 }
1508 return res
1509}
1510
1511/* */
1512
1513function validateProp (
1514 key,
1515 propOptions,
1516 propsData,
1517 vm
1518) {
1519 var prop = propOptions[key];
1520 var absent = !hasOwn(propsData, key);
1521 var value = propsData[key];
1522 // handle boolean props
1523 if (isType(Boolean, prop.type)) {
1524 if (absent && !hasOwn(prop, 'default')) {
1525 value = false;
1526 } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
1527 value = true;
1528 }
1529 }
1530 // check default value
1531 if (value === undefined) {
1532 value = getPropDefaultValue(vm, prop, key);
1533 // since the default value is a fresh copy,
1534 // make sure to observe it.
1535 var prevShouldConvert = observerState.shouldConvert;
1536 observerState.shouldConvert = true;
1537 observe(value);
1538 observerState.shouldConvert = prevShouldConvert;
1539 }
1540 {
1541 assertProp(prop, key, value, vm, absent);
1542 }
1543 return value
1544}
1545
1546/**
1547 * Get the default value of a prop.
1548 */
1549function getPropDefaultValue (vm, prop, key) {
1550 // no default, return undefined
1551 if (!hasOwn(prop, 'default')) {
1552 return undefined
1553 }
1554 var def = prop.default;
1555 // warn against non-factory defaults for Object & Array
1556 if ("development" !== 'production' && isObject(def)) {
1557 warn(
1558 'Invalid default value for prop "' + key + '": ' +
1559 'Props with type Object/Array must use a factory function ' +
1560 'to return the default value.',
1561 vm
1562 );
1563 }
1564 // the raw prop value was also undefined from previous render,
1565 // return previous default value to avoid unnecessary watcher trigger
1566 if (vm && vm.$options.propsData &&
1567 vm.$options.propsData[key] === undefined &&
1568 vm._props[key] !== undefined
1569 ) {
1570 return vm._props[key]
1571 }
1572 // call factory function for non-Function types
1573 // a value is Function if its prototype is function even across different execution context
1574 return typeof def === 'function' && getType(prop.type) !== 'Function'
1575 ? def.call(vm)
1576 : def
1577}
1578
1579/**
1580 * Assert whether a prop is valid.
1581 */
1582function assertProp (
1583 prop,
1584 name,
1585 value,
1586 vm,
1587 absent
1588) {
1589 if (prop.required && absent) {
1590 warn(
1591 'Missing required prop: "' + name + '"',
1592 vm
1593 );
1594 return
1595 }
1596 if (value == null && !prop.required) {
1597 return
1598 }
1599 var type = prop.type;
1600 var valid = !type || type === true;
1601 var expectedTypes = [];
1602 if (type) {
1603 if (!Array.isArray(type)) {
1604 type = [type];
1605 }
1606 for (var i = 0; i < type.length && !valid; i++) {
1607 var assertedType = assertType(value, type[i]);
1608 expectedTypes.push(assertedType.expectedType || '');
1609 valid = assertedType.valid;
1610 }
1611 }
1612 if (!valid) {
1613 warn(
1614 "Invalid prop: type check failed for prop \"" + name + "\"." +
1615 " Expected " + (expectedTypes.map(capitalize).join(', ')) +
1616 ", got " + (toRawType(value)) + ".",
1617 vm
1618 );
1619 return
1620 }
1621 var validator = prop.validator;
1622 if (validator) {
1623 if (!validator(value)) {
1624 warn(
1625 'Invalid prop: custom validator check failed for prop "' + name + '".',
1626 vm
1627 );
1628 }
1629 }
1630}
1631
1632var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1633
1634function assertType (value, type) {
1635 var valid;
1636 var expectedType = getType(type);
1637 if (simpleCheckRE.test(expectedType)) {
1638 var t = typeof value;
1639 valid = t === expectedType.toLowerCase();
1640 // for primitive wrapper objects
1641 if (!valid && t === 'object') {
1642 valid = value instanceof type;
1643 }
1644 } else if (expectedType === 'Object') {
1645 valid = isPlainObject(value);
1646 } else if (expectedType === 'Array') {
1647 valid = Array.isArray(value);
1648 } else {
1649 valid = value instanceof type;
1650 }
1651 return {
1652 valid: valid,
1653 expectedType: expectedType
1654 }
1655}
1656
1657/**
1658 * Use function string name to check built-in types,
1659 * because a simple equality check will fail when running
1660 * across different vms / iframes.
1661 */
1662function getType (fn) {
1663 var match = fn && fn.toString().match(/^\s*function (\w+)/);
1664 return match ? match[1] : ''
1665}
1666
1667function isType (type, fn) {
1668 if (!Array.isArray(fn)) {
1669 return getType(fn) === getType(type)
1670 }
1671 for (var i = 0, len = fn.length; i < len; i++) {
1672 if (getType(fn[i]) === getType(type)) {
1673 return true
1674 }
1675 }
1676 /* istanbul ignore next */
1677 return false
1678}
1679
1680/* */
1681
1682function handleError (err, vm, info) {
1683 if (vm) {
1684 var cur = vm;
1685 while ((cur = cur.$parent)) {
1686 var hooks = cur.$options.errorCaptured;
1687 if (hooks) {
1688 for (var i = 0; i < hooks.length; i++) {
1689 try {
1690 var capture = hooks[i].call(cur, err, vm, info) === false;
1691 if (capture) { return }
1692 } catch (e) {
1693 globalHandleError(e, cur, 'errorCaptured hook');
1694 }
1695 }
1696 }
1697 }
1698 }
1699 globalHandleError(err, vm, info);
1700}
1701
1702function globalHandleError (err, vm, info) {
1703 if (config.errorHandler) {
1704 try {
1705 return config.errorHandler.call(null, err, vm, info)
1706 } catch (e) {
1707 logError(e, null, 'config.errorHandler');
1708 }
1709 }
1710 logError(err, vm, info);
1711}
1712
1713function logError (err, vm, info) {
1714 {
1715 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1716 }
1717 /* istanbul ignore else */
1718 if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1719 console.error(err);
1720 } else {
1721 throw err
1722 }
1723}
1724
1725/* */
1726/* globals MessageChannel */
1727
1728var callbacks = [];
1729var pending = false;
1730
1731function flushCallbacks () {
1732 pending = false;
1733 var copies = callbacks.slice(0);
1734 callbacks.length = 0;
1735 for (var i = 0; i < copies.length; i++) {
1736 copies[i]();
1737 }
1738}
1739
1740// Here we have async deferring wrappers using both micro and macro tasks.
1741// In < 2.4 we used micro tasks everywhere, but there are some scenarios where
1742// micro tasks have too high a priority and fires in between supposedly
1743// sequential events (e.g. #4521, #6690) or even between bubbling of the same
1744// event (#6566). However, using macro tasks everywhere also has subtle problems
1745// when state is changed right before repaint (e.g. #6813, out-in transitions).
1746// Here we use micro task by default, but expose a way to force macro task when
1747// needed (e.g. in event handlers attached by v-on).
1748var microTimerFunc;
1749var macroTimerFunc;
1750var useMacroTask = false;
1751
1752// Determine (macro) Task defer implementation.
1753// Technically setImmediate should be the ideal choice, but it's only available
1754// in IE. The only polyfill that consistently queues the callback after all DOM
1755// events triggered in the same loop is by using MessageChannel.
1756/* istanbul ignore if */
1757if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1758 macroTimerFunc = function () {
1759 setImmediate(flushCallbacks);
1760 };
1761} else if (typeof MessageChannel !== 'undefined' && (
1762 isNative(MessageChannel) ||
1763 // PhantomJS
1764 MessageChannel.toString() === '[object MessageChannelConstructor]'
1765)) {
1766 var channel = new MessageChannel();
1767 var port = channel.port2;
1768 channel.port1.onmessage = flushCallbacks;
1769 macroTimerFunc = function () {
1770 port.postMessage(1);
1771 };
1772} else {
1773 /* istanbul ignore next */
1774 macroTimerFunc = function () {
1775 setTimeout(flushCallbacks, 0);
1776 };
1777}
1778
1779// Determine MicroTask defer implementation.
1780/* istanbul ignore next, $flow-disable-line */
1781if (typeof Promise !== 'undefined' && isNative(Promise)) {
1782 var p = Promise.resolve();
1783 microTimerFunc = function () {
1784 p.then(flushCallbacks);
1785 // in problematic UIWebViews, Promise.then doesn't completely break, but
1786 // it can get stuck in a weird state where callbacks are pushed into the
1787 // microtask queue but the queue isn't being flushed, until the browser
1788 // needs to do some other work, e.g. handle a timer. Therefore we can
1789 // "force" the microtask queue to be flushed by adding an empty timer.
1790 if (isIOS) { setTimeout(noop); }
1791 };
1792} else {
1793 // fallback to macro
1794 microTimerFunc = macroTimerFunc;
1795}
1796
1797/**
1798 * Wrap a function so that if any code inside triggers state change,
1799 * the changes are queued using a Task instead of a MicroTask.
1800 */
1801function withMacroTask (fn) {
1802 return fn._withTask || (fn._withTask = function () {
1803 useMacroTask = true;
1804 var res = fn.apply(null, arguments);
1805 useMacroTask = false;
1806 return res
1807 })
1808}
1809
1810function nextTick (cb, ctx) {
1811 var _resolve;
1812 callbacks.push(function () {
1813 if (cb) {
1814 try {
1815 cb.call(ctx);
1816 } catch (e) {
1817 handleError(e, ctx, 'nextTick');
1818 }
1819 } else if (_resolve) {
1820 _resolve(ctx);
1821 }
1822 });
1823 if (!pending) {
1824 pending = true;
1825 if (useMacroTask) {
1826 macroTimerFunc();
1827 } else {
1828 microTimerFunc();
1829 }
1830 }
1831 // $flow-disable-line
1832 if (!cb && typeof Promise !== 'undefined') {
1833 return new Promise(function (resolve) {
1834 _resolve = resolve;
1835 })
1836 }
1837}
1838
1839/* */
1840
1841var mark;
1842var measure;
1843
1844{
1845 var perf = inBrowser && window.performance;
1846 /* istanbul ignore if */
1847 if (
1848 perf &&
1849 perf.mark &&
1850 perf.measure &&
1851 perf.clearMarks &&
1852 perf.clearMeasures
1853 ) {
1854 mark = function (tag) { return perf.mark(tag); };
1855 measure = function (name, startTag, endTag) {
1856 perf.measure(name, startTag, endTag);
1857 perf.clearMarks(startTag);
1858 perf.clearMarks(endTag);
1859 perf.clearMeasures(name);
1860 };
1861 }
1862}
1863
1864/* not type checking this file because flow doesn't play well with Proxy */
1865
1866var initProxy;
1867
1868{
1869 var allowedGlobals = makeMap(
1870 'Infinity,undefined,NaN,isFinite,isNaN,' +
1871 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
1872 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
1873 'require' // for Webpack/Browserify
1874 );
1875
1876 var warnNonPresent = function (target, key) {
1877 warn(
1878 "Property or method \"" + key + "\" is not defined on the instance but " +
1879 'referenced during render. Make sure that this property is reactive, ' +
1880 'either in the data option, or for class-based components, by ' +
1881 'initializing the property. ' +
1882 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
1883 target
1884 );
1885 };
1886
1887 var hasProxy =
1888 typeof Proxy !== 'undefined' &&
1889 Proxy.toString().match(/native code/);
1890
1891 if (hasProxy) {
1892 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
1893 config.keyCodes = new Proxy(config.keyCodes, {
1894 set: function set (target, key, value) {
1895 if (isBuiltInModifier(key)) {
1896 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
1897 return false
1898 } else {
1899 target[key] = value;
1900 return true
1901 }
1902 }
1903 });
1904 }
1905
1906 var hasHandler = {
1907 has: function has (target, key) {
1908 var has = key in target;
1909 var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
1910 if (!has && !isAllowed) {
1911 warnNonPresent(target, key);
1912 }
1913 return has || !isAllowed
1914 }
1915 };
1916
1917 var getHandler = {
1918 get: function get (target, key) {
1919 if (typeof key === 'string' && !(key in target)) {
1920 warnNonPresent(target, key);
1921 }
1922 return target[key]
1923 }
1924 };
1925
1926 initProxy = function initProxy (vm) {
1927 if (hasProxy) {
1928 // determine which proxy handler to use
1929 var options = vm.$options;
1930 var handlers = options.render && options.render._withStripped
1931 ? getHandler
1932 : hasHandler;
1933 vm._renderProxy = new Proxy(vm, handlers);
1934 } else {
1935 vm._renderProxy = vm;
1936 }
1937 };
1938}
1939
1940/* */
1941
1942var seenObjects = new _Set();
1943
1944/**
1945 * Recursively traverse an object to evoke all converted
1946 * getters, so that every nested property inside the object
1947 * is collected as a "deep" dependency.
1948 */
1949function traverse (val) {
1950 _traverse(val, seenObjects);
1951 seenObjects.clear();
1952}
1953
1954function _traverse (val, seen) {
1955 var i, keys;
1956 var isA = Array.isArray(val);
1957 if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
1958 return
1959 }
1960 if (val.__ob__) {
1961 var depId = val.__ob__.dep.id;
1962 if (seen.has(depId)) {
1963 return
1964 }
1965 seen.add(depId);
1966 }
1967 if (isA) {
1968 i = val.length;
1969 while (i--) { _traverse(val[i], seen); }
1970 } else {
1971 keys = Object.keys(val);
1972 i = keys.length;
1973 while (i--) { _traverse(val[keys[i]], seen); }
1974 }
1975}
1976
1977/* */
1978
1979var normalizeEvent = cached(function (name) {
1980 var passive = name.charAt(0) === '&';
1981 name = passive ? name.slice(1) : name;
1982 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
1983 name = once$$1 ? name.slice(1) : name;
1984 var capture = name.charAt(0) === '!';
1985 name = capture ? name.slice(1) : name;
1986 return {
1987 name: name,
1988 once: once$$1,
1989 capture: capture,
1990 passive: passive
1991 }
1992});
1993
1994function createFnInvoker (fns) {
1995 function invoker () {
1996 var arguments$1 = arguments;
1997
1998 var fns = invoker.fns;
1999 if (Array.isArray(fns)) {
2000 var cloned = fns.slice();
2001 for (var i = 0; i < cloned.length; i++) {
2002 cloned[i].apply(null, arguments$1);
2003 }
2004 } else {
2005 // return handler return value for single handlers
2006 return fns.apply(null, arguments)
2007 }
2008 }
2009 invoker.fns = fns;
2010 return invoker
2011}
2012
2013function updateListeners (
2014 on,
2015 oldOn,
2016 add,
2017 remove$$1,
2018 vm
2019) {
2020 var name, def, cur, old, event;
2021 for (name in on) {
2022 def = cur = on[name];
2023 old = oldOn[name];
2024 event = normalizeEvent(name);
2025 /* istanbul ignore if */
2026 if (isUndef(cur)) {
2027 "development" !== 'production' && warn(
2028 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2029 vm
2030 );
2031 } else if (isUndef(old)) {
2032 if (isUndef(cur.fns)) {
2033 cur = on[name] = createFnInvoker(cur);
2034 }
2035 add(event.name, cur, event.once, event.capture, event.passive, event.params);
2036 } else if (cur !== old) {
2037 old.fns = cur;
2038 on[name] = old;
2039 }
2040 }
2041 for (name in oldOn) {
2042 if (isUndef(on[name])) {
2043 event = normalizeEvent(name);
2044 remove$$1(event.name, oldOn[name], event.capture);
2045 }
2046 }
2047}
2048
2049/* */
2050
2051function mergeVNodeHook (def, hookKey, hook) {
2052 if (def instanceof VNode) {
2053 def = def.data.hook || (def.data.hook = {});
2054 }
2055 var invoker;
2056 var oldHook = def[hookKey];
2057
2058 function wrappedHook () {
2059 hook.apply(this, arguments);
2060 // important: remove merged hook to ensure it's called only once
2061 // and prevent memory leak
2062 remove(invoker.fns, wrappedHook);
2063 }
2064
2065 if (isUndef(oldHook)) {
2066 // no existing hook
2067 invoker = createFnInvoker([wrappedHook]);
2068 } else {
2069 /* istanbul ignore if */
2070 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2071 // already a merged invoker
2072 invoker = oldHook;
2073 invoker.fns.push(wrappedHook);
2074 } else {
2075 // existing plain hook
2076 invoker = createFnInvoker([oldHook, wrappedHook]);
2077 }
2078 }
2079
2080 invoker.merged = true;
2081 def[hookKey] = invoker;
2082}
2083
2084/* */
2085
2086function extractPropsFromVNodeData (
2087 data,
2088 Ctor,
2089 tag
2090) {
2091 // we are only extracting raw values here.
2092 // validation and default values are handled in the child
2093 // component itself.
2094 var propOptions = Ctor.options.props;
2095 if (isUndef(propOptions)) {
2096 return
2097 }
2098 var res = {};
2099 var attrs = data.attrs;
2100 var props = data.props;
2101 if (isDef(attrs) || isDef(props)) {
2102 for (var key in propOptions) {
2103 var altKey = hyphenate(key);
2104 {
2105 var keyInLowerCase = key.toLowerCase();
2106 if (
2107 key !== keyInLowerCase &&
2108 attrs && hasOwn(attrs, keyInLowerCase)
2109 ) {
2110 tip(
2111 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2112 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2113 " \"" + key + "\". " +
2114 "Note that HTML attributes are case-insensitive and camelCased " +
2115 "props need to use their kebab-case equivalents when using in-DOM " +
2116 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2117 );
2118 }
2119 }
2120 checkProp(res, props, key, altKey, true) ||
2121 checkProp(res, attrs, key, altKey, false);
2122 }
2123 }
2124 return res
2125}
2126
2127function checkProp (
2128 res,
2129 hash,
2130 key,
2131 altKey,
2132 preserve
2133) {
2134 if (isDef(hash)) {
2135 if (hasOwn(hash, key)) {
2136 res[key] = hash[key];
2137 if (!preserve) {
2138 delete hash[key];
2139 }
2140 return true
2141 } else if (hasOwn(hash, altKey)) {
2142 res[key] = hash[altKey];
2143 if (!preserve) {
2144 delete hash[altKey];
2145 }
2146 return true
2147 }
2148 }
2149 return false
2150}
2151
2152/* */
2153
2154// The template compiler attempts to minimize the need for normalization by
2155// statically analyzing the template at compile time.
2156//
2157// For plain HTML markup, normalization can be completely skipped because the
2158// generated render function is guaranteed to return Array<VNode>. There are
2159// two cases where extra normalization is needed:
2160
2161// 1. When the children contains components - because a functional component
2162// may return an Array instead of a single root. In this case, just a simple
2163// normalization is needed - if any child is an Array, we flatten the whole
2164// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2165// because functional components already normalize their own children.
2166function simpleNormalizeChildren (children) {
2167 for (var i = 0; i < children.length; i++) {
2168 if (Array.isArray(children[i])) {
2169 return Array.prototype.concat.apply([], children)
2170 }
2171 }
2172 return children
2173}
2174
2175// 2. When the children contains constructs that always generated nested Arrays,
2176// e.g. <template>, <slot>, v-for, or when the children is provided by user
2177// with hand-written render functions / JSX. In such cases a full normalization
2178// is needed to cater to all possible types of children values.
2179function normalizeChildren (children) {
2180 return isPrimitive(children)
2181 ? [createTextVNode(children)]
2182 : Array.isArray(children)
2183 ? normalizeArrayChildren(children)
2184 : undefined
2185}
2186
2187function isTextNode (node) {
2188 return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2189}
2190
2191function normalizeArrayChildren (children, nestedIndex) {
2192 var res = [];
2193 var i, c, lastIndex, last;
2194 for (i = 0; i < children.length; i++) {
2195 c = children[i];
2196 if (isUndef(c) || typeof c === 'boolean') { continue }
2197 lastIndex = res.length - 1;
2198 last = res[lastIndex];
2199 // nested
2200 if (Array.isArray(c)) {
2201 if (c.length > 0) {
2202 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2203 // merge adjacent text nodes
2204 if (isTextNode(c[0]) && isTextNode(last)) {
2205 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2206 c.shift();
2207 }
2208 res.push.apply(res, c);
2209 }
2210 } else if (isPrimitive(c)) {
2211 if (isTextNode(last)) {
2212 // merge adjacent text nodes
2213 // this is necessary for SSR hydration because text nodes are
2214 // essentially merged when rendered to HTML strings
2215 res[lastIndex] = createTextVNode(last.text + c);
2216 } else if (c !== '') {
2217 // convert primitive to vnode
2218 res.push(createTextVNode(c));
2219 }
2220 } else {
2221 if (isTextNode(c) && isTextNode(last)) {
2222 // merge adjacent text nodes
2223 res[lastIndex] = createTextVNode(last.text + c.text);
2224 } else {
2225 // default key for nested array children (likely generated by v-for)
2226 if (isTrue(children._isVList) &&
2227 isDef(c.tag) &&
2228 isUndef(c.key) &&
2229 isDef(nestedIndex)) {
2230 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2231 }
2232 res.push(c);
2233 }
2234 }
2235 }
2236 return res
2237}
2238
2239/* */
2240
2241function ensureCtor (comp, base) {
2242 if (
2243 comp.__esModule ||
2244 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
2245 ) {
2246 comp = comp.default;
2247 }
2248 return isObject(comp)
2249 ? base.extend(comp)
2250 : comp
2251}
2252
2253function createAsyncPlaceholder (
2254 factory,
2255 data,
2256 context,
2257 children,
2258 tag
2259) {
2260 var node = createEmptyVNode();
2261 node.asyncFactory = factory;
2262 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
2263 return node
2264}
2265
2266function resolveAsyncComponent (
2267 factory,
2268 baseCtor,
2269 context
2270) {
2271 if (isTrue(factory.error) && isDef(factory.errorComp)) {
2272 return factory.errorComp
2273 }
2274
2275 if (isDef(factory.resolved)) {
2276 return factory.resolved
2277 }
2278
2279 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
2280 return factory.loadingComp
2281 }
2282
2283 if (isDef(factory.contexts)) {
2284 // already pending
2285 factory.contexts.push(context);
2286 } else {
2287 var contexts = factory.contexts = [context];
2288 var sync = true;
2289
2290 var forceRender = function () {
2291 for (var i = 0, l = contexts.length; i < l; i++) {
2292 contexts[i].$forceUpdate();
2293 }
2294 };
2295
2296 var resolve = once(function (res) {
2297 // cache resolved
2298 factory.resolved = ensureCtor(res, baseCtor);
2299 // invoke callbacks only if this is not a synchronous resolve
2300 // (async resolves are shimmed as synchronous during SSR)
2301 if (!sync) {
2302 forceRender();
2303 }
2304 });
2305
2306 var reject = once(function (reason) {
2307 "development" !== 'production' && warn(
2308 "Failed to resolve async component: " + (String(factory)) +
2309 (reason ? ("\nReason: " + reason) : '')
2310 );
2311 if (isDef(factory.errorComp)) {
2312 factory.error = true;
2313 forceRender();
2314 }
2315 });
2316
2317 var res = factory(resolve, reject);
2318
2319 if (isObject(res)) {
2320 if (typeof res.then === 'function') {
2321 // () => Promise
2322 if (isUndef(factory.resolved)) {
2323 res.then(resolve, reject);
2324 }
2325 } else if (isDef(res.component) && typeof res.component.then === 'function') {
2326 res.component.then(resolve, reject);
2327
2328 if (isDef(res.error)) {
2329 factory.errorComp = ensureCtor(res.error, baseCtor);
2330 }
2331
2332 if (isDef(res.loading)) {
2333 factory.loadingComp = ensureCtor(res.loading, baseCtor);
2334 if (res.delay === 0) {
2335 factory.loading = true;
2336 } else {
2337 setTimeout(function () {
2338 if (isUndef(factory.resolved) && isUndef(factory.error)) {
2339 factory.loading = true;
2340 forceRender();
2341 }
2342 }, res.delay || 200);
2343 }
2344 }
2345
2346 if (isDef(res.timeout)) {
2347 setTimeout(function () {
2348 if (isUndef(factory.resolved)) {
2349 reject(
2350 "timeout (" + (res.timeout) + "ms)"
2351 );
2352 }
2353 }, res.timeout);
2354 }
2355 }
2356 }
2357
2358 sync = false;
2359 // return in case resolved synchronously
2360 return factory.loading
2361 ? factory.loadingComp
2362 : factory.resolved
2363 }
2364}
2365
2366/* */
2367
2368function isAsyncPlaceholder (node) {
2369 return node.isComment && node.asyncFactory
2370}
2371
2372/* */
2373
2374function getFirstComponentChild (children) {
2375 if (Array.isArray(children)) {
2376 for (var i = 0; i < children.length; i++) {
2377 var c = children[i];
2378 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
2379 return c
2380 }
2381 }
2382 }
2383}
2384
2385/* */
2386
2387/* */
2388
2389function initEvents (vm) {
2390 vm._events = Object.create(null);
2391 vm._hasHookEvent = false;
2392 // init parent attached events
2393 var listeners = vm.$options._parentListeners;
2394 if (listeners) {
2395 updateComponentListeners(vm, listeners);
2396 }
2397}
2398
2399var target;
2400
2401function add (event, fn, once) {
2402 if (once) {
2403 target.$once(event, fn);
2404 } else {
2405 target.$on(event, fn);
2406 }
2407}
2408
2409function remove$1 (event, fn) {
2410 target.$off(event, fn);
2411}
2412
2413function updateComponentListeners (
2414 vm,
2415 listeners,
2416 oldListeners
2417) {
2418 target = vm;
2419 updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
2420 target = undefined;
2421}
2422
2423function eventsMixin (Vue) {
2424 var hookRE = /^hook:/;
2425 Vue.prototype.$on = function (event, fn) {
2426 var this$1 = this;
2427
2428 var vm = this;
2429 if (Array.isArray(event)) {
2430 for (var i = 0, l = event.length; i < l; i++) {
2431 this$1.$on(event[i], fn);
2432 }
2433 } else {
2434 (vm._events[event] || (vm._events[event] = [])).push(fn);
2435 // optimize hook:event cost by using a boolean flag marked at registration
2436 // instead of a hash lookup
2437 if (hookRE.test(event)) {
2438 vm._hasHookEvent = true;
2439 }
2440 }
2441 return vm
2442 };
2443
2444 Vue.prototype.$once = function (event, fn) {
2445 var vm = this;
2446 function on () {
2447 vm.$off(event, on);
2448 fn.apply(vm, arguments);
2449 }
2450 on.fn = fn;
2451 vm.$on(event, on);
2452 return vm
2453 };
2454
2455 Vue.prototype.$off = function (event, fn) {
2456 var this$1 = this;
2457
2458 var vm = this;
2459 // all
2460 if (!arguments.length) {
2461 vm._events = Object.create(null);
2462 return vm
2463 }
2464 // array of events
2465 if (Array.isArray(event)) {
2466 for (var i = 0, l = event.length; i < l; i++) {
2467 this$1.$off(event[i], fn);
2468 }
2469 return vm
2470 }
2471 // specific event
2472 var cbs = vm._events[event];
2473 if (!cbs) {
2474 return vm
2475 }
2476 if (!fn) {
2477 vm._events[event] = null;
2478 return vm
2479 }
2480 if (fn) {
2481 // specific handler
2482 var cb;
2483 var i$1 = cbs.length;
2484 while (i$1--) {
2485 cb = cbs[i$1];
2486 if (cb === fn || cb.fn === fn) {
2487 cbs.splice(i$1, 1);
2488 break
2489 }
2490 }
2491 }
2492 return vm
2493 };
2494
2495 Vue.prototype.$emit = function (event) {
2496 var vm = this;
2497 {
2498 var lowerCaseEvent = event.toLowerCase();
2499 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
2500 tip(
2501 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
2502 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
2503 "Note that HTML attributes are case-insensitive and you cannot use " +
2504 "v-on to listen to camelCase events when using in-DOM templates. " +
2505 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
2506 );
2507 }
2508 }
2509 var cbs = vm._events[event];
2510 if (cbs) {
2511 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
2512 var args = toArray(arguments, 1);
2513 for (var i = 0, l = cbs.length; i < l; i++) {
2514 try {
2515 cbs[i].apply(vm, args);
2516 } catch (e) {
2517 handleError(e, vm, ("event handler for \"" + event + "\""));
2518 }
2519 }
2520 }
2521 return vm
2522 };
2523}
2524
2525/* */
2526
2527
2528
2529/**
2530 * Runtime helper for resolving raw children VNodes into a slot object.
2531 */
2532function resolveSlots (
2533 children,
2534 context
2535) {
2536 var slots = {};
2537 if (!children) {
2538 return slots
2539 }
2540 for (var i = 0, l = children.length; i < l; i++) {
2541 var child = children[i];
2542 var data = child.data;
2543 // remove slot attribute if the node is resolved as a Vue slot node
2544 if (data && data.attrs && data.attrs.slot) {
2545 delete data.attrs.slot;
2546 }
2547 // named slots should only be respected if the vnode was rendered in the
2548 // same context.
2549 if ((child.context === context || child.fnContext === context) &&
2550 data && data.slot != null
2551 ) {
2552 var name = data.slot;
2553 var slot = (slots[name] || (slots[name] = []));
2554 if (child.tag === 'template') {
2555 slot.push.apply(slot, child.children || []);
2556 } else {
2557 slot.push(child);
2558 }
2559 } else {
2560 (slots.default || (slots.default = [])).push(child);
2561 }
2562 }
2563 // ignore slots that contains only whitespace
2564 for (var name$1 in slots) {
2565 if (slots[name$1].every(isWhitespace)) {
2566 delete slots[name$1];
2567 }
2568 }
2569 return slots
2570}
2571
2572function isWhitespace (node) {
2573 return (node.isComment && !node.asyncFactory) || node.text === ' '
2574}
2575
2576function resolveScopedSlots (
2577 fns, // see flow/vnode
2578 res
2579) {
2580 res = res || {};
2581 for (var i = 0; i < fns.length; i++) {
2582 if (Array.isArray(fns[i])) {
2583 resolveScopedSlots(fns[i], res);
2584 } else {
2585 res[fns[i].key] = fns[i].fn;
2586 }
2587 }
2588 return res
2589}
2590
2591/* */
2592
2593var activeInstance = null;
2594var isUpdatingChildComponent = false;
2595
2596function initLifecycle (vm) {
2597 var options = vm.$options;
2598
2599 // locate first non-abstract parent
2600 var parent = options.parent;
2601 if (parent && !options.abstract) {
2602 while (parent.$options.abstract && parent.$parent) {
2603 parent = parent.$parent;
2604 }
2605 parent.$children.push(vm);
2606 }
2607
2608 vm.$parent = parent;
2609 vm.$root = parent ? parent.$root : vm;
2610
2611 vm.$children = [];
2612 vm.$refs = {};
2613
2614 vm._watcher = null;
2615 vm._inactive = null;
2616 vm._directInactive = false;
2617 vm._isMounted = false;
2618 vm._isDestroyed = false;
2619 vm._isBeingDestroyed = false;
2620}
2621
2622function lifecycleMixin (Vue) {
2623 Vue.prototype._update = function (vnode, hydrating) {
2624 var vm = this;
2625 if (vm._isMounted) {
2626 callHook(vm, 'beforeUpdate');
2627 }
2628 var prevEl = vm.$el;
2629 var prevVnode = vm._vnode;
2630 var prevActiveInstance = activeInstance;
2631 activeInstance = vm;
2632 vm._vnode = vnode;
2633 // Vue.prototype.__patch__ is injected in entry points
2634 // based on the rendering backend used.
2635 if (!prevVnode) {
2636 // initial render
2637 vm.$el = vm.__patch__(
2638 vm.$el, vnode, hydrating, false /* removeOnly */,
2639 vm.$options._parentElm,
2640 vm.$options._refElm
2641 );
2642 // no need for the ref nodes after initial patch
2643 // this prevents keeping a detached DOM tree in memory (#5851)
2644 vm.$options._parentElm = vm.$options._refElm = null;
2645 } else {
2646 // updates
2647 vm.$el = vm.__patch__(prevVnode, vnode);
2648 }
2649 activeInstance = prevActiveInstance;
2650 // update __vue__ reference
2651 if (prevEl) {
2652 prevEl.__vue__ = null;
2653 }
2654 if (vm.$el) {
2655 vm.$el.__vue__ = vm;
2656 }
2657 // if parent is an HOC, update its $el as well
2658 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
2659 vm.$parent.$el = vm.$el;
2660 }
2661 // updated hook is called by the scheduler to ensure that children are
2662 // updated in a parent's updated hook.
2663 };
2664
2665 Vue.prototype.$forceUpdate = function () {
2666 var vm = this;
2667 if (vm._watcher) {
2668 vm._watcher.update();
2669 }
2670 };
2671
2672 Vue.prototype.$destroy = function () {
2673 var vm = this;
2674 if (vm._isBeingDestroyed) {
2675 return
2676 }
2677 callHook(vm, 'beforeDestroy');
2678 vm._isBeingDestroyed = true;
2679 // remove self from parent
2680 var parent = vm.$parent;
2681 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
2682 remove(parent.$children, vm);
2683 }
2684 // teardown watchers
2685 if (vm._watcher) {
2686 vm._watcher.teardown();
2687 }
2688 var i = vm._watchers.length;
2689 while (i--) {
2690 vm._watchers[i].teardown();
2691 }
2692 // remove reference from data ob
2693 // frozen object may not have observer.
2694 if (vm._data.__ob__) {
2695 vm._data.__ob__.vmCount--;
2696 }
2697 // call the last hook...
2698 vm._isDestroyed = true;
2699 // invoke destroy hooks on current rendered tree
2700 vm.__patch__(vm._vnode, null);
2701 // fire destroyed hook
2702 callHook(vm, 'destroyed');
2703 // turn off all instance listeners.
2704 vm.$off();
2705 // remove __vue__ reference
2706 if (vm.$el) {
2707 vm.$el.__vue__ = null;
2708 }
2709 // release circular reference (#6759)
2710 if (vm.$vnode) {
2711 vm.$vnode.parent = null;
2712 }
2713 };
2714}
2715
2716function mountComponent (
2717 vm,
2718 el,
2719 hydrating
2720) {
2721 vm.$el = el;
2722 if (!vm.$options.render) {
2723 vm.$options.render = createEmptyVNode;
2724 {
2725 /* istanbul ignore if */
2726 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
2727 vm.$options.el || el) {
2728 warn(
2729 'You are using the runtime-only build of Vue where the template ' +
2730 'compiler is not available. Either pre-compile the templates into ' +
2731 'render functions, or use the compiler-included build.',
2732 vm
2733 );
2734 } else {
2735 warn(
2736 'Failed to mount component: template or render function not defined.',
2737 vm
2738 );
2739 }
2740 }
2741 }
2742 callHook(vm, 'beforeMount');
2743
2744 var updateComponent;
2745 /* istanbul ignore if */
2746 if ("development" !== 'production' && config.performance && mark) {
2747 updateComponent = function () {
2748 var name = vm._name;
2749 var id = vm._uid;
2750 var startTag = "vue-perf-start:" + id;
2751 var endTag = "vue-perf-end:" + id;
2752
2753 mark(startTag);
2754 var vnode = vm._render();
2755 mark(endTag);
2756 measure(("vue " + name + " render"), startTag, endTag);
2757
2758 mark(startTag);
2759 vm._update(vnode, hydrating);
2760 mark(endTag);
2761 measure(("vue " + name + " patch"), startTag, endTag);
2762 };
2763 } else {
2764 updateComponent = function () {
2765 vm._update(vm._render(), hydrating);
2766 };
2767 }
2768
2769 // we set this to vm._watcher inside the watcher's constructor
2770 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
2771 // component's mounted hook), which relies on vm._watcher being already defined
2772 new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
2773 hydrating = false;
2774
2775 // manually mounted instance, call mounted on self
2776 // mounted is called for render-created child components in its inserted hook
2777 if (vm.$vnode == null) {
2778 vm._isMounted = true;
2779 callHook(vm, 'mounted');
2780 }
2781 return vm
2782}
2783
2784function updateChildComponent (
2785 vm,
2786 propsData,
2787 listeners,
2788 parentVnode,
2789 renderChildren
2790) {
2791 {
2792 isUpdatingChildComponent = true;
2793 }
2794
2795 // determine whether component has slot children
2796 // we need to do this before overwriting $options._renderChildren
2797 var hasChildren = !!(
2798 renderChildren || // has new static slots
2799 vm.$options._renderChildren || // has old static slots
2800 parentVnode.data.scopedSlots || // has new scoped slots
2801 vm.$scopedSlots !== emptyObject // has old scoped slots
2802 );
2803
2804 vm.$options._parentVnode = parentVnode;
2805 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
2806
2807 if (vm._vnode) { // update child tree's parent
2808 vm._vnode.parent = parentVnode;
2809 }
2810 vm.$options._renderChildren = renderChildren;
2811
2812 // update $attrs and $listeners hash
2813 // these are also reactive so they may trigger child update if the child
2814 // used them during render
2815 vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
2816 vm.$listeners = listeners || emptyObject;
2817
2818 // update props
2819 if (propsData && vm.$options.props) {
2820 observerState.shouldConvert = false;
2821 var props = vm._props;
2822 var propKeys = vm.$options._propKeys || [];
2823 for (var i = 0; i < propKeys.length; i++) {
2824 var key = propKeys[i];
2825 props[key] = validateProp(key, vm.$options.props, propsData, vm);
2826 }
2827 observerState.shouldConvert = true;
2828 // keep a copy of raw propsData
2829 vm.$options.propsData = propsData;
2830 }
2831
2832 // update listeners
2833 if (listeners) {
2834 var oldListeners = vm.$options._parentListeners;
2835 vm.$options._parentListeners = listeners;
2836 updateComponentListeners(vm, listeners, oldListeners);
2837 }
2838 // resolve slots + force update if has children
2839 if (hasChildren) {
2840 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
2841 vm.$forceUpdate();
2842 }
2843
2844 {
2845 isUpdatingChildComponent = false;
2846 }
2847}
2848
2849function isInInactiveTree (vm) {
2850 while (vm && (vm = vm.$parent)) {
2851 if (vm._inactive) { return true }
2852 }
2853 return false
2854}
2855
2856function activateChildComponent (vm, direct) {
2857 if (direct) {
2858 vm._directInactive = false;
2859 if (isInInactiveTree(vm)) {
2860 return
2861 }
2862 } else if (vm._directInactive) {
2863 return
2864 }
2865 if (vm._inactive || vm._inactive === null) {
2866 vm._inactive = false;
2867 for (var i = 0; i < vm.$children.length; i++) {
2868 activateChildComponent(vm.$children[i]);
2869 }
2870 callHook(vm, 'activated');
2871 }
2872}
2873
2874function deactivateChildComponent (vm, direct) {
2875 if (direct) {
2876 vm._directInactive = true;
2877 if (isInInactiveTree(vm)) {
2878 return
2879 }
2880 }
2881 if (!vm._inactive) {
2882 vm._inactive = true;
2883 for (var i = 0; i < vm.$children.length; i++) {
2884 deactivateChildComponent(vm.$children[i]);
2885 }
2886 callHook(vm, 'deactivated');
2887 }
2888}
2889
2890function callHook (vm, hook) {
2891 var handlers = vm.$options[hook];
2892 if (handlers) {
2893 for (var i = 0, j = handlers.length; i < j; i++) {
2894 try {
2895 handlers[i].call(vm);
2896 } catch (e) {
2897 handleError(e, vm, (hook + " hook"));
2898 }
2899 }
2900 }
2901 if (vm._hasHookEvent) {
2902 vm.$emit('hook:' + hook);
2903 }
2904}
2905
2906/* */
2907
2908
2909var MAX_UPDATE_COUNT = 100;
2910
2911var queue = [];
2912var activatedChildren = [];
2913var has = {};
2914var circular = {};
2915var waiting = false;
2916var flushing = false;
2917var index = 0;
2918
2919/**
2920 * Reset the scheduler's state.
2921 */
2922function resetSchedulerState () {
2923 index = queue.length = activatedChildren.length = 0;
2924 has = {};
2925 {
2926 circular = {};
2927 }
2928 waiting = flushing = false;
2929}
2930
2931/**
2932 * Flush both queues and run the watchers.
2933 */
2934function flushSchedulerQueue () {
2935 flushing = true;
2936 var watcher, id;
2937
2938 // Sort queue before flush.
2939 // This ensures that:
2940 // 1. Components are updated from parent to child. (because parent is always
2941 // created before the child)
2942 // 2. A component's user watchers are run before its render watcher (because
2943 // user watchers are created before the render watcher)
2944 // 3. If a component is destroyed during a parent component's watcher run,
2945 // its watchers can be skipped.
2946 queue.sort(function (a, b) { return a.id - b.id; });
2947
2948 // do not cache length because more watchers might be pushed
2949 // as we run existing watchers
2950 for (index = 0; index < queue.length; index++) {
2951 watcher = queue[index];
2952 id = watcher.id;
2953 has[id] = null;
2954 watcher.run();
2955 // in dev build, check and stop circular updates.
2956 if ("development" !== 'production' && has[id] != null) {
2957 circular[id] = (circular[id] || 0) + 1;
2958 if (circular[id] > MAX_UPDATE_COUNT) {
2959 warn(
2960 'You may have an infinite update loop ' + (
2961 watcher.user
2962 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
2963 : "in a component render function."
2964 ),
2965 watcher.vm
2966 );
2967 break
2968 }
2969 }
2970 }
2971
2972 // keep copies of post queues before resetting state
2973 var activatedQueue = activatedChildren.slice();
2974 var updatedQueue = queue.slice();
2975
2976 resetSchedulerState();
2977
2978 // call component updated and activated hooks
2979 callActivatedHooks(activatedQueue);
2980 callUpdatedHooks(updatedQueue);
2981
2982 // devtool hook
2983 /* istanbul ignore if */
2984 if (devtools && config.devtools) {
2985 devtools.emit('flush');
2986 }
2987}
2988
2989function callUpdatedHooks (queue) {
2990 var i = queue.length;
2991 while (i--) {
2992 var watcher = queue[i];
2993 var vm = watcher.vm;
2994 if (vm._watcher === watcher && vm._isMounted) {
2995 callHook(vm, 'updated');
2996 }
2997 }
2998}
2999
3000/**
3001 * Queue a kept-alive component that was activated during patch.
3002 * The queue will be processed after the entire tree has been patched.
3003 */
3004function queueActivatedComponent (vm) {
3005 // setting _inactive to false here so that a render function can
3006 // rely on checking whether it's in an inactive tree (e.g. router-view)
3007 vm._inactive = false;
3008 activatedChildren.push(vm);
3009}
3010
3011function callActivatedHooks (queue) {
3012 for (var i = 0; i < queue.length; i++) {
3013 queue[i]._inactive = true;
3014 activateChildComponent(queue[i], true /* true */);
3015 }
3016}
3017
3018/**
3019 * Push a watcher into the watcher queue.
3020 * Jobs with duplicate IDs will be skipped unless it's
3021 * pushed when the queue is being flushed.
3022 */
3023function queueWatcher (watcher) {
3024 var id = watcher.id;
3025 if (has[id] == null) {
3026 has[id] = true;
3027 if (!flushing) {
3028 queue.push(watcher);
3029 } else {
3030 // if already flushing, splice the watcher based on its id
3031 // if already past its id, it will be run next immediately.
3032 var i = queue.length - 1;
3033 while (i > index && queue[i].id > watcher.id) {
3034 i--;
3035 }
3036 queue.splice(i + 1, 0, watcher);
3037 }
3038 // queue the flush
3039 if (!waiting) {
3040 waiting = true;
3041 nextTick(flushSchedulerQueue);
3042 }
3043 }
3044}
3045
3046/* */
3047
3048var uid$2 = 0;
3049
3050/**
3051 * A watcher parses an expression, collects dependencies,
3052 * and fires callback when the expression value changes.
3053 * This is used for both the $watch() api and directives.
3054 */
3055var Watcher = function Watcher (
3056 vm,
3057 expOrFn,
3058 cb,
3059 options,
3060 isRenderWatcher
3061) {
3062 this.vm = vm;
3063 if (isRenderWatcher) {
3064 vm._watcher = this;
3065 }
3066 vm._watchers.push(this);
3067 // options
3068 if (options) {
3069 this.deep = !!options.deep;
3070 this.user = !!options.user;
3071 this.lazy = !!options.lazy;
3072 this.sync = !!options.sync;
3073 } else {
3074 this.deep = this.user = this.lazy = this.sync = false;
3075 }
3076 this.cb = cb;
3077 this.id = ++uid$2; // uid for batching
3078 this.active = true;
3079 this.dirty = this.lazy; // for lazy watchers
3080 this.deps = [];
3081 this.newDeps = [];
3082 this.depIds = new _Set();
3083 this.newDepIds = new _Set();
3084 this.expression = expOrFn.toString();
3085 // parse expression for getter
3086 if (typeof expOrFn === 'function') {
3087 this.getter = expOrFn;
3088 } else {
3089 this.getter = parsePath(expOrFn);
3090 if (!this.getter) {
3091 this.getter = function () {};
3092 "development" !== 'production' && warn(
3093 "Failed watching path: \"" + expOrFn + "\" " +
3094 'Watcher only accepts simple dot-delimited paths. ' +
3095 'For full control, use a function instead.',
3096 vm
3097 );
3098 }
3099 }
3100 this.value = this.lazy
3101 ? undefined
3102 : this.get();
3103};
3104
3105/**
3106 * Evaluate the getter, and re-collect dependencies.
3107 */
3108Watcher.prototype.get = function get () {
3109 pushTarget(this);
3110 var value;
3111 var vm = this.vm;
3112 try {
3113 value = this.getter.call(vm, vm);
3114 } catch (e) {
3115 if (this.user) {
3116 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
3117 } else {
3118 throw e
3119 }
3120 } finally {
3121 // "touch" every property so they are all tracked as
3122 // dependencies for deep watching
3123 if (this.deep) {
3124 traverse(value);
3125 }
3126 popTarget();
3127 this.cleanupDeps();
3128 }
3129 return value
3130};
3131
3132/**
3133 * Add a dependency to this directive.
3134 */
3135Watcher.prototype.addDep = function addDep (dep) {
3136 var id = dep.id;
3137 if (!this.newDepIds.has(id)) {
3138 this.newDepIds.add(id);
3139 this.newDeps.push(dep);
3140 if (!this.depIds.has(id)) {
3141 dep.addSub(this);
3142 }
3143 }
3144};
3145
3146/**
3147 * Clean up for dependency collection.
3148 */
3149Watcher.prototype.cleanupDeps = function cleanupDeps () {
3150 var this$1 = this;
3151
3152 var i = this.deps.length;
3153 while (i--) {
3154 var dep = this$1.deps[i];
3155 if (!this$1.newDepIds.has(dep.id)) {
3156 dep.removeSub(this$1);
3157 }
3158 }
3159 var tmp = this.depIds;
3160 this.depIds = this.newDepIds;
3161 this.newDepIds = tmp;
3162 this.newDepIds.clear();
3163 tmp = this.deps;
3164 this.deps = this.newDeps;
3165 this.newDeps = tmp;
3166 this.newDeps.length = 0;
3167};
3168
3169/**
3170 * Subscriber interface.
3171 * Will be called when a dependency changes.
3172 */
3173Watcher.prototype.update = function update () {
3174 /* istanbul ignore else */
3175 if (this.lazy) {
3176 this.dirty = true;
3177 } else if (this.sync) {
3178 this.run();
3179 } else {
3180 queueWatcher(this);
3181 }
3182};
3183
3184/**
3185 * Scheduler job interface.
3186 * Will be called by the scheduler.
3187 */
3188Watcher.prototype.run = function run () {
3189 if (this.active) {
3190 var value = this.get();
3191 if (
3192 value !== this.value ||
3193 // Deep watchers and watchers on Object/Arrays should fire even
3194 // when the value is the same, because the value may
3195 // have mutated.
3196 isObject(value) ||
3197 this.deep
3198 ) {
3199 // set new value
3200 var oldValue = this.value;
3201 this.value = value;
3202 if (this.user) {
3203 try {
3204 this.cb.call(this.vm, value, oldValue);
3205 } catch (e) {
3206 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
3207 }
3208 } else {
3209 this.cb.call(this.vm, value, oldValue);
3210 }
3211 }
3212 }
3213};
3214
3215/**
3216 * Evaluate the value of the watcher.
3217 * This only gets called for lazy watchers.
3218 */
3219Watcher.prototype.evaluate = function evaluate () {
3220 this.value = this.get();
3221 this.dirty = false;
3222};
3223
3224/**
3225 * Depend on all deps collected by this watcher.
3226 */
3227Watcher.prototype.depend = function depend () {
3228 var this$1 = this;
3229
3230 var i = this.deps.length;
3231 while (i--) {
3232 this$1.deps[i].depend();
3233 }
3234};
3235
3236/**
3237 * Remove self from all dependencies' subscriber list.
3238 */
3239Watcher.prototype.teardown = function teardown () {
3240 var this$1 = this;
3241
3242 if (this.active) {
3243 // remove self from vm's watcher list
3244 // this is a somewhat expensive operation so we skip it
3245 // if the vm is being destroyed.
3246 if (!this.vm._isBeingDestroyed) {
3247 remove(this.vm._watchers, this);
3248 }
3249 var i = this.deps.length;
3250 while (i--) {
3251 this$1.deps[i].removeSub(this$1);
3252 }
3253 this.active = false;
3254 }
3255};
3256
3257/* */
3258
3259var sharedPropertyDefinition = {
3260 enumerable: true,
3261 configurable: true,
3262 get: noop,
3263 set: noop
3264};
3265
3266function proxy (target, sourceKey, key) {
3267 sharedPropertyDefinition.get = function proxyGetter () {
3268 return this[sourceKey][key]
3269 };
3270 sharedPropertyDefinition.set = function proxySetter (val) {
3271 this[sourceKey][key] = val;
3272 };
3273 Object.defineProperty(target, key, sharedPropertyDefinition);
3274}
3275
3276function initState (vm) {
3277 vm._watchers = [];
3278 var opts = vm.$options;
3279 if (opts.props) { initProps(vm, opts.props); }
3280 if (opts.methods) { initMethods(vm, opts.methods); }
3281 if (opts.data) {
3282 initData(vm);
3283 } else {
3284 observe(vm._data = {}, true /* asRootData */);
3285 }
3286 if (opts.computed) { initComputed(vm, opts.computed); }
3287 if (opts.watch && opts.watch !== nativeWatch) {
3288 initWatch(vm, opts.watch);
3289 }
3290}
3291
3292function initProps (vm, propsOptions) {
3293 var propsData = vm.$options.propsData || {};
3294 var props = vm._props = {};
3295 // cache prop keys so that future props updates can iterate using Array
3296 // instead of dynamic object key enumeration.
3297 var keys = vm.$options._propKeys = [];
3298 var isRoot = !vm.$parent;
3299 // root instance props should be converted
3300 observerState.shouldConvert = isRoot;
3301 var loop = function ( key ) {
3302 keys.push(key);
3303 var value = validateProp(key, propsOptions, propsData, vm);
3304 /* istanbul ignore else */
3305 {
3306 var hyphenatedKey = hyphenate(key);
3307 if (isReservedAttribute(hyphenatedKey) ||
3308 config.isReservedAttr(hyphenatedKey)) {
3309 warn(
3310 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
3311 vm
3312 );
3313 }
3314 defineReactive(props, key, value, function () {
3315 if (vm.$parent && !isUpdatingChildComponent) {
3316 warn(
3317 "Avoid mutating a prop directly since the value will be " +
3318 "overwritten whenever the parent component re-renders. " +
3319 "Instead, use a data or computed property based on the prop's " +
3320 "value. Prop being mutated: \"" + key + "\"",
3321 vm
3322 );
3323 }
3324 });
3325 }
3326 // static props are already proxied on the component's prototype
3327 // during Vue.extend(). We only need to proxy props defined at
3328 // instantiation here.
3329 if (!(key in vm)) {
3330 proxy(vm, "_props", key);
3331 }
3332 };
3333
3334 for (var key in propsOptions) loop( key );
3335 observerState.shouldConvert = true;
3336}
3337
3338function initData (vm) {
3339 var data = vm.$options.data;
3340 data = vm._data = typeof data === 'function'
3341 ? getData(data, vm)
3342 : data || {};
3343 if (!isPlainObject(data)) {
3344 data = {};
3345 "development" !== 'production' && warn(
3346 'data functions should return an object:\n' +
3347 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
3348 vm
3349 );
3350 }
3351 // proxy data on instance
3352 var keys = Object.keys(data);
3353 var props = vm.$options.props;
3354 var methods = vm.$options.methods;
3355 var i = keys.length;
3356 while (i--) {
3357 var key = keys[i];
3358 {
3359 if (methods && hasOwn(methods, key)) {
3360 warn(
3361 ("Method \"" + key + "\" has already been defined as a data property."),
3362 vm
3363 );
3364 }
3365 }
3366 if (props && hasOwn(props, key)) {
3367 "development" !== 'production' && warn(
3368 "The data property \"" + key + "\" is already declared as a prop. " +
3369 "Use prop default value instead.",
3370 vm
3371 );
3372 } else if (!isReserved(key)) {
3373 proxy(vm, "_data", key);
3374 }
3375 }
3376 // observe data
3377 observe(data, true /* asRootData */);
3378}
3379
3380function getData (data, vm) {
3381 try {
3382 return data.call(vm, vm)
3383 } catch (e) {
3384 handleError(e, vm, "data()");
3385 return {}
3386 }
3387}
3388
3389var computedWatcherOptions = { lazy: true };
3390
3391function initComputed (vm, computed) {
3392 // $flow-disable-line
3393 var watchers = vm._computedWatchers = Object.create(null);
3394 // computed properties are just getters during SSR
3395 var isSSR = isServerRendering();
3396
3397 for (var key in computed) {
3398 var userDef = computed[key];
3399 var getter = typeof userDef === 'function' ? userDef : userDef.get;
3400 if ("development" !== 'production' && getter == null) {
3401 warn(
3402 ("Getter is missing for computed property \"" + key + "\"."),
3403 vm
3404 );
3405 }
3406
3407 if (!isSSR) {
3408 // create internal watcher for the computed property.
3409 watchers[key] = new Watcher(
3410 vm,
3411 getter || noop,
3412 noop,
3413 computedWatcherOptions
3414 );
3415 }
3416
3417 // component-defined computed properties are already defined on the
3418 // component prototype. We only need to define computed properties defined
3419 // at instantiation here.
3420 if (!(key in vm)) {
3421 defineComputed(vm, key, userDef);
3422 } else {
3423 if (key in vm.$data) {
3424 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
3425 } else if (vm.$options.props && key in vm.$options.props) {
3426 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
3427 }
3428 }
3429 }
3430}
3431
3432function defineComputed (
3433 target,
3434 key,
3435 userDef
3436) {
3437 var shouldCache = !isServerRendering();
3438 if (typeof userDef === 'function') {
3439 sharedPropertyDefinition.get = shouldCache
3440 ? createComputedGetter(key)
3441 : userDef;
3442 sharedPropertyDefinition.set = noop;
3443 } else {
3444 sharedPropertyDefinition.get = userDef.get
3445 ? shouldCache && userDef.cache !== false
3446 ? createComputedGetter(key)
3447 : userDef.get
3448 : noop;
3449 sharedPropertyDefinition.set = userDef.set
3450 ? userDef.set
3451 : noop;
3452 }
3453 if ("development" !== 'production' &&
3454 sharedPropertyDefinition.set === noop) {
3455 sharedPropertyDefinition.set = function () {
3456 warn(
3457 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
3458 this
3459 );
3460 };
3461 }
3462 Object.defineProperty(target, key, sharedPropertyDefinition);
3463}
3464
3465function createComputedGetter (key) {
3466 return function computedGetter () {
3467 var watcher = this._computedWatchers && this._computedWatchers[key];
3468 if (watcher) {
3469 if (watcher.dirty) {
3470 watcher.evaluate();
3471 }
3472 if (Dep.target) {
3473 watcher.depend();
3474 }
3475 return watcher.value
3476 }
3477 }
3478}
3479
3480function initMethods (vm, methods) {
3481 var props = vm.$options.props;
3482 for (var key in methods) {
3483 {
3484 if (methods[key] == null) {
3485 warn(
3486 "Method \"" + key + "\" has an undefined value in the component definition. " +
3487 "Did you reference the function correctly?",
3488 vm
3489 );
3490 }
3491 if (props && hasOwn(props, key)) {
3492 warn(
3493 ("Method \"" + key + "\" has already been defined as a prop."),
3494 vm
3495 );
3496 }
3497 if ((key in vm) && isReserved(key)) {
3498 warn(
3499 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
3500 "Avoid defining component methods that start with _ or $."
3501 );
3502 }
3503 }
3504 vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
3505 }
3506}
3507
3508function initWatch (vm, watch) {
3509 for (var key in watch) {
3510 var handler = watch[key];
3511 if (Array.isArray(handler)) {
3512 for (var i = 0; i < handler.length; i++) {
3513 createWatcher(vm, key, handler[i]);
3514 }
3515 } else {
3516 createWatcher(vm, key, handler);
3517 }
3518 }
3519}
3520
3521function createWatcher (
3522 vm,
3523 keyOrFn,
3524 handler,
3525 options
3526) {
3527 if (isPlainObject(handler)) {
3528 options = handler;
3529 handler = handler.handler;
3530 }
3531 if (typeof handler === 'string') {
3532 handler = vm[handler];
3533 }
3534 return vm.$watch(keyOrFn, handler, options)
3535}
3536
3537function stateMixin (Vue) {
3538 // flow somehow has problems with directly declared definition object
3539 // when using Object.defineProperty, so we have to procedurally build up
3540 // the object here.
3541 var dataDef = {};
3542 dataDef.get = function () { return this._data };
3543 var propsDef = {};
3544 propsDef.get = function () { return this._props };
3545 {
3546 dataDef.set = function (newData) {
3547 warn(
3548 'Avoid replacing instance root $data. ' +
3549 'Use nested data properties instead.',
3550 this
3551 );
3552 };
3553 propsDef.set = function () {
3554 warn("$props is readonly.", this);
3555 };
3556 }
3557 Object.defineProperty(Vue.prototype, '$data', dataDef);
3558 Object.defineProperty(Vue.prototype, '$props', propsDef);
3559
3560 Vue.prototype.$set = set;
3561 Vue.prototype.$delete = del;
3562
3563 Vue.prototype.$watch = function (
3564 expOrFn,
3565 cb,
3566 options
3567 ) {
3568 var vm = this;
3569 if (isPlainObject(cb)) {
3570 return createWatcher(vm, expOrFn, cb, options)
3571 }
3572 options = options || {};
3573 options.user = true;
3574 var watcher = new Watcher(vm, expOrFn, cb, options);
3575 if (options.immediate) {
3576 cb.call(vm, watcher.value);
3577 }
3578 return function unwatchFn () {
3579 watcher.teardown();
3580 }
3581 };
3582}
3583
3584/* */
3585
3586function initProvide (vm) {
3587 var provide = vm.$options.provide;
3588 if (provide) {
3589 vm._provided = typeof provide === 'function'
3590 ? provide.call(vm)
3591 : provide;
3592 }
3593}
3594
3595function initInjections (vm) {
3596 var result = resolveInject(vm.$options.inject, vm);
3597 if (result) {
3598 observerState.shouldConvert = false;
3599 Object.keys(result).forEach(function (key) {
3600 /* istanbul ignore else */
3601 {
3602 defineReactive(vm, key, result[key], function () {
3603 warn(
3604 "Avoid mutating an injected value directly since the changes will be " +
3605 "overwritten whenever the provided component re-renders. " +
3606 "injection being mutated: \"" + key + "\"",
3607 vm
3608 );
3609 });
3610 }
3611 });
3612 observerState.shouldConvert = true;
3613 }
3614}
3615
3616function resolveInject (inject, vm) {
3617 if (inject) {
3618 // inject is :any because flow is not smart enough to figure out cached
3619 var result = Object.create(null);
3620 var keys = hasSymbol
3621 ? Reflect.ownKeys(inject).filter(function (key) {
3622 /* istanbul ignore next */
3623 return Object.getOwnPropertyDescriptor(inject, key).enumerable
3624 })
3625 : Object.keys(inject);
3626
3627 for (var i = 0; i < keys.length; i++) {
3628 var key = keys[i];
3629 var provideKey = inject[key].from;
3630 var source = vm;
3631 while (source) {
3632 if (source._provided && provideKey in source._provided) {
3633 result[key] = source._provided[provideKey];
3634 break
3635 }
3636 source = source.$parent;
3637 }
3638 if (!source) {
3639 if ('default' in inject[key]) {
3640 var provideDefault = inject[key].default;
3641 result[key] = typeof provideDefault === 'function'
3642 ? provideDefault.call(vm)
3643 : provideDefault;
3644 } else {
3645 warn(("Injection \"" + key + "\" not found"), vm);
3646 }
3647 }
3648 }
3649 return result
3650 }
3651}
3652
3653/* */
3654
3655/**
3656 * Runtime helper for rendering v-for lists.
3657 */
3658function renderList (
3659 val,
3660 render
3661) {
3662 var ret, i, l, keys, key;
3663 if (Array.isArray(val) || typeof val === 'string') {
3664 ret = new Array(val.length);
3665 for (i = 0, l = val.length; i < l; i++) {
3666 ret[i] = render(val[i], i);
3667 }
3668 } else if (typeof val === 'number') {
3669 ret = new Array(val);
3670 for (i = 0; i < val; i++) {
3671 ret[i] = render(i + 1, i);
3672 }
3673 } else if (isObject(val)) {
3674 keys = Object.keys(val);
3675 ret = new Array(keys.length);
3676 for (i = 0, l = keys.length; i < l; i++) {
3677 key = keys[i];
3678 ret[i] = render(val[key], key, i);
3679 }
3680 }
3681 if (isDef(ret)) {
3682 (ret)._isVList = true;
3683 }
3684 return ret
3685}
3686
3687/* */
3688
3689/**
3690 * Runtime helper for rendering <slot>
3691 */
3692function renderSlot (
3693 name,
3694 fallback,
3695 props,
3696 bindObject
3697) {
3698 var scopedSlotFn = this.$scopedSlots[name];
3699 var nodes;
3700 if (scopedSlotFn) { // scoped slot
3701 props = props || {};
3702 if (bindObject) {
3703 if ("development" !== 'production' && !isObject(bindObject)) {
3704 warn(
3705 'slot v-bind without argument expects an Object',
3706 this
3707 );
3708 }
3709 props = extend(extend({}, bindObject), props);
3710 }
3711 nodes = scopedSlotFn(props) || fallback;
3712 } else {
3713 var slotNodes = this.$slots[name];
3714 // warn duplicate slot usage
3715 if (slotNodes) {
3716 if ("development" !== 'production' && slotNodes._rendered) {
3717 warn(
3718 "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
3719 "- this will likely cause render errors.",
3720 this
3721 );
3722 }
3723 slotNodes._rendered = true;
3724 }
3725 nodes = slotNodes || fallback;
3726 }
3727
3728 var target = props && props.slot;
3729 if (target) {
3730 return this.$createElement('template', { slot: target }, nodes)
3731 } else {
3732 return nodes
3733 }
3734}
3735
3736/* */
3737
3738/**
3739 * Runtime helper for resolving filters
3740 */
3741function resolveFilter (id) {
3742 return resolveAsset(this.$options, 'filters', id, true) || identity
3743}
3744
3745/* */
3746
3747/**
3748 * Runtime helper for checking keyCodes from config.
3749 * exposed as Vue.prototype._k
3750 * passing in eventKeyName as last argument separately for backwards compat
3751 */
3752function checkKeyCodes (
3753 eventKeyCode,
3754 key,
3755 builtInAlias,
3756 eventKeyName
3757) {
3758 var keyCodes = config.keyCodes[key] || builtInAlias;
3759 if (keyCodes) {
3760 if (Array.isArray(keyCodes)) {
3761 return keyCodes.indexOf(eventKeyCode) === -1
3762 } else {
3763 return keyCodes !== eventKeyCode
3764 }
3765 } else if (eventKeyName) {
3766 return hyphenate(eventKeyName) !== key
3767 }
3768}
3769
3770/* */
3771
3772/**
3773 * Runtime helper for merging v-bind="object" into a VNode's data.
3774 */
3775function bindObjectProps (
3776 data,
3777 tag,
3778 value,
3779 asProp,
3780 isSync
3781) {
3782 if (value) {
3783 if (!isObject(value)) {
3784 "development" !== 'production' && warn(
3785 'v-bind without argument expects an Object or Array value',
3786 this
3787 );
3788 } else {
3789 if (Array.isArray(value)) {
3790 value = toObject(value);
3791 }
3792 var hash;
3793 var loop = function ( key ) {
3794 if (
3795 key === 'class' ||
3796 key === 'style' ||
3797 isReservedAttribute(key)
3798 ) {
3799 hash = data;
3800 } else {
3801 var type = data.attrs && data.attrs.type;
3802 hash = asProp || config.mustUseProp(tag, type, key)
3803 ? data.domProps || (data.domProps = {})
3804 : data.attrs || (data.attrs = {});
3805 }
3806 if (!(key in hash)) {
3807 hash[key] = value[key];
3808
3809 if (isSync) {
3810 var on = data.on || (data.on = {});
3811 on[("update:" + key)] = function ($event) {
3812 value[key] = $event;
3813 };
3814 }
3815 }
3816 };
3817
3818 for (var key in value) loop( key );
3819 }
3820 }
3821 return data
3822}
3823
3824/* */
3825
3826/**
3827 * Runtime helper for rendering static trees.
3828 */
3829function renderStatic (
3830 index,
3831 isInFor
3832) {
3833 var cached = this._staticTrees || (this._staticTrees = []);
3834 var tree = cached[index];
3835 // if has already-rendered static tree and not inside v-for,
3836 // we can reuse the same tree by doing a shallow clone.
3837 if (tree && !isInFor) {
3838 return Array.isArray(tree)
3839 ? cloneVNodes(tree)
3840 : cloneVNode(tree)
3841 }
3842 // otherwise, render a fresh tree.
3843 tree = cached[index] = this.$options.staticRenderFns[index].call(
3844 this._renderProxy,
3845 null,
3846 this // for render fns generated for functional component templates
3847 );
3848 markStatic(tree, ("__static__" + index), false);
3849 return tree
3850}
3851
3852/**
3853 * Runtime helper for v-once.
3854 * Effectively it means marking the node as static with a unique key.
3855 */
3856function markOnce (
3857 tree,
3858 index,
3859 key
3860) {
3861 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
3862 return tree
3863}
3864
3865function markStatic (
3866 tree,
3867 key,
3868 isOnce
3869) {
3870 if (Array.isArray(tree)) {
3871 for (var i = 0; i < tree.length; i++) {
3872 if (tree[i] && typeof tree[i] !== 'string') {
3873 markStaticNode(tree[i], (key + "_" + i), isOnce);
3874 }
3875 }
3876 } else {
3877 markStaticNode(tree, key, isOnce);
3878 }
3879}
3880
3881function markStaticNode (node, key, isOnce) {
3882 node.isStatic = true;
3883 node.key = key;
3884 node.isOnce = isOnce;
3885}
3886
3887/* */
3888
3889function bindObjectListeners (data, value) {
3890 if (value) {
3891 if (!isPlainObject(value)) {
3892 "development" !== 'production' && warn(
3893 'v-on without argument expects an Object value',
3894 this
3895 );
3896 } else {
3897 var on = data.on = data.on ? extend({}, data.on) : {};
3898 for (var key in value) {
3899 var existing = on[key];
3900 var ours = value[key];
3901 on[key] = existing ? [].concat(existing, ours) : ours;
3902 }
3903 }
3904 }
3905 return data
3906}
3907
3908/* */
3909
3910function installRenderHelpers (target) {
3911 target._o = markOnce;
3912 target._n = toNumber;
3913 target._s = toString;
3914 target._l = renderList;
3915 target._t = renderSlot;
3916 target._q = looseEqual;
3917 target._i = looseIndexOf;
3918 target._m = renderStatic;
3919 target._f = resolveFilter;
3920 target._k = checkKeyCodes;
3921 target._b = bindObjectProps;
3922 target._v = createTextVNode;
3923 target._e = createEmptyVNode;
3924 target._u = resolveScopedSlots;
3925 target._g = bindObjectListeners;
3926}
3927
3928/* */
3929
3930function FunctionalRenderContext (
3931 data,
3932 props,
3933 children,
3934 parent,
3935 Ctor
3936) {
3937 var options = Ctor.options;
3938 this.data = data;
3939 this.props = props;
3940 this.children = children;
3941 this.parent = parent;
3942 this.listeners = data.on || emptyObject;
3943 this.injections = resolveInject(options.inject, parent);
3944 this.slots = function () { return resolveSlots(children, parent); };
3945
3946 // ensure the createElement function in functional components
3947 // gets a unique context - this is necessary for correct named slot check
3948 var contextVm = Object.create(parent);
3949 var isCompiled = isTrue(options._compiled);
3950 var needNormalization = !isCompiled;
3951
3952 // support for compiled functional template
3953 if (isCompiled) {
3954 // exposing $options for renderStatic()
3955 this.$options = options;
3956 // pre-resolve slots for renderSlot()
3957 this.$slots = this.slots();
3958 this.$scopedSlots = data.scopedSlots || emptyObject;
3959 }
3960
3961 if (options._scopeId) {
3962 this._c = function (a, b, c, d) {
3963 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3964 if (vnode) {
3965 vnode.fnScopeId = options._scopeId;
3966 vnode.fnContext = parent;
3967 }
3968 return vnode
3969 };
3970 } else {
3971 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
3972 }
3973}
3974
3975installRenderHelpers(FunctionalRenderContext.prototype);
3976
3977function createFunctionalComponent (
3978 Ctor,
3979 propsData,
3980 data,
3981 contextVm,
3982 children
3983) {
3984 var options = Ctor.options;
3985 var props = {};
3986 var propOptions = options.props;
3987 if (isDef(propOptions)) {
3988 for (var key in propOptions) {
3989 props[key] = validateProp(key, propOptions, propsData || emptyObject);
3990 }
3991 } else {
3992 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3993 if (isDef(data.props)) { mergeProps(props, data.props); }
3994 }
3995
3996 var renderContext = new FunctionalRenderContext(
3997 data,
3998 props,
3999 children,
4000 contextVm,
4001 Ctor
4002 );
4003
4004 var vnode = options.render.call(null, renderContext._c, renderContext);
4005
4006 if (vnode instanceof VNode) {
4007 vnode.fnContext = contextVm;
4008 vnode.fnOptions = options;
4009 if (data.slot) {
4010 (vnode.data || (vnode.data = {})).slot = data.slot;
4011 }
4012 }
4013
4014 return vnode
4015}
4016
4017function mergeProps (to, from) {
4018 for (var key in from) {
4019 to[camelize(key)] = from[key];
4020 }
4021}
4022
4023/* */
4024
4025
4026
4027
4028// Register the component hook to weex native render engine.
4029// The hook will be triggered by native, not javascript.
4030
4031
4032// Updates the state of the component to weex native render engine.
4033
4034/* */
4035
4036// https://github.com/Hanks10100/weex-native-directive/tree/master/component
4037
4038// listening on native callback
4039
4040/* */
4041
4042/* */
4043
4044// hooks to be invoked on component VNodes during patch
4045var componentVNodeHooks = {
4046 init: function init (
4047 vnode,
4048 hydrating,
4049 parentElm,
4050 refElm
4051 ) {
4052 if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
4053 var child = vnode.componentInstance = createComponentInstanceForVnode(
4054 vnode,
4055 activeInstance,
4056 parentElm,
4057 refElm
4058 );
4059 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
4060 } else if (vnode.data.keepAlive) {
4061 // kept-alive components, treat as a patch
4062 var mountedNode = vnode; // work around flow
4063 componentVNodeHooks.prepatch(mountedNode, mountedNode);
4064 }
4065 },
4066
4067 prepatch: function prepatch (oldVnode, vnode) {
4068 var options = vnode.componentOptions;
4069 var child = vnode.componentInstance = oldVnode.componentInstance;
4070 updateChildComponent(
4071 child,
4072 options.propsData, // updated props
4073 options.listeners, // updated listeners
4074 vnode, // new parent vnode
4075 options.children // new children
4076 );
4077 },
4078
4079 insert: function insert (vnode) {
4080 var context = vnode.context;
4081 var componentInstance = vnode.componentInstance;
4082 if (!componentInstance._isMounted) {
4083 componentInstance._isMounted = true;
4084 callHook(componentInstance, 'mounted');
4085 }
4086 if (vnode.data.keepAlive) {
4087 if (context._isMounted) {
4088 // vue-router#1212
4089 // During updates, a kept-alive component's child components may
4090 // change, so directly walking the tree here may call activated hooks
4091 // on incorrect children. Instead we push them into a queue which will
4092 // be processed after the whole patch process ended.
4093 queueActivatedComponent(componentInstance);
4094 } else {
4095 activateChildComponent(componentInstance, true /* direct */);
4096 }
4097 }
4098 },
4099
4100 destroy: function destroy (vnode) {
4101 var componentInstance = vnode.componentInstance;
4102 if (!componentInstance._isDestroyed) {
4103 if (!vnode.data.keepAlive) {
4104 componentInstance.$destroy();
4105 } else {
4106 deactivateChildComponent(componentInstance, true /* direct */);
4107 }
4108 }
4109 }
4110};
4111
4112var hooksToMerge = Object.keys(componentVNodeHooks);
4113
4114function createComponent (
4115 Ctor,
4116 data,
4117 context,
4118 children,
4119 tag
4120) {
4121 if (isUndef(Ctor)) {
4122 return
4123 }
4124
4125 var baseCtor = context.$options._base;
4126
4127 // plain options object: turn it into a constructor
4128 if (isObject(Ctor)) {
4129 Ctor = baseCtor.extend(Ctor);
4130 }
4131
4132 // if at this stage it's not a constructor or an async component factory,
4133 // reject.
4134 if (typeof Ctor !== 'function') {
4135 {
4136 warn(("Invalid Component definition: " + (String(Ctor))), context);
4137 }
4138 return
4139 }
4140
4141 // async component
4142 var asyncFactory;
4143 if (isUndef(Ctor.cid)) {
4144 asyncFactory = Ctor;
4145 Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
4146 if (Ctor === undefined) {
4147 // return a placeholder node for async component, which is rendered
4148 // as a comment node but preserves all the raw information for the node.
4149 // the information will be used for async server-rendering and hydration.
4150 return createAsyncPlaceholder(
4151 asyncFactory,
4152 data,
4153 context,
4154 children,
4155 tag
4156 )
4157 }
4158 }
4159
4160 data = data || {};
4161
4162 // resolve constructor options in case global mixins are applied after
4163 // component constructor creation
4164 resolveConstructorOptions(Ctor);
4165
4166 // transform component v-model data into props & events
4167 if (isDef(data.model)) {
4168 transformModel(Ctor.options, data);
4169 }
4170
4171 // extract props
4172 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
4173
4174 // functional component
4175 if (isTrue(Ctor.options.functional)) {
4176 return createFunctionalComponent(Ctor, propsData, data, context, children)
4177 }
4178
4179 // extract listeners, since these needs to be treated as
4180 // child component listeners instead of DOM listeners
4181 var listeners = data.on;
4182 // replace with listeners with .native modifier
4183 // so it gets processed during parent component patch.
4184 data.on = data.nativeOn;
4185
4186 if (isTrue(Ctor.options.abstract)) {
4187 // abstract components do not keep anything
4188 // other than props & listeners & slot
4189
4190 // work around flow
4191 var slot = data.slot;
4192 data = {};
4193 if (slot) {
4194 data.slot = slot;
4195 }
4196 }
4197
4198 // merge component management hooks onto the placeholder node
4199 mergeHooks(data);
4200
4201 // return a placeholder vnode
4202 var name = Ctor.options.name || tag;
4203 var vnode = new VNode(
4204 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
4205 data, undefined, undefined, undefined, context,
4206 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
4207 asyncFactory
4208 );
4209
4210 // Weex specific: invoke recycle-list optimized @render function for
4211 // extracting cell-slot template.
4212 // https://github.com/Hanks10100/weex-native-directive/tree/master/component
4213 /* istanbul ignore if */
4214 return vnode
4215}
4216
4217function createComponentInstanceForVnode (
4218 vnode, // we know it's MountedComponentVNode but flow doesn't
4219 parent, // activeInstance in lifecycle state
4220 parentElm,
4221 refElm
4222) {
4223 var options = {
4224 _isComponent: true,
4225 parent: parent,
4226 _parentVnode: vnode,
4227 _parentElm: parentElm || null,
4228 _refElm: refElm || null
4229 };
4230 // check inline-template render functions
4231 var inlineTemplate = vnode.data.inlineTemplate;
4232 if (isDef(inlineTemplate)) {
4233 options.render = inlineTemplate.render;
4234 options.staticRenderFns = inlineTemplate.staticRenderFns;
4235 }
4236 return new vnode.componentOptions.Ctor(options)
4237}
4238
4239function mergeHooks (data) {
4240 if (!data.hook) {
4241 data.hook = {};
4242 }
4243 for (var i = 0; i < hooksToMerge.length; i++) {
4244 var key = hooksToMerge[i];
4245 var fromParent = data.hook[key];
4246 var ours = componentVNodeHooks[key];
4247 data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
4248 }
4249}
4250
4251function mergeHook$1 (one, two) {
4252 return function (a, b, c, d) {
4253 one(a, b, c, d);
4254 two(a, b, c, d);
4255 }
4256}
4257
4258// transform component v-model info (value and callback) into
4259// prop and event handler respectively.
4260function transformModel (options, data) {
4261 var prop = (options.model && options.model.prop) || 'value';
4262 var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
4263 var on = data.on || (data.on = {});
4264 if (isDef(on[event])) {
4265 on[event] = [data.model.callback].concat(on[event]);
4266 } else {
4267 on[event] = data.model.callback;
4268 }
4269}
4270
4271/* */
4272
4273var SIMPLE_NORMALIZE = 1;
4274var ALWAYS_NORMALIZE = 2;
4275
4276// wrapper function for providing a more flexible interface
4277// without getting yelled at by flow
4278function createElement (
4279 context,
4280 tag,
4281 data,
4282 children,
4283 normalizationType,
4284 alwaysNormalize
4285) {
4286 if (Array.isArray(data) || isPrimitive(data)) {
4287 normalizationType = children;
4288 children = data;
4289 data = undefined;
4290 }
4291 if (isTrue(alwaysNormalize)) {
4292 normalizationType = ALWAYS_NORMALIZE;
4293 }
4294 return _createElement(context, tag, data, children, normalizationType)
4295}
4296
4297function _createElement (
4298 context,
4299 tag,
4300 data,
4301 children,
4302 normalizationType
4303) {
4304 if (isDef(data) && isDef((data).__ob__)) {
4305 "development" !== 'production' && warn(
4306 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
4307 'Always create fresh vnode data objects in each render!',
4308 context
4309 );
4310 return createEmptyVNode()
4311 }
4312 // object syntax in v-bind
4313 if (isDef(data) && isDef(data.is)) {
4314 tag = data.is;
4315 }
4316 if (!tag) {
4317 // in case of component :is set to falsy value
4318 return createEmptyVNode()
4319 }
4320 // warn against non-primitive key
4321 if ("development" !== 'production' &&
4322 isDef(data) && isDef(data.key) && !isPrimitive(data.key)
4323 ) {
4324 {
4325 warn(
4326 'Avoid using non-primitive value as key, ' +
4327 'use string/number value instead.',
4328 context
4329 );
4330 }
4331 }
4332 // support single function children as default scoped slot
4333 if (Array.isArray(children) &&
4334 typeof children[0] === 'function'
4335 ) {
4336 data = data || {};
4337 data.scopedSlots = { default: children[0] };
4338 children.length = 0;
4339 }
4340 if (normalizationType === ALWAYS_NORMALIZE) {
4341 children = normalizeChildren(children);
4342 } else if (normalizationType === SIMPLE_NORMALIZE) {
4343 children = simpleNormalizeChildren(children);
4344 }
4345 var vnode, ns;
4346 if (typeof tag === 'string') {
4347 var Ctor;
4348 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
4349 if (config.isReservedTag(tag)) {
4350 // platform built-in elements
4351 vnode = new VNode(
4352 config.parsePlatformTagName(tag), data, children,
4353 undefined, undefined, context
4354 );
4355 } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
4356 // component
4357 vnode = createComponent(Ctor, data, context, children, tag);
4358 } else {
4359 // unknown or unlisted namespaced elements
4360 // check at runtime because it may get assigned a namespace when its
4361 // parent normalizes children
4362 vnode = new VNode(
4363 tag, data, children,
4364 undefined, undefined, context
4365 );
4366 }
4367 } else {
4368 // direct component options / constructor
4369 vnode = createComponent(tag, data, context, children);
4370 }
4371 if (isDef(vnode)) {
4372 if (ns) { applyNS(vnode, ns); }
4373 return vnode
4374 } else {
4375 return createEmptyVNode()
4376 }
4377}
4378
4379function applyNS (vnode, ns, force) {
4380 vnode.ns = ns;
4381 if (vnode.tag === 'foreignObject') {
4382 // use default namespace inside foreignObject
4383 ns = undefined;
4384 force = true;
4385 }
4386 if (isDef(vnode.children)) {
4387 for (var i = 0, l = vnode.children.length; i < l; i++) {
4388 var child = vnode.children[i];
4389 if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
4390 applyNS(child, ns, force);
4391 }
4392 }
4393 }
4394}
4395
4396/* */
4397
4398function initRender (vm) {
4399 vm._vnode = null; // the root of the child tree
4400 vm._staticTrees = null; // v-once cached trees
4401 var options = vm.$options;
4402 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
4403 var renderContext = parentVnode && parentVnode.context;
4404 vm.$slots = resolveSlots(options._renderChildren, renderContext);
4405 vm.$scopedSlots = emptyObject;
4406 // bind the createElement fn to this instance
4407 // so that we get proper render context inside it.
4408 // args order: tag, data, children, normalizationType, alwaysNormalize
4409 // internal version is used by render functions compiled from templates
4410 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
4411 // normalization is always applied for the public version, used in
4412 // user-written render functions.
4413 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
4414
4415 // $attrs & $listeners are exposed for easier HOC creation.
4416 // they need to be reactive so that HOCs using them are always updated
4417 var parentData = parentVnode && parentVnode.data;
4418
4419 /* istanbul ignore else */
4420 {
4421 defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
4422 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
4423 }, true);
4424 defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
4425 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
4426 }, true);
4427 }
4428}
4429
4430function renderMixin (Vue) {
4431 // install runtime convenience helpers
4432 installRenderHelpers(Vue.prototype);
4433
4434 Vue.prototype.$nextTick = function (fn) {
4435 return nextTick(fn, this)
4436 };
4437
4438 Vue.prototype._render = function () {
4439 var vm = this;
4440 var ref = vm.$options;
4441 var render = ref.render;
4442 var _parentVnode = ref._parentVnode;
4443
4444 if (vm._isMounted) {
4445 // if the parent didn't update, the slot nodes will be the ones from
4446 // last render. They need to be cloned to ensure "freshness" for this render.
4447 for (var key in vm.$slots) {
4448 var slot = vm.$slots[key];
4449 // _rendered is a flag added by renderSlot, but may not be present
4450 // if the slot is passed from manually written render functions
4451 if (slot._rendered || (slot[0] && slot[0].elm)) {
4452 vm.$slots[key] = cloneVNodes(slot, true /* deep */);
4453 }
4454 }
4455 }
4456
4457 vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
4458
4459 // set parent vnode. this allows render functions to have access
4460 // to the data on the placeholder node.
4461 vm.$vnode = _parentVnode;
4462 // render self
4463 var vnode;
4464 try {
4465 vnode = render.call(vm._renderProxy, vm.$createElement);
4466 } catch (e) {
4467 handleError(e, vm, "render");
4468 // return error render result,
4469 // or previous vnode to prevent render error causing blank component
4470 /* istanbul ignore else */
4471 {
4472 if (vm.$options.renderError) {
4473 try {
4474 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
4475 } catch (e) {
4476 handleError(e, vm, "renderError");
4477 vnode = vm._vnode;
4478 }
4479 } else {
4480 vnode = vm._vnode;
4481 }
4482 }
4483 }
4484 // return empty vnode in case the render function errored out
4485 if (!(vnode instanceof VNode)) {
4486 if ("development" !== 'production' && Array.isArray(vnode)) {
4487 warn(
4488 'Multiple root nodes returned from render function. Render function ' +
4489 'should return a single root node.',
4490 vm
4491 );
4492 }
4493 vnode = createEmptyVNode();
4494 }
4495 // set parent
4496 vnode.parent = _parentVnode;
4497 return vnode
4498 };
4499}
4500
4501/* */
4502
4503var uid$1 = 0;
4504
4505function initMixin (Vue) {
4506 Vue.prototype._init = function (options) {
4507 var vm = this;
4508 // a uid
4509 vm._uid = uid$1++;
4510
4511 var startTag, endTag;
4512 /* istanbul ignore if */
4513 if ("development" !== 'production' && config.performance && mark) {
4514 startTag = "vue-perf-start:" + (vm._uid);
4515 endTag = "vue-perf-end:" + (vm._uid);
4516 mark(startTag);
4517 }
4518
4519 // a flag to avoid this being observed
4520 vm._isVue = true;
4521 // merge options
4522 if (options && options._isComponent) {
4523 // optimize internal component instantiation
4524 // since dynamic options merging is pretty slow, and none of the
4525 // internal component options needs special treatment.
4526 initInternalComponent(vm, options);
4527 } else {
4528 vm.$options = mergeOptions(
4529 resolveConstructorOptions(vm.constructor),
4530 options || {},
4531 vm
4532 );
4533 }
4534 /* istanbul ignore else */
4535 {
4536 initProxy(vm);
4537 }
4538 // expose real self
4539 vm._self = vm;
4540 initLifecycle(vm);
4541 initEvents(vm);
4542 initRender(vm);
4543 callHook(vm, 'beforeCreate');
4544 initInjections(vm); // resolve injections before data/props
4545 initState(vm);
4546 initProvide(vm); // resolve provide after data/props
4547 callHook(vm, 'created');
4548
4549 /* istanbul ignore if */
4550 if ("development" !== 'production' && config.performance && mark) {
4551 vm._name = formatComponentName(vm, false);
4552 mark(endTag);
4553 measure(("vue " + (vm._name) + " init"), startTag, endTag);
4554 }
4555
4556 if (vm.$options.el) {
4557 vm.$mount(vm.$options.el);
4558 }
4559 };
4560}
4561
4562function initInternalComponent (vm, options) {
4563 var opts = vm.$options = Object.create(vm.constructor.options);
4564 // doing this because it's faster than dynamic enumeration.
4565 var parentVnode = options._parentVnode;
4566 opts.parent = options.parent;
4567 opts._parentVnode = parentVnode;
4568 opts._parentElm = options._parentElm;
4569 opts._refElm = options._refElm;
4570
4571 var vnodeComponentOptions = parentVnode.componentOptions;
4572 opts.propsData = vnodeComponentOptions.propsData;
4573 opts._parentListeners = vnodeComponentOptions.listeners;
4574 opts._renderChildren = vnodeComponentOptions.children;
4575 opts._componentTag = vnodeComponentOptions.tag;
4576
4577 if (options.render) {
4578 opts.render = options.render;
4579 opts.staticRenderFns = options.staticRenderFns;
4580 }
4581}
4582
4583function resolveConstructorOptions (Ctor) {
4584 var options = Ctor.options;
4585 if (Ctor.super) {
4586 var superOptions = resolveConstructorOptions(Ctor.super);
4587 var cachedSuperOptions = Ctor.superOptions;
4588 if (superOptions !== cachedSuperOptions) {
4589 // super option changed,
4590 // need to resolve new options.
4591 Ctor.superOptions = superOptions;
4592 // check if there are any late-modified/attached options (#4976)
4593 var modifiedOptions = resolveModifiedOptions(Ctor);
4594 // update base extend options
4595 if (modifiedOptions) {
4596 extend(Ctor.extendOptions, modifiedOptions);
4597 }
4598 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
4599 if (options.name) {
4600 options.components[options.name] = Ctor;
4601 }
4602 }
4603 }
4604 return options
4605}
4606
4607function resolveModifiedOptions (Ctor) {
4608 var modified;
4609 var latest = Ctor.options;
4610 var extended = Ctor.extendOptions;
4611 var sealed = Ctor.sealedOptions;
4612 for (var key in latest) {
4613 if (latest[key] !== sealed[key]) {
4614 if (!modified) { modified = {}; }
4615 modified[key] = dedupe(latest[key], extended[key], sealed[key]);
4616 }
4617 }
4618 return modified
4619}
4620
4621function dedupe (latest, extended, sealed) {
4622 // compare latest and sealed to ensure lifecycle hooks won't be duplicated
4623 // between merges
4624 if (Array.isArray(latest)) {
4625 var res = [];
4626 sealed = Array.isArray(sealed) ? sealed : [sealed];
4627 extended = Array.isArray(extended) ? extended : [extended];
4628 for (var i = 0; i < latest.length; i++) {
4629 // push original options and not sealed options to exclude duplicated options
4630 if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
4631 res.push(latest[i]);
4632 }
4633 }
4634 return res
4635 } else {
4636 return latest
4637 }
4638}
4639
4640function Vue$3 (options) {
4641 if ("development" !== 'production' &&
4642 !(this instanceof Vue$3)
4643 ) {
4644 warn('Vue is a constructor and should be called with the `new` keyword');
4645 }
4646 this._init(options);
4647}
4648
4649initMixin(Vue$3);
4650stateMixin(Vue$3);
4651eventsMixin(Vue$3);
4652lifecycleMixin(Vue$3);
4653renderMixin(Vue$3);
4654
4655/* */
4656
4657function initUse (Vue) {
4658 Vue.use = function (plugin) {
4659 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
4660 if (installedPlugins.indexOf(plugin) > -1) {
4661 return this
4662 }
4663
4664 // additional parameters
4665 var args = toArray(arguments, 1);
4666 args.unshift(this);
4667 if (typeof plugin.install === 'function') {
4668 plugin.install.apply(plugin, args);
4669 } else if (typeof plugin === 'function') {
4670 plugin.apply(null, args);
4671 }
4672 installedPlugins.push(plugin);
4673 return this
4674 };
4675}
4676
4677/* */
4678
4679function initMixin$1 (Vue) {
4680 Vue.mixin = function (mixin) {
4681 this.options = mergeOptions(this.options, mixin);
4682 return this
4683 };
4684}
4685
4686/* */
4687
4688function initExtend (Vue) {
4689 /**
4690 * Each instance constructor, including Vue, has a unique
4691 * cid. This enables us to create wrapped "child
4692 * constructors" for prototypal inheritance and cache them.
4693 */
4694 Vue.cid = 0;
4695 var cid = 1;
4696
4697 /**
4698 * Class inheritance
4699 */
4700 Vue.extend = function (extendOptions) {
4701 extendOptions = extendOptions || {};
4702 var Super = this;
4703 var SuperId = Super.cid;
4704 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
4705 if (cachedCtors[SuperId]) {
4706 return cachedCtors[SuperId]
4707 }
4708
4709 var name = extendOptions.name || Super.options.name;
4710 if ("development" !== 'production' && name) {
4711 validateComponentName(name);
4712 }
4713
4714 var Sub = function VueComponent (options) {
4715 this._init(options);
4716 };
4717 Sub.prototype = Object.create(Super.prototype);
4718 Sub.prototype.constructor = Sub;
4719 Sub.cid = cid++;
4720 Sub.options = mergeOptions(
4721 Super.options,
4722 extendOptions
4723 );
4724 Sub['super'] = Super;
4725
4726 // For props and computed properties, we define the proxy getters on
4727 // the Vue instances at extension time, on the extended prototype. This
4728 // avoids Object.defineProperty calls for each instance created.
4729 if (Sub.options.props) {
4730 initProps$1(Sub);
4731 }
4732 if (Sub.options.computed) {
4733 initComputed$1(Sub);
4734 }
4735
4736 // allow further extension/mixin/plugin usage
4737 Sub.extend = Super.extend;
4738 Sub.mixin = Super.mixin;
4739 Sub.use = Super.use;
4740
4741 // create asset registers, so extended classes
4742 // can have their private assets too.
4743 ASSET_TYPES.forEach(function (type) {
4744 Sub[type] = Super[type];
4745 });
4746 // enable recursive self-lookup
4747 if (name) {
4748 Sub.options.components[name] = Sub;
4749 }
4750
4751 // keep a reference to the super options at extension time.
4752 // later at instantiation we can check if Super's options have
4753 // been updated.
4754 Sub.superOptions = Super.options;
4755 Sub.extendOptions = extendOptions;
4756 Sub.sealedOptions = extend({}, Sub.options);
4757
4758 // cache constructor
4759 cachedCtors[SuperId] = Sub;
4760 return Sub
4761 };
4762}
4763
4764function initProps$1 (Comp) {
4765 var props = Comp.options.props;
4766 for (var key in props) {
4767 proxy(Comp.prototype, "_props", key);
4768 }
4769}
4770
4771function initComputed$1 (Comp) {
4772 var computed = Comp.options.computed;
4773 for (var key in computed) {
4774 defineComputed(Comp.prototype, key, computed[key]);
4775 }
4776}
4777
4778/* */
4779
4780function initAssetRegisters (Vue) {
4781 /**
4782 * Create asset registration methods.
4783 */
4784 ASSET_TYPES.forEach(function (type) {
4785 Vue[type] = function (
4786 id,
4787 definition
4788 ) {
4789 if (!definition) {
4790 return this.options[type + 's'][id]
4791 } else {
4792 /* istanbul ignore if */
4793 if ("development" !== 'production' && type === 'component') {
4794 validateComponentName(id);
4795 }
4796 if (type === 'component' && isPlainObject(definition)) {
4797 definition.name = definition.name || id;
4798 definition = this.options._base.extend(definition);
4799 }
4800 if (type === 'directive' && typeof definition === 'function') {
4801 definition = { bind: definition, update: definition };
4802 }
4803 this.options[type + 's'][id] = definition;
4804 return definition
4805 }
4806 };
4807 });
4808}
4809
4810/* */
4811
4812function getComponentName (opts) {
4813 return opts && (opts.Ctor.options.name || opts.tag)
4814}
4815
4816function matches (pattern, name) {
4817 if (Array.isArray(pattern)) {
4818 return pattern.indexOf(name) > -1
4819 } else if (typeof pattern === 'string') {
4820 return pattern.split(',').indexOf(name) > -1
4821 } else if (isRegExp(pattern)) {
4822 return pattern.test(name)
4823 }
4824 /* istanbul ignore next */
4825 return false
4826}
4827
4828function pruneCache (keepAliveInstance, filter) {
4829 var cache = keepAliveInstance.cache;
4830 var keys = keepAliveInstance.keys;
4831 var _vnode = keepAliveInstance._vnode;
4832 for (var key in cache) {
4833 var cachedNode = cache[key];
4834 if (cachedNode) {
4835 var name = getComponentName(cachedNode.componentOptions);
4836 if (name && !filter(name)) {
4837 pruneCacheEntry(cache, key, keys, _vnode);
4838 }
4839 }
4840 }
4841}
4842
4843function pruneCacheEntry (
4844 cache,
4845 key,
4846 keys,
4847 current
4848) {
4849 var cached$$1 = cache[key];
4850 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
4851 cached$$1.componentInstance.$destroy();
4852 }
4853 cache[key] = null;
4854 remove(keys, key);
4855}
4856
4857var patternTypes = [String, RegExp, Array];
4858
4859var KeepAlive = {
4860 name: 'keep-alive',
4861 abstract: true,
4862
4863 props: {
4864 include: patternTypes,
4865 exclude: patternTypes,
4866 max: [String, Number]
4867 },
4868
4869 created: function created () {
4870 this.cache = Object.create(null);
4871 this.keys = [];
4872 },
4873
4874 destroyed: function destroyed () {
4875 var this$1 = this;
4876
4877 for (var key in this$1.cache) {
4878 pruneCacheEntry(this$1.cache, key, this$1.keys);
4879 }
4880 },
4881
4882 watch: {
4883 include: function include (val) {
4884 pruneCache(this, function (name) { return matches(val, name); });
4885 },
4886 exclude: function exclude (val) {
4887 pruneCache(this, function (name) { return !matches(val, name); });
4888 }
4889 },
4890
4891 render: function render () {
4892 var slot = this.$slots.default;
4893 var vnode = getFirstComponentChild(slot);
4894 var componentOptions = vnode && vnode.componentOptions;
4895 if (componentOptions) {
4896 // check pattern
4897 var name = getComponentName(componentOptions);
4898 var ref = this;
4899 var include = ref.include;
4900 var exclude = ref.exclude;
4901 if (
4902 // not included
4903 (include && (!name || !matches(include, name))) ||
4904 // excluded
4905 (exclude && name && matches(exclude, name))
4906 ) {
4907 return vnode
4908 }
4909
4910 var ref$1 = this;
4911 var cache = ref$1.cache;
4912 var keys = ref$1.keys;
4913 var key = vnode.key == null
4914 // same constructor may get registered as different local components
4915 // so cid alone is not enough (#3269)
4916 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
4917 : vnode.key;
4918 if (cache[key]) {
4919 vnode.componentInstance = cache[key].componentInstance;
4920 // make current key freshest
4921 remove(keys, key);
4922 keys.push(key);
4923 } else {
4924 cache[key] = vnode;
4925 keys.push(key);
4926 // prune oldest entry
4927 if (this.max && keys.length > parseInt(this.max)) {
4928 pruneCacheEntry(cache, keys[0], keys, this._vnode);
4929 }
4930 }
4931
4932 vnode.data.keepAlive = true;
4933 }
4934 return vnode || (slot && slot[0])
4935 }
4936};
4937
4938var builtInComponents = {
4939 KeepAlive: KeepAlive
4940};
4941
4942/* */
4943
4944function initGlobalAPI (Vue) {
4945 // config
4946 var configDef = {};
4947 configDef.get = function () { return config; };
4948 {
4949 configDef.set = function () {
4950 warn(
4951 'Do not replace the Vue.config object, set individual fields instead.'
4952 );
4953 };
4954 }
4955 Object.defineProperty(Vue, 'config', configDef);
4956
4957 // exposed util methods.
4958 // NOTE: these are not considered part of the public API - avoid relying on
4959 // them unless you are aware of the risk.
4960 Vue.util = {
4961 warn: warn,
4962 extend: extend,
4963 mergeOptions: mergeOptions,
4964 defineReactive: defineReactive
4965 };
4966
4967 Vue.set = set;
4968 Vue.delete = del;
4969 Vue.nextTick = nextTick;
4970
4971 Vue.options = Object.create(null);
4972 ASSET_TYPES.forEach(function (type) {
4973 Vue.options[type + 's'] = Object.create(null);
4974 });
4975
4976 // this is used to identify the "base" constructor to extend all plain-object
4977 // components with in Weex's multi-instance scenarios.
4978 Vue.options._base = Vue;
4979
4980 extend(Vue.options.components, builtInComponents);
4981
4982 initUse(Vue);
4983 initMixin$1(Vue);
4984 initExtend(Vue);
4985 initAssetRegisters(Vue);
4986}
4987
4988initGlobalAPI(Vue$3);
4989
4990Object.defineProperty(Vue$3.prototype, '$isServer', {
4991 get: isServerRendering
4992});
4993
4994Object.defineProperty(Vue$3.prototype, '$ssrContext', {
4995 get: function get () {
4996 /* istanbul ignore next */
4997 return this.$vnode && this.$vnode.ssrContext
4998 }
4999});
5000
5001Vue$3.version = '2.5.13';
5002
5003/* */
5004
5005// these are reserved for web because they are directly compiled away
5006// during template compilation
5007var isReservedAttr = makeMap('style,class');
5008
5009// attributes that should be using props for binding
5010var acceptValue = makeMap('input,textarea,option,select,progress');
5011var mustUseProp = function (tag, type, attr) {
5012 return (
5013 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5014 (attr === 'selected' && tag === 'option') ||
5015 (attr === 'checked' && tag === 'input') ||
5016 (attr === 'muted' && tag === 'video')
5017 )
5018};
5019
5020var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5021
5022var isBooleanAttr = makeMap(
5023 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5024 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5025 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5026 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5027 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5028 'truespeed,typemustmatch,visible'
5029);
5030
5031var xlinkNS = 'http://www.w3.org/1999/xlink';
5032
5033var isXlink = function (name) {
5034 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5035};
5036
5037var getXlinkProp = function (name) {
5038 return isXlink(name) ? name.slice(6, name.length) : ''
5039};
5040
5041var isFalsyAttrValue = function (val) {
5042 return val == null || val === false
5043};
5044
5045/* */
5046
5047function genClassForVnode (vnode) {
5048 var data = vnode.data;
5049 var parentNode = vnode;
5050 var childNode = vnode;
5051 while (isDef(childNode.componentInstance)) {
5052 childNode = childNode.componentInstance._vnode;
5053 if (childNode && childNode.data) {
5054 data = mergeClassData(childNode.data, data);
5055 }
5056 }
5057 while (isDef(parentNode = parentNode.parent)) {
5058 if (parentNode && parentNode.data) {
5059 data = mergeClassData(data, parentNode.data);
5060 }
5061 }
5062 return renderClass(data.staticClass, data.class)
5063}
5064
5065function mergeClassData (child, parent) {
5066 return {
5067 staticClass: concat(child.staticClass, parent.staticClass),
5068 class: isDef(child.class)
5069 ? [child.class, parent.class]
5070 : parent.class
5071 }
5072}
5073
5074function renderClass (
5075 staticClass,
5076 dynamicClass
5077) {
5078 if (isDef(staticClass) || isDef(dynamicClass)) {
5079 return concat(staticClass, stringifyClass(dynamicClass))
5080 }
5081 /* istanbul ignore next */
5082 return ''
5083}
5084
5085function concat (a, b) {
5086 return a ? b ? (a + ' ' + b) : a : (b || '')
5087}
5088
5089function stringifyClass (value) {
5090 if (Array.isArray(value)) {
5091 return stringifyArray(value)
5092 }
5093 if (isObject(value)) {
5094 return stringifyObject(value)
5095 }
5096 if (typeof value === 'string') {
5097 return value
5098 }
5099 /* istanbul ignore next */
5100 return ''
5101}
5102
5103function stringifyArray (value) {
5104 var res = '';
5105 var stringified;
5106 for (var i = 0, l = value.length; i < l; i++) {
5107 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5108 if (res) { res += ' '; }
5109 res += stringified;
5110 }
5111 }
5112 return res
5113}
5114
5115function stringifyObject (value) {
5116 var res = '';
5117 for (var key in value) {
5118 if (value[key]) {
5119 if (res) { res += ' '; }
5120 res += key;
5121 }
5122 }
5123 return res
5124}
5125
5126/* */
5127
5128var namespaceMap = {
5129 svg: 'http://www.w3.org/2000/svg',
5130 math: 'http://www.w3.org/1998/Math/MathML'
5131};
5132
5133var isHTMLTag = makeMap(
5134 'html,body,base,head,link,meta,style,title,' +
5135 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5136 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5137 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5138 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5139 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5140 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5141 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5142 'output,progress,select,textarea,' +
5143 'details,dialog,menu,menuitem,summary,' +
5144 'content,element,shadow,template,blockquote,iframe,tfoot'
5145);
5146
5147// this map is intentionally selective, only covering SVG elements that may
5148// contain child elements.
5149var isSVG = makeMap(
5150 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5151 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5152 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5153 true
5154);
5155
5156var isPreTag = function (tag) { return tag === 'pre'; };
5157
5158var isReservedTag = function (tag) {
5159 return isHTMLTag(tag) || isSVG(tag)
5160};
5161
5162function getTagNamespace (tag) {
5163 if (isSVG(tag)) {
5164 return 'svg'
5165 }
5166 // basic support for MathML
5167 // note it doesn't support other MathML elements being component roots
5168 if (tag === 'math') {
5169 return 'math'
5170 }
5171}
5172
5173var unknownElementCache = Object.create(null);
5174function isUnknownElement (tag) {
5175 /* istanbul ignore if */
5176 if (!inBrowser) {
5177 return true
5178 }
5179 if (isReservedTag(tag)) {
5180 return false
5181 }
5182 tag = tag.toLowerCase();
5183 /* istanbul ignore if */
5184 if (unknownElementCache[tag] != null) {
5185 return unknownElementCache[tag]
5186 }
5187 var el = document.createElement(tag);
5188 if (tag.indexOf('-') > -1) {
5189 // http://stackoverflow.com/a/28210364/1070244
5190 return (unknownElementCache[tag] = (
5191 el.constructor === window.HTMLUnknownElement ||
5192 el.constructor === window.HTMLElement
5193 ))
5194 } else {
5195 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5196 }
5197}
5198
5199var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5200
5201/* */
5202
5203/**
5204 * Query an element selector if it's not an element already.
5205 */
5206function query (el) {
5207 if (typeof el === 'string') {
5208 var selected = document.querySelector(el);
5209 if (!selected) {
5210 "development" !== 'production' && warn(
5211 'Cannot find element: ' + el
5212 );
5213 return document.createElement('div')
5214 }
5215 return selected
5216 } else {
5217 return el
5218 }
5219}
5220
5221/* */
5222
5223function createElement$1 (tagName, vnode) {
5224 var elm = document.createElement(tagName);
5225 if (tagName !== 'select') {
5226 return elm
5227 }
5228 // false or null will remove the attribute but undefined will not
5229 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5230 elm.setAttribute('multiple', 'multiple');
5231 }
5232 return elm
5233}
5234
5235function createElementNS (namespace, tagName) {
5236 return document.createElementNS(namespaceMap[namespace], tagName)
5237}
5238
5239function createTextNode (text) {
5240 return document.createTextNode(text)
5241}
5242
5243function createComment (text) {
5244 return document.createComment(text)
5245}
5246
5247function insertBefore (parentNode, newNode, referenceNode) {
5248 parentNode.insertBefore(newNode, referenceNode);
5249}
5250
5251function removeChild (node, child) {
5252 node.removeChild(child);
5253}
5254
5255function appendChild (node, child) {
5256 node.appendChild(child);
5257}
5258
5259function parentNode (node) {
5260 return node.parentNode
5261}
5262
5263function nextSibling (node) {
5264 return node.nextSibling
5265}
5266
5267function tagName (node) {
5268 return node.tagName
5269}
5270
5271function setTextContent (node, text) {
5272 node.textContent = text;
5273}
5274
5275function setAttribute (node, key, val) {
5276 node.setAttribute(key, val);
5277}
5278
5279
5280var nodeOps = Object.freeze({
5281 createElement: createElement$1,
5282 createElementNS: createElementNS,
5283 createTextNode: createTextNode,
5284 createComment: createComment,
5285 insertBefore: insertBefore,
5286 removeChild: removeChild,
5287 appendChild: appendChild,
5288 parentNode: parentNode,
5289 nextSibling: nextSibling,
5290 tagName: tagName,
5291 setTextContent: setTextContent,
5292 setAttribute: setAttribute
5293});
5294
5295/* */
5296
5297var ref = {
5298 create: function create (_, vnode) {
5299 registerRef(vnode);
5300 },
5301 update: function update (oldVnode, vnode) {
5302 if (oldVnode.data.ref !== vnode.data.ref) {
5303 registerRef(oldVnode, true);
5304 registerRef(vnode);
5305 }
5306 },
5307 destroy: function destroy (vnode) {
5308 registerRef(vnode, true);
5309 }
5310};
5311
5312function registerRef (vnode, isRemoval) {
5313 var key = vnode.data.ref;
5314 if (!key) { return }
5315
5316 var vm = vnode.context;
5317 var ref = vnode.componentInstance || vnode.elm;
5318 var refs = vm.$refs;
5319 if (isRemoval) {
5320 if (Array.isArray(refs[key])) {
5321 remove(refs[key], ref);
5322 } else if (refs[key] === ref) {
5323 refs[key] = undefined;
5324 }
5325 } else {
5326 if (vnode.data.refInFor) {
5327 if (!Array.isArray(refs[key])) {
5328 refs[key] = [ref];
5329 } else if (refs[key].indexOf(ref) < 0) {
5330 // $flow-disable-line
5331 refs[key].push(ref);
5332 }
5333 } else {
5334 refs[key] = ref;
5335 }
5336 }
5337}
5338
5339/**
5340 * Virtual DOM patching algorithm based on Snabbdom by
5341 * Simon Friis Vindum (@paldepind)
5342 * Licensed under the MIT License
5343 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5344 *
5345 * modified by Evan You (@yyx990803)
5346 *
5347 * Not type-checking this because this file is perf-critical and the cost
5348 * of making flow understand it is not worth it.
5349 */
5350
5351var emptyNode = new VNode('', {}, []);
5352
5353var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5354
5355function sameVnode (a, b) {
5356 return (
5357 a.key === b.key && (
5358 (
5359 a.tag === b.tag &&
5360 a.isComment === b.isComment &&
5361 isDef(a.data) === isDef(b.data) &&
5362 sameInputType(a, b)
5363 ) || (
5364 isTrue(a.isAsyncPlaceholder) &&
5365 a.asyncFactory === b.asyncFactory &&
5366 isUndef(b.asyncFactory.error)
5367 )
5368 )
5369 )
5370}
5371
5372function sameInputType (a, b) {
5373 if (a.tag !== 'input') { return true }
5374 var i;
5375 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5376 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5377 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5378}
5379
5380function createKeyToOldIdx (children, beginIdx, endIdx) {
5381 var i, key;
5382 var map = {};
5383 for (i = beginIdx; i <= endIdx; ++i) {
5384 key = children[i].key;
5385 if (isDef(key)) { map[key] = i; }
5386 }
5387 return map
5388}
5389
5390function createPatchFunction (backend) {
5391 var i, j;
5392 var cbs = {};
5393
5394 var modules = backend.modules;
5395 var nodeOps = backend.nodeOps;
5396
5397 for (i = 0; i < hooks.length; ++i) {
5398 cbs[hooks[i]] = [];
5399 for (j = 0; j < modules.length; ++j) {
5400 if (isDef(modules[j][hooks[i]])) {
5401 cbs[hooks[i]].push(modules[j][hooks[i]]);
5402 }
5403 }
5404 }
5405
5406 function emptyNodeAt (elm) {
5407 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5408 }
5409
5410 function createRmCb (childElm, listeners) {
5411 function remove () {
5412 if (--remove.listeners === 0) {
5413 removeNode(childElm);
5414 }
5415 }
5416 remove.listeners = listeners;
5417 return remove
5418 }
5419
5420 function removeNode (el) {
5421 var parent = nodeOps.parentNode(el);
5422 // element may have already been removed due to v-html / v-text
5423 if (isDef(parent)) {
5424 nodeOps.removeChild(parent, el);
5425 }
5426 }
5427
5428 function isUnknownElement$$1 (vnode, inVPre) {
5429 return (
5430 !inVPre &&
5431 !vnode.ns &&
5432 !(
5433 config.ignoredElements.length &&
5434 config.ignoredElements.some(function (ignore) {
5435 return isRegExp(ignore)
5436 ? ignore.test(vnode.tag)
5437 : ignore === vnode.tag
5438 })
5439 ) &&
5440 config.isUnknownElement(vnode.tag)
5441 )
5442 }
5443
5444 var creatingElmInVPre = 0;
5445 function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
5446 vnode.isRootInsert = !nested; // for transition enter check
5447 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5448 return
5449 }
5450
5451 var data = vnode.data;
5452 var children = vnode.children;
5453 var tag = vnode.tag;
5454 if (isDef(tag)) {
5455 {
5456 if (data && data.pre) {
5457 creatingElmInVPre++;
5458 }
5459 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5460 warn(
5461 'Unknown custom element: <' + tag + '> - did you ' +
5462 'register the component correctly? For recursive components, ' +
5463 'make sure to provide the "name" option.',
5464 vnode.context
5465 );
5466 }
5467 }
5468 vnode.elm = vnode.ns
5469 ? nodeOps.createElementNS(vnode.ns, tag)
5470 : nodeOps.createElement(tag, vnode);
5471 setScope(vnode);
5472
5473 /* istanbul ignore if */
5474 {
5475 createChildren(vnode, children, insertedVnodeQueue);
5476 if (isDef(data)) {
5477 invokeCreateHooks(vnode, insertedVnodeQueue);
5478 }
5479 insert(parentElm, vnode.elm, refElm);
5480 }
5481
5482 if ("development" !== 'production' && data && data.pre) {
5483 creatingElmInVPre--;
5484 }
5485 } else if (isTrue(vnode.isComment)) {
5486 vnode.elm = nodeOps.createComment(vnode.text);
5487 insert(parentElm, vnode.elm, refElm);
5488 } else {
5489 vnode.elm = nodeOps.createTextNode(vnode.text);
5490 insert(parentElm, vnode.elm, refElm);
5491 }
5492 }
5493
5494 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5495 var i = vnode.data;
5496 if (isDef(i)) {
5497 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5498 if (isDef(i = i.hook) && isDef(i = i.init)) {
5499 i(vnode, false /* hydrating */, parentElm, refElm);
5500 }
5501 // after calling the init hook, if the vnode is a child component
5502 // it should've created a child instance and mounted it. the child
5503 // component also has set the placeholder vnode's elm.
5504 // in that case we can just return the element and be done.
5505 if (isDef(vnode.componentInstance)) {
5506 initComponent(vnode, insertedVnodeQueue);
5507 if (isTrue(isReactivated)) {
5508 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5509 }
5510 return true
5511 }
5512 }
5513 }
5514
5515 function initComponent (vnode, insertedVnodeQueue) {
5516 if (isDef(vnode.data.pendingInsert)) {
5517 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5518 vnode.data.pendingInsert = null;
5519 }
5520 vnode.elm = vnode.componentInstance.$el;
5521 if (isPatchable(vnode)) {
5522 invokeCreateHooks(vnode, insertedVnodeQueue);
5523 setScope(vnode);
5524 } else {
5525 // empty component root.
5526 // skip all element-related modules except for ref (#3455)
5527 registerRef(vnode);
5528 // make sure to invoke the insert hook
5529 insertedVnodeQueue.push(vnode);
5530 }
5531 }
5532
5533 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5534 var i;
5535 // hack for #4339: a reactivated component with inner transition
5536 // does not trigger because the inner node's created hooks are not called
5537 // again. It's not ideal to involve module-specific logic in here but
5538 // there doesn't seem to be a better way to do it.
5539 var innerNode = vnode;
5540 while (innerNode.componentInstance) {
5541 innerNode = innerNode.componentInstance._vnode;
5542 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
5543 for (i = 0; i < cbs.activate.length; ++i) {
5544 cbs.activate[i](emptyNode, innerNode);
5545 }
5546 insertedVnodeQueue.push(innerNode);
5547 break
5548 }
5549 }
5550 // unlike a newly created component,
5551 // a reactivated keep-alive component doesn't insert itself
5552 insert(parentElm, vnode.elm, refElm);
5553 }
5554
5555 function insert (parent, elm, ref$$1) {
5556 if (isDef(parent)) {
5557 if (isDef(ref$$1)) {
5558 if (ref$$1.parentNode === parent) {
5559 nodeOps.insertBefore(parent, elm, ref$$1);
5560 }
5561 } else {
5562 nodeOps.appendChild(parent, elm);
5563 }
5564 }
5565 }
5566
5567 function createChildren (vnode, children, insertedVnodeQueue) {
5568 if (Array.isArray(children)) {
5569 {
5570 checkDuplicateKeys(children);
5571 }
5572 for (var i = 0; i < children.length; ++i) {
5573 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
5574 }
5575 } else if (isPrimitive(vnode.text)) {
5576 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
5577 }
5578 }
5579
5580 function isPatchable (vnode) {
5581 while (vnode.componentInstance) {
5582 vnode = vnode.componentInstance._vnode;
5583 }
5584 return isDef(vnode.tag)
5585 }
5586
5587 function invokeCreateHooks (vnode, insertedVnodeQueue) {
5588 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
5589 cbs.create[i$1](emptyNode, vnode);
5590 }
5591 i = vnode.data.hook; // Reuse variable
5592 if (isDef(i)) {
5593 if (isDef(i.create)) { i.create(emptyNode, vnode); }
5594 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
5595 }
5596 }
5597
5598 // set scope id attribute for scoped CSS.
5599 // this is implemented as a special case to avoid the overhead
5600 // of going through the normal attribute patching process.
5601 function setScope (vnode) {
5602 var i;
5603 if (isDef(i = vnode.fnScopeId)) {
5604 nodeOps.setAttribute(vnode.elm, i, '');
5605 } else {
5606 var ancestor = vnode;
5607 while (ancestor) {
5608 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
5609 nodeOps.setAttribute(vnode.elm, i, '');
5610 }
5611 ancestor = ancestor.parent;
5612 }
5613 }
5614 // for slot content they should also get the scopeId from the host instance.
5615 if (isDef(i = activeInstance) &&
5616 i !== vnode.context &&
5617 i !== vnode.fnContext &&
5618 isDef(i = i.$options._scopeId)
5619 ) {
5620 nodeOps.setAttribute(vnode.elm, i, '');
5621 }
5622 }
5623
5624 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
5625 for (; startIdx <= endIdx; ++startIdx) {
5626 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
5627 }
5628 }
5629
5630 function invokeDestroyHook (vnode) {
5631 var i, j;
5632 var data = vnode.data;
5633 if (isDef(data)) {
5634 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
5635 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
5636 }
5637 if (isDef(i = vnode.children)) {
5638 for (j = 0; j < vnode.children.length; ++j) {
5639 invokeDestroyHook(vnode.children[j]);
5640 }
5641 }
5642 }
5643
5644 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
5645 for (; startIdx <= endIdx; ++startIdx) {
5646 var ch = vnodes[startIdx];
5647 if (isDef(ch)) {
5648 if (isDef(ch.tag)) {
5649 removeAndInvokeRemoveHook(ch);
5650 invokeDestroyHook(ch);
5651 } else { // Text node
5652 removeNode(ch.elm);
5653 }
5654 }
5655 }
5656 }
5657
5658 function removeAndInvokeRemoveHook (vnode, rm) {
5659 if (isDef(rm) || isDef(vnode.data)) {
5660 var i;
5661 var listeners = cbs.remove.length + 1;
5662 if (isDef(rm)) {
5663 // we have a recursively passed down rm callback
5664 // increase the listeners count
5665 rm.listeners += listeners;
5666 } else {
5667 // directly removing
5668 rm = createRmCb(vnode.elm, listeners);
5669 }
5670 // recursively invoke hooks on child component root node
5671 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
5672 removeAndInvokeRemoveHook(i, rm);
5673 }
5674 for (i = 0; i < cbs.remove.length; ++i) {
5675 cbs.remove[i](vnode, rm);
5676 }
5677 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
5678 i(vnode, rm);
5679 } else {
5680 rm();
5681 }
5682 } else {
5683 removeNode(vnode.elm);
5684 }
5685 }
5686
5687 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
5688 var oldStartIdx = 0;
5689 var newStartIdx = 0;
5690 var oldEndIdx = oldCh.length - 1;
5691 var oldStartVnode = oldCh[0];
5692 var oldEndVnode = oldCh[oldEndIdx];
5693 var newEndIdx = newCh.length - 1;
5694 var newStartVnode = newCh[0];
5695 var newEndVnode = newCh[newEndIdx];
5696 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
5697
5698 // removeOnly is a special flag used only by <transition-group>
5699 // to ensure removed elements stay in correct relative positions
5700 // during leaving transitions
5701 var canMove = !removeOnly;
5702
5703 {
5704 checkDuplicateKeys(newCh);
5705 }
5706
5707 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
5708 if (isUndef(oldStartVnode)) {
5709 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
5710 } else if (isUndef(oldEndVnode)) {
5711 oldEndVnode = oldCh[--oldEndIdx];
5712 } else if (sameVnode(oldStartVnode, newStartVnode)) {
5713 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
5714 oldStartVnode = oldCh[++oldStartIdx];
5715 newStartVnode = newCh[++newStartIdx];
5716 } else if (sameVnode(oldEndVnode, newEndVnode)) {
5717 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
5718 oldEndVnode = oldCh[--oldEndIdx];
5719 newEndVnode = newCh[--newEndIdx];
5720 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
5721 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
5722 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
5723 oldStartVnode = oldCh[++oldStartIdx];
5724 newEndVnode = newCh[--newEndIdx];
5725 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
5726 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
5727 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
5728 oldEndVnode = oldCh[--oldEndIdx];
5729 newStartVnode = newCh[++newStartIdx];
5730 } else {
5731 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
5732 idxInOld = isDef(newStartVnode.key)
5733 ? oldKeyToIdx[newStartVnode.key]
5734 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
5735 if (isUndef(idxInOld)) { // New element
5736 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
5737 } else {
5738 vnodeToMove = oldCh[idxInOld];
5739 if (sameVnode(vnodeToMove, newStartVnode)) {
5740 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
5741 oldCh[idxInOld] = undefined;
5742 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
5743 } else {
5744 // same key but different element. treat as new element
5745 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
5746 }
5747 }
5748 newStartVnode = newCh[++newStartIdx];
5749 }
5750 }
5751 if (oldStartIdx > oldEndIdx) {
5752 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
5753 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
5754 } else if (newStartIdx > newEndIdx) {
5755 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
5756 }
5757 }
5758
5759 function checkDuplicateKeys (children) {
5760 var seenKeys = {};
5761 for (var i = 0; i < children.length; i++) {
5762 var vnode = children[i];
5763 var key = vnode.key;
5764 if (isDef(key)) {
5765 if (seenKeys[key]) {
5766 warn(
5767 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
5768 vnode.context
5769 );
5770 } else {
5771 seenKeys[key] = true;
5772 }
5773 }
5774 }
5775 }
5776
5777 function findIdxInOld (node, oldCh, start, end) {
5778 for (var i = start; i < end; i++) {
5779 var c = oldCh[i];
5780 if (isDef(c) && sameVnode(node, c)) { return i }
5781 }
5782 }
5783
5784 function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
5785 if (oldVnode === vnode) {
5786 return
5787 }
5788
5789 var elm = vnode.elm = oldVnode.elm;
5790
5791 if (isTrue(oldVnode.isAsyncPlaceholder)) {
5792 if (isDef(vnode.asyncFactory.resolved)) {
5793 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
5794 } else {
5795 vnode.isAsyncPlaceholder = true;
5796 }
5797 return
5798 }
5799
5800 // reuse element for static trees.
5801 // note we only do this if the vnode is cloned -
5802 // if the new node is not cloned it means the render functions have been
5803 // reset by the hot-reload-api and we need to do a proper re-render.
5804 if (isTrue(vnode.isStatic) &&
5805 isTrue(oldVnode.isStatic) &&
5806 vnode.key === oldVnode.key &&
5807 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
5808 ) {
5809 vnode.componentInstance = oldVnode.componentInstance;
5810 return
5811 }
5812
5813 var i;
5814 var data = vnode.data;
5815 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
5816 i(oldVnode, vnode);
5817 }
5818
5819 var oldCh = oldVnode.children;
5820 var ch = vnode.children;
5821 if (isDef(data) && isPatchable(vnode)) {
5822 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
5823 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
5824 }
5825 if (isUndef(vnode.text)) {
5826 if (isDef(oldCh) && isDef(ch)) {
5827 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
5828 } else if (isDef(ch)) {
5829 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
5830 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
5831 } else if (isDef(oldCh)) {
5832 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
5833 } else if (isDef(oldVnode.text)) {
5834 nodeOps.setTextContent(elm, '');
5835 }
5836 } else if (oldVnode.text !== vnode.text) {
5837 nodeOps.setTextContent(elm, vnode.text);
5838 }
5839 if (isDef(data)) {
5840 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
5841 }
5842 }
5843
5844 function invokeInsertHook (vnode, queue, initial) {
5845 // delay insert hooks for component root nodes, invoke them after the
5846 // element is really inserted
5847 if (isTrue(initial) && isDef(vnode.parent)) {
5848 vnode.parent.data.pendingInsert = queue;
5849 } else {
5850 for (var i = 0; i < queue.length; ++i) {
5851 queue[i].data.hook.insert(queue[i]);
5852 }
5853 }
5854 }
5855
5856 var hydrationBailed = false;
5857 // list of modules that can skip create hook during hydration because they
5858 // are already rendered on the client or has no need for initialization
5859 // Note: style is excluded because it relies on initial clone for future
5860 // deep updates (#7063).
5861 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
5862
5863 // Note: this is a browser-only function so we can assume elms are DOM nodes.
5864 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
5865 var i;
5866 var tag = vnode.tag;
5867 var data = vnode.data;
5868 var children = vnode.children;
5869 inVPre = inVPre || (data && data.pre);
5870 vnode.elm = elm;
5871
5872 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
5873 vnode.isAsyncPlaceholder = true;
5874 return true
5875 }
5876 // assert node match
5877 {
5878 if (!assertNodeMatch(elm, vnode, inVPre)) {
5879 return false
5880 }
5881 }
5882 if (isDef(data)) {
5883 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
5884 if (isDef(i = vnode.componentInstance)) {
5885 // child component. it should have hydrated its own tree.
5886 initComponent(vnode, insertedVnodeQueue);
5887 return true
5888 }
5889 }
5890 if (isDef(tag)) {
5891 if (isDef(children)) {
5892 // empty element, allow client to pick up and populate children
5893 if (!elm.hasChildNodes()) {
5894 createChildren(vnode, children, insertedVnodeQueue);
5895 } else {
5896 // v-html and domProps: innerHTML
5897 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
5898 if (i !== elm.innerHTML) {
5899 /* istanbul ignore if */
5900 if ("development" !== 'production' &&
5901 typeof console !== 'undefined' &&
5902 !hydrationBailed
5903 ) {
5904 hydrationBailed = true;
5905 console.warn('Parent: ', elm);
5906 console.warn('server innerHTML: ', i);
5907 console.warn('client innerHTML: ', elm.innerHTML);
5908 }
5909 return false
5910 }
5911 } else {
5912 // iterate and compare children lists
5913 var childrenMatch = true;
5914 var childNode = elm.firstChild;
5915 for (var i$1 = 0; i$1 < children.length; i$1++) {
5916 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
5917 childrenMatch = false;
5918 break
5919 }
5920 childNode = childNode.nextSibling;
5921 }
5922 // if childNode is not null, it means the actual childNodes list is
5923 // longer than the virtual children list.
5924 if (!childrenMatch || childNode) {
5925 /* istanbul ignore if */
5926 if ("development" !== 'production' &&
5927 typeof console !== 'undefined' &&
5928 !hydrationBailed
5929 ) {
5930 hydrationBailed = true;
5931 console.warn('Parent: ', elm);
5932 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
5933 }
5934 return false
5935 }
5936 }
5937 }
5938 }
5939 if (isDef(data)) {
5940 var fullInvoke = false;
5941 for (var key in data) {
5942 if (!isRenderedModule(key)) {
5943 fullInvoke = true;
5944 invokeCreateHooks(vnode, insertedVnodeQueue);
5945 break
5946 }
5947 }
5948 if (!fullInvoke && data['class']) {
5949 // ensure collecting deps for deep class bindings for future updates
5950 traverse(data['class']);
5951 }
5952 }
5953 } else if (elm.data !== vnode.text) {
5954 elm.data = vnode.text;
5955 }
5956 return true
5957 }
5958
5959 function assertNodeMatch (node, vnode, inVPre) {
5960 if (isDef(vnode.tag)) {
5961 return vnode.tag.indexOf('vue-component') === 0 || (
5962 !isUnknownElement$$1(vnode, inVPre) &&
5963 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
5964 )
5965 } else {
5966 return node.nodeType === (vnode.isComment ? 8 : 3)
5967 }
5968 }
5969
5970 return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
5971 if (isUndef(vnode)) {
5972 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
5973 return
5974 }
5975
5976 var isInitialPatch = false;
5977 var insertedVnodeQueue = [];
5978
5979 if (isUndef(oldVnode)) {
5980 // empty mount (likely as component), create new root element
5981 isInitialPatch = true;
5982 createElm(vnode, insertedVnodeQueue, parentElm, refElm);
5983 } else {
5984 var isRealElement = isDef(oldVnode.nodeType);
5985 if (!isRealElement && sameVnode(oldVnode, vnode)) {
5986 // patch existing root node
5987 patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
5988 } else {
5989 if (isRealElement) {
5990 // mounting to a real element
5991 // check if this is server-rendered content and if we can perform
5992 // a successful hydration.
5993 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
5994 oldVnode.removeAttribute(SSR_ATTR);
5995 hydrating = true;
5996 }
5997 if (isTrue(hydrating)) {
5998 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
5999 invokeInsertHook(vnode, insertedVnodeQueue, true);
6000 return oldVnode
6001 } else {
6002 warn(
6003 'The client-side rendered virtual DOM tree is not matching ' +
6004 'server-rendered content. This is likely caused by incorrect ' +
6005 'HTML markup, for example nesting block-level elements inside ' +
6006 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6007 'full client-side render.'
6008 );
6009 }
6010 }
6011 // either not server-rendered, or hydration failed.
6012 // create an empty node and replace it
6013 oldVnode = emptyNodeAt(oldVnode);
6014 }
6015
6016 // replacing existing element
6017 var oldElm = oldVnode.elm;
6018 var parentElm$1 = nodeOps.parentNode(oldElm);
6019
6020 // create new node
6021 createElm(
6022 vnode,
6023 insertedVnodeQueue,
6024 // extremely rare edge case: do not insert if old element is in a
6025 // leaving transition. Only happens when combining transition +
6026 // keep-alive + HOCs. (#4590)
6027 oldElm._leaveCb ? null : parentElm$1,
6028 nodeOps.nextSibling(oldElm)
6029 );
6030
6031 // update parent placeholder node element, recursively
6032 if (isDef(vnode.parent)) {
6033 var ancestor = vnode.parent;
6034 var patchable = isPatchable(vnode);
6035 while (ancestor) {
6036 for (var i = 0; i < cbs.destroy.length; ++i) {
6037 cbs.destroy[i](ancestor);
6038 }
6039 ancestor.elm = vnode.elm;
6040 if (patchable) {
6041 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6042 cbs.create[i$1](emptyNode, ancestor);
6043 }
6044 // #6513
6045 // invoke insert hooks that may have been merged by create hooks.
6046 // e.g. for directives that uses the "inserted" hook.
6047 var insert = ancestor.data.hook.insert;
6048 if (insert.merged) {
6049 // start at index 1 to avoid re-invoking component mounted hook
6050 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6051 insert.fns[i$2]();
6052 }
6053 }
6054 } else {
6055 registerRef(ancestor);
6056 }
6057 ancestor = ancestor.parent;
6058 }
6059 }
6060
6061 // destroy old node
6062 if (isDef(parentElm$1)) {
6063 removeVnodes(parentElm$1, [oldVnode], 0, 0);
6064 } else if (isDef(oldVnode.tag)) {
6065 invokeDestroyHook(oldVnode);
6066 }
6067 }
6068 }
6069
6070 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6071 return vnode.elm
6072 }
6073}
6074
6075/* */
6076
6077var directives = {
6078 create: updateDirectives,
6079 update: updateDirectives,
6080 destroy: function unbindDirectives (vnode) {
6081 updateDirectives(vnode, emptyNode);
6082 }
6083};
6084
6085function updateDirectives (oldVnode, vnode) {
6086 if (oldVnode.data.directives || vnode.data.directives) {
6087 _update(oldVnode, vnode);
6088 }
6089}
6090
6091function _update (oldVnode, vnode) {
6092 var isCreate = oldVnode === emptyNode;
6093 var isDestroy = vnode === emptyNode;
6094 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6095 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6096
6097 var dirsWithInsert = [];
6098 var dirsWithPostpatch = [];
6099
6100 var key, oldDir, dir;
6101 for (key in newDirs) {
6102 oldDir = oldDirs[key];
6103 dir = newDirs[key];
6104 if (!oldDir) {
6105 // new directive, bind
6106 callHook$1(dir, 'bind', vnode, oldVnode);
6107 if (dir.def && dir.def.inserted) {
6108 dirsWithInsert.push(dir);
6109 }
6110 } else {
6111 // existing directive, update
6112 dir.oldValue = oldDir.value;
6113 callHook$1(dir, 'update', vnode, oldVnode);
6114 if (dir.def && dir.def.componentUpdated) {
6115 dirsWithPostpatch.push(dir);
6116 }
6117 }
6118 }
6119
6120 if (dirsWithInsert.length) {
6121 var callInsert = function () {
6122 for (var i = 0; i < dirsWithInsert.length; i++) {
6123 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6124 }
6125 };
6126 if (isCreate) {
6127 mergeVNodeHook(vnode, 'insert', callInsert);
6128 } else {
6129 callInsert();
6130 }
6131 }
6132
6133 if (dirsWithPostpatch.length) {
6134 mergeVNodeHook(vnode, 'postpatch', function () {
6135 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6136 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6137 }
6138 });
6139 }
6140
6141 if (!isCreate) {
6142 for (key in oldDirs) {
6143 if (!newDirs[key]) {
6144 // no longer present, unbind
6145 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6146 }
6147 }
6148 }
6149}
6150
6151var emptyModifiers = Object.create(null);
6152
6153function normalizeDirectives$1 (
6154 dirs,
6155 vm
6156) {
6157 var res = Object.create(null);
6158 if (!dirs) {
6159 // $flow-disable-line
6160 return res
6161 }
6162 var i, dir;
6163 for (i = 0; i < dirs.length; i++) {
6164 dir = dirs[i];
6165 if (!dir.modifiers) {
6166 // $flow-disable-line
6167 dir.modifiers = emptyModifiers;
6168 }
6169 res[getRawDirName(dir)] = dir;
6170 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6171 }
6172 // $flow-disable-line
6173 return res
6174}
6175
6176function getRawDirName (dir) {
6177 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6178}
6179
6180function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6181 var fn = dir.def && dir.def[hook];
6182 if (fn) {
6183 try {
6184 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6185 } catch (e) {
6186 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6187 }
6188 }
6189}
6190
6191var baseModules = [
6192 ref,
6193 directives
6194];
6195
6196/* */
6197
6198function updateAttrs (oldVnode, vnode) {
6199 var opts = vnode.componentOptions;
6200 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6201 return
6202 }
6203 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6204 return
6205 }
6206 var key, cur, old;
6207 var elm = vnode.elm;
6208 var oldAttrs = oldVnode.data.attrs || {};
6209 var attrs = vnode.data.attrs || {};
6210 // clone observed objects, as the user probably wants to mutate it
6211 if (isDef(attrs.__ob__)) {
6212 attrs = vnode.data.attrs = extend({}, attrs);
6213 }
6214
6215 for (key in attrs) {
6216 cur = attrs[key];
6217 old = oldAttrs[key];
6218 if (old !== cur) {
6219 setAttr(elm, key, cur);
6220 }
6221 }
6222 // #4391: in IE9, setting type can reset value for input[type=radio]
6223 // #6666: IE/Edge forces progress value down to 1 before setting a max
6224 /* istanbul ignore if */
6225 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6226 setAttr(elm, 'value', attrs.value);
6227 }
6228 for (key in oldAttrs) {
6229 if (isUndef(attrs[key])) {
6230 if (isXlink(key)) {
6231 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6232 } else if (!isEnumeratedAttr(key)) {
6233 elm.removeAttribute(key);
6234 }
6235 }
6236 }
6237}
6238
6239function setAttr (el, key, value) {
6240 if (isBooleanAttr(key)) {
6241 // set attribute for blank value
6242 // e.g. <option disabled>Select one</option>
6243 if (isFalsyAttrValue(value)) {
6244 el.removeAttribute(key);
6245 } else {
6246 // technically allowfullscreen is a boolean attribute for <iframe>,
6247 // but Flash expects a value of "true" when used on <embed> tag
6248 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6249 ? 'true'
6250 : key;
6251 el.setAttribute(key, value);
6252 }
6253 } else if (isEnumeratedAttr(key)) {
6254 el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
6255 } else if (isXlink(key)) {
6256 if (isFalsyAttrValue(value)) {
6257 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6258 } else {
6259 el.setAttributeNS(xlinkNS, key, value);
6260 }
6261 } else {
6262 if (isFalsyAttrValue(value)) {
6263 el.removeAttribute(key);
6264 } else {
6265 // #7138: IE10 & 11 fires input event when setting placeholder on
6266 // <textarea>... block the first input event and remove the blocker
6267 // immediately.
6268 /* istanbul ignore if */
6269 if (
6270 isIE && !isIE9 &&
6271 el.tagName === 'TEXTAREA' &&
6272 key === 'placeholder' && !el.__ieph
6273 ) {
6274 var blocker = function (e) {
6275 e.stopImmediatePropagation();
6276 el.removeEventListener('input', blocker);
6277 };
6278 el.addEventListener('input', blocker);
6279 // $flow-disable-line
6280 el.__ieph = true; /* IE placeholder patched */
6281 }
6282 el.setAttribute(key, value);
6283 }
6284 }
6285}
6286
6287var attrs = {
6288 create: updateAttrs,
6289 update: updateAttrs
6290};
6291
6292/* */
6293
6294function updateClass (oldVnode, vnode) {
6295 var el = vnode.elm;
6296 var data = vnode.data;
6297 var oldData = oldVnode.data;
6298 if (
6299 isUndef(data.staticClass) &&
6300 isUndef(data.class) && (
6301 isUndef(oldData) || (
6302 isUndef(oldData.staticClass) &&
6303 isUndef(oldData.class)
6304 )
6305 )
6306 ) {
6307 return
6308 }
6309
6310 var cls = genClassForVnode(vnode);
6311
6312 // handle transition classes
6313 var transitionClass = el._transitionClasses;
6314 if (isDef(transitionClass)) {
6315 cls = concat(cls, stringifyClass(transitionClass));
6316 }
6317
6318 // set the class
6319 if (cls !== el._prevClass) {
6320 el.setAttribute('class', cls);
6321 el._prevClass = cls;
6322 }
6323}
6324
6325var klass = {
6326 create: updateClass,
6327 update: updateClass
6328};
6329
6330/* */
6331
6332var validDivisionCharRE = /[\w).+\-_$\]]/;
6333
6334function parseFilters (exp) {
6335 var inSingle = false;
6336 var inDouble = false;
6337 var inTemplateString = false;
6338 var inRegex = false;
6339 var curly = 0;
6340 var square = 0;
6341 var paren = 0;
6342 var lastFilterIndex = 0;
6343 var c, prev, i, expression, filters;
6344
6345 for (i = 0; i < exp.length; i++) {
6346 prev = c;
6347 c = exp.charCodeAt(i);
6348 if (inSingle) {
6349 if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
6350 } else if (inDouble) {
6351 if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
6352 } else if (inTemplateString) {
6353 if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
6354 } else if (inRegex) {
6355 if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
6356 } else if (
6357 c === 0x7C && // pipe
6358 exp.charCodeAt(i + 1) !== 0x7C &&
6359 exp.charCodeAt(i - 1) !== 0x7C &&
6360 !curly && !square && !paren
6361 ) {
6362 if (expression === undefined) {
6363 // first filter, end of expression
6364 lastFilterIndex = i + 1;
6365 expression = exp.slice(0, i).trim();
6366 } else {
6367 pushFilter();
6368 }
6369 } else {
6370 switch (c) {
6371 case 0x22: inDouble = true; break // "
6372 case 0x27: inSingle = true; break // '
6373 case 0x60: inTemplateString = true; break // `
6374 case 0x28: paren++; break // (
6375 case 0x29: paren--; break // )
6376 case 0x5B: square++; break // [
6377 case 0x5D: square--; break // ]
6378 case 0x7B: curly++; break // {
6379 case 0x7D: curly--; break // }
6380 }
6381 if (c === 0x2f) { // /
6382 var j = i - 1;
6383 var p = (void 0);
6384 // find first non-whitespace prev char
6385 for (; j >= 0; j--) {
6386 p = exp.charAt(j);
6387 if (p !== ' ') { break }
6388 }
6389 if (!p || !validDivisionCharRE.test(p)) {
6390 inRegex = true;
6391 }
6392 }
6393 }
6394 }
6395
6396 if (expression === undefined) {
6397 expression = exp.slice(0, i).trim();
6398 } else if (lastFilterIndex !== 0) {
6399 pushFilter();
6400 }
6401
6402 function pushFilter () {
6403 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
6404 lastFilterIndex = i + 1;
6405 }
6406
6407 if (filters) {
6408 for (i = 0; i < filters.length; i++) {
6409 expression = wrapFilter(expression, filters[i]);
6410 }
6411 }
6412
6413 return expression
6414}
6415
6416function wrapFilter (exp, filter) {
6417 var i = filter.indexOf('(');
6418 if (i < 0) {
6419 // _f: resolveFilter
6420 return ("_f(\"" + filter + "\")(" + exp + ")")
6421 } else {
6422 var name = filter.slice(0, i);
6423 var args = filter.slice(i + 1);
6424 return ("_f(\"" + name + "\")(" + exp + "," + args)
6425 }
6426}
6427
6428/* */
6429
6430function baseWarn (msg) {
6431 console.error(("[Vue compiler]: " + msg));
6432}
6433
6434function pluckModuleFunction (
6435 modules,
6436 key
6437) {
6438 return modules
6439 ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
6440 : []
6441}
6442
6443function addProp (el, name, value) {
6444 (el.props || (el.props = [])).push({ name: name, value: value });
6445 el.plain = false;
6446}
6447
6448function addAttr (el, name, value) {
6449 (el.attrs || (el.attrs = [])).push({ name: name, value: value });
6450 el.plain = false;
6451}
6452
6453// add a raw attr (use this in preTransforms)
6454function addRawAttr (el, name, value) {
6455 el.attrsMap[name] = value;
6456 el.attrsList.push({ name: name, value: value });
6457}
6458
6459function addDirective (
6460 el,
6461 name,
6462 rawName,
6463 value,
6464 arg,
6465 modifiers
6466) {
6467 (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
6468 el.plain = false;
6469}
6470
6471function addHandler (
6472 el,
6473 name,
6474 value,
6475 modifiers,
6476 important,
6477 warn
6478) {
6479 modifiers = modifiers || emptyObject;
6480 // warn prevent and passive modifier
6481 /* istanbul ignore if */
6482 if (
6483 "development" !== 'production' && warn &&
6484 modifiers.prevent && modifiers.passive
6485 ) {
6486 warn(
6487 'passive and prevent can\'t be used together. ' +
6488 'Passive handler can\'t prevent default event.'
6489 );
6490 }
6491
6492 // check capture modifier
6493 if (modifiers.capture) {
6494 delete modifiers.capture;
6495 name = '!' + name; // mark the event as captured
6496 }
6497 if (modifiers.once) {
6498 delete modifiers.once;
6499 name = '~' + name; // mark the event as once
6500 }
6501 /* istanbul ignore if */
6502 if (modifiers.passive) {
6503 delete modifiers.passive;
6504 name = '&' + name; // mark the event as passive
6505 }
6506
6507 // normalize click.right and click.middle since they don't actually fire
6508 // this is technically browser-specific, but at least for now browsers are
6509 // the only target envs that have right/middle clicks.
6510 if (name === 'click') {
6511 if (modifiers.right) {
6512 name = 'contextmenu';
6513 delete modifiers.right;
6514 } else if (modifiers.middle) {
6515 name = 'mouseup';
6516 }
6517 }
6518
6519 var events;
6520 if (modifiers.native) {
6521 delete modifiers.native;
6522 events = el.nativeEvents || (el.nativeEvents = {});
6523 } else {
6524 events = el.events || (el.events = {});
6525 }
6526
6527 var newHandler = { value: value };
6528 if (modifiers !== emptyObject) {
6529 newHandler.modifiers = modifiers;
6530 }
6531
6532 var handlers = events[name];
6533 /* istanbul ignore if */
6534 if (Array.isArray(handlers)) {
6535 important ? handlers.unshift(newHandler) : handlers.push(newHandler);
6536 } else if (handlers) {
6537 events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
6538 } else {
6539 events[name] = newHandler;
6540 }
6541
6542 el.plain = false;
6543}
6544
6545function getBindingAttr (
6546 el,
6547 name,
6548 getStatic
6549) {
6550 var dynamicValue =
6551 getAndRemoveAttr(el, ':' + name) ||
6552 getAndRemoveAttr(el, 'v-bind:' + name);
6553 if (dynamicValue != null) {
6554 return parseFilters(dynamicValue)
6555 } else if (getStatic !== false) {
6556 var staticValue = getAndRemoveAttr(el, name);
6557 if (staticValue != null) {
6558 return JSON.stringify(staticValue)
6559 }
6560 }
6561}
6562
6563// note: this only removes the attr from the Array (attrsList) so that it
6564// doesn't get processed by processAttrs.
6565// By default it does NOT remove it from the map (attrsMap) because the map is
6566// needed during codegen.
6567function getAndRemoveAttr (
6568 el,
6569 name,
6570 removeFromMap
6571) {
6572 var val;
6573 if ((val = el.attrsMap[name]) != null) {
6574 var list = el.attrsList;
6575 for (var i = 0, l = list.length; i < l; i++) {
6576 if (list[i].name === name) {
6577 list.splice(i, 1);
6578 break
6579 }
6580 }
6581 }
6582 if (removeFromMap) {
6583 delete el.attrsMap[name];
6584 }
6585 return val
6586}
6587
6588/* */
6589
6590/**
6591 * Cross-platform code generation for component v-model
6592 */
6593function genComponentModel (
6594 el,
6595 value,
6596 modifiers
6597) {
6598 var ref = modifiers || {};
6599 var number = ref.number;
6600 var trim = ref.trim;
6601
6602 var baseValueExpression = '$$v';
6603 var valueExpression = baseValueExpression;
6604 if (trim) {
6605 valueExpression =
6606 "(typeof " + baseValueExpression + " === 'string'" +
6607 "? " + baseValueExpression + ".trim()" +
6608 ": " + baseValueExpression + ")";
6609 }
6610 if (number) {
6611 valueExpression = "_n(" + valueExpression + ")";
6612 }
6613 var assignment = genAssignmentCode(value, valueExpression);
6614
6615 el.model = {
6616 value: ("(" + value + ")"),
6617 expression: ("\"" + value + "\""),
6618 callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
6619 };
6620}
6621
6622/**
6623 * Cross-platform codegen helper for generating v-model value assignment code.
6624 */
6625function genAssignmentCode (
6626 value,
6627 assignment
6628) {
6629 var res = parseModel(value);
6630 if (res.key === null) {
6631 return (value + "=" + assignment)
6632 } else {
6633 return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
6634 }
6635}
6636
6637/**
6638 * Parse a v-model expression into a base path and a final key segment.
6639 * Handles both dot-path and possible square brackets.
6640 *
6641 * Possible cases:
6642 *
6643 * - test
6644 * - test[key]
6645 * - test[test1[key]]
6646 * - test["a"][key]
6647 * - xxx.test[a[a].test1[key]]
6648 * - test.xxx.a["asa"][test1[key]]
6649 *
6650 */
6651
6652var len;
6653var str;
6654var chr;
6655var index$1;
6656var expressionPos;
6657var expressionEndPos;
6658
6659
6660
6661function parseModel (val) {
6662 len = val.length;
6663
6664 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
6665 index$1 = val.lastIndexOf('.');
6666 if (index$1 > -1) {
6667 return {
6668 exp: val.slice(0, index$1),
6669 key: '"' + val.slice(index$1 + 1) + '"'
6670 }
6671 } else {
6672 return {
6673 exp: val,
6674 key: null
6675 }
6676 }
6677 }
6678
6679 str = val;
6680 index$1 = expressionPos = expressionEndPos = 0;
6681
6682 while (!eof()) {
6683 chr = next();
6684 /* istanbul ignore if */
6685 if (isStringStart(chr)) {
6686 parseString(chr);
6687 } else if (chr === 0x5B) {
6688 parseBracket(chr);
6689 }
6690 }
6691
6692 return {
6693 exp: val.slice(0, expressionPos),
6694 key: val.slice(expressionPos + 1, expressionEndPos)
6695 }
6696}
6697
6698function next () {
6699 return str.charCodeAt(++index$1)
6700}
6701
6702function eof () {
6703 return index$1 >= len
6704}
6705
6706function isStringStart (chr) {
6707 return chr === 0x22 || chr === 0x27
6708}
6709
6710function parseBracket (chr) {
6711 var inBracket = 1;
6712 expressionPos = index$1;
6713 while (!eof()) {
6714 chr = next();
6715 if (isStringStart(chr)) {
6716 parseString(chr);
6717 continue
6718 }
6719 if (chr === 0x5B) { inBracket++; }
6720 if (chr === 0x5D) { inBracket--; }
6721 if (inBracket === 0) {
6722 expressionEndPos = index$1;
6723 break
6724 }
6725 }
6726}
6727
6728function parseString (chr) {
6729 var stringQuote = chr;
6730 while (!eof()) {
6731 chr = next();
6732 if (chr === stringQuote) {
6733 break
6734 }
6735 }
6736}
6737
6738/* */
6739
6740var warn$1;
6741
6742// in some cases, the event used has to be determined at runtime
6743// so we used some reserved tokens during compile.
6744var RANGE_TOKEN = '__r';
6745var CHECKBOX_RADIO_TOKEN = '__c';
6746
6747function model (
6748 el,
6749 dir,
6750 _warn
6751) {
6752 warn$1 = _warn;
6753 var value = dir.value;
6754 var modifiers = dir.modifiers;
6755 var tag = el.tag;
6756 var type = el.attrsMap.type;
6757
6758 {
6759 // inputs with type="file" are read only and setting the input's
6760 // value will throw an error.
6761 if (tag === 'input' && type === 'file') {
6762 warn$1(
6763 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
6764 "File inputs are read only. Use a v-on:change listener instead."
6765 );
6766 }
6767 }
6768
6769 if (el.component) {
6770 genComponentModel(el, value, modifiers);
6771 // component v-model doesn't need extra runtime
6772 return false
6773 } else if (tag === 'select') {
6774 genSelect(el, value, modifiers);
6775 } else if (tag === 'input' && type === 'checkbox') {
6776 genCheckboxModel(el, value, modifiers);
6777 } else if (tag === 'input' && type === 'radio') {
6778 genRadioModel(el, value, modifiers);
6779 } else if (tag === 'input' || tag === 'textarea') {
6780 genDefaultModel(el, value, modifiers);
6781 } else if (!config.isReservedTag(tag)) {
6782 genComponentModel(el, value, modifiers);
6783 // component v-model doesn't need extra runtime
6784 return false
6785 } else {
6786 warn$1(
6787 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
6788 "v-model is not supported on this element type. " +
6789 'If you are working with contenteditable, it\'s recommended to ' +
6790 'wrap a library dedicated for that purpose inside a custom component.'
6791 );
6792 }
6793
6794 // ensure runtime directive metadata
6795 return true
6796}
6797
6798function genCheckboxModel (
6799 el,
6800 value,
6801 modifiers
6802) {
6803 var number = modifiers && modifiers.number;
6804 var valueBinding = getBindingAttr(el, 'value') || 'null';
6805 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
6806 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
6807 addProp(el, 'checked',
6808 "Array.isArray(" + value + ")" +
6809 "?_i(" + value + "," + valueBinding + ")>-1" + (
6810 trueValueBinding === 'true'
6811 ? (":(" + value + ")")
6812 : (":_q(" + value + "," + trueValueBinding + ")")
6813 )
6814 );
6815 addHandler(el, 'change',
6816 "var $$a=" + value + "," +
6817 '$$el=$event.target,' +
6818 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
6819 'if(Array.isArray($$a)){' +
6820 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
6821 '$$i=_i($$a,$$v);' +
6822 "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
6823 "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
6824 "}else{" + (genAssignmentCode(value, '$$c')) + "}",
6825 null, true
6826 );
6827}
6828
6829function genRadioModel (
6830 el,
6831 value,
6832 modifiers
6833) {
6834 var number = modifiers && modifiers.number;
6835 var valueBinding = getBindingAttr(el, 'value') || 'null';
6836 valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
6837 addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
6838 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
6839}
6840
6841function genSelect (
6842 el,
6843 value,
6844 modifiers
6845) {
6846 var number = modifiers && modifiers.number;
6847 var selectedVal = "Array.prototype.filter" +
6848 ".call($event.target.options,function(o){return o.selected})" +
6849 ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
6850 "return " + (number ? '_n(val)' : 'val') + "})";
6851
6852 var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
6853 var code = "var $$selectedVal = " + selectedVal + ";";
6854 code = code + " " + (genAssignmentCode(value, assignment));
6855 addHandler(el, 'change', code, null, true);
6856}
6857
6858function genDefaultModel (
6859 el,
6860 value,
6861 modifiers
6862) {
6863 var type = el.attrsMap.type;
6864
6865 // warn if v-bind:value conflicts with v-model
6866 {
6867 var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
6868 if (value$1) {
6869 var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
6870 warn$1(
6871 binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
6872 'because the latter already expands to a value binding internally'
6873 );
6874 }
6875 }
6876
6877 var ref = modifiers || {};
6878 var lazy = ref.lazy;
6879 var number = ref.number;
6880 var trim = ref.trim;
6881 var needCompositionGuard = !lazy && type !== 'range';
6882 var event = lazy
6883 ? 'change'
6884 : type === 'range'
6885 ? RANGE_TOKEN
6886 : 'input';
6887
6888 var valueExpression = '$event.target.value';
6889 if (trim) {
6890 valueExpression = "$event.target.value.trim()";
6891 }
6892 if (number) {
6893 valueExpression = "_n(" + valueExpression + ")";
6894 }
6895
6896 var code = genAssignmentCode(value, valueExpression);
6897 if (needCompositionGuard) {
6898 code = "if($event.target.composing)return;" + code;
6899 }
6900
6901 addProp(el, 'value', ("(" + value + ")"));
6902 addHandler(el, event, code, null, true);
6903 if (trim || number) {
6904 addHandler(el, 'blur', '$forceUpdate()');
6905 }
6906}
6907
6908/* */
6909
6910// normalize v-model event tokens that can only be determined at runtime.
6911// it's important to place the event as the first in the array because
6912// the whole point is ensuring the v-model callback gets called before
6913// user-attached handlers.
6914function normalizeEvents (on) {
6915 /* istanbul ignore if */
6916 if (isDef(on[RANGE_TOKEN])) {
6917 // IE input[type=range] only supports `change` event
6918 var event = isIE ? 'change' : 'input';
6919 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6920 delete on[RANGE_TOKEN];
6921 }
6922 // This was originally intended to fix #4521 but no longer necessary
6923 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6924 /* istanbul ignore if */
6925 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6926 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6927 delete on[CHECKBOX_RADIO_TOKEN];
6928 }
6929}
6930
6931var target$1;
6932
6933function createOnceHandler (handler, event, capture) {
6934 var _target = target$1; // save current target element in closure
6935 return function onceHandler () {
6936 var res = handler.apply(null, arguments);
6937 if (res !== null) {
6938 remove$2(event, onceHandler, capture, _target);
6939 }
6940 }
6941}
6942
6943function add$1 (
6944 event,
6945 handler,
6946 once$$1,
6947 capture,
6948 passive
6949) {
6950 handler = withMacroTask(handler);
6951 if (once$$1) { handler = createOnceHandler(handler, event, capture); }
6952 target$1.addEventListener(
6953 event,
6954 handler,
6955 supportsPassive
6956 ? { capture: capture, passive: passive }
6957 : capture
6958 );
6959}
6960
6961function remove$2 (
6962 event,
6963 handler,
6964 capture,
6965 _target
6966) {
6967 (_target || target$1).removeEventListener(
6968 event,
6969 handler._withTask || handler,
6970 capture
6971 );
6972}
6973
6974function updateDOMListeners (oldVnode, vnode) {
6975 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6976 return
6977 }
6978 var on = vnode.data.on || {};
6979 var oldOn = oldVnode.data.on || {};
6980 target$1 = vnode.elm;
6981 normalizeEvents(on);
6982 updateListeners(on, oldOn, add$1, remove$2, vnode.context);
6983 target$1 = undefined;
6984}
6985
6986var events = {
6987 create: updateDOMListeners,
6988 update: updateDOMListeners
6989};
6990
6991/* */
6992
6993function updateDOMProps (oldVnode, vnode) {
6994 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6995 return
6996 }
6997 var key, cur;
6998 var elm = vnode.elm;
6999 var oldProps = oldVnode.data.domProps || {};
7000 var props = vnode.data.domProps || {};
7001 // clone observed objects, as the user probably wants to mutate it
7002 if (isDef(props.__ob__)) {
7003 props = vnode.data.domProps = extend({}, props);
7004 }
7005
7006 for (key in oldProps) {
7007 if (isUndef(props[key])) {
7008 elm[key] = '';
7009 }
7010 }
7011 for (key in props) {
7012 cur = props[key];
7013 // ignore children if the node has textContent or innerHTML,
7014 // as these will throw away existing DOM nodes and cause removal errors
7015 // on subsequent patches (#3360)
7016 if (key === 'textContent' || key === 'innerHTML') {
7017 if (vnode.children) { vnode.children.length = 0; }
7018 if (cur === oldProps[key]) { continue }
7019 // #6601 work around Chrome version <= 55 bug where single textNode
7020 // replaced by innerHTML/textContent retains its parentNode property
7021 if (elm.childNodes.length === 1) {
7022 elm.removeChild(elm.childNodes[0]);
7023 }
7024 }
7025
7026 if (key === 'value') {
7027 // store value as _value as well since
7028 // non-string values will be stringified
7029 elm._value = cur;
7030 // avoid resetting cursor position when value is the same
7031 var strCur = isUndef(cur) ? '' : String(cur);
7032 if (shouldUpdateValue(elm, strCur)) {
7033 elm.value = strCur;
7034 }
7035 } else {
7036 elm[key] = cur;
7037 }
7038 }
7039}
7040
7041// check platforms/web/util/attrs.js acceptValue
7042
7043
7044function shouldUpdateValue (elm, checkVal) {
7045 return (!elm.composing && (
7046 elm.tagName === 'OPTION' ||
7047 isNotInFocusAndDirty(elm, checkVal) ||
7048 isDirtyWithModifiers(elm, checkVal)
7049 ))
7050}
7051
7052function isNotInFocusAndDirty (elm, checkVal) {
7053 // return true when textbox (.number and .trim) loses focus and its value is
7054 // not equal to the updated value
7055 var notInFocus = true;
7056 // #6157
7057 // work around IE bug when accessing document.activeElement in an iframe
7058 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7059 return notInFocus && elm.value !== checkVal
7060}
7061
7062function isDirtyWithModifiers (elm, newVal) {
7063 var value = elm.value;
7064 var modifiers = elm._vModifiers; // injected by v-model runtime
7065 if (isDef(modifiers)) {
7066 if (modifiers.lazy) {
7067 // inputs with lazy should only be updated when not in focus
7068 return false
7069 }
7070 if (modifiers.number) {
7071 return toNumber(value) !== toNumber(newVal)
7072 }
7073 if (modifiers.trim) {
7074 return value.trim() !== newVal.trim()
7075 }
7076 }
7077 return value !== newVal
7078}
7079
7080var domProps = {
7081 create: updateDOMProps,
7082 update: updateDOMProps
7083};
7084
7085/* */
7086
7087var parseStyleText = cached(function (cssText) {
7088 var res = {};
7089 var listDelimiter = /;(?![^(]*\))/g;
7090 var propertyDelimiter = /:(.+)/;
7091 cssText.split(listDelimiter).forEach(function (item) {
7092 if (item) {
7093 var tmp = item.split(propertyDelimiter);
7094 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7095 }
7096 });
7097 return res
7098});
7099
7100// merge static and dynamic style data on the same vnode
7101function normalizeStyleData (data) {
7102 var style = normalizeStyleBinding(data.style);
7103 // static style is pre-processed into an object during compilation
7104 // and is always a fresh object, so it's safe to merge into it
7105 return data.staticStyle
7106 ? extend(data.staticStyle, style)
7107 : style
7108}
7109
7110// normalize possible array / string values into Object
7111function normalizeStyleBinding (bindingStyle) {
7112 if (Array.isArray(bindingStyle)) {
7113 return toObject(bindingStyle)
7114 }
7115 if (typeof bindingStyle === 'string') {
7116 return parseStyleText(bindingStyle)
7117 }
7118 return bindingStyle
7119}
7120
7121/**
7122 * parent component style should be after child's
7123 * so that parent component's style could override it
7124 */
7125function getStyle (vnode, checkChild) {
7126 var res = {};
7127 var styleData;
7128
7129 if (checkChild) {
7130 var childNode = vnode;
7131 while (childNode.componentInstance) {
7132 childNode = childNode.componentInstance._vnode;
7133 if (
7134 childNode && childNode.data &&
7135 (styleData = normalizeStyleData(childNode.data))
7136 ) {
7137 extend(res, styleData);
7138 }
7139 }
7140 }
7141
7142 if ((styleData = normalizeStyleData(vnode.data))) {
7143 extend(res, styleData);
7144 }
7145
7146 var parentNode = vnode;
7147 while ((parentNode = parentNode.parent)) {
7148 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7149 extend(res, styleData);
7150 }
7151 }
7152 return res
7153}
7154
7155/* */
7156
7157var cssVarRE = /^--/;
7158var importantRE = /\s*!important$/;
7159var setProp = function (el, name, val) {
7160 /* istanbul ignore if */
7161 if (cssVarRE.test(name)) {
7162 el.style.setProperty(name, val);
7163 } else if (importantRE.test(val)) {
7164 el.style.setProperty(name, val.replace(importantRE, ''), 'important');
7165 } else {
7166 var normalizedName = normalize(name);
7167 if (Array.isArray(val)) {
7168 // Support values array created by autoprefixer, e.g.
7169 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7170 // Set them one by one, and the browser will only set those it can recognize
7171 for (var i = 0, len = val.length; i < len; i++) {
7172 el.style[normalizedName] = val[i];
7173 }
7174 } else {
7175 el.style[normalizedName] = val;
7176 }
7177 }
7178};
7179
7180var vendorNames = ['Webkit', 'Moz', 'ms'];
7181
7182var emptyStyle;
7183var normalize = cached(function (prop) {
7184 emptyStyle = emptyStyle || document.createElement('div').style;
7185 prop = camelize(prop);
7186 if (prop !== 'filter' && (prop in emptyStyle)) {
7187 return prop
7188 }
7189 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7190 for (var i = 0; i < vendorNames.length; i++) {
7191 var name = vendorNames[i] + capName;
7192 if (name in emptyStyle) {
7193 return name
7194 }
7195 }
7196});
7197
7198function updateStyle (oldVnode, vnode) {
7199 var data = vnode.data;
7200 var oldData = oldVnode.data;
7201
7202 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7203 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7204 ) {
7205 return
7206 }
7207
7208 var cur, name;
7209 var el = vnode.elm;
7210 var oldStaticStyle = oldData.staticStyle;
7211 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7212
7213 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7214 var oldStyle = oldStaticStyle || oldStyleBinding;
7215
7216 var style = normalizeStyleBinding(vnode.data.style) || {};
7217
7218 // store normalized style under a different key for next diff
7219 // make sure to clone it if it's reactive, since the user likely wants
7220 // to mutate it.
7221 vnode.data.normalizedStyle = isDef(style.__ob__)
7222 ? extend({}, style)
7223 : style;
7224
7225 var newStyle = getStyle(vnode, true);
7226
7227 for (name in oldStyle) {
7228 if (isUndef(newStyle[name])) {
7229 setProp(el, name, '');
7230 }
7231 }
7232 for (name in newStyle) {
7233 cur = newStyle[name];
7234 if (cur !== oldStyle[name]) {
7235 // ie9 setting to null has no effect, must use empty string
7236 setProp(el, name, cur == null ? '' : cur);
7237 }
7238 }
7239}
7240
7241var style = {
7242 create: updateStyle,
7243 update: updateStyle
7244};
7245
7246/* */
7247
7248/**
7249 * Add class with compatibility for SVG since classList is not supported on
7250 * SVG elements in IE
7251 */
7252function addClass (el, cls) {
7253 /* istanbul ignore if */
7254 if (!cls || !(cls = cls.trim())) {
7255 return
7256 }
7257
7258 /* istanbul ignore else */
7259 if (el.classList) {
7260 if (cls.indexOf(' ') > -1) {
7261 cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
7262 } else {
7263 el.classList.add(cls);
7264 }
7265 } else {
7266 var cur = " " + (el.getAttribute('class') || '') + " ";
7267 if (cur.indexOf(' ' + cls + ' ') < 0) {
7268 el.setAttribute('class', (cur + cls).trim());
7269 }
7270 }
7271}
7272
7273/**
7274 * Remove class with compatibility for SVG since classList is not supported on
7275 * SVG elements in IE
7276 */
7277function removeClass (el, cls) {
7278 /* istanbul ignore if */
7279 if (!cls || !(cls = cls.trim())) {
7280 return
7281 }
7282
7283 /* istanbul ignore else */
7284 if (el.classList) {
7285 if (cls.indexOf(' ') > -1) {
7286 cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
7287 } else {
7288 el.classList.remove(cls);
7289 }
7290 if (!el.classList.length) {
7291 el.removeAttribute('class');
7292 }
7293 } else {
7294 var cur = " " + (el.getAttribute('class') || '') + " ";
7295 var tar = ' ' + cls + ' ';
7296 while (cur.indexOf(tar) >= 0) {
7297 cur = cur.replace(tar, ' ');
7298 }
7299 cur = cur.trim();
7300 if (cur) {
7301 el.setAttribute('class', cur);
7302 } else {
7303 el.removeAttribute('class');
7304 }
7305 }
7306}
7307
7308/* */
7309
7310function resolveTransition (def) {
7311 if (!def) {
7312 return
7313 }
7314 /* istanbul ignore else */
7315 if (typeof def === 'object') {
7316 var res = {};
7317 if (def.css !== false) {
7318 extend(res, autoCssTransition(def.name || 'v'));
7319 }
7320 extend(res, def);
7321 return res
7322 } else if (typeof def === 'string') {
7323 return autoCssTransition(def)
7324 }
7325}
7326
7327var autoCssTransition = cached(function (name) {
7328 return {
7329 enterClass: (name + "-enter"),
7330 enterToClass: (name + "-enter-to"),
7331 enterActiveClass: (name + "-enter-active"),
7332 leaveClass: (name + "-leave"),
7333 leaveToClass: (name + "-leave-to"),
7334 leaveActiveClass: (name + "-leave-active")
7335 }
7336});
7337
7338var hasTransition = inBrowser && !isIE9;
7339var TRANSITION = 'transition';
7340var ANIMATION = 'animation';
7341
7342// Transition property/event sniffing
7343var transitionProp = 'transition';
7344var transitionEndEvent = 'transitionend';
7345var animationProp = 'animation';
7346var animationEndEvent = 'animationend';
7347if (hasTransition) {
7348 /* istanbul ignore if */
7349 if (window.ontransitionend === undefined &&
7350 window.onwebkittransitionend !== undefined
7351 ) {
7352 transitionProp = 'WebkitTransition';
7353 transitionEndEvent = 'webkitTransitionEnd';
7354 }
7355 if (window.onanimationend === undefined &&
7356 window.onwebkitanimationend !== undefined
7357 ) {
7358 animationProp = 'WebkitAnimation';
7359 animationEndEvent = 'webkitAnimationEnd';
7360 }
7361}
7362
7363// binding to window is necessary to make hot reload work in IE in strict mode
7364var raf = inBrowser
7365 ? window.requestAnimationFrame
7366 ? window.requestAnimationFrame.bind(window)
7367 : setTimeout
7368 : /* istanbul ignore next */ function (fn) { return fn(); };
7369
7370function nextFrame (fn) {
7371 raf(function () {
7372 raf(fn);
7373 });
7374}
7375
7376function addTransitionClass (el, cls) {
7377 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7378 if (transitionClasses.indexOf(cls) < 0) {
7379 transitionClasses.push(cls);
7380 addClass(el, cls);
7381 }
7382}
7383
7384function removeTransitionClass (el, cls) {
7385 if (el._transitionClasses) {
7386 remove(el._transitionClasses, cls);
7387 }
7388 removeClass(el, cls);
7389}
7390
7391function whenTransitionEnds (
7392 el,
7393 expectedType,
7394 cb
7395) {
7396 var ref = getTransitionInfo(el, expectedType);
7397 var type = ref.type;
7398 var timeout = ref.timeout;
7399 var propCount = ref.propCount;
7400 if (!type) { return cb() }
7401 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7402 var ended = 0;
7403 var end = function () {
7404 el.removeEventListener(event, onEnd);
7405 cb();
7406 };
7407 var onEnd = function (e) {
7408 if (e.target === el) {
7409 if (++ended >= propCount) {
7410 end();
7411 }
7412 }
7413 };
7414 setTimeout(function () {
7415 if (ended < propCount) {
7416 end();
7417 }
7418 }, timeout + 1);
7419 el.addEventListener(event, onEnd);
7420}
7421
7422var transformRE = /\b(transform|all)(,|$)/;
7423
7424function getTransitionInfo (el, expectedType) {
7425 var styles = window.getComputedStyle(el);
7426 var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
7427 var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
7428 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7429 var animationDelays = styles[animationProp + 'Delay'].split(', ');
7430 var animationDurations = styles[animationProp + 'Duration'].split(', ');
7431 var animationTimeout = getTimeout(animationDelays, animationDurations);
7432
7433 var type;
7434 var timeout = 0;
7435 var propCount = 0;
7436 /* istanbul ignore if */
7437 if (expectedType === TRANSITION) {
7438 if (transitionTimeout > 0) {
7439 type = TRANSITION;
7440 timeout = transitionTimeout;
7441 propCount = transitionDurations.length;
7442 }
7443 } else if (expectedType === ANIMATION) {
7444 if (animationTimeout > 0) {
7445 type = ANIMATION;
7446 timeout = animationTimeout;
7447 propCount = animationDurations.length;
7448 }
7449 } else {
7450 timeout = Math.max(transitionTimeout, animationTimeout);
7451 type = timeout > 0
7452 ? transitionTimeout > animationTimeout
7453 ? TRANSITION
7454 : ANIMATION
7455 : null;
7456 propCount = type
7457 ? type === TRANSITION
7458 ? transitionDurations.length
7459 : animationDurations.length
7460 : 0;
7461 }
7462 var hasTransform =
7463 type === TRANSITION &&
7464 transformRE.test(styles[transitionProp + 'Property']);
7465 return {
7466 type: type,
7467 timeout: timeout,
7468 propCount: propCount,
7469 hasTransform: hasTransform
7470 }
7471}
7472
7473function getTimeout (delays, durations) {
7474 /* istanbul ignore next */
7475 while (delays.length < durations.length) {
7476 delays = delays.concat(delays);
7477 }
7478
7479 return Math.max.apply(null, durations.map(function (d, i) {
7480 return toMs(d) + toMs(delays[i])
7481 }))
7482}
7483
7484function toMs (s) {
7485 return Number(s.slice(0, -1)) * 1000
7486}
7487
7488/* */
7489
7490function enter (vnode, toggleDisplay) {
7491 var el = vnode.elm;
7492
7493 // call leave callback now
7494 if (isDef(el._leaveCb)) {
7495 el._leaveCb.cancelled = true;
7496 el._leaveCb();
7497 }
7498
7499 var data = resolveTransition(vnode.data.transition);
7500 if (isUndef(data)) {
7501 return
7502 }
7503
7504 /* istanbul ignore if */
7505 if (isDef(el._enterCb) || el.nodeType !== 1) {
7506 return
7507 }
7508
7509 var css = data.css;
7510 var type = data.type;
7511 var enterClass = data.enterClass;
7512 var enterToClass = data.enterToClass;
7513 var enterActiveClass = data.enterActiveClass;
7514 var appearClass = data.appearClass;
7515 var appearToClass = data.appearToClass;
7516 var appearActiveClass = data.appearActiveClass;
7517 var beforeEnter = data.beforeEnter;
7518 var enter = data.enter;
7519 var afterEnter = data.afterEnter;
7520 var enterCancelled = data.enterCancelled;
7521 var beforeAppear = data.beforeAppear;
7522 var appear = data.appear;
7523 var afterAppear = data.afterAppear;
7524 var appearCancelled = data.appearCancelled;
7525 var duration = data.duration;
7526
7527 // activeInstance will always be the <transition> component managing this
7528 // transition. One edge case to check is when the <transition> is placed
7529 // as the root node of a child component. In that case we need to check
7530 // <transition>'s parent for appear check.
7531 var context = activeInstance;
7532 var transitionNode = activeInstance.$vnode;
7533 while (transitionNode && transitionNode.parent) {
7534 transitionNode = transitionNode.parent;
7535 context = transitionNode.context;
7536 }
7537
7538 var isAppear = !context._isMounted || !vnode.isRootInsert;
7539
7540 if (isAppear && !appear && appear !== '') {
7541 return
7542 }
7543
7544 var startClass = isAppear && appearClass
7545 ? appearClass
7546 : enterClass;
7547 var activeClass = isAppear && appearActiveClass
7548 ? appearActiveClass
7549 : enterActiveClass;
7550 var toClass = isAppear && appearToClass
7551 ? appearToClass
7552 : enterToClass;
7553
7554 var beforeEnterHook = isAppear
7555 ? (beforeAppear || beforeEnter)
7556 : beforeEnter;
7557 var enterHook = isAppear
7558 ? (typeof appear === 'function' ? appear : enter)
7559 : enter;
7560 var afterEnterHook = isAppear
7561 ? (afterAppear || afterEnter)
7562 : afterEnter;
7563 var enterCancelledHook = isAppear
7564 ? (appearCancelled || enterCancelled)
7565 : enterCancelled;
7566
7567 var explicitEnterDuration = toNumber(
7568 isObject(duration)
7569 ? duration.enter
7570 : duration
7571 );
7572
7573 if ("development" !== 'production' && explicitEnterDuration != null) {
7574 checkDuration(explicitEnterDuration, 'enter', vnode);
7575 }
7576
7577 var expectsCSS = css !== false && !isIE9;
7578 var userWantsControl = getHookArgumentsLength(enterHook);
7579
7580 var cb = el._enterCb = once(function () {
7581 if (expectsCSS) {
7582 removeTransitionClass(el, toClass);
7583 removeTransitionClass(el, activeClass);
7584 }
7585 if (cb.cancelled) {
7586 if (expectsCSS) {
7587 removeTransitionClass(el, startClass);
7588 }
7589 enterCancelledHook && enterCancelledHook(el);
7590 } else {
7591 afterEnterHook && afterEnterHook(el);
7592 }
7593 el._enterCb = null;
7594 });
7595
7596 if (!vnode.data.show) {
7597 // remove pending leave element on enter by injecting an insert hook
7598 mergeVNodeHook(vnode, 'insert', function () {
7599 var parent = el.parentNode;
7600 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7601 if (pendingNode &&
7602 pendingNode.tag === vnode.tag &&
7603 pendingNode.elm._leaveCb
7604 ) {
7605 pendingNode.elm._leaveCb();
7606 }
7607 enterHook && enterHook(el, cb);
7608 });
7609 }
7610
7611 // start enter transition
7612 beforeEnterHook && beforeEnterHook(el);
7613 if (expectsCSS) {
7614 addTransitionClass(el, startClass);
7615 addTransitionClass(el, activeClass);
7616 nextFrame(function () {
7617 addTransitionClass(el, toClass);
7618 removeTransitionClass(el, startClass);
7619 if (!cb.cancelled && !userWantsControl) {
7620 if (isValidDuration(explicitEnterDuration)) {
7621 setTimeout(cb, explicitEnterDuration);
7622 } else {
7623 whenTransitionEnds(el, type, cb);
7624 }
7625 }
7626 });
7627 }
7628
7629 if (vnode.data.show) {
7630 toggleDisplay && toggleDisplay();
7631 enterHook && enterHook(el, cb);
7632 }
7633
7634 if (!expectsCSS && !userWantsControl) {
7635 cb();
7636 }
7637}
7638
7639function leave (vnode, rm) {
7640 var el = vnode.elm;
7641
7642 // call enter callback now
7643 if (isDef(el._enterCb)) {
7644 el._enterCb.cancelled = true;
7645 el._enterCb();
7646 }
7647
7648 var data = resolveTransition(vnode.data.transition);
7649 if (isUndef(data) || el.nodeType !== 1) {
7650 return rm()
7651 }
7652
7653 /* istanbul ignore if */
7654 if (isDef(el._leaveCb)) {
7655 return
7656 }
7657
7658 var css = data.css;
7659 var type = data.type;
7660 var leaveClass = data.leaveClass;
7661 var leaveToClass = data.leaveToClass;
7662 var leaveActiveClass = data.leaveActiveClass;
7663 var beforeLeave = data.beforeLeave;
7664 var leave = data.leave;
7665 var afterLeave = data.afterLeave;
7666 var leaveCancelled = data.leaveCancelled;
7667 var delayLeave = data.delayLeave;
7668 var duration = data.duration;
7669
7670 var expectsCSS = css !== false && !isIE9;
7671 var userWantsControl = getHookArgumentsLength(leave);
7672
7673 var explicitLeaveDuration = toNumber(
7674 isObject(duration)
7675 ? duration.leave
7676 : duration
7677 );
7678
7679 if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
7680 checkDuration(explicitLeaveDuration, 'leave', vnode);
7681 }
7682
7683 var cb = el._leaveCb = once(function () {
7684 if (el.parentNode && el.parentNode._pending) {
7685 el.parentNode._pending[vnode.key] = null;
7686 }
7687 if (expectsCSS) {
7688 removeTransitionClass(el, leaveToClass);
7689 removeTransitionClass(el, leaveActiveClass);
7690 }
7691 if (cb.cancelled) {
7692 if (expectsCSS) {
7693 removeTransitionClass(el, leaveClass);
7694 }
7695 leaveCancelled && leaveCancelled(el);
7696 } else {
7697 rm();
7698 afterLeave && afterLeave(el);
7699 }
7700 el._leaveCb = null;
7701 });
7702
7703 if (delayLeave) {
7704 delayLeave(performLeave);
7705 } else {
7706 performLeave();
7707 }
7708
7709 function performLeave () {
7710 // the delayed leave may have already been cancelled
7711 if (cb.cancelled) {
7712 return
7713 }
7714 // record leaving element
7715 if (!vnode.data.show) {
7716 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7717 }
7718 beforeLeave && beforeLeave(el);
7719 if (expectsCSS) {
7720 addTransitionClass(el, leaveClass);
7721 addTransitionClass(el, leaveActiveClass);
7722 nextFrame(function () {
7723 addTransitionClass(el, leaveToClass);
7724 removeTransitionClass(el, leaveClass);
7725 if (!cb.cancelled && !userWantsControl) {
7726 if (isValidDuration(explicitLeaveDuration)) {
7727 setTimeout(cb, explicitLeaveDuration);
7728 } else {
7729 whenTransitionEnds(el, type, cb);
7730 }
7731 }
7732 });
7733 }
7734 leave && leave(el, cb);
7735 if (!expectsCSS && !userWantsControl) {
7736 cb();
7737 }
7738 }
7739}
7740
7741// only used in dev mode
7742function checkDuration (val, name, vnode) {
7743 if (typeof val !== 'number') {
7744 warn(
7745 "<transition> explicit " + name + " duration is not a valid number - " +
7746 "got " + (JSON.stringify(val)) + ".",
7747 vnode.context
7748 );
7749 } else if (isNaN(val)) {
7750 warn(
7751 "<transition> explicit " + name + " duration is NaN - " +
7752 'the duration expression might be incorrect.',
7753 vnode.context
7754 );
7755 }
7756}
7757
7758function isValidDuration (val) {
7759 return typeof val === 'number' && !isNaN(val)
7760}
7761
7762/**
7763 * Normalize a transition hook's argument length. The hook may be:
7764 * - a merged hook (invoker) with the original in .fns
7765 * - a wrapped component method (check ._length)
7766 * - a plain function (.length)
7767 */
7768function getHookArgumentsLength (fn) {
7769 if (isUndef(fn)) {
7770 return false
7771 }
7772 var invokerFns = fn.fns;
7773 if (isDef(invokerFns)) {
7774 // invoker
7775 return getHookArgumentsLength(
7776 Array.isArray(invokerFns)
7777 ? invokerFns[0]
7778 : invokerFns
7779 )
7780 } else {
7781 return (fn._length || fn.length) > 1
7782 }
7783}
7784
7785function _enter (_, vnode) {
7786 if (vnode.data.show !== true) {
7787 enter(vnode);
7788 }
7789}
7790
7791var transition = inBrowser ? {
7792 create: _enter,
7793 activate: _enter,
7794 remove: function remove$$1 (vnode, rm) {
7795 /* istanbul ignore else */
7796 if (vnode.data.show !== true) {
7797 leave(vnode, rm);
7798 } else {
7799 rm();
7800 }
7801 }
7802} : {};
7803
7804var platformModules = [
7805 attrs,
7806 klass,
7807 events,
7808 domProps,
7809 style,
7810 transition
7811];
7812
7813/* */
7814
7815// the directive module should be applied last, after all
7816// built-in modules have been applied.
7817var modules = platformModules.concat(baseModules);
7818
7819var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7820
7821/**
7822 * Not type checking this file because flow doesn't like attaching
7823 * properties to Elements.
7824 */
7825
7826/* istanbul ignore if */
7827if (isIE9) {
7828 // http://www.matts411.com/post/internet-explorer-9-oninput/
7829 document.addEventListener('selectionchange', function () {
7830 var el = document.activeElement;
7831 if (el && el.vmodel) {
7832 trigger(el, 'input');
7833 }
7834 });
7835}
7836
7837var directive = {
7838 inserted: function inserted (el, binding, vnode, oldVnode) {
7839 if (vnode.tag === 'select') {
7840 // #6903
7841 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7842 mergeVNodeHook(vnode, 'postpatch', function () {
7843 directive.componentUpdated(el, binding, vnode);
7844 });
7845 } else {
7846 setSelected(el, binding, vnode.context);
7847 }
7848 el._vOptions = [].map.call(el.options, getValue);
7849 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7850 el._vModifiers = binding.modifiers;
7851 if (!binding.modifiers.lazy) {
7852 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7853 // switching focus before confirming composition choice
7854 // this also fixes the issue where some browsers e.g. iOS Chrome
7855 // fires "change" instead of "input" on autocomplete.
7856 el.addEventListener('change', onCompositionEnd);
7857 if (!isAndroid) {
7858 el.addEventListener('compositionstart', onCompositionStart);
7859 el.addEventListener('compositionend', onCompositionEnd);
7860 }
7861 /* istanbul ignore if */
7862 if (isIE9) {
7863 el.vmodel = true;
7864 }
7865 }
7866 }
7867 },
7868
7869 componentUpdated: function componentUpdated (el, binding, vnode) {
7870 if (vnode.tag === 'select') {
7871 setSelected(el, binding, vnode.context);
7872 // in case the options rendered by v-for have changed,
7873 // it's possible that the value is out-of-sync with the rendered options.
7874 // detect such cases and filter out values that no longer has a matching
7875 // option in the DOM.
7876 var prevOptions = el._vOptions;
7877 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7878 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7879 // trigger change event if
7880 // no matching option found for at least one value
7881 var needReset = el.multiple
7882 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7883 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7884 if (needReset) {
7885 trigger(el, 'change');
7886 }
7887 }
7888 }
7889 }
7890};
7891
7892function setSelected (el, binding, vm) {
7893 actuallySetSelected(el, binding, vm);
7894 /* istanbul ignore if */
7895 if (isIE || isEdge) {
7896 setTimeout(function () {
7897 actuallySetSelected(el, binding, vm);
7898 }, 0);
7899 }
7900}
7901
7902function actuallySetSelected (el, binding, vm) {
7903 var value = binding.value;
7904 var isMultiple = el.multiple;
7905 if (isMultiple && !Array.isArray(value)) {
7906 "development" !== 'production' && warn(
7907 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7908 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7909 vm
7910 );
7911 return
7912 }
7913 var selected, option;
7914 for (var i = 0, l = el.options.length; i < l; i++) {
7915 option = el.options[i];
7916 if (isMultiple) {
7917 selected = looseIndexOf(value, getValue(option)) > -1;
7918 if (option.selected !== selected) {
7919 option.selected = selected;
7920 }
7921 } else {
7922 if (looseEqual(getValue(option), value)) {
7923 if (el.selectedIndex !== i) {
7924 el.selectedIndex = i;
7925 }
7926 return
7927 }
7928 }
7929 }
7930 if (!isMultiple) {
7931 el.selectedIndex = -1;
7932 }
7933}
7934
7935function hasNoMatchingOption (value, options) {
7936 return options.every(function (o) { return !looseEqual(o, value); })
7937}
7938
7939function getValue (option) {
7940 return '_value' in option
7941 ? option._value
7942 : option.value
7943}
7944
7945function onCompositionStart (e) {
7946 e.target.composing = true;
7947}
7948
7949function onCompositionEnd (e) {
7950 // prevent triggering an input event for no reason
7951 if (!e.target.composing) { return }
7952 e.target.composing = false;
7953 trigger(e.target, 'input');
7954}
7955
7956function trigger (el, type) {
7957 var e = document.createEvent('HTMLEvents');
7958 e.initEvent(type, true, true);
7959 el.dispatchEvent(e);
7960}
7961
7962/* */
7963
7964// recursively search for possible transition defined inside the component root
7965function locateNode (vnode) {
7966 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7967 ? locateNode(vnode.componentInstance._vnode)
7968 : vnode
7969}
7970
7971var show = {
7972 bind: function bind (el, ref, vnode) {
7973 var value = ref.value;
7974
7975 vnode = locateNode(vnode);
7976 var transition$$1 = vnode.data && vnode.data.transition;
7977 var originalDisplay = el.__vOriginalDisplay =
7978 el.style.display === 'none' ? '' : el.style.display;
7979 if (value && transition$$1) {
7980 vnode.data.show = true;
7981 enter(vnode, function () {
7982 el.style.display = originalDisplay;
7983 });
7984 } else {
7985 el.style.display = value ? originalDisplay : 'none';
7986 }
7987 },
7988
7989 update: function update (el, ref, vnode) {
7990 var value = ref.value;
7991 var oldValue = ref.oldValue;
7992
7993 /* istanbul ignore if */
7994 if (value === oldValue) { return }
7995 vnode = locateNode(vnode);
7996 var transition$$1 = vnode.data && vnode.data.transition;
7997 if (transition$$1) {
7998 vnode.data.show = true;
7999 if (value) {
8000 enter(vnode, function () {
8001 el.style.display = el.__vOriginalDisplay;
8002 });
8003 } else {
8004 leave(vnode, function () {
8005 el.style.display = 'none';
8006 });
8007 }
8008 } else {
8009 el.style.display = value ? el.__vOriginalDisplay : 'none';
8010 }
8011 },
8012
8013 unbind: function unbind (
8014 el,
8015 binding,
8016 vnode,
8017 oldVnode,
8018 isDestroy
8019 ) {
8020 if (!isDestroy) {
8021 el.style.display = el.__vOriginalDisplay;
8022 }
8023 }
8024};
8025
8026var platformDirectives = {
8027 model: directive,
8028 show: show
8029};
8030
8031/* */
8032
8033// Provides transition support for a single element/component.
8034// supports transition mode (out-in / in-out)
8035
8036var transitionProps = {
8037 name: String,
8038 appear: Boolean,
8039 css: Boolean,
8040 mode: String,
8041 type: String,
8042 enterClass: String,
8043 leaveClass: String,
8044 enterToClass: String,
8045 leaveToClass: String,
8046 enterActiveClass: String,
8047 leaveActiveClass: String,
8048 appearClass: String,
8049 appearActiveClass: String,
8050 appearToClass: String,
8051 duration: [Number, String, Object]
8052};
8053
8054// in case the child is also an abstract component, e.g. <keep-alive>
8055// we want to recursively retrieve the real component to be rendered
8056function getRealChild (vnode) {
8057 var compOptions = vnode && vnode.componentOptions;
8058 if (compOptions && compOptions.Ctor.options.abstract) {
8059 return getRealChild(getFirstComponentChild(compOptions.children))
8060 } else {
8061 return vnode
8062 }
8063}
8064
8065function extractTransitionData (comp) {
8066 var data = {};
8067 var options = comp.$options;
8068 // props
8069 for (var key in options.propsData) {
8070 data[key] = comp[key];
8071 }
8072 // events.
8073 // extract listeners and pass them directly to the transition methods
8074 var listeners = options._parentListeners;
8075 for (var key$1 in listeners) {
8076 data[camelize(key$1)] = listeners[key$1];
8077 }
8078 return data
8079}
8080
8081function placeholder (h, rawChild) {
8082 if (/\d-keep-alive$/.test(rawChild.tag)) {
8083 return h('keep-alive', {
8084 props: rawChild.componentOptions.propsData
8085 })
8086 }
8087}
8088
8089function hasParentTransition (vnode) {
8090 while ((vnode = vnode.parent)) {
8091 if (vnode.data.transition) {
8092 return true
8093 }
8094 }
8095}
8096
8097function isSameChild (child, oldChild) {
8098 return oldChild.key === child.key && oldChild.tag === child.tag
8099}
8100
8101var Transition = {
8102 name: 'transition',
8103 props: transitionProps,
8104 abstract: true,
8105
8106 render: function render (h) {
8107 var this$1 = this;
8108
8109 var children = this.$slots.default;
8110 if (!children) {
8111 return
8112 }
8113
8114 // filter out text nodes (possible whitespaces)
8115 children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
8116 /* istanbul ignore if */
8117 if (!children.length) {
8118 return
8119 }
8120
8121 // warn multiple elements
8122 if ("development" !== 'production' && children.length > 1) {
8123 warn(
8124 '<transition> can only be used on a single element. Use ' +
8125 '<transition-group> for lists.',
8126 this.$parent
8127 );
8128 }
8129
8130 var mode = this.mode;
8131
8132 // warn invalid mode
8133 if ("development" !== 'production' &&
8134 mode && mode !== 'in-out' && mode !== 'out-in'
8135 ) {
8136 warn(
8137 'invalid <transition> mode: ' + mode,
8138 this.$parent
8139 );
8140 }
8141
8142 var rawChild = children[0];
8143
8144 // if this is a component root node and the component's
8145 // parent container node also has transition, skip.
8146 if (hasParentTransition(this.$vnode)) {
8147 return rawChild
8148 }
8149
8150 // apply transition data to child
8151 // use getRealChild() to ignore abstract components e.g. keep-alive
8152 var child = getRealChild(rawChild);
8153 /* istanbul ignore if */
8154 if (!child) {
8155 return rawChild
8156 }
8157
8158 if (this._leaving) {
8159 return placeholder(h, rawChild)
8160 }
8161
8162 // ensure a key that is unique to the vnode type and to this transition
8163 // component instance. This key will be used to remove pending leaving nodes
8164 // during entering.
8165 var id = "__transition-" + (this._uid) + "-";
8166 child.key = child.key == null
8167 ? child.isComment
8168 ? id + 'comment'
8169 : id + child.tag
8170 : isPrimitive(child.key)
8171 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8172 : child.key;
8173
8174 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8175 var oldRawChild = this._vnode;
8176 var oldChild = getRealChild(oldRawChild);
8177
8178 // mark v-show
8179 // so that the transition module can hand over the control to the directive
8180 if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
8181 child.data.show = true;
8182 }
8183
8184 if (
8185 oldChild &&
8186 oldChild.data &&
8187 !isSameChild(child, oldChild) &&
8188 !isAsyncPlaceholder(oldChild) &&
8189 // #6687 component root is a comment node
8190 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8191 ) {
8192 // replace old child transition data with fresh one
8193 // important for dynamic transitions!
8194 var oldData = oldChild.data.transition = extend({}, data);
8195 // handle transition mode
8196 if (mode === 'out-in') {
8197 // return placeholder node and queue update when leave finishes
8198 this._leaving = true;
8199 mergeVNodeHook(oldData, 'afterLeave', function () {
8200 this$1._leaving = false;
8201 this$1.$forceUpdate();
8202 });
8203 return placeholder(h, rawChild)
8204 } else if (mode === 'in-out') {
8205 if (isAsyncPlaceholder(child)) {
8206 return oldRawChild
8207 }
8208 var delayedLeave;
8209 var performLeave = function () { delayedLeave(); };
8210 mergeVNodeHook(data, 'afterEnter', performLeave);
8211 mergeVNodeHook(data, 'enterCancelled', performLeave);
8212 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8213 }
8214 }
8215
8216 return rawChild
8217 }
8218};
8219
8220/* */
8221
8222// Provides transition support for list items.
8223// supports move transitions using the FLIP technique.
8224
8225// Because the vdom's children update algorithm is "unstable" - i.e.
8226// it doesn't guarantee the relative positioning of removed elements,
8227// we force transition-group to update its children into two passes:
8228// in the first pass, we remove all nodes that need to be removed,
8229// triggering their leaving transition; in the second pass, we insert/move
8230// into the final desired state. This way in the second pass removed
8231// nodes will remain where they should be.
8232
8233var props = extend({
8234 tag: String,
8235 moveClass: String
8236}, transitionProps);
8237
8238delete props.mode;
8239
8240var TransitionGroup = {
8241 props: props,
8242
8243 render: function render (h) {
8244 var tag = this.tag || this.$vnode.data.tag || 'span';
8245 var map = Object.create(null);
8246 var prevChildren = this.prevChildren = this.children;
8247 var rawChildren = this.$slots.default || [];
8248 var children = this.children = [];
8249 var transitionData = extractTransitionData(this);
8250
8251 for (var i = 0; i < rawChildren.length; i++) {
8252 var c = rawChildren[i];
8253 if (c.tag) {
8254 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8255 children.push(c);
8256 map[c.key] = c
8257 ;(c.data || (c.data = {})).transition = transitionData;
8258 } else {
8259 var opts = c.componentOptions;
8260 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8261 warn(("<transition-group> children must be keyed: <" + name + ">"));
8262 }
8263 }
8264 }
8265
8266 if (prevChildren) {
8267 var kept = [];
8268 var removed = [];
8269 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8270 var c$1 = prevChildren[i$1];
8271 c$1.data.transition = transitionData;
8272 c$1.data.pos = c$1.elm.getBoundingClientRect();
8273 if (map[c$1.key]) {
8274 kept.push(c$1);
8275 } else {
8276 removed.push(c$1);
8277 }
8278 }
8279 this.kept = h(tag, null, kept);
8280 this.removed = removed;
8281 }
8282
8283 return h(tag, null, children)
8284 },
8285
8286 beforeUpdate: function beforeUpdate () {
8287 // force removing pass
8288 this.__patch__(
8289 this._vnode,
8290 this.kept,
8291 false, // hydrating
8292 true // removeOnly (!important avoids unnecessary moves)
8293 );
8294 this._vnode = this.kept;
8295 },
8296
8297 updated: function updated () {
8298 var children = this.prevChildren;
8299 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8300 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8301 return
8302 }
8303
8304 // we divide the work into three loops to avoid mixing DOM reads and writes
8305 // in each iteration - which helps prevent layout thrashing.
8306 children.forEach(callPendingCbs);
8307 children.forEach(recordPosition);
8308 children.forEach(applyTranslation);
8309
8310 // force reflow to put everything in position
8311 // assign to this to avoid being removed in tree-shaking
8312 // $flow-disable-line
8313 this._reflow = document.body.offsetHeight;
8314
8315 children.forEach(function (c) {
8316 if (c.data.moved) {
8317 var el = c.elm;
8318 var s = el.style;
8319 addTransitionClass(el, moveClass);
8320 s.transform = s.WebkitTransform = s.transitionDuration = '';
8321 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8322 if (!e || /transform$/.test(e.propertyName)) {
8323 el.removeEventListener(transitionEndEvent, cb);
8324 el._moveCb = null;
8325 removeTransitionClass(el, moveClass);
8326 }
8327 });
8328 }
8329 });
8330 },
8331
8332 methods: {
8333 hasMove: function hasMove (el, moveClass) {
8334 /* istanbul ignore if */
8335 if (!hasTransition) {
8336 return false
8337 }
8338 /* istanbul ignore if */
8339 if (this._hasMove) {
8340 return this._hasMove
8341 }
8342 // Detect whether an element with the move class applied has
8343 // CSS transitions. Since the element may be inside an entering
8344 // transition at this very moment, we make a clone of it and remove
8345 // all other transition classes applied to ensure only the move class
8346 // is applied.
8347 var clone = el.cloneNode();
8348 if (el._transitionClasses) {
8349 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8350 }
8351 addClass(clone, moveClass);
8352 clone.style.display = 'none';
8353 this.$el.appendChild(clone);
8354 var info = getTransitionInfo(clone);
8355 this.$el.removeChild(clone);
8356 return (this._hasMove = info.hasTransform)
8357 }
8358 }
8359};
8360
8361function callPendingCbs (c) {
8362 /* istanbul ignore if */
8363 if (c.elm._moveCb) {
8364 c.elm._moveCb();
8365 }
8366 /* istanbul ignore if */
8367 if (c.elm._enterCb) {
8368 c.elm._enterCb();
8369 }
8370}
8371
8372function recordPosition (c) {
8373 c.data.newPos = c.elm.getBoundingClientRect();
8374}
8375
8376function applyTranslation (c) {
8377 var oldPos = c.data.pos;
8378 var newPos = c.data.newPos;
8379 var dx = oldPos.left - newPos.left;
8380 var dy = oldPos.top - newPos.top;
8381 if (dx || dy) {
8382 c.data.moved = true;
8383 var s = c.elm.style;
8384 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8385 s.transitionDuration = '0s';
8386 }
8387}
8388
8389var platformComponents = {
8390 Transition: Transition,
8391 TransitionGroup: TransitionGroup
8392};
8393
8394/* */
8395
8396// install platform specific utils
8397Vue$3.config.mustUseProp = mustUseProp;
8398Vue$3.config.isReservedTag = isReservedTag;
8399Vue$3.config.isReservedAttr = isReservedAttr;
8400Vue$3.config.getTagNamespace = getTagNamespace;
8401Vue$3.config.isUnknownElement = isUnknownElement;
8402
8403// install platform runtime directives & components
8404extend(Vue$3.options.directives, platformDirectives);
8405extend(Vue$3.options.components, platformComponents);
8406
8407// install platform patch function
8408Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
8409
8410// public mount method
8411Vue$3.prototype.$mount = function (
8412 el,
8413 hydrating
8414) {
8415 el = el && inBrowser ? query(el) : undefined;
8416 return mountComponent(this, el, hydrating)
8417};
8418
8419// devtools global hook
8420/* istanbul ignore next */
8421Vue$3.nextTick(function () {
8422 if (config.devtools) {
8423 if (devtools) {
8424 devtools.emit('init', Vue$3);
8425 } else if ("development" !== 'production' && isChrome) {
8426 console[console.info ? 'info' : 'log'](
8427 'Download the Vue Devtools extension for a better development experience:\n' +
8428 'https://github.com/vuejs/vue-devtools'
8429 );
8430 }
8431 }
8432 if ("development" !== 'production' &&
8433 config.productionTip !== false &&
8434 inBrowser && typeof console !== 'undefined'
8435 ) {
8436 console[console.info ? 'info' : 'log'](
8437 "You are running Vue in development mode.\n" +
8438 "Make sure to turn on production mode when deploying for production.\n" +
8439 "See more tips at https://vuejs.org/guide/deployment.html"
8440 );
8441 }
8442}, 0);
8443
8444/* */
8445
8446var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
8447var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
8448
8449var buildRegex = cached(function (delimiters) {
8450 var open = delimiters[0].replace(regexEscapeRE, '\\$&');
8451 var close = delimiters[1].replace(regexEscapeRE, '\\$&');
8452 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
8453});
8454
8455
8456
8457function parseText (
8458 text,
8459 delimiters
8460) {
8461 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
8462 if (!tagRE.test(text)) {
8463 return
8464 }
8465 var tokens = [];
8466 var rawTokens = [];
8467 var lastIndex = tagRE.lastIndex = 0;
8468 var match, index, tokenValue;
8469 while ((match = tagRE.exec(text))) {
8470 index = match.index;
8471 // push text token
8472 if (index > lastIndex) {
8473 rawTokens.push(tokenValue = text.slice(lastIndex, index));
8474 tokens.push(JSON.stringify(tokenValue));
8475 }
8476 // tag token
8477 var exp = parseFilters(match[1].trim());
8478 tokens.push(("_s(" + exp + ")"));
8479 rawTokens.push({ '@binding': exp });
8480 lastIndex = index + match[0].length;
8481 }
8482 if (lastIndex < text.length) {
8483 rawTokens.push(tokenValue = text.slice(lastIndex));
8484 tokens.push(JSON.stringify(tokenValue));
8485 }
8486 return {
8487 expression: tokens.join('+'),
8488 tokens: rawTokens
8489 }
8490}
8491
8492/* */
8493
8494function transformNode (el, options) {
8495 var warn = options.warn || baseWarn;
8496 var staticClass = getAndRemoveAttr(el, 'class');
8497 if ("development" !== 'production' && staticClass) {
8498 var res = parseText(staticClass, options.delimiters);
8499 if (res) {
8500 warn(
8501 "class=\"" + staticClass + "\": " +
8502 'Interpolation inside attributes has been removed. ' +
8503 'Use v-bind or the colon shorthand instead. For example, ' +
8504 'instead of <div class="{{ val }}">, use <div :class="val">.'
8505 );
8506 }
8507 }
8508 if (staticClass) {
8509 el.staticClass = JSON.stringify(staticClass);
8510 }
8511 var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
8512 if (classBinding) {
8513 el.classBinding = classBinding;
8514 }
8515}
8516
8517function genData (el) {
8518 var data = '';
8519 if (el.staticClass) {
8520 data += "staticClass:" + (el.staticClass) + ",";
8521 }
8522 if (el.classBinding) {
8523 data += "class:" + (el.classBinding) + ",";
8524 }
8525 return data
8526}
8527
8528var klass$1 = {
8529 staticKeys: ['staticClass'],
8530 transformNode: transformNode,
8531 genData: genData
8532};
8533
8534/* */
8535
8536function transformNode$1 (el, options) {
8537 var warn = options.warn || baseWarn;
8538 var staticStyle = getAndRemoveAttr(el, 'style');
8539 if (staticStyle) {
8540 /* istanbul ignore if */
8541 {
8542 var res = parseText(staticStyle, options.delimiters);
8543 if (res) {
8544 warn(
8545 "style=\"" + staticStyle + "\": " +
8546 'Interpolation inside attributes has been removed. ' +
8547 'Use v-bind or the colon shorthand instead. For example, ' +
8548 'instead of <div style="{{ val }}">, use <div :style="val">.'
8549 );
8550 }
8551 }
8552 el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
8553 }
8554
8555 var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
8556 if (styleBinding) {
8557 el.styleBinding = styleBinding;
8558 }
8559}
8560
8561function genData$1 (el) {
8562 var data = '';
8563 if (el.staticStyle) {
8564 data += "staticStyle:" + (el.staticStyle) + ",";
8565 }
8566 if (el.styleBinding) {
8567 data += "style:(" + (el.styleBinding) + "),";
8568 }
8569 return data
8570}
8571
8572var style$1 = {
8573 staticKeys: ['staticStyle'],
8574 transformNode: transformNode$1,
8575 genData: genData$1
8576};
8577
8578/* */
8579
8580var decoder;
8581
8582var he = {
8583 decode: function decode (html) {
8584 decoder = decoder || document.createElement('div');
8585 decoder.innerHTML = html;
8586 return decoder.textContent
8587 }
8588};
8589
8590/* */
8591
8592var isUnaryTag = makeMap(
8593 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
8594 'link,meta,param,source,track,wbr'
8595);
8596
8597// Elements that you can, intentionally, leave open
8598// (and which close themselves)
8599var canBeLeftOpenTag = makeMap(
8600 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
8601);
8602
8603// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
8604// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
8605var isNonPhrasingTag = makeMap(
8606 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
8607 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
8608 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
8609 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
8610 'title,tr,track'
8611);
8612
8613/**
8614 * Not type-checking this file because it's mostly vendor code.
8615 */
8616
8617/*!
8618 * HTML Parser By John Resig (ejohn.org)
8619 * Modified by Juriy "kangax" Zaytsev
8620 * Original code by Erik Arvidsson, Mozilla Public License
8621 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
8622 */
8623
8624// Regular Expressions for parsing tags and attributes
8625var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
8626// could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
8627// but for Vue templates we can enforce a simple charset
8628var ncname = '[a-zA-Z_][\\w\\-\\.]*';
8629var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
8630var startTagOpen = new RegExp(("^<" + qnameCapture));
8631var startTagClose = /^\s*(\/?)>/;
8632var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
8633var doctype = /^<!DOCTYPE [^>]+>/i;
8634var comment = /^<!--/;
8635var conditionalComment = /^<!\[/;
8636
8637var IS_REGEX_CAPTURING_BROKEN = false;
8638'x'.replace(/x(.)?/g, function (m, g) {
8639 IS_REGEX_CAPTURING_BROKEN = g === '';
8640});
8641
8642// Special Elements (can contain anything)
8643var isPlainTextElement = makeMap('script,style,textarea', true);
8644var reCache = {};
8645
8646var decodingMap = {
8647 '<': '<',
8648 '>': '>',
8649 '"': '"',
8650 '&': '&',
8651 ' ': '\n',
8652 '	': '\t'
8653};
8654var encodedAttr = /&(?:lt|gt|quot|amp);/g;
8655var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
8656
8657// #5992
8658var isIgnoreNewlineTag = makeMap('pre,textarea', true);
8659var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
8660
8661function decodeAttr (value, shouldDecodeNewlines) {
8662 var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
8663 return value.replace(re, function (match) { return decodingMap[match]; })
8664}
8665
8666function parseHTML (html, options) {
8667 var stack = [];
8668 var expectHTML = options.expectHTML;
8669 var isUnaryTag$$1 = options.isUnaryTag || no;
8670 var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
8671 var index = 0;
8672 var last, lastTag;
8673 while (html) {
8674 last = html;
8675 // Make sure we're not in a plaintext content element like script/style
8676 if (!lastTag || !isPlainTextElement(lastTag)) {
8677 var textEnd = html.indexOf('<');
8678 if (textEnd === 0) {
8679 // Comment:
8680 if (comment.test(html)) {
8681 var commentEnd = html.indexOf('-->');
8682
8683 if (commentEnd >= 0) {
8684 if (options.shouldKeepComment) {
8685 options.comment(html.substring(4, commentEnd));
8686 }
8687 advance(commentEnd + 3);
8688 continue
8689 }
8690 }
8691
8692 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
8693 if (conditionalComment.test(html)) {
8694 var conditionalEnd = html.indexOf(']>');
8695
8696 if (conditionalEnd >= 0) {
8697 advance(conditionalEnd + 2);
8698 continue
8699 }
8700 }
8701
8702 // Doctype:
8703 var doctypeMatch = html.match(doctype);
8704 if (doctypeMatch) {
8705 advance(doctypeMatch[0].length);
8706 continue
8707 }
8708
8709 // End tag:
8710 var endTagMatch = html.match(endTag);
8711 if (endTagMatch) {
8712 var curIndex = index;
8713 advance(endTagMatch[0].length);
8714 parseEndTag(endTagMatch[1], curIndex, index);
8715 continue
8716 }
8717
8718 // Start tag:
8719 var startTagMatch = parseStartTag();
8720 if (startTagMatch) {
8721 handleStartTag(startTagMatch);
8722 if (shouldIgnoreFirstNewline(lastTag, html)) {
8723 advance(1);
8724 }
8725 continue
8726 }
8727 }
8728
8729 var text = (void 0), rest = (void 0), next = (void 0);
8730 if (textEnd >= 0) {
8731 rest = html.slice(textEnd);
8732 while (
8733 !endTag.test(rest) &&
8734 !startTagOpen.test(rest) &&
8735 !comment.test(rest) &&
8736 !conditionalComment.test(rest)
8737 ) {
8738 // < in plain text, be forgiving and treat it as text
8739 next = rest.indexOf('<', 1);
8740 if (next < 0) { break }
8741 textEnd += next;
8742 rest = html.slice(textEnd);
8743 }
8744 text = html.substring(0, textEnd);
8745 advance(textEnd);
8746 }
8747
8748 if (textEnd < 0) {
8749 text = html;
8750 html = '';
8751 }
8752
8753 if (options.chars && text) {
8754 options.chars(text);
8755 }
8756 } else {
8757 var endTagLength = 0;
8758 var stackedTag = lastTag.toLowerCase();
8759 var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
8760 var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
8761 endTagLength = endTag.length;
8762 if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
8763 text = text
8764 .replace(/<!--([\s\S]*?)-->/g, '$1')
8765 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
8766 }
8767 if (shouldIgnoreFirstNewline(stackedTag, text)) {
8768 text = text.slice(1);
8769 }
8770 if (options.chars) {
8771 options.chars(text);
8772 }
8773 return ''
8774 });
8775 index += html.length - rest$1.length;
8776 html = rest$1;
8777 parseEndTag(stackedTag, index - endTagLength, index);
8778 }
8779
8780 if (html === last) {
8781 options.chars && options.chars(html);
8782 if ("development" !== 'production' && !stack.length && options.warn) {
8783 options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
8784 }
8785 break
8786 }
8787 }
8788
8789 // Clean up any remaining tags
8790 parseEndTag();
8791
8792 function advance (n) {
8793 index += n;
8794 html = html.substring(n);
8795 }
8796
8797 function parseStartTag () {
8798 var start = html.match(startTagOpen);
8799 if (start) {
8800 var match = {
8801 tagName: start[1],
8802 attrs: [],
8803 start: index
8804 };
8805 advance(start[0].length);
8806 var end, attr;
8807 while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
8808 advance(attr[0].length);
8809 match.attrs.push(attr);
8810 }
8811 if (end) {
8812 match.unarySlash = end[1];
8813 advance(end[0].length);
8814 match.end = index;
8815 return match
8816 }
8817 }
8818 }
8819
8820 function handleStartTag (match) {
8821 var tagName = match.tagName;
8822 var unarySlash = match.unarySlash;
8823
8824 if (expectHTML) {
8825 if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
8826 parseEndTag(lastTag);
8827 }
8828 if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
8829 parseEndTag(tagName);
8830 }
8831 }
8832
8833 var unary = isUnaryTag$$1(tagName) || !!unarySlash;
8834
8835 var l = match.attrs.length;
8836 var attrs = new Array(l);
8837 for (var i = 0; i < l; i++) {
8838 var args = match.attrs[i];
8839 // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
8840 if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
8841 if (args[3] === '') { delete args[3]; }
8842 if (args[4] === '') { delete args[4]; }
8843 if (args[5] === '') { delete args[5]; }
8844 }
8845 var value = args[3] || args[4] || args[5] || '';
8846 var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
8847 ? options.shouldDecodeNewlinesForHref
8848 : options.shouldDecodeNewlines;
8849 attrs[i] = {
8850 name: args[1],
8851 value: decodeAttr(value, shouldDecodeNewlines)
8852 };
8853 }
8854
8855 if (!unary) {
8856 stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
8857 lastTag = tagName;
8858 }
8859
8860 if (options.start) {
8861 options.start(tagName, attrs, unary, match.start, match.end);
8862 }
8863 }
8864
8865 function parseEndTag (tagName, start, end) {
8866 var pos, lowerCasedTagName;
8867 if (start == null) { start = index; }
8868 if (end == null) { end = index; }
8869
8870 if (tagName) {
8871 lowerCasedTagName = tagName.toLowerCase();
8872 }
8873
8874 // Find the closest opened tag of the same type
8875 if (tagName) {
8876 for (pos = stack.length - 1; pos >= 0; pos--) {
8877 if (stack[pos].lowerCasedTag === lowerCasedTagName) {
8878 break
8879 }
8880 }
8881 } else {
8882 // If no tag name is provided, clean shop
8883 pos = 0;
8884 }
8885
8886 if (pos >= 0) {
8887 // Close all the open elements, up the stack
8888 for (var i = stack.length - 1; i >= pos; i--) {
8889 if ("development" !== 'production' &&
8890 (i > pos || !tagName) &&
8891 options.warn
8892 ) {
8893 options.warn(
8894 ("tag <" + (stack[i].tag) + "> has no matching end tag.")
8895 );
8896 }
8897 if (options.end) {
8898 options.end(stack[i].tag, start, end);
8899 }
8900 }
8901
8902 // Remove the open elements from the stack
8903 stack.length = pos;
8904 lastTag = pos && stack[pos - 1].tag;
8905 } else if (lowerCasedTagName === 'br') {
8906 if (options.start) {
8907 options.start(tagName, [], true, start, end);
8908 }
8909 } else if (lowerCasedTagName === 'p') {
8910 if (options.start) {
8911 options.start(tagName, [], false, start, end);
8912 }
8913 if (options.end) {
8914 options.end(tagName, start, end);
8915 }
8916 }
8917 }
8918}
8919
8920/* */
8921
8922var onRE = /^@|^v-on:/;
8923var dirRE = /^v-|^@|^:/;
8924var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
8925var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
8926var stripParensRE = /^\(|\)$/g;
8927
8928var argRE = /:(.*)$/;
8929var bindRE = /^:|^v-bind:/;
8930var modifierRE = /\.[^.]+/g;
8931
8932var decodeHTMLCached = cached(he.decode);
8933
8934// configurable state
8935var warn$2;
8936var delimiters;
8937var transforms;
8938var preTransforms;
8939var postTransforms;
8940var platformIsPreTag;
8941var platformMustUseProp;
8942var platformGetTagNamespace;
8943
8944
8945
8946function createASTElement (
8947 tag,
8948 attrs,
8949 parent
8950) {
8951 return {
8952 type: 1,
8953 tag: tag,
8954 attrsList: attrs,
8955 attrsMap: makeAttrsMap(attrs),
8956 parent: parent,
8957 children: []
8958 }
8959}
8960
8961/**
8962 * Convert HTML string to AST.
8963 */
8964function parse (
8965 template,
8966 options
8967) {
8968 warn$2 = options.warn || baseWarn;
8969
8970 platformIsPreTag = options.isPreTag || no;
8971 platformMustUseProp = options.mustUseProp || no;
8972 platformGetTagNamespace = options.getTagNamespace || no;
8973
8974 transforms = pluckModuleFunction(options.modules, 'transformNode');
8975 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
8976 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
8977
8978 delimiters = options.delimiters;
8979
8980 var stack = [];
8981 var preserveWhitespace = options.preserveWhitespace !== false;
8982 var root;
8983 var currentParent;
8984 var inVPre = false;
8985 var inPre = false;
8986 var warned = false;
8987
8988 function warnOnce (msg) {
8989 if (!warned) {
8990 warned = true;
8991 warn$2(msg);
8992 }
8993 }
8994
8995 function closeElement (element) {
8996 // check pre state
8997 if (element.pre) {
8998 inVPre = false;
8999 }
9000 if (platformIsPreTag(element.tag)) {
9001 inPre = false;
9002 }
9003 // apply post-transforms
9004 for (var i = 0; i < postTransforms.length; i++) {
9005 postTransforms[i](element, options);
9006 }
9007 }
9008
9009 parseHTML(template, {
9010 warn: warn$2,
9011 expectHTML: options.expectHTML,
9012 isUnaryTag: options.isUnaryTag,
9013 canBeLeftOpenTag: options.canBeLeftOpenTag,
9014 shouldDecodeNewlines: options.shouldDecodeNewlines,
9015 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9016 shouldKeepComment: options.comments,
9017 start: function start (tag, attrs, unary) {
9018 // check namespace.
9019 // inherit parent ns if there is one
9020 var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
9021
9022 // handle IE svg bug
9023 /* istanbul ignore if */
9024 if (isIE && ns === 'svg') {
9025 attrs = guardIESVGBug(attrs);
9026 }
9027
9028 var element = createASTElement(tag, attrs, currentParent);
9029 if (ns) {
9030 element.ns = ns;
9031 }
9032
9033 if (isForbiddenTag(element) && !isServerRendering()) {
9034 element.forbidden = true;
9035 "development" !== 'production' && warn$2(
9036 'Templates should only be responsible for mapping the state to the ' +
9037 'UI. Avoid placing tags with side-effects in your templates, such as ' +
9038 "<" + tag + ">" + ', as they will not be parsed.'
9039 );
9040 }
9041
9042 // apply pre-transforms
9043 for (var i = 0; i < preTransforms.length; i++) {
9044 element = preTransforms[i](element, options) || element;
9045 }
9046
9047 if (!inVPre) {
9048 processPre(element);
9049 if (element.pre) {
9050 inVPre = true;
9051 }
9052 }
9053 if (platformIsPreTag(element.tag)) {
9054 inPre = true;
9055 }
9056 if (inVPre) {
9057 processRawAttrs(element);
9058 } else if (!element.processed) {
9059 // structural directives
9060 processFor(element);
9061 processIf(element);
9062 processOnce(element);
9063 // element-scope stuff
9064 processElement(element, options);
9065 }
9066
9067 function checkRootConstraints (el) {
9068 {
9069 if (el.tag === 'slot' || el.tag === 'template') {
9070 warnOnce(
9071 "Cannot use <" + (el.tag) + "> as component root element because it may " +
9072 'contain multiple nodes.'
9073 );
9074 }
9075 if (el.attrsMap.hasOwnProperty('v-for')) {
9076 warnOnce(
9077 'Cannot use v-for on stateful component root element because ' +
9078 'it renders multiple elements.'
9079 );
9080 }
9081 }
9082 }
9083
9084 // tree management
9085 if (!root) {
9086 root = element;
9087 checkRootConstraints(root);
9088 } else if (!stack.length) {
9089 // allow root elements with v-if, v-else-if and v-else
9090 if (root.if && (element.elseif || element.else)) {
9091 checkRootConstraints(element);
9092 addIfCondition(root, {
9093 exp: element.elseif,
9094 block: element
9095 });
9096 } else {
9097 warnOnce(
9098 "Component template should contain exactly one root element. " +
9099 "If you are using v-if on multiple elements, " +
9100 "use v-else-if to chain them instead."
9101 );
9102 }
9103 }
9104 if (currentParent && !element.forbidden) {
9105 if (element.elseif || element.else) {
9106 processIfConditions(element, currentParent);
9107 } else if (element.slotScope) { // scoped slot
9108 currentParent.plain = false;
9109 var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
9110 } else {
9111 currentParent.children.push(element);
9112 element.parent = currentParent;
9113 }
9114 }
9115 if (!unary) {
9116 currentParent = element;
9117 stack.push(element);
9118 } else {
9119 closeElement(element);
9120 }
9121 },
9122
9123 end: function end () {
9124 // remove trailing whitespace
9125 var element = stack[stack.length - 1];
9126 var lastNode = element.children[element.children.length - 1];
9127 if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
9128 element.children.pop();
9129 }
9130 // pop stack
9131 stack.length -= 1;
9132 currentParent = stack[stack.length - 1];
9133 closeElement(element);
9134 },
9135
9136 chars: function chars (text) {
9137 if (!currentParent) {
9138 {
9139 if (text === template) {
9140 warnOnce(
9141 'Component template requires a root element, rather than just text.'
9142 );
9143 } else if ((text = text.trim())) {
9144 warnOnce(
9145 ("text \"" + text + "\" outside root element will be ignored.")
9146 );
9147 }
9148 }
9149 return
9150 }
9151 // IE textarea placeholder bug
9152 /* istanbul ignore if */
9153 if (isIE &&
9154 currentParent.tag === 'textarea' &&
9155 currentParent.attrsMap.placeholder === text
9156 ) {
9157 return
9158 }
9159 var children = currentParent.children;
9160 text = inPre || text.trim()
9161 ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
9162 // only preserve whitespace if its not right after a starting tag
9163 : preserveWhitespace && children.length ? ' ' : '';
9164 if (text) {
9165 var res;
9166 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
9167 children.push({
9168 type: 2,
9169 expression: res.expression,
9170 tokens: res.tokens,
9171 text: text
9172 });
9173 } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
9174 children.push({
9175 type: 3,
9176 text: text
9177 });
9178 }
9179 }
9180 },
9181 comment: function comment (text) {
9182 currentParent.children.push({
9183 type: 3,
9184 text: text,
9185 isComment: true
9186 });
9187 }
9188 });
9189 return root
9190}
9191
9192function processPre (el) {
9193 if (getAndRemoveAttr(el, 'v-pre') != null) {
9194 el.pre = true;
9195 }
9196}
9197
9198function processRawAttrs (el) {
9199 var l = el.attrsList.length;
9200 if (l) {
9201 var attrs = el.attrs = new Array(l);
9202 for (var i = 0; i < l; i++) {
9203 attrs[i] = {
9204 name: el.attrsList[i].name,
9205 value: JSON.stringify(el.attrsList[i].value)
9206 };
9207 }
9208 } else if (!el.pre) {
9209 // non root node in pre blocks with no attributes
9210 el.plain = true;
9211 }
9212}
9213
9214function processElement (element, options) {
9215 processKey(element);
9216
9217 // determine whether this is a plain element after
9218 // removing structural attributes
9219 element.plain = !element.key && !element.attrsList.length;
9220
9221 processRef(element);
9222 processSlot(element);
9223 processComponent(element);
9224 for (var i = 0; i < transforms.length; i++) {
9225 element = transforms[i](element, options) || element;
9226 }
9227 processAttrs(element);
9228}
9229
9230function processKey (el) {
9231 var exp = getBindingAttr(el, 'key');
9232 if (exp) {
9233 if ("development" !== 'production' && el.tag === 'template') {
9234 warn$2("<template> cannot be keyed. Place the key on real elements instead.");
9235 }
9236 el.key = exp;
9237 }
9238}
9239
9240function processRef (el) {
9241 var ref = getBindingAttr(el, 'ref');
9242 if (ref) {
9243 el.ref = ref;
9244 el.refInFor = checkInFor(el);
9245 }
9246}
9247
9248function processFor (el) {
9249 var exp;
9250 if ((exp = getAndRemoveAttr(el, 'v-for'))) {
9251 var res = parseFor(exp);
9252 if (res) {
9253 extend(el, res);
9254 } else {
9255 warn$2(
9256 ("Invalid v-for expression: " + exp)
9257 );
9258 }
9259 }
9260}
9261
9262function parseFor (exp) {
9263 var inMatch = exp.match(forAliasRE);
9264 if (!inMatch) { return }
9265 var res = {};
9266 res.for = inMatch[2].trim();
9267 var alias = inMatch[1].trim().replace(stripParensRE, '');
9268 var iteratorMatch = alias.match(forIteratorRE);
9269 if (iteratorMatch) {
9270 res.alias = alias.replace(forIteratorRE, '');
9271 res.iterator1 = iteratorMatch[1].trim();
9272 if (iteratorMatch[2]) {
9273 res.iterator2 = iteratorMatch[2].trim();
9274 }
9275 } else {
9276 res.alias = alias;
9277 }
9278 return res
9279}
9280
9281function processIf (el) {
9282 var exp = getAndRemoveAttr(el, 'v-if');
9283 if (exp) {
9284 el.if = exp;
9285 addIfCondition(el, {
9286 exp: exp,
9287 block: el
9288 });
9289 } else {
9290 if (getAndRemoveAttr(el, 'v-else') != null) {
9291 el.else = true;
9292 }
9293 var elseif = getAndRemoveAttr(el, 'v-else-if');
9294 if (elseif) {
9295 el.elseif = elseif;
9296 }
9297 }
9298}
9299
9300function processIfConditions (el, parent) {
9301 var prev = findPrevElement(parent.children);
9302 if (prev && prev.if) {
9303 addIfCondition(prev, {
9304 exp: el.elseif,
9305 block: el
9306 });
9307 } else {
9308 warn$2(
9309 "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
9310 "used on element <" + (el.tag) + "> without corresponding v-if."
9311 );
9312 }
9313}
9314
9315function findPrevElement (children) {
9316 var i = children.length;
9317 while (i--) {
9318 if (children[i].type === 1) {
9319 return children[i]
9320 } else {
9321 if ("development" !== 'production' && children[i].text !== ' ') {
9322 warn$2(
9323 "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
9324 "will be ignored."
9325 );
9326 }
9327 children.pop();
9328 }
9329 }
9330}
9331
9332function addIfCondition (el, condition) {
9333 if (!el.ifConditions) {
9334 el.ifConditions = [];
9335 }
9336 el.ifConditions.push(condition);
9337}
9338
9339function processOnce (el) {
9340 var once$$1 = getAndRemoveAttr(el, 'v-once');
9341 if (once$$1 != null) {
9342 el.once = true;
9343 }
9344}
9345
9346function processSlot (el) {
9347 if (el.tag === 'slot') {
9348 el.slotName = getBindingAttr(el, 'name');
9349 if ("development" !== 'production' && el.key) {
9350 warn$2(
9351 "`key` does not work on <slot> because slots are abstract outlets " +
9352 "and can possibly expand into multiple elements. " +
9353 "Use the key on a wrapping element instead."
9354 );
9355 }
9356 } else {
9357 var slotScope;
9358 if (el.tag === 'template') {
9359 slotScope = getAndRemoveAttr(el, 'scope');
9360 /* istanbul ignore if */
9361 if ("development" !== 'production' && slotScope) {
9362 warn$2(
9363 "the \"scope\" attribute for scoped slots have been deprecated and " +
9364 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
9365 "can also be used on plain elements in addition to <template> to " +
9366 "denote scoped slots.",
9367 true
9368 );
9369 }
9370 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
9371 } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
9372 /* istanbul ignore if */
9373 if ("development" !== 'production' && el.attrsMap['v-for']) {
9374 warn$2(
9375 "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
9376 "(v-for takes higher priority). Use a wrapper <template> for the " +
9377 "scoped slot to make it clearer.",
9378 true
9379 );
9380 }
9381 el.slotScope = slotScope;
9382 }
9383 var slotTarget = getBindingAttr(el, 'slot');
9384 if (slotTarget) {
9385 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
9386 // preserve slot as an attribute for native shadow DOM compat
9387 // only for non-scoped slots.
9388 if (el.tag !== 'template' && !el.slotScope) {
9389 addAttr(el, 'slot', slotTarget);
9390 }
9391 }
9392 }
9393}
9394
9395function processComponent (el) {
9396 var binding;
9397 if ((binding = getBindingAttr(el, 'is'))) {
9398 el.component = binding;
9399 }
9400 if (getAndRemoveAttr(el, 'inline-template') != null) {
9401 el.inlineTemplate = true;
9402 }
9403}
9404
9405function processAttrs (el) {
9406 var list = el.attrsList;
9407 var i, l, name, rawName, value, modifiers, isProp;
9408 for (i = 0, l = list.length; i < l; i++) {
9409 name = rawName = list[i].name;
9410 value = list[i].value;
9411 if (dirRE.test(name)) {
9412 // mark element as dynamic
9413 el.hasBindings = true;
9414 // modifiers
9415 modifiers = parseModifiers(name);
9416 if (modifiers) {
9417 name = name.replace(modifierRE, '');
9418 }
9419 if (bindRE.test(name)) { // v-bind
9420 name = name.replace(bindRE, '');
9421 value = parseFilters(value);
9422 isProp = false;
9423 if (modifiers) {
9424 if (modifiers.prop) {
9425 isProp = true;
9426 name = camelize(name);
9427 if (name === 'innerHtml') { name = 'innerHTML'; }
9428 }
9429 if (modifiers.camel) {
9430 name = camelize(name);
9431 }
9432 if (modifiers.sync) {
9433 addHandler(
9434 el,
9435 ("update:" + (camelize(name))),
9436 genAssignmentCode(value, "$event")
9437 );
9438 }
9439 }
9440 if (isProp || (
9441 !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
9442 )) {
9443 addProp(el, name, value);
9444 } else {
9445 addAttr(el, name, value);
9446 }
9447 } else if (onRE.test(name)) { // v-on
9448 name = name.replace(onRE, '');
9449 addHandler(el, name, value, modifiers, false, warn$2);
9450 } else { // normal directives
9451 name = name.replace(dirRE, '');
9452 // parse arg
9453 var argMatch = name.match(argRE);
9454 var arg = argMatch && argMatch[1];
9455 if (arg) {
9456 name = name.slice(0, -(arg.length + 1));
9457 }
9458 addDirective(el, name, rawName, value, arg, modifiers);
9459 if ("development" !== 'production' && name === 'model') {
9460 checkForAliasModel(el, value);
9461 }
9462 }
9463 } else {
9464 // literal attribute
9465 {
9466 var res = parseText(value, delimiters);
9467 if (res) {
9468 warn$2(
9469 name + "=\"" + value + "\": " +
9470 'Interpolation inside attributes has been removed. ' +
9471 'Use v-bind or the colon shorthand instead. For example, ' +
9472 'instead of <div id="{{ val }}">, use <div :id="val">.'
9473 );
9474 }
9475 }
9476 addAttr(el, name, JSON.stringify(value));
9477 // #6887 firefox doesn't update muted state if set via attribute
9478 // even immediately after element creation
9479 if (!el.component &&
9480 name === 'muted' &&
9481 platformMustUseProp(el.tag, el.attrsMap.type, name)) {
9482 addProp(el, name, 'true');
9483 }
9484 }
9485 }
9486}
9487
9488function checkInFor (el) {
9489 var parent = el;
9490 while (parent) {
9491 if (parent.for !== undefined) {
9492 return true
9493 }
9494 parent = parent.parent;
9495 }
9496 return false
9497}
9498
9499function parseModifiers (name) {
9500 var match = name.match(modifierRE);
9501 if (match) {
9502 var ret = {};
9503 match.forEach(function (m) { ret[m.slice(1)] = true; });
9504 return ret
9505 }
9506}
9507
9508function makeAttrsMap (attrs) {
9509 var map = {};
9510 for (var i = 0, l = attrs.length; i < l; i++) {
9511 if (
9512 "development" !== 'production' &&
9513 map[attrs[i].name] && !isIE && !isEdge
9514 ) {
9515 warn$2('duplicate attribute: ' + attrs[i].name);
9516 }
9517 map[attrs[i].name] = attrs[i].value;
9518 }
9519 return map
9520}
9521
9522// for script (e.g. type="x/template") or style, do not decode content
9523function isTextTag (el) {
9524 return el.tag === 'script' || el.tag === 'style'
9525}
9526
9527function isForbiddenTag (el) {
9528 return (
9529 el.tag === 'style' ||
9530 (el.tag === 'script' && (
9531 !el.attrsMap.type ||
9532 el.attrsMap.type === 'text/javascript'
9533 ))
9534 )
9535}
9536
9537var ieNSBug = /^xmlns:NS\d+/;
9538var ieNSPrefix = /^NS\d+:/;
9539
9540/* istanbul ignore next */
9541function guardIESVGBug (attrs) {
9542 var res = [];
9543 for (var i = 0; i < attrs.length; i++) {
9544 var attr = attrs[i];
9545 if (!ieNSBug.test(attr.name)) {
9546 attr.name = attr.name.replace(ieNSPrefix, '');
9547 res.push(attr);
9548 }
9549 }
9550 return res
9551}
9552
9553function checkForAliasModel (el, value) {
9554 var _el = el;
9555 while (_el) {
9556 if (_el.for && _el.alias === value) {
9557 warn$2(
9558 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
9559 "You are binding v-model directly to a v-for iteration alias. " +
9560 "This will not be able to modify the v-for source array because " +
9561 "writing to the alias is like modifying a function local variable. " +
9562 "Consider using an array of objects and use v-model on an object property instead."
9563 );
9564 }
9565 _el = _el.parent;
9566 }
9567}
9568
9569/* */
9570
9571/**
9572 * Expand input[v-model] with dyanmic type bindings into v-if-else chains
9573 * Turn this:
9574 * <input v-model="data[type]" :type="type">
9575 * into this:
9576 * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
9577 * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
9578 * <input v-else :type="type" v-model="data[type]">
9579 */
9580
9581function preTransformNode (el, options) {
9582 if (el.tag === 'input') {
9583 var map = el.attrsMap;
9584 if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
9585 var typeBinding = getBindingAttr(el, 'type');
9586 var ifCondition = getAndRemoveAttr(el, 'v-if', true);
9587 var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
9588 var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
9589 var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
9590 // 1. checkbox
9591 var branch0 = cloneASTElement(el);
9592 // process for on the main node
9593 processFor(branch0);
9594 addRawAttr(branch0, 'type', 'checkbox');
9595 processElement(branch0, options);
9596 branch0.processed = true; // prevent it from double-processed
9597 branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
9598 addIfCondition(branch0, {
9599 exp: branch0.if,
9600 block: branch0
9601 });
9602 // 2. add radio else-if condition
9603 var branch1 = cloneASTElement(el);
9604 getAndRemoveAttr(branch1, 'v-for', true);
9605 addRawAttr(branch1, 'type', 'radio');
9606 processElement(branch1, options);
9607 addIfCondition(branch0, {
9608 exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
9609 block: branch1
9610 });
9611 // 3. other
9612 var branch2 = cloneASTElement(el);
9613 getAndRemoveAttr(branch2, 'v-for', true);
9614 addRawAttr(branch2, ':type', typeBinding);
9615 processElement(branch2, options);
9616 addIfCondition(branch0, {
9617 exp: ifCondition,
9618 block: branch2
9619 });
9620
9621 if (hasElse) {
9622 branch0.else = true;
9623 } else if (elseIfCondition) {
9624 branch0.elseif = elseIfCondition;
9625 }
9626
9627 return branch0
9628 }
9629 }
9630}
9631
9632function cloneASTElement (el) {
9633 return createASTElement(el.tag, el.attrsList.slice(), el.parent)
9634}
9635
9636var model$2 = {
9637 preTransformNode: preTransformNode
9638};
9639
9640var modules$1 = [
9641 klass$1,
9642 style$1,
9643 model$2
9644];
9645
9646/* */
9647
9648function text (el, dir) {
9649 if (dir.value) {
9650 addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
9651 }
9652}
9653
9654/* */
9655
9656function html (el, dir) {
9657 if (dir.value) {
9658 addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
9659 }
9660}
9661
9662var directives$1 = {
9663 model: model,
9664 text: text,
9665 html: html
9666};
9667
9668/* */
9669
9670var baseOptions = {
9671 expectHTML: true,
9672 modules: modules$1,
9673 directives: directives$1,
9674 isPreTag: isPreTag,
9675 isUnaryTag: isUnaryTag,
9676 mustUseProp: mustUseProp,
9677 canBeLeftOpenTag: canBeLeftOpenTag,
9678 isReservedTag: isReservedTag,
9679 getTagNamespace: getTagNamespace,
9680 staticKeys: genStaticKeys(modules$1)
9681};
9682
9683/* */
9684
9685var isStaticKey;
9686var isPlatformReservedTag;
9687
9688var genStaticKeysCached = cached(genStaticKeys$1);
9689
9690/**
9691 * Goal of the optimizer: walk the generated template AST tree
9692 * and detect sub-trees that are purely static, i.e. parts of
9693 * the DOM that never needs to change.
9694 *
9695 * Once we detect these sub-trees, we can:
9696 *
9697 * 1. Hoist them into constants, so that we no longer need to
9698 * create fresh nodes for them on each re-render;
9699 * 2. Completely skip them in the patching process.
9700 */
9701function optimize (root, options) {
9702 if (!root) { return }
9703 isStaticKey = genStaticKeysCached(options.staticKeys || '');
9704 isPlatformReservedTag = options.isReservedTag || no;
9705 // first pass: mark all non-static nodes.
9706 markStatic$1(root);
9707 // second pass: mark static roots.
9708 markStaticRoots(root, false);
9709}
9710
9711function genStaticKeys$1 (keys) {
9712 return makeMap(
9713 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
9714 (keys ? ',' + keys : '')
9715 )
9716}
9717
9718function markStatic$1 (node) {
9719 node.static = isStatic(node);
9720 if (node.type === 1) {
9721 // do not make component slot content static. this avoids
9722 // 1. components not able to mutate slot nodes
9723 // 2. static slot content fails for hot-reloading
9724 if (
9725 !isPlatformReservedTag(node.tag) &&
9726 node.tag !== 'slot' &&
9727 node.attrsMap['inline-template'] == null
9728 ) {
9729 return
9730 }
9731 for (var i = 0, l = node.children.length; i < l; i++) {
9732 var child = node.children[i];
9733 markStatic$1(child);
9734 if (!child.static) {
9735 node.static = false;
9736 }
9737 }
9738 if (node.ifConditions) {
9739 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
9740 var block = node.ifConditions[i$1].block;
9741 markStatic$1(block);
9742 if (!block.static) {
9743 node.static = false;
9744 }
9745 }
9746 }
9747 }
9748}
9749
9750function markStaticRoots (node, isInFor) {
9751 if (node.type === 1) {
9752 if (node.static || node.once) {
9753 node.staticInFor = isInFor;
9754 }
9755 // For a node to qualify as a static root, it should have children that
9756 // are not just static text. Otherwise the cost of hoisting out will
9757 // outweigh the benefits and it's better off to just always render it fresh.
9758 if (node.static && node.children.length && !(
9759 node.children.length === 1 &&
9760 node.children[0].type === 3
9761 )) {
9762 node.staticRoot = true;
9763 return
9764 } else {
9765 node.staticRoot = false;
9766 }
9767 if (node.children) {
9768 for (var i = 0, l = node.children.length; i < l; i++) {
9769 markStaticRoots(node.children[i], isInFor || !!node.for);
9770 }
9771 }
9772 if (node.ifConditions) {
9773 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
9774 markStaticRoots(node.ifConditions[i$1].block, isInFor);
9775 }
9776 }
9777 }
9778}
9779
9780function isStatic (node) {
9781 if (node.type === 2) { // expression
9782 return false
9783 }
9784 if (node.type === 3) { // text
9785 return true
9786 }
9787 return !!(node.pre || (
9788 !node.hasBindings && // no dynamic bindings
9789 !node.if && !node.for && // not v-if or v-for or v-else
9790 !isBuiltInTag(node.tag) && // not a built-in
9791 isPlatformReservedTag(node.tag) && // not a component
9792 !isDirectChildOfTemplateFor(node) &&
9793 Object.keys(node).every(isStaticKey)
9794 ))
9795}
9796
9797function isDirectChildOfTemplateFor (node) {
9798 while (node.parent) {
9799 node = node.parent;
9800 if (node.tag !== 'template') {
9801 return false
9802 }
9803 if (node.for) {
9804 return true
9805 }
9806 }
9807 return false
9808}
9809
9810/* */
9811
9812var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
9813var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
9814
9815// keyCode aliases
9816var keyCodes = {
9817 esc: 27,
9818 tab: 9,
9819 enter: 13,
9820 space: 32,
9821 up: 38,
9822 left: 37,
9823 right: 39,
9824 down: 40,
9825 'delete': [8, 46]
9826};
9827
9828// #4868: modifiers that prevent the execution of the listener
9829// need to explicitly return null so that we can determine whether to remove
9830// the listener for .once
9831var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
9832
9833var modifierCode = {
9834 stop: '$event.stopPropagation();',
9835 prevent: '$event.preventDefault();',
9836 self: genGuard("$event.target !== $event.currentTarget"),
9837 ctrl: genGuard("!$event.ctrlKey"),
9838 shift: genGuard("!$event.shiftKey"),
9839 alt: genGuard("!$event.altKey"),
9840 meta: genGuard("!$event.metaKey"),
9841 left: genGuard("'button' in $event && $event.button !== 0"),
9842 middle: genGuard("'button' in $event && $event.button !== 1"),
9843 right: genGuard("'button' in $event && $event.button !== 2")
9844};
9845
9846function genHandlers (
9847 events,
9848 isNative,
9849 warn
9850) {
9851 var res = isNative ? 'nativeOn:{' : 'on:{';
9852 for (var name in events) {
9853 res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
9854 }
9855 return res.slice(0, -1) + '}'
9856}
9857
9858function genHandler (
9859 name,
9860 handler
9861) {
9862 if (!handler) {
9863 return 'function(){}'
9864 }
9865
9866 if (Array.isArray(handler)) {
9867 return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
9868 }
9869
9870 var isMethodPath = simplePathRE.test(handler.value);
9871 var isFunctionExpression = fnExpRE.test(handler.value);
9872
9873 if (!handler.modifiers) {
9874 if (isMethodPath || isFunctionExpression) {
9875 return handler.value
9876 }
9877 /* istanbul ignore if */
9878 return ("function($event){" + (handler.value) + "}") // inline statement
9879 } else {
9880 var code = '';
9881 var genModifierCode = '';
9882 var keys = [];
9883 for (var key in handler.modifiers) {
9884 if (modifierCode[key]) {
9885 genModifierCode += modifierCode[key];
9886 // left/right
9887 if (keyCodes[key]) {
9888 keys.push(key);
9889 }
9890 } else if (key === 'exact') {
9891 var modifiers = (handler.modifiers);
9892 genModifierCode += genGuard(
9893 ['ctrl', 'shift', 'alt', 'meta']
9894 .filter(function (keyModifier) { return !modifiers[keyModifier]; })
9895 .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
9896 .join('||')
9897 );
9898 } else {
9899 keys.push(key);
9900 }
9901 }
9902 if (keys.length) {
9903 code += genKeyFilter(keys);
9904 }
9905 // Make sure modifiers like prevent and stop get executed after key filtering
9906 if (genModifierCode) {
9907 code += genModifierCode;
9908 }
9909 var handlerCode = isMethodPath
9910 ? handler.value + '($event)'
9911 : isFunctionExpression
9912 ? ("(" + (handler.value) + ")($event)")
9913 : handler.value;
9914 /* istanbul ignore if */
9915 return ("function($event){" + code + handlerCode + "}")
9916 }
9917}
9918
9919function genKeyFilter (keys) {
9920 return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
9921}
9922
9923function genFilterCode (key) {
9924 var keyVal = parseInt(key, 10);
9925 if (keyVal) {
9926 return ("$event.keyCode!==" + keyVal)
9927 }
9928 var code = keyCodes[key];
9929 return (
9930 "_k($event.keyCode," +
9931 (JSON.stringify(key)) + "," +
9932 (JSON.stringify(code)) + "," +
9933 "$event.key)"
9934 )
9935}
9936
9937/* */
9938
9939function on (el, dir) {
9940 if ("development" !== 'production' && dir.modifiers) {
9941 warn("v-on without argument does not support modifiers.");
9942 }
9943 el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
9944}
9945
9946/* */
9947
9948function bind$1 (el, dir) {
9949 el.wrapData = function (code) {
9950 return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
9951 };
9952}
9953
9954/* */
9955
9956var baseDirectives = {
9957 on: on,
9958 bind: bind$1,
9959 cloak: noop
9960};
9961
9962/* */
9963
9964var CodegenState = function CodegenState (options) {
9965 this.options = options;
9966 this.warn = options.warn || baseWarn;
9967 this.transforms = pluckModuleFunction(options.modules, 'transformCode');
9968 this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
9969 this.directives = extend(extend({}, baseDirectives), options.directives);
9970 var isReservedTag = options.isReservedTag || no;
9971 this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
9972 this.onceId = 0;
9973 this.staticRenderFns = [];
9974};
9975
9976
9977
9978function generate (
9979 ast,
9980 options
9981) {
9982 var state = new CodegenState(options);
9983 var code = ast ? genElement(ast, state) : '_c("div")';
9984 return {
9985 render: ("with(this){return " + code + "}"),
9986 staticRenderFns: state.staticRenderFns
9987 }
9988}
9989
9990function genElement (el, state) {
9991 if (el.staticRoot && !el.staticProcessed) {
9992 return genStatic(el, state)
9993 } else if (el.once && !el.onceProcessed) {
9994 return genOnce(el, state)
9995 } else if (el.for && !el.forProcessed) {
9996 return genFor(el, state)
9997 } else if (el.if && !el.ifProcessed) {
9998 return genIf(el, state)
9999 } else if (el.tag === 'template' && !el.slotTarget) {
10000 return genChildren(el, state) || 'void 0'
10001 } else if (el.tag === 'slot') {
10002 return genSlot(el, state)
10003 } else {
10004 // component or element
10005 var code;
10006 if (el.component) {
10007 code = genComponent(el.component, el, state);
10008 } else {
10009 var data = el.plain ? undefined : genData$2(el, state);
10010
10011 var children = el.inlineTemplate ? null : genChildren(el, state, true);
10012 code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
10013 }
10014 // module transforms
10015 for (var i = 0; i < state.transforms.length; i++) {
10016 code = state.transforms[i](el, code);
10017 }
10018 return code
10019 }
10020}
10021
10022// hoist static sub-trees out
10023function genStatic (el, state) {
10024 el.staticProcessed = true;
10025 state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
10026 return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
10027}
10028
10029// v-once
10030function genOnce (el, state) {
10031 el.onceProcessed = true;
10032 if (el.if && !el.ifProcessed) {
10033 return genIf(el, state)
10034 } else if (el.staticInFor) {
10035 var key = '';
10036 var parent = el.parent;
10037 while (parent) {
10038 if (parent.for) {
10039 key = parent.key;
10040 break
10041 }
10042 parent = parent.parent;
10043 }
10044 if (!key) {
10045 "development" !== 'production' && state.warn(
10046 "v-once can only be used inside v-for that is keyed. "
10047 );
10048 return genElement(el, state)
10049 }
10050 return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
10051 } else {
10052 return genStatic(el, state)
10053 }
10054}
10055
10056function genIf (
10057 el,
10058 state,
10059 altGen,
10060 altEmpty
10061) {
10062 el.ifProcessed = true; // avoid recursion
10063 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
10064}
10065
10066function genIfConditions (
10067 conditions,
10068 state,
10069 altGen,
10070 altEmpty
10071) {
10072 if (!conditions.length) {
10073 return altEmpty || '_e()'
10074 }
10075
10076 var condition = conditions.shift();
10077 if (condition.exp) {
10078 return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
10079 } else {
10080 return ("" + (genTernaryExp(condition.block)))
10081 }
10082
10083 // v-if with v-once should generate code like (a)?_m(0):_m(1)
10084 function genTernaryExp (el) {
10085 return altGen
10086 ? altGen(el, state)
10087 : el.once
10088 ? genOnce(el, state)
10089 : genElement(el, state)
10090 }
10091}
10092
10093function genFor (
10094 el,
10095 state,
10096 altGen,
10097 altHelper
10098) {
10099 var exp = el.for;
10100 var alias = el.alias;
10101 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
10102 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
10103
10104 if ("development" !== 'production' &&
10105 state.maybeComponent(el) &&
10106 el.tag !== 'slot' &&
10107 el.tag !== 'template' &&
10108 !el.key
10109 ) {
10110 state.warn(
10111 "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
10112 "v-for should have explicit keys. " +
10113 "See https://vuejs.org/guide/list.html#key for more info.",
10114 true /* tip */
10115 );
10116 }
10117
10118 el.forProcessed = true; // avoid recursion
10119 return (altHelper || '_l') + "((" + exp + ")," +
10120 "function(" + alias + iterator1 + iterator2 + "){" +
10121 "return " + ((altGen || genElement)(el, state)) +
10122 '})'
10123}
10124
10125function genData$2 (el, state) {
10126 var data = '{';
10127
10128 // directives first.
10129 // directives may mutate the el's other properties before they are generated.
10130 var dirs = genDirectives(el, state);
10131 if (dirs) { data += dirs + ','; }
10132
10133 // key
10134 if (el.key) {
10135 data += "key:" + (el.key) + ",";
10136 }
10137 // ref
10138 if (el.ref) {
10139 data += "ref:" + (el.ref) + ",";
10140 }
10141 if (el.refInFor) {
10142 data += "refInFor:true,";
10143 }
10144 // pre
10145 if (el.pre) {
10146 data += "pre:true,";
10147 }
10148 // record original tag name for components using "is" attribute
10149 if (el.component) {
10150 data += "tag:\"" + (el.tag) + "\",";
10151 }
10152 // module data generation functions
10153 for (var i = 0; i < state.dataGenFns.length; i++) {
10154 data += state.dataGenFns[i](el);
10155 }
10156 // attributes
10157 if (el.attrs) {
10158 data += "attrs:{" + (genProps(el.attrs)) + "},";
10159 }
10160 // DOM props
10161 if (el.props) {
10162 data += "domProps:{" + (genProps(el.props)) + "},";
10163 }
10164 // event handlers
10165 if (el.events) {
10166 data += (genHandlers(el.events, false, state.warn)) + ",";
10167 }
10168 if (el.nativeEvents) {
10169 data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
10170 }
10171 // slot target
10172 // only for non-scoped slots
10173 if (el.slotTarget && !el.slotScope) {
10174 data += "slot:" + (el.slotTarget) + ",";
10175 }
10176 // scoped slots
10177 if (el.scopedSlots) {
10178 data += (genScopedSlots(el.scopedSlots, state)) + ",";
10179 }
10180 // component v-model
10181 if (el.model) {
10182 data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
10183 }
10184 // inline-template
10185 if (el.inlineTemplate) {
10186 var inlineTemplate = genInlineTemplate(el, state);
10187 if (inlineTemplate) {
10188 data += inlineTemplate + ",";
10189 }
10190 }
10191 data = data.replace(/,$/, '') + '}';
10192 // v-bind data wrap
10193 if (el.wrapData) {
10194 data = el.wrapData(data);
10195 }
10196 // v-on data wrap
10197 if (el.wrapListeners) {
10198 data = el.wrapListeners(data);
10199 }
10200 return data
10201}
10202
10203function genDirectives (el, state) {
10204 var dirs = el.directives;
10205 if (!dirs) { return }
10206 var res = 'directives:[';
10207 var hasRuntime = false;
10208 var i, l, dir, needRuntime;
10209 for (i = 0, l = dirs.length; i < l; i++) {
10210 dir = dirs[i];
10211 needRuntime = true;
10212 var gen = state.directives[dir.name];
10213 if (gen) {
10214 // compile-time directive that manipulates AST.
10215 // returns true if it also needs a runtime counterpart.
10216 needRuntime = !!gen(el, dir, state.warn);
10217 }
10218 if (needRuntime) {
10219 hasRuntime = true;
10220 res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
10221 }
10222 }
10223 if (hasRuntime) {
10224 return res.slice(0, -1) + ']'
10225 }
10226}
10227
10228function genInlineTemplate (el, state) {
10229 var ast = el.children[0];
10230 if ("development" !== 'production' && (
10231 el.children.length !== 1 || ast.type !== 1
10232 )) {
10233 state.warn('Inline-template components must have exactly one child element.');
10234 }
10235 if (ast.type === 1) {
10236 var inlineRenderFns = generate(ast, state.options);
10237 return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
10238 }
10239}
10240
10241function genScopedSlots (
10242 slots,
10243 state
10244) {
10245 return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
10246 return genScopedSlot(key, slots[key], state)
10247 }).join(',')) + "])")
10248}
10249
10250function genScopedSlot (
10251 key,
10252 el,
10253 state
10254) {
10255 if (el.for && !el.forProcessed) {
10256 return genForScopedSlot(key, el, state)
10257 }
10258 var fn = "function(" + (String(el.slotScope)) + "){" +
10259 "return " + (el.tag === 'template'
10260 ? el.if
10261 ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
10262 : genChildren(el, state) || 'undefined'
10263 : genElement(el, state)) + "}";
10264 return ("{key:" + key + ",fn:" + fn + "}")
10265}
10266
10267function genForScopedSlot (
10268 key,
10269 el,
10270 state
10271) {
10272 var exp = el.for;
10273 var alias = el.alias;
10274 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
10275 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
10276 el.forProcessed = true; // avoid recursion
10277 return "_l((" + exp + ")," +
10278 "function(" + alias + iterator1 + iterator2 + "){" +
10279 "return " + (genScopedSlot(key, el, state)) +
10280 '})'
10281}
10282
10283function genChildren (
10284 el,
10285 state,
10286 checkSkip,
10287 altGenElement,
10288 altGenNode
10289) {
10290 var children = el.children;
10291 if (children.length) {
10292 var el$1 = children[0];
10293 // optimize single v-for
10294 if (children.length === 1 &&
10295 el$1.for &&
10296 el$1.tag !== 'template' &&
10297 el$1.tag !== 'slot'
10298 ) {
10299 return (altGenElement || genElement)(el$1, state)
10300 }
10301 var normalizationType = checkSkip
10302 ? getNormalizationType(children, state.maybeComponent)
10303 : 0;
10304 var gen = altGenNode || genNode;
10305 return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
10306 }
10307}
10308
10309// determine the normalization needed for the children array.
10310// 0: no normalization needed
10311// 1: simple normalization needed (possible 1-level deep nested array)
10312// 2: full normalization needed
10313function getNormalizationType (
10314 children,
10315 maybeComponent
10316) {
10317 var res = 0;
10318 for (var i = 0; i < children.length; i++) {
10319 var el = children[i];
10320 if (el.type !== 1) {
10321 continue
10322 }
10323 if (needsNormalization(el) ||
10324 (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
10325 res = 2;
10326 break
10327 }
10328 if (maybeComponent(el) ||
10329 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
10330 res = 1;
10331 }
10332 }
10333 return res
10334}
10335
10336function needsNormalization (el) {
10337 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
10338}
10339
10340function genNode (node, state) {
10341 if (node.type === 1) {
10342 return genElement(node, state)
10343 } if (node.type === 3 && node.isComment) {
10344 return genComment(node)
10345 } else {
10346 return genText(node)
10347 }
10348}
10349
10350function genText (text) {
10351 return ("_v(" + (text.type === 2
10352 ? text.expression // no need for () because already wrapped in _s()
10353 : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
10354}
10355
10356function genComment (comment) {
10357 return ("_e(" + (JSON.stringify(comment.text)) + ")")
10358}
10359
10360function genSlot (el, state) {
10361 var slotName = el.slotName || '"default"';
10362 var children = genChildren(el, state);
10363 var res = "_t(" + slotName + (children ? ("," + children) : '');
10364 var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
10365 var bind$$1 = el.attrsMap['v-bind'];
10366 if ((attrs || bind$$1) && !children) {
10367 res += ",null";
10368 }
10369 if (attrs) {
10370 res += "," + attrs;
10371 }
10372 if (bind$$1) {
10373 res += (attrs ? '' : ',null') + "," + bind$$1;
10374 }
10375 return res + ')'
10376}
10377
10378// componentName is el.component, take it as argument to shun flow's pessimistic refinement
10379function genComponent (
10380 componentName,
10381 el,
10382 state
10383) {
10384 var children = el.inlineTemplate ? null : genChildren(el, state, true);
10385 return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
10386}
10387
10388function genProps (props) {
10389 var res = '';
10390 for (var i = 0; i < props.length; i++) {
10391 var prop = props[i];
10392 /* istanbul ignore if */
10393 {
10394 res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
10395 }
10396 }
10397 return res.slice(0, -1)
10398}
10399
10400// #3895, #4268
10401function transformSpecialNewlines (text) {
10402 return text
10403 .replace(/\u2028/g, '\\u2028')
10404 .replace(/\u2029/g, '\\u2029')
10405}
10406
10407/* */
10408
10409// these keywords should not appear inside expressions, but operators like
10410// typeof, instanceof and in are allowed
10411var prohibitedKeywordRE = new RegExp('\\b' + (
10412 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
10413 'super,throw,while,yield,delete,export,import,return,switch,default,' +
10414 'extends,finally,continue,debugger,function,arguments'
10415).split(',').join('\\b|\\b') + '\\b');
10416
10417// these unary operators should not be used as property/method names
10418var unaryOperatorsRE = new RegExp('\\b' + (
10419 'delete,typeof,void'
10420).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
10421
10422// strip strings in expressions
10423var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
10424
10425// detect problematic expressions in a template
10426function detectErrors (ast) {
10427 var errors = [];
10428 if (ast) {
10429 checkNode(ast, errors);
10430 }
10431 return errors
10432}
10433
10434function checkNode (node, errors) {
10435 if (node.type === 1) {
10436 for (var name in node.attrsMap) {
10437 if (dirRE.test(name)) {
10438 var value = node.attrsMap[name];
10439 if (value) {
10440 if (name === 'v-for') {
10441 checkFor(node, ("v-for=\"" + value + "\""), errors);
10442 } else if (onRE.test(name)) {
10443 checkEvent(value, (name + "=\"" + value + "\""), errors);
10444 } else {
10445 checkExpression(value, (name + "=\"" + value + "\""), errors);
10446 }
10447 }
10448 }
10449 }
10450 if (node.children) {
10451 for (var i = 0; i < node.children.length; i++) {
10452 checkNode(node.children[i], errors);
10453 }
10454 }
10455 } else if (node.type === 2) {
10456 checkExpression(node.expression, node.text, errors);
10457 }
10458}
10459
10460function checkEvent (exp, text, errors) {
10461 var stipped = exp.replace(stripStringRE, '');
10462 var keywordMatch = stipped.match(unaryOperatorsRE);
10463 if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
10464 errors.push(
10465 "avoid using JavaScript unary operator as property name: " +
10466 "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
10467 );
10468 }
10469 checkExpression(exp, text, errors);
10470}
10471
10472function checkFor (node, text, errors) {
10473 checkExpression(node.for || '', text, errors);
10474 checkIdentifier(node.alias, 'v-for alias', text, errors);
10475 checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
10476 checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
10477}
10478
10479function checkIdentifier (
10480 ident,
10481 type,
10482 text,
10483 errors
10484) {
10485 if (typeof ident === 'string') {
10486 try {
10487 new Function(("var " + ident + "=_"));
10488 } catch (e) {
10489 errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
10490 }
10491 }
10492}
10493
10494function checkExpression (exp, text, errors) {
10495 try {
10496 new Function(("return " + exp));
10497 } catch (e) {
10498 var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
10499 if (keywordMatch) {
10500 errors.push(
10501 "avoid using JavaScript keyword as property name: " +
10502 "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
10503 );
10504 } else {
10505 errors.push(
10506 "invalid expression: " + (e.message) + " in\n\n" +
10507 " " + exp + "\n\n" +
10508 " Raw expression: " + (text.trim()) + "\n"
10509 );
10510 }
10511 }
10512}
10513
10514/* */
10515
10516function createFunction (code, errors) {
10517 try {
10518 return new Function(code)
10519 } catch (err) {
10520 errors.push({ err: err, code: code });
10521 return noop
10522 }
10523}
10524
10525function createCompileToFunctionFn (compile) {
10526 var cache = Object.create(null);
10527
10528 return function compileToFunctions (
10529 template,
10530 options,
10531 vm
10532 ) {
10533 options = extend({}, options);
10534 var warn$$1 = options.warn || warn;
10535 delete options.warn;
10536
10537 /* istanbul ignore if */
10538 {
10539 // detect possible CSP restriction
10540 try {
10541 new Function('return 1');
10542 } catch (e) {
10543 if (e.toString().match(/unsafe-eval|CSP/)) {
10544 warn$$1(
10545 'It seems you are using the standalone build of Vue.js in an ' +
10546 'environment with Content Security Policy that prohibits unsafe-eval. ' +
10547 'The template compiler cannot work in this environment. Consider ' +
10548 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
10549 'templates into render functions.'
10550 );
10551 }
10552 }
10553 }
10554
10555 // check cache
10556 var key = options.delimiters
10557 ? String(options.delimiters) + template
10558 : template;
10559 if (cache[key]) {
10560 return cache[key]
10561 }
10562
10563 // compile
10564 var compiled = compile(template, options);
10565
10566 // check compilation errors/tips
10567 {
10568 if (compiled.errors && compiled.errors.length) {
10569 warn$$1(
10570 "Error compiling template:\n\n" + template + "\n\n" +
10571 compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
10572 vm
10573 );
10574 }
10575 if (compiled.tips && compiled.tips.length) {
10576 compiled.tips.forEach(function (msg) { return tip(msg, vm); });
10577 }
10578 }
10579
10580 // turn code into functions
10581 var res = {};
10582 var fnGenErrors = [];
10583 res.render = createFunction(compiled.render, fnGenErrors);
10584 res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
10585 return createFunction(code, fnGenErrors)
10586 });
10587
10588 // check function generation errors.
10589 // this should only happen if there is a bug in the compiler itself.
10590 // mostly for codegen development use
10591 /* istanbul ignore if */
10592 {
10593 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
10594 warn$$1(
10595 "Failed to generate render function:\n\n" +
10596 fnGenErrors.map(function (ref) {
10597 var err = ref.err;
10598 var code = ref.code;
10599
10600 return ((err.toString()) + " in\n\n" + code + "\n");
10601 }).join('\n'),
10602 vm
10603 );
10604 }
10605 }
10606
10607 return (cache[key] = res)
10608 }
10609}
10610
10611/* */
10612
10613function createCompilerCreator (baseCompile) {
10614 return function createCompiler (baseOptions) {
10615 function compile (
10616 template,
10617 options
10618 ) {
10619 var finalOptions = Object.create(baseOptions);
10620 var errors = [];
10621 var tips = [];
10622 finalOptions.warn = function (msg, tip) {
10623 (tip ? tips : errors).push(msg);
10624 };
10625
10626 if (options) {
10627 // merge custom modules
10628 if (options.modules) {
10629 finalOptions.modules =
10630 (baseOptions.modules || []).concat(options.modules);
10631 }
10632 // merge custom directives
10633 if (options.directives) {
10634 finalOptions.directives = extend(
10635 Object.create(baseOptions.directives || null),
10636 options.directives
10637 );
10638 }
10639 // copy other options
10640 for (var key in options) {
10641 if (key !== 'modules' && key !== 'directives') {
10642 finalOptions[key] = options[key];
10643 }
10644 }
10645 }
10646
10647 var compiled = baseCompile(template, finalOptions);
10648 {
10649 errors.push.apply(errors, detectErrors(compiled.ast));
10650 }
10651 compiled.errors = errors;
10652 compiled.tips = tips;
10653 return compiled
10654 }
10655
10656 return {
10657 compile: compile,
10658 compileToFunctions: createCompileToFunctionFn(compile)
10659 }
10660 }
10661}
10662
10663/* */
10664
10665// `createCompilerCreator` allows creating compilers that use alternative
10666// parser/optimizer/codegen, e.g the SSR optimizing compiler.
10667// Here we just export a default compiler using the default parts.
10668var createCompiler = createCompilerCreator(function baseCompile (
10669 template,
10670 options
10671) {
10672 var ast = parse(template.trim(), options);
10673 if (options.optimize !== false) {
10674 optimize(ast, options);
10675 }
10676 var code = generate(ast, options);
10677 return {
10678 ast: ast,
10679 render: code.render,
10680 staticRenderFns: code.staticRenderFns
10681 }
10682});
10683
10684/* */
10685
10686var ref$1 = createCompiler(baseOptions);
10687var compileToFunctions = ref$1.compileToFunctions;
10688
10689/* */
10690
10691// check whether current browser encodes a char inside attribute values
10692var div;
10693function getShouldDecode (href) {
10694 div = div || document.createElement('div');
10695 div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
10696 return div.innerHTML.indexOf(' ') > 0
10697}
10698
10699// #3663: IE encodes newlines inside attribute values while other browsers don't
10700var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
10701// #6828: chrome encodes content in a[href]
10702var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
10703
10704/* */
10705
10706var idToTemplate = cached(function (id) {
10707 var el = query(id);
10708 return el && el.innerHTML
10709});
10710
10711var mount = Vue$3.prototype.$mount;
10712Vue$3.prototype.$mount = function (
10713 el,
10714 hydrating
10715) {
10716 el = el && query(el);
10717
10718 /* istanbul ignore if */
10719 if (el === document.body || el === document.documentElement) {
10720 "development" !== 'production' && warn(
10721 "Do not mount Vue to <html> or <body> - mount to normal elements instead."
10722 );
10723 return this
10724 }
10725
10726 var options = this.$options;
10727 // resolve template/el and convert to render function
10728 if (!options.render) {
10729 var template = options.template;
10730 if (template) {
10731 if (typeof template === 'string') {
10732 if (template.charAt(0) === '#') {
10733 template = idToTemplate(template);
10734 /* istanbul ignore if */
10735 if ("development" !== 'production' && !template) {
10736 warn(
10737 ("Template element not found or is empty: " + (options.template)),
10738 this
10739 );
10740 }
10741 }
10742 } else if (template.nodeType) {
10743 template = template.innerHTML;
10744 } else {
10745 {
10746 warn('invalid template option:' + template, this);
10747 }
10748 return this
10749 }
10750 } else if (el) {
10751 template = getOuterHTML(el);
10752 }
10753 if (template) {
10754 /* istanbul ignore if */
10755 if ("development" !== 'production' && config.performance && mark) {
10756 mark('compile');
10757 }
10758
10759 var ref = compileToFunctions(template, {
10760 shouldDecodeNewlines: shouldDecodeNewlines,
10761 shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
10762 delimiters: options.delimiters,
10763 comments: options.comments
10764 }, this);
10765 var render = ref.render;
10766 var staticRenderFns = ref.staticRenderFns;
10767 options.render = render;
10768 options.staticRenderFns = staticRenderFns;
10769
10770 /* istanbul ignore if */
10771 if ("development" !== 'production' && config.performance && mark) {
10772 mark('compile end');
10773 measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
10774 }
10775 }
10776 }
10777 return mount.call(this, el, hydrating)
10778};
10779
10780/**
10781 * Get outerHTML of elements, taking care
10782 * of SVG elements in IE as well.
10783 */
10784function getOuterHTML (el) {
10785 if (el.outerHTML) {
10786 return el.outerHTML
10787 } else {
10788 var container = document.createElement('div');
10789 container.appendChild(el.cloneNode(true));
10790 return container.innerHTML
10791 }
10792}
10793
10794Vue$3.compile = compileToFunctions;
10795
10796return Vue$3;
10797
10798})));