UNPKG

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