UNPKG

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