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