UNPKG

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