1 (function webpackUniversalModuleDefinition(root
, factory
) {
2 if(typeof exports
=== 'object' && typeof module
=== 'object')
3 module
.exports
= factory();
4 else if(typeof define
=== 'function' && define
.amd
)
6 else if(typeof exports
=== 'object')
7 exports
["SortingHat"] = factory();
9 root
["SortingHat"] = factory();
11 return /******/ (function(modules
) { // webpackBootstrap
12 /******/ // The module cache
13 /******/ var installedModules
= {};
15 /******/ // The require function
16 /******/ function __webpack_require__(moduleId
) {
18 /******/ // Check if module is in cache
19 /******/ if(installedModules
[moduleId
]) {
20 /******/ return installedModules
[moduleId
].exports
;
22 /******/ // Create a new module (and put it into the cache)
23 /******/ var module
= installedModules
[moduleId
] = {
29 /******/ // Execute the module function
30 /******/ modules
[moduleId
].call(module
.exports
, module
, module
.exports
, __webpack_require__
);
32 /******/ // Flag the module as loaded
33 /******/ module
.l
= true;
35 /******/ // Return the exports of the module
36 /******/ return module
.exports
;
40 /******/ // expose the modules object (__webpack_modules__)
41 /******/ __webpack_require__
.m
= modules
;
43 /******/ // expose the module cache
44 /******/ __webpack_require__
.c
= installedModules
;
46 /******/ // define getter function for harmony exports
47 /******/ __webpack_require__
.d = function(exports
, name
, getter
) {
48 /******/ if(!__webpack_require__
.o(exports
, name
)) {
49 /******/ Object
.defineProperty(exports
, name
, {
50 /******/ configurable: false,
51 /******/ enumerable: true,
57 /******/ // getDefaultExport function for compatibility with non-harmony modules
58 /******/ __webpack_require__
.n = function(module
) {
59 /******/ var getter
= module
&& module
.__esModule
?
60 /******/ function getDefault() { return module
['default']; } :
61 /******/ function getModuleExports() { return module
; };
62 /******/ __webpack_require__
.d(getter
, 'a', getter
);
63 /******/ return getter
;
66 /******/ // Object.prototype.hasOwnProperty.call
67 /******/ __webpack_require__
.o = function(object
, property
) { return Object
.prototype.hasOwnProperty
.call(object
, property
); };
69 /******/ // __webpack_public_path__
70 /******/ __webpack_require__
.p
= "/assets/";
72 /******/ // Load entry module and return exports
73 /******/ return __webpack_require__(__webpack_require__
.s
= 2);
75 /************************************************************************/
78 /***/ (function(module
, __webpack_exports__
, __webpack_require__
) {
81 /* WEBPACK VAR INJECTION */(function(process
, global
) {/*!
83 * (c) 2014-2017 Evan You
84 * Released under the MIT License.
88 // these helpers produces better vm code in JS engines due to their
89 // explicitness and function inlining
91 return v
=== undefined || v
=== null;
95 return v
!== undefined && v
!== null;
102 function isFalse(v
) {
107 * Check if value is primitive
109 function isPrimitive(value
) {
110 return typeof value
=== 'string' || typeof value
=== 'number' || typeof value
=== 'boolean';
114 * Quick object check - this is primarily used to tell
115 * Objects from primitive values when we know the value
116 * is a JSON-compliant type.
118 function isObject(obj
) {
119 return obj
!== null && typeof obj
=== 'object';
122 var _toString
= Object
.prototype.toString
;
125 * Strict object type check. Only returns true
126 * for plain JavaScript objects.
128 function isPlainObject(obj
) {
129 return _toString
.call(obj
) === '[object Object]';
132 function isRegExp(v
) {
133 return _toString
.call(v
) === '[object RegExp]';
137 * Check if val is a valid array index.
139 function isValidArrayIndex(val
) {
140 var n
= parseFloat(val
);
141 return n
>= 0 && Math
.floor(n
) === n
&& isFinite(val
);
145 * Convert a value to a string that is actually rendered.
147 function toString(val
) {
148 return val
== null ? '' : typeof val
=== 'object' ? JSON
.stringify(val
, null, 2) : String(val
);
152 * Convert a input value to a number for persistence.
153 * If the conversion fails, return original string.
155 function toNumber(val
) {
156 var n
= parseFloat(val
);
157 return isNaN(n
) ? val : n
;
161 * Make a map and return a function for checking if a key
164 function makeMap(str
, expectsLowerCase
) {
165 var map
= Object
.create(null);
166 var list
= str
.split(',');
167 for (var i
= 0; i
< list
.length
; i
++) {
170 return expectsLowerCase
? function (val
) {
171 return map
[val
.toLowerCase()];
178 * Check if a tag is a built-in tag.
180 var isBuiltInTag
= makeMap('slot,component', true);
183 * Check if a attribute is a reserved attribute.
185 var isReservedAttribute
= makeMap('key,ref,slot,is');
188 * Remove an item from an array
190 function remove(arr
, item
) {
192 var index
= arr
.indexOf(item
);
194 return arr
.splice(index
, 1);
200 * Check whether the object has the property.
202 var hasOwnProperty
= Object
.prototype.hasOwnProperty
;
203 function hasOwn(obj
, key
) {
204 return hasOwnProperty
.call(obj
, key
);
208 * Create a cached version of a pure function.
210 function cached(fn
) {
211 var cache
= Object
.create(null);
212 return function cachedFn(str
) {
213 var hit
= cache
[str
];
214 return hit
|| (cache
[str
] = fn(str
));
219 * Camelize a hyphen-delimited string.
221 var camelizeRE
= /-(\w)/g;
222 var camelize
= cached(function (str
) {
223 return str
.replace(camelizeRE
, function (_
, c
) {
224 return c
? c
.toUpperCase() : '';
229 * Capitalize a string.
231 var capitalize
= cached(function (str
) {
232 return str
.charAt(0).toUpperCase() + str
.slice(1);
236 * Hyphenate a camelCase string.
238 var hyphenateRE
= /([^-])([A-Z])/g;
239 var hyphenate
= cached(function (str
) {
240 return str
.replace(hyphenateRE
, '$1-$2').replace(hyphenateRE
, '$1-$2').toLowerCase();
244 * Simple bind, faster than native
246 function bind(fn
, ctx
) {
247 function boundFn(a
) {
248 var l
= arguments
.length
;
249 return l
? l
> 1 ? fn
.apply(ctx
, arguments
) : fn
.call(ctx
, a
) : fn
.call(ctx
);
251 // record original fn length
252 boundFn
._length
= fn
.length
;
257 * Convert an Array-like object to a real Array.
259 function toArray(list
, start
) {
261 var i
= list
.length
- start
;
262 var ret
= new Array(i
);
264 ret
[i
] = list
[i
+ start
];
270 * Mix properties into target object.
272 function extend(to
, _from
) {
273 for (var key
in _from
) {
274 to
[key
] = _from
[key
];
280 * Merge an Array of Objects into a single Object.
282 function toObject(arr
) {
284 for (var i
= 0; i
< arr
.length
; i
++) {
293 * Perform no operation.
294 * Stubbing args to make Flow happy without leaving useless transpiled code
295 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
297 function noop(a
, b
, c
) {}
300 * Always return false.
302 var no = function (a
, b
, c
) {
309 var identity = function (_
) {
314 * Generate a static keys string from compiler modules.
316 function genStaticKeys(modules
) {
317 return modules
.reduce(function (keys
, m
) {
318 return keys
.concat(m
.staticKeys
|| []);
323 * Check if two values are loosely equal - that is,
324 * if they are plain objects, do they have the same shape?
326 function looseEqual(a
, b
) {
330 var isObjectA
= isObject(a
);
331 var isObjectB
= isObject(b
);
332 if (isObjectA
&& isObjectB
) {
334 var isArrayA
= Array
.isArray(a
);
335 var isArrayB
= Array
.isArray(b
);
336 if (isArrayA
&& isArrayB
) {
337 return a
.length
=== b
.length
&& a
.every(function (e
, i
) {
338 return looseEqual(e
, b
[i
]);
340 } else if (!isArrayA
&& !isArrayB
) {
341 var keysA
= Object
.keys(a
);
342 var keysB
= Object
.keys(b
);
343 return keysA
.length
=== keysB
.length
&& keysA
.every(function (key
) {
344 return looseEqual(a
[key
], b
[key
]);
347 /* istanbul ignore next */
351 /* istanbul ignore next */
354 } else if (!isObjectA
&& !isObjectB
) {
355 return String(a
) === String(b
);
361 function looseIndexOf(arr
, val
) {
362 for (var i
= 0; i
< arr
.length
; i
++) {
363 if (looseEqual(arr
[i
], val
)) {
371 * Ensure a function is called only once.
378 fn
.apply(this, arguments
);
383 var SSR_ATTR
= 'data-server-rendered';
385 var ASSET_TYPES
= ['component', 'directive', 'filter'];
387 var LIFECYCLE_HOOKS
= ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'activated', 'deactivated'];
393 * Option merge strategies (used in core/util/options)
395 optionMergeStrategies: Object
.create(null),
398 * Whether to suppress warnings.
403 * Show production mode tip message on boot?
405 productionTip: process
.env
.NODE_ENV
!== 'production',
408 * Whether to enable devtools
410 devtools: process
.env
.NODE_ENV
!== 'production',
413 * Whether to record perf
418 * Error handler for watcher errors
423 * Warn handler for watcher warns
428 * Ignore certain custom elements
433 * Custom user key aliases for v-on
435 keyCodes: Object
.create(null),
438 * Check if a tag is reserved so that it cannot be registered as a
439 * component. This is platform-dependent and may be overwritten.
444 * Check if an attribute is reserved so that it cannot be used as a component
445 * prop. This is platform-dependent and may be overwritten.
450 * Check if a tag is an unknown element.
451 * Platform-dependent.
453 isUnknownElement: no
,
456 * Get the namespace of an element
458 getTagNamespace: noop
,
461 * Parse the real tag name for the specific platform.
463 parsePlatformTagName: identity
,
466 * Check if an attribute must be bound using property, e.g. value
467 * Platform-dependent.
472 * Exposed for legacy reasons
474 _lifecycleHooks: LIFECYCLE_HOOKS
479 var emptyObject
= Object
.freeze({});
482 * Check if a string starts with $ or _
484 function isReserved(str
) {
485 var c
= (str
+ '').charCodeAt(0);
486 return c
=== 0x24 || c
=== 0x5F;
492 function def(obj
, key
, val
, enumerable
) {
493 Object
.defineProperty(obj
, key
, {
495 enumerable: !!enumerable
,
504 var bailRE
= /[^\w.$]/;
505 function parsePath(path
) {
506 if (bailRE
.test(path
)) {
509 var segments
= path
.split('.');
510 return function (obj
) {
511 for (var i
= 0; i
< segments
.length
; i
++) {
515 obj
= obj
[segments
[i
]];
525 var formatComponentName
= null; // work around flow check
527 if (process
.env
.NODE_ENV
!== 'production') {
528 var hasConsole
= typeof console
!== 'undefined';
529 var classifyRE
= /(?:^|[-_])(\w)/g;
530 var classify = function (str
) {
531 return str
.replace(classifyRE
, function (c
) {
532 return c
.toUpperCase();
533 }).replace(/[-_]/g, '');
536 warn = function (msg
, vm
) {
537 var trace
= vm
? generateComponentTrace(vm
) : '';
539 if (config
.warnHandler
) {
540 config
.warnHandler
.call(null, msg
, vm
, trace
);
541 } else if (hasConsole
&& !config
.silent
) {
542 console
.error("[Vue warn]: " + msg
+ trace
);
546 tip = function (msg
, vm
) {
547 if (hasConsole
&& !config
.silent
) {
548 console
.warn("[Vue tip]: " + msg
+ (vm
? generateComponentTrace(vm
) : ''));
552 formatComponentName = function (vm
, includeFile
) {
553 if (vm
.$root
=== vm
) {
556 var name
= typeof vm
=== 'string' ? vm : typeof vm
=== 'function' && vm
.options
? vm
.options
.name : vm
._isVue
? vm
.$options
.name
|| vm
.$options
._componentTag : vm
.name
;
558 var file
= vm
._isVue
&& vm
.$options
.__file
;
560 var match
= file
.match(/([^/\\]+)\.vue
$/);
561 name
= match
&& match
[1];
564 return (name
? "<" + classify(name
) + ">" : "<Anonymous>") + (file
&& includeFile
!== false ? " at " + file : '');
567 var repeat = function (str
, n
) {
581 var generateComponentTrace = function (vm
) {
582 if (vm
._isVue
&& vm
.$parent
) {
584 var currentRecursiveSequence
= 0;
586 if (tree
.length
> 0) {
587 var last
= tree
[tree
.length
- 1];
588 if (last
.constructor === vm
.constructor) {
589 currentRecursiveSequence
++;
592 } else if (currentRecursiveSequence
> 0) {
593 tree
[tree
.length
- 1] = [last
, currentRecursiveSequence
];
594 currentRecursiveSequence
= 0;
600 return '\n\nfound in\n\n' + tree
.map(function (vm
, i
) {
601 return "" + (i
=== 0 ? '---> ' : repeat(' ', 5 + i
* 2)) + (Array
.isArray(vm
) ? formatComponentName(vm
[0]) + "... (" + vm
[1] + " recursive calls)" : formatComponentName(vm
));
604 return "\n\n(found in " + formatComponentName(vm
) + ")";
611 function handleError(err
, vm
, info
) {
612 if (config
.errorHandler
) {
613 config
.errorHandler
.call(null, err
, vm
, info
);
615 if (process
.env
.NODE_ENV
!== 'production') {
616 warn("Error in " + info
+ ": \"" + err
.toString() + "\"", vm
);
618 /* istanbul ignore else */
619 if (inBrowser
&& typeof console
!== 'undefined') {
628 /* globals MutationObserver */
630 // can we use __proto__?
631 var hasProto
= '__proto__' in {};
633 // Browser environment sniffing
634 var inBrowser
= typeof window
!== 'undefined';
635 var UA
= inBrowser
&& window
.navigator
.userAgent
.toLowerCase();
636 var isIE
= UA
&& /msie|trident/.test(UA
);
637 var isIE9
= UA
&& UA
.indexOf('msie 9.0') > 0;
638 var isEdge
= UA
&& UA
.indexOf('edge/') > 0;
639 var isAndroid
= UA
&& UA
.indexOf('android') > 0;
640 var isIOS
= UA
&& /iphone|ipad|ipod|ios/.test(UA
);
641 var isChrome
= UA
&& /chrome\/\d+/.test(UA
) && !isEdge
;
643 // Firefix has a "watch" function on Object.prototype...
644 var nativeWatch
= {}.watch
;
646 var supportsPassive
= false;
650 Object
.defineProperty(opts
, 'passive', {
651 get: function get() {
652 /* istanbul ignore next */
653 supportsPassive
= true;
655 }); // https://github.com/facebook/flow/issues/285
656 window
.addEventListener('test-passive', null, opts
);
660 // this needs to be lazy-evaled because vue may be required before
661 // vue-server-renderer can set VUE_ENV
663 var isServerRendering = function () {
664 if (_isServer
=== undefined) {
665 /* istanbul ignore if */
666 if (!inBrowser
&& typeof global
!== 'undefined') {
667 // detect presence of vue-server-renderer and avoid
668 // Webpack shimming the process
669 _isServer
= global
['process'].env
.VUE_ENV
=== 'server';
678 var devtools
= inBrowser
&& window
.__VUE_DEVTOOLS_GLOBAL_HOOK__
;
680 /* istanbul ignore next */
681 function isNative(Ctor
) {
682 return typeof Ctor
=== 'function' && /native code
/.test(Ctor
.toString());
685 var hasSymbol
= typeof Symbol
!== 'undefined' && isNative(Symbol
) && typeof Reflect
!== 'undefined' && isNative(Reflect
.ownKeys
);
688 * Defer a task to execute it asynchronously.
690 var nextTick = function () {
695 function nextTickHandler() {
697 var copies
= callbacks
.slice(0);
698 callbacks
.length
= 0;
699 for (var i
= 0; i
< copies
.length
; i
++) {
704 // the nextTick behavior leverages the microtask queue, which can be accessed
705 // via either native Promise.then or MutationObserver.
706 // MutationObserver has wider support, however it is seriously bugged in
707 // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
708 // completely stops working after triggering a few times... so, if native
709 // Promise is available, we will use it:
710 /* istanbul ignore if */
711 if (typeof Promise
!== 'undefined' && isNative(Promise
)) {
712 var p
= Promise
.resolve();
713 var logError = function (err
) {
716 timerFunc = function () {
717 p
.then(nextTickHandler
).catch(logError
);
718 // in problematic UIWebViews, Promise.then doesn't completely break, but
719 // it can get stuck in a weird state where callbacks are pushed into the
720 // microtask queue but the queue isn't being flushed, until the browser
721 // needs to do some other work, e.g. handle a timer. Therefore we can
722 // "force" the microtask queue to be flushed by adding an empty timer.
727 } else if (typeof MutationObserver
!== 'undefined' && (isNative(MutationObserver
) ||
728 // PhantomJS and iOS 7.x
729 MutationObserver
.toString() === '[object MutationObserverConstructor]')) {
730 // use MutationObserver where native Promise is not available,
731 // e.g. PhantomJS IE11, iOS7, Android 4.4
733 var observer
= new MutationObserver(nextTickHandler
);
734 var textNode
= document
.createTextNode(String(counter
));
735 observer
.observe(textNode
, {
738 timerFunc = function () {
739 counter
= (counter
+ 1) % 2;
740 textNode
.data
= String(counter
);
743 // fallback to setTimeout
744 /* istanbul ignore next */
745 timerFunc = function () {
746 setTimeout(nextTickHandler
, 0);
750 return function queueNextTick(cb
, ctx
) {
752 callbacks
.push(function () {
757 handleError(e
, ctx
, 'nextTick');
759 } else if (_resolve
) {
767 if (!cb
&& typeof Promise
!== 'undefined') {
768 return new Promise(function (resolve
, reject
) {
776 /* istanbul ignore if */
777 if (typeof Set
!== 'undefined' && isNative(Set
)) {
778 // use native Set when available.
781 // a non-standard Set polyfill that only works with primitive keys.
784 this.set = Object
.create(null);
786 Set
.prototype.has
= function has(key
) {
787 return this.set[key
] === true;
789 Set
.prototype.add
= function add(key
) {
790 this.set[key
] = true;
792 Set
.prototype.clear
= function clear() {
793 this.set = Object
.create(null);
805 * A dep is an observable that can have multiple
806 * directives subscribing to it.
808 var Dep
= function Dep() {
813 Dep
.prototype.addSub
= function addSub(sub
) {
817 Dep
.prototype.removeSub
= function removeSub(sub
) {
818 remove(this.subs
, sub
);
821 Dep
.prototype.depend
= function depend() {
823 Dep
.target
.addDep(this);
827 Dep
.prototype.notify
= function notify() {
828 // stabilize the subscriber list first
829 var subs
= this.subs
.slice();
830 for (var i
= 0, l
= subs
.length
; i
< l
; i
++) {
835 // the current target watcher being evaluated.
836 // this is globally unique because there could be only one
837 // watcher being evaluated at any time.
839 var targetStack
= [];
841 function pushTarget(_target
) {
843 targetStack
.push(Dep
.target
);
845 Dep
.target
= _target
;
848 function popTarget() {
849 Dep
.target
= targetStack
.pop();
853 * not type checking this file because flow doesn't play well with
854 * dynamically accessing methods on Array prototype
857 var arrayProto
= Array
.prototype;
858 var arrayMethods
= Object
.create(arrayProto
);['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method
) {
859 // cache original method
860 var original
= arrayProto
[method
];
861 def(arrayMethods
, method
, function mutator() {
863 len
= arguments
.length
;
864 while (len
--) args
[len
] = arguments
[len
];
866 var result
= original
.apply(this, args
);
867 var ob
= this.__ob__
;
875 inserted
= args
.slice(2);
879 ob
.observeArray(inserted
);
889 var arrayKeys
= Object
.getOwnPropertyNames(arrayMethods
);
892 * By default, when a reactive property is set, the new value is
893 * also converted to become reactive. However when passing down props,
894 * we don't want to force conversion because the value may be a nested value
895 * under a frozen data structure. Converting it would defeat the optimization.
897 var observerState
= {
902 * Observer class that are attached to each observed
903 * object. Once attached, the observer converts target
904 * object's property keys into getter/setters that
905 * collect dependencies and dispatches updates.
907 var Observer
= function Observer(value
) {
909 this.dep
= new Dep();
911 def(value
, '__ob__', this);
912 if (Array
.isArray(value
)) {
913 var augment
= hasProto
? protoAugment : copyAugment
;
914 augment(value
, arrayMethods
, arrayKeys
);
915 this.observeArray(value
);
922 * Walk through each property and convert them into
923 * getter/setters. This method should only be called when
924 * value type is Object.
926 Observer
.prototype.walk
= function walk(obj
) {
927 var keys
= Object
.keys(obj
);
928 for (var i
= 0; i
< keys
.length
; i
++) {
929 defineReactive
$$1(obj
, keys
[i
], obj
[keys
[i
]]);
934 * Observe a list of Array items.
936 Observer
.prototype.observeArray
= function observeArray(items
) {
937 for (var i
= 0, l
= items
.length
; i
< l
; i
++) {
945 * Augment an target Object or Array by intercepting
946 * the prototype chain using __proto__
948 function protoAugment(target
, src
, keys
) {
949 /* eslint-disable no-proto */
950 target
.__proto__
= src
;
951 /* eslint-enable no-proto */
955 * Augment an target Object or Array by defining
958 /* istanbul ignore next */
959 function copyAugment(target
, src
, keys
) {
960 for (var i
= 0, l
= keys
.length
; i
< l
; i
++) {
962 def(target
, key
, src
[key
]);
967 * Attempt to create an observer instance for a value,
968 * returns the new observer if successfully observed,
969 * or the existing observer if the value already has one.
971 function observe(value
, asRootData
) {
972 if (!isObject(value
)) {
976 if (hasOwn(value
, '__ob__') && value
.__ob__
instanceof Observer
) {
978 } else if (observerState
.shouldConvert
&& !isServerRendering() && (Array
.isArray(value
) || isPlainObject(value
)) && Object
.isExtensible(value
) && !value
._isVue
) {
979 ob
= new Observer(value
);
981 if (asRootData
&& ob
) {
988 * Define a reactive property on an Object.
990 function defineReactive
$$1(obj
, key
, val
, customSetter
, shallow
) {
993 var property
= Object
.getOwnPropertyDescriptor(obj
, key
);
994 if (property
&& property
.configurable
=== false) {
998 // cater for pre-defined getter/setters
999 var getter
= property
&& property
.get;
1000 var setter
= property
&& property
.set;
1002 var childOb
= !shallow
&& observe(val
);
1003 Object
.defineProperty(obj
, key
, {
1006 get: function reactiveGetter() {
1007 var value
= getter
? getter
.call(obj
) : val
;
1011 childOb
.dep
.depend();
1013 if (Array
.isArray(value
)) {
1019 set: function reactiveSetter(newVal
) {
1020 var value
= getter
? getter
.call(obj
) : val
;
1021 /* eslint-disable no-self-compare */
1022 if (newVal
=== value
|| newVal
!== newVal
&& value
!== value
) {
1025 /* eslint-enable no-self-compare */
1026 if (process
.env
.NODE_ENV
!== 'production' && customSetter
) {
1030 setter
.call(obj
, newVal
);
1034 childOb
= !shallow
&& observe(newVal
);
1041 * Set a property on an object. Adds the new property and
1042 * triggers change notification if the property doesn't
1045 function set(target
, key
, val
) {
1046 if (Array
.isArray(target
) && isValidArrayIndex(key
)) {
1047 target
.length
= Math
.max(target
.length
, key
);
1048 target
.splice(key
, 1, val
);
1051 if (hasOwn(target
, key
)) {
1055 var ob
= target
.__ob__
;
1056 if (target
._isVue
|| ob
&& ob
.vmCount
) {
1057 process
.env
.NODE_ENV
!== 'production' && warn('Avoid adding reactive properties to a Vue instance or its root $data ' + 'at runtime - declare it upfront in the data option.');
1064 defineReactive
$$1(ob
.value
, key
, val
);
1070 * Delete a property and trigger change if necessary.
1072 function del(target
, key
) {
1073 if (Array
.isArray(target
) && isValidArrayIndex(key
)) {
1074 target
.splice(key
, 1);
1077 var ob
= target
.__ob__
;
1078 if (target
._isVue
|| ob
&& ob
.vmCount
) {
1079 process
.env
.NODE_ENV
!== 'production' && warn('Avoid deleting properties on a Vue instance or its root $data ' + '- just set it to null.');
1082 if (!hasOwn(target
, key
)) {
1093 * Collect dependencies on array elements when the array is touched, since
1094 * we cannot intercept array element access like property getters.
1096 function dependArray(value
) {
1097 for (var e
= void 0, i
= 0, l
= value
.length
; i
< l
; i
++) {
1099 e
&& e
.__ob__
&& e
.__ob__
.dep
.depend();
1100 if (Array
.isArray(e
)) {
1109 * Option overwriting strategies are functions that handle
1110 * how to merge a parent option value and a child option
1111 * value into the final value.
1113 var strats
= config
.optionMergeStrategies
;
1116 * Options with restrictions
1118 if (process
.env
.NODE_ENV
!== 'production') {
1119 strats
.el
= strats
.propsData = function (parent
, child
, vm
, key
) {
1121 warn("option \"" + key
+ "\" can only be used during instance " + 'creation with the `new` keyword.');
1123 return defaultStrat(parent
, child
);
1128 * Helper that recursively merges two data objects together.
1130 function mergeData(to
, from) {
1134 var key
, toVal
, fromVal
;
1135 var keys
= Object
.keys(from);
1136 for (var i
= 0; i
< keys
.length
; i
++) {
1139 fromVal
= from[key
];
1140 if (!hasOwn(to
, key
)) {
1141 set(to
, key
, fromVal
);
1142 } else if (isPlainObject(toVal
) && isPlainObject(fromVal
)) {
1143 mergeData(toVal
, fromVal
);
1152 function mergeDataOrFn(parentVal
, childVal
, vm
) {
1154 // in a Vue.extend merge, both should be functions
1161 // when parentVal & childVal are both present,
1162 // we need to return a function that returns the
1163 // merged result of both functions... no need to
1164 // check if parentVal is a function here because
1165 // it has to be a function to pass previous merges.
1166 return function mergedDataFn() {
1167 return mergeData(typeof childVal
=== 'function' ? childVal
.call(this) : childVal
, typeof parentVal
=== 'function' ? parentVal
.call(this) : parentVal
);
1169 } else if (parentVal
|| childVal
) {
1170 return function mergedInstanceDataFn() {
1172 var instanceData
= typeof childVal
=== 'function' ? childVal
.call(vm
) : childVal
;
1173 var defaultData
= typeof parentVal
=== 'function' ? parentVal
.call(vm
) : undefined;
1175 return mergeData(instanceData
, defaultData
);
1183 strats
.data = function (parentVal
, childVal
, vm
) {
1185 if (childVal
&& typeof childVal
!== 'function') {
1186 process
.env
.NODE_ENV
!== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm
);
1190 return mergeDataOrFn
.call(this, parentVal
, childVal
);
1193 return mergeDataOrFn(parentVal
, childVal
, vm
);
1197 * Hooks and props are merged as arrays.
1199 function mergeHook(parentVal
, childVal
) {
1200 return childVal
? parentVal
? parentVal
.concat(childVal
) : Array
.isArray(childVal
) ? childVal : [childVal
] : parentVal
;
1203 LIFECYCLE_HOOKS
.forEach(function (hook
) {
1204 strats
[hook
] = mergeHook
;
1210 * When a vm is present (instance creation), we need to do
1211 * a three-way merge between constructor options, instance
1212 * options and parent options.
1214 function mergeAssets(parentVal
, childVal
) {
1215 var res
= Object
.create(parentVal
|| null);
1216 return childVal
? extend(res
, childVal
) : res
;
1219 ASSET_TYPES
.forEach(function (type
) {
1220 strats
[type
+ 's'] = mergeAssets
;
1226 * Watchers hashes should not overwrite one
1227 * another, so we merge them as arrays.
1229 strats
.watch = function (parentVal
, childVal
) {
1230 // work around Firefox's Object.prototype.watch...
1231 if (parentVal
=== nativeWatch
) {
1232 parentVal
= undefined;
1234 if (childVal
=== nativeWatch
) {
1235 childVal
= undefined;
1237 /* istanbul ignore if */
1239 return Object
.create(parentVal
|| null);
1245 extend(ret
, parentVal
);
1246 for (var key
in childVal
) {
1247 var parent
= ret
[key
];
1248 var child
= childVal
[key
];
1249 if (parent
&& !Array
.isArray(parent
)) {
1252 ret
[key
] = parent
? parent
.concat(child
) : Array
.isArray(child
) ? child : [child
];
1258 * Other object hashes.
1260 strats
.props
= strats
.methods
= strats
.inject
= strats
.computed = function (parentVal
, childVal
) {
1264 var ret
= Object
.create(null);
1265 extend(ret
, parentVal
);
1267 extend(ret
, childVal
);
1271 strats
.provide
= mergeDataOrFn
;
1276 var defaultStrat = function (parentVal
, childVal
) {
1277 return childVal
=== undefined ? parentVal : childVal
;
1281 * Validate component names
1283 function checkComponents(options
) {
1284 for (var key
in options
.components
) {
1285 var lower
= key
.toLowerCase();
1286 if (isBuiltInTag(lower
) || config
.isReservedTag(lower
)) {
1287 warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key
);
1293 * Ensure all props option syntax are normalized into the
1294 * Object-based format.
1296 function normalizeProps(options
) {
1297 var props
= options
.props
;
1303 if (Array
.isArray(props
)) {
1307 if (typeof val
=== 'string') {
1308 name
= camelize(val
);
1309 res
[name
] = { type: null };
1310 } else if (process
.env
.NODE_ENV
!== 'production') {
1311 warn('props must be strings when using array syntax.');
1314 } else if (isPlainObject(props
)) {
1315 for (var key
in props
) {
1317 name
= camelize(key
);
1318 res
[name
] = isPlainObject(val
) ? val : { type: val
};
1321 options
.props
= res
;
1325 * Normalize all injections into Object-based format
1327 function normalizeInject(options
) {
1328 var inject
= options
.inject
;
1329 if (Array
.isArray(inject
)) {
1330 var normalized
= options
.inject
= {};
1331 for (var i
= 0; i
< inject
.length
; i
++) {
1332 normalized
[inject
[i
]] = inject
[i
];
1338 * Normalize raw function directives into object format.
1340 function normalizeDirectives(options
) {
1341 var dirs
= options
.directives
;
1343 for (var key
in dirs
) {
1344 var def
= dirs
[key
];
1345 if (typeof def
=== 'function') {
1346 dirs
[key
] = { bind: def
, update: def
};
1353 * Merge two option objects into a new one.
1354 * Core utility used in both instantiation and inheritance.
1356 function mergeOptions(parent
, child
, vm
) {
1357 if (process
.env
.NODE_ENV
!== 'production') {
1358 checkComponents(child
);
1361 if (typeof child
=== 'function') {
1362 child
= child
.options
;
1365 normalizeProps(child
);
1366 normalizeInject(child
);
1367 normalizeDirectives(child
);
1368 var extendsFrom
= child
.extends;
1370 parent
= mergeOptions(parent
, extendsFrom
, vm
);
1373 for (var i
= 0, l
= child
.mixins
.length
; i
< l
; i
++) {
1374 parent
= mergeOptions(parent
, child
.mixins
[i
], vm
);
1379 for (key
in parent
) {
1382 for (key
in child
) {
1383 if (!hasOwn(parent
, key
)) {
1387 function mergeField(key
) {
1388 var strat
= strats
[key
] || defaultStrat
;
1389 options
[key
] = strat(parent
[key
], child
[key
], vm
, key
);
1396 * This function is used because child instances need access
1397 * to assets defined in its ancestor chain.
1399 function resolveAsset(options
, type
, id
, warnMissing
) {
1400 /* istanbul ignore if */
1401 if (typeof id
!== 'string') {
1404 var assets
= options
[type
];
1405 // check local registration variations first
1406 if (hasOwn(assets
, id
)) {
1409 var camelizedId
= camelize(id
);
1410 if (hasOwn(assets
, camelizedId
)) {
1411 return assets
[camelizedId
];
1413 var PascalCaseId
= capitalize(camelizedId
);
1414 if (hasOwn(assets
, PascalCaseId
)) {
1415 return assets
[PascalCaseId
];
1417 // fallback to prototype chain
1418 var res
= assets
[id
] || assets
[camelizedId
] || assets
[PascalCaseId
];
1419 if (process
.env
.NODE_ENV
!== 'production' && warnMissing
&& !res
) {
1420 warn('Failed to resolve ' + type
.slice(0, -1) + ': ' + id
, options
);
1427 function validateProp(key
, propOptions
, propsData
, vm
) {
1428 var prop
= propOptions
[key
];
1429 var absent
= !hasOwn(propsData
, key
);
1430 var value
= propsData
[key
];
1431 // handle boolean props
1432 if (isType(Boolean
, prop
.type
)) {
1433 if (absent
&& !hasOwn(prop
, 'default')) {
1435 } else if (!isType(String
, prop
.type
) && (value
=== '' || value
=== hyphenate(key
))) {
1439 // check default value
1440 if (value
=== undefined) {
1441 value
= getPropDefaultValue(vm
, prop
, key
);
1442 // since the default value is a fresh copy,
1443 // make sure to observe it.
1444 var prevShouldConvert
= observerState
.shouldConvert
;
1445 observerState
.shouldConvert
= true;
1447 observerState
.shouldConvert
= prevShouldConvert
;
1449 if (process
.env
.NODE_ENV
!== 'production') {
1450 assertProp(prop
, key
, value
, vm
, absent
);
1456 * Get the default value of a prop.
1458 function getPropDefaultValue(vm
, prop
, key
) {
1459 // no default, return undefined
1460 if (!hasOwn(prop
, 'default')) {
1463 var def
= prop
.default;
1464 // warn against non-factory defaults for Object & Array
1465 if (process
.env
.NODE_ENV
!== 'production' && isObject(def
)) {
1466 warn('Invalid default value for prop "' + key
+ '": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', vm
);
1468 // the raw prop value was also undefined from previous render,
1469 // return previous default value to avoid unnecessary watcher trigger
1470 if (vm
&& vm
.$options
.propsData
&& vm
.$options
.propsData
[key
] === undefined && vm
._props
[key
] !== undefined) {
1471 return vm
._props
[key
];
1473 // call factory function for non-Function types
1474 // a value is Function if its prototype is function even across different execution context
1475 return typeof def
=== 'function' && getType(prop
.type
) !== 'Function' ? def
.call(vm
) : def
;
1479 * Assert whether a prop is valid.
1481 function assertProp(prop
, name
, value
, vm
, absent
) {
1482 if (prop
.required
&& absent
) {
1483 warn('Missing required prop: "' + name
+ '"', vm
);
1486 if (value
== null && !prop
.required
) {
1489 var type
= prop
.type
;
1490 var valid
= !type
|| type
=== true;
1491 var expectedTypes
= [];
1493 if (!Array
.isArray(type
)) {
1496 for (var i
= 0; i
< type
.length
&& !valid
; i
++) {
1497 var assertedType
= assertType(value
, type
[i
]);
1498 expectedTypes
.push(assertedType
.expectedType
|| '');
1499 valid
= assertedType
.valid
;
1503 warn('Invalid prop: type check failed for prop "' + name
+ '".' + ' Expected ' + expectedTypes
.map(capitalize
).join(', ') + ', got ' + Object
.prototype.toString
.call(value
).slice(8, -1) + '.', vm
);
1506 var validator
= prop
.validator
;
1508 if (!validator(value
)) {
1509 warn('Invalid prop: custom validator check failed for prop "' + name
+ '".', vm
);
1514 var simpleCheckRE
= /^(String|Number|Boolean|Function|Symbol)$/;
1516 function assertType(value
, type
) {
1518 var expectedType
= getType(type
);
1519 if (simpleCheckRE
.test(expectedType
)) {
1520 valid
= typeof value
=== expectedType
.toLowerCase();
1521 } else if (expectedType
=== 'Object') {
1522 valid
= isPlainObject(value
);
1523 } else if (expectedType
=== 'Array') {
1524 valid
= Array
.isArray(value
);
1526 valid
= value
instanceof type
;
1530 expectedType: expectedType
1535 * Use function string name to check built-in types,
1536 * because a simple equality check will fail when running
1537 * across different vms / iframes.
1539 function getType(fn
) {
1540 var match
= fn
&& fn
.toString().match(/^\s
*function (\w
+)/);
1541 return match
? match
[1] : '';
1544 function isType(type
, fn
) {
1545 if (!Array
.isArray(fn
)) {
1546 return getType(fn
) === getType(type
);
1548 for (var i
= 0, len
= fn
.length
; i
< len
; i
++) {
1549 if (getType(fn
[i
]) === getType(type
)) {
1553 /* istanbul ignore next */
1562 if (process
.env
.NODE_ENV
!== 'production') {
1563 var perf
= inBrowser
&& window
.performance
;
1564 /* istanbul ignore if */
1565 if (perf
&& perf
.mark
&& perf
.measure
&& perf
.clearMarks
&& perf
.clearMeasures
) {
1566 mark = function (tag
) {
1567 return perf
.mark(tag
);
1569 measure = function (name
, startTag
, endTag
) {
1570 perf
.measure(name
, startTag
, endTag
);
1571 perf
.clearMarks(startTag
);
1572 perf
.clearMarks(endTag
);
1573 perf
.clearMeasures(name
);
1578 /* not type checking this file because flow doesn't play well with Proxy */
1582 if (process
.env
.NODE_ENV
!== 'production') {
1583 var allowedGlobals
= makeMap('Infinity,undefined,NaN,isFinite,isNaN,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + 'require' // for Webpack/Browserify
1586 var warnNonPresent = function (target
, key
) {
1587 warn("Property or method \"" + key
+ "\" is not defined on the instance but " + "referenced during render. Make sure to declare reactive data " + "properties in the data option.", target
);
1590 var hasProxy
= typeof Proxy
!== 'undefined' && Proxy
.toString().match(/native code
/);
1593 var isBuiltInModifier
= makeMap('stop,prevent,self,ctrl,shift,alt,meta');
1594 config
.keyCodes
= new Proxy(config
.keyCodes
, {
1595 set: function set(target
, key
, value
) {
1596 if (isBuiltInModifier(key
)) {
1597 warn("Avoid overwriting built-in modifier in config.keyCodes: ." + key
);
1600 target
[key
] = value
;
1608 has: function has(target
, key
) {
1609 var has
= key
in target
;
1610 var isAllowed
= allowedGlobals(key
) || key
.charAt(0) === '_';
1611 if (!has
&& !isAllowed
) {
1612 warnNonPresent(target
, key
);
1614 return has
|| !isAllowed
;
1619 get: function get(target
, key
) {
1620 if (typeof key
=== 'string' && !(key
in target
)) {
1621 warnNonPresent(target
, key
);
1627 initProxy
= function initProxy(vm
) {
1629 // determine which proxy handler to use
1630 var options
= vm
.$options
;
1631 var handlers
= options
.render
&& options
.render
._withStripped
? getHandler : hasHandler
;
1632 vm
._renderProxy
= new Proxy(vm
, handlers
);
1634 vm
._renderProxy
= vm
;
1641 var VNode
= function VNode(tag
, data
, children
, text
, elm
, context
, componentOptions
, asyncFactory
) {
1644 this.children
= children
;
1647 this.ns
= undefined;
1648 this.context
= context
;
1649 this.functionalContext
= undefined;
1650 this.key
= data
&& data
.key
;
1651 this.componentOptions
= componentOptions
;
1652 this.componentInstance
= undefined;
1653 this.parent
= undefined;
1655 this.isStatic
= false;
1656 this.isRootInsert
= true;
1657 this.isComment
= false;
1658 this.isCloned
= false;
1659 this.isOnce
= false;
1660 this.asyncFactory
= asyncFactory
;
1661 this.asyncMeta
= undefined;
1662 this.isAsyncPlaceholder
= false;
1665 var prototypeAccessors
= { child: {} };
1667 // DEPRECATED: alias for componentInstance for backwards compat.
1668 /* istanbul ignore next */
1669 prototypeAccessors
.child
.get = function () {
1670 return this.componentInstance
;
1673 Object
.defineProperties(VNode
.prototype, prototypeAccessors
);
1675 var createEmptyVNode = function (text
) {
1676 if (text
=== void 0) text
= '';
1678 var node
= new VNode();
1680 node
.isComment
= true;
1684 function createTextVNode(val
) {
1685 return new VNode(undefined, undefined, undefined, String(val
));
1688 // optimized shallow clone
1689 // used for static nodes and slot nodes because they may be reused across
1690 // multiple renders, cloning them avoids errors when DOM manipulations rely
1691 // on their elm reference.
1692 function cloneVNode(vnode
) {
1693 var cloned
= new VNode(vnode
.tag
, vnode
.data
, vnode
.children
, vnode
.text
, vnode
.elm
, vnode
.context
, vnode
.componentOptions
, vnode
.asyncFactory
);
1694 cloned
.ns
= vnode
.ns
;
1695 cloned
.isStatic
= vnode
.isStatic
;
1696 cloned
.key
= vnode
.key
;
1697 cloned
.isComment
= vnode
.isComment
;
1698 cloned
.isCloned
= true;
1702 function cloneVNodes(vnodes
) {
1703 var len
= vnodes
.length
;
1704 var res
= new Array(len
);
1705 for (var i
= 0; i
< len
; i
++) {
1706 res
[i
] = cloneVNode(vnodes
[i
]);
1713 var normalizeEvent
= cached(function (name
) {
1714 var passive
= name
.charAt(0) === '&';
1715 name
= passive
? name
.slice(1) : name
;
1716 var once
$$1 = name
.charAt(0) === '~'; // Prefixed last, checked first
1717 name
= once
$$1 ? name
.slice(1) : name
;
1718 var capture
= name
.charAt(0) === '!';
1719 name
= capture
? name
.slice(1) : name
;
1728 function createFnInvoker(fns
) {
1729 function invoker() {
1730 var arguments
$1 = arguments
;
1732 var fns
= invoker
.fns
;
1733 if (Array
.isArray(fns
)) {
1734 var cloned
= fns
.slice();
1735 for (var i
= 0; i
< cloned
.length
; i
++) {
1736 cloned
[i
].apply(null, arguments
$1);
1739 // return handler return value for single handlers
1740 return fns
.apply(null, arguments
);
1747 function updateListeners(on
, oldOn
, add
, remove
$$1, vm
) {
1748 var name
, cur
, old
, event
;
1752 event
= normalizeEvent(name
);
1754 process
.env
.NODE_ENV
!== 'production' && warn("Invalid handler for event \"" + event
.name
+ "\": got " + String(cur
), vm
);
1755 } else if (isUndef(old
)) {
1756 if (isUndef(cur
.fns
)) {
1757 cur
= on
[name
] = createFnInvoker(cur
);
1759 add(event
.name
, cur
, event
.once
, event
.capture
, event
.passive
);
1760 } else if (cur
!== old
) {
1765 for (name
in oldOn
) {
1766 if (isUndef(on
[name
])) {
1767 event
= normalizeEvent(name
);
1768 remove
$$1(event
.name
, oldOn
[name
], event
.capture
);
1775 function mergeVNodeHook(def
, hookKey
, hook
) {
1777 var oldHook
= def
[hookKey
];
1779 function wrappedHook() {
1780 hook
.apply(this, arguments
);
1781 // important: remove merged hook to ensure it's called only once
1782 // and prevent memory leak
1783 remove(invoker
.fns
, wrappedHook
);
1786 if (isUndef(oldHook
)) {
1788 invoker
= createFnInvoker([wrappedHook
]);
1790 /* istanbul ignore if */
1791 if (isDef(oldHook
.fns
) && isTrue(oldHook
.merged
)) {
1792 // already a merged invoker
1794 invoker
.fns
.push(wrappedHook
);
1796 // existing plain hook
1797 invoker
= createFnInvoker([oldHook
, wrappedHook
]);
1801 invoker
.merged
= true;
1802 def
[hookKey
] = invoker
;
1807 function extractPropsFromVNodeData(data
, Ctor
, tag
) {
1808 // we are only extracting raw values here.
1809 // validation and default values are handled in the child
1810 // component itself.
1811 var propOptions
= Ctor
.options
.props
;
1812 if (isUndef(propOptions
)) {
1816 var attrs
= data
.attrs
;
1817 var props
= data
.props
;
1818 if (isDef(attrs
) || isDef(props
)) {
1819 for (var key
in propOptions
) {
1820 var altKey
= hyphenate(key
);
1821 if (process
.env
.NODE_ENV
!== 'production') {
1822 var keyInLowerCase
= key
.toLowerCase();
1823 if (key
!== keyInLowerCase
&& attrs
&& hasOwn(attrs
, keyInLowerCase
)) {
1824 tip("Prop \"" + keyInLowerCase
+ "\" is passed to component " + formatComponentName(tag
|| Ctor
) + ", but the declared prop name is" + " \"" + key
+ "\". " + "Note that HTML attributes are case-insensitive and camelCased " + "props need to use their kebab-case equivalents when using in-DOM " + "templates. You should probably use \"" + altKey
+ "\" instead of \"" + key
+ "\".");
1827 checkProp(res
, props
, key
, altKey
, true) || checkProp(res
, attrs
, key
, altKey
, false);
1833 function checkProp(res
, hash
, key
, altKey
, preserve
) {
1835 if (hasOwn(hash
, key
)) {
1836 res
[key
] = hash
[key
];
1841 } else if (hasOwn(hash
, altKey
)) {
1842 res
[key
] = hash
[altKey
];
1844 delete hash
[altKey
];
1854 // The template compiler attempts to minimize the need for normalization by
1855 // statically analyzing the template at compile time.
1857 // For plain HTML markup, normalization can be completely skipped because the
1858 // generated render function is guaranteed to return Array<VNode>. There are
1859 // two cases where extra normalization is needed:
1861 // 1. When the children contains components - because a functional component
1862 // may return an Array instead of a single root. In this case, just a simple
1863 // normalization is needed - if any child is an Array, we flatten the whole
1864 // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
1865 // because functional components already normalize their own children.
1866 function simpleNormalizeChildren(children
) {
1867 for (var i
= 0; i
< children
.length
; i
++) {
1868 if (Array
.isArray(children
[i
])) {
1869 return Array
.prototype.concat
.apply([], children
);
1875 // 2. When the children contains constructs that always generated nested Arrays,
1876 // e.g. <template>, <slot>, v-for, or when the children is provided by user
1877 // with hand-written render functions / JSX. In such cases a full normalization
1878 // is needed to cater to all possible types of children values.
1879 function normalizeChildren(children
) {
1880 return isPrimitive(children
) ? [createTextVNode(children
)] : Array
.isArray(children
) ? normalizeArrayChildren(children
) : undefined;
1883 function isTextNode(node
) {
1884 return isDef(node
) && isDef(node
.text
) && isFalse(node
.isComment
);
1887 function normalizeArrayChildren(children
, nestedIndex
) {
1890 for (i
= 0; i
< children
.length
; i
++) {
1892 if (isUndef(c
) || typeof c
=== 'boolean') {
1895 last
= res
[res
.length
- 1];
1897 if (Array
.isArray(c
)) {
1898 res
.push
.apply(res
, normalizeArrayChildren(c
, (nestedIndex
|| '') + "_" + i
));
1899 } else if (isPrimitive(c
)) {
1900 if (isTextNode(last
)) {
1901 // merge adjacent text nodes
1902 // this is necessary for SSR hydration because text nodes are
1903 // essentially merged when rendered to HTML strings
1904 last
.text
+= String(c
);
1905 } else if (c
!== '') {
1906 // convert primitive to vnode
1907 res
.push(createTextVNode(c
));
1910 if (isTextNode(c
) && isTextNode(last
)) {
1911 // merge adjacent text nodes
1912 res
[res
.length
- 1] = createTextVNode(last
.text
+ c
.text
);
1914 // default key for nested array children (likely generated by v-for)
1915 if (isTrue(children
._isVList
) && isDef(c
.tag
) && isUndef(c
.key
) && isDef(nestedIndex
)) {
1916 c
.key
= "__vlist" + nestedIndex
+ "_" + i
+ "__";
1927 function ensureCtor(comp
, base
) {
1928 if (comp
.__esModule
&& comp
.default) {
1929 comp
= comp
.default;
1931 return isObject(comp
) ? base
.extend(comp
) : comp
;
1934 function createAsyncPlaceholder(factory
, data
, context
, children
, tag
) {
1935 var node
= createEmptyVNode();
1936 node
.asyncFactory
= factory
;
1937 node
.asyncMeta
= { data: data
, context: context
, children: children
, tag: tag
};
1941 function resolveAsyncComponent(factory
, baseCtor
, context
) {
1942 if (isTrue(factory
.error
) && isDef(factory
.errorComp
)) {
1943 return factory
.errorComp
;
1946 if (isDef(factory
.resolved
)) {
1947 return factory
.resolved
;
1950 if (isTrue(factory
.loading
) && isDef(factory
.loadingComp
)) {
1951 return factory
.loadingComp
;
1954 if (isDef(factory
.contexts
)) {
1956 factory
.contexts
.push(context
);
1958 var contexts
= factory
.contexts
= [context
];
1961 var forceRender = function () {
1962 for (var i
= 0, l
= contexts
.length
; i
< l
; i
++) {
1963 contexts
[i
].$forceUpdate();
1967 var resolve
= once(function (res
) {
1969 factory
.resolved
= ensureCtor(res
, baseCtor
);
1970 // invoke callbacks only if this is not a synchronous resolve
1971 // (async resolves are shimmed as synchronous during SSR)
1977 var reject
= once(function (reason
) {
1978 process
.env
.NODE_ENV
!== 'production' && warn("Failed to resolve async component: " + String(factory
) + (reason
? "\nReason: " + reason : ''));
1979 if (isDef(factory
.errorComp
)) {
1980 factory
.error
= true;
1985 var res
= factory(resolve
, reject
);
1987 if (isObject(res
)) {
1988 if (typeof res
.then
=== 'function') {
1990 if (isUndef(factory
.resolved
)) {
1991 res
.then(resolve
, reject
);
1993 } else if (isDef(res
.component
) && typeof res
.component
.then
=== 'function') {
1994 res
.component
.then(resolve
, reject
);
1996 if (isDef(res
.error
)) {
1997 factory
.errorComp
= ensureCtor(res
.error
, baseCtor
);
2000 if (isDef(res
.loading
)) {
2001 factory
.loadingComp
= ensureCtor(res
.loading
, baseCtor
);
2002 if (res
.delay
=== 0) {
2003 factory
.loading
= true;
2005 setTimeout(function () {
2006 if (isUndef(factory
.resolved
) && isUndef(factory
.error
)) {
2007 factory
.loading
= true;
2010 }, res
.delay
|| 200);
2014 if (isDef(res
.timeout
)) {
2015 setTimeout(function () {
2016 if (isUndef(factory
.resolved
)) {
2017 reject(process
.env
.NODE_ENV
!== 'production' ? "timeout (" + res
.timeout
+ "ms)" : null);
2025 // return in case resolved synchronously
2026 return factory
.loading
? factory
.loadingComp : factory
.resolved
;
2032 function getFirstComponentChild(children
) {
2033 if (Array
.isArray(children
)) {
2034 for (var i
= 0; i
< children
.length
; i
++) {
2035 var c
= children
[i
];
2036 if (isDef(c
) && isDef(c
.componentOptions
)) {
2047 function initEvents(vm
) {
2048 vm
._events
= Object
.create(null);
2049 vm
._hasHookEvent
= false;
2050 // init parent attached events
2051 var listeners
= vm
.$options
._parentListeners
;
2053 updateComponentListeners(vm
, listeners
);
2059 function add(event
, fn
, once
$$1) {
2061 target
.$once(event
, fn
);
2063 target
.$on(event
, fn
);
2067 function remove
$1(event
, fn
) {
2068 target
.$off(event
, fn
);
2071 function updateComponentListeners(vm
, listeners
, oldListeners
) {
2073 updateListeners(listeners
, oldListeners
|| {}, add
, remove
$1, vm
);
2076 function eventsMixin(Vue
) {
2077 var hookRE
= /^hook:/;
2078 Vue
.prototype.$on = function (event
, fn
) {
2082 if (Array
.isArray(event
)) {
2083 for (var i
= 0, l
= event
.length
; i
< l
; i
++) {
2084 this$1.$on(event
[i
], fn
);
2087 (vm
._events
[event
] || (vm
._events
[event
] = [])).push(fn
);
2088 // optimize hook:event cost by using a boolean flag marked at registration
2089 // instead of a hash lookup
2090 if (hookRE
.test(event
)) {
2091 vm
._hasHookEvent
= true;
2097 Vue
.prototype.$once = function (event
, fn
) {
2101 fn
.apply(vm
, arguments
);
2108 Vue
.prototype.$off = function (event
, fn
) {
2113 if (!arguments
.length
) {
2114 vm
._events
= Object
.create(null);
2118 if (Array
.isArray(event
)) {
2119 for (var i
$1 = 0, l
= event
.length
; i
$1 < l
; i
$1++) {
2120 this$1.$off(event
[i
$1], fn
);
2125 var cbs
= vm
._events
[event
];
2129 if (arguments
.length
=== 1) {
2130 vm
._events
[event
] = null;
2138 if (cb
=== fn
|| cb
.fn
=== fn
) {
2146 Vue
.prototype.$emit = function (event
) {
2148 if (process
.env
.NODE_ENV
!== 'production') {
2149 var lowerCaseEvent
= event
.toLowerCase();
2150 if (lowerCaseEvent
!== event
&& vm
._events
[lowerCaseEvent
]) {
2151 tip("Event \"" + lowerCaseEvent
+ "\" is emitted in component " + formatComponentName(vm
) + " but the handler is registered for \"" + event
+ "\". " + "Note that HTML attributes are case-insensitive and you cannot use " + "v-on to listen to camelCase events when using in-DOM templates. " + "You should probably use \"" + hyphenate(event
) + "\" instead of \"" + event
+ "\".");
2154 var cbs
= vm
._events
[event
];
2156 cbs
= cbs
.length
> 1 ? toArray(cbs
) : cbs
;
2157 var args
= toArray(arguments
, 1);
2158 for (var i
= 0, l
= cbs
.length
; i
< l
; i
++) {
2160 cbs
[i
].apply(vm
, args
);
2162 handleError(e
, vm
, "event handler for \"" + event
+ "\"");
2173 * Runtime helper for resolving raw children VNodes into a slot object.
2175 function resolveSlots(children
, context
) {
2180 var defaultSlot
= [];
2181 for (var i
= 0, l
= children
.length
; i
< l
; i
++) {
2182 var child
= children
[i
];
2183 // named slots should only be respected if the vnode was rendered in the
2185 if ((child
.context
=== context
|| child
.functionalContext
=== context
) && child
.data
&& child
.data
.slot
!= null) {
2186 var name
= child
.data
.slot
;
2187 var slot
= slots
[name
] || (slots
[name
] = []);
2188 if (child
.tag
=== 'template') {
2189 slot
.push
.apply(slot
, child
.children
);
2194 defaultSlot
.push(child
);
2197 // ignore whitespace
2198 if (!defaultSlot
.every(isWhitespace
)) {
2199 slots
.default = defaultSlot
;
2204 function isWhitespace(node
) {
2205 return node
.isComment
|| node
.text
=== ' ';
2208 function resolveScopedSlots(fns
, // see flow/vnode
2211 for (var i
= 0; i
< fns
.length
; i
++) {
2212 if (Array
.isArray(fns
[i
])) {
2213 resolveScopedSlots(fns
[i
], res
);
2215 res
[fns
[i
].key
] = fns
[i
].fn
;
2223 var activeInstance
= null;
2224 var isUpdatingChildComponent
= false;
2226 function initLifecycle(vm
) {
2227 var options
= vm
.$options
;
2229 // locate first non-abstract parent
2230 var parent
= options
.parent
;
2231 if (parent
&& !options
.abstract) {
2232 while (parent
.$options
.abstract && parent
.$parent
) {
2233 parent
= parent
.$parent
;
2235 parent
.$children
.push(vm
);
2238 vm
.$parent
= parent
;
2239 vm
.$root
= parent
? parent
.$root : vm
;
2245 vm
._inactive
= null;
2246 vm
._directInactive
= false;
2247 vm
._isMounted
= false;
2248 vm
._isDestroyed
= false;
2249 vm
._isBeingDestroyed
= false;
2252 function lifecycleMixin(Vue
) {
2253 Vue
.prototype._update = function (vnode
, hydrating
) {
2255 if (vm
._isMounted
) {
2256 callHook(vm
, 'beforeUpdate');
2258 var prevEl
= vm
.$el
;
2259 var prevVnode
= vm
._vnode
;
2260 var prevActiveInstance
= activeInstance
;
2261 activeInstance
= vm
;
2263 // Vue.prototype.__patch__ is injected in entry points
2264 // based on the rendering backend used.
2267 vm
.$el
= vm
.__patch__(vm
.$el
, vnode
, hydrating
, false /* removeOnly */
2268 , vm
.$options
._parentElm
, vm
.$options
._refElm
);
2269 // no need for the ref nodes after initial patch
2270 // this prevents keeping a detached DOM tree in memory (#5851)
2271 vm
.$options
._parentElm
= vm
.$options
._refElm
= null;
2274 vm
.$el
= vm
.__patch__(prevVnode
, vnode
);
2276 activeInstance
= prevActiveInstance
;
2277 // update __vue__ reference
2279 prevEl
.__vue__
= null;
2282 vm
.$el
.__vue__
= vm
;
2284 // if parent is an HOC, update its $el as well
2285 if (vm
.$vnode
&& vm
.$parent
&& vm
.$vnode
=== vm
.$parent
._vnode
) {
2286 vm
.$parent
.$el
= vm
.$el
;
2288 // updated hook is called by the scheduler to ensure that children are
2289 // updated in a parent's updated hook.
2292 Vue
.prototype.$forceUpdate = function () {
2295 vm
._watcher
.update();
2299 Vue
.prototype.$destroy = function () {
2301 if (vm
._isBeingDestroyed
) {
2304 callHook(vm
, 'beforeDestroy');
2305 vm
._isBeingDestroyed
= true;
2306 // remove self from parent
2307 var parent
= vm
.$parent
;
2308 if (parent
&& !parent
._isBeingDestroyed
&& !vm
.$options
.abstract) {
2309 remove(parent
.$children
, vm
);
2311 // teardown watchers
2313 vm
._watcher
.teardown();
2315 var i
= vm
._watchers
.length
;
2317 vm
._watchers
[i
].teardown();
2319 // remove reference from data ob
2320 // frozen object may not have observer.
2321 if (vm
._data
.__ob__
) {
2322 vm
._data
.__ob__
.vmCount
--;
2324 // call the last hook...
2325 vm
._isDestroyed
= true;
2326 // invoke destroy hooks on current rendered tree
2327 vm
.__patch__(vm
._vnode
, null);
2328 // fire destroyed hook
2329 callHook(vm
, 'destroyed');
2330 // turn off all instance listeners.
2332 // remove __vue__ reference
2334 vm
.$el
.__vue__
= null;
2339 function mountComponent(vm
, el
, hydrating
) {
2341 if (!vm
.$options
.render
) {
2342 vm
.$options
.render
= createEmptyVNode
;
2343 if (process
.env
.NODE_ENV
!== 'production') {
2344 /* istanbul ignore if */
2345 if (vm
.$options
.template
&& vm
.$options
.template
.charAt(0) !== '#' || vm
.$options
.el
|| el
) {
2346 warn('You are using the runtime-only build of Vue where the template ' + 'compiler is not available. Either pre-compile the templates into ' + 'render functions, or use the compiler-included build.', vm
);
2348 warn('Failed to mount component: template or render function not defined.', vm
);
2352 callHook(vm
, 'beforeMount');
2354 var updateComponent
;
2355 /* istanbul ignore if */
2356 if (process
.env
.NODE_ENV
!== 'production' && config
.performance
&& mark
) {
2357 updateComponent = function () {
2358 var name
= vm
._name
;
2360 var startTag
= "vue-perf-start:" + id
;
2361 var endTag
= "vue-perf-end:" + id
;
2364 var vnode
= vm
._render();
2366 measure(name
+ " render", startTag
, endTag
);
2369 vm
._update(vnode
, hydrating
);
2371 measure(name
+ " patch", startTag
, endTag
);
2374 updateComponent = function () {
2375 vm
._update(vm
._render(), hydrating
);
2379 vm
._watcher
= new Watcher(vm
, updateComponent
, noop
);
2382 // manually mounted instance, call mounted on self
2383 // mounted is called for render-created child components in its inserted hook
2384 if (vm
.$vnode
== null) {
2385 vm
._isMounted
= true;
2386 callHook(vm
, 'mounted');
2391 function updateChildComponent(vm
, propsData
, listeners
, parentVnode
, renderChildren
) {
2392 if (process
.env
.NODE_ENV
!== 'production') {
2393 isUpdatingChildComponent
= true;
2396 // determine whether component has slot children
2397 // we need to do this before overwriting $options._renderChildren
2398 var hasChildren
= !!(renderChildren
|| // has new static slots
2399 vm
.$options
._renderChildren
|| // has old static slots
2400 parentVnode
.data
.scopedSlots
|| // has new scoped slots
2401 vm
.$scopedSlots
!== emptyObject
// has old scoped slots
2404 vm
.$options
._parentVnode
= parentVnode
;
2405 vm
.$vnode
= parentVnode
; // update vm's placeholder node without re-render
2408 // update child tree's parent
2409 vm
._vnode
.parent
= parentVnode
;
2411 vm
.$options
._renderChildren
= renderChildren
;
2413 // update $attrs and $listensers hash
2414 // these are also reactive so they may trigger child update if the child
2415 // used them during render
2416 vm
.$attrs
= parentVnode
.data
&& parentVnode
.data
.attrs
;
2417 vm
.$listeners
= listeners
;
2420 if (propsData
&& vm
.$options
.props
) {
2421 observerState
.shouldConvert
= false;
2422 var props
= vm
._props
;
2423 var propKeys
= vm
.$options
._propKeys
|| [];
2424 for (var i
= 0; i
< propKeys
.length
; i
++) {
2425 var key
= propKeys
[i
];
2426 props
[key
] = validateProp(key
, vm
.$options
.props
, propsData
, vm
);
2428 observerState
.shouldConvert
= true;
2429 // keep a copy of raw propsData
2430 vm
.$options
.propsData
= propsData
;
2435 var oldListeners
= vm
.$options
._parentListeners
;
2436 vm
.$options
._parentListeners
= listeners
;
2437 updateComponentListeners(vm
, listeners
, oldListeners
);
2439 // resolve slots + force update if has children
2441 vm
.$slots
= resolveSlots(renderChildren
, parentVnode
.context
);
2445 if (process
.env
.NODE_ENV
!== 'production') {
2446 isUpdatingChildComponent
= false;
2450 function isInInactiveTree(vm
) {
2451 while (vm
&& (vm
= vm
.$parent
)) {
2459 function activateChildComponent(vm
, direct
) {
2461 vm
._directInactive
= false;
2462 if (isInInactiveTree(vm
)) {
2465 } else if (vm
._directInactive
) {
2468 if (vm
._inactive
|| vm
._inactive
=== null) {
2469 vm
._inactive
= false;
2470 for (var i
= 0; i
< vm
.$children
.length
; i
++) {
2471 activateChildComponent(vm
.$children
[i
]);
2473 callHook(vm
, 'activated');
2477 function deactivateChildComponent(vm
, direct
) {
2479 vm
._directInactive
= true;
2480 if (isInInactiveTree(vm
)) {
2484 if (!vm
._inactive
) {
2485 vm
._inactive
= true;
2486 for (var i
= 0; i
< vm
.$children
.length
; i
++) {
2487 deactivateChildComponent(vm
.$children
[i
]);
2489 callHook(vm
, 'deactivated');
2493 function callHook(vm
, hook
) {
2494 var handlers
= vm
.$options
[hook
];
2496 for (var i
= 0, j
= handlers
.length
; i
< j
; i
++) {
2498 handlers
[i
].call(vm
);
2500 handleError(e
, vm
, hook
+ " hook");
2504 if (vm
._hasHookEvent
) {
2505 vm
.$emit('hook:' + hook
);
2511 var MAX_UPDATE_COUNT
= 100;
2514 var activatedChildren
= [];
2517 var waiting
= false;
2518 var flushing
= false;
2522 * Reset the scheduler's state.
2524 function resetSchedulerState() {
2525 index
= queue
.length
= activatedChildren
.length
= 0;
2527 if (process
.env
.NODE_ENV
!== 'production') {
2530 waiting
= flushing
= false;
2534 * Flush both queues and run the watchers.
2536 function flushSchedulerQueue() {
2540 // Sort queue before flush.
2541 // This ensures that:
2542 // 1. Components are updated from parent to child. (because parent is always
2543 // created before the child)
2544 // 2. A component's user watchers are run before its render watcher (because
2545 // user watchers are created before the render watcher)
2546 // 3. If a component is destroyed during a parent component's watcher run,
2547 // its watchers can be skipped.
2548 queue
.sort(function (a
, b
) {
2552 // do not cache length because more watchers might be pushed
2553 // as we run existing watchers
2554 for (index
= 0; index
< queue
.length
; index
++) {
2555 watcher
= queue
[index
];
2559 // in dev build, check and stop circular updates.
2560 if (process
.env
.NODE_ENV
!== 'production' && has
[id
] != null) {
2561 circular
[id
] = (circular
[id
] || 0) + 1;
2562 if (circular
[id
] > MAX_UPDATE_COUNT
) {
2563 warn('You may have an infinite update loop ' + (watcher
.user
? "in watcher with expression \"" + watcher
.expression
+ "\"" : "in a component render function."), watcher
.vm
);
2569 // keep copies of post queues before resetting state
2570 var activatedQueue
= activatedChildren
.slice();
2571 var updatedQueue
= queue
.slice();
2573 resetSchedulerState();
2575 // call component updated and activated hooks
2576 callActivatedHooks(activatedQueue
);
2577 callUpdatedHooks(updatedQueue
);
2580 /* istanbul ignore if */
2581 if (devtools
&& config
.devtools
) {
2582 devtools
.emit('flush');
2586 function callUpdatedHooks(queue
) {
2587 var i
= queue
.length
;
2589 var watcher
= queue
[i
];
2590 var vm
= watcher
.vm
;
2591 if (vm
._watcher
=== watcher
&& vm
._isMounted
) {
2592 callHook(vm
, 'updated');
2598 * Queue a kept-alive component that was activated during patch.
2599 * The queue will be processed after the entire tree has been patched.
2601 function queueActivatedComponent(vm
) {
2602 // setting _inactive to false here so that a render function can
2603 // rely on checking whether it's in an inactive tree (e.g. router-view)
2604 vm
._inactive
= false;
2605 activatedChildren
.push(vm
);
2608 function callActivatedHooks(queue
) {
2609 for (var i
= 0; i
< queue
.length
; i
++) {
2610 queue
[i
]._inactive
= true;
2611 activateChildComponent(queue
[i
], true /* true */);
2616 * Push a watcher into the watcher queue.
2617 * Jobs with duplicate IDs will be skipped unless it's
2618 * pushed when the queue is being flushed.
2620 function queueWatcher(watcher
) {
2621 var id
= watcher
.id
;
2622 if (has
[id
] == null) {
2625 queue
.push(watcher
);
2627 // if already flushing, splice the watcher based on its id
2628 // if already past its id, it will be run next immediately.
2629 var i
= queue
.length
- 1;
2630 while (i
> index
&& queue
[i
].id
> watcher
.id
) {
2633 queue
.splice(i
+ 1, 0, watcher
);
2638 nextTick(flushSchedulerQueue
);
2648 * A watcher parses an expression, collects dependencies,
2649 * and fires callback when the expression value changes.
2650 * This is used for both the $watch() api and directives.
2652 var Watcher
= function Watcher(vm
, expOrFn
, cb
, options
) {
2654 vm
._watchers
.push(this);
2657 this.deep
= !!options
.deep
;
2658 this.user
= !!options
.user
;
2659 this.lazy
= !!options
.lazy
;
2660 this.sync
= !!options
.sync
;
2662 this.deep
= this.user
= this.lazy
= this.sync
= false;
2665 this.id
= ++uid
$2; // uid for batching
2667 this.dirty
= this.lazy
; // for lazy watchers
2670 this.depIds
= new _Set();
2671 this.newDepIds
= new _Set();
2672 this.expression
= process
.env
.NODE_ENV
!== 'production' ? expOrFn
.toString() : '';
2673 // parse expression for getter
2674 if (typeof expOrFn
=== 'function') {
2675 this.getter
= expOrFn
;
2677 this.getter
= parsePath(expOrFn
);
2679 this.getter = function () {};
2680 process
.env
.NODE_ENV
!== 'production' && warn("Failed watching path: \"" + expOrFn
+ "\" " + 'Watcher only accepts simple dot-delimited paths. ' + 'For full control, use a function instead.', vm
);
2683 this.value
= this.lazy
? undefined : this.get();
2687 * Evaluate the getter, and re-collect dependencies.
2689 Watcher
.prototype.get = function get() {
2694 value
= this.getter
.call(vm
, vm
);
2697 handleError(e
, vm
, "getter for watcher \"" + this.expression
+ "\"");
2702 // "touch" every property so they are all tracked as
2703 // dependencies for deep watching
2714 * Add a dependency to this directive.
2716 Watcher
.prototype.addDep
= function addDep(dep
) {
2718 if (!this.newDepIds
.has(id
)) {
2719 this.newDepIds
.add(id
);
2720 this.newDeps
.push(dep
);
2721 if (!this.depIds
.has(id
)) {
2728 * Clean up for dependency collection.
2730 Watcher
.prototype.cleanupDeps
= function cleanupDeps() {
2733 var i
= this.deps
.length
;
2735 var dep
= this$1.deps
[i
];
2736 if (!this$1.newDepIds
.has(dep
.id
)) {
2737 dep
.removeSub(this$1);
2740 var tmp
= this.depIds
;
2741 this.depIds
= this.newDepIds
;
2742 this.newDepIds
= tmp
;
2743 this.newDepIds
.clear();
2745 this.deps
= this.newDeps
;
2747 this.newDeps
.length
= 0;
2751 * Subscriber interface.
2752 * Will be called when a dependency changes.
2754 Watcher
.prototype.update
= function update() {
2755 /* istanbul ignore else */
2758 } else if (this.sync
) {
2766 * Scheduler job interface.
2767 * Will be called by the scheduler.
2769 Watcher
.prototype.run
= function run() {
2771 var value
= this.get();
2772 if (value
!== this.value
||
2773 // Deep watchers and watchers on Object/Arrays should fire even
2774 // when the value is the same, because the value may
2776 isObject(value
) || this.deep
) {
2778 var oldValue
= this.value
;
2782 this.cb
.call(this.vm
, value
, oldValue
);
2784 handleError(e
, this.vm
, "callback for watcher \"" + this.expression
+ "\"");
2787 this.cb
.call(this.vm
, value
, oldValue
);
2794 * Evaluate the value of the watcher.
2795 * This only gets called for lazy watchers.
2797 Watcher
.prototype.evaluate
= function evaluate() {
2798 this.value
= this.get();
2803 * Depend on all deps collected by this watcher.
2805 Watcher
.prototype.depend
= function depend() {
2808 var i
= this.deps
.length
;
2810 this$1.deps
[i
].depend();
2815 * Remove self from all dependencies' subscriber list.
2817 Watcher
.prototype.teardown
= function teardown() {
2821 // remove self from vm's watcher list
2822 // this is a somewhat expensive operation so we skip it
2823 // if the vm is being destroyed.
2824 if (!this.vm
._isBeingDestroyed
) {
2825 remove(this.vm
._watchers
, this);
2827 var i
= this.deps
.length
;
2829 this$1.deps
[i
].removeSub(this$1);
2831 this.active
= false;
2836 * Recursively traverse an object to evoke all converted
2837 * getters, so that every nested property inside the object
2838 * is collected as a "deep" dependency.
2840 var seenObjects
= new _Set();
2841 function traverse(val
) {
2842 seenObjects
.clear();
2843 _traverse(val
, seenObjects
);
2846 function _traverse(val
, seen
) {
2848 var isA
= Array
.isArray(val
);
2849 if (!isA
&& !isObject(val
) || !Object
.isExtensible(val
)) {
2853 var depId
= val
.__ob__
.dep
.id
;
2854 if (seen
.has(depId
)) {
2862 _traverse(val
[i
], seen
);
2865 keys
= Object
.keys(val
);
2868 _traverse(val
[keys
[i
]], seen
);
2875 var sharedPropertyDefinition
= {
2882 function proxy(target
, sourceKey
, key
) {
2883 sharedPropertyDefinition
.get = function proxyGetter() {
2884 return this[sourceKey
][key
];
2886 sharedPropertyDefinition
.set = function proxySetter(val
) {
2887 this[sourceKey
][key
] = val
;
2889 Object
.defineProperty(target
, key
, sharedPropertyDefinition
);
2892 function initState(vm
) {
2894 var opts
= vm
.$options
;
2896 initProps(vm
, opts
.props
);
2899 initMethods(vm
, opts
.methods
);
2904 observe(vm
._data
= {}, true /* asRootData */);
2906 if (opts
.computed
) {
2907 initComputed(vm
, opts
.computed
);
2909 if (opts
.watch
&& opts
.watch
!== nativeWatch
) {
2910 initWatch(vm
, opts
.watch
);
2914 function checkOptionType(vm
, name
) {
2915 var option
= vm
.$options
[name
];
2916 if (!isPlainObject(option
)) {
2917 warn("component option \"" + name
+ "\" should be an object.", vm
);
2921 function initProps(vm
, propsOptions
) {
2922 var propsData
= vm
.$options
.propsData
|| {};
2923 var props
= vm
._props
= {};
2924 // cache prop keys so that future props updates can iterate using Array
2925 // instead of dynamic object key enumeration.
2926 var keys
= vm
.$options
._propKeys
= [];
2927 var isRoot
= !vm
.$parent
;
2928 // root instance props should be converted
2929 observerState
.shouldConvert
= isRoot
;
2930 var loop = function (key
) {
2932 var value
= validateProp(key
, propsOptions
, propsData
, vm
);
2933 /* istanbul ignore else */
2934 if (process
.env
.NODE_ENV
!== 'production') {
2935 if (isReservedAttribute(key
) || config
.isReservedAttr(key
)) {
2936 warn("\"" + key
+ "\" is a reserved attribute and cannot be used as component prop.", vm
);
2938 defineReactive
$$1(props
, key
, value
, function () {
2939 if (vm
.$parent
&& !isUpdatingChildComponent
) {
2940 warn("Avoid mutating a prop directly since the value will be " + "overwritten whenever the parent component re-renders. " + "Instead, use a data or computed property based on the prop's " + "value. Prop being mutated: \"" + key
+ "\"", vm
);
2944 defineReactive
$$1(props
, key
, value
);
2946 // static props are already proxied on the component's prototype
2947 // during Vue.extend(). We only need to proxy props defined at
2948 // instantiation here.
2950 proxy(vm
, "_props", key
);
2954 for (var key
in propsOptions
) loop(key
);
2955 observerState
.shouldConvert
= true;
2958 function initData(vm
) {
2959 var data
= vm
.$options
.data
;
2960 data
= vm
._data
= typeof data
=== 'function' ? getData(data
, vm
) : data
|| {};
2961 if (!isPlainObject(data
)) {
2963 process
.env
.NODE_ENV
!== 'production' && warn('data functions should return an object:\n' + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm
);
2965 // proxy data on instance
2966 var keys
= Object
.keys(data
);
2967 var props
= vm
.$options
.props
;
2968 var methods
= vm
.$options
.methods
;
2969 var i
= keys
.length
;
2972 if (process
.env
.NODE_ENV
!== 'production') {
2973 if (methods
&& hasOwn(methods
, key
)) {
2974 warn("method \"" + key
+ "\" has already been defined as a data property.", vm
);
2977 if (props
&& hasOwn(props
, key
)) {
2978 process
.env
.NODE_ENV
!== 'production' && warn("The data property \"" + key
+ "\" is already declared as a prop. " + "Use prop default value instead.", vm
);
2979 } else if (!isReserved(key
)) {
2980 proxy(vm
, "_data", key
);
2984 observe(data
, true /* asRootData */);
2987 function getData(data
, vm
) {
2989 return data
.call(vm
);
2991 handleError(e
, vm
, "data()");
2996 var computedWatcherOptions
= { lazy: true };
2998 function initComputed(vm
, computed
) {
2999 process
.env
.NODE_ENV
!== 'production' && checkOptionType(vm
, 'computed');
3000 var watchers
= vm
._computedWatchers
= Object
.create(null);
3002 for (var key
in computed
) {
3003 var userDef
= computed
[key
];
3004 var getter
= typeof userDef
=== 'function' ? userDef : userDef
.get;
3005 if (process
.env
.NODE_ENV
!== 'production' && getter
== null) {
3006 warn("Getter is missing for computed property \"" + key
+ "\".", vm
);
3008 // create internal watcher for the computed property.
3009 watchers
[key
] = new Watcher(vm
, getter
|| noop
, noop
, computedWatcherOptions
);
3011 // component-defined computed properties are already defined on the
3012 // component prototype. We only need to define computed properties defined
3013 // at instantiation here.
3015 defineComputed(vm
, key
, userDef
);
3016 } else if (process
.env
.NODE_ENV
!== 'production') {
3017 if (key
in vm
.$data
) {
3018 warn("The computed property \"" + key
+ "\" is already defined in data.", vm
);
3019 } else if (vm
.$options
.props
&& key
in vm
.$options
.props
) {
3020 warn("The computed property \"" + key
+ "\" is already defined as a prop.", vm
);
3026 function defineComputed(target
, key
, userDef
) {
3027 if (typeof userDef
=== 'function') {
3028 sharedPropertyDefinition
.get = createComputedGetter(key
);
3029 sharedPropertyDefinition
.set = noop
;
3031 sharedPropertyDefinition
.get = userDef
.get ? userDef
.cache
!== false ? createComputedGetter(key
) : userDef
.get : noop
;
3032 sharedPropertyDefinition
.set = userDef
.set ? userDef
.set : noop
;
3034 if (process
.env
.NODE_ENV
!== 'production' && sharedPropertyDefinition
.set === noop
) {
3035 sharedPropertyDefinition
.set = function () {
3036 warn("Computed property \"" + key
+ "\" was assigned to but it has no setter.", this);
3039 Object
.defineProperty(target
, key
, sharedPropertyDefinition
);
3042 function createComputedGetter(key
) {
3043 return function computedGetter() {
3044 var watcher
= this._computedWatchers
&& this._computedWatchers
[key
];
3046 if (watcher
.dirty
) {
3052 return watcher
.value
;
3057 function initMethods(vm
, methods
) {
3058 process
.env
.NODE_ENV
!== 'production' && checkOptionType(vm
, 'methods');
3059 var props
= vm
.$options
.props
;
3060 for (var key
in methods
) {
3061 vm
[key
] = methods
[key
] == null ? noop : bind(methods
[key
], vm
);
3062 if (process
.env
.NODE_ENV
!== 'production') {
3063 if (methods
[key
] == null) {
3064 warn("method \"" + key
+ "\" has an undefined value in the component definition. " + "Did you reference the function correctly?", vm
);
3066 if (props
&& hasOwn(props
, key
)) {
3067 warn("method \"" + key
+ "\" has already been defined as a prop.", vm
);
3073 function initWatch(vm
, watch
) {
3074 process
.env
.NODE_ENV
!== 'production' && checkOptionType(vm
, 'watch');
3075 for (var key
in watch
) {
3076 var handler
= watch
[key
];
3077 if (Array
.isArray(handler
)) {
3078 for (var i
= 0; i
< handler
.length
; i
++) {
3079 createWatcher(vm
, key
, handler
[i
]);
3082 createWatcher(vm
, key
, handler
);
3087 function createWatcher(vm
, keyOrFn
, handler
, options
) {
3088 if (isPlainObject(handler
)) {
3090 handler
= handler
.handler
;
3092 if (typeof handler
=== 'string') {
3093 handler
= vm
[handler
];
3095 return vm
.$watch(keyOrFn
, handler
, options
);
3098 function stateMixin(Vue
) {
3099 // flow somehow has problems with directly declared definition object
3100 // when using Object.defineProperty, so we have to procedurally build up
3103 dataDef
.get = function () {
3107 propsDef
.get = function () {
3110 if (process
.env
.NODE_ENV
!== 'production') {
3111 dataDef
.set = function (newData
) {
3112 warn('Avoid replacing instance root $data. ' + 'Use nested data properties instead.', this);
3114 propsDef
.set = function () {
3115 warn("$props is readonly.", this);
3118 Object
.defineProperty(Vue
.prototype, '$data', dataDef
);
3119 Object
.defineProperty(Vue
.prototype, '$props', propsDef
);
3121 Vue
.prototype.$set = set;
3122 Vue
.prototype.$delete = del
;
3124 Vue
.prototype.$watch = function (expOrFn
, cb
, options
) {
3126 if (isPlainObject(cb
)) {
3127 return createWatcher(vm
, expOrFn
, cb
, options
);
3129 options
= options
|| {};
3130 options
.user
= true;
3131 var watcher
= new Watcher(vm
, expOrFn
, cb
, options
);
3132 if (options
.immediate
) {
3133 cb
.call(vm
, watcher
.value
);
3135 return function unwatchFn() {
3143 function initProvide(vm
) {
3144 var provide
= vm
.$options
.provide
;
3146 vm
._provided
= typeof provide
=== 'function' ? provide
.call(vm
) : provide
;
3150 function initInjections(vm
) {
3151 var result
= resolveInject(vm
.$options
.inject
, vm
);
3153 observerState
.shouldConvert
= false;
3154 Object
.keys(result
).forEach(function (key
) {
3155 /* istanbul ignore else */
3156 if (process
.env
.NODE_ENV
!== 'production') {
3157 defineReactive
$$1(vm
, key
, result
[key
], function () {
3158 warn("Avoid mutating an injected value directly since the changes will be " + "overwritten whenever the provided component re-renders. " + "injection being mutated: \"" + key
+ "\"", vm
);
3161 defineReactive
$$1(vm
, key
, result
[key
]);
3164 observerState
.shouldConvert
= true;
3168 function resolveInject(inject
, vm
) {
3170 // inject is :any because flow is not smart enough to figure out cached
3171 var result
= Object
.create(null);
3172 var keys
= hasSymbol
? Reflect
.ownKeys(inject
) : Object
.keys(inject
);
3174 for (var i
= 0; i
< keys
.length
; i
++) {
3176 var provideKey
= inject
[key
];
3179 if (source
._provided
&& provideKey
in source
._provided
) {
3180 result
[key
] = source
._provided
[provideKey
];
3183 source
= source
.$parent
;
3185 if (process
.env
.NODE_ENV
!== 'production' && !source
) {
3186 warn("Injection \"" + key
+ "\" not found", vm
);
3195 function createFunctionalComponent(Ctor
, propsData
, data
, context
, children
) {
3197 var propOptions
= Ctor
.options
.props
;
3198 if (isDef(propOptions
)) {
3199 for (var key
in propOptions
) {
3200 props
[key
] = validateProp(key
, propOptions
, propsData
|| {});
3203 if (isDef(data
.attrs
)) {
3204 mergeProps(props
, data
.attrs
);
3206 if (isDef(data
.props
)) {
3207 mergeProps(props
, data
.props
);
3210 // ensure the createElement function in functional components
3211 // gets a unique context - this is necessary for correct named slot check
3212 var _context
= Object
.create(context
);
3213 var h = function (a
, b
, c
, d
) {
3214 return createElement(_context
, a
, b
, c
, d
, true);
3216 var vnode
= Ctor
.options
.render
.call(null, h
, {
3221 listeners: data
.on
|| {},
3222 injections: resolveInject(Ctor
.options
.inject
, context
),
3223 slots: function () {
3224 return resolveSlots(children
, context
);
3227 if (vnode
instanceof VNode
) {
3228 vnode
.functionalContext
= context
;
3229 vnode
.functionalOptions
= Ctor
.options
;
3231 (vnode
.data
|| (vnode
.data
= {})).slot
= data
.slot
;
3237 function mergeProps(to
, from) {
3238 for (var key
in from) {
3239 to
[camelize(key
)] = from[key
];
3245 // hooks to be invoked on component VNodes during patch
3246 var componentVNodeHooks
= {
3247 init: function init(vnode
, hydrating
, parentElm
, refElm
) {
3248 if (!vnode
.componentInstance
|| vnode
.componentInstance
._isDestroyed
) {
3249 var child
= vnode
.componentInstance
= createComponentInstanceForVnode(vnode
, activeInstance
, parentElm
, refElm
);
3250 child
.$mount(hydrating
? vnode
.elm : undefined, hydrating
);
3251 } else if (vnode
.data
.keepAlive
) {
3252 // kept-alive components, treat as a patch
3253 var mountedNode
= vnode
; // work around flow
3254 componentVNodeHooks
.prepatch(mountedNode
, mountedNode
);
3258 prepatch: function prepatch(oldVnode
, vnode
) {
3259 var options
= vnode
.componentOptions
;
3260 var child
= vnode
.componentInstance
= oldVnode
.componentInstance
;
3261 updateChildComponent(child
, options
.propsData
, // updated props
3262 options
.listeners
, // updated listeners
3263 vnode
, // new parent vnode
3264 options
.children
// new children
3268 insert: function insert(vnode
) {
3269 var context
= vnode
.context
;
3270 var componentInstance
= vnode
.componentInstance
;
3271 if (!componentInstance
._isMounted
) {
3272 componentInstance
._isMounted
= true;
3273 callHook(componentInstance
, 'mounted');
3275 if (vnode
.data
.keepAlive
) {
3276 if (context
._isMounted
) {
3278 // During updates, a kept-alive component's child components may
3279 // change, so directly walking the tree here may call activated hooks
3280 // on incorrect children. Instead we push them into a queue which will
3281 // be processed after the whole patch process ended.
3282 queueActivatedComponent(componentInstance
);
3284 activateChildComponent(componentInstance
, true /* direct */);
3289 destroy: function destroy(vnode
) {
3290 var componentInstance
= vnode
.componentInstance
;
3291 if (!componentInstance
._isDestroyed
) {
3292 if (!vnode
.data
.keepAlive
) {
3293 componentInstance
.$destroy();
3295 deactivateChildComponent(componentInstance
, true /* direct */);
3301 var hooksToMerge
= Object
.keys(componentVNodeHooks
);
3303 function createComponent(Ctor
, data
, context
, children
, tag
) {
3304 if (isUndef(Ctor
)) {
3308 var baseCtor
= context
.$options
._base
;
3310 // plain options object: turn it into a constructor
3311 if (isObject(Ctor
)) {
3312 Ctor
= baseCtor
.extend(Ctor
);
3315 // if at this stage it's not a constructor or an async component factory,
3317 if (typeof Ctor
!== 'function') {
3318 if (process
.env
.NODE_ENV
!== 'production') {
3319 warn("Invalid Component definition: " + String(Ctor
), context
);
3326 if (isUndef(Ctor
.cid
)) {
3327 asyncFactory
= Ctor
;
3328 Ctor
= resolveAsyncComponent(asyncFactory
, baseCtor
, context
);
3329 if (Ctor
=== undefined) {
3330 // return a placeholder node for async component, which is rendered
3331 // as a comment node but preserves all the raw information for the node.
3332 // the information will be used for async server-rendering and hydration.
3333 return createAsyncPlaceholder(asyncFactory
, data
, context
, children
, tag
);
3339 // resolve constructor options in case global mixins are applied after
3340 // component constructor creation
3341 resolveConstructorOptions(Ctor
);
3343 // transform component v-model data into props & events
3344 if (isDef(data
.model
)) {
3345 transformModel(Ctor
.options
, data
);
3349 var propsData
= extractPropsFromVNodeData(data
, Ctor
, tag
);
3351 // functional component
3352 if (isTrue(Ctor
.options
.functional
)) {
3353 return createFunctionalComponent(Ctor
, propsData
, data
, context
, children
);
3356 // extract listeners, since these needs to be treated as
3357 // child component listeners instead of DOM listeners
3358 var listeners
= data
.on
;
3359 // replace with listeners with .native modifier
3360 // so it gets processed during parent component patch.
3361 data
.on
= data
.nativeOn
;
3363 if (isTrue(Ctor
.options
.abstract)) {
3364 // abstract components do not keep anything
3365 // other than props & listeners & slot
3368 var slot
= data
.slot
;
3375 // merge component management hooks onto the placeholder node
3378 // return a placeholder vnode
3379 var name
= Ctor
.options
.name
|| tag
;
3380 var vnode
= new VNode("vue-component-" + Ctor
.cid
+ (name
? "-" + name : ''), data
, undefined, undefined, undefined, context
, { Ctor: Ctor
, propsData: propsData
, listeners: listeners
, tag: tag
, children: children
}, asyncFactory
);
3384 function createComponentInstanceForVnode(vnode
, // we know it's MountedComponentVNode but flow doesn't
3385 parent
, // activeInstance in lifecycle state
3386 parentElm
, refElm
) {
3387 var vnodeComponentOptions
= vnode
.componentOptions
;
3391 propsData: vnodeComponentOptions
.propsData
,
3392 _componentTag: vnodeComponentOptions
.tag
,
3393 _parentVnode: vnode
,
3394 _parentListeners: vnodeComponentOptions
.listeners
,
3395 _renderChildren: vnodeComponentOptions
.children
,
3396 _parentElm: parentElm
|| null,
3397 _refElm: refElm
|| null
3399 // check inline-template render functions
3400 var inlineTemplate
= vnode
.data
.inlineTemplate
;
3401 if (isDef(inlineTemplate
)) {
3402 options
.render
= inlineTemplate
.render
;
3403 options
.staticRenderFns
= inlineTemplate
.staticRenderFns
;
3405 return new vnodeComponentOptions
.Ctor(options
);
3408 function mergeHooks(data
) {
3412 for (var i
= 0; i
< hooksToMerge
.length
; i
++) {
3413 var key
= hooksToMerge
[i
];
3414 var fromParent
= data
.hook
[key
];
3415 var ours
= componentVNodeHooks
[key
];
3416 data
.hook
[key
] = fromParent
? mergeHook
$1(ours
, fromParent
) : ours
;
3420 function mergeHook
$1(one
, two
) {
3421 return function (a
, b
, c
, d
) {
3427 // transform component v-model info (value and callback) into
3428 // prop and event handler respectively.
3429 function transformModel(options
, data
) {
3430 var prop
= options
.model
&& options
.model
.prop
|| 'value';
3431 var event
= options
.model
&& options
.model
.event
|| 'input';(data
.props
|| (data
.props
= {}))[prop
] = data
.model
.value
;
3432 var on
= data
.on
|| (data
.on
= {});
3433 if (isDef(on
[event
])) {
3434 on
[event
] = [data
.model
.callback
].concat(on
[event
]);
3436 on
[event
] = data
.model
.callback
;
3442 var SIMPLE_NORMALIZE
= 1;
3443 var ALWAYS_NORMALIZE
= 2;
3445 // wrapper function for providing a more flexible interface
3446 // without getting yelled at by flow
3447 function createElement(context
, tag
, data
, children
, normalizationType
, alwaysNormalize
) {
3448 if (Array
.isArray(data
) || isPrimitive(data
)) {
3449 normalizationType
= children
;
3453 if (isTrue(alwaysNormalize
)) {
3454 normalizationType
= ALWAYS_NORMALIZE
;
3456 return _createElement(context
, tag
, data
, children
, normalizationType
);
3459 function _createElement(context
, tag
, data
, children
, normalizationType
) {
3460 if (isDef(data
) && isDef(data
.__ob__
)) {
3461 process
.env
.NODE_ENV
!== 'production' && warn("Avoid using observed data object as vnode data: " + JSON
.stringify(data
) + "\n" + 'Always create fresh vnode data objects in each render!', context
);
3462 return createEmptyVNode();
3464 // object syntax in v-bind
3465 if (isDef(data
) && isDef(data
.is
)) {
3469 // in case of component :is set to falsy value
3470 return createEmptyVNode();
3472 // warn against non-primitive key
3473 if (process
.env
.NODE_ENV
!== 'production' && isDef(data
) && isDef(data
.key
) && !isPrimitive(data
.key
)) {
3474 warn('Avoid using non-primitive value as key, ' + 'use string/number value instead.', context
);
3476 // support single function children as default scoped slot
3477 if (Array
.isArray(children
) && typeof children
[0] === 'function') {
3479 data
.scopedSlots
= { default: children
[0] };
3480 children
.length
= 0;
3482 if (normalizationType
=== ALWAYS_NORMALIZE
) {
3483 children
= normalizeChildren(children
);
3484 } else if (normalizationType
=== SIMPLE_NORMALIZE
) {
3485 children
= simpleNormalizeChildren(children
);
3488 if (typeof tag
=== 'string') {
3490 ns
= config
.getTagNamespace(tag
);
3491 if (config
.isReservedTag(tag
)) {
3492 // platform built-in elements
3493 vnode
= new VNode(config
.parsePlatformTagName(tag
), data
, children
, undefined, undefined, context
);
3494 } else if (isDef(Ctor
= resolveAsset(context
.$options
, 'components', tag
))) {
3496 vnode
= createComponent(Ctor
, data
, context
, children
, tag
);
3498 // unknown or unlisted namespaced elements
3499 // check at runtime because it may get assigned a namespace when its
3500 // parent normalizes children
3501 vnode
= new VNode(tag
, data
, children
, undefined, undefined, context
);
3504 // direct component options / constructor
3505 vnode
= createComponent(tag
, data
, context
, children
);
3513 return createEmptyVNode();
3517 function applyNS(vnode
, ns
) {
3519 if (vnode
.tag
=== 'foreignObject') {
3520 // use default namespace inside foreignObject
3523 if (isDef(vnode
.children
)) {
3524 for (var i
= 0, l
= vnode
.children
.length
; i
< l
; i
++) {
3525 var child
= vnode
.children
[i
];
3526 if (isDef(child
.tag
) && isUndef(child
.ns
)) {
3536 * Runtime helper for rendering v-for lists.
3538 function renderList(val
, render
) {
3539 var ret
, i
, l
, keys
, key
;
3540 if (Array
.isArray(val
) || typeof val
=== 'string') {
3541 ret
= new Array(val
.length
);
3542 for (i
= 0, l
= val
.length
; i
< l
; i
++) {
3543 ret
[i
] = render(val
[i
], i
);
3545 } else if (typeof val
=== 'number') {
3546 ret
= new Array(val
);
3547 for (i
= 0; i
< val
; i
++) {
3548 ret
[i
] = render(i
+ 1, i
);
3550 } else if (isObject(val
)) {
3551 keys
= Object
.keys(val
);
3552 ret
= new Array(keys
.length
);
3553 for (i
= 0, l
= keys
.length
; i
< l
; i
++) {
3555 ret
[i
] = render(val
[key
], key
, i
);
3559 ret
._isVList
= true;
3567 * Runtime helper for rendering <slot>
3569 function renderSlot(name
, fallback
, props
, bindObject
) {
3570 var scopedSlotFn
= this.$scopedSlots
[name
];
3573 props
= props
|| {};
3575 props
= extend(extend({}, bindObject
), props
);
3577 return scopedSlotFn(props
) || fallback
;
3579 var slotNodes
= this.$slots
[name
];
3580 // warn duplicate slot usage
3581 if (slotNodes
&& process
.env
.NODE_ENV
!== 'production') {
3582 slotNodes
._rendered
&& warn("Duplicate presence of slot \"" + name
+ "\" found in the same render tree " + "- this will likely cause render errors.", this);
3583 slotNodes
._rendered
= true;
3585 return slotNodes
|| fallback
;
3592 * Runtime helper for resolving filters
3594 function resolveFilter(id
) {
3595 return resolveAsset(this.$options
, 'filters', id
, true) || identity
;
3601 * Runtime helper for checking keyCodes from config.
3603 function checkKeyCodes(eventKeyCode
, key
, builtInAlias
) {
3604 var keyCodes
= config
.keyCodes
[key
] || builtInAlias
;
3605 if (Array
.isArray(keyCodes
)) {
3606 return keyCodes
.indexOf(eventKeyCode
) === -1;
3608 return keyCodes
!== eventKeyCode
;
3615 * Runtime helper for merging v-bind="object" into a VNode's data.
3617 function bindObjectProps(data
, tag
, value
, asProp
, isSync
) {
3619 if (!isObject(value
)) {
3620 process
.env
.NODE_ENV
!== 'production' && warn('v-bind without argument expects an Object or Array value', this);
3622 if (Array
.isArray(value
)) {
3623 value
= toObject(value
);
3626 var loop = function (key
) {
3627 if (key
=== 'class' || key
=== 'style' || isReservedAttribute(key
)) {
3630 var type
= data
.attrs
&& data
.attrs
.type
;
3631 hash
= asProp
|| config
.mustUseProp(tag
, type
, key
) ? data
.domProps
|| (data
.domProps
= {}) : data
.attrs
|| (data
.attrs
= {});
3633 if (!(key
in hash
)) {
3634 hash
[key
] = value
[key
];
3637 var on
= data
.on
|| (data
.on
= {});
3638 on
["update:" + key
] = function ($event
) {
3639 value
[key
] = $event
;
3645 for (var key
in value
) loop(key
);
3654 * Runtime helper for rendering static trees.
3656 function renderStatic(index
, isInFor
) {
3657 var tree
= this._staticTrees
[index
];
3658 // if has already-rendered static tree and not inside v-for,
3659 // we can reuse the same tree by doing a shallow clone.
3660 if (tree
&& !isInFor
) {
3661 return Array
.isArray(tree
) ? cloneVNodes(tree
) : cloneVNode(tree
);
3663 // otherwise, render a fresh tree.
3664 tree
= this._staticTrees
[index
] = this.$options
.staticRenderFns
[index
].call(this._renderProxy
);
3665 markStatic(tree
, "__static__" + index
, false);
3670 * Runtime helper for v-once.
3671 * Effectively it means marking the node as static with a unique key.
3673 function markOnce(tree
, index
, key
) {
3674 markStatic(tree
, "__once__" + index
+ (key
? "_" + key : ""), true);
3678 function markStatic(tree
, key
, isOnce
) {
3679 if (Array
.isArray(tree
)) {
3680 for (var i
= 0; i
< tree
.length
; i
++) {
3681 if (tree
[i
] && typeof tree
[i
] !== 'string') {
3682 markStaticNode(tree
[i
], key
+ "_" + i
, isOnce
);
3686 markStaticNode(tree
, key
, isOnce
);
3690 function markStaticNode(node
, key
, isOnce
) {
3691 node
.isStatic
= true;
3693 node
.isOnce
= isOnce
;
3698 function bindObjectListeners(data
, value
) {
3700 if (!isPlainObject(value
)) {
3701 process
.env
.NODE_ENV
!== 'production' && warn('v-on without argument expects an Object value', this);
3703 var on
= data
.on
= data
.on
? extend({}, data
.on
) : {};
3704 for (var key
in value
) {
3705 var existing
= on
[key
];
3706 var ours
= value
[key
];
3707 on
[key
] = existing
? [].concat(ours
, existing
) : ours
;
3716 function initRender(vm
) {
3717 vm
._vnode
= null; // the root of the child tree
3718 vm
._staticTrees
= null;
3719 var parentVnode
= vm
.$vnode
= vm
.$options
._parentVnode
; // the placeholder node in parent tree
3720 var renderContext
= parentVnode
&& parentVnode
.context
;
3721 vm
.$slots
= resolveSlots(vm
.$options
._renderChildren
, renderContext
);
3722 vm
.$scopedSlots
= emptyObject
;
3723 // bind the createElement fn to this instance
3724 // so that we get proper render context inside it.
3725 // args order: tag, data, children, normalizationType, alwaysNormalize
3726 // internal version is used by render functions compiled from templates
3727 vm
._c = function (a
, b
, c
, d
) {
3728 return createElement(vm
, a
, b
, c
, d
, false);
3730 // normalization is always applied for the public version, used in
3731 // user-written render functions.
3732 vm
.$createElement = function (a
, b
, c
, d
) {
3733 return createElement(vm
, a
, b
, c
, d
, true);
3736 // $attrs & $listeners are exposed for easier HOC creation.
3737 // they need to be reactive so that HOCs using them are always updated
3738 var parentData
= parentVnode
&& parentVnode
.data
;
3739 /* istanbul ignore else */
3740 if (process
.env
.NODE_ENV
!== 'production') {
3741 defineReactive
$$1(vm
, '$attrs', parentData
&& parentData
.attrs
, function () {
3742 !isUpdatingChildComponent
&& warn("$attrs is readonly.", vm
);
3744 defineReactive
$$1(vm
, '$listeners', vm
.$options
._parentListeners
, function () {
3745 !isUpdatingChildComponent
&& warn("$listeners is readonly.", vm
);
3748 defineReactive
$$1(vm
, '$attrs', parentData
&& parentData
.attrs
, null, true);
3749 defineReactive
$$1(vm
, '$listeners', vm
.$options
._parentListeners
, null, true);
3753 function renderMixin(Vue
) {
3754 Vue
.prototype.$nextTick = function (fn
) {
3755 return nextTick(fn
, this);
3758 Vue
.prototype._render = function () {
3760 var ref
= vm
.$options
;
3761 var render
= ref
.render
;
3762 var staticRenderFns
= ref
.staticRenderFns
;
3763 var _parentVnode
= ref
._parentVnode
;
3765 if (vm
._isMounted
) {
3766 // clone slot nodes on re-renders
3767 for (var key
in vm
.$slots
) {
3768 vm
.$slots
[key
] = cloneVNodes(vm
.$slots
[key
]);
3772 vm
.$scopedSlots
= _parentVnode
&& _parentVnode
.data
.scopedSlots
|| emptyObject
;
3774 if (staticRenderFns
&& !vm
._staticTrees
) {
3775 vm
._staticTrees
= [];
3777 // set parent vnode. this allows render functions to have access
3778 // to the data on the placeholder node.
3779 vm
.$vnode
= _parentVnode
;
3783 vnode
= render
.call(vm
._renderProxy
, vm
.$createElement
);
3785 handleError(e
, vm
, "render function");
3786 // return error render result,
3787 // or previous vnode to prevent render error causing blank component
3788 /* istanbul ignore else */
3789 if (process
.env
.NODE_ENV
!== 'production') {
3790 vnode
= vm
.$options
.renderError
? vm
.$options
.renderError
.call(vm
._renderProxy
, vm
.$createElement
, e
) : vm
._vnode
;
3795 // return empty vnode in case the render function errored out
3796 if (!(vnode
instanceof VNode
)) {
3797 if (process
.env
.NODE_ENV
!== 'production' && Array
.isArray(vnode
)) {
3798 warn('Multiple root nodes returned from render function. Render function ' + 'should return a single root node.', vm
);
3800 vnode
= createEmptyVNode();
3803 vnode
.parent
= _parentVnode
;
3807 // internal render helpers.
3808 // these are exposed on the instance prototype to reduce generated render
3810 Vue
.prototype._o
= markOnce
;
3811 Vue
.prototype._n
= toNumber
;
3812 Vue
.prototype._s
= toString
;
3813 Vue
.prototype._l
= renderList
;
3814 Vue
.prototype._t
= renderSlot
;
3815 Vue
.prototype._q
= looseEqual
;
3816 Vue
.prototype._i
= looseIndexOf
;
3817 Vue
.prototype._m
= renderStatic
;
3818 Vue
.prototype._f
= resolveFilter
;
3819 Vue
.prototype._k
= checkKeyCodes
;
3820 Vue
.prototype._b
= bindObjectProps
;
3821 Vue
.prototype._v
= createTextVNode
;
3822 Vue
.prototype._e
= createEmptyVNode
;
3823 Vue
.prototype._u
= resolveScopedSlots
;
3824 Vue
.prototype._g
= bindObjectListeners
;
3831 function initMixin(Vue
) {
3832 Vue
.prototype._init = function (options
) {
3837 var startTag
, endTag
;
3838 /* istanbul ignore if */
3839 if (process
.env
.NODE_ENV
!== 'production' && config
.performance
&& mark
) {
3840 startTag
= "vue-perf-init:" + vm
._uid
;
3841 endTag
= "vue-perf-end:" + vm
._uid
;
3845 // a flag to avoid this being observed
3848 if (options
&& options
._isComponent
) {
3849 // optimize internal component instantiation
3850 // since dynamic options merging is pretty slow, and none of the
3851 // internal component options needs special treatment.
3852 initInternalComponent(vm
, options
);
3854 vm
.$options
= mergeOptions(resolveConstructorOptions(vm
.constructor), options
|| {}, vm
);
3856 /* istanbul ignore else */
3857 if (process
.env
.NODE_ENV
!== 'production') {
3860 vm
._renderProxy
= vm
;
3867 callHook(vm
, 'beforeCreate');
3868 initInjections(vm
); // resolve injections before data/props
3870 initProvide(vm
); // resolve provide after data/props
3871 callHook(vm
, 'created');
3873 /* istanbul ignore if */
3874 if (process
.env
.NODE_ENV
!== 'production' && config
.performance
&& mark
) {
3875 vm
._name
= formatComponentName(vm
, false);
3877 measure(vm
._name
+ " init", startTag
, endTag
);
3880 if (vm
.$options
.el
) {
3881 vm
.$mount(vm
.$options
.el
);
3886 function initInternalComponent(vm
, options
) {
3887 var opts
= vm
.$options
= Object
.create(vm
.constructor.options
);
3888 // doing this because it's faster than dynamic enumeration.
3889 opts
.parent
= options
.parent
;
3890 opts
.propsData
= options
.propsData
;
3891 opts
._parentVnode
= options
._parentVnode
;
3892 opts
._parentListeners
= options
._parentListeners
;
3893 opts
._renderChildren
= options
._renderChildren
;
3894 opts
._componentTag
= options
._componentTag
;
3895 opts
._parentElm
= options
._parentElm
;
3896 opts
._refElm
= options
._refElm
;
3897 if (options
.render
) {
3898 opts
.render
= options
.render
;
3899 opts
.staticRenderFns
= options
.staticRenderFns
;
3903 function resolveConstructorOptions(Ctor
) {
3904 var options
= Ctor
.options
;
3906 var superOptions
= resolveConstructorOptions(Ctor
.super);
3907 var cachedSuperOptions
= Ctor
.superOptions
;
3908 if (superOptions
!== cachedSuperOptions
) {
3909 // super option changed,
3910 // need to resolve new options.
3911 Ctor
.superOptions
= superOptions
;
3912 // check if there are any late-modified/attached options (#4976)
3913 var modifiedOptions
= resolveModifiedOptions(Ctor
);
3914 // update base extend options
3915 if (modifiedOptions
) {
3916 extend(Ctor
.extendOptions
, modifiedOptions
);
3918 options
= Ctor
.options
= mergeOptions(superOptions
, Ctor
.extendOptions
);
3920 options
.components
[options
.name
] = Ctor
;
3927 function resolveModifiedOptions(Ctor
) {
3929 var latest
= Ctor
.options
;
3930 var extended
= Ctor
.extendOptions
;
3931 var sealed
= Ctor
.sealedOptions
;
3932 for (var key
in latest
) {
3933 if (latest
[key
] !== sealed
[key
]) {
3937 modified
[key
] = dedupe(latest
[key
], extended
[key
], sealed
[key
]);
3943 function dedupe(latest
, extended
, sealed
) {
3944 // compare latest and sealed to ensure lifecycle hooks won't be duplicated
3946 if (Array
.isArray(latest
)) {
3948 sealed
= Array
.isArray(sealed
) ? sealed : [sealed
];
3949 extended
= Array
.isArray(extended
) ? extended : [extended
];
3950 for (var i
= 0; i
< latest
.length
; i
++) {
3951 // push original options and not sealed options to exclude duplicated options
3952 if (extended
.indexOf(latest
[i
]) >= 0 || sealed
.indexOf(latest
[i
]) < 0) {
3953 res
.push(latest
[i
]);
3962 function Vue
$3(options
) {
3963 if (process
.env
.NODE_ENV
!== 'production' && !(this instanceof Vue
$3)) {
3964 warn('Vue is a constructor and should be called with the `new` keyword');
3966 this._init(options
);
3972 lifecycleMixin(Vue
$3);
3977 function initUse(Vue
) {
3978 Vue
.use = function (plugin
) {
3979 var installedPlugins
= this._installedPlugins
|| (this._installedPlugins
= []);
3980 if (installedPlugins
.indexOf(plugin
) > -1) {
3984 // additional parameters
3985 var args
= toArray(arguments
, 1);
3987 if (typeof plugin
.install
=== 'function') {
3988 plugin
.install
.apply(plugin
, args
);
3989 } else if (typeof plugin
=== 'function') {
3990 plugin
.apply(null, args
);
3992 installedPlugins
.push(plugin
);
3999 function initMixin
$1(Vue
) {
4000 Vue
.mixin = function (mixin
) {
4001 this.options
= mergeOptions(this.options
, mixin
);
4008 function initExtend(Vue
) {
4010 * Each instance constructor, including Vue, has a unique
4011 * cid. This enables us to create wrapped "child
4012 * constructors" for prototypal inheritance and cache them.
4020 Vue
.extend = function (extendOptions
) {
4021 extendOptions
= extendOptions
|| {};
4023 var SuperId
= Super
.cid
;
4024 var cachedCtors
= extendOptions
._Ctor
|| (extendOptions
._Ctor
= {});
4025 if (cachedCtors
[SuperId
]) {
4026 return cachedCtors
[SuperId
];
4029 var name
= extendOptions
.name
|| Super
.options
.name
;
4030 if (process
.env
.NODE_ENV
!== 'production') {
4031 if (!/^[a-zA-Z][\w-]*$/.test(name
)) {
4032 warn('Invalid component name: "' + name
+ '". Component names ' + 'can only contain alphanumeric characters and the hyphen, ' + 'and must start with a letter.');
4036 var Sub
= function VueComponent(options
) {
4037 this._init(options
);
4039 Sub
.prototype = Object
.create(Super
.prototype);
4040 Sub
.prototype.constructor = Sub
;
4042 Sub
.options
= mergeOptions(Super
.options
, extendOptions
);
4043 Sub
['super'] = Super
;
4045 // For props and computed properties, we define the proxy getters on
4046 // the Vue instances at extension time, on the extended prototype. This
4047 // avoids Object.defineProperty calls for each instance created.
4048 if (Sub
.options
.props
) {
4051 if (Sub
.options
.computed
) {
4052 initComputed
$1(Sub
);
4055 // allow further extension/mixin/plugin usage
4056 Sub
.extend
= Super
.extend
;
4057 Sub
.mixin
= Super
.mixin
;
4058 Sub
.use = Super
.use;
4060 // create asset registers, so extended classes
4061 // can have their private assets too.
4062 ASSET_TYPES
.forEach(function (type
) {
4063 Sub
[type
] = Super
[type
];
4065 // enable recursive self-lookup
4067 Sub
.options
.components
[name
] = Sub
;
4070 // keep a reference to the super options at extension time.
4071 // later at instantiation we can check if Super's options have
4073 Sub
.superOptions
= Super
.options
;
4074 Sub
.extendOptions
= extendOptions
;
4075 Sub
.sealedOptions
= extend({}, Sub
.options
);
4077 // cache constructor
4078 cachedCtors
[SuperId
] = Sub
;
4083 function initProps
$1(Comp
) {
4084 var props
= Comp
.options
.props
;
4085 for (var key
in props
) {
4086 proxy(Comp
.prototype, "_props", key
);
4090 function initComputed
$1(Comp
) {
4091 var computed
= Comp
.options
.computed
;
4092 for (var key
in computed
) {
4093 defineComputed(Comp
.prototype, key
, computed
[key
]);
4099 function initAssetRegisters(Vue
) {
4101 * Create asset registration methods.
4103 ASSET_TYPES
.forEach(function (type
) {
4104 Vue
[type
] = function (id
, definition
) {
4106 return this.options
[type
+ 's'][id
];
4108 /* istanbul ignore if */
4109 if (process
.env
.NODE_ENV
!== 'production') {
4110 if (type
=== 'component' && config
.isReservedTag(id
)) {
4111 warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + id
);
4114 if (type
=== 'component' && isPlainObject(definition
)) {
4115 definition
.name
= definition
.name
|| id
;
4116 definition
= this.options
._base
.extend(definition
);
4118 if (type
=== 'directive' && typeof definition
=== 'function') {
4119 definition
= { bind: definition
, update: definition
};
4121 this.options
[type
+ 's'][id
] = definition
;
4130 var patternTypes
= [String
, RegExp
, Array
];
4132 function getComponentName(opts
) {
4133 return opts
&& (opts
.Ctor
.options
.name
|| opts
.tag
);
4136 function matches(pattern
, name
) {
4137 if (Array
.isArray(pattern
)) {
4138 return pattern
.indexOf(name
) > -1;
4139 } else if (typeof pattern
=== 'string') {
4140 return pattern
.split(',').indexOf(name
) > -1;
4141 } else if (isRegExp(pattern
)) {
4142 return pattern
.test(name
);
4144 /* istanbul ignore next */
4148 function pruneCache(cache
, current
, filter
) {
4149 for (var key
in cache
) {
4150 var cachedNode
= cache
[key
];
4152 var name
= getComponentName(cachedNode
.componentOptions
);
4153 if (name
&& !filter(name
)) {
4154 if (cachedNode
!== current
) {
4155 pruneCacheEntry(cachedNode
);
4163 function pruneCacheEntry(vnode
) {
4165 vnode
.componentInstance
.$destroy();
4174 include: patternTypes
,
4175 exclude: patternTypes
4178 created: function created() {
4179 this.cache
= Object
.create(null);
4182 destroyed: function destroyed() {
4185 for (var key
in this$1.cache
) {
4186 pruneCacheEntry(this$1.cache
[key
]);
4191 include: function include(val
) {
4192 pruneCache(this.cache
, this._vnode
, function (name
) {
4193 return matches(val
, name
);
4196 exclude: function exclude(val
) {
4197 pruneCache(this.cache
, this._vnode
, function (name
) {
4198 return !matches(val
, name
);
4203 render: function render() {
4204 var vnode
= getFirstComponentChild(this.$slots
.default);
4205 var componentOptions
= vnode
&& vnode
.componentOptions
;
4206 if (componentOptions
) {
4208 var name
= getComponentName(componentOptions
);
4209 if (name
&& (this.include
&& !matches(this.include
, name
) || this.exclude
&& matches(this.exclude
, name
))) {
4212 var key
= vnode
.key
== null
4213 // same constructor may get registered as different local components
4214 // so cid alone is not enough (#3269)
4215 ? componentOptions
.Ctor
.cid
+ (componentOptions
.tag
? "::" + componentOptions
.tag : '') : vnode
.key
;
4216 if (this.cache
[key
]) {
4217 vnode
.componentInstance
= this.cache
[key
].componentInstance
;
4219 this.cache
[key
] = vnode
;
4221 vnode
.data
.keepAlive
= true;
4227 var builtInComponents
= {
4228 KeepAlive: KeepAlive
4233 function initGlobalAPI(Vue
) {
4236 configDef
.get = function () {
4239 if (process
.env
.NODE_ENV
!== 'production') {
4240 configDef
.set = function () {
4241 warn('Do not replace the Vue.config object, set individual fields instead.');
4244 Object
.defineProperty(Vue
, 'config', configDef
);
4246 // exposed util methods.
4247 // NOTE: these are not considered part of the public API - avoid relying on
4248 // them unless you are aware of the risk.
4252 mergeOptions: mergeOptions
,
4253 defineReactive: defineReactive
$$1
4258 Vue
.nextTick
= nextTick
;
4260 Vue
.options
= Object
.create(null);
4261 ASSET_TYPES
.forEach(function (type
) {
4262 Vue
.options
[type
+ 's'] = Object
.create(null);
4265 // this is used to identify the "base" constructor to extend all plain-object
4266 // components with in Weex's multi-instance scenarios.
4267 Vue
.options
._base
= Vue
;
4269 extend(Vue
.options
.components
, builtInComponents
);
4274 initAssetRegisters(Vue
);
4277 initGlobalAPI(Vue
$3);
4279 Object
.defineProperty(Vue
$3.prototype, '$isServer', {
4280 get: isServerRendering
4283 Object
.defineProperty(Vue
$3.prototype, '$ssrContext', {
4284 get: function get() {
4285 /* istanbul ignore next */
4286 return this.$vnode
&& this.$vnode
.ssrContext
;
4290 Vue
$3.version
= '2.4.2';
4294 // these are reserved for web because they are directly compiled away
4295 // during template compilation
4296 var isReservedAttr
= makeMap('style,class');
4298 // attributes that should be using props for binding
4299 var acceptValue
= makeMap('input,textarea,option,select');
4300 var mustUseProp = function (tag
, type
, attr
) {
4301 return attr
=== 'value' && acceptValue(tag
) && type
!== 'button' || attr
=== 'selected' && tag
=== 'option' || attr
=== 'checked' && tag
=== 'input' || attr
=== 'muted' && tag
=== 'video';
4304 var isEnumeratedAttr
= makeMap('contenteditable,draggable,spellcheck');
4306 var isBooleanAttr
= makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 'required,reversed,scoped,seamless,selected,sortable,translate,' + 'truespeed,typemustmatch,visible');
4308 var xlinkNS
= 'http://www.w3.org/1999/xlink';
4310 var isXlink = function (name
) {
4311 return name
.charAt(5) === ':' && name
.slice(0, 5) === 'xlink';
4314 var getXlinkProp = function (name
) {
4315 return isXlink(name
) ? name
.slice(6, name
.length
) : '';
4318 var isFalsyAttrValue = function (val
) {
4319 return val
== null || val
=== false;
4324 function genClassForVnode(vnode
) {
4325 var data
= vnode
.data
;
4326 var parentNode
= vnode
;
4327 var childNode
= vnode
;
4328 while (isDef(childNode
.componentInstance
)) {
4329 childNode
= childNode
.componentInstance
._vnode
;
4330 if (childNode
.data
) {
4331 data
= mergeClassData(childNode
.data
, data
);
4334 while (isDef(parentNode
= parentNode
.parent
)) {
4335 if (parentNode
.data
) {
4336 data
= mergeClassData(data
, parentNode
.data
);
4339 return renderClass(data
.staticClass
, data
.class);
4342 function mergeClassData(child
, parent
) {
4344 staticClass: concat(child
.staticClass
, parent
.staticClass
),
4345 class: isDef(child
.class) ? [child
.class, parent
.class] : parent
.class
4349 function renderClass(staticClass
, dynamicClass
) {
4350 if (isDef(staticClass
) || isDef(dynamicClass
)) {
4351 return concat(staticClass
, stringifyClass(dynamicClass
));
4353 /* istanbul ignore next */
4357 function concat(a
, b
) {
4358 return a
? b
? a
+ ' ' + b : a : b
|| '';
4361 function stringifyClass(value
) {
4362 if (Array
.isArray(value
)) {
4363 return stringifyArray(value
);
4365 if (isObject(value
)) {
4366 return stringifyObject(value
);
4368 if (typeof value
=== 'string') {
4371 /* istanbul ignore next */
4375 function stringifyArray(value
) {
4378 for (var i
= 0, l
= value
.length
; i
< l
; i
++) {
4379 if (isDef(stringified
= stringifyClass(value
[i
])) && stringified
!== '') {
4389 function stringifyObject(value
) {
4391 for (var key
in value
) {
4404 var namespaceMap
= {
4405 svg: 'http://www.w3.org/2000/svg',
4406 math: 'http://www.w3.org/1998/Math/MathML'
4409 var isHTMLTag
= makeMap('html,body,base,head,link,meta,style,title,' + 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 'embed,object,param,source,canvas,script,noscript,del,ins,' + 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 'output,progress,select,textarea,' + 'details,dialog,menu,menuitem,summary,' + 'content,element,shadow,template,blockquote,iframe,tfoot');
4411 // this map is intentionally selective, only covering SVG elements that may
4412 // contain child elements.
4413 var isSVG
= makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
4415 var isPreTag = function (tag
) {
4416 return tag
=== 'pre';
4419 var isReservedTag = function (tag
) {
4420 return isHTMLTag(tag
) || isSVG(tag
);
4423 function getTagNamespace(tag
) {
4427 // basic support for MathML
4428 // note it doesn't support other MathML elements being component roots
4429 if (tag
=== 'math') {
4434 var unknownElementCache
= Object
.create(null);
4435 function isUnknownElement(tag
) {
4436 /* istanbul ignore if */
4440 if (isReservedTag(tag
)) {
4443 tag
= tag
.toLowerCase();
4444 /* istanbul ignore if */
4445 if (unknownElementCache
[tag
] != null) {
4446 return unknownElementCache
[tag
];
4448 var el
= document
.createElement(tag
);
4449 if (tag
.indexOf('-') > -1) {
4450 // http://stackoverflow.com/a/28210364/1070244
4451 return unknownElementCache
[tag
] = el
.constructor === window
.HTMLUnknownElement
|| el
.constructor === window
.HTMLElement
;
4453 return unknownElementCache
[tag
] = /HTMLUnknownElement/.test(el
.toString());
4460 * Query an element selector if it's not an element already.
4462 function query(el
) {
4463 if (typeof el
=== 'string') {
4464 var selected
= document
.querySelector(el
);
4466 process
.env
.NODE_ENV
!== 'production' && warn('Cannot find element: ' + el
);
4467 return document
.createElement('div');
4477 function createElement
$1(tagName
, vnode
) {
4478 var elm
= document
.createElement(tagName
);
4479 if (tagName
!== 'select') {
4482 // false or null will remove the attribute but undefined will not
4483 if (vnode
.data
&& vnode
.data
.attrs
&& vnode
.data
.attrs
.multiple
!== undefined) {
4484 elm
.setAttribute('multiple', 'multiple');
4489 function createElementNS(namespace, tagName
) {
4490 return document
.createElementNS(namespaceMap
[namespace], tagName
);
4493 function createTextNode(text
) {
4494 return document
.createTextNode(text
);
4497 function createComment(text
) {
4498 return document
.createComment(text
);
4501 function insertBefore(parentNode
, newNode
, referenceNode
) {
4502 parentNode
.insertBefore(newNode
, referenceNode
);
4505 function removeChild(node
, child
) {
4506 node
.removeChild(child
);
4509 function appendChild(node
, child
) {
4510 node
.appendChild(child
);
4513 function parentNode(node
) {
4514 return node
.parentNode
;
4517 function nextSibling(node
) {
4518 return node
.nextSibling
;
4521 function tagName(node
) {
4522 return node
.tagName
;
4525 function setTextContent(node
, text
) {
4526 node
.textContent
= text
;
4529 function setAttribute(node
, key
, val
) {
4530 node
.setAttribute(key
, val
);
4533 var nodeOps
= Object
.freeze({
4534 createElement: createElement
$1,
4535 createElementNS: createElementNS
,
4536 createTextNode: createTextNode
,
4537 createComment: createComment
,
4538 insertBefore: insertBefore
,
4539 removeChild: removeChild
,
4540 appendChild: appendChild
,
4541 parentNode: parentNode
,
4542 nextSibling: nextSibling
,
4544 setTextContent: setTextContent
,
4545 setAttribute: setAttribute
4551 create: function create(_
, vnode
) {
4554 update: function update(oldVnode
, vnode
) {
4555 if (oldVnode
.data
.ref
!== vnode
.data
.ref
) {
4556 registerRef(oldVnode
, true);
4560 destroy: function destroy(vnode
) {
4561 registerRef(vnode
, true);
4565 function registerRef(vnode
, isRemoval
) {
4566 var key
= vnode
.data
.ref
;
4571 var vm
= vnode
.context
;
4572 var ref
= vnode
.componentInstance
|| vnode
.elm
;
4573 var refs
= vm
.$refs
;
4575 if (Array
.isArray(refs
[key
])) {
4576 remove(refs
[key
], ref
);
4577 } else if (refs
[key
] === ref
) {
4578 refs
[key
] = undefined;
4581 if (vnode
.data
.refInFor
) {
4582 if (!Array
.isArray(refs
[key
])) {
4584 } else if (refs
[key
].indexOf(ref
) < 0) {
4585 // $flow-disable-line
4586 refs
[key
].push(ref
);
4595 * Virtual DOM patching algorithm based on Snabbdom by
4596 * Simon Friis Vindum (@paldepind)
4597 * Licensed under the MIT License
4598 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
4600 * modified by Evan You (@yyx990803)
4604 * Not type-checking this because this file is perf-critical and the cost
4605 * of making flow understand it is not worth it.
4608 var emptyNode
= new VNode('', {}, []);
4610 var hooks
= ['create', 'activate', 'update', 'remove', 'destroy'];
4612 function sameVnode(a
, b
) {
4613 return a
.key
=== b
.key
&& (a
.tag
=== b
.tag
&& a
.isComment
=== b
.isComment
&& isDef(a
.data
) === isDef(b
.data
) && sameInputType(a
, b
) || isTrue(a
.isAsyncPlaceholder
) && a
.asyncFactory
=== b
.asyncFactory
&& isUndef(b
.asyncFactory
.error
));
4616 // Some browsers do not support dynamically changing type for <input>
4617 // so they need to be treated as different nodes
4618 function sameInputType(a
, b
) {
4619 if (a
.tag
!== 'input') {
4623 var typeA
= isDef(i
= a
.data
) && isDef(i
= i
.attrs
) && i
.type
;
4624 var typeB
= isDef(i
= b
.data
) && isDef(i
= i
.attrs
) && i
.type
;
4625 return typeA
=== typeB
;
4628 function createKeyToOldIdx(children
, beginIdx
, endIdx
) {
4631 for (i
= beginIdx
; i
<= endIdx
; ++i
) {
4632 key
= children
[i
].key
;
4640 function createPatchFunction(backend
) {
4644 var modules
= backend
.modules
;
4645 var nodeOps
= backend
.nodeOps
;
4647 for (i
= 0; i
< hooks
.length
; ++i
) {
4649 for (j
= 0; j
< modules
.length
; ++j
) {
4650 if (isDef(modules
[j
][hooks
[i
]])) {
4651 cbs
[hooks
[i
]].push(modules
[j
][hooks
[i
]]);
4656 function emptyNodeAt(elm
) {
4657 return new VNode(nodeOps
.tagName(elm
).toLowerCase(), {}, [], undefined, elm
);
4660 function createRmCb(childElm
, listeners
) {
4661 function remove
$$1() {
4662 if (--remove
$$1.listeners
=== 0) {
4663 removeNode(childElm
);
4666 remove
$$1.listeners
= listeners
;
4670 function removeNode(el
) {
4671 var parent
= nodeOps
.parentNode(el
);
4672 // element may have already been removed due to v-html / v-text
4673 if (isDef(parent
)) {
4674 nodeOps
.removeChild(parent
, el
);
4679 function createElm(vnode
, insertedVnodeQueue
, parentElm
, refElm
, nested
) {
4680 vnode
.isRootInsert
= !nested
; // for transition enter check
4681 if (createComponent(vnode
, insertedVnodeQueue
, parentElm
, refElm
)) {
4685 var data
= vnode
.data
;
4686 var children
= vnode
.children
;
4687 var tag
= vnode
.tag
;
4689 if (process
.env
.NODE_ENV
!== 'production') {
4690 if (data
&& data
.pre
) {
4693 if (!inPre
&& !vnode
.ns
&& !(config
.ignoredElements
.length
&& config
.ignoredElements
.indexOf(tag
) > -1) && config
.isUnknownElement(tag
)) {
4694 warn('Unknown custom element: <' + tag
+ '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.', vnode
.context
);
4697 vnode
.elm
= vnode
.ns
? nodeOps
.createElementNS(vnode
.ns
, tag
) : nodeOps
.createElement(tag
, vnode
);
4700 /* istanbul ignore if */
4702 createChildren(vnode
, children
, insertedVnodeQueue
);
4704 invokeCreateHooks(vnode
, insertedVnodeQueue
);
4706 insert(parentElm
, vnode
.elm
, refElm
);
4709 if (process
.env
.NODE_ENV
!== 'production' && data
&& data
.pre
) {
4712 } else if (isTrue(vnode
.isComment
)) {
4713 vnode
.elm
= nodeOps
.createComment(vnode
.text
);
4714 insert(parentElm
, vnode
.elm
, refElm
);
4716 vnode
.elm
= nodeOps
.createTextNode(vnode
.text
);
4717 insert(parentElm
, vnode
.elm
, refElm
);
4721 function createComponent(vnode
, insertedVnodeQueue
, parentElm
, refElm
) {
4724 var isReactivated
= isDef(vnode
.componentInstance
) && i
.keepAlive
;
4725 if (isDef(i
= i
.hook
) && isDef(i
= i
.init
)) {
4726 i(vnode
, false /* hydrating */, parentElm
, refElm
);
4728 // after calling the init hook, if the vnode is a child component
4729 // it should've created a child instance and mounted it. the child
4730 // component also has set the placeholder vnode's elm.
4731 // in that case we can just return the element and be done.
4732 if (isDef(vnode
.componentInstance
)) {
4733 initComponent(vnode
, insertedVnodeQueue
);
4734 if (isTrue(isReactivated
)) {
4735 reactivateComponent(vnode
, insertedVnodeQueue
, parentElm
, refElm
);
4742 function initComponent(vnode
, insertedVnodeQueue
) {
4743 if (isDef(vnode
.data
.pendingInsert
)) {
4744 insertedVnodeQueue
.push
.apply(insertedVnodeQueue
, vnode
.data
.pendingInsert
);
4745 vnode
.data
.pendingInsert
= null;
4747 vnode
.elm
= vnode
.componentInstance
.$el
;
4748 if (isPatchable(vnode
)) {
4749 invokeCreateHooks(vnode
, insertedVnodeQueue
);
4752 // empty component root.
4753 // skip all element-related modules except for ref (#3455)
4755 // make sure to invoke the insert hook
4756 insertedVnodeQueue
.push(vnode
);
4760 function reactivateComponent(vnode
, insertedVnodeQueue
, parentElm
, refElm
) {
4762 // hack for #4339: a reactivated component with inner transition
4763 // does not trigger because the inner node's created hooks are not called
4764 // again. It's not ideal to involve module-specific logic in here but
4765 // there doesn't seem to be a better way to do it.
4766 var innerNode
= vnode
;
4767 while (innerNode
.componentInstance
) {
4768 innerNode
= innerNode
.componentInstance
._vnode
;
4769 if (isDef(i
= innerNode
.data
) && isDef(i
= i
.transition
)) {
4770 for (i
= 0; i
< cbs
.activate
.length
; ++i
) {
4771 cbs
.activate
[i
](emptyNode
, innerNode
);
4773 insertedVnodeQueue
.push(innerNode
);
4777 // unlike a newly created component,
4778 // a reactivated keep-alive component doesn't insert itself
4779 insert(parentElm
, vnode
.elm
, refElm
);
4782 function insert(parent
, elm
, ref
$$1) {
4783 if (isDef(parent
)) {
4784 if (isDef(ref
$$1)) {
4785 if (ref
$$1.parentNode
=== parent
) {
4786 nodeOps
.insertBefore(parent
, elm
, ref
$$1);
4789 nodeOps
.appendChild(parent
, elm
);
4794 function createChildren(vnode
, children
, insertedVnodeQueue
) {
4795 if (Array
.isArray(children
)) {
4796 for (var i
= 0; i
< children
.length
; ++i
) {
4797 createElm(children
[i
], insertedVnodeQueue
, vnode
.elm
, null, true);
4799 } else if (isPrimitive(vnode
.text
)) {
4800 nodeOps
.appendChild(vnode
.elm
, nodeOps
.createTextNode(vnode
.text
));
4804 function isPatchable(vnode
) {
4805 while (vnode
.componentInstance
) {
4806 vnode
= vnode
.componentInstance
._vnode
;
4808 return isDef(vnode
.tag
);
4811 function invokeCreateHooks(vnode
, insertedVnodeQueue
) {
4812 for (var i
$1 = 0; i
$1 < cbs
.create
.length
; ++i
$1) {
4813 cbs
.create
[i
$1](emptyNode
, vnode
);
4815 i
= vnode
.data
.hook
; // Reuse variable
4817 if (isDef(i
.create
)) {
4818 i
.create(emptyNode
, vnode
);
4820 if (isDef(i
.insert
)) {
4821 insertedVnodeQueue
.push(vnode
);
4826 // set scope id attribute for scoped CSS.
4827 // this is implemented as a special case to avoid the overhead
4828 // of going through the normal attribute patching process.
4829 function setScope(vnode
) {
4831 var ancestor
= vnode
;
4833 if (isDef(i
= ancestor
.context
) && isDef(i
= i
.$options
._scopeId
)) {
4834 nodeOps
.setAttribute(vnode
.elm
, i
, '');
4836 ancestor
= ancestor
.parent
;
4838 // for slot content they should also get the scopeId from the host instance.
4839 if (isDef(i
= activeInstance
) && i
!== vnode
.context
&& isDef(i
= i
.$options
._scopeId
)) {
4840 nodeOps
.setAttribute(vnode
.elm
, i
, '');
4844 function addVnodes(parentElm
, refElm
, vnodes
, startIdx
, endIdx
, insertedVnodeQueue
) {
4845 for (; startIdx
<= endIdx
; ++startIdx
) {
4846 createElm(vnodes
[startIdx
], insertedVnodeQueue
, parentElm
, refElm
);
4850 function invokeDestroyHook(vnode
) {
4852 var data
= vnode
.data
;
4854 if (isDef(i
= data
.hook
) && isDef(i
= i
.destroy
)) {
4857 for (i
= 0; i
< cbs
.destroy
.length
; ++i
) {
4858 cbs
.destroy
[i
](vnode
);
4861 if (isDef(i
= vnode
.children
)) {
4862 for (j
= 0; j
< vnode
.children
.length
; ++j
) {
4863 invokeDestroyHook(vnode
.children
[j
]);
4868 function removeVnodes(parentElm
, vnodes
, startIdx
, endIdx
) {
4869 for (; startIdx
<= endIdx
; ++startIdx
) {
4870 var ch
= vnodes
[startIdx
];
4872 if (isDef(ch
.tag
)) {
4873 removeAndInvokeRemoveHook(ch
);
4874 invokeDestroyHook(ch
);
4883 function removeAndInvokeRemoveHook(vnode
, rm
) {
4884 if (isDef(rm
) || isDef(vnode
.data
)) {
4886 var listeners
= cbs
.remove
.length
+ 1;
4888 // we have a recursively passed down rm callback
4889 // increase the listeners count
4890 rm
.listeners
+= listeners
;
4892 // directly removing
4893 rm
= createRmCb(vnode
.elm
, listeners
);
4895 // recursively invoke hooks on child component root node
4896 if (isDef(i
= vnode
.componentInstance
) && isDef(i
= i
._vnode
) && isDef(i
.data
)) {
4897 removeAndInvokeRemoveHook(i
, rm
);
4899 for (i
= 0; i
< cbs
.remove
.length
; ++i
) {
4900 cbs
.remove
[i
](vnode
, rm
);
4902 if (isDef(i
= vnode
.data
.hook
) && isDef(i
= i
.remove
)) {
4908 removeNode(vnode
.elm
);
4912 function updateChildren(parentElm
, oldCh
, newCh
, insertedVnodeQueue
, removeOnly
) {
4913 var oldStartIdx
= 0;
4914 var newStartIdx
= 0;
4915 var oldEndIdx
= oldCh
.length
- 1;
4916 var oldStartVnode
= oldCh
[0];
4917 var oldEndVnode
= oldCh
[oldEndIdx
];
4918 var newEndIdx
= newCh
.length
- 1;
4919 var newStartVnode
= newCh
[0];
4920 var newEndVnode
= newCh
[newEndIdx
];
4921 var oldKeyToIdx
, idxInOld
, elmToMove
, refElm
;
4923 // removeOnly is a special flag used only by <transition-group>
4924 // to ensure removed elements stay in correct relative positions
4925 // during leaving transitions
4926 var canMove
= !removeOnly
;
4928 while (oldStartIdx
<= oldEndIdx
&& newStartIdx
<= newEndIdx
) {
4929 if (isUndef(oldStartVnode
)) {
4930 oldStartVnode
= oldCh
[++oldStartIdx
]; // Vnode has been moved left
4931 } else if (isUndef(oldEndVnode
)) {
4932 oldEndVnode
= oldCh
[--oldEndIdx
];
4933 } else if (sameVnode(oldStartVnode
, newStartVnode
)) {
4934 patchVnode(oldStartVnode
, newStartVnode
, insertedVnodeQueue
);
4935 oldStartVnode
= oldCh
[++oldStartIdx
];
4936 newStartVnode
= newCh
[++newStartIdx
];
4937 } else if (sameVnode(oldEndVnode
, newEndVnode
)) {
4938 patchVnode(oldEndVnode
, newEndVnode
, insertedVnodeQueue
);
4939 oldEndVnode
= oldCh
[--oldEndIdx
];
4940 newEndVnode
= newCh
[--newEndIdx
];
4941 } else if (sameVnode(oldStartVnode
, newEndVnode
)) {
4942 // Vnode moved right
4943 patchVnode(oldStartVnode
, newEndVnode
, insertedVnodeQueue
);
4944 canMove
&& nodeOps
.insertBefore(parentElm
, oldStartVnode
.elm
, nodeOps
.nextSibling(oldEndVnode
.elm
));
4945 oldStartVnode
= oldCh
[++oldStartIdx
];
4946 newEndVnode
= newCh
[--newEndIdx
];
4947 } else if (sameVnode(oldEndVnode
, newStartVnode
)) {
4949 patchVnode(oldEndVnode
, newStartVnode
, insertedVnodeQueue
);
4950 canMove
&& nodeOps
.insertBefore(parentElm
, oldEndVnode
.elm
, oldStartVnode
.elm
);
4951 oldEndVnode
= oldCh
[--oldEndIdx
];
4952 newStartVnode
= newCh
[++newStartIdx
];
4954 if (isUndef(oldKeyToIdx
)) {
4955 oldKeyToIdx
= createKeyToOldIdx(oldCh
, oldStartIdx
, oldEndIdx
);
4957 idxInOld
= isDef(newStartVnode
.key
) ? oldKeyToIdx
[newStartVnode
.key
] : null;
4958 if (isUndef(idxInOld
)) {
4960 createElm(newStartVnode
, insertedVnodeQueue
, parentElm
, oldStartVnode
.elm
);
4961 newStartVnode
= newCh
[++newStartIdx
];
4963 elmToMove
= oldCh
[idxInOld
];
4964 /* istanbul ignore if */
4965 if (process
.env
.NODE_ENV
!== 'production' && !elmToMove
) {
4966 warn('It seems there are duplicate keys that is causing an update error. ' + 'Make sure each v-for item has a unique key.');
4968 if (sameVnode(elmToMove
, newStartVnode
)) {
4969 patchVnode(elmToMove
, newStartVnode
, insertedVnodeQueue
);
4970 oldCh
[idxInOld
] = undefined;
4971 canMove
&& nodeOps
.insertBefore(parentElm
, elmToMove
.elm
, oldStartVnode
.elm
);
4972 newStartVnode
= newCh
[++newStartIdx
];
4974 // same key but different element. treat as new element
4975 createElm(newStartVnode
, insertedVnodeQueue
, parentElm
, oldStartVnode
.elm
);
4976 newStartVnode
= newCh
[++newStartIdx
];
4981 if (oldStartIdx
> oldEndIdx
) {
4982 refElm
= isUndef(newCh
[newEndIdx
+ 1]) ? null : newCh
[newEndIdx
+ 1].elm
;
4983 addVnodes(parentElm
, refElm
, newCh
, newStartIdx
, newEndIdx
, insertedVnodeQueue
);
4984 } else if (newStartIdx
> newEndIdx
) {
4985 removeVnodes(parentElm
, oldCh
, oldStartIdx
, oldEndIdx
);
4989 function patchVnode(oldVnode
, vnode
, insertedVnodeQueue
, removeOnly
) {
4990 if (oldVnode
=== vnode
) {
4994 var elm
= vnode
.elm
= oldVnode
.elm
;
4996 if (isTrue(oldVnode
.isAsyncPlaceholder
)) {
4997 if (isDef(vnode
.asyncFactory
.resolved
)) {
4998 hydrate(oldVnode
.elm
, vnode
, insertedVnodeQueue
);
5000 vnode
.isAsyncPlaceholder
= true;
5005 // reuse element for static trees.
5006 // note we only do this if the vnode is cloned -
5007 // if the new node is not cloned it means the render functions have been
5008 // reset by the hot-reload-api and we need to do a proper re-render.
5009 if (isTrue(vnode
.isStatic
) && isTrue(oldVnode
.isStatic
) && vnode
.key
=== oldVnode
.key
&& (isTrue(vnode
.isCloned
) || isTrue(vnode
.isOnce
))) {
5010 vnode
.componentInstance
= oldVnode
.componentInstance
;
5015 var data
= vnode
.data
;
5016 if (isDef(data
) && isDef(i
= data
.hook
) && isDef(i
= i
.prepatch
)) {
5020 var oldCh
= oldVnode
.children
;
5021 var ch
= vnode
.children
;
5022 if (isDef(data
) && isPatchable(vnode
)) {
5023 for (i
= 0; i
< cbs
.update
.length
; ++i
) {
5024 cbs
.update
[i
](oldVnode
, vnode
);
5026 if (isDef(i
= data
.hook
) && isDef(i
= i
.update
)) {
5030 if (isUndef(vnode
.text
)) {
5031 if (isDef(oldCh
) && isDef(ch
)) {
5033 updateChildren(elm
, oldCh
, ch
, insertedVnodeQueue
, removeOnly
);
5035 } else if (isDef(ch
)) {
5036 if (isDef(oldVnode
.text
)) {
5037 nodeOps
.setTextContent(elm
, '');
5039 addVnodes(elm
, null, ch
, 0, ch
.length
- 1, insertedVnodeQueue
);
5040 } else if (isDef(oldCh
)) {
5041 removeVnodes(elm
, oldCh
, 0, oldCh
.length
- 1);
5042 } else if (isDef(oldVnode
.text
)) {
5043 nodeOps
.setTextContent(elm
, '');
5045 } else if (oldVnode
.text
!== vnode
.text
) {
5046 nodeOps
.setTextContent(elm
, vnode
.text
);
5049 if (isDef(i
= data
.hook
) && isDef(i
= i
.postpatch
)) {
5055 function invokeInsertHook(vnode
, queue
, initial
) {
5056 // delay insert hooks for component root nodes, invoke them after the
5057 // element is really inserted
5058 if (isTrue(initial
) && isDef(vnode
.parent
)) {
5059 vnode
.parent
.data
.pendingInsert
= queue
;
5061 for (var i
= 0; i
< queue
.length
; ++i
) {
5062 queue
[i
].data
.hook
.insert(queue
[i
]);
5068 // list of modules that can skip create hook during hydration because they
5069 // are already rendered on the client or has no need for initialization
5070 var isRenderedModule
= makeMap('attrs,style,class,staticClass,staticStyle,key');
5072 // Note: this is a browser-only function so we can assume elms are DOM nodes.
5073 function hydrate(elm
, vnode
, insertedVnodeQueue
) {
5074 if (isTrue(vnode
.isComment
) && isDef(vnode
.asyncFactory
)) {
5076 vnode
.isAsyncPlaceholder
= true;
5079 if (process
.env
.NODE_ENV
!== 'production') {
5080 if (!assertNodeMatch(elm
, vnode
)) {
5085 var tag
= vnode
.tag
;
5086 var data
= vnode
.data
;
5087 var children
= vnode
.children
;
5089 if (isDef(i
= data
.hook
) && isDef(i
= i
.init
)) {
5090 i(vnode
, true /* hydrating */);
5092 if (isDef(i
= vnode
.componentInstance
)) {
5093 // child component. it should have hydrated its own tree.
5094 initComponent(vnode
, insertedVnodeQueue
);
5099 if (isDef(children
)) {
5100 // empty element, allow client to pick up and populate children
5101 if (!elm
.hasChildNodes()) {
5102 createChildren(vnode
, children
, insertedVnodeQueue
);
5104 var childrenMatch
= true;
5105 var childNode
= elm
.firstChild
;
5106 for (var i
$1 = 0; i
$1 < children
.length
; i
$1++) {
5107 if (!childNode
|| !hydrate(childNode
, children
[i
$1], insertedVnodeQueue
)) {
5108 childrenMatch
= false;
5111 childNode
= childNode
.nextSibling
;
5113 // if childNode is not null, it means the actual childNodes list is
5114 // longer than the virtual children list.
5115 if (!childrenMatch
|| childNode
) {
5116 if (process
.env
.NODE_ENV
!== 'production' && typeof console
!== 'undefined' && !bailed
) {
5118 console
.warn('Parent: ', elm
);
5119 console
.warn('Mismatching childNodes vs. VNodes: ', elm
.childNodes
, children
);
5126 for (var key
in data
) {
5127 if (!isRenderedModule(key
)) {
5128 invokeCreateHooks(vnode
, insertedVnodeQueue
);
5133 } else if (elm
.data
!== vnode
.text
) {
5134 elm
.data
= vnode
.text
;
5139 function assertNodeMatch(node
, vnode
) {
5140 if (isDef(vnode
.tag
)) {
5141 return vnode
.tag
.indexOf('vue-component') === 0 || vnode
.tag
.toLowerCase() === (node
.tagName
&& node
.tagName
.toLowerCase());
5143 return node
.nodeType
=== (vnode
.isComment
? 8 : 3);
5147 return function patch(oldVnode
, vnode
, hydrating
, removeOnly
, parentElm
, refElm
) {
5148 if (isUndef(vnode
)) {
5149 if (isDef(oldVnode
)) {
5150 invokeDestroyHook(oldVnode
);
5155 var isInitialPatch
= false;
5156 var insertedVnodeQueue
= [];
5158 if (isUndef(oldVnode
)) {
5159 // empty mount (likely as component), create new root element
5160 isInitialPatch
= true;
5161 createElm(vnode
, insertedVnodeQueue
, parentElm
, refElm
);
5163 var isRealElement
= isDef(oldVnode
.nodeType
);
5164 if (!isRealElement
&& sameVnode(oldVnode
, vnode
)) {
5165 // patch existing root node
5166 patchVnode(oldVnode
, vnode
, insertedVnodeQueue
, removeOnly
);
5168 if (isRealElement
) {
5169 // mounting to a real element
5170 // check if this is server-rendered content and if we can perform
5171 // a successful hydration.
5172 if (oldVnode
.nodeType
=== 1 && oldVnode
.hasAttribute(SSR_ATTR
)) {
5173 oldVnode
.removeAttribute(SSR_ATTR
);
5176 if (isTrue(hydrating
)) {
5177 if (hydrate(oldVnode
, vnode
, insertedVnodeQueue
)) {
5178 invokeInsertHook(vnode
, insertedVnodeQueue
, true);
5180 } else if (process
.env
.NODE_ENV
!== 'production') {
5181 warn('The client-side rendered virtual DOM tree is not matching ' + 'server-rendered content. This is likely caused by incorrect ' + 'HTML markup, for example nesting block-level elements inside ' + '<p>, or missing <tbody>. Bailing hydration and performing ' + 'full client-side render.');
5184 // either not server-rendered, or hydration failed.
5185 // create an empty node and replace it
5186 oldVnode
= emptyNodeAt(oldVnode
);
5188 // replacing existing element
5189 var oldElm
= oldVnode
.elm
;
5190 var parentElm
$1 = nodeOps
.parentNode(oldElm
);
5191 createElm(vnode
, insertedVnodeQueue
,
5192 // extremely rare edge case: do not insert if old element is in a
5193 // leaving transition. Only happens when combining transition +
5194 // keep-alive + HOCs. (#4590)
5195 oldElm
._leaveCb
? null : parentElm
$1, nodeOps
.nextSibling(oldElm
));
5197 if (isDef(vnode
.parent
)) {
5198 // component root element replaced.
5199 // update parent placeholder node element, recursively
5200 var ancestor
= vnode
.parent
;
5202 ancestor
.elm
= vnode
.elm
;
5203 ancestor
= ancestor
.parent
;
5205 if (isPatchable(vnode
)) {
5206 for (var i
= 0; i
< cbs
.create
.length
; ++i
) {
5207 cbs
.create
[i
](emptyNode
, vnode
.parent
);
5212 if (isDef(parentElm
$1)) {
5213 removeVnodes(parentElm
$1, [oldVnode
], 0, 0);
5214 } else if (isDef(oldVnode
.tag
)) {
5215 invokeDestroyHook(oldVnode
);
5220 invokeInsertHook(vnode
, insertedVnodeQueue
, isInitialPatch
);
5228 create: updateDirectives
,
5229 update: updateDirectives
,
5230 destroy: function unbindDirectives(vnode
) {
5231 updateDirectives(vnode
, emptyNode
);
5235 function updateDirectives(oldVnode
, vnode
) {
5236 if (oldVnode
.data
.directives
|| vnode
.data
.directives
) {
5237 _update(oldVnode
, vnode
);
5241 function _update(oldVnode
, vnode
) {
5242 var isCreate
= oldVnode
=== emptyNode
;
5243 var isDestroy
= vnode
=== emptyNode
;
5244 var oldDirs
= normalizeDirectives
$1(oldVnode
.data
.directives
, oldVnode
.context
);
5245 var newDirs
= normalizeDirectives
$1(vnode
.data
.directives
, vnode
.context
);
5247 var dirsWithInsert
= [];
5248 var dirsWithPostpatch
= [];
5250 var key
, oldDir
, dir
;
5251 for (key
in newDirs
) {
5252 oldDir
= oldDirs
[key
];
5255 // new directive, bind
5256 callHook
$1(dir
, 'bind', vnode
, oldVnode
);
5257 if (dir
.def
&& dir
.def
.inserted
) {
5258 dirsWithInsert
.push(dir
);
5261 // existing directive, update
5262 dir
.oldValue
= oldDir
.value
;
5263 callHook
$1(dir
, 'update', vnode
, oldVnode
);
5264 if (dir
.def
&& dir
.def
.componentUpdated
) {
5265 dirsWithPostpatch
.push(dir
);
5270 if (dirsWithInsert
.length
) {
5271 var callInsert = function () {
5272 for (var i
= 0; i
< dirsWithInsert
.length
; i
++) {
5273 callHook
$1(dirsWithInsert
[i
], 'inserted', vnode
, oldVnode
);
5277 mergeVNodeHook(vnode
.data
.hook
|| (vnode
.data
.hook
= {}), 'insert', callInsert
);
5283 if (dirsWithPostpatch
.length
) {
5284 mergeVNodeHook(vnode
.data
.hook
|| (vnode
.data
.hook
= {}), 'postpatch', function () {
5285 for (var i
= 0; i
< dirsWithPostpatch
.length
; i
++) {
5286 callHook
$1(dirsWithPostpatch
[i
], 'componentUpdated', vnode
, oldVnode
);
5292 for (key
in oldDirs
) {
5293 if (!newDirs
[key
]) {
5294 // no longer present, unbind
5295 callHook
$1(oldDirs
[key
], 'unbind', oldVnode
, oldVnode
, isDestroy
);
5301 var emptyModifiers
= Object
.create(null);
5303 function normalizeDirectives
$1(dirs
, vm
) {
5304 var res
= Object
.create(null);
5309 for (i
= 0; i
< dirs
.length
; i
++) {
5311 if (!dir
.modifiers
) {
5312 dir
.modifiers
= emptyModifiers
;
5314 res
[getRawDirName(dir
)] = dir
;
5315 dir
.def
= resolveAsset(vm
.$options
, 'directives', dir
.name
, true);
5320 function getRawDirName(dir
) {
5321 return dir
.rawName
|| dir
.name
+ "." + Object
.keys(dir
.modifiers
|| {}).join('.');
5324 function callHook
$1(dir
, hook
, vnode
, oldVnode
, isDestroy
) {
5325 var fn
= dir
.def
&& dir
.def
[hook
];
5328 fn(vnode
.elm
, dir
, vnode
, oldVnode
, isDestroy
);
5330 handleError(e
, vnode
.context
, "directive " + dir
.name
+ " " + hook
+ " hook");
5335 var baseModules
= [ref
, directives
];
5339 function updateAttrs(oldVnode
, vnode
) {
5340 var opts
= vnode
.componentOptions
;
5341 if (isDef(opts
) && opts
.Ctor
.options
.inheritAttrs
=== false) {
5344 if (isUndef(oldVnode
.data
.attrs
) && isUndef(vnode
.data
.attrs
)) {
5348 var elm
= vnode
.elm
;
5349 var oldAttrs
= oldVnode
.data
.attrs
|| {};
5350 var attrs
= vnode
.data
.attrs
|| {};
5351 // clone observed objects, as the user probably wants to mutate it
5352 if (isDef(attrs
.__ob__
)) {
5353 attrs
= vnode
.data
.attrs
= extend({}, attrs
);
5356 for (key
in attrs
) {
5358 old
= oldAttrs
[key
];
5360 setAttr(elm
, key
, cur
);
5363 // #4391: in IE9, setting type can reset value for input[type=radio]
5364 /* istanbul ignore if */
5365 if (isIE9
&& attrs
.value
!== oldAttrs
.value
) {
5366 setAttr(elm
, 'value', attrs
.value
);
5368 for (key
in oldAttrs
) {
5369 if (isUndef(attrs
[key
])) {
5371 elm
.removeAttributeNS(xlinkNS
, getXlinkProp(key
));
5372 } else if (!isEnumeratedAttr(key
)) {
5373 elm
.removeAttribute(key
);
5379 function setAttr(el
, key
, value
) {
5380 if (isBooleanAttr(key
)) {
5381 // set attribute for blank value
5382 // e.g. <option disabled>Select one</option>
5383 if (isFalsyAttrValue(value
)) {
5384 el
.removeAttribute(key
);
5386 el
.setAttribute(key
, key
);
5388 } else if (isEnumeratedAttr(key
)) {
5389 el
.setAttribute(key
, isFalsyAttrValue(value
) || value
=== 'false' ? 'false' : 'true');
5390 } else if (isXlink(key
)) {
5391 if (isFalsyAttrValue(value
)) {
5392 el
.removeAttributeNS(xlinkNS
, getXlinkProp(key
));
5394 el
.setAttributeNS(xlinkNS
, key
, value
);
5397 if (isFalsyAttrValue(value
)) {
5398 el
.removeAttribute(key
);
5400 el
.setAttribute(key
, value
);
5406 create: updateAttrs
,
5412 function updateClass(oldVnode
, vnode
) {
5414 var data
= vnode
.data
;
5415 var oldData
= oldVnode
.data
;
5416 if (isUndef(data
.staticClass
) && isUndef(data
.class) && (isUndef(oldData
) || isUndef(oldData
.staticClass
) && isUndef(oldData
.class))) {
5420 var cls
= genClassForVnode(vnode
);
5422 // handle transition classes
5423 var transitionClass
= el
._transitionClasses
;
5424 if (isDef(transitionClass
)) {
5425 cls
= concat(cls
, stringifyClass(transitionClass
));
5429 if (cls
!== el
._prevClass
) {
5430 el
.setAttribute('class', cls
);
5431 el
._prevClass
= cls
;
5436 create: updateClass
,
5442 var validDivisionCharRE
= /[\w).+\-_$\]]/;
5444 function parseFilters(exp
) {
5445 var inSingle
= false;
5446 var inDouble
= false;
5447 var inTemplateString
= false;
5448 var inRegex
= false;
5452 var lastFilterIndex
= 0;
5453 var c
, prev
, i
, expression
, filters
;
5455 for (i
= 0; i
< exp
.length
; i
++) {
5457 c
= exp
.charCodeAt(i
);
5459 if (c
=== 0x27 && prev
!== 0x5C) {
5462 } else if (inDouble
) {
5463 if (c
=== 0x22 && prev
!== 0x5C) {
5466 } else if (inTemplateString
) {
5467 if (c
=== 0x60 && prev
!== 0x5C) {
5468 inTemplateString
= false;
5470 } else if (inRegex
) {
5471 if (c
=== 0x2f && prev
!== 0x5C) {
5474 } else if (c
=== 0x7C && // pipe
5475 exp
.charCodeAt(i
+ 1) !== 0x7C && exp
.charCodeAt(i
- 1) !== 0x7C && !curly
&& !square
&& !paren
) {
5476 if (expression
=== undefined) {
5477 // first filter, end of expression
5478 lastFilterIndex
= i
+ 1;
5479 expression
= exp
.slice(0, i
).trim();
5486 inDouble
= true;break; // "
5488 inSingle
= true;break; // '
5490 inTemplateString
= true;break; // `
5496 square
++;break; // [
5498 square
--;break; // ]
5508 // find first non-whitespace prev char
5509 for (; j
>= 0; j
--) {
5515 if (!p
|| !validDivisionCharRE
.test(p
)) {
5522 if (expression
=== undefined) {
5523 expression
= exp
.slice(0, i
).trim();
5524 } else if (lastFilterIndex
!== 0) {
5528 function pushFilter() {
5529 (filters
|| (filters
= [])).push(exp
.slice(lastFilterIndex
, i
).trim());
5530 lastFilterIndex
= i
+ 1;
5534 for (i
= 0; i
< filters
.length
; i
++) {
5535 expression
= wrapFilter(expression
, filters
[i
]);
5542 function wrapFilter(exp
, filter
) {
5543 var i
= filter
.indexOf('(');
5545 // _f: resolveFilter
5546 return "_f(\"" + filter
+ "\")(" + exp
+ ")";
5548 var name
= filter
.slice(0, i
);
5549 var args
= filter
.slice(i
+ 1);
5550 return "_f(\"" + name
+ "\")(" + exp
+ "," + args
;
5556 function baseWarn(msg
) {
5557 console
.error("[Vue compiler]: " + msg
);
5560 function pluckModuleFunction(modules
, key
) {
5561 return modules
? modules
.map(function (m
) {
5563 }).filter(function (_
) {
5568 function addProp(el
, name
, value
) {
5569 (el
.props
|| (el
.props
= [])).push({ name: name
, value: value
});
5572 function addAttr(el
, name
, value
) {
5573 (el
.attrs
|| (el
.attrs
= [])).push({ name: name
, value: value
});
5576 function addDirective(el
, name
, rawName
, value
, arg
, modifiers
) {
5577 (el
.directives
|| (el
.directives
= [])).push({ name: name
, rawName: rawName
, value: value
, arg: arg
, modifiers: modifiers
});
5580 function addHandler(el
, name
, value
, modifiers
, important
, warn
) {
5581 // warn prevent and passive modifier
5582 /* istanbul ignore if */
5583 if (process
.env
.NODE_ENV
!== 'production' && warn
&& modifiers
&& modifiers
.prevent
&& modifiers
.passive
) {
5584 warn('passive and prevent can\'t be used together. ' + 'Passive handler can\'t prevent default event.');
5586 // check capture modifier
5587 if (modifiers
&& modifiers
.capture
) {
5588 delete modifiers
.capture
;
5589 name
= '!' + name
; // mark the event as captured
5591 if (modifiers
&& modifiers
.once
) {
5592 delete modifiers
.once
;
5593 name
= '~' + name
; // mark the event as once
5595 /* istanbul ignore if */
5596 if (modifiers
&& modifiers
.passive
) {
5597 delete modifiers
.passive
;
5598 name
= '&' + name
; // mark the event as passive
5601 if (modifiers
&& modifiers
.native) {
5602 delete modifiers
.native;
5603 events
= el
.nativeEvents
|| (el
.nativeEvents
= {});
5605 events
= el
.events
|| (el
.events
= {});
5607 var newHandler
= { value: value
, modifiers: modifiers
};
5608 var handlers
= events
[name
];
5609 /* istanbul ignore if */
5610 if (Array
.isArray(handlers
)) {
5611 important
? handlers
.unshift(newHandler
) : handlers
.push(newHandler
);
5612 } else if (handlers
) {
5613 events
[name
] = important
? [newHandler
, handlers
] : [handlers
, newHandler
];
5615 events
[name
] = newHandler
;
5619 function getBindingAttr(el
, name
, getStatic
) {
5620 var dynamicValue
= getAndRemoveAttr(el
, ':' + name
) || getAndRemoveAttr(el
, 'v-bind:' + name
);
5621 if (dynamicValue
!= null) {
5622 return parseFilters(dynamicValue
);
5623 } else if (getStatic
!== false) {
5624 var staticValue
= getAndRemoveAttr(el
, name
);
5625 if (staticValue
!= null) {
5626 return JSON
.stringify(staticValue
);
5631 function getAndRemoveAttr(el
, name
) {
5633 if ((val
= el
.attrsMap
[name
]) != null) {
5634 var list
= el
.attrsList
;
5635 for (var i
= 0, l
= list
.length
; i
< l
; i
++) {
5636 if (list
[i
].name
=== name
) {
5648 * Cross-platform code generation for component v-model
5650 function genComponentModel(el
, value
, modifiers
) {
5651 var ref
= modifiers
|| {};
5652 var number
= ref
.number
;
5653 var trim
= ref
.trim
;
5655 var baseValueExpression
= '$$v';
5656 var valueExpression
= baseValueExpression
;
5658 valueExpression
= "(typeof " + baseValueExpression
+ " === 'string'" + "? " + baseValueExpression
+ ".trim()" + ": " + baseValueExpression
+ ")";
5661 valueExpression
= "_n(" + valueExpression
+ ")";
5663 var assignment
= genAssignmentCode(value
, valueExpression
);
5666 value: "(" + value
+ ")",
5667 expression: "\"" + value
+ "\"",
5668 callback: "function (" + baseValueExpression
+ ") {" + assignment
+ "}"
5673 * Cross-platform codegen helper for generating v-model value assignment code.
5675 function genAssignmentCode(value
, assignment
) {
5676 var modelRs
= parseModel(value
);
5677 if (modelRs
.idx
=== null) {
5678 return value
+ "=" + assignment
;
5680 return "$set(" + modelRs
.exp
+ ", " + modelRs
.idx
+ ", " + assignment
+ ")";
5685 * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
5687 * for loop possible cases:
5691 * - test[test1[idx]]
5693 * - xxx.test[a[a].test1[idx]]
5694 * - test.xxx.a["asa"][test1[idx]]
5703 var expressionEndPos
;
5705 function parseModel(val
) {
5708 index
$1 = expressionPos
= expressionEndPos
= 0;
5710 if (val
.indexOf('[') < 0 || val
.lastIndexOf(']') < len
- 1) {
5719 /* istanbul ignore if */
5720 if (isStringStart(chr
)) {
5722 } else if (chr
=== 0x5B) {
5728 exp: val
.substring(0, expressionPos
),
5729 idx: val
.substring(expressionPos
+ 1, expressionEndPos
)
5734 return str
.charCodeAt(++index
$1);
5738 return index
$1 >= len
;
5741 function isStringStart(chr
) {
5742 return chr
=== 0x22 || chr
=== 0x27;
5745 function parseBracket(chr
) {
5747 expressionPos
= index
$1;
5750 if (isStringStart(chr
)) {
5760 if (inBracket
=== 0) {
5761 expressionEndPos
= index
$1;
5767 function parseString(chr
) {
5768 var stringQuote
= chr
;
5771 if (chr
=== stringQuote
) {
5781 // in some cases, the event used has to be determined at runtime
5782 // so we used some reserved tokens during compile.
5783 var RANGE_TOKEN
= '__r';
5784 var CHECKBOX_RADIO_TOKEN
= '__c';
5786 function model(el
, dir
, _warn
) {
5788 var value
= dir
.value
;
5789 var modifiers
= dir
.modifiers
;
5791 var type
= el
.attrsMap
.type
;
5793 if (process
.env
.NODE_ENV
!== 'production') {
5794 var dynamicType
= el
.attrsMap
['v-bind:type'] || el
.attrsMap
[':type'];
5795 if (tag
=== 'input' && dynamicType
) {
5796 warn
$1("<input :type=\"" + dynamicType
+ "\" v-model=\"" + value
+ "\">:\n" + "v-model does not support dynamic input types. Use v-if branches instead.");
5798 // inputs with type="file" are read only and setting the input's
5799 // value will throw an error.
5800 if (tag
=== 'input' && type
=== 'file') {
5801 warn
$1("<" + el
.tag
+ " v-model=\"" + value
+ "\" type=\"file\">:\n" + "File inputs are read only. Use a v-on:change listener instead.");
5806 genComponentModel(el
, value
, modifiers
);
5807 // component v-model doesn't need extra runtime
5809 } else if (tag
=== 'select') {
5810 genSelect(el
, value
, modifiers
);
5811 } else if (tag
=== 'input' && type
=== 'checkbox') {
5812 genCheckboxModel(el
, value
, modifiers
);
5813 } else if (tag
=== 'input' && type
=== 'radio') {
5814 genRadioModel(el
, value
, modifiers
);
5815 } else if (tag
=== 'input' || tag
=== 'textarea') {
5816 genDefaultModel(el
, value
, modifiers
);
5817 } else if (!config
.isReservedTag(tag
)) {
5818 genComponentModel(el
, value
, modifiers
);
5819 // component v-model doesn't need extra runtime
5821 } else if (process
.env
.NODE_ENV
!== 'production') {
5822 warn
$1("<" + el
.tag
+ " v-model=\"" + value
+ "\">: " + "v-model is not supported on this element type. " + 'If you are working with contenteditable, it\'s recommended to ' + 'wrap a library dedicated for that purpose inside a custom component.');
5825 // ensure runtime directive metadata
5829 function genCheckboxModel(el
, value
, modifiers
) {
5830 var number
= modifiers
&& modifiers
.number
;
5831 var valueBinding
= getBindingAttr(el
, 'value') || 'null';
5832 var trueValueBinding
= getBindingAttr(el
, 'true-value') || 'true';
5833 var falseValueBinding
= getBindingAttr(el
, 'false-value') || 'false';
5834 addProp(el
, 'checked', "Array.isArray(" + value
+ ")" + "?_i(" + value
+ "," + valueBinding
+ ")>-1" + (trueValueBinding
=== 'true' ? ":(" + value
+ ")" : ":_q(" + value
+ "," + trueValueBinding
+ ")"));
5835 addHandler(el
, CHECKBOX_RADIO_TOKEN
, "var $$a=" + value
+ "," + '$$el=$event.target,' + "$$c=$$el.checked?(" + trueValueBinding
+ "):(" + falseValueBinding
+ ");" + 'if(Array.isArray($$a)){' + "var $$v=" + (number
? '_n(' + valueBinding
+ ')' : valueBinding
) + "," + '$$i=_i($$a,$$v);' + "if($$el.checked){$$i<0&&(" + value
+ "=$$a.concat($$v))}" + "else{$$i>-1&&(" + value
+ "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" + "}else{" + genAssignmentCode(value
, '$$c') + "}", null, true);
5838 function genRadioModel(el
, value
, modifiers
) {
5839 var number
= modifiers
&& modifiers
.number
;
5840 var valueBinding
= getBindingAttr(el
, 'value') || 'null';
5841 valueBinding
= number
? "_n(" + valueBinding
+ ")" : valueBinding
;
5842 addProp(el
, 'checked', "_q(" + value
+ "," + valueBinding
+ ")");
5843 addHandler(el
, CHECKBOX_RADIO_TOKEN
, genAssignmentCode(value
, valueBinding
), null, true);
5846 function genSelect(el
, value
, modifiers
) {
5847 var number
= modifiers
&& modifiers
.number
;
5848 var selectedVal
= "Array.prototype.filter" + ".call($event.target.options,function(o){return o.selected})" + ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + "return " + (number
? '_n(val)' : 'val') + "})";
5850 var assignment
= '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
5851 var code
= "var $$selectedVal = " + selectedVal
+ ";";
5852 code
= code
+ " " + genAssignmentCode(value
, assignment
);
5853 addHandler(el
, 'change', code
, null, true);
5856 function genDefaultModel(el
, value
, modifiers
) {
5857 var type
= el
.attrsMap
.type
;
5858 var ref
= modifiers
|| {};
5859 var lazy
= ref
.lazy
;
5860 var number
= ref
.number
;
5861 var trim
= ref
.trim
;
5862 var needCompositionGuard
= !lazy
&& type
!== 'range';
5863 var event
= lazy
? 'change' : type
=== 'range' ? RANGE_TOKEN : 'input';
5865 var valueExpression
= '$event.target.value';
5867 valueExpression
= "$event.target.value.trim()";
5870 valueExpression
= "_n(" + valueExpression
+ ")";
5873 var code
= genAssignmentCode(value
, valueExpression
);
5874 if (needCompositionGuard
) {
5875 code
= "if($event.target.composing)return;" + code
;
5878 addProp(el
, 'value', "(" + value
+ ")");
5879 addHandler(el
, event
, code
, null, true);
5880 if (trim
|| number
) {
5881 addHandler(el
, 'blur', '$forceUpdate()');
5887 // normalize v-model event tokens that can only be determined at runtime.
5888 // it's important to place the event as the first in the array because
5889 // the whole point is ensuring the v-model callback gets called before
5890 // user-attached handlers.
5891 function normalizeEvents(on
) {
5893 /* istanbul ignore if */
5894 if (isDef(on
[RANGE_TOKEN
])) {
5895 // IE input[type=range] only supports `change` event
5896 event
= isIE
? 'change' : 'input';
5897 on
[event
] = [].concat(on
[RANGE_TOKEN
], on
[event
] || []);
5898 delete on
[RANGE_TOKEN
];
5900 if (isDef(on
[CHECKBOX_RADIO_TOKEN
])) {
5901 // Chrome fires microtasks in between click/change, leads to #4521
5902 event
= isChrome
? 'click' : 'change';
5903 on
[event
] = [].concat(on
[CHECKBOX_RADIO_TOKEN
], on
[event
] || []);
5904 delete on
[CHECKBOX_RADIO_TOKEN
];
5910 function add
$1(event
, handler
, once
$$1, capture
, passive
) {
5912 var oldHandler
= handler
;
5913 var _target
= target
$1; // save current target element in closure
5914 handler = function (ev
) {
5915 var res
= arguments
.length
=== 1 ? oldHandler(ev
) : oldHandler
.apply(null, arguments
);
5917 remove
$2(event
, handler
, capture
, _target
);
5921 target
$1.addEventListener(event
, handler
, supportsPassive
? { capture: capture
, passive: passive
} : capture
);
5924 function remove
$2(event
, handler
, capture
, _target
) {
5925 (_target
|| target
$1).removeEventListener(event
, handler
, capture
);
5928 function updateDOMListeners(oldVnode
, vnode
) {
5929 if (isUndef(oldVnode
.data
.on
) && isUndef(vnode
.data
.on
)) {
5932 var on
= vnode
.data
.on
|| {};
5933 var oldOn
= oldVnode
.data
.on
|| {};
5934 target
$1 = vnode
.elm
;
5935 normalizeEvents(on
);
5936 updateListeners(on
, oldOn
, add
$1, remove
$2, vnode
.context
);
5940 create: updateDOMListeners
,
5941 update: updateDOMListeners
5946 function updateDOMProps(oldVnode
, vnode
) {
5947 if (isUndef(oldVnode
.data
.domProps
) && isUndef(vnode
.data
.domProps
)) {
5951 var elm
= vnode
.elm
;
5952 var oldProps
= oldVnode
.data
.domProps
|| {};
5953 var props
= vnode
.data
.domProps
|| {};
5954 // clone observed objects, as the user probably wants to mutate it
5955 if (isDef(props
.__ob__
)) {
5956 props
= vnode
.data
.domProps
= extend({}, props
);
5959 for (key
in oldProps
) {
5960 if (isUndef(props
[key
])) {
5964 for (key
in props
) {
5966 // ignore children if the node has textContent or innerHTML,
5967 // as these will throw away existing DOM nodes and cause removal errors
5968 // on subsequent patches (#3360)
5969 if (key
=== 'textContent' || key
=== 'innerHTML') {
5970 if (vnode
.children
) {
5971 vnode
.children
.length
= 0;
5973 if (cur
=== oldProps
[key
]) {
5978 if (key
=== 'value') {
5979 // store value as _value as well since
5980 // non-string values will be stringified
5982 // avoid resetting cursor position when value is the same
5983 var strCur
= isUndef(cur
) ? '' : String(cur
);
5984 if (shouldUpdateValue(elm
, vnode
, strCur
)) {
5993 // check platforms/web/util/attrs.js acceptValue
5996 function shouldUpdateValue(elm
, vnode
, checkVal
) {
5997 return !elm
.composing
&& (vnode
.tag
=== 'option' || isDirty(elm
, checkVal
) || isInputChanged(elm
, checkVal
));
6000 function isDirty(elm
, checkVal
) {
6001 // return true when textbox (.number and .trim) loses focus and its value is
6002 // not equal to the updated value
6003 var notInFocus
= true;
6005 // work around IE bug when accessing document.activeElement in an iframe
6007 notInFocus
= document
.activeElement
!== elm
;
6009 return notInFocus
&& elm
.value
!== checkVal
;
6012 function isInputChanged(elm
, newVal
) {
6013 var value
= elm
.value
;
6014 var modifiers
= elm
._vModifiers
; // injected by v-model runtime
6015 if (isDef(modifiers
) && modifiers
.number
) {
6016 return toNumber(value
) !== toNumber(newVal
);
6018 if (isDef(modifiers
) && modifiers
.trim
) {
6019 return value
.trim() !== newVal
.trim();
6021 return value
!== newVal
;
6025 create: updateDOMProps
,
6026 update: updateDOMProps
6031 var parseStyleText
= cached(function (cssText
) {
6033 var listDelimiter
= /;(?![^(]*\))/g;
6034 var propertyDelimiter
= /:(.+)/;
6035 cssText
.split(listDelimiter
).forEach(function (item
) {
6037 var tmp
= item
.split(propertyDelimiter
);
6038 tmp
.length
> 1 && (res
[tmp
[0].trim()] = tmp
[1].trim());
6044 // merge static and dynamic style data on the same vnode
6045 function normalizeStyleData(data
) {
6046 var style
= normalizeStyleBinding(data
.style
);
6047 // static style is pre-processed into an object during compilation
6048 // and is always a fresh object, so it's safe to merge into it
6049 return data
.staticStyle
? extend(data
.staticStyle
, style
) : style
;
6052 // normalize possible array / string values into Object
6053 function normalizeStyleBinding(bindingStyle
) {
6054 if (Array
.isArray(bindingStyle
)) {
6055 return toObject(bindingStyle
);
6057 if (typeof bindingStyle
=== 'string') {
6058 return parseStyleText(bindingStyle
);
6060 return bindingStyle
;
6064 * parent component style should be after child's
6065 * so that parent component's style could override it
6067 function getStyle(vnode
, checkChild
) {
6072 var childNode
= vnode
;
6073 while (childNode
.componentInstance
) {
6074 childNode
= childNode
.componentInstance
._vnode
;
6075 if (childNode
.data
&& (styleData
= normalizeStyleData(childNode
.data
))) {
6076 extend(res
, styleData
);
6081 if (styleData
= normalizeStyleData(vnode
.data
)) {
6082 extend(res
, styleData
);
6085 var parentNode
= vnode
;
6086 while (parentNode
= parentNode
.parent
) {
6087 if (parentNode
.data
&& (styleData
= normalizeStyleData(parentNode
.data
))) {
6088 extend(res
, styleData
);
6096 var cssVarRE
= /^--/;
6097 var importantRE
= /\s*!important$/;
6098 var setProp = function (el
, name
, val
) {
6099 /* istanbul ignore if */
6100 if (cssVarRE
.test(name
)) {
6101 el
.style
.setProperty(name
, val
);
6102 } else if (importantRE
.test(val
)) {
6103 el
.style
.setProperty(name
, val
.replace(importantRE
, ''), 'important');
6105 var normalizedName
= normalize(name
);
6106 if (Array
.isArray(val
)) {
6107 // Support values array created by autoprefixer, e.g.
6108 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
6109 // Set them one by one, and the browser will only set those it can recognize
6110 for (var i
= 0, len
= val
.length
; i
< len
; i
++) {
6111 el
.style
[normalizedName
] = val
[i
];
6114 el
.style
[normalizedName
] = val
;
6119 var vendorNames
= ['Webkit', 'Moz', 'ms'];
6122 var normalize
= cached(function (prop
) {
6123 emptyStyle
= emptyStyle
|| document
.createElement('div').style
;
6124 prop
= camelize(prop
);
6125 if (prop
!== 'filter' && prop
in emptyStyle
) {
6128 var capName
= prop
.charAt(0).toUpperCase() + prop
.slice(1);
6129 for (var i
= 0; i
< vendorNames
.length
; i
++) {
6130 var name
= vendorNames
[i
] + capName
;
6131 if (name
in emptyStyle
) {
6137 function updateStyle(oldVnode
, vnode
) {
6138 var data
= vnode
.data
;
6139 var oldData
= oldVnode
.data
;
6141 if (isUndef(data
.staticStyle
) && isUndef(data
.style
) && isUndef(oldData
.staticStyle
) && isUndef(oldData
.style
)) {
6147 var oldStaticStyle
= oldData
.staticStyle
;
6148 var oldStyleBinding
= oldData
.normalizedStyle
|| oldData
.style
|| {};
6150 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
6151 var oldStyle
= oldStaticStyle
|| oldStyleBinding
;
6153 var style
= normalizeStyleBinding(vnode
.data
.style
) || {};
6155 // store normalized style under a different key for next diff
6156 // make sure to clone it if it's reactive, since the user likley wants
6158 vnode
.data
.normalizedStyle
= isDef(style
.__ob__
) ? extend({}, style
) : style
;
6160 var newStyle
= getStyle(vnode
, true);
6162 for (name
in oldStyle
) {
6163 if (isUndef(newStyle
[name
])) {
6164 setProp(el
, name
, '');
6167 for (name
in newStyle
) {
6168 cur
= newStyle
[name
];
6169 if (cur
!== oldStyle
[name
]) {
6170 // ie9 setting to null has no effect, must use empty string
6171 setProp(el
, name
, cur
== null ? '' : cur
);
6177 create: updateStyle
,
6184 * Add class with compatibility for SVG since classList is not supported on
6185 * SVG elements in IE
6187 function addClass(el
, cls
) {
6188 /* istanbul ignore if */
6189 if (!cls
|| !(cls
= cls
.trim())) {
6193 /* istanbul ignore else */
6195 if (cls
.indexOf(' ') > -1) {
6196 cls
.split(/\s+/).forEach(function (c
) {
6197 return el
.classList
.add(c
);
6200 el
.classList
.add(cls
);
6203 var cur
= " " + (el
.getAttribute('class') || '') + " ";
6204 if (cur
.indexOf(' ' + cls
+ ' ') < 0) {
6205 el
.setAttribute('class', (cur
+ cls
).trim());
6211 * Remove class with compatibility for SVG since classList is not supported on
6212 * SVG elements in IE
6214 function removeClass(el
, cls
) {
6215 /* istanbul ignore if */
6216 if (!cls
|| !(cls
= cls
.trim())) {
6220 /* istanbul ignore else */
6222 if (cls
.indexOf(' ') > -1) {
6223 cls
.split(/\s+/).forEach(function (c
) {
6224 return el
.classList
.remove(c
);
6227 el
.classList
.remove(cls
);
6229 if (!el
.classList
.length
) {
6230 el
.removeAttribute('class');
6233 var cur
= " " + (el
.getAttribute('class') || '') + " ";
6234 var tar
= ' ' + cls
+ ' ';
6235 while (cur
.indexOf(tar
) >= 0) {
6236 cur
= cur
.replace(tar
, ' ');
6240 el
.setAttribute('class', cur
);
6242 el
.removeAttribute('class');
6249 function resolveTransition(def
$$1) {
6253 /* istanbul ignore else */
6254 if (typeof def
$$1 === 'object') {
6256 if (def
$$1.css
!== false) {
6257 extend(res
, autoCssTransition(def
$$1.name
|| 'v'));
6259 extend(res
, def
$$1);
6261 } else if (typeof def
$$1 === 'string') {
6262 return autoCssTransition(def
$$1);
6266 var autoCssTransition
= cached(function (name
) {
6268 enterClass: name
+ "-enter",
6269 enterToClass: name
+ "-enter-to",
6270 enterActiveClass: name
+ "-enter-active",
6271 leaveClass: name
+ "-leave",
6272 leaveToClass: name
+ "-leave-to",
6273 leaveActiveClass: name
+ "-leave-active"
6277 var hasTransition
= inBrowser
&& !isIE9
;
6278 var TRANSITION
= 'transition';
6279 var ANIMATION
= 'animation';
6281 // Transition property/event sniffing
6282 var transitionProp
= 'transition';
6283 var transitionEndEvent
= 'transitionend';
6284 var animationProp
= 'animation';
6285 var animationEndEvent
= 'animationend';
6286 if (hasTransition
) {
6287 /* istanbul ignore if */
6288 if (window
.ontransitionend
=== undefined && window
.onwebkittransitionend
!== undefined) {
6289 transitionProp
= 'WebkitTransition';
6290 transitionEndEvent
= 'webkitTransitionEnd';
6292 if (window
.onanimationend
=== undefined && window
.onwebkitanimationend
!== undefined) {
6293 animationProp
= 'WebkitAnimation';
6294 animationEndEvent
= 'webkitAnimationEnd';
6298 // binding to window is necessary to make hot reload work in IE in strict mode
6299 var raf
= inBrowser
&& window
.requestAnimationFrame
? window
.requestAnimationFrame
.bind(window
) : setTimeout
;
6301 function nextFrame(fn
) {
6307 function addTransitionClass(el
, cls
) {
6308 var transitionClasses
= el
._transitionClasses
|| (el
._transitionClasses
= []);
6309 if (transitionClasses
.indexOf(cls
) < 0) {
6310 transitionClasses
.push(cls
);
6315 function removeTransitionClass(el
, cls
) {
6316 if (el
._transitionClasses
) {
6317 remove(el
._transitionClasses
, cls
);
6319 removeClass(el
, cls
);
6322 function whenTransitionEnds(el
, expectedType
, cb
) {
6323 var ref
= getTransitionInfo(el
, expectedType
);
6324 var type
= ref
.type
;
6325 var timeout
= ref
.timeout
;
6326 var propCount
= ref
.propCount
;
6330 var event
= type
=== TRANSITION
? transitionEndEvent : animationEndEvent
;
6332 var end = function () {
6333 el
.removeEventListener(event
, onEnd
);
6336 var onEnd = function (e
) {
6337 if (e
.target
=== el
) {
6338 if (++ended
>= propCount
) {
6343 setTimeout(function () {
6344 if (ended
< propCount
) {
6348 el
.addEventListener(event
, onEnd
);
6351 var transformRE
= /\b(transform|all)(,|$)/;
6353 function getTransitionInfo(el
, expectedType
) {
6354 var styles
= window
.getComputedStyle(el
);
6355 var transitionDelays
= styles
[transitionProp
+ 'Delay'].split(', ');
6356 var transitionDurations
= styles
[transitionProp
+ 'Duration'].split(', ');
6357 var transitionTimeout
= getTimeout(transitionDelays
, transitionDurations
);
6358 var animationDelays
= styles
[animationProp
+ 'Delay'].split(', ');
6359 var animationDurations
= styles
[animationProp
+ 'Duration'].split(', ');
6360 var animationTimeout
= getTimeout(animationDelays
, animationDurations
);
6365 /* istanbul ignore if */
6366 if (expectedType
=== TRANSITION
) {
6367 if (transitionTimeout
> 0) {
6369 timeout
= transitionTimeout
;
6370 propCount
= transitionDurations
.length
;
6372 } else if (expectedType
=== ANIMATION
) {
6373 if (animationTimeout
> 0) {
6375 timeout
= animationTimeout
;
6376 propCount
= animationDurations
.length
;
6379 timeout
= Math
.max(transitionTimeout
, animationTimeout
);
6380 type
= timeout
> 0 ? transitionTimeout
> animationTimeout
? TRANSITION : ANIMATION : null;
6381 propCount
= type
? type
=== TRANSITION
? transitionDurations
.length : animationDurations
.length : 0;
6383 var hasTransform
= type
=== TRANSITION
&& transformRE
.test(styles
[transitionProp
+ 'Property']);
6387 propCount: propCount
,
6388 hasTransform: hasTransform
6392 function getTimeout(delays
, durations
) {
6393 /* istanbul ignore next */
6394 while (delays
.length
< durations
.length
) {
6395 delays
= delays
.concat(delays
);
6398 return Math
.max
.apply(null, durations
.map(function (d
, i
) {
6399 return toMs(d
) + toMs(delays
[i
]);
6404 return Number(s
.slice(0, -1)) * 1000;
6409 function enter(vnode
, toggleDisplay
) {
6412 // call leave callback now
6413 if (isDef(el
._leaveCb
)) {
6414 el
._leaveCb
.cancelled
= true;
6418 var data
= resolveTransition(vnode
.data
.transition
);
6419 if (isUndef(data
)) {
6423 /* istanbul ignore if */
6424 if (isDef(el
._enterCb
) || el
.nodeType
!== 1) {
6429 var type
= data
.type
;
6430 var enterClass
= data
.enterClass
;
6431 var enterToClass
= data
.enterToClass
;
6432 var enterActiveClass
= data
.enterActiveClass
;
6433 var appearClass
= data
.appearClass
;
6434 var appearToClass
= data
.appearToClass
;
6435 var appearActiveClass
= data
.appearActiveClass
;
6436 var beforeEnter
= data
.beforeEnter
;
6437 var enter
= data
.enter
;
6438 var afterEnter
= data
.afterEnter
;
6439 var enterCancelled
= data
.enterCancelled
;
6440 var beforeAppear
= data
.beforeAppear
;
6441 var appear
= data
.appear
;
6442 var afterAppear
= data
.afterAppear
;
6443 var appearCancelled
= data
.appearCancelled
;
6444 var duration
= data
.duration
;
6446 // activeInstance will always be the <transition> component managing this
6447 // transition. One edge case to check is when the <transition> is placed
6448 // as the root node of a child component. In that case we need to check
6449 // <transition>'s parent for appear check.
6450 var context
= activeInstance
;
6451 var transitionNode
= activeInstance
.$vnode
;
6452 while (transitionNode
&& transitionNode
.parent
) {
6453 transitionNode
= transitionNode
.parent
;
6454 context
= transitionNode
.context
;
6457 var isAppear
= !context
._isMounted
|| !vnode
.isRootInsert
;
6459 if (isAppear
&& !appear
&& appear
!== '') {
6463 var startClass
= isAppear
&& appearClass
? appearClass : enterClass
;
6464 var activeClass
= isAppear
&& appearActiveClass
? appearActiveClass : enterActiveClass
;
6465 var toClass
= isAppear
&& appearToClass
? appearToClass : enterToClass
;
6467 var beforeEnterHook
= isAppear
? beforeAppear
|| beforeEnter : beforeEnter
;
6468 var enterHook
= isAppear
? typeof appear
=== 'function' ? appear : enter : enter
;
6469 var afterEnterHook
= isAppear
? afterAppear
|| afterEnter : afterEnter
;
6470 var enterCancelledHook
= isAppear
? appearCancelled
|| enterCancelled : enterCancelled
;
6472 var explicitEnterDuration
= toNumber(isObject(duration
) ? duration
.enter : duration
);
6474 if (process
.env
.NODE_ENV
!== 'production' && explicitEnterDuration
!= null) {
6475 checkDuration(explicitEnterDuration
, 'enter', vnode
);
6478 var expectsCSS
= css
!== false && !isIE9
;
6479 var userWantsControl
= getHookArgumentsLength(enterHook
);
6481 var cb
= el
._enterCb
= once(function () {
6483 removeTransitionClass(el
, toClass
);
6484 removeTransitionClass(el
, activeClass
);
6488 removeTransitionClass(el
, startClass
);
6490 enterCancelledHook
&& enterCancelledHook(el
);
6492 afterEnterHook
&& afterEnterHook(el
);
6497 if (!vnode
.data
.show
) {
6498 // remove pending leave element on enter by injecting an insert hook
6499 mergeVNodeHook(vnode
.data
.hook
|| (vnode
.data
.hook
= {}), 'insert', function () {
6500 var parent
= el
.parentNode
;
6501 var pendingNode
= parent
&& parent
._pending
&& parent
._pending
[vnode
.key
];
6502 if (pendingNode
&& pendingNode
.tag
=== vnode
.tag
&& pendingNode
.elm
._leaveCb
) {
6503 pendingNode
.elm
._leaveCb();
6505 enterHook
&& enterHook(el
, cb
);
6509 // start enter transition
6510 beforeEnterHook
&& beforeEnterHook(el
);
6512 addTransitionClass(el
, startClass
);
6513 addTransitionClass(el
, activeClass
);
6514 nextFrame(function () {
6515 addTransitionClass(el
, toClass
);
6516 removeTransitionClass(el
, startClass
);
6517 if (!cb
.cancelled
&& !userWantsControl
) {
6518 if (isValidDuration(explicitEnterDuration
)) {
6519 setTimeout(cb
, explicitEnterDuration
);
6521 whenTransitionEnds(el
, type
, cb
);
6527 if (vnode
.data
.show
) {
6528 toggleDisplay
&& toggleDisplay();
6529 enterHook
&& enterHook(el
, cb
);
6532 if (!expectsCSS
&& !userWantsControl
) {
6537 function leave(vnode
, rm
) {
6540 // call enter callback now
6541 if (isDef(el
._enterCb
)) {
6542 el
._enterCb
.cancelled
= true;
6546 var data
= resolveTransition(vnode
.data
.transition
);
6547 if (isUndef(data
)) {
6551 /* istanbul ignore if */
6552 if (isDef(el
._leaveCb
) || el
.nodeType
!== 1) {
6557 var type
= data
.type
;
6558 var leaveClass
= data
.leaveClass
;
6559 var leaveToClass
= data
.leaveToClass
;
6560 var leaveActiveClass
= data
.leaveActiveClass
;
6561 var beforeLeave
= data
.beforeLeave
;
6562 var leave
= data
.leave
;
6563 var afterLeave
= data
.afterLeave
;
6564 var leaveCancelled
= data
.leaveCancelled
;
6565 var delayLeave
= data
.delayLeave
;
6566 var duration
= data
.duration
;
6568 var expectsCSS
= css
!== false && !isIE9
;
6569 var userWantsControl
= getHookArgumentsLength(leave
);
6571 var explicitLeaveDuration
= toNumber(isObject(duration
) ? duration
.leave : duration
);
6573 if (process
.env
.NODE_ENV
!== 'production' && isDef(explicitLeaveDuration
)) {
6574 checkDuration(explicitLeaveDuration
, 'leave', vnode
);
6577 var cb
= el
._leaveCb
= once(function () {
6578 if (el
.parentNode
&& el
.parentNode
._pending
) {
6579 el
.parentNode
._pending
[vnode
.key
] = null;
6582 removeTransitionClass(el
, leaveToClass
);
6583 removeTransitionClass(el
, leaveActiveClass
);
6587 removeTransitionClass(el
, leaveClass
);
6589 leaveCancelled
&& leaveCancelled(el
);
6592 afterLeave
&& afterLeave(el
);
6598 delayLeave(performLeave
);
6603 function performLeave() {
6604 // the delayed leave may have already been cancelled
6608 // record leaving element
6609 if (!vnode
.data
.show
) {
6610 (el
.parentNode
._pending
|| (el
.parentNode
._pending
= {}))[vnode
.key
] = vnode
;
6612 beforeLeave
&& beforeLeave(el
);
6614 addTransitionClass(el
, leaveClass
);
6615 addTransitionClass(el
, leaveActiveClass
);
6616 nextFrame(function () {
6617 addTransitionClass(el
, leaveToClass
);
6618 removeTransitionClass(el
, leaveClass
);
6619 if (!cb
.cancelled
&& !userWantsControl
) {
6620 if (isValidDuration(explicitLeaveDuration
)) {
6621 setTimeout(cb
, explicitLeaveDuration
);
6623 whenTransitionEnds(el
, type
, cb
);
6628 leave
&& leave(el
, cb
);
6629 if (!expectsCSS
&& !userWantsControl
) {
6635 // only used in dev mode
6636 function checkDuration(val
, name
, vnode
) {
6637 if (typeof val
!== 'number') {
6638 warn("<transition> explicit " + name
+ " duration is not a valid number - " + "got " + JSON
.stringify(val
) + ".", vnode
.context
);
6639 } else if (isNaN(val
)) {
6640 warn("<transition> explicit " + name
+ " duration is NaN - " + 'the duration expression might be incorrect.', vnode
.context
);
6644 function isValidDuration(val
) {
6645 return typeof val
=== 'number' && !isNaN(val
);
6649 * Normalize a transition hook's argument length. The hook may be:
6650 * - a merged hook (invoker) with the original in .fns
6651 * - a wrapped component method (check ._length)
6652 * - a plain function (.length)
6654 function getHookArgumentsLength(fn
) {
6658 var invokerFns
= fn
.fns
;
6659 if (isDef(invokerFns
)) {
6661 return getHookArgumentsLength(Array
.isArray(invokerFns
) ? invokerFns
[0] : invokerFns
);
6663 return (fn
._length
|| fn
.length
) > 1;
6667 function _enter(_
, vnode
) {
6668 if (vnode
.data
.show
!== true) {
6673 var transition
= inBrowser
? {
6676 remove: function remove
$$1(vnode
, rm
) {
6677 /* istanbul ignore else */
6678 if (vnode
.data
.show
!== true) {
6686 var platformModules
= [attrs
, klass
, events
, domProps
, style
, transition
];
6690 // the directive module should be applied last, after all
6691 // built-in modules have been applied.
6692 var modules
= platformModules
.concat(baseModules
);
6694 var patch
= createPatchFunction({ nodeOps: nodeOps
, modules: modules
});
6697 * Not type checking this file because flow doesn't like attaching
6698 * properties to Elements.
6701 var isTextInputType
= makeMap('text,number,password,search,email,tel,url');
6703 /* istanbul ignore if */
6705 // http://www.matts411.com/post/internet-explorer-9-oninput/
6706 document
.addEventListener('selectionchange', function () {
6707 var el
= document
.activeElement
;
6708 if (el
&& el
.vmodel
) {
6709 trigger(el
, 'input');
6715 inserted: function inserted(el
, binding
, vnode
) {
6716 if (vnode
.tag
=== 'select') {
6717 var cb = function () {
6718 setSelected(el
, binding
, vnode
.context
);
6721 /* istanbul ignore if */
6722 if (isIE
|| isEdge
) {
6725 el
._vOptions
= [].map
.call(el
.options
, getValue
);
6726 } else if (vnode
.tag
=== 'textarea' || isTextInputType(el
.type
)) {
6727 el
._vModifiers
= binding
.modifiers
;
6728 if (!binding
.modifiers
.lazy
) {
6729 // Safari < 10.2 & UIWebView doesn't fire compositionend when
6730 // switching focus before confirming composition choice
6731 // this also fixes the issue where some browsers e.g. iOS Chrome
6732 // fires "change" instead of "input" on autocomplete.
6733 el
.addEventListener('change', onCompositionEnd
);
6735 el
.addEventListener('compositionstart', onCompositionStart
);
6736 el
.addEventListener('compositionend', onCompositionEnd
);
6738 /* istanbul ignore if */
6745 componentUpdated: function componentUpdated(el
, binding
, vnode
) {
6746 if (vnode
.tag
=== 'select') {
6747 setSelected(el
, binding
, vnode
.context
);
6748 // in case the options rendered by v-for have changed,
6749 // it's possible that the value is out-of-sync with the rendered options.
6750 // detect such cases and filter out values that no longer has a matching
6751 // option in the DOM.
6752 var prevOptions
= el
._vOptions
;
6753 var curOptions
= el
._vOptions
= [].map
.call(el
.options
, getValue
);
6754 if (curOptions
.some(function (o
, i
) {
6755 return !looseEqual(o
, prevOptions
[i
]);
6757 trigger(el
, 'change');
6763 function setSelected(el
, binding
, vm
) {
6764 var value
= binding
.value
;
6765 var isMultiple
= el
.multiple
;
6766 if (isMultiple
&& !Array
.isArray(value
)) {
6767 process
.env
.NODE_ENV
!== 'production' && warn("<select multiple v-model=\"" + binding
.expression
+ "\"> " + "expects an Array value for its binding, but got " + Object
.prototype.toString
.call(value
).slice(8, -1), vm
);
6770 var selected
, option
;
6771 for (var i
= 0, l
= el
.options
.length
; i
< l
; i
++) {
6772 option
= el
.options
[i
];
6774 selected
= looseIndexOf(value
, getValue(option
)) > -1;
6775 if (option
.selected
!== selected
) {
6776 option
.selected
= selected
;
6779 if (looseEqual(getValue(option
), value
)) {
6780 if (el
.selectedIndex
!== i
) {
6781 el
.selectedIndex
= i
;
6788 el
.selectedIndex
= -1;
6792 function getValue(option
) {
6793 return '_value' in option
? option
._value : option
.value
;
6796 function onCompositionStart(e
) {
6797 e
.target
.composing
= true;
6800 function onCompositionEnd(e
) {
6801 // prevent triggering an input event for no reason
6802 if (!e
.target
.composing
) {
6805 e
.target
.composing
= false;
6806 trigger(e
.target
, 'input');
6809 function trigger(el
, type
) {
6810 var e
= document
.createEvent('HTMLEvents');
6811 e
.initEvent(type
, true, true);
6812 el
.dispatchEvent(e
);
6817 // recursively search for possible transition defined inside the component root
6818 function locateNode(vnode
) {
6819 return vnode
.componentInstance
&& (!vnode
.data
|| !vnode
.data
.transition
) ? locateNode(vnode
.componentInstance
._vnode
) : vnode
;
6823 bind: function bind(el
, ref
, vnode
) {
6824 var value
= ref
.value
;
6826 vnode
= locateNode(vnode
);
6827 var transition
$$1 = vnode
.data
&& vnode
.data
.transition
;
6828 var originalDisplay
= el
.__vOriginalDisplay
= el
.style
.display
=== 'none' ? '' : el
.style
.display
;
6829 if (value
&& transition
$$1) {
6830 vnode
.data
.show
= true;
6831 enter(vnode
, function () {
6832 el
.style
.display
= originalDisplay
;
6835 el
.style
.display
= value
? originalDisplay : 'none';
6839 update: function update(el
, ref
, vnode
) {
6840 var value
= ref
.value
;
6841 var oldValue
= ref
.oldValue
;
6843 /* istanbul ignore if */
6844 if (value
=== oldValue
) {
6847 vnode
= locateNode(vnode
);
6848 var transition
$$1 = vnode
.data
&& vnode
.data
.transition
;
6849 if (transition
$$1) {
6850 vnode
.data
.show
= true;
6852 enter(vnode
, function () {
6853 el
.style
.display
= el
.__vOriginalDisplay
;
6856 leave(vnode
, function () {
6857 el
.style
.display
= 'none';
6861 el
.style
.display
= value
? el
.__vOriginalDisplay : 'none';
6865 unbind: function unbind(el
, binding
, vnode
, oldVnode
, isDestroy
) {
6867 el
.style
.display
= el
.__vOriginalDisplay
;
6872 var platformDirectives
= {
6879 // Provides transition support for a single element/component.
6880 // supports transition mode (out-in / in-out)
6882 var transitionProps
= {
6890 enterToClass: String
,
6891 leaveToClass: String
,
6892 enterActiveClass: String
,
6893 leaveActiveClass: String
,
6894 appearClass: String
,
6895 appearActiveClass: String
,
6896 appearToClass: String
,
6897 duration: [Number
, String
, Object
]
6900 // in case the child is also an abstract component, e.g. <keep-alive>
6901 // we want to recursively retrieve the real component to be rendered
6902 function getRealChild(vnode
) {
6903 var compOptions
= vnode
&& vnode
.componentOptions
;
6904 if (compOptions
&& compOptions
.Ctor
.options
.abstract) {
6905 return getRealChild(getFirstComponentChild(compOptions
.children
));
6911 function extractTransitionData(comp
) {
6913 var options
= comp
.$options
;
6915 for (var key
in options
.propsData
) {
6916 data
[key
] = comp
[key
];
6919 // extract listeners and pass them directly to the transition methods
6920 var listeners
= options
._parentListeners
;
6921 for (var key
$1 in listeners
) {
6922 data
[camelize(key
$1)] = listeners
[key
$1];
6927 function placeholder(h
, rawChild
) {
6928 if (/\d-keep-alive$/.test(rawChild
.tag
)) {
6929 return h('keep-alive', {
6930 props: rawChild
.componentOptions
.propsData
6935 function hasParentTransition(vnode
) {
6936 while (vnode
= vnode
.parent
) {
6937 if (vnode
.data
.transition
) {
6943 function isSameChild(child
, oldChild
) {
6944 return oldChild
.key
=== child
.key
&& oldChild
.tag
=== child
.tag
;
6947 function isAsyncPlaceholder(node
) {
6948 return node
.isComment
&& node
.asyncFactory
;
6953 props: transitionProps
,
6956 render: function render(h
) {
6959 var children
= this.$options
._renderChildren
;
6964 // filter out text nodes (possible whitespaces)
6965 children
= children
.filter(function (c
) {
6966 return c
.tag
|| isAsyncPlaceholder(c
);
6968 /* istanbul ignore if */
6969 if (!children
.length
) {
6973 // warn multiple elements
6974 if (process
.env
.NODE_ENV
!== 'production' && children
.length
> 1) {
6975 warn('<transition> can only be used on a single element. Use ' + '<transition-group> for lists.', this.$parent
);
6978 var mode
= this.mode
;
6980 // warn invalid mode
6981 if (process
.env
.NODE_ENV
!== 'production' && mode
&& mode
!== 'in-out' && mode
!== 'out-in') {
6982 warn('invalid <transition> mode: ' + mode
, this.$parent
);
6985 var rawChild
= children
[0];
6987 // if this is a component root node and the component's
6988 // parent container node also has transition, skip.
6989 if (hasParentTransition(this.$vnode
)) {
6993 // apply transition data to child
6994 // use getRealChild() to ignore abstract components e.g. keep-alive
6995 var child
= getRealChild(rawChild
);
6996 /* istanbul ignore if */
7001 if (this._leaving
) {
7002 return placeholder(h
, rawChild
);
7005 // ensure a key that is unique to the vnode type and to this transition
7006 // component instance. This key will be used to remove pending leaving nodes
7008 var id
= "__transition-" + this._uid
+ "-";
7009 child
.key
= child
.key
== null ? child
.isComment
? id
+ 'comment' : id
+ child
.tag : isPrimitive(child
.key
) ? String(child
.key
).indexOf(id
) === 0 ? child
.key : id
+ child
.key : child
.key
;
7011 var data
= (child
.data
|| (child
.data
= {})).transition
= extractTransitionData(this);
7012 var oldRawChild
= this._vnode
;
7013 var oldChild
= getRealChild(oldRawChild
);
7016 // so that the transition module can hand over the control to the directive
7017 if (child
.data
.directives
&& child
.data
.directives
.some(function (d
) {
7018 return d
.name
=== 'show';
7020 child
.data
.show
= true;
7023 if (oldChild
&& oldChild
.data
&& !isSameChild(child
, oldChild
) && !isAsyncPlaceholder(oldChild
)) {
7024 // replace old child transition data with fresh one
7025 // important for dynamic transitions!
7026 var oldData
= oldChild
&& (oldChild
.data
.transition
= extend({}, data
));
7027 // handle transition mode
7028 if (mode
=== 'out-in') {
7029 // return placeholder node and queue update when leave finishes
7030 this._leaving
= true;
7031 mergeVNodeHook(oldData
, 'afterLeave', function () {
7032 this$1._leaving
= false;
7033 this$1.$forceUpdate();
7035 return placeholder(h
, rawChild
);
7036 } else if (mode
=== 'in-out') {
7037 if (isAsyncPlaceholder(child
)) {
7041 var performLeave = function () {
7044 mergeVNodeHook(data
, 'afterEnter', performLeave
);
7045 mergeVNodeHook(data
, 'enterCancelled', performLeave
);
7046 mergeVNodeHook(oldData
, 'delayLeave', function (leave
) {
7047 delayedLeave
= leave
;
7058 // Provides transition support for list items.
7059 // supports move transitions using the FLIP technique.
7061 // Because the vdom's children update algorithm is "unstable" - i.e.
7062 // it doesn't guarantee the relative positioning of removed elements,
7063 // we force transition-group to update its children into two passes:
7064 // in the first pass, we remove all nodes that need to be removed,
7065 // triggering their leaving transition; in the second pass, we insert/move
7066 // into the final desired state. This way in the second pass removed
7067 // nodes will remain where they should be.
7069 var props
= extend({
7072 }, transitionProps
);
7076 var TransitionGroup
= {
7079 render: function render(h
) {
7080 var tag
= this.tag
|| this.$vnode
.data
.tag
|| 'span';
7081 var map
= Object
.create(null);
7082 var prevChildren
= this.prevChildren
= this.children
;
7083 var rawChildren
= this.$slots
.default || [];
7084 var children
= this.children
= [];
7085 var transitionData
= extractTransitionData(this);
7087 for (var i
= 0; i
< rawChildren
.length
; i
++) {
7088 var c
= rawChildren
[i
];
7090 if (c
.key
!= null && String(c
.key
).indexOf('__vlist') !== 0) {
7092 map
[c
.key
] = c
;(c
.data
|| (c
.data
= {})).transition
= transitionData
;
7093 } else if (process
.env
.NODE_ENV
!== 'production') {
7094 var opts
= c
.componentOptions
;
7095 var name
= opts
? opts
.Ctor
.options
.name
|| opts
.tag
|| '' : c
.tag
;
7096 warn("<transition-group> children must be keyed: <" + name
+ ">");
7104 for (var i
$1 = 0; i
$1 < prevChildren
.length
; i
$1++) {
7105 var c
$1 = prevChildren
[i
$1];
7106 c
$1.data
.transition
= transitionData
;
7107 c
$1.data
.pos
= c
$1.elm
.getBoundingClientRect();
7114 this.kept
= h(tag
, null, kept
);
7115 this.removed
= removed
;
7118 return h(tag
, null, children
);
7121 beforeUpdate: function beforeUpdate() {
7122 // force removing pass
7123 this.__patch__(this._vnode
, this.kept
, false, // hydrating
7124 true // removeOnly (!important, avoids unnecessary moves)
7126 this._vnode
= this.kept
;
7129 updated: function updated() {
7130 var children
= this.prevChildren
;
7131 var moveClass
= this.moveClass
|| (this.name
|| 'v') + '-move';
7132 if (!children
.length
|| !this.hasMove(children
[0].elm
, moveClass
)) {
7136 // we divide the work into three loops to avoid mixing DOM reads and writes
7137 // in each iteration - which helps prevent layout thrashing.
7138 children
.forEach(callPendingCbs
);
7139 children
.forEach(recordPosition
);
7140 children
.forEach(applyTranslation
);
7142 // force reflow to put everything in position
7143 var body
= document
.body
;
7144 var f
= body
.offsetHeight
; // eslint-disable-line
7146 children
.forEach(function (c
) {
7150 addTransitionClass(el
, moveClass
);
7151 s
.transform
= s
.WebkitTransform
= s
.transitionDuration
= '';
7152 el
.addEventListener(transitionEndEvent
, el
._moveCb
= function cb(e
) {
7153 if (!e
|| /transform$/.test(e
.propertyName
)) {
7154 el
.removeEventListener(transitionEndEvent
, cb
);
7156 removeTransitionClass(el
, moveClass
);
7164 hasMove: function hasMove(el
, moveClass
) {
7165 /* istanbul ignore if */
7166 if (!hasTransition
) {
7169 /* istanbul ignore if */
7170 if (this._hasMove
) {
7171 return this._hasMove
;
7173 // Detect whether an element with the move class applied has
7174 // CSS transitions. Since the element may be inside an entering
7175 // transition at this very moment, we make a clone of it and remove
7176 // all other transition classes applied to ensure only the move class
7178 var clone
= el
.cloneNode();
7179 if (el
._transitionClasses
) {
7180 el
._transitionClasses
.forEach(function (cls
) {
7181 removeClass(clone
, cls
);
7184 addClass(clone
, moveClass
);
7185 clone
.style
.display
= 'none';
7186 this.$el
.appendChild(clone
);
7187 var info
= getTransitionInfo(clone
);
7188 this.$el
.removeChild(clone
);
7189 return this._hasMove
= info
.hasTransform
;
7194 function callPendingCbs(c
) {
7195 /* istanbul ignore if */
7196 if (c
.elm
._moveCb
) {
7199 /* istanbul ignore if */
7200 if (c
.elm
._enterCb
) {
7205 function recordPosition(c
) {
7206 c
.data
.newPos
= c
.elm
.getBoundingClientRect();
7209 function applyTranslation(c
) {
7210 var oldPos
= c
.data
.pos
;
7211 var newPos
= c
.data
.newPos
;
7212 var dx
= oldPos
.left
- newPos
.left
;
7213 var dy
= oldPos
.top
- newPos
.top
;
7215 c
.data
.moved
= true;
7216 var s
= c
.elm
.style
;
7217 s
.transform
= s
.WebkitTransform
= "translate(" + dx
+ "px," + dy
+ "px)";
7218 s
.transitionDuration
= '0s';
7222 var platformComponents
= {
7223 Transition: Transition
,
7224 TransitionGroup: TransitionGroup
7229 // install platform specific utils
7230 Vue
$3.config
.mustUseProp
= mustUseProp
;
7231 Vue
$3.config
.isReservedTag
= isReservedTag
;
7232 Vue
$3.config
.isReservedAttr
= isReservedAttr
;
7233 Vue
$3.config
.getTagNamespace
= getTagNamespace
;
7234 Vue
$3.config
.isUnknownElement
= isUnknownElement
;
7236 // install platform runtime directives & components
7237 extend(Vue
$3.options
.directives
, platformDirectives
);
7238 extend(Vue
$3.options
.components
, platformComponents
);
7240 // install platform patch function
7241 Vue
$3.prototype.__patch__
= inBrowser
? patch : noop
;
7243 // public mount method
7244 Vue
$3.prototype.$mount = function (el
, hydrating
) {
7245 el
= el
&& inBrowser
? query(el
) : undefined;
7246 return mountComponent(this, el
, hydrating
);
7249 // devtools global hook
7250 /* istanbul ignore next */
7251 setTimeout(function () {
7252 if (config
.devtools
) {
7254 devtools
.emit('init', Vue
$3);
7255 } else if (process
.env
.NODE_ENV
!== 'production' && isChrome
) {
7256 console
[console
.info
? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
7259 if (process
.env
.NODE_ENV
!== 'production' && config
.productionTip
!== false && inBrowser
&& typeof console
!== 'undefined') {
7260 console
[console
.info
? 'info' : 'log']("You are running Vue in development mode.\n" + "Make sure to turn on production mode when deploying for production.\n" + "See more tips at https://vuejs.org/guide/deployment.html");
7266 // check whether current browser encodes a char inside attribute values
7267 function shouldDecode(content
, encoded
) {
7268 var div
= document
.createElement('div');
7269 div
.innerHTML
= "<div a=\"" + content
+ "\"/>";
7270 return div
.innerHTML
.indexOf(encoded
) > 0;
7274 // IE encodes newlines inside attribute values while other browsers don't
7275 var shouldDecodeNewlines
= inBrowser
? shouldDecode('\n', ' ') : false;
7279 var defaultTagRE
= /\{\{((?:.|\n)+?)\}\}/g;
7280 var regexEscapeRE
= /[-.*+?^${}()|[\]\/\\]/g;
7282 var buildRegex
= cached(function (delimiters
) {
7283 var open
= delimiters
[0].replace(regexEscapeRE
, '\\$&');
7284 var close
= delimiters
[1].replace(regexEscapeRE
, '\\$&');
7285 return new RegExp(open
+ '((?:.|\\n)+?)' + close
, 'g');
7288 function parseText(text
, delimiters
) {
7289 var tagRE
= delimiters
? buildRegex(delimiters
) : defaultTagRE
;
7290 if (!tagRE
.test(text
)) {
7294 var lastIndex
= tagRE
.lastIndex
= 0;
7296 while (match
= tagRE
.exec(text
)) {
7297 index
= match
.index
;
7299 if (index
> lastIndex
) {
7300 tokens
.push(JSON
.stringify(text
.slice(lastIndex
, index
)));
7303 var exp
= parseFilters(match
[1].trim());
7304 tokens
.push("_s(" + exp
+ ")");
7305 lastIndex
= index
+ match
[0].length
;
7307 if (lastIndex
< text
.length
) {
7308 tokens
.push(JSON
.stringify(text
.slice(lastIndex
)));
7310 return tokens
.join('+');
7315 function transformNode(el
, options
) {
7316 var warn
= options
.warn
|| baseWarn
;
7317 var staticClass
= getAndRemoveAttr(el
, 'class');
7318 if (process
.env
.NODE_ENV
!== 'production' && staticClass
) {
7319 var expression
= parseText(staticClass
, options
.delimiters
);
7321 warn("class=\"" + staticClass
+ "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div class="{{ val }}">, use <div :class="val">.');
7325 el
.staticClass
= JSON
.stringify(staticClass
);
7327 var classBinding
= getBindingAttr(el
, 'class', false /* getStatic */);
7329 el
.classBinding
= classBinding
;
7333 function genData(el
) {
7335 if (el
.staticClass
) {
7336 data
+= "staticClass:" + el
.staticClass
+ ",";
7338 if (el
.classBinding
) {
7339 data
+= "class:" + el
.classBinding
+ ",";
7345 staticKeys: ['staticClass'],
7346 transformNode: transformNode
,
7352 function transformNode
$1(el
, options
) {
7353 var warn
= options
.warn
|| baseWarn
;
7354 var staticStyle
= getAndRemoveAttr(el
, 'style');
7356 /* istanbul ignore if */
7357 if (process
.env
.NODE_ENV
!== 'production') {
7358 var expression
= parseText(staticStyle
, options
.delimiters
);
7360 warn("style=\"" + staticStyle
+ "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div style="{{ val }}">, use <div :style="val">.');
7363 el
.staticStyle
= JSON
.stringify(parseStyleText(staticStyle
));
7366 var styleBinding
= getBindingAttr(el
, 'style', false /* getStatic */);
7368 el
.styleBinding
= styleBinding
;
7372 function genData
$1(el
) {
7374 if (el
.staticStyle
) {
7375 data
+= "staticStyle:" + el
.staticStyle
+ ",";
7377 if (el
.styleBinding
) {
7378 data
+= "style:(" + el
.styleBinding
+ "),";
7384 staticKeys: ['staticStyle'],
7385 transformNode: transformNode
$1,
7389 var modules
$1 = [klass
$1, style
$1];
7393 function text(el
, dir
) {
7395 addProp(el
, 'textContent', "_s(" + dir
.value
+ ")");
7401 function html(el
, dir
) {
7403 addProp(el
, 'innerHTML', "_s(" + dir
.value
+ ")");
7407 var directives
$1 = {
7415 var isUnaryTag
= makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 'link,meta,param,source,track,wbr');
7417 // Elements that you can, intentionally, leave open
7418 // (and which close themselves)
7419 var canBeLeftOpenTag
= makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
7421 // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
7422 // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
7423 var isNonPhrasingTag
= makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 'title,tr,track');
7430 directives: directives
$1,
7432 isUnaryTag: isUnaryTag
,
7433 mustUseProp: mustUseProp
,
7434 canBeLeftOpenTag: canBeLeftOpenTag
,
7435 isReservedTag: isReservedTag
,
7436 getTagNamespace: getTagNamespace
,
7437 staticKeys: genStaticKeys(modules
$1)
7445 decode: function decode(html
) {
7446 decoder
= decoder
|| document
.createElement('div');
7447 decoder
.innerHTML
= html
;
7448 return decoder
.textContent
;
7453 * Not type-checking this file because it's mostly vendor code.
7457 * HTML Parser By John Resig (ejohn.org)
7458 * Modified by Juriy "kangax" Zaytsev
7459 * Original code by Erik Arvidsson, Mozilla Public License
7460 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
7463 // Regular Expressions for parsing tags and attributes
7464 var singleAttrIdentifier
= /([^\s"'<>/=]+)/;
7465 var singleAttrAssign
= /(?:=)/;
7466 var singleAttrValues
= [
7467 // attr value double quotes
7468 /"([^"]*)"+/.source
,
7469 // attr value, single quotes
7470 /'([^']*)'+/.source
,
7471 // attr value, no quotes
7472 /([^\s"'=<>`]+)/.source
];
7473 var attribute
= new RegExp('^\\s*' + singleAttrIdentifier
.source
+ '(?:\\s*(' + singleAttrAssign
.source
+ ')' + '\\s*(?:' + singleAttrValues
.join('|') + '))?');
7475 // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
7476 // but for Vue templates we can enforce a simple charset
7477 var ncname
= '[a-zA-Z_][\\w\\-\\.]*';
7478 var qnameCapture
= '((?:' + ncname
+ '\\:)?' + ncname
+ ')';
7479 var startTagOpen
= new RegExp('^<' + qnameCapture
);
7480 var startTagClose
= /^\s*(\/?)>/;
7481 var endTag
= new RegExp('^<\\/' + qnameCapture
+ '[^>]*>');
7482 var doctype
= /^<!DOCTYPE
[^>]+>/i
;
7483 var comment
= /^<!--/;
7484 var conditionalComment
= /^<!\[/;
7486 var IS_REGEX_CAPTURING_BROKEN
= false;
7487 'x'.replace(/x(.)?/g, function (m
, g
) {
7488 IS_REGEX_CAPTURING_BROKEN
= g
=== '';
7491 // Special Elements (can contain anything)
7492 var isPlainTextElement
= makeMap('script,style,textarea', true);
7502 var encodedAttr
= /&(?:lt|gt|quot|amp);/g;
7503 var encodedAttrWithNewLines
= /&(?:lt|gt|quot|amp|#10);/g;
7506 var isIgnoreNewlineTag
= makeMap('pre,textarea', true);
7507 var shouldIgnoreFirstNewline = function (tag
, html
) {
7508 return tag
&& isIgnoreNewlineTag(tag
) && html
[0] === '\n';
7511 function decodeAttr(value
, shouldDecodeNewlines
) {
7512 var re
= shouldDecodeNewlines
? encodedAttrWithNewLines : encodedAttr
;
7513 return value
.replace(re
, function (match
) {
7514 return decodingMap
[match
];
7518 function parseHTML(html
, options
) {
7520 var expectHTML
= options
.expectHTML
;
7521 var isUnaryTag
$$1 = options
.isUnaryTag
|| no
;
7522 var canBeLeftOpenTag
$$1 = options
.canBeLeftOpenTag
|| no
;
7527 // Make sure we're not in a plaintext content element like script/style
7528 if (!lastTag
|| !isPlainTextElement(lastTag
)) {
7529 var textEnd
= html
.indexOf('<');
7530 if (textEnd
=== 0) {
7532 if (comment
.test(html
)) {
7533 var commentEnd
= html
.indexOf('-->');
7535 if (commentEnd
>= 0) {
7536 if (options
.shouldKeepComment
) {
7537 options
.comment(html
.substring(4, commentEnd
));
7539 advance(commentEnd
+ 3);
7544 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
7545 if (conditionalComment
.test(html
)) {
7546 var conditionalEnd
= html
.indexOf(']>');
7548 if (conditionalEnd
>= 0) {
7549 advance(conditionalEnd
+ 2);
7555 var doctypeMatch
= html
.match(doctype
);
7557 advance(doctypeMatch
[0].length
);
7562 var endTagMatch
= html
.match(endTag
);
7564 var curIndex
= index
;
7565 advance(endTagMatch
[0].length
);
7566 parseEndTag(endTagMatch
[1], curIndex
, index
);
7571 var startTagMatch
= parseStartTag();
7572 if (startTagMatch
) {
7573 handleStartTag(startTagMatch
);
7574 if (shouldIgnoreFirstNewline(lastTag
, html
)) {
7585 rest
= html
.slice(textEnd
);
7586 while (!endTag
.test(rest
) && !startTagOpen
.test(rest
) && !comment
.test(rest
) && !conditionalComment
.test(rest
)) {
7587 // < in plain text, be forgiving and treat it as text
7588 next
= rest
.indexOf('<', 1);
7593 rest
= html
.slice(textEnd
);
7595 text
= html
.substring(0, textEnd
);
7604 if (options
.chars
&& text
) {
7605 options
.chars(text
);
7608 var endTagLength
= 0;
7609 var stackedTag
= lastTag
.toLowerCase();
7610 var reStackedTag
= reCache
[stackedTag
] || (reCache
[stackedTag
] = new RegExp('([\\s\\S]*?)(</' + stackedTag
+ '[^>]*>)', 'i'));
7611 var rest
$1 = html
.replace(reStackedTag
, function (all
, text
, endTag
) {
7612 endTagLength
= endTag
.length
;
7613 if (!isPlainTextElement(stackedTag
) && stackedTag
!== 'noscript') {
7614 text
= text
.replace(/<!--([\s\S]*?)-->/g, '$1').replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
7616 if (shouldIgnoreFirstNewline(stackedTag
, text
)) {
7617 text
= text
.slice(1);
7619 if (options
.chars
) {
7620 options
.chars(text
);
7624 index
+= html
.length
- rest
$1.length
;
7626 parseEndTag(stackedTag
, index
- endTagLength
, index
);
7629 if (html
=== last
) {
7630 options
.chars
&& options
.chars(html
);
7631 if (process
.env
.NODE_ENV
!== 'production' && !stack
.length
&& options
.warn
) {
7632 options
.warn("Mal-formatted tag at end of template: \"" + html
+ "\"");
7638 // Clean up any remaining tags
7641 function advance(n
) {
7643 html
= html
.substring(n
);
7646 function parseStartTag() {
7647 var start
= html
.match(startTagOpen
);
7654 advance(start
[0].length
);
7656 while (!(end
= html
.match(startTagClose
)) && (attr
= html
.match(attribute
))) {
7657 advance(attr
[0].length
);
7658 match
.attrs
.push(attr
);
7661 match
.unarySlash
= end
[1];
7662 advance(end
[0].length
);
7669 function handleStartTag(match
) {
7670 var tagName
= match
.tagName
;
7671 var unarySlash
= match
.unarySlash
;
7674 if (lastTag
=== 'p' && isNonPhrasingTag(tagName
)) {
7675 parseEndTag(lastTag
);
7677 if (canBeLeftOpenTag
$$1(tagName
) && lastTag
=== tagName
) {
7678 parseEndTag(tagName
);
7682 var unary
= isUnaryTag
$$1(tagName
) || !!unarySlash
;
7684 var l
= match
.attrs
.length
;
7685 var attrs
= new Array(l
);
7686 for (var i
= 0; i
< l
; i
++) {
7687 var args
= match
.attrs
[i
];
7688 // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
7689 if (IS_REGEX_CAPTURING_BROKEN
&& args
[0].indexOf('""') === -1) {
7690 if (args
[3] === '') {
7693 if (args
[4] === '') {
7696 if (args
[5] === '') {
7700 var value
= args
[3] || args
[4] || args
[5] || '';
7703 value: decodeAttr(value
, options
.shouldDecodeNewlines
)
7708 stack
.push({ tag: tagName
, lowerCasedTag: tagName
.toLowerCase(), attrs: attrs
});
7712 if (options
.start
) {
7713 options
.start(tagName
, attrs
, unary
, match
.start
, match
.end
);
7717 function parseEndTag(tagName
, start
, end
) {
7718 var pos
, lowerCasedTagName
;
7719 if (start
== null) {
7727 lowerCasedTagName
= tagName
.toLowerCase();
7730 // Find the closest opened tag of the same type
7732 for (pos
= stack
.length
- 1; pos
>= 0; pos
--) {
7733 if (stack
[pos
].lowerCasedTag
=== lowerCasedTagName
) {
7738 // If no tag name is provided, clean shop
7743 // Close all the open elements, up the stack
7744 for (var i
= stack
.length
- 1; i
>= pos
; i
--) {
7745 if (process
.env
.NODE_ENV
!== 'production' && (i
> pos
|| !tagName
) && options
.warn
) {
7746 options
.warn("tag <" + stack
[i
].tag
+ "> has no matching end tag.");
7749 options
.end(stack
[i
].tag
, start
, end
);
7753 // Remove the open elements from the stack
7755 lastTag
= pos
&& stack
[pos
- 1].tag
;
7756 } else if (lowerCasedTagName
=== 'br') {
7757 if (options
.start
) {
7758 options
.start(tagName
, [], true, start
, end
);
7760 } else if (lowerCasedTagName
=== 'p') {
7761 if (options
.start
) {
7762 options
.start(tagName
, [], false, start
, end
);
7765 options
.end(tagName
, start
, end
);
7773 var onRE
= /^@|^v-on:/;
7774 var dirRE
= /^v-|^@|^:/;
7775 var forAliasRE
= /(.*?)\s+(?:in|of)\s+(.*)/;
7776 var forIteratorRE
= /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
7778 var argRE
= /:(.*)$/;
7779 var bindRE
= /^:|^v-bind:/;
7780 var modifierRE
= /\.[^.]+/g;
7782 var decodeHTMLCached
= cached(he
.decode
);
7784 // configurable state
7790 var platformIsPreTag
;
7791 var platformMustUseProp
;
7792 var platformGetTagNamespace
;
7795 * Convert HTML string to AST.
7797 function parse(template
, options
) {
7798 warn
$2 = options
.warn
|| baseWarn
;
7800 platformIsPreTag
= options
.isPreTag
|| no
;
7801 platformMustUseProp
= options
.mustUseProp
|| no
;
7802 platformGetTagNamespace
= options
.getTagNamespace
|| no
;
7804 transforms
= pluckModuleFunction(options
.modules
, 'transformNode');
7805 preTransforms
= pluckModuleFunction(options
.modules
, 'preTransformNode');
7806 postTransforms
= pluckModuleFunction(options
.modules
, 'postTransformNode');
7808 delimiters
= options
.delimiters
;
7811 var preserveWhitespace
= options
.preserveWhitespace
!== false;
7818 function warnOnce(msg
) {
7825 function endPre(element
) {
7830 if (platformIsPreTag(element
.tag
)) {
7835 parseHTML(template
, {
7837 expectHTML: options
.expectHTML
,
7838 isUnaryTag: options
.isUnaryTag
,
7839 canBeLeftOpenTag: options
.canBeLeftOpenTag
,
7840 shouldDecodeNewlines: options
.shouldDecodeNewlines
,
7841 shouldKeepComment: options
.comments
,
7842 start: function start(tag
, attrs
, unary
) {
7844 // inherit parent ns if there is one
7845 var ns
= currentParent
&& currentParent
.ns
|| platformGetTagNamespace(tag
);
7847 // handle IE svg bug
7848 /* istanbul ignore if */
7849 if (isIE
&& ns
=== 'svg') {
7850 attrs
= guardIESVGBug(attrs
);
7857 attrsMap: makeAttrsMap(attrs
),
7858 parent: currentParent
,
7865 if (isForbiddenTag(element
) && !isServerRendering()) {
7866 element
.forbidden
= true;
7867 process
.env
.NODE_ENV
!== 'production' && warn
$2('Templates should only be responsible for mapping the state to the ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' + "<" + tag
+ ">" + ', as they will not be parsed.');
7870 // apply pre-transforms
7871 for (var i
= 0; i
< preTransforms
.length
; i
++) {
7872 preTransforms
[i
](element
, options
);
7876 processPre(element
);
7881 if (platformIsPreTag(element
.tag
)) {
7885 processRawAttrs(element
);
7887 processFor(element
);
7889 processOnce(element
);
7890 processKey(element
);
7892 // determine whether this is a plain element after
7893 // removing structural attributes
7894 element
.plain
= !element
.key
&& !attrs
.length
;
7896 processRef(element
);
7897 processSlot(element
);
7898 processComponent(element
);
7899 for (var i
$1 = 0; i
$1 < transforms
.length
; i
$1++) {
7900 transforms
[i
$1](element
, options
);
7902 processAttrs(element
);
7905 function checkRootConstraints(el
) {
7906 if (process
.env
.NODE_ENV
!== 'production') {
7907 if (el
.tag
=== 'slot' || el
.tag
=== 'template') {
7908 warnOnce("Cannot use <" + el
.tag
+ "> as component root element because it may " + 'contain multiple nodes.');
7910 if (el
.attrsMap
.hasOwnProperty('v-for')) {
7911 warnOnce('Cannot use v-for on stateful component root element because ' + 'it renders multiple elements.');
7919 checkRootConstraints(root
);
7920 } else if (!stack
.length
) {
7921 // allow root elements with v-if, v-else-if and v-else
7922 if (root
.if && (element
.elseif
|| element
.else)) {
7923 checkRootConstraints(element
);
7924 addIfCondition(root
, {
7925 exp: element
.elseif
,
7928 } else if (process
.env
.NODE_ENV
!== 'production') {
7929 warnOnce("Component template should contain exactly one root element. " + "If you are using v-if on multiple elements, " + "use v-else-if to chain them instead.");
7932 if (currentParent
&& !element
.forbidden
) {
7933 if (element
.elseif
|| element
.else) {
7934 processIfConditions(element
, currentParent
);
7935 } else if (element
.slotScope
) {
7937 currentParent
.plain
= false;
7938 var name
= element
.slotTarget
|| '"default"';(currentParent
.scopedSlots
|| (currentParent
.scopedSlots
= {}))[name
] = element
;
7940 currentParent
.children
.push(element
);
7941 element
.parent
= currentParent
;
7945 currentParent
= element
;
7946 stack
.push(element
);
7950 // apply post-transforms
7951 for (var i
$2 = 0; i
$2 < postTransforms
.length
; i
$2++) {
7952 postTransforms
[i
$2](element
, options
);
7956 end: function end() {
7957 // remove trailing whitespace
7958 var element
= stack
[stack
.length
- 1];
7959 var lastNode
= element
.children
[element
.children
.length
- 1];
7960 if (lastNode
&& lastNode
.type
=== 3 && lastNode
.text
=== ' ' && !inPre
) {
7961 element
.children
.pop();
7965 currentParent
= stack
[stack
.length
- 1];
7969 chars: function chars(text
) {
7970 if (!currentParent
) {
7971 if (process
.env
.NODE_ENV
!== 'production') {
7972 if (text
=== template
) {
7973 warnOnce('Component template requires a root element, rather than just text.');
7974 } else if (text
= text
.trim()) {
7975 warnOnce("text \"" + text
+ "\" outside root element will be ignored.");
7980 // IE textarea placeholder bug
7981 /* istanbul ignore if */
7982 if (isIE
&& currentParent
.tag
=== 'textarea' && currentParent
.attrsMap
.placeholder
=== text
) {
7985 var children
= currentParent
.children
;
7986 text
= inPre
|| text
.trim() ? isTextTag(currentParent
) ? text : decodeHTMLCached(text
)
7987 // only preserve whitespace if its not right after a starting tag
7988 : preserveWhitespace
&& children
.length
? ' ' : '';
7991 if (!inVPre
&& text
!== ' ' && (expression
= parseText(text
, delimiters
))) {
7994 expression: expression
,
7997 } else if (text
!== ' ' || !children
.length
|| children
[children
.length
- 1].text
!== ' ') {
8005 comment: function comment(text
) {
8006 currentParent
.children
.push({
8016 function processPre(el
) {
8017 if (getAndRemoveAttr(el
, 'v-pre') != null) {
8022 function processRawAttrs(el
) {
8023 var l
= el
.attrsList
.length
;
8025 var attrs
= el
.attrs
= new Array(l
);
8026 for (var i
= 0; i
< l
; i
++) {
8028 name: el
.attrsList
[i
].name
,
8029 value: JSON
.stringify(el
.attrsList
[i
].value
)
8032 } else if (!el
.pre
) {
8033 // non root node in pre blocks with no attributes
8038 function processKey(el
) {
8039 var exp
= getBindingAttr(el
, 'key');
8041 if (process
.env
.NODE_ENV
!== 'production' && el
.tag
=== 'template') {
8042 warn
$2("<template> cannot be keyed. Place the key on real elements instead.");
8048 function processRef(el
) {
8049 var ref
= getBindingAttr(el
, 'ref');
8052 el
.refInFor
= checkInFor(el
);
8056 function processFor(el
) {
8058 if (exp
= getAndRemoveAttr(el
, 'v-for')) {
8059 var inMatch
= exp
.match(forAliasRE
);
8061 process
.env
.NODE_ENV
!== 'production' && warn
$2("Invalid v-for expression: " + exp
);
8064 el
.for = inMatch
[2].trim();
8065 var alias
= inMatch
[1].trim();
8066 var iteratorMatch
= alias
.match(forIteratorRE
);
8067 if (iteratorMatch
) {
8068 el
.alias
= iteratorMatch
[1].trim();
8069 el
.iterator1
= iteratorMatch
[2].trim();
8070 if (iteratorMatch
[3]) {
8071 el
.iterator2
= iteratorMatch
[3].trim();
8079 function processIf(el
) {
8080 var exp
= getAndRemoveAttr(el
, 'v-if');
8083 addIfCondition(el
, {
8088 if (getAndRemoveAttr(el
, 'v-else') != null) {
8091 var elseif
= getAndRemoveAttr(el
, 'v-else-if');
8098 function processIfConditions(el
, parent
) {
8099 var prev
= findPrevElement(parent
.children
);
8100 if (prev
&& prev
.if) {
8101 addIfCondition(prev
, {
8105 } else if (process
.env
.NODE_ENV
!== 'production') {
8106 warn
$2("v-" + (el
.elseif
? 'else-if="' + el
.elseif
+ '"' : 'else') + " " + "used on element <" + el
.tag
+ "> without corresponding v-if.");
8110 function findPrevElement(children
) {
8111 var i
= children
.length
;
8113 if (children
[i
].type
=== 1) {
8116 if (process
.env
.NODE_ENV
!== 'production' && children
[i
].text
!== ' ') {
8117 warn
$2("text \"" + children
[i
].text
.trim() + "\" between v-if and v-else(-if) " + "will be ignored.");
8124 function addIfCondition(el
, condition
) {
8125 if (!el
.ifConditions
) {
8126 el
.ifConditions
= [];
8128 el
.ifConditions
.push(condition
);
8131 function processOnce(el
) {
8132 var once
$$1 = getAndRemoveAttr(el
, 'v-once');
8133 if (once
$$1 != null) {
8138 function processSlot(el
) {
8139 if (el
.tag
=== 'slot') {
8140 el
.slotName
= getBindingAttr(el
, 'name');
8141 if (process
.env
.NODE_ENV
!== 'production' && el
.key
) {
8142 warn
$2("`key` does not work on <slot> because slots are abstract outlets " + "and can possibly expand into multiple elements. " + "Use the key on a wrapping element instead.");
8145 var slotTarget
= getBindingAttr(el
, 'slot');
8147 el
.slotTarget
= slotTarget
=== '""' ? '"default"' : slotTarget
;
8149 if (el
.tag
=== 'template') {
8150 el
.slotScope
= getAndRemoveAttr(el
, 'scope');
8155 function processComponent(el
) {
8157 if (binding
= getBindingAttr(el
, 'is')) {
8158 el
.component
= binding
;
8160 if (getAndRemoveAttr(el
, 'inline-template') != null) {
8161 el
.inlineTemplate
= true;
8165 function processAttrs(el
) {
8166 var list
= el
.attrsList
;
8167 var i
, l
, name
, rawName
, value
, modifiers
, isProp
;
8168 for (i
= 0, l
= list
.length
; i
< l
; i
++) {
8169 name
= rawName
= list
[i
].name
;
8170 value
= list
[i
].value
;
8171 if (dirRE
.test(name
)) {
8172 // mark element as dynamic
8173 el
.hasBindings
= true;
8175 modifiers
= parseModifiers(name
);
8177 name
= name
.replace(modifierRE
, '');
8179 if (bindRE
.test(name
)) {
8181 name
= name
.replace(bindRE
, '');
8182 value
= parseFilters(value
);
8185 if (modifiers
.prop
) {
8187 name
= camelize(name
);
8188 if (name
=== 'innerHtml') {
8192 if (modifiers
.camel
) {
8193 name
= camelize(name
);
8195 if (modifiers
.sync
) {
8196 addHandler(el
, "update:" + camelize(name
), genAssignmentCode(value
, "$event"));
8199 if (isProp
|| !el
.component
&& platformMustUseProp(el
.tag
, el
.attrsMap
.type
, name
)) {
8200 addProp(el
, name
, value
);
8202 addAttr(el
, name
, value
);
8204 } else if (onRE
.test(name
)) {
8206 name
= name
.replace(onRE
, '');
8207 addHandler(el
, name
, value
, modifiers
, false, warn
$2);
8209 // normal directives
8210 name
= name
.replace(dirRE
, '');
8212 var argMatch
= name
.match(argRE
);
8213 var arg
= argMatch
&& argMatch
[1];
8215 name
= name
.slice(0, -(arg
.length
+ 1));
8217 addDirective(el
, name
, rawName
, value
, arg
, modifiers
);
8218 if (process
.env
.NODE_ENV
!== 'production' && name
=== 'model') {
8219 checkForAliasModel(el
, value
);
8223 // literal attribute
8224 if (process
.env
.NODE_ENV
!== 'production') {
8225 var expression
= parseText(value
, delimiters
);
8227 warn
$2(name
+ "=\"" + value
+ "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div id="{{ val }}">, use <div :id="val">.');
8230 addAttr(el
, name
, JSON
.stringify(value
));
8235 function checkInFor(el
) {
8238 if (parent
.for !== undefined) {
8241 parent
= parent
.parent
;
8246 function parseModifiers(name
) {
8247 var match
= name
.match(modifierRE
);
8250 match
.forEach(function (m
) {
8251 ret
[m
.slice(1)] = true;
8257 function makeAttrsMap(attrs
) {
8259 for (var i
= 0, l
= attrs
.length
; i
< l
; i
++) {
8260 if (process
.env
.NODE_ENV
!== 'production' && map
[attrs
[i
].name
] && !isIE
&& !isEdge
) {
8261 warn
$2('duplicate attribute: ' + attrs
[i
].name
);
8263 map
[attrs
[i
].name
] = attrs
[i
].value
;
8268 // for script (e.g. type="x/template") or style, do not decode content
8269 function isTextTag(el
) {
8270 return el
.tag
=== 'script' || el
.tag
=== 'style';
8273 function isForbiddenTag(el
) {
8274 return el
.tag
=== 'style' || el
.tag
=== 'script' && (!el
.attrsMap
.type
|| el
.attrsMap
.type
=== 'text/javascript');
8277 var ieNSBug
= /^xmlns:NS\d+/;
8278 var ieNSPrefix
= /^NS\d+:/;
8280 /* istanbul ignore next */
8281 function guardIESVGBug(attrs
) {
8283 for (var i
= 0; i
< attrs
.length
; i
++) {
8284 var attr
= attrs
[i
];
8285 if (!ieNSBug
.test(attr
.name
)) {
8286 attr
.name
= attr
.name
.replace(ieNSPrefix
, '');
8293 function checkForAliasModel(el
, value
) {
8296 if (_el
.for && _el
.alias
=== value
) {
8297 warn
$2("<" + el
.tag
+ " v-model=\"" + value
+ "\">: " + "You are binding v-model directly to a v-for iteration alias. " + "This will not be able to modify the v-for source array because " + "writing to the alias is like modifying a function local variable. " + "Consider using an array of objects and use v-model on an object property instead.");
8306 var isPlatformReservedTag
;
8308 var genStaticKeysCached
= cached(genStaticKeys
$1);
8311 * Goal of the optimizer: walk the generated template AST tree
8312 * and detect sub-trees that are purely static, i.e. parts of
8313 * the DOM that never needs to change.
8315 * Once we detect these sub-trees, we can:
8317 * 1. Hoist them into constants, so that we no longer need to
8318 * create fresh nodes for them on each re-render;
8319 * 2. Completely skip them in the patching process.
8321 function optimize(root
, options
) {
8325 isStaticKey
= genStaticKeysCached(options
.staticKeys
|| '');
8326 isPlatformReservedTag
= options
.isReservedTag
|| no
;
8327 // first pass: mark all non-static nodes.
8329 // second pass: mark static roots.
8330 markStaticRoots(root
, false);
8333 function genStaticKeys
$1(keys
) {
8334 return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs' + (keys
? ',' + keys : ''));
8337 function markStatic
$1(node
) {
8338 node
.static = isStatic(node
);
8339 if (node
.type
=== 1) {
8340 // do not make component slot content static. this avoids
8341 // 1. components not able to mutate slot nodes
8342 // 2. static slot content fails for hot-reloading
8343 if (!isPlatformReservedTag(node
.tag
) && node
.tag
!== 'slot' && node
.attrsMap
['inline-template'] == null) {
8346 for (var i
= 0, l
= node
.children
.length
; i
< l
; i
++) {
8347 var child
= node
.children
[i
];
8348 markStatic
$1(child
);
8349 if (!child
.static) {
8350 node
.static = false;
8353 if (node
.ifConditions
) {
8354 for (var i
$1 = 1, l
$1 = node
.ifConditions
.length
; i
$1 < l
$1; i
$1++) {
8355 var block
= node
.ifConditions
[i
$1].block
;
8356 markStatic
$1(block
);
8357 if (!block
.static) {
8358 node
.static = false;
8365 function markStaticRoots(node
, isInFor
) {
8366 if (node
.type
=== 1) {
8367 if (node
.static || node
.once
) {
8368 node
.staticInFor
= isInFor
;
8370 // For a node to qualify as a static root, it should have children that
8371 // are not just static text. Otherwise the cost of hoisting out will
8372 // outweigh the benefits and it's better off to just always render it fresh.
8373 if (node
.static && node
.children
.length
&& !(node
.children
.length
=== 1 && node
.children
[0].type
=== 3)) {
8374 node
.staticRoot
= true;
8377 node
.staticRoot
= false;
8379 if (node
.children
) {
8380 for (var i
= 0, l
= node
.children
.length
; i
< l
; i
++) {
8381 markStaticRoots(node
.children
[i
], isInFor
|| !!node
.for);
8384 if (node
.ifConditions
) {
8385 for (var i
$1 = 1, l
$1 = node
.ifConditions
.length
; i
$1 < l
$1; i
$1++) {
8386 markStaticRoots(node
.ifConditions
[i
$1].block
, isInFor
);
8392 function isStatic(node
) {
8393 if (node
.type
=== 2) {
8397 if (node
.type
=== 3) {
8401 return !!(node
.pre
|| !node
.hasBindings
&& // no dynamic bindings
8402 !node
.if && !node
.for && // not v-if or v-for or v-else
8403 !isBuiltInTag(node
.tag
) && // not a built-in
8404 isPlatformReservedTag(node
.tag
) && // not a component
8405 !isDirectChildOfTemplateFor(node
) && Object
.keys(node
).every(isStaticKey
));
8408 function isDirectChildOfTemplateFor(node
) {
8409 while (node
.parent
) {
8411 if (node
.tag
!== 'template') {
8423 var fnExpRE
= /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
8424 var simplePathRE
= /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
8439 // #4868: modifiers that prevent the execution of the listener
8440 // need to explicitly return null so that we can determine whether to remove
8441 // the listener for .once
8442 var genGuard = function (condition
) {
8443 return "if(" + condition
+ ")return null;";
8446 var modifierCode
= {
8447 stop: '$event.stopPropagation();',
8448 prevent: '$event.preventDefault();',
8449 self: genGuard("$event.target !== $event.currentTarget"),
8450 ctrl: genGuard("!$event.ctrlKey"),
8451 shift: genGuard("!$event.shiftKey"),
8452 alt: genGuard("!$event.altKey"),
8453 meta: genGuard("!$event.metaKey"),
8454 left: genGuard("'button' in $event && $event.button !== 0"),
8455 middle: genGuard("'button' in $event && $event.button !== 1"),
8456 right: genGuard("'button' in $event && $event.button !== 2")
8459 function genHandlers(events
, isNative
, warn
) {
8460 var res
= isNative
? 'nativeOn:{' : 'on:{';
8461 for (var name
in events
) {
8462 var handler
= events
[name
];
8463 // #5330: warn click.right, since right clicks do not actually fire click events.
8464 if (process
.env
.NODE_ENV
!== 'production' && name
=== 'click' && handler
&& handler
.modifiers
&& handler
.modifiers
.right
) {
8465 warn("Use \"contextmenu\" instead of \"click.right\" since right clicks " + "do not actually fire \"click\" events.");
8467 res
+= "\"" + name
+ "\":" + genHandler(name
, handler
) + ",";
8469 return res
.slice(0, -1) + '}';
8472 function genHandler(name
, handler
) {
8474 return 'function(){}';
8477 if (Array
.isArray(handler
)) {
8478 return "[" + handler
.map(function (handler
) {
8479 return genHandler(name
, handler
);
8483 var isMethodPath
= simplePathRE
.test(handler
.value
);
8484 var isFunctionExpression
= fnExpRE
.test(handler
.value
);
8486 if (!handler
.modifiers
) {
8487 return isMethodPath
|| isFunctionExpression
? handler
.value : "function($event){" + handler
.value
+ "}"; // inline statement
8490 var genModifierCode
= '';
8492 for (var key
in handler
.modifiers
) {
8493 if (modifierCode
[key
]) {
8494 genModifierCode
+= modifierCode
[key
];
8496 if (keyCodes
[key
]) {
8504 code
+= genKeyFilter(keys
);
8506 // Make sure modifiers like prevent and stop get executed after key filtering
8507 if (genModifierCode
) {
8508 code
+= genModifierCode
;
8510 var handlerCode
= isMethodPath
? handler
.value
+ '($event)' : isFunctionExpression
? "(" + handler
.value
+ ")($event)" : handler
.value
;
8511 return "function($event){" + code
+ handlerCode
+ "}";
8515 function genKeyFilter(keys
) {
8516 return "if(!('button' in $event)&&" + keys
.map(genFilterCode
).join('&&') + ")return null;";
8519 function genFilterCode(key
) {
8520 var keyVal
= parseInt(key
, 10);
8522 return "$event.keyCode!==" + keyVal
;
8524 var alias
= keyCodes
[key
];
8525 return "_k($event.keyCode," + JSON
.stringify(key
) + (alias
? ',' + JSON
.stringify(alias
) : '') + ")";
8530 function on(el
, dir
) {
8531 if (process
.env
.NODE_ENV
!== 'production' && dir
.modifiers
) {
8532 warn("v-on without argument does not support modifiers.");
8534 el
.wrapListeners = function (code
) {
8535 return "_g(" + code
+ "," + dir
.value
+ ")";
8541 function bind
$1(el
, dir
) {
8542 el
.wrapData = function (code
) {
8543 return "_b(" + code
+ ",'" + el
.tag
+ "'," + dir
.value
+ "," + (dir
.modifiers
&& dir
.modifiers
.prop
? 'true' : 'false') + (dir
.modifiers
&& dir
.modifiers
.sync
? ',true' : '') + ")";
8549 var baseDirectives
= {
8557 var CodegenState
= function CodegenState(options
) {
8558 this.options
= options
;
8559 this.warn
= options
.warn
|| baseWarn
;
8560 this.transforms
= pluckModuleFunction(options
.modules
, 'transformCode');
8561 this.dataGenFns
= pluckModuleFunction(options
.modules
, 'genData');
8562 this.directives
= extend(extend({}, baseDirectives
), options
.directives
);
8563 var isReservedTag
= options
.isReservedTag
|| no
;
8564 this.maybeComponent = function (el
) {
8565 return !isReservedTag(el
.tag
);
8568 this.staticRenderFns
= [];
8571 function generate(ast
, options
) {
8572 var state
= new CodegenState(options
);
8573 var code
= ast
? genElement(ast
, state
) : '_c("div")';
8575 render: "with(this){return " + code
+ "}",
8576 staticRenderFns: state
.staticRenderFns
8580 function genElement(el
, state
) {
8581 if (el
.staticRoot
&& !el
.staticProcessed
) {
8582 return genStatic(el
, state
);
8583 } else if (el
.once
&& !el
.onceProcessed
) {
8584 return genOnce(el
, state
);
8585 } else if (el
.for && !el
.forProcessed
) {
8586 return genFor(el
, state
);
8587 } else if (el
.if && !el
.ifProcessed
) {
8588 return genIf(el
, state
);
8589 } else if (el
.tag
=== 'template' && !el
.slotTarget
) {
8590 return genChildren(el
, state
) || 'void 0';
8591 } else if (el
.tag
=== 'slot') {
8592 return genSlot(el
, state
);
8594 // component or element
8597 code
= genComponent(el
.component
, el
, state
);
8599 var data
= el
.plain
? undefined : genData
$2(el
, state
);
8601 var children
= el
.inlineTemplate
? null : genChildren(el
, state
, true);
8602 code
= "_c('" + el
.tag
+ "'" + (data
? "," + data : '') + (children
? "," + children : '') + ")";
8604 // module transforms
8605 for (var i
= 0; i
< state
.transforms
.length
; i
++) {
8606 code
= state
.transforms
[i
](el
, code
);
8612 // hoist static sub-trees out
8613 function genStatic(el
, state
) {
8614 el
.staticProcessed
= true;
8615 state
.staticRenderFns
.push("with(this){return " + genElement(el
, state
) + "}");
8616 return "_m(" + (state
.staticRenderFns
.length
- 1) + (el
.staticInFor
? ',true' : '') + ")";
8620 function genOnce(el
, state
) {
8621 el
.onceProcessed
= true;
8622 if (el
.if && !el
.ifProcessed
) {
8623 return genIf(el
, state
);
8624 } else if (el
.staticInFor
) {
8626 var parent
= el
.parent
;
8632 parent
= parent
.parent
;
8635 process
.env
.NODE_ENV
!== 'production' && state
.warn("v-once can only be used inside v-for that is keyed. ");
8636 return genElement(el
, state
);
8638 return "_o(" + genElement(el
, state
) + "," + state
.onceId
++ + (key
? "," + key : "") + ")";
8640 return genStatic(el
, state
);
8644 function genIf(el
, state
, altGen
, altEmpty
) {
8645 el
.ifProcessed
= true; // avoid recursion
8646 return genIfConditions(el
.ifConditions
.slice(), state
, altGen
, altEmpty
);
8649 function genIfConditions(conditions
, state
, altGen
, altEmpty
) {
8650 if (!conditions
.length
) {
8651 return altEmpty
|| '_e()';
8654 var condition
= conditions
.shift();
8655 if (condition
.exp
) {
8656 return "(" + condition
.exp
+ ")?" + genTernaryExp(condition
.block
) + ":" + genIfConditions(conditions
, state
, altGen
, altEmpty
);
8658 return "" + genTernaryExp(condition
.block
);
8661 // v-if with v-once should generate code like (a)?_m(0):_m(1)
8662 function genTernaryExp(el
) {
8663 return altGen
? altGen(el
, state
) : el
.once
? genOnce(el
, state
) : genElement(el
, state
);
8667 function genFor(el
, state
, altGen
, altHelper
) {
8669 var alias
= el
.alias
;
8670 var iterator1
= el
.iterator1
? "," + el
.iterator1 : '';
8671 var iterator2
= el
.iterator2
? "," + el
.iterator2 : '';
8673 if (process
.env
.NODE_ENV
!== 'production' && state
.maybeComponent(el
) && el
.tag
!== 'slot' && el
.tag
!== 'template' && !el
.key
) {
8674 state
.warn("<" + el
.tag
+ " v-for=\"" + alias
+ " in " + exp
+ "\">: component lists rendered with " + "v-for should have explicit keys. " + "See https://vuejs.org/guide/list.html#key for more info.", true /* tip */
8678 el
.forProcessed
= true; // avoid recursion
8679 return (altHelper
|| '_l') + "((" + exp
+ ")," + "function(" + alias
+ iterator1
+ iterator2
+ "){" + "return " + (altGen
|| genElement
)(el
, state
) + '})';
8682 function genData
$2(el
, state
) {
8685 // directives first.
8686 // directives may mutate the el's other properties before they are generated.
8687 var dirs
= genDirectives(el
, state
);
8694 data
+= "key:" + el
.key
+ ",";
8698 data
+= "ref:" + el
.ref
+ ",";
8701 data
+= "refInFor:true,";
8705 data
+= "pre:true,";
8707 // record original tag name for components using "is" attribute
8709 data
+= "tag:\"" + el
.tag
+ "\",";
8711 // module data generation functions
8712 for (var i
= 0; i
< state
.dataGenFns
.length
; i
++) {
8713 data
+= state
.dataGenFns
[i
](el
);
8717 data
+= "attrs:{" + genProps(el
.attrs
) + "},";
8721 data
+= "domProps:{" + genProps(el
.props
) + "},";
8725 data
+= genHandlers(el
.events
, false, state
.warn
) + ",";
8727 if (el
.nativeEvents
) {
8728 data
+= genHandlers(el
.nativeEvents
, true, state
.warn
) + ",";
8731 if (el
.slotTarget
) {
8732 data
+= "slot:" + el
.slotTarget
+ ",";
8735 if (el
.scopedSlots
) {
8736 data
+= genScopedSlots(el
.scopedSlots
, state
) + ",";
8738 // component v-model
8740 data
+= "model:{value:" + el
.model
.value
+ ",callback:" + el
.model
.callback
+ ",expression:" + el
.model
.expression
+ "},";
8743 if (el
.inlineTemplate
) {
8744 var inlineTemplate
= genInlineTemplate(el
, state
);
8745 if (inlineTemplate
) {
8746 data
+= inlineTemplate
+ ",";
8749 data
= data
.replace(/,$/, '') + '}';
8752 data
= el
.wrapData(data
);
8755 if (el
.wrapListeners
) {
8756 data
= el
.wrapListeners(data
);
8761 function genDirectives(el
, state
) {
8762 var dirs
= el
.directives
;
8766 var res
= 'directives:[';
8767 var hasRuntime
= false;
8768 var i
, l
, dir
, needRuntime
;
8769 for (i
= 0, l
= dirs
.length
; i
< l
; i
++) {
8772 var gen
= state
.directives
[dir
.name
];
8774 // compile-time directive that manipulates AST.
8775 // returns true if it also needs a runtime counterpart.
8776 needRuntime
= !!gen(el
, dir
, state
.warn
);
8780 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
) : '') + "},";
8784 return res
.slice(0, -1) + ']';
8788 function genInlineTemplate(el
, state
) {
8789 var ast
= el
.children
[0];
8790 if (process
.env
.NODE_ENV
!== 'production' && (el
.children
.length
> 1 || ast
.type
!== 1)) {
8791 state
.warn('Inline-template components must have exactly one child element.');
8793 if (ast
.type
=== 1) {
8794 var inlineRenderFns
= generate(ast
, state
.options
);
8795 return "inlineTemplate:{render:function(){" + inlineRenderFns
.render
+ "},staticRenderFns:[" + inlineRenderFns
.staticRenderFns
.map(function (code
) {
8796 return "function(){" + code
+ "}";
8797 }).join(',') + "]}";
8801 function genScopedSlots(slots
, state
) {
8802 return "scopedSlots:_u([" + Object
.keys(slots
).map(function (key
) {
8803 return genScopedSlot(key
, slots
[key
], state
);
8804 }).join(',') + "])";
8807 function genScopedSlot(key
, el
, state
) {
8808 if (el
.for && !el
.forProcessed
) {
8809 return genForScopedSlot(key
, el
, state
);
8811 return "{key:" + key
+ ",fn:function(" + String(el
.attrsMap
.scope
) + "){" + "return " + (el
.tag
=== 'template' ? genChildren(el
, state
) || 'void 0' : genElement(el
, state
)) + "}}";
8814 function genForScopedSlot(key
, el
, state
) {
8816 var alias
= el
.alias
;
8817 var iterator1
= el
.iterator1
? "," + el
.iterator1 : '';
8818 var iterator2
= el
.iterator2
? "," + el
.iterator2 : '';
8819 el
.forProcessed
= true; // avoid recursion
8820 return "_l((" + exp
+ ")," + "function(" + alias
+ iterator1
+ iterator2
+ "){" + "return " + genScopedSlot(key
, el
, state
) + '})';
8823 function genChildren(el
, state
, checkSkip
, altGenElement
, altGenNode
) {
8824 var children
= el
.children
;
8825 if (children
.length
) {
8826 var el
$1 = children
[0];
8827 // optimize single v-for
8828 if (children
.length
=== 1 && el
$1.for && el
$1.tag
!== 'template' && el
$1.tag
!== 'slot') {
8829 return (altGenElement
|| genElement
)(el
$1, state
);
8831 var normalizationType
= checkSkip
? getNormalizationType(children
, state
.maybeComponent
) : 0;
8832 var gen
= altGenNode
|| genNode
;
8833 return "[" + children
.map(function (c
) {
8834 return gen(c
, state
);
8835 }).join(',') + "]" + (normalizationType
? "," + normalizationType : '');
8839 // determine the normalization needed for the children array.
8840 // 0: no normalization needed
8841 // 1: simple normalization needed (possible 1-level deep nested array)
8842 // 2: full normalization needed
8843 function getNormalizationType(children
, maybeComponent
) {
8845 for (var i
= 0; i
< children
.length
; i
++) {
8846 var el
= children
[i
];
8847 if (el
.type
!== 1) {
8850 if (needsNormalization(el
) || el
.ifConditions
&& el
.ifConditions
.some(function (c
) {
8851 return needsNormalization(c
.block
);
8856 if (maybeComponent(el
) || el
.ifConditions
&& el
.ifConditions
.some(function (c
) {
8857 return maybeComponent(c
.block
);
8865 function needsNormalization(el
) {
8866 return el
.for !== undefined || el
.tag
=== 'template' || el
.tag
=== 'slot';
8869 function genNode(node
, state
) {
8870 if (node
.type
=== 1) {
8871 return genElement(node
, state
);
8872 }if (node
.type
=== 3 && node
.isComment
) {
8873 return genComment(node
);
8875 return genText(node
);
8879 function genText(text
) {
8880 return "_v(" + (text
.type
=== 2 ? text
.expression
// no need for () because already wrapped in _s()
8881 : transformSpecialNewlines(JSON
.stringify(text
.text
))) + ")";
8884 function genComment(comment
) {
8885 return "_e(" + JSON
.stringify(comment
.text
) + ")";
8888 function genSlot(el
, state
) {
8889 var slotName
= el
.slotName
|| '"default"';
8890 var children
= genChildren(el
, state
);
8891 var res
= "_t(" + slotName
+ (children
? "," + children : '');
8892 var attrs
= el
.attrs
&& "{" + el
.attrs
.map(function (a
) {
8893 return camelize(a
.name
) + ":" + a
.value
;
8895 var bind
$$1 = el
.attrsMap
['v-bind'];
8896 if ((attrs
|| bind
$$1) && !children
) {
8903 res
+= (attrs
? '' : ',null') + "," + bind
$$1;
8908 // componentName is el.component, take it as argument to shun flow's pessimistic refinement
8909 function genComponent(componentName
, el
, state
) {
8910 var children
= el
.inlineTemplate
? null : genChildren(el
, state
, true);
8911 return "_c(" + componentName
+ "," + genData
$2(el
, state
) + (children
? "," + children : '') + ")";
8914 function genProps(props
) {
8916 for (var i
= 0; i
< props
.length
; i
++) {
8917 var prop
= props
[i
];
8918 res
+= "\"" + prop
.name
+ "\":" + transformSpecialNewlines(prop
.value
) + ",";
8920 return res
.slice(0, -1);
8924 function transformSpecialNewlines(text
) {
8925 return text
.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
8930 // these keywords should not appear inside expressions, but operators like
8931 // typeof, instanceof and in are allowed
8932 var prohibitedKeywordRE
= new RegExp('\\b' + ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + 'super,throw,while,yield,delete,export,import,return,switch,default,' + 'extends,finally,continue,debugger,function,arguments').split(',').join('\\b|\\b') + '\\b');
8934 // these unary operators should not be used as property/method names
8935 var unaryOperatorsRE
= new RegExp('\\b' + 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
8937 // check valid identifier for v-for
8938 var identRE
= /[A-Za-z_$][\w$]*/;
8940 // strip strings in expressions
8941 var stripStringRE
= /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
8943 // detect problematic expressions in a template
8944 function detectErrors(ast
) {
8947 checkNode(ast
, errors
);
8952 function checkNode(node
, errors
) {
8953 if (node
.type
=== 1) {
8954 for (var name
in node
.attrsMap
) {
8955 if (dirRE
.test(name
)) {
8956 var value
= node
.attrsMap
[name
];
8958 if (name
=== 'v-for') {
8959 checkFor(node
, "v-for=\"" + value
+ "\"", errors
);
8960 } else if (onRE
.test(name
)) {
8961 checkEvent(value
, name
+ "=\"" + value
+ "\"", errors
);
8963 checkExpression(value
, name
+ "=\"" + value
+ "\"", errors
);
8968 if (node
.children
) {
8969 for (var i
= 0; i
< node
.children
.length
; i
++) {
8970 checkNode(node
.children
[i
], errors
);
8973 } else if (node
.type
=== 2) {
8974 checkExpression(node
.expression
, node
.text
, errors
);
8978 function checkEvent(exp
, text
, errors
) {
8979 var stipped
= exp
.replace(stripStringRE
, '');
8980 var keywordMatch
= stipped
.match(unaryOperatorsRE
);
8981 if (keywordMatch
&& stipped
.charAt(keywordMatch
.index
- 1) !== '$') {
8982 errors
.push("avoid using JavaScript unary operator as property name: " + "\"" + keywordMatch
[0] + "\" in expression " + text
.trim());
8984 checkExpression(exp
, text
, errors
);
8987 function checkFor(node
, text
, errors
) {
8988 checkExpression(node
.for || '', text
, errors
);
8989 checkIdentifier(node
.alias
, 'v-for alias', text
, errors
);
8990 checkIdentifier(node
.iterator1
, 'v-for iterator', text
, errors
);
8991 checkIdentifier(node
.iterator2
, 'v-for iterator', text
, errors
);
8994 function checkIdentifier(ident
, type
, text
, errors
) {
8995 if (typeof ident
=== 'string' && !identRE
.test(ident
)) {
8996 errors
.push("invalid " + type
+ " \"" + ident
+ "\" in expression: " + text
.trim());
9000 function checkExpression(exp
, text
, errors
) {
9002 new Function("return " + exp
);
9004 var keywordMatch
= exp
.replace(stripStringRE
, '').match(prohibitedKeywordRE
);
9006 errors
.push("avoid using JavaScript keyword as property name: " + "\"" + keywordMatch
[0] + "\" in expression " + text
.trim());
9008 errors
.push("invalid expression: " + text
.trim());
9015 function createFunction(code
, errors
) {
9017 return new Function(code
);
9019 errors
.push({ err: err
, code: code
});
9024 function createCompileToFunctionFn(compile
) {
9025 var cache
= Object
.create(null);
9027 return function compileToFunctions(template
, options
, vm
) {
9028 options
= options
|| {};
9030 /* istanbul ignore if */
9031 if (process
.env
.NODE_ENV
!== 'production') {
9032 // detect possible CSP restriction
9034 new Function('return 1');
9036 if (e
.toString().match(/unsafe-eval|CSP/)) {
9037 warn('It seems you are using the standalone build of Vue.js in an ' + 'environment with Content Security Policy that prohibits unsafe-eval. ' + 'The template compiler cannot work in this environment. Consider ' + 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 'templates into render functions.');
9043 var key
= options
.delimiters
? String(options
.delimiters
) + template : template
;
9049 var compiled
= compile(template
, options
);
9051 // check compilation errors/tips
9052 if (process
.env
.NODE_ENV
!== 'production') {
9053 if (compiled
.errors
&& compiled
.errors
.length
) {
9054 warn("Error compiling template:\n\n" + template
+ "\n\n" + compiled
.errors
.map(function (e
) {
9056 }).join('\n') + '\n', vm
);
9058 if (compiled
.tips
&& compiled
.tips
.length
) {
9059 compiled
.tips
.forEach(function (msg
) {
9060 return tip(msg
, vm
);
9065 // turn code into functions
9067 var fnGenErrors
= [];
9068 res
.render
= createFunction(compiled
.render
, fnGenErrors
);
9069 res
.staticRenderFns
= compiled
.staticRenderFns
.map(function (code
) {
9070 return createFunction(code
, fnGenErrors
);
9073 // check function generation errors.
9074 // this should only happen if there is a bug in the compiler itself.
9075 // mostly for codegen development use
9076 /* istanbul ignore if */
9077 if (process
.env
.NODE_ENV
!== 'production') {
9078 if ((!compiled
.errors
|| !compiled
.errors
.length
) && fnGenErrors
.length
) {
9079 warn("Failed to generate render function:\n\n" + fnGenErrors
.map(function (ref
) {
9081 var code
= ref
.code
;
9083 return err
.toString() + " in\n\n" + code
+ "\n";
9088 return cache
[key
] = res
;
9094 function createCompilerCreator(baseCompile
) {
9095 return function createCompiler(baseOptions
) {
9096 function compile(template
, options
) {
9097 var finalOptions
= Object
.create(baseOptions
);
9100 finalOptions
.warn = function (msg
, tip
) {
9101 (tip
? tips : errors
).push(msg
);
9105 // merge custom modules
9106 if (options
.modules
) {
9107 finalOptions
.modules
= (baseOptions
.modules
|| []).concat(options
.modules
);
9109 // merge custom directives
9110 if (options
.directives
) {
9111 finalOptions
.directives
= extend(Object
.create(baseOptions
.directives
), options
.directives
);
9113 // copy other options
9114 for (var key
in options
) {
9115 if (key
!== 'modules' && key
!== 'directives') {
9116 finalOptions
[key
] = options
[key
];
9121 var compiled
= baseCompile(template
, finalOptions
);
9122 if (process
.env
.NODE_ENV
!== 'production') {
9123 errors
.push
.apply(errors
, detectErrors(compiled
.ast
));
9125 compiled
.errors
= errors
;
9126 compiled
.tips
= tips
;
9132 compileToFunctions: createCompileToFunctionFn(compile
)
9139 // `createCompilerCreator` allows creating compilers that use alternative
9140 // parser/optimizer/codegen, e.g the SSR optimizing compiler.
9141 // Here we just export a default compiler using the default parts.
9142 var createCompiler
= createCompilerCreator(function baseCompile(template
, options
) {
9143 var ast
= parse(template
.trim(), options
);
9144 optimize(ast
, options
);
9145 var code
= generate(ast
, options
);
9148 render: code
.render
,
9149 staticRenderFns: code
.staticRenderFns
9155 var ref
$1 = createCompiler(baseOptions
);
9156 var compileToFunctions
= ref
$1.compileToFunctions
;
9160 var idToTemplate
= cached(function (id
) {
9162 return el
&& el
.innerHTML
;
9165 var mount
= Vue
$3.prototype.$mount
;
9166 Vue
$3.prototype.$mount = function (el
, hydrating
) {
9167 el
= el
&& query(el
);
9169 /* istanbul ignore if */
9170 if (el
=== document
.body
|| el
=== document
.documentElement
) {
9171 process
.env
.NODE_ENV
!== 'production' && warn("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
9175 var options
= this.$options
;
9176 // resolve template/el and convert to render function
9177 if (!options
.render
) {
9178 var template
= options
.template
;
9180 if (typeof template
=== 'string') {
9181 if (template
.charAt(0) === '#') {
9182 template
= idToTemplate(template
);
9183 /* istanbul ignore if */
9184 if (process
.env
.NODE_ENV
!== 'production' && !template
) {
9185 warn("Template element not found or is empty: " + options
.template
, this);
9188 } else if (template
.nodeType
) {
9189 template
= template
.innerHTML
;
9191 if (process
.env
.NODE_ENV
!== 'production') {
9192 warn('invalid template option:' + template
, this);
9197 template
= getOuterHTML(el
);
9200 /* istanbul ignore if */
9201 if (process
.env
.NODE_ENV
!== 'production' && config
.performance
&& mark
) {
9205 var ref
= compileToFunctions(template
, {
9206 shouldDecodeNewlines: shouldDecodeNewlines
,
9207 delimiters: options
.delimiters
,
9208 comments: options
.comments
9210 var render
= ref
.render
;
9211 var staticRenderFns
= ref
.staticRenderFns
;
9212 options
.render
= render
;
9213 options
.staticRenderFns
= staticRenderFns
;
9215 /* istanbul ignore if */
9216 if (process
.env
.NODE_ENV
!== 'production' && config
.performance
&& mark
) {
9217 mark('compile end');
9218 measure(this._name
+ " compile", 'compile', 'compile end');
9222 return mount
.call(this, el
, hydrating
);
9226 * Get outerHTML of elements, taking care
9227 * of SVG elements in IE as well.
9229 function getOuterHTML(el
) {
9231 return el
.outerHTML
;
9233 var container
= document
.createElement('div');
9234 container
.appendChild(el
.cloneNode(true));
9235 return container
.innerHTML
;
9239 Vue
$3.compile
= compileToFunctions
;
9241 /* harmony default export */ __webpack_exports__
["a"] = (Vue
$3);
9242 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__
, __webpack_require__(3), __webpack_require__(4)))
9246 /***/ (function(module
, __webpack_exports__
, __webpack_require__
) {
9251 kSocketLocation: 'ws://localhost:1987',
9255 runningAverages: {},
9261 internals
.socket
= new WebSocket(internals
.kSocketLocation
);
9262 internals
.socket
.addEventListener('message', data
=> {
9264 Object
.assign(internals
.data
, JSON
.parse(data
.data
));
9269 /* harmony default export */ __webpack_exports__
["a"] = ({
9272 if (!internals
.socket
) {
9273 internals
.initSocket();
9276 return internals
.data
;
9282 /***/ (function(module
, __webpack_exports__
, __webpack_require__
) {
9285 Object
.defineProperty(__webpack_exports__
, "__esModule", { value: true });
9286 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__
= __webpack_require__(0);
9287 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_wave_renderer__
= __webpack_require__(5);
9288 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_status__
= __webpack_require__(6);
9296 const internals
= {};
9298 internals
.SortingHat
= {
9302 this.vm
= new __WEBPACK_IMPORTED_MODULE_0_vue__
["a" /* default */]({
9305 waveRenderer: __WEBPACK_IMPORTED_MODULE_1__components_wave_renderer__
["a" /* default */],
9306 status: __WEBPACK_IMPORTED_MODULE_2__components_status__
["a" /* default */]
9312 internals
.run = function () {
9314 internals
.SortingHat
.start();
9317 window
.addEventListener('load', internals
.run
);
9321 /***/ (function(module
, exports
) {
9323 // shim for using process in browser
9324 var process
= module
.exports
= {};
9326 // cached from whatever global is present so that test runners that stub it
9327 // don't break things. But we need to wrap it in a try catch in case it is
9328 // wrapped in strict mode code which doesn't define any globals. It's inside a
9329 // function because try/catches deoptimize in certain engines.
9331 var cachedSetTimeout
;
9332 var cachedClearTimeout
;
9334 function defaultSetTimout() {
9335 throw new Error('setTimeout has not been defined');
9337 function defaultClearTimeout() {
9338 throw new Error('clearTimeout has not been defined');
9342 if (typeof setTimeout
=== 'function') {
9343 cachedSetTimeout
= setTimeout
;
9345 cachedSetTimeout
= defaultSetTimout
;
9348 cachedSetTimeout
= defaultSetTimout
;
9351 if (typeof clearTimeout
=== 'function') {
9352 cachedClearTimeout
= clearTimeout
;
9354 cachedClearTimeout
= defaultClearTimeout
;
9357 cachedClearTimeout
= defaultClearTimeout
;
9360 function runTimeout(fun
) {
9361 if (cachedSetTimeout
=== setTimeout
) {
9362 //normal enviroments in sane situations
9363 return setTimeout(fun
, 0);
9365 // if setTimeout wasn't available but was latter defined
9366 if ((cachedSetTimeout
=== defaultSetTimout
|| !cachedSetTimeout
) && setTimeout
) {
9367 cachedSetTimeout
= setTimeout
;
9368 return setTimeout(fun
, 0);
9371 // when when somebody has screwed with setTimeout but no I.E. maddness
9372 return cachedSetTimeout(fun
, 0);
9375 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
9376 return cachedSetTimeout
.call(null, fun
, 0);
9378 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
9379 return cachedSetTimeout
.call(this, fun
, 0);
9383 function runClearTimeout(marker
) {
9384 if (cachedClearTimeout
=== clearTimeout
) {
9385 //normal enviroments in sane situations
9386 return clearTimeout(marker
);
9388 // if clearTimeout wasn't available but was latter defined
9389 if ((cachedClearTimeout
=== defaultClearTimeout
|| !cachedClearTimeout
) && clearTimeout
) {
9390 cachedClearTimeout
= clearTimeout
;
9391 return clearTimeout(marker
);
9394 // when when somebody has screwed with setTimeout but no I.E. maddness
9395 return cachedClearTimeout(marker
);
9398 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
9399 return cachedClearTimeout
.call(null, marker
);
9401 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
9402 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
9403 return cachedClearTimeout
.call(this, marker
);
9408 var draining
= false;
9410 var queueIndex
= -1;
9412 function cleanUpNextTick() {
9413 if (!draining
|| !currentQueue
) {
9417 if (currentQueue
.length
) {
9418 queue
= currentQueue
.concat(queue
);
9427 function drainQueue() {
9431 var timeout
= runTimeout(cleanUpNextTick
);
9434 var len
= queue
.length
;
9436 currentQueue
= queue
;
9438 while (++queueIndex
< len
) {
9440 currentQueue
[queueIndex
].run();
9446 currentQueue
= null;
9448 runClearTimeout(timeout
);
9451 process
.nextTick = function (fun
) {
9452 var args
= new Array(arguments
.length
- 1);
9453 if (arguments
.length
> 1) {
9454 for (var i
= 1; i
< arguments
.length
; i
++) {
9455 args
[i
- 1] = arguments
[i
];
9458 queue
.push(new Item(fun
, args
));
9459 if (queue
.length
=== 1 && !draining
) {
9460 runTimeout(drainQueue
);
9464 // v8 likes predictible objects
9465 function Item(fun
, array
) {
9469 Item
.prototype.run = function () {
9470 this.fun
.apply(null, this.array
);
9472 process
.title
= 'browser';
9473 process
.browser
= true;
9476 process
.version
= ''; // empty string to avoid regexp issues
9477 process
.versions
= {};
9482 process
.addListener
= noop
;
9483 process
.once
= noop
;
9485 process
.removeListener
= noop
;
9486 process
.removeAllListeners
= noop
;
9487 process
.emit
= noop
;
9488 process
.prependListener
= noop
;
9489 process
.prependOnceListener
= noop
;
9491 process
.listeners = function (name
) {
9495 process
.binding = function (name
) {
9496 throw new Error('process.binding is not supported');
9499 process
.cwd = function () {
9502 process
.chdir = function (dir
) {
9503 throw new Error('process.chdir is not supported');
9505 process
.umask = function () {
9511 /***/ (function(module
, exports
) {
9515 // This works in non-strict mode
9521 // This works if eval is allowed (see CSP)
9522 g
= g
|| Function("return this")() || (1, eval
)("this");
9524 // This works if the window reference is available
9525 if (typeof window
=== "object") g
= window
;
9528 // g can still be undefined, but nothing to do about it...
9529 // We return undefined, instead of nothing here, so it's
9530 // easier to handle this case. if(!global) { ...}
9536 /***/ (function(module
, __webpack_exports__
, __webpack_require__
) {
9539 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__
= __webpack_require__(0);
9540 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_data__
= __webpack_require__(1);
9549 donatello: 'purple',
9551 michaelangelo: 'orange',
9561 // Utility functions
9563 scale(value
, min
, max
) {
9565 return (value
- min
) / (max
- min
) * (internals
.kMaxValue
- internals
.kMinValue
) - internals
.kMinValue
;
9569 /* harmony default export */ __webpack_exports__
["a"] = (__WEBPACK_IMPORTED_MODULE_0_vue__
["a" /* default */].component('posts', {
9570 template: '<transition name="fade">' + '<canvas v-show="state === 1" class="wave-renderer"></canvas>' + '</transition>',
9572 data: __WEBPACK_IMPORTED_MODULE_1__services_data__
["a" /* default */].data
,
9576 // Convert from the min / max value in the measurement to a
9577 // predefined min value between 0 and 100 (see kMinValue and
9578 // kMaxValue for actual values)
9582 const keys
= Object
.keys(this.runningAverages
);
9584 const averages
= keys
.reduce((averages
, averageCategory
) => {
9586 const runningAverage
= this.runningAverages
[averageCategory
];
9587 averages
[averageCategory
] = runningAverage
.average
;
9591 const max
= Math
.max(...Object
.values(averages
));
9592 const min
= Math
.min(...Object
.values(averages
));
9594 const scaledAverages
= Object
.keys(averages
).reduce((scaledAverages
, averageCategory
) => {
9596 const value
= averages
[averageCategory
];
9597 scaledAverages
[averageCategory
] = internals
.scale(value
, min
, max
);
9598 return scaledAverages
;
9601 return scaledAverages
;
9608 this.$el
.width
= window
.innerWidth
;
9609 this.$el
.height
= window
.innerHeight
;
9613 // Initiates the animation loop
9617 // Make sure we resize, do an initial sizing
9619 window
.addEventListener('resize', this.onResize
.bind(this));
9622 // Start the whole animation (Sorry it's a mess)
9624 const canvas
= this.$el
;
9626 const context
= canvas
.getContext('2d');
9627 const interval
= 1000 / internals
.kTargetFPS
;
9629 let lastTimestamp
= 0;
9631 const animationHandler
= timestamp
=> {
9633 window
.requestAnimationFrame(animationHandler
);
9634 const delta
= timestamp
- lastTimestamp
;
9636 if (delta
> interval
) {
9638 const keys
= Object
.keys(this.scaledAverages
);
9639 const values
= Object
.values(this.scaledAverages
);
9640 const segments
= keys
.length
;
9641 const period
= canvas
.width
/ segments
;
9643 const fillGradient
= context
.createLinearGradient(0, 0, canvas
.width
, 0);
9644 const gradientBandWidth
= 1 / segments
;
9646 // Position the drawing cursor left-center of screen
9648 context
.clearRect(0, 0, canvas
.width
, canvas
.height
);
9649 context
.beginPath();
9650 context
.moveTo(0, canvas
.height
);
9651 context
.lineTo(0, canvas
.height
/ 2);
9653 // Iterate over the segments
9655 for (let currentSegment
= 0; currentSegment
< segments
; ++currentSegment
) {
9656 const segmentStart
= currentSegment
* period
;
9657 const segmentEnd
= currentSegment
+ period
;
9659 const category
= keys
[currentSegment
];
9660 const magnitude
= values
[currentSegment
];
9661 const segmentHeight
= Math
.round(Math
.random() * internals
.kRandomJitter
+ magnitude
* (canvas
.height
/ 2) / 100);
9663 // Calculate the gradient using the correct color according to
9666 const color
= internals
.kColors
[category
] || 'black';
9667 let currentGradientPosition
= currentSegment
* gradientBandWidth
+ internals
.kGradientFade
;
9668 fillGradient
.addColorStop(currentGradientPosition
, color
);
9669 currentGradientPosition
= (currentSegment
+ 1) * gradientBandWidth
- internals
.kGradientFade
;
9670 fillGradient
.addColorStop(currentGradientPosition
, color
);
9672 // This draws the sine wave
9674 for (let angle
= 0; angle
< 180; ++angle
) {
9675 const currentPixel
= segmentStart
+ angle
* period
/ 180;
9676 const currentAngle
= angle
+ 180 * (currentSegment
% 2);
9677 const currentRadians
= currentAngle
* Math
.PI
/ 180;
9678 const currentHeight
= segmentHeight
* Math
.sin(internals
.kFrequency
* currentRadians
);
9680 context
.lineTo(currentPixel
, currentHeight
+ canvas
.height
/ 2);
9684 context
.lineTo(canvas
.width
, canvas
.height
/ 2);
9685 context
.lineTo(canvas
.width
, canvas
.height
);
9686 context
.fillStyle
= fillGradient
;
9689 lastTimestamp
= timestamp
;
9693 window
.requestAnimationFrame(animationHandler
);
9699 /***/ (function(module
, __webpack_exports__
, __webpack_require__
) {
9702 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__
= __webpack_require__(0);
9703 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_data__
= __webpack_require__(1);
9707 const internals
= {};
9709 /* harmony default export */ __webpack_exports__
["a"] = (__WEBPACK_IMPORTED_MODULE_0_vue__
["a" /* default */].component('posts', {
9710 template: '<div class="status-widget">' + '<transition name="fade">' + '<div v-if="state === 0" class="waiting-message">Waiting</div>' + '<div v-if="state === 2 && !winner" class="no-winner">Could not read you</div>' + '<div v-if="state === 2 && winner" class="winner" v-bind:class="[winner]">{{winner}}</div>' + '</transition>' + '</div>',
9712 data: __WEBPACK_IMPORTED_MODULE_1__services_data__
["a" /* default */].data