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