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