PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.0.3
JetFormBuilder — Dynamic Blocks Form Builder v2.0.3
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 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 / framework / vue-ui / assets / js / vue.js
jetformbuilder / framework / vue-ui / assets / js Last commit date
cx-vue-ui.js 4 years ago vue.js 4 years ago vue.min.js 4 years ago
vue.js
11945 lines
1 /*!
2 * Vue.js v2.6.10
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 // Techinically 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 speical 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 vnode = new VNode(
3417 config.parsePlatformTagName(tag), data, children,
3418 undefined, undefined, context
3419 );
3420 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3421 // component
3422 vnode = createComponent(Ctor, data, context, children, tag);
3423 } else {
3424 // unknown or unlisted namespaced elements
3425 // check at runtime because it may get assigned a namespace when its
3426 // parent normalizes children
3427 vnode = new VNode(
3428 tag, data, children,
3429 undefined, undefined, context
3430 );
3431 }
3432 } else {
3433 // direct component options / constructor
3434 vnode = createComponent(tag, data, context, children);
3435 }
3436 if (Array.isArray(vnode)) {
3437 return vnode
3438 } else if (isDef(vnode)) {
3439 if (isDef(ns)) { applyNS(vnode, ns); }
3440 if (isDef(data)) { registerDeepBindings(data); }
3441 return vnode
3442 } else {
3443 return createEmptyVNode()
3444 }
3445 }
3446
3447 function applyNS (vnode, ns, force) {
3448 vnode.ns = ns;
3449 if (vnode.tag === 'foreignObject') {
3450 // use default namespace inside foreignObject
3451 ns = undefined;
3452 force = true;
3453 }
3454 if (isDef(vnode.children)) {
3455 for (var i = 0, l = vnode.children.length; i < l; i++) {
3456 var child = vnode.children[i];
3457 if (isDef(child.tag) && (
3458 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3459 applyNS(child, ns, force);
3460 }
3461 }
3462 }
3463 }
3464
3465 // ref #5318
3466 // necessary to ensure parent re-render when deep bindings like :style and
3467 // :class are used on slot nodes
3468 function registerDeepBindings (data) {
3469 if (isObject(data.style)) {
3470 traverse(data.style);
3471 }
3472 if (isObject(data.class)) {
3473 traverse(data.class);
3474 }
3475 }
3476
3477 /* */
3478
3479 function initRender (vm) {
3480 vm._vnode = null; // the root of the child tree
3481 vm._staticTrees = null; // v-once cached trees
3482 var options = vm.$options;
3483 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3484 var renderContext = parentVnode && parentVnode.context;
3485 vm.$slots = resolveSlots(options._renderChildren, renderContext);
3486 vm.$scopedSlots = emptyObject;
3487 // bind the createElement fn to this instance
3488 // so that we get proper render context inside it.
3489 // args order: tag, data, children, normalizationType, alwaysNormalize
3490 // internal version is used by render functions compiled from templates
3491 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3492 // normalization is always applied for the public version, used in
3493 // user-written render functions.
3494 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3495
3496 // $attrs & $listeners are exposed for easier HOC creation.
3497 // they need to be reactive so that HOCs using them are always updated
3498 var parentData = parentVnode && parentVnode.data;
3499
3500 /* istanbul ignore else */
3501 {
3502 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3503 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3504 }, true);
3505 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3506 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3507 }, true);
3508 }
3509 }
3510
3511 var currentRenderingInstance = null;
3512
3513 function renderMixin (Vue) {
3514 // install runtime convenience helpers
3515 installRenderHelpers(Vue.prototype);
3516
3517 Vue.prototype.$nextTick = function (fn) {
3518 return nextTick(fn, this)
3519 };
3520
3521 Vue.prototype._render = function () {
3522 var vm = this;
3523 var ref = vm.$options;
3524 var render = ref.render;
3525 var _parentVnode = ref._parentVnode;
3526
3527 if (_parentVnode) {
3528 vm.$scopedSlots = normalizeScopedSlots(
3529 _parentVnode.data.scopedSlots,
3530 vm.$slots,
3531 vm.$scopedSlots
3532 );
3533 }
3534
3535 // set parent vnode. this allows render functions to have access
3536 // to the data on the placeholder node.
3537 vm.$vnode = _parentVnode;
3538 // render self
3539 var vnode;
3540 try {
3541 // There's no need to maintain a stack becaues all render fns are called
3542 // separately from one another. Nested component's render fns are called
3543 // when parent component is patched.
3544 currentRenderingInstance = vm;
3545 vnode = render.call(vm._renderProxy, vm.$createElement);
3546 } catch (e) {
3547 handleError(e, vm, "render");
3548 // return error render result,
3549 // or previous vnode to prevent render error causing blank component
3550 /* istanbul ignore else */
3551 if (vm.$options.renderError) {
3552 try {
3553 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3554 } catch (e) {
3555 handleError(e, vm, "renderError");
3556 vnode = vm._vnode;
3557 }
3558 } else {
3559 vnode = vm._vnode;
3560 }
3561 } finally {
3562 currentRenderingInstance = null;
3563 }
3564 // if the returned array contains only a single node, allow it
3565 if (Array.isArray(vnode) && vnode.length === 1) {
3566 vnode = vnode[0];
3567 }
3568 // return empty vnode in case the render function errored out
3569 if (!(vnode instanceof VNode)) {
3570 if (Array.isArray(vnode)) {
3571 warn(
3572 'Multiple root nodes returned from render function. Render function ' +
3573 'should return a single root node.',
3574 vm
3575 );
3576 }
3577 vnode = createEmptyVNode();
3578 }
3579 // set parent
3580 vnode.parent = _parentVnode;
3581 return vnode
3582 };
3583 }
3584
3585 /* */
3586
3587 function ensureCtor (comp, base) {
3588 if (
3589 comp.__esModule ||
3590 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3591 ) {
3592 comp = comp.default;
3593 }
3594 return isObject(comp)
3595 ? base.extend(comp)
3596 : comp
3597 }
3598
3599 function createAsyncPlaceholder (
3600 factory,
3601 data,
3602 context,
3603 children,
3604 tag
3605 ) {
3606 var node = createEmptyVNode();
3607 node.asyncFactory = factory;
3608 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3609 return node
3610 }
3611
3612 function resolveAsyncComponent (
3613 factory,
3614 baseCtor
3615 ) {
3616 if (isTrue(factory.error) && isDef(factory.errorComp)) {
3617 return factory.errorComp
3618 }
3619
3620 if (isDef(factory.resolved)) {
3621 return factory.resolved
3622 }
3623
3624 var owner = currentRenderingInstance;
3625 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3626 // already pending
3627 factory.owners.push(owner);
3628 }
3629
3630 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3631 return factory.loadingComp
3632 }
3633
3634 if (owner && !isDef(factory.owners)) {
3635 var owners = factory.owners = [owner];
3636 var sync = true;
3637 var timerLoading = null;
3638 var timerTimeout = null
3639
3640 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3641
3642 var forceRender = function (renderCompleted) {
3643 for (var i = 0, l = owners.length; i < l; i++) {
3644 (owners[i]).$forceUpdate();
3645 }
3646
3647 if (renderCompleted) {
3648 owners.length = 0;
3649 if (timerLoading !== null) {
3650 clearTimeout(timerLoading);
3651 timerLoading = null;
3652 }
3653 if (timerTimeout !== null) {
3654 clearTimeout(timerTimeout);
3655 timerTimeout = null;
3656 }
3657 }
3658 };
3659
3660 var resolve = once(function (res) {
3661 // cache resolved
3662 factory.resolved = ensureCtor(res, baseCtor);
3663 // invoke callbacks only if this is not a synchronous resolve
3664 // (async resolves are shimmed as synchronous during SSR)
3665 if (!sync) {
3666 forceRender(true);
3667 } else {
3668 owners.length = 0;
3669 }
3670 });
3671
3672 var reject = once(function (reason) {
3673 warn(
3674 "Failed to resolve async component: " + (String(factory)) +
3675 (reason ? ("\nReason: " + reason) : '')
3676 );
3677 if (isDef(factory.errorComp)) {
3678 factory.error = true;
3679 forceRender(true);
3680 }
3681 });
3682
3683 var res = factory(resolve, reject);
3684
3685 if (isObject(res)) {
3686 if (isPromise(res)) {
3687 // () => Promise
3688 if (isUndef(factory.resolved)) {
3689 res.then(resolve, reject);
3690 }
3691 } else if (isPromise(res.component)) {
3692 res.component.then(resolve, reject);
3693
3694 if (isDef(res.error)) {
3695 factory.errorComp = ensureCtor(res.error, baseCtor);
3696 }
3697
3698 if (isDef(res.loading)) {
3699 factory.loadingComp = ensureCtor(res.loading, baseCtor);
3700 if (res.delay === 0) {
3701 factory.loading = true;
3702 } else {
3703 timerLoading = setTimeout(function () {
3704 timerLoading = null;
3705 if (isUndef(factory.resolved) && isUndef(factory.error)) {
3706 factory.loading = true;
3707 forceRender(false);
3708 }
3709 }, res.delay || 200);
3710 }
3711 }
3712
3713 if (isDef(res.timeout)) {
3714 timerTimeout = setTimeout(function () {
3715 timerTimeout = null;
3716 if (isUndef(factory.resolved)) {
3717 reject(
3718 "timeout (" + (res.timeout) + "ms)"
3719 );
3720 }
3721 }, res.timeout);
3722 }
3723 }
3724 }
3725
3726 sync = false;
3727 // return in case resolved synchronously
3728 return factory.loading
3729 ? factory.loadingComp
3730 : factory.resolved
3731 }
3732 }
3733
3734 /* */
3735
3736 function isAsyncPlaceholder (node) {
3737 return node.isComment && node.asyncFactory
3738 }
3739
3740 /* */
3741
3742 function getFirstComponentChild (children) {
3743 if (Array.isArray(children)) {
3744 for (var i = 0; i < children.length; i++) {
3745 var c = children[i];
3746 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3747 return c
3748 }
3749 }
3750 }
3751 }
3752
3753 /* */
3754
3755 /* */
3756
3757 function initEvents (vm) {
3758 vm._events = Object.create(null);
3759 vm._hasHookEvent = false;
3760 // init parent attached events
3761 var listeners = vm.$options._parentListeners;
3762 if (listeners) {
3763 updateComponentListeners(vm, listeners);
3764 }
3765 }
3766
3767 var target;
3768
3769 function add (event, fn) {
3770 target.$on(event, fn);
3771 }
3772
3773 function remove$1 (event, fn) {
3774 target.$off(event, fn);
3775 }
3776
3777 function createOnceHandler (event, fn) {
3778 var _target = target;
3779 return function onceHandler () {
3780 var res = fn.apply(null, arguments);
3781 if (res !== null) {
3782 _target.$off(event, onceHandler);
3783 }
3784 }
3785 }
3786
3787 function updateComponentListeners (
3788 vm,
3789 listeners,
3790 oldListeners
3791 ) {
3792 target = vm;
3793 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3794 target = undefined;
3795 }
3796
3797 function eventsMixin (Vue) {
3798 var hookRE = /^hook:/;
3799 Vue.prototype.$on = function (event, fn) {
3800 var vm = this;
3801 if (Array.isArray(event)) {
3802 for (var i = 0, l = event.length; i < l; i++) {
3803 vm.$on(event[i], fn);
3804 }
3805 } else {
3806 (vm._events[event] || (vm._events[event] = [])).push(fn);
3807 // optimize hook:event cost by using a boolean flag marked at registration
3808 // instead of a hash lookup
3809 if (hookRE.test(event)) {
3810 vm._hasHookEvent = true;
3811 }
3812 }
3813 return vm
3814 };
3815
3816 Vue.prototype.$once = function (event, fn) {
3817 var vm = this;
3818 function on () {
3819 vm.$off(event, on);
3820 fn.apply(vm, arguments);
3821 }
3822 on.fn = fn;
3823 vm.$on(event, on);
3824 return vm
3825 };
3826
3827 Vue.prototype.$off = function (event, fn) {
3828 var vm = this;
3829 // all
3830 if (!arguments.length) {
3831 vm._events = Object.create(null);
3832 return vm
3833 }
3834 // array of events
3835 if (Array.isArray(event)) {
3836 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3837 vm.$off(event[i$1], fn);
3838 }
3839 return vm
3840 }
3841 // specific event
3842 var cbs = vm._events[event];
3843 if (!cbs) {
3844 return vm
3845 }
3846 if (!fn) {
3847 vm._events[event] = null;
3848 return vm
3849 }
3850 // specific handler
3851 var cb;
3852 var i = cbs.length;
3853 while (i--) {
3854 cb = cbs[i];
3855 if (cb === fn || cb.fn === fn) {
3856 cbs.splice(i, 1);
3857 break
3858 }
3859 }
3860 return vm
3861 };
3862
3863 Vue.prototype.$emit = function (event) {
3864 var vm = this;
3865 {
3866 var lowerCaseEvent = event.toLowerCase();
3867 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3868 tip(
3869 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3870 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3871 "Note that HTML attributes are case-insensitive and you cannot use " +
3872 "v-on to listen to camelCase events when using in-DOM templates. " +
3873 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3874 );
3875 }
3876 }
3877 var cbs = vm._events[event];
3878 if (cbs) {
3879 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3880 var args = toArray(arguments, 1);
3881 var info = "event handler for \"" + event + "\"";
3882 for (var i = 0, l = cbs.length; i < l; i++) {
3883 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3884 }
3885 }
3886 return vm
3887 };
3888 }
3889
3890 /* */
3891
3892 var activeInstance = null;
3893 var isUpdatingChildComponent = false;
3894
3895 function setActiveInstance(vm) {
3896 var prevActiveInstance = activeInstance;
3897 activeInstance = vm;
3898 return function () {
3899 activeInstance = prevActiveInstance;
3900 }
3901 }
3902
3903 function initLifecycle (vm) {
3904 var options = vm.$options;
3905
3906 // locate first non-abstract parent
3907 var parent = options.parent;
3908 if (parent && !options.abstract) {
3909 while (parent.$options.abstract && parent.$parent) {
3910 parent = parent.$parent;
3911 }
3912 parent.$children.push(vm);
3913 }
3914
3915 vm.$parent = parent;
3916 vm.$root = parent ? parent.$root : vm;
3917
3918 vm.$children = [];
3919 vm.$refs = {};
3920
3921 vm._watcher = null;
3922 vm._inactive = null;
3923 vm._directInactive = false;
3924 vm._isMounted = false;
3925 vm._isDestroyed = false;
3926 vm._isBeingDestroyed = false;
3927 }
3928
3929 function lifecycleMixin (Vue) {
3930 Vue.prototype._update = function (vnode, hydrating) {
3931 var vm = this;
3932 var prevEl = vm.$el;
3933 var prevVnode = vm._vnode;
3934 var restoreActiveInstance = setActiveInstance(vm);
3935 vm._vnode = vnode;
3936 // Vue.prototype.__patch__ is injected in entry points
3937 // based on the rendering backend used.
3938 if (!prevVnode) {
3939 // initial render
3940 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3941 } else {
3942 // updates
3943 vm.$el = vm.__patch__(prevVnode, vnode);
3944 }
3945 restoreActiveInstance();
3946 // update __vue__ reference
3947 if (prevEl) {
3948 prevEl.__vue__ = null;
3949 }
3950 if (vm.$el) {
3951 vm.$el.__vue__ = vm;
3952 }
3953 // if parent is an HOC, update its $el as well
3954 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3955 vm.$parent.$el = vm.$el;
3956 }
3957 // updated hook is called by the scheduler to ensure that children are
3958 // updated in a parent's updated hook.
3959 };
3960
3961 Vue.prototype.$forceUpdate = function () {
3962 var vm = this;
3963 if (vm._watcher) {
3964 vm._watcher.update();
3965 }
3966 };
3967
3968 Vue.prototype.$destroy = function () {
3969 var vm = this;
3970 if (vm._isBeingDestroyed) {
3971 return
3972 }
3973 callHook(vm, 'beforeDestroy');
3974 vm._isBeingDestroyed = true;
3975 // remove self from parent
3976 var parent = vm.$parent;
3977 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3978 remove(parent.$children, vm);
3979 }
3980 // teardown watchers
3981 if (vm._watcher) {
3982 vm._watcher.teardown();
3983 }
3984 var i = vm._watchers.length;
3985 while (i--) {
3986 vm._watchers[i].teardown();
3987 }
3988 // remove reference from data ob
3989 // frozen object may not have observer.
3990 if (vm._data.__ob__) {
3991 vm._data.__ob__.vmCount--;
3992 }
3993 // call the last hook...
3994 vm._isDestroyed = true;
3995 // invoke destroy hooks on current rendered tree
3996 vm.__patch__(vm._vnode, null);
3997 // fire destroyed hook
3998 callHook(vm, 'destroyed');
3999 // turn off all instance listeners.
4000 vm.$off();
4001 // remove __vue__ reference
4002 if (vm.$el) {
4003 vm.$el.__vue__ = null;
4004 }
4005 // release circular reference (#6759)
4006 if (vm.$vnode) {
4007 vm.$vnode.parent = null;
4008 }
4009 };
4010 }
4011
4012 function mountComponent (
4013 vm,
4014 el,
4015 hydrating
4016 ) {
4017 vm.$el = el;
4018 if (!vm.$options.render) {
4019 vm.$options.render = createEmptyVNode;
4020 {
4021 /* istanbul ignore if */
4022 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
4023 vm.$options.el || el) {
4024 warn(
4025 'You are using the runtime-only build of Vue where the template ' +
4026 'compiler is not available. Either pre-compile the templates into ' +
4027 'render functions, or use the compiler-included build.',
4028 vm
4029 );
4030 } else {
4031 warn(
4032 'Failed to mount component: template or render function not defined.',
4033 vm
4034 );
4035 }
4036 }
4037 }
4038 callHook(vm, 'beforeMount');
4039
4040 var updateComponent;
4041 /* istanbul ignore if */
4042 if (config.performance && mark) {
4043 updateComponent = function () {
4044 var name = vm._name;
4045 var id = vm._uid;
4046 var startTag = "vue-perf-start:" + id;
4047 var endTag = "vue-perf-end:" + id;
4048
4049 mark(startTag);
4050 var vnode = vm._render();
4051 mark(endTag);
4052 measure(("vue " + name + " render"), startTag, endTag);
4053
4054 mark(startTag);
4055 vm._update(vnode, hydrating);
4056 mark(endTag);
4057 measure(("vue " + name + " patch"), startTag, endTag);
4058 };
4059 } else {
4060 updateComponent = function () {
4061 vm._update(vm._render(), hydrating);
4062 };
4063 }
4064
4065 // we set this to vm._watcher inside the watcher's constructor
4066 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4067 // component's mounted hook), which relies on vm._watcher being already defined
4068 new Watcher(vm, updateComponent, noop, {
4069 before: function before () {
4070 if (vm._isMounted && !vm._isDestroyed) {
4071 callHook(vm, 'beforeUpdate');
4072 }
4073 }
4074 }, true /* isRenderWatcher */);
4075 hydrating = false;
4076
4077 // manually mounted instance, call mounted on self
4078 // mounted is called for render-created child components in its inserted hook
4079 if (vm.$vnode == null) {
4080 vm._isMounted = true;
4081 callHook(vm, 'mounted');
4082 }
4083 return vm
4084 }
4085
4086 function updateChildComponent (
4087 vm,
4088 propsData,
4089 listeners,
4090 parentVnode,
4091 renderChildren
4092 ) {
4093 {
4094 isUpdatingChildComponent = true;
4095 }
4096
4097 // determine whether component has slot children
4098 // we need to do this before overwriting $options._renderChildren.
4099
4100 // check if there are dynamic scopedSlots (hand-written or compiled but with
4101 // dynamic slot names). Static scoped slots compiled from template has the
4102 // "$stable" marker.
4103 var newScopedSlots = parentVnode.data.scopedSlots;
4104 var oldScopedSlots = vm.$scopedSlots;
4105 var hasDynamicScopedSlot = !!(
4106 (newScopedSlots && !newScopedSlots.$stable) ||
4107 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4108 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4109 );
4110
4111 // Any static slot children from the parent may have changed during parent's
4112 // update. Dynamic scoped slots may also have changed. In such cases, a forced
4113 // update is necessary to ensure correctness.
4114 var needsForceUpdate = !!(
4115 renderChildren || // has new static slots
4116 vm.$options._renderChildren || // has old static slots
4117 hasDynamicScopedSlot
4118 );
4119
4120 vm.$options._parentVnode = parentVnode;
4121 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4122
4123 if (vm._vnode) { // update child tree's parent
4124 vm._vnode.parent = parentVnode;
4125 }
4126 vm.$options._renderChildren = renderChildren;
4127
4128 // update $attrs and $listeners hash
4129 // these are also reactive so they may trigger child update if the child
4130 // used them during render
4131 vm.$attrs = parentVnode.data.attrs || emptyObject;
4132 vm.$listeners = listeners || emptyObject;
4133
4134 // update props
4135 if (propsData && vm.$options.props) {
4136 toggleObserving(false);
4137 var props = vm._props;
4138 var propKeys = vm.$options._propKeys || [];
4139 for (var i = 0; i < propKeys.length; i++) {
4140 var key = propKeys[i];
4141 var propOptions = vm.$options.props; // wtf flow?
4142 props[key] = validateProp(key, propOptions, propsData, vm);
4143 }
4144 toggleObserving(true);
4145 // keep a copy of raw propsData
4146 vm.$options.propsData = propsData;
4147 }
4148
4149 // update listeners
4150 listeners = listeners || emptyObject;
4151 var oldListeners = vm.$options._parentListeners;
4152 vm.$options._parentListeners = listeners;
4153 updateComponentListeners(vm, listeners, oldListeners);
4154
4155 // resolve slots + force update if has children
4156 if (needsForceUpdate) {
4157 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4158 vm.$forceUpdate();
4159 }
4160
4161 {
4162 isUpdatingChildComponent = false;
4163 }
4164 }
4165
4166 function isInInactiveTree (vm) {
4167 while (vm && (vm = vm.$parent)) {
4168 if (vm._inactive) { return true }
4169 }
4170 return false
4171 }
4172
4173 function activateChildComponent (vm, direct) {
4174 if (direct) {
4175 vm._directInactive = false;
4176 if (isInInactiveTree(vm)) {
4177 return
4178 }
4179 } else if (vm._directInactive) {
4180 return
4181 }
4182 if (vm._inactive || vm._inactive === null) {
4183 vm._inactive = false;
4184 for (var i = 0; i < vm.$children.length; i++) {
4185 activateChildComponent(vm.$children[i]);
4186 }
4187 callHook(vm, 'activated');
4188 }
4189 }
4190
4191 function deactivateChildComponent (vm, direct) {
4192 if (direct) {
4193 vm._directInactive = true;
4194 if (isInInactiveTree(vm)) {
4195 return
4196 }
4197 }
4198 if (!vm._inactive) {
4199 vm._inactive = true;
4200 for (var i = 0; i < vm.$children.length; i++) {
4201 deactivateChildComponent(vm.$children[i]);
4202 }
4203 callHook(vm, 'deactivated');
4204 }
4205 }
4206
4207 function callHook (vm, hook) {
4208 // #7573 disable dep collection when invoking lifecycle hooks
4209 pushTarget();
4210 var handlers = vm.$options[hook];
4211 var info = hook + " hook";
4212 if (handlers) {
4213 for (var i = 0, j = handlers.length; i < j; i++) {
4214 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4215 }
4216 }
4217 if (vm._hasHookEvent) {
4218 vm.$emit('hook:' + hook);
4219 }
4220 popTarget();
4221 }
4222
4223 /* */
4224
4225 var MAX_UPDATE_COUNT = 100;
4226
4227 var queue = [];
4228 var activatedChildren = [];
4229 var has = {};
4230 var circular = {};
4231 var waiting = false;
4232 var flushing = false;
4233 var index = 0;
4234
4235 /**
4236 * Reset the scheduler's state.
4237 */
4238 function resetSchedulerState () {
4239 index = queue.length = activatedChildren.length = 0;
4240 has = {};
4241 {
4242 circular = {};
4243 }
4244 waiting = flushing = false;
4245 }
4246
4247 // Async edge case #6566 requires saving the timestamp when event listeners are
4248 // attached. However, calling performance.now() has a perf overhead especially
4249 // if the page has thousands of event listeners. Instead, we take a timestamp
4250 // every time the scheduler flushes and use that for all event listeners
4251 // attached during that flush.
4252 var currentFlushTimestamp = 0;
4253
4254 // Async edge case fix requires storing an event listener's attach timestamp.
4255 var getNow = Date.now;
4256
4257 // Determine what event timestamp the browser is using. Annoyingly, the
4258 // timestamp can either be hi-res (relative to page load) or low-res
4259 // (relative to UNIX epoch), so in order to compare time we have to use the
4260 // same timestamp type when saving the flush timestamp.
4261 // All IE versions use low-res event timestamps, and have problematic clock
4262 // implementations (#9632)
4263 if (inBrowser && !isIE) {
4264 var performance = window.performance;
4265 if (
4266 performance &&
4267 typeof performance.now === 'function' &&
4268 getNow() > document.createEvent('Event').timeStamp
4269 ) {
4270 // if the event timestamp, although evaluated AFTER the Date.now(), is
4271 // smaller than it, it means the event is using a hi-res timestamp,
4272 // and we need to use the hi-res version for event listener timestamps as
4273 // well.
4274 getNow = function () { return performance.now(); };
4275 }
4276 }
4277
4278 /**
4279 * Flush both queues and run the watchers.
4280 */
4281 function flushSchedulerQueue () {
4282 currentFlushTimestamp = getNow();
4283 flushing = true;
4284 var watcher, id;
4285
4286 // Sort queue before flush.
4287 // This ensures that:
4288 // 1. Components are updated from parent to child. (because parent is always
4289 // created before the child)
4290 // 2. A component's user watchers are run before its render watcher (because
4291 // user watchers are created before the render watcher)
4292 // 3. If a component is destroyed during a parent component's watcher run,
4293 // its watchers can be skipped.
4294 queue.sort(function (a, b) { return a.id - b.id; });
4295
4296 // do not cache length because more watchers might be pushed
4297 // as we run existing watchers
4298 for (index = 0; index < queue.length; index++) {
4299 watcher = queue[index];
4300 if (watcher.before) {
4301 watcher.before();
4302 }
4303 id = watcher.id;
4304 has[id] = null;
4305 watcher.run();
4306 // in dev build, check and stop circular updates.
4307 if (has[id] != null) {
4308 circular[id] = (circular[id] || 0) + 1;
4309 if (circular[id] > MAX_UPDATE_COUNT) {
4310 warn(
4311 'You may have an infinite update loop ' + (
4312 watcher.user
4313 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4314 : "in a component render function."
4315 ),
4316 watcher.vm
4317 );
4318 break
4319 }
4320 }
4321 }
4322
4323 // keep copies of post queues before resetting state
4324 var activatedQueue = activatedChildren.slice();
4325 var updatedQueue = queue.slice();
4326
4327 resetSchedulerState();
4328
4329 // call component updated and activated hooks
4330 callActivatedHooks(activatedQueue);
4331 callUpdatedHooks(updatedQueue);
4332
4333 // devtool hook
4334 /* istanbul ignore if */
4335 if (devtools && config.devtools) {
4336 devtools.emit('flush');
4337 }
4338 }
4339
4340 function callUpdatedHooks (queue) {
4341 var i = queue.length;
4342 while (i--) {
4343 var watcher = queue[i];
4344 var vm = watcher.vm;
4345 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4346 callHook(vm, 'updated');
4347 }
4348 }
4349 }
4350
4351 /**
4352 * Queue a kept-alive component that was activated during patch.
4353 * The queue will be processed after the entire tree has been patched.
4354 */
4355 function queueActivatedComponent (vm) {
4356 // setting _inactive to false here so that a render function can
4357 // rely on checking whether it's in an inactive tree (e.g. router-view)
4358 vm._inactive = false;
4359 activatedChildren.push(vm);
4360 }
4361
4362 function callActivatedHooks (queue) {
4363 for (var i = 0; i < queue.length; i++) {
4364 queue[i]._inactive = true;
4365 activateChildComponent(queue[i], true /* true */);
4366 }
4367 }
4368
4369 /**
4370 * Push a watcher into the watcher queue.
4371 * Jobs with duplicate IDs will be skipped unless it's
4372 * pushed when the queue is being flushed.
4373 */
4374 function queueWatcher (watcher) {
4375 var id = watcher.id;
4376 if (has[id] == null) {
4377 has[id] = true;
4378 if (!flushing) {
4379 queue.push(watcher);
4380 } else {
4381 // if already flushing, splice the watcher based on its id
4382 // if already past its id, it will be run next immediately.
4383 var i = queue.length - 1;
4384 while (i > index && queue[i].id > watcher.id) {
4385 i--;
4386 }
4387 queue.splice(i + 1, 0, watcher);
4388 }
4389 // queue the flush
4390 if (!waiting) {
4391 waiting = true;
4392
4393 if (!config.async) {
4394 flushSchedulerQueue();
4395 return
4396 }
4397 nextTick(flushSchedulerQueue);
4398 }
4399 }
4400 }
4401
4402 /* */
4403
4404
4405
4406 var uid$2 = 0;
4407
4408 /**
4409 * A watcher parses an expression, collects dependencies,
4410 * and fires callback when the expression value changes.
4411 * This is used for both the $watch() api and directives.
4412 */
4413 var Watcher = function Watcher (
4414 vm,
4415 expOrFn,
4416 cb,
4417 options,
4418 isRenderWatcher
4419 ) {
4420 this.vm = vm;
4421 if (isRenderWatcher) {
4422 vm._watcher = this;
4423 }
4424 vm._watchers.push(this);
4425 // options
4426 if (options) {
4427 this.deep = !!options.deep;
4428 this.user = !!options.user;
4429 this.lazy = !!options.lazy;
4430 this.sync = !!options.sync;
4431 this.before = options.before;
4432 } else {
4433 this.deep = this.user = this.lazy = this.sync = false;
4434 }
4435 this.cb = cb;
4436 this.id = ++uid$2; // uid for batching
4437 this.active = true;
4438 this.dirty = this.lazy; // for lazy watchers
4439 this.deps = [];
4440 this.newDeps = [];
4441 this.depIds = new _Set();
4442 this.newDepIds = new _Set();
4443 this.expression = expOrFn.toString();
4444 // parse expression for getter
4445 if (typeof expOrFn === 'function') {
4446 this.getter = expOrFn;
4447 } else {
4448 this.getter = parsePath(expOrFn);
4449 if (!this.getter) {
4450 this.getter = noop;
4451 warn(
4452 "Failed watching path: \"" + expOrFn + "\" " +
4453 'Watcher only accepts simple dot-delimited paths. ' +
4454 'For full control, use a function instead.',
4455 vm
4456 );
4457 }
4458 }
4459 this.value = this.lazy
4460 ? undefined
4461 : this.get();
4462 };
4463
4464 /**
4465 * Evaluate the getter, and re-collect dependencies.
4466 */
4467 Watcher.prototype.get = function get () {
4468 pushTarget(this);
4469 var value;
4470 var vm = this.vm;
4471 try {
4472 value = this.getter.call(vm, vm);
4473 } catch (e) {
4474 if (this.user) {
4475 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4476 } else {
4477 throw e
4478 }
4479 } finally {
4480 // "touch" every property so they are all tracked as
4481 // dependencies for deep watching
4482 if (this.deep) {
4483 traverse(value);
4484 }
4485 popTarget();
4486 this.cleanupDeps();
4487 }
4488 return value
4489 };
4490
4491 /**
4492 * Add a dependency to this directive.
4493 */
4494 Watcher.prototype.addDep = function addDep (dep) {
4495 var id = dep.id;
4496 if (!this.newDepIds.has(id)) {
4497 this.newDepIds.add(id);
4498 this.newDeps.push(dep);
4499 if (!this.depIds.has(id)) {
4500 dep.addSub(this);
4501 }
4502 }
4503 };
4504
4505 /**
4506 * Clean up for dependency collection.
4507 */
4508 Watcher.prototype.cleanupDeps = function cleanupDeps () {
4509 var i = this.deps.length;
4510 while (i--) {
4511 var dep = this.deps[i];
4512 if (!this.newDepIds.has(dep.id)) {
4513 dep.removeSub(this);
4514 }
4515 }
4516 var tmp = this.depIds;
4517 this.depIds = this.newDepIds;
4518 this.newDepIds = tmp;
4519 this.newDepIds.clear();
4520 tmp = this.deps;
4521 this.deps = this.newDeps;
4522 this.newDeps = tmp;
4523 this.newDeps.length = 0;
4524 };
4525
4526 /**
4527 * Subscriber interface.
4528 * Will be called when a dependency changes.
4529 */
4530 Watcher.prototype.update = function update () {
4531 /* istanbul ignore else */
4532 if (this.lazy) {
4533 this.dirty = true;
4534 } else if (this.sync) {
4535 this.run();
4536 } else {
4537 queueWatcher(this);
4538 }
4539 };
4540
4541 /**
4542 * Scheduler job interface.
4543 * Will be called by the scheduler.
4544 */
4545 Watcher.prototype.run = function run () {
4546 if (this.active) {
4547 var value = this.get();
4548 if (
4549 value !== this.value ||
4550 // Deep watchers and watchers on Object/Arrays should fire even
4551 // when the value is the same, because the value may
4552 // have mutated.
4553 isObject(value) ||
4554 this.deep
4555 ) {
4556 // set new value
4557 var oldValue = this.value;
4558 this.value = value;
4559 if (this.user) {
4560 try {
4561 this.cb.call(this.vm, value, oldValue);
4562 } catch (e) {
4563 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4564 }
4565 } else {
4566 this.cb.call(this.vm, value, oldValue);
4567 }
4568 }
4569 }
4570 };
4571
4572 /**
4573 * Evaluate the value of the watcher.
4574 * This only gets called for lazy watchers.
4575 */
4576 Watcher.prototype.evaluate = function evaluate () {
4577 this.value = this.get();
4578 this.dirty = false;
4579 };
4580
4581 /**
4582 * Depend on all deps collected by this watcher.
4583 */
4584 Watcher.prototype.depend = function depend () {
4585 var i = this.deps.length;
4586 while (i--) {
4587 this.deps[i].depend();
4588 }
4589 };
4590
4591 /**
4592 * Remove self from all dependencies' subscriber list.
4593 */
4594 Watcher.prototype.teardown = function teardown () {
4595 if (this.active) {
4596 // remove self from vm's watcher list
4597 // this is a somewhat expensive operation so we skip it
4598 // if the vm is being destroyed.
4599 if (!this.vm._isBeingDestroyed) {
4600 remove(this.vm._watchers, this);
4601 }
4602 var i = this.deps.length;
4603 while (i--) {
4604 this.deps[i].removeSub(this);
4605 }
4606 this.active = false;
4607 }
4608 };
4609
4610 /* */
4611
4612 var sharedPropertyDefinition = {
4613 enumerable: true,
4614 configurable: true,
4615 get: noop,
4616 set: noop
4617 };
4618
4619 function proxy (target, sourceKey, key) {
4620 sharedPropertyDefinition.get = function proxyGetter () {
4621 return this[sourceKey][key]
4622 };
4623 sharedPropertyDefinition.set = function proxySetter (val) {
4624 this[sourceKey][key] = val;
4625 };
4626 Object.defineProperty(target, key, sharedPropertyDefinition);
4627 }
4628
4629 function initState (vm) {
4630 vm._watchers = [];
4631 var opts = vm.$options;
4632 if (opts.props) { initProps(vm, opts.props); }
4633 if (opts.methods) { initMethods(vm, opts.methods); }
4634 if (opts.data) {
4635 initData(vm);
4636 } else {
4637 observe(vm._data = {}, true /* asRootData */);
4638 }
4639 if (opts.computed) { initComputed(vm, opts.computed); }
4640 if (opts.watch && opts.watch !== nativeWatch) {
4641 initWatch(vm, opts.watch);
4642 }
4643 }
4644
4645 function initProps (vm, propsOptions) {
4646 var propsData = vm.$options.propsData || {};
4647 var props = vm._props = {};
4648 // cache prop keys so that future props updates can iterate using Array
4649 // instead of dynamic object key enumeration.
4650 var keys = vm.$options._propKeys = [];
4651 var isRoot = !vm.$parent;
4652 // root instance props should be converted
4653 if (!isRoot) {
4654 toggleObserving(false);
4655 }
4656 var loop = function ( key ) {
4657 keys.push(key);
4658 var value = validateProp(key, propsOptions, propsData, vm);
4659 /* istanbul ignore else */
4660 {
4661 var hyphenatedKey = hyphenate(key);
4662 if (isReservedAttribute(hyphenatedKey) ||
4663 config.isReservedAttr(hyphenatedKey)) {
4664 warn(
4665 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4666 vm
4667 );
4668 }
4669 defineReactive$$1(props, key, value, function () {
4670 if (!isRoot && !isUpdatingChildComponent) {
4671 warn(
4672 "Avoid mutating a prop directly since the value will be " +
4673 "overwritten whenever the parent component re-renders. " +
4674 "Instead, use a data or computed property based on the prop's " +
4675 "value. Prop being mutated: \"" + key + "\"",
4676 vm
4677 );
4678 }
4679 });
4680 }
4681 // static props are already proxied on the component's prototype
4682 // during Vue.extend(). We only need to proxy props defined at
4683 // instantiation here.
4684 if (!(key in vm)) {
4685 proxy(vm, "_props", key);
4686 }
4687 };
4688
4689 for (var key in propsOptions) loop( key );
4690 toggleObserving(true);
4691 }
4692
4693 function initData (vm) {
4694 var data = vm.$options.data;
4695 data = vm._data = typeof data === 'function'
4696 ? getData(data, vm)
4697 : data || {};
4698 if (!isPlainObject(data)) {
4699 data = {};
4700 warn(
4701 'data functions should return an object:\n' +
4702 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4703 vm
4704 );
4705 }
4706 // proxy data on instance
4707 var keys = Object.keys(data);
4708 var props = vm.$options.props;
4709 var methods = vm.$options.methods;
4710 var i = keys.length;
4711 while (i--) {
4712 var key = keys[i];
4713 {
4714 if (methods && hasOwn(methods, key)) {
4715 warn(
4716 ("Method \"" + key + "\" has already been defined as a data property."),
4717 vm
4718 );
4719 }
4720 }
4721 if (props && hasOwn(props, key)) {
4722 warn(
4723 "The data property \"" + key + "\" is already declared as a prop. " +
4724 "Use prop default value instead.",
4725 vm
4726 );
4727 } else if (!isReserved(key)) {
4728 proxy(vm, "_data", key);
4729 }
4730 }
4731 // observe data
4732 observe(data, true /* asRootData */);
4733 }
4734
4735 function getData (data, vm) {
4736 // #7573 disable dep collection when invoking data getters
4737 pushTarget();
4738 try {
4739 return data.call(vm, vm)
4740 } catch (e) {
4741 handleError(e, vm, "data()");
4742 return {}
4743 } finally {
4744 popTarget();
4745 }
4746 }
4747
4748 var computedWatcherOptions = { lazy: true };
4749
4750 function initComputed (vm, computed) {
4751 // $flow-disable-line
4752 var watchers = vm._computedWatchers = Object.create(null);
4753 // computed properties are just getters during SSR
4754 var isSSR = isServerRendering();
4755
4756 for (var key in computed) {
4757 var userDef = computed[key];
4758 var getter = typeof userDef === 'function' ? userDef : userDef.get;
4759 if (getter == null) {
4760 warn(
4761 ("Getter is missing for computed property \"" + key + "\"."),
4762 vm
4763 );
4764 }
4765
4766 if (!isSSR) {
4767 // create internal watcher for the computed property.
4768 watchers[key] = new Watcher(
4769 vm,
4770 getter || noop,
4771 noop,
4772 computedWatcherOptions
4773 );
4774 }
4775
4776 // component-defined computed properties are already defined on the
4777 // component prototype. We only need to define computed properties defined
4778 // at instantiation here.
4779 if (!(key in vm)) {
4780 defineComputed(vm, key, userDef);
4781 } else {
4782 if (key in vm.$data) {
4783 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4784 } else if (vm.$options.props && key in vm.$options.props) {
4785 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4786 }
4787 }
4788 }
4789 }
4790
4791 function defineComputed (
4792 target,
4793 key,
4794 userDef
4795 ) {
4796 var shouldCache = !isServerRendering();
4797 if (typeof userDef === 'function') {
4798 sharedPropertyDefinition.get = shouldCache
4799 ? createComputedGetter(key)
4800 : createGetterInvoker(userDef);
4801 sharedPropertyDefinition.set = noop;
4802 } else {
4803 sharedPropertyDefinition.get = userDef.get
4804 ? shouldCache && userDef.cache !== false
4805 ? createComputedGetter(key)
4806 : createGetterInvoker(userDef.get)
4807 : noop;
4808 sharedPropertyDefinition.set = userDef.set || noop;
4809 }
4810 if (sharedPropertyDefinition.set === noop) {
4811 sharedPropertyDefinition.set = function () {
4812 warn(
4813 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4814 this
4815 );
4816 };
4817 }
4818 Object.defineProperty(target, key, sharedPropertyDefinition);
4819 }
4820
4821 function createComputedGetter (key) {
4822 return function computedGetter () {
4823 var watcher = this._computedWatchers && this._computedWatchers[key];
4824 if (watcher) {
4825 if (watcher.dirty) {
4826 watcher.evaluate();
4827 }
4828 if (Dep.target) {
4829 watcher.depend();
4830 }
4831 return watcher.value
4832 }
4833 }
4834 }
4835
4836 function createGetterInvoker(fn) {
4837 return function computedGetter () {
4838 return fn.call(this, this)
4839 }
4840 }
4841
4842 function initMethods (vm, methods) {
4843 var props = vm.$options.props;
4844 for (var key in methods) {
4845 {
4846 if (typeof methods[key] !== 'function') {
4847 warn(
4848 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4849 "Did you reference the function correctly?",
4850 vm
4851 );
4852 }
4853 if (props && hasOwn(props, key)) {
4854 warn(
4855 ("Method \"" + key + "\" has already been defined as a prop."),
4856 vm
4857 );
4858 }
4859 if ((key in vm) && isReserved(key)) {
4860 warn(
4861 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4862 "Avoid defining component methods that start with _ or $."
4863 );
4864 }
4865 }
4866 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4867 }
4868 }
4869
4870 function initWatch (vm, watch) {
4871 for (var key in watch) {
4872 var handler = watch[key];
4873 if (Array.isArray(handler)) {
4874 for (var i = 0; i < handler.length; i++) {
4875 createWatcher(vm, key, handler[i]);
4876 }
4877 } else {
4878 createWatcher(vm, key, handler);
4879 }
4880 }
4881 }
4882
4883 function createWatcher (
4884 vm,
4885 expOrFn,
4886 handler,
4887 options
4888 ) {
4889 if (isPlainObject(handler)) {
4890 options = handler;
4891 handler = handler.handler;
4892 }
4893 if (typeof handler === 'string') {
4894 handler = vm[handler];
4895 }
4896 return vm.$watch(expOrFn, handler, options)
4897 }
4898
4899 function stateMixin (Vue) {
4900 // flow somehow has problems with directly declared definition object
4901 // when using Object.defineProperty, so we have to procedurally build up
4902 // the object here.
4903 var dataDef = {};
4904 dataDef.get = function () { return this._data };
4905 var propsDef = {};
4906 propsDef.get = function () { return this._props };
4907 {
4908 dataDef.set = function () {
4909 warn(
4910 'Avoid replacing instance root $data. ' +
4911 'Use nested data properties instead.',
4912 this
4913 );
4914 };
4915 propsDef.set = function () {
4916 warn("$props is readonly.", this);
4917 };
4918 }
4919 Object.defineProperty(Vue.prototype, '$data', dataDef);
4920 Object.defineProperty(Vue.prototype, '$props', propsDef);
4921
4922 Vue.prototype.$set = set;
4923 Vue.prototype.$delete = del;
4924
4925 Vue.prototype.$watch = function (
4926 expOrFn,
4927 cb,
4928 options
4929 ) {
4930 var vm = this;
4931 if (isPlainObject(cb)) {
4932 return createWatcher(vm, expOrFn, cb, options)
4933 }
4934 options = options || {};
4935 options.user = true;
4936 var watcher = new Watcher(vm, expOrFn, cb, options);
4937 if (options.immediate) {
4938 try {
4939 cb.call(vm, watcher.value);
4940 } catch (error) {
4941 handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4942 }
4943 }
4944 return function unwatchFn () {
4945 watcher.teardown();
4946 }
4947 };
4948 }
4949
4950 /* */
4951
4952 var uid$3 = 0;
4953
4954 function initMixin (Vue) {
4955 Vue.prototype._init = function (options) {
4956 var vm = this;
4957 // a uid
4958 vm._uid = uid$3++;
4959
4960 var startTag, endTag;
4961 /* istanbul ignore if */
4962 if (config.performance && mark) {
4963 startTag = "vue-perf-start:" + (vm._uid);
4964 endTag = "vue-perf-end:" + (vm._uid);
4965 mark(startTag);
4966 }
4967
4968 // a flag to avoid this being observed
4969 vm._isVue = true;
4970 // merge options
4971 if (options && options._isComponent) {
4972 // optimize internal component instantiation
4973 // since dynamic options merging is pretty slow, and none of the
4974 // internal component options needs special treatment.
4975 initInternalComponent(vm, options);
4976 } else {
4977 vm.$options = mergeOptions(
4978 resolveConstructorOptions(vm.constructor),
4979 options || {},
4980 vm
4981 );
4982 }
4983 /* istanbul ignore else */
4984 {
4985 initProxy(vm);
4986 }
4987 // expose real self
4988 vm._self = vm;
4989 initLifecycle(vm);
4990 initEvents(vm);
4991 initRender(vm);
4992 callHook(vm, 'beforeCreate');
4993 initInjections(vm); // resolve injections before data/props
4994 initState(vm);
4995 initProvide(vm); // resolve provide after data/props
4996 callHook(vm, 'created');
4997
4998 /* istanbul ignore if */
4999 if (config.performance && mark) {
5000 vm._name = formatComponentName(vm, false);
5001 mark(endTag);
5002 measure(("vue " + (vm._name) + " init"), startTag, endTag);
5003 }
5004
5005 if (vm.$options.el) {
5006 vm.$mount(vm.$options.el);
5007 }
5008 };
5009 }
5010
5011 function initInternalComponent (vm, options) {
5012 var opts = vm.$options = Object.create(vm.constructor.options);
5013 // doing this because it's faster than dynamic enumeration.
5014 var parentVnode = options._parentVnode;
5015 opts.parent = options.parent;
5016 opts._parentVnode = parentVnode;
5017
5018 var vnodeComponentOptions = parentVnode.componentOptions;
5019 opts.propsData = vnodeComponentOptions.propsData;
5020 opts._parentListeners = vnodeComponentOptions.listeners;
5021 opts._renderChildren = vnodeComponentOptions.children;
5022 opts._componentTag = vnodeComponentOptions.tag;
5023
5024 if (options.render) {
5025 opts.render = options.render;
5026 opts.staticRenderFns = options.staticRenderFns;
5027 }
5028 }
5029
5030 function resolveConstructorOptions (Ctor) {
5031 var options = Ctor.options;
5032 if (Ctor.super) {
5033 var superOptions = resolveConstructorOptions(Ctor.super);
5034 var cachedSuperOptions = Ctor.superOptions;
5035 if (superOptions !== cachedSuperOptions) {
5036 // super option changed,
5037 // need to resolve new options.
5038 Ctor.superOptions = superOptions;
5039 // check if there are any late-modified/attached options (#4976)
5040 var modifiedOptions = resolveModifiedOptions(Ctor);
5041 // update base extend options
5042 if (modifiedOptions) {
5043 extend(Ctor.extendOptions, modifiedOptions);
5044 }
5045 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5046 if (options.name) {
5047 options.components[options.name] = Ctor;
5048 }
5049 }
5050 }
5051 return options
5052 }
5053
5054 function resolveModifiedOptions (Ctor) {
5055 var modified;
5056 var latest = Ctor.options;
5057 var sealed = Ctor.sealedOptions;
5058 for (var key in latest) {
5059 if (latest[key] !== sealed[key]) {
5060 if (!modified) { modified = {}; }
5061 modified[key] = latest[key];
5062 }
5063 }
5064 return modified
5065 }
5066
5067 function Vue (options) {
5068 if (!(this instanceof Vue)
5069 ) {
5070 warn('Vue is a constructor and should be called with the `new` keyword');
5071 }
5072 this._init(options);
5073 }
5074
5075 initMixin(Vue);
5076 stateMixin(Vue);
5077 eventsMixin(Vue);
5078 lifecycleMixin(Vue);
5079 renderMixin(Vue);
5080
5081 /* */
5082
5083 function initUse (Vue) {
5084 Vue.use = function (plugin) {
5085 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5086 if (installedPlugins.indexOf(plugin) > -1) {
5087 return this
5088 }
5089
5090 // additional parameters
5091 var args = toArray(arguments, 1);
5092 args.unshift(this);
5093 if (typeof plugin.install === 'function') {
5094 plugin.install.apply(plugin, args);
5095 } else if (typeof plugin === 'function') {
5096 plugin.apply(null, args);
5097 }
5098 installedPlugins.push(plugin);
5099 return this
5100 };
5101 }
5102
5103 /* */
5104
5105 function initMixin$1 (Vue) {
5106 Vue.mixin = function (mixin) {
5107 this.options = mergeOptions(this.options, mixin);
5108 return this
5109 };
5110 }
5111
5112 /* */
5113
5114 function initExtend (Vue) {
5115 /**
5116 * Each instance constructor, including Vue, has a unique
5117 * cid. This enables us to create wrapped "child
5118 * constructors" for prototypal inheritance and cache them.
5119 */
5120 Vue.cid = 0;
5121 var cid = 1;
5122
5123 /**
5124 * Class inheritance
5125 */
5126 Vue.extend = function (extendOptions) {
5127 extendOptions = extendOptions || {};
5128 var Super = this;
5129 var SuperId = Super.cid;
5130 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5131 if (cachedCtors[SuperId]) {
5132 return cachedCtors[SuperId]
5133 }
5134
5135 var name = extendOptions.name || Super.options.name;
5136 if (name) {
5137 validateComponentName(name);
5138 }
5139
5140 var Sub = function VueComponent (options) {
5141 this._init(options);
5142 };
5143 Sub.prototype = Object.create(Super.prototype);
5144 Sub.prototype.constructor = Sub;
5145 Sub.cid = cid++;
5146 Sub.options = mergeOptions(
5147 Super.options,
5148 extendOptions
5149 );
5150 Sub['super'] = Super;
5151
5152 // For props and computed properties, we define the proxy getters on
5153 // the Vue instances at extension time, on the extended prototype. This
5154 // avoids Object.defineProperty calls for each instance created.
5155 if (Sub.options.props) {
5156 initProps$1(Sub);
5157 }
5158 if (Sub.options.computed) {
5159 initComputed$1(Sub);
5160 }
5161
5162 // allow further extension/mixin/plugin usage
5163 Sub.extend = Super.extend;
5164 Sub.mixin = Super.mixin;
5165 Sub.use = Super.use;
5166
5167 // create asset registers, so extended classes
5168 // can have their private assets too.
5169 ASSET_TYPES.forEach(function (type) {
5170 Sub[type] = Super[type];
5171 });
5172 // enable recursive self-lookup
5173 if (name) {
5174 Sub.options.components[name] = Sub;
5175 }
5176
5177 // keep a reference to the super options at extension time.
5178 // later at instantiation we can check if Super's options have
5179 // been updated.
5180 Sub.superOptions = Super.options;
5181 Sub.extendOptions = extendOptions;
5182 Sub.sealedOptions = extend({}, Sub.options);
5183
5184 // cache constructor
5185 cachedCtors[SuperId] = Sub;
5186 return Sub
5187 };
5188 }
5189
5190 function initProps$1 (Comp) {
5191 var props = Comp.options.props;
5192 for (var key in props) {
5193 proxy(Comp.prototype, "_props", key);
5194 }
5195 }
5196
5197 function initComputed$1 (Comp) {
5198 var computed = Comp.options.computed;
5199 for (var key in computed) {
5200 defineComputed(Comp.prototype, key, computed[key]);
5201 }
5202 }
5203
5204 /* */
5205
5206 function initAssetRegisters (Vue) {
5207 /**
5208 * Create asset registration methods.
5209 */
5210 ASSET_TYPES.forEach(function (type) {
5211 Vue[type] = function (
5212 id,
5213 definition
5214 ) {
5215 if (!definition) {
5216 return this.options[type + 's'][id]
5217 } else {
5218 /* istanbul ignore if */
5219 if (type === 'component') {
5220 validateComponentName(id);
5221 }
5222 if (type === 'component' && isPlainObject(definition)) {
5223 definition.name = definition.name || id;
5224 definition = this.options._base.extend(definition);
5225 }
5226 if (type === 'directive' && typeof definition === 'function') {
5227 definition = { bind: definition, update: definition };
5228 }
5229 this.options[type + 's'][id] = definition;
5230 return definition
5231 }
5232 };
5233 });
5234 }
5235
5236 /* */
5237
5238
5239
5240 function getComponentName (opts) {
5241 return opts && (opts.Ctor.options.name || opts.tag)
5242 }
5243
5244 function matches (pattern, name) {
5245 if (Array.isArray(pattern)) {
5246 return pattern.indexOf(name) > -1
5247 } else if (typeof pattern === 'string') {
5248 return pattern.split(',').indexOf(name) > -1
5249 } else if (isRegExp(pattern)) {
5250 return pattern.test(name)
5251 }
5252 /* istanbul ignore next */
5253 return false
5254 }
5255
5256 function pruneCache (keepAliveInstance, filter) {
5257 var cache = keepAliveInstance.cache;
5258 var keys = keepAliveInstance.keys;
5259 var _vnode = keepAliveInstance._vnode;
5260 for (var key in cache) {
5261 var cachedNode = cache[key];
5262 if (cachedNode) {
5263 var name = getComponentName(cachedNode.componentOptions);
5264 if (name && !filter(name)) {
5265 pruneCacheEntry(cache, key, keys, _vnode);
5266 }
5267 }
5268 }
5269 }
5270
5271 function pruneCacheEntry (
5272 cache,
5273 key,
5274 keys,
5275 current
5276 ) {
5277 var cached$$1 = cache[key];
5278 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5279 cached$$1.componentInstance.$destroy();
5280 }
5281 cache[key] = null;
5282 remove(keys, key);
5283 }
5284
5285 var patternTypes = [String, RegExp, Array];
5286
5287 var KeepAlive = {
5288 name: 'keep-alive',
5289 abstract: true,
5290
5291 props: {
5292 include: patternTypes,
5293 exclude: patternTypes,
5294 max: [String, Number]
5295 },
5296
5297 created: function created () {
5298 this.cache = Object.create(null);
5299 this.keys = [];
5300 },
5301
5302 destroyed: function destroyed () {
5303 for (var key in this.cache) {
5304 pruneCacheEntry(this.cache, key, this.keys);
5305 }
5306 },
5307
5308 mounted: function mounted () {
5309 var this$1 = this;
5310
5311 this.$watch('include', function (val) {
5312 pruneCache(this$1, function (name) { return matches(val, name); });
5313 });
5314 this.$watch('exclude', function (val) {
5315 pruneCache(this$1, function (name) { return !matches(val, name); });
5316 });
5317 },
5318
5319 render: function render () {
5320 var slot = this.$slots.default;
5321 var vnode = getFirstComponentChild(slot);
5322 var componentOptions = vnode && vnode.componentOptions;
5323 if (componentOptions) {
5324 // check pattern
5325 var name = getComponentName(componentOptions);
5326 var ref = this;
5327 var include = ref.include;
5328 var exclude = ref.exclude;
5329 if (
5330 // not included
5331 (include && (!name || !matches(include, name))) ||
5332 // excluded
5333 (exclude && name && matches(exclude, name))
5334 ) {
5335 return vnode
5336 }
5337
5338 var ref$1 = this;
5339 var cache = ref$1.cache;
5340 var keys = ref$1.keys;
5341 var key = vnode.key == null
5342 // same constructor may get registered as different local components
5343 // so cid alone is not enough (#3269)
5344 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5345 : vnode.key;
5346 if (cache[key]) {
5347 vnode.componentInstance = cache[key].componentInstance;
5348 // make current key freshest
5349 remove(keys, key);
5350 keys.push(key);
5351 } else {
5352 cache[key] = vnode;
5353 keys.push(key);
5354 // prune oldest entry
5355 if (this.max && keys.length > parseInt(this.max)) {
5356 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5357 }
5358 }
5359
5360 vnode.data.keepAlive = true;
5361 }
5362 return vnode || (slot && slot[0])
5363 }
5364 };
5365
5366 var builtInComponents = {
5367 KeepAlive: KeepAlive
5368 };
5369
5370 /* */
5371
5372 function initGlobalAPI (Vue) {
5373 // config
5374 var configDef = {};
5375 configDef.get = function () { return config; };
5376 {
5377 configDef.set = function () {
5378 warn(
5379 'Do not replace the Vue.config object, set individual fields instead.'
5380 );
5381 };
5382 }
5383 Object.defineProperty(Vue, 'config', configDef);
5384
5385 // exposed util methods.
5386 // NOTE: these are not considered part of the public API - avoid relying on
5387 // them unless you are aware of the risk.
5388 Vue.util = {
5389 warn: warn,
5390 extend: extend,
5391 mergeOptions: mergeOptions,
5392 defineReactive: defineReactive$$1
5393 };
5394
5395 Vue.set = set;
5396 Vue.delete = del;
5397 Vue.nextTick = nextTick;
5398
5399 // 2.6 explicit observable API
5400 Vue.observable = function (obj) {
5401 observe(obj);
5402 return obj
5403 };
5404
5405 Vue.options = Object.create(null);
5406 ASSET_TYPES.forEach(function (type) {
5407 Vue.options[type + 's'] = Object.create(null);
5408 });
5409
5410 // this is used to identify the "base" constructor to extend all plain-object
5411 // components with in Weex's multi-instance scenarios.
5412 Vue.options._base = Vue;
5413
5414 extend(Vue.options.components, builtInComponents);
5415
5416 initUse(Vue);
5417 initMixin$1(Vue);
5418 initExtend(Vue);
5419 initAssetRegisters(Vue);
5420 }
5421
5422 initGlobalAPI(Vue);
5423
5424 Object.defineProperty(Vue.prototype, '$isServer', {
5425 get: isServerRendering
5426 });
5427
5428 Object.defineProperty(Vue.prototype, '$ssrContext', {
5429 get: function get () {
5430 /* istanbul ignore next */
5431 return this.$vnode && this.$vnode.ssrContext
5432 }
5433 });
5434
5435 // expose FunctionalRenderContext for ssr runtime helper installation
5436 Object.defineProperty(Vue, 'FunctionalRenderContext', {
5437 value: FunctionalRenderContext
5438 });
5439
5440 Vue.version = '2.6.10';
5441
5442 /* */
5443
5444 // these are reserved for web because they are directly compiled away
5445 // during template compilation
5446 var isReservedAttr = makeMap('style,class');
5447
5448 // attributes that should be using props for binding
5449 var acceptValue = makeMap('input,textarea,option,select,progress');
5450 var mustUseProp = function (tag, type, attr) {
5451 return (
5452 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5453 (attr === 'selected' && tag === 'option') ||
5454 (attr === 'checked' && tag === 'input') ||
5455 (attr === 'muted' && tag === 'video')
5456 )
5457 };
5458
5459 var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5460
5461 var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5462
5463 var convertEnumeratedValue = function (key, value) {
5464 return isFalsyAttrValue(value) || value === 'false'
5465 ? 'false'
5466 // allow arbitrary string value for contenteditable
5467 : key === 'contenteditable' && isValidContentEditableValue(value)
5468 ? value
5469 : 'true'
5470 };
5471
5472 var isBooleanAttr = makeMap(
5473 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5474 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5475 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5476 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5477 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5478 'truespeed,typemustmatch,visible'
5479 );
5480
5481 var xlinkNS = 'http://www.w3.org/1999/xlink';
5482
5483 var isXlink = function (name) {
5484 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5485 };
5486
5487 var getXlinkProp = function (name) {
5488 return isXlink(name) ? name.slice(6, name.length) : ''
5489 };
5490
5491 var isFalsyAttrValue = function (val) {
5492 return val == null || val === false
5493 };
5494
5495 /* */
5496
5497 function genClassForVnode (vnode) {
5498 var data = vnode.data;
5499 var parentNode = vnode;
5500 var childNode = vnode;
5501 while (isDef(childNode.componentInstance)) {
5502 childNode = childNode.componentInstance._vnode;
5503 if (childNode && childNode.data) {
5504 data = mergeClassData(childNode.data, data);
5505 }
5506 }
5507 while (isDef(parentNode = parentNode.parent)) {
5508 if (parentNode && parentNode.data) {
5509 data = mergeClassData(data, parentNode.data);
5510 }
5511 }
5512 return renderClass(data.staticClass, data.class)
5513 }
5514
5515 function mergeClassData (child, parent) {
5516 return {
5517 staticClass: concat(child.staticClass, parent.staticClass),
5518 class: isDef(child.class)
5519 ? [child.class, parent.class]
5520 : parent.class
5521 }
5522 }
5523
5524 function renderClass (
5525 staticClass,
5526 dynamicClass
5527 ) {
5528 if (isDef(staticClass) || isDef(dynamicClass)) {
5529 return concat(staticClass, stringifyClass(dynamicClass))
5530 }
5531 /* istanbul ignore next */
5532 return ''
5533 }
5534
5535 function concat (a, b) {
5536 return a ? b ? (a + ' ' + b) : a : (b || '')
5537 }
5538
5539 function stringifyClass (value) {
5540 if (Array.isArray(value)) {
5541 return stringifyArray(value)
5542 }
5543 if (isObject(value)) {
5544 return stringifyObject(value)
5545 }
5546 if (typeof value === 'string') {
5547 return value
5548 }
5549 /* istanbul ignore next */
5550 return ''
5551 }
5552
5553 function stringifyArray (value) {
5554 var res = '';
5555 var stringified;
5556 for (var i = 0, l = value.length; i < l; i++) {
5557 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5558 if (res) { res += ' '; }
5559 res += stringified;
5560 }
5561 }
5562 return res
5563 }
5564
5565 function stringifyObject (value) {
5566 var res = '';
5567 for (var key in value) {
5568 if (value[key]) {
5569 if (res) { res += ' '; }
5570 res += key;
5571 }
5572 }
5573 return res
5574 }
5575
5576 /* */
5577
5578 var namespaceMap = {
5579 svg: 'http://www.w3.org/2000/svg',
5580 math: 'http://www.w3.org/1998/Math/MathML'
5581 };
5582
5583 var isHTMLTag = makeMap(
5584 'html,body,base,head,link,meta,style,title,' +
5585 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5586 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5587 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5588 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5589 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5590 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5591 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5592 'output,progress,select,textarea,' +
5593 'details,dialog,menu,menuitem,summary,' +
5594 'content,element,shadow,template,blockquote,iframe,tfoot'
5595 );
5596
5597 // this map is intentionally selective, only covering SVG elements that may
5598 // contain child elements.
5599 var isSVG = makeMap(
5600 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5601 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5602 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5603 true
5604 );
5605
5606 var isPreTag = function (tag) { return tag === 'pre'; };
5607
5608 var isReservedTag = function (tag) {
5609 return isHTMLTag(tag) || isSVG(tag)
5610 };
5611
5612 function getTagNamespace (tag) {
5613 if (isSVG(tag)) {
5614 return 'svg'
5615 }
5616 // basic support for MathML
5617 // note it doesn't support other MathML elements being component roots
5618 if (tag === 'math') {
5619 return 'math'
5620 }
5621 }
5622
5623 var unknownElementCache = Object.create(null);
5624 function isUnknownElement (tag) {
5625 /* istanbul ignore if */
5626 if (!inBrowser) {
5627 return true
5628 }
5629 if (isReservedTag(tag)) {
5630 return false
5631 }
5632 tag = tag.toLowerCase();
5633 /* istanbul ignore if */
5634 if (unknownElementCache[tag] != null) {
5635 return unknownElementCache[tag]
5636 }
5637 var el = document.createElement(tag);
5638 if (tag.indexOf('-') > -1) {
5639 // http://stackoverflow.com/a/28210364/1070244
5640 return (unknownElementCache[tag] = (
5641 el.constructor === window.HTMLUnknownElement ||
5642 el.constructor === window.HTMLElement
5643 ))
5644 } else {
5645 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5646 }
5647 }
5648
5649 var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5650
5651 /* */
5652
5653 /**
5654 * Query an element selector if it's not an element already.
5655 */
5656 function query (el) {
5657 if (typeof el === 'string') {
5658 var selected = document.querySelector(el);
5659 if (!selected) {
5660 warn(
5661 'Cannot find element: ' + el
5662 );
5663 return document.createElement('div')
5664 }
5665 return selected
5666 } else {
5667 return el
5668 }
5669 }
5670
5671 /* */
5672
5673 function createElement$1 (tagName, vnode) {
5674 var elm = document.createElement(tagName);
5675 if (tagName !== 'select') {
5676 return elm
5677 }
5678 // false or null will remove the attribute but undefined will not
5679 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5680 elm.setAttribute('multiple', 'multiple');
5681 }
5682 return elm
5683 }
5684
5685 function createElementNS (namespace, tagName) {
5686 return document.createElementNS(namespaceMap[namespace], tagName)
5687 }
5688
5689 function createTextNode (text) {
5690 return document.createTextNode(text)
5691 }
5692
5693 function createComment (text) {
5694 return document.createComment(text)
5695 }
5696
5697 function insertBefore (parentNode, newNode, referenceNode) {
5698 parentNode.insertBefore(newNode, referenceNode);
5699 }
5700
5701 function removeChild (node, child) {
5702 node.removeChild(child);
5703 }
5704
5705 function appendChild (node, child) {
5706 node.appendChild(child);
5707 }
5708
5709 function parentNode (node) {
5710 return node.parentNode
5711 }
5712
5713 function nextSibling (node) {
5714 return node.nextSibling
5715 }
5716
5717 function tagName (node) {
5718 return node.tagName
5719 }
5720
5721 function setTextContent (node, text) {
5722 node.textContent = text;
5723 }
5724
5725 function setStyleScope (node, scopeId) {
5726 node.setAttribute(scopeId, '');
5727 }
5728
5729 var nodeOps = /*#__PURE__*/Object.freeze({
5730 createElement: createElement$1,
5731 createElementNS: createElementNS,
5732 createTextNode: createTextNode,
5733 createComment: createComment,
5734 insertBefore: insertBefore,
5735 removeChild: removeChild,
5736 appendChild: appendChild,
5737 parentNode: parentNode,
5738 nextSibling: nextSibling,
5739 tagName: tagName,
5740 setTextContent: setTextContent,
5741 setStyleScope: setStyleScope
5742 });
5743
5744 /* */
5745
5746 var ref = {
5747 create: function create (_, vnode) {
5748 registerRef(vnode);
5749 },
5750 update: function update (oldVnode, vnode) {
5751 if (oldVnode.data.ref !== vnode.data.ref) {
5752 registerRef(oldVnode, true);
5753 registerRef(vnode);
5754 }
5755 },
5756 destroy: function destroy (vnode) {
5757 registerRef(vnode, true);
5758 }
5759 };
5760
5761 function registerRef (vnode, isRemoval) {
5762 var key = vnode.data.ref;
5763 if (!isDef(key)) { return }
5764
5765 var vm = vnode.context;
5766 var ref = vnode.componentInstance || vnode.elm;
5767 var refs = vm.$refs;
5768 if (isRemoval) {
5769 if (Array.isArray(refs[key])) {
5770 remove(refs[key], ref);
5771 } else if (refs[key] === ref) {
5772 refs[key] = undefined;
5773 }
5774 } else {
5775 if (vnode.data.refInFor) {
5776 if (!Array.isArray(refs[key])) {
5777 refs[key] = [ref];
5778 } else if (refs[key].indexOf(ref) < 0) {
5779 // $flow-disable-line
5780 refs[key].push(ref);
5781 }
5782 } else {
5783 refs[key] = ref;
5784 }
5785 }
5786 }
5787
5788 /**
5789 * Virtual DOM patching algorithm based on Snabbdom by
5790 * Simon Friis Vindum (@paldepind)
5791 * Licensed under the MIT License
5792 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5793 *
5794 * modified by Evan You (@yyx990803)
5795 *
5796 * Not type-checking this because this file is perf-critical and the cost
5797 * of making flow understand it is not worth it.
5798 */
5799
5800 var emptyNode = new VNode('', {}, []);
5801
5802 var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5803
5804 function sameVnode (a, b) {
5805 return (
5806 a.key === b.key && (
5807 (
5808 a.tag === b.tag &&
5809 a.isComment === b.isComment &&
5810 isDef(a.data) === isDef(b.data) &&
5811 sameInputType(a, b)
5812 ) || (
5813 isTrue(a.isAsyncPlaceholder) &&
5814 a.asyncFactory === b.asyncFactory &&
5815 isUndef(b.asyncFactory.error)
5816 )
5817 )
5818 )
5819 }
5820
5821 function sameInputType (a, b) {
5822 if (a.tag !== 'input') { return true }
5823 var i;
5824 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5825 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5826 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5827 }
5828
5829 function createKeyToOldIdx (children, beginIdx, endIdx) {
5830 var i, key;
5831 var map = {};
5832 for (i = beginIdx; i <= endIdx; ++i) {
5833 key = children[i].key;
5834 if (isDef(key)) { map[key] = i; }
5835 }
5836 return map
5837 }
5838
5839 function createPatchFunction (backend) {
5840 var i, j;
5841 var cbs = {};
5842
5843 var modules = backend.modules;
5844 var nodeOps = backend.nodeOps;
5845
5846 for (i = 0; i < hooks.length; ++i) {
5847 cbs[hooks[i]] = [];
5848 for (j = 0; j < modules.length; ++j) {
5849 if (isDef(modules[j][hooks[i]])) {
5850 cbs[hooks[i]].push(modules[j][hooks[i]]);
5851 }
5852 }
5853 }
5854
5855 function emptyNodeAt (elm) {
5856 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5857 }
5858
5859 function createRmCb (childElm, listeners) {
5860 function remove$$1 () {
5861 if (--remove$$1.listeners === 0) {
5862 removeNode(childElm);
5863 }
5864 }
5865 remove$$1.listeners = listeners;
5866 return remove$$1
5867 }
5868
5869 function removeNode (el) {
5870 var parent = nodeOps.parentNode(el);
5871 // element may have already been removed due to v-html / v-text
5872 if (isDef(parent)) {
5873 nodeOps.removeChild(parent, el);
5874 }
5875 }
5876
5877 function isUnknownElement$$1 (vnode, inVPre) {
5878 return (
5879 !inVPre &&
5880 !vnode.ns &&
5881 !(
5882 config.ignoredElements.length &&
5883 config.ignoredElements.some(function (ignore) {
5884 return isRegExp(ignore)
5885 ? ignore.test(vnode.tag)
5886 : ignore === vnode.tag
5887 })
5888 ) &&
5889 config.isUnknownElement(vnode.tag)
5890 )
5891 }
5892
5893 var creatingElmInVPre = 0;
5894
5895 function createElm (
5896 vnode,
5897 insertedVnodeQueue,
5898 parentElm,
5899 refElm,
5900 nested,
5901 ownerArray,
5902 index
5903 ) {
5904 if (isDef(vnode.elm) && isDef(ownerArray)) {
5905 // This vnode was used in a previous render!
5906 // now it's used as a new node, overwriting its elm would cause
5907 // potential patch errors down the road when it's used as an insertion
5908 // reference node. Instead, we clone the node on-demand before creating
5909 // associated DOM element for it.
5910 vnode = ownerArray[index] = cloneVNode(vnode);
5911 }
5912
5913 vnode.isRootInsert = !nested; // for transition enter check
5914 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5915 return
5916 }
5917
5918 var data = vnode.data;
5919 var children = vnode.children;
5920 var tag = vnode.tag;
5921 if (isDef(tag)) {
5922 {
5923 if (data && data.pre) {
5924 creatingElmInVPre++;
5925 }
5926 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5927 warn(
5928 'Unknown custom element: <' + tag + '> - did you ' +
5929 'register the component correctly? For recursive components, ' +
5930 'make sure to provide the "name" option.',
5931 vnode.context
5932 );
5933 }
5934 }
5935
5936 vnode.elm = vnode.ns
5937 ? nodeOps.createElementNS(vnode.ns, tag)
5938 : nodeOps.createElement(tag, vnode);
5939 setScope(vnode);
5940
5941 /* istanbul ignore if */
5942 {
5943 createChildren(vnode, children, insertedVnodeQueue);
5944 if (isDef(data)) {
5945 invokeCreateHooks(vnode, insertedVnodeQueue);
5946 }
5947 insert(parentElm, vnode.elm, refElm);
5948 }
5949
5950 if (data && data.pre) {
5951 creatingElmInVPre--;
5952 }
5953 } else if (isTrue(vnode.isComment)) {
5954 vnode.elm = nodeOps.createComment(vnode.text);
5955 insert(parentElm, vnode.elm, refElm);
5956 } else {
5957 vnode.elm = nodeOps.createTextNode(vnode.text);
5958 insert(parentElm, vnode.elm, refElm);
5959 }
5960 }
5961
5962 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5963 var i = vnode.data;
5964 if (isDef(i)) {
5965 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5966 if (isDef(i = i.hook) && isDef(i = i.init)) {
5967 i(vnode, false /* hydrating */);
5968 }
5969 // after calling the init hook, if the vnode is a child component
5970 // it should've created a child instance and mounted it. the child
5971 // component also has set the placeholder vnode's elm.
5972 // in that case we can just return the element and be done.
5973 if (isDef(vnode.componentInstance)) {
5974 initComponent(vnode, insertedVnodeQueue);
5975 insert(parentElm, vnode.elm, refElm);
5976 if (isTrue(isReactivated)) {
5977 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5978 }
5979 return true
5980 }
5981 }
5982 }
5983
5984 function initComponent (vnode, insertedVnodeQueue) {
5985 if (isDef(vnode.data.pendingInsert)) {
5986 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5987 vnode.data.pendingInsert = null;
5988 }
5989 vnode.elm = vnode.componentInstance.$el;
5990 if (isPatchable(vnode)) {
5991 invokeCreateHooks(vnode, insertedVnodeQueue);
5992 setScope(vnode);
5993 } else {
5994 // empty component root.
5995 // skip all element-related modules except for ref (#3455)
5996 registerRef(vnode);
5997 // make sure to invoke the insert hook
5998 insertedVnodeQueue.push(vnode);
5999 }
6000 }
6001
6002 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
6003 var i;
6004 // hack for #4339: a reactivated component with inner transition
6005 // does not trigger because the inner node's created hooks are not called
6006 // again. It's not ideal to involve module-specific logic in here but
6007 // there doesn't seem to be a better way to do it.
6008 var innerNode = vnode;
6009 while (innerNode.componentInstance) {
6010 innerNode = innerNode.componentInstance._vnode;
6011 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6012 for (i = 0; i < cbs.activate.length; ++i) {
6013 cbs.activate[i](emptyNode, innerNode);
6014 }
6015 insertedVnodeQueue.push(innerNode);
6016 break
6017 }
6018 }
6019 // unlike a newly created component,
6020 // a reactivated keep-alive component doesn't insert itself
6021 insert(parentElm, vnode.elm, refElm);
6022 }
6023
6024 function insert (parent, elm, ref$$1) {
6025 if (isDef(parent)) {
6026 if (isDef(ref$$1)) {
6027 if (nodeOps.parentNode(ref$$1) === parent) {
6028 nodeOps.insertBefore(parent, elm, ref$$1);
6029 }
6030 } else {
6031 nodeOps.appendChild(parent, elm);
6032 }
6033 }
6034 }
6035
6036 function createChildren (vnode, children, insertedVnodeQueue) {
6037 if (Array.isArray(children)) {
6038 {
6039 checkDuplicateKeys(children);
6040 }
6041 for (var i = 0; i < children.length; ++i) {
6042 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6043 }
6044 } else if (isPrimitive(vnode.text)) {
6045 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6046 }
6047 }
6048
6049 function isPatchable (vnode) {
6050 while (vnode.componentInstance) {
6051 vnode = vnode.componentInstance._vnode;
6052 }
6053 return isDef(vnode.tag)
6054 }
6055
6056 function invokeCreateHooks (vnode, insertedVnodeQueue) {
6057 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6058 cbs.create[i$1](emptyNode, vnode);
6059 }
6060 i = vnode.data.hook; // Reuse variable
6061 if (isDef(i)) {
6062 if (isDef(i.create)) { i.create(emptyNode, vnode); }
6063 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6064 }
6065 }
6066
6067 // set scope id attribute for scoped CSS.
6068 // this is implemented as a special case to avoid the overhead
6069 // of going through the normal attribute patching process.
6070 function setScope (vnode) {
6071 var i;
6072 if (isDef(i = vnode.fnScopeId)) {
6073 nodeOps.setStyleScope(vnode.elm, i);
6074 } else {
6075 var ancestor = vnode;
6076 while (ancestor) {
6077 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6078 nodeOps.setStyleScope(vnode.elm, i);
6079 }
6080 ancestor = ancestor.parent;
6081 }
6082 }
6083 // for slot content they should also get the scopeId from the host instance.
6084 if (isDef(i = activeInstance) &&
6085 i !== vnode.context &&
6086 i !== vnode.fnContext &&
6087 isDef(i = i.$options._scopeId)
6088 ) {
6089 nodeOps.setStyleScope(vnode.elm, i);
6090 }
6091 }
6092
6093 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6094 for (; startIdx <= endIdx; ++startIdx) {
6095 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6096 }
6097 }
6098
6099 function invokeDestroyHook (vnode) {
6100 var i, j;
6101 var data = vnode.data;
6102 if (isDef(data)) {
6103 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6104 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6105 }
6106 if (isDef(i = vnode.children)) {
6107 for (j = 0; j < vnode.children.length; ++j) {
6108 invokeDestroyHook(vnode.children[j]);
6109 }
6110 }
6111 }
6112
6113 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6114 for (; startIdx <= endIdx; ++startIdx) {
6115 var ch = vnodes[startIdx];
6116 if (isDef(ch)) {
6117 if (isDef(ch.tag)) {
6118 removeAndInvokeRemoveHook(ch);
6119 invokeDestroyHook(ch);
6120 } else { // Text node
6121 removeNode(ch.elm);
6122 }
6123 }
6124 }
6125 }
6126
6127 function removeAndInvokeRemoveHook (vnode, rm) {
6128 if (isDef(rm) || isDef(vnode.data)) {
6129 var i;
6130 var listeners = cbs.remove.length + 1;
6131 if (isDef(rm)) {
6132 // we have a recursively passed down rm callback
6133 // increase the listeners count
6134 rm.listeners += listeners;
6135 } else {
6136 // directly removing
6137 rm = createRmCb(vnode.elm, listeners);
6138 }
6139 // recursively invoke hooks on child component root node
6140 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6141 removeAndInvokeRemoveHook(i, rm);
6142 }
6143 for (i = 0; i < cbs.remove.length; ++i) {
6144 cbs.remove[i](vnode, rm);
6145 }
6146 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6147 i(vnode, rm);
6148 } else {
6149 rm();
6150 }
6151 } else {
6152 removeNode(vnode.elm);
6153 }
6154 }
6155
6156 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6157 var oldStartIdx = 0;
6158 var newStartIdx = 0;
6159 var oldEndIdx = oldCh.length - 1;
6160 var oldStartVnode = oldCh[0];
6161 var oldEndVnode = oldCh[oldEndIdx];
6162 var newEndIdx = newCh.length - 1;
6163 var newStartVnode = newCh[0];
6164 var newEndVnode = newCh[newEndIdx];
6165 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6166
6167 // removeOnly is a special flag used only by <transition-group>
6168 // to ensure removed elements stay in correct relative positions
6169 // during leaving transitions
6170 var canMove = !removeOnly;
6171
6172 {
6173 checkDuplicateKeys(newCh);
6174 }
6175
6176 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6177 if (isUndef(oldStartVnode)) {
6178 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6179 } else if (isUndef(oldEndVnode)) {
6180 oldEndVnode = oldCh[--oldEndIdx];
6181 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6182 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6183 oldStartVnode = oldCh[++oldStartIdx];
6184 newStartVnode = newCh[++newStartIdx];
6185 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6186 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6187 oldEndVnode = oldCh[--oldEndIdx];
6188 newEndVnode = newCh[--newEndIdx];
6189 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6190 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6191 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6192 oldStartVnode = oldCh[++oldStartIdx];
6193 newEndVnode = newCh[--newEndIdx];
6194 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6195 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6196 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6197 oldEndVnode = oldCh[--oldEndIdx];
6198 newStartVnode = newCh[++newStartIdx];
6199 } else {
6200 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6201 idxInOld = isDef(newStartVnode.key)
6202 ? oldKeyToIdx[newStartVnode.key]
6203 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6204 if (isUndef(idxInOld)) { // New element
6205 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6206 } else {
6207 vnodeToMove = oldCh[idxInOld];
6208 if (sameVnode(vnodeToMove, newStartVnode)) {
6209 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6210 oldCh[idxInOld] = undefined;
6211 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6212 } else {
6213 // same key but different element. treat as new element
6214 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6215 }
6216 }
6217 newStartVnode = newCh[++newStartIdx];
6218 }
6219 }
6220 if (oldStartIdx > oldEndIdx) {
6221 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6222 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6223 } else if (newStartIdx > newEndIdx) {
6224 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6225 }
6226 }
6227
6228 function checkDuplicateKeys (children) {
6229 var seenKeys = {};
6230 for (var i = 0; i < children.length; i++) {
6231 var vnode = children[i];
6232 var key = vnode.key;
6233 if (isDef(key)) {
6234 if (seenKeys[key]) {
6235 warn(
6236 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6237 vnode.context
6238 );
6239 } else {
6240 seenKeys[key] = true;
6241 }
6242 }
6243 }
6244 }
6245
6246 function findIdxInOld (node, oldCh, start, end) {
6247 for (var i = start; i < end; i++) {
6248 var c = oldCh[i];
6249 if (isDef(c) && sameVnode(node, c)) { return i }
6250 }
6251 }
6252
6253 function patchVnode (
6254 oldVnode,
6255 vnode,
6256 insertedVnodeQueue,
6257 ownerArray,
6258 index,
6259 removeOnly
6260 ) {
6261 if (oldVnode === vnode) {
6262 return
6263 }
6264
6265 if (isDef(vnode.elm) && isDef(ownerArray)) {
6266 // clone reused vnode
6267 vnode = ownerArray[index] = cloneVNode(vnode);
6268 }
6269
6270 var elm = vnode.elm = oldVnode.elm;
6271
6272 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6273 if (isDef(vnode.asyncFactory.resolved)) {
6274 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6275 } else {
6276 vnode.isAsyncPlaceholder = true;
6277 }
6278 return
6279 }
6280
6281 // reuse element for static trees.
6282 // note we only do this if the vnode is cloned -
6283 // if the new node is not cloned it means the render functions have been
6284 // reset by the hot-reload-api and we need to do a proper re-render.
6285 if (isTrue(vnode.isStatic) &&
6286 isTrue(oldVnode.isStatic) &&
6287 vnode.key === oldVnode.key &&
6288 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6289 ) {
6290 vnode.componentInstance = oldVnode.componentInstance;
6291 return
6292 }
6293
6294 var i;
6295 var data = vnode.data;
6296 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6297 i(oldVnode, vnode);
6298 }
6299
6300 var oldCh = oldVnode.children;
6301 var ch = vnode.children;
6302 if (isDef(data) && isPatchable(vnode)) {
6303 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6304 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6305 }
6306 if (isUndef(vnode.text)) {
6307 if (isDef(oldCh) && isDef(ch)) {
6308 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6309 } else if (isDef(ch)) {
6310 {
6311 checkDuplicateKeys(ch);
6312 }
6313 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6314 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6315 } else if (isDef(oldCh)) {
6316 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6317 } else if (isDef(oldVnode.text)) {
6318 nodeOps.setTextContent(elm, '');
6319 }
6320 } else if (oldVnode.text !== vnode.text) {
6321 nodeOps.setTextContent(elm, vnode.text);
6322 }
6323 if (isDef(data)) {
6324 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6325 }
6326 }
6327
6328 function invokeInsertHook (vnode, queue, initial) {
6329 // delay insert hooks for component root nodes, invoke them after the
6330 // element is really inserted
6331 if (isTrue(initial) && isDef(vnode.parent)) {
6332 vnode.parent.data.pendingInsert = queue;
6333 } else {
6334 for (var i = 0; i < queue.length; ++i) {
6335 queue[i].data.hook.insert(queue[i]);
6336 }
6337 }
6338 }
6339
6340 var hydrationBailed = false;
6341 // list of modules that can skip create hook during hydration because they
6342 // are already rendered on the client or has no need for initialization
6343 // Note: style is excluded because it relies on initial clone for future
6344 // deep updates (#7063).
6345 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6346
6347 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6348 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6349 var i;
6350 var tag = vnode.tag;
6351 var data = vnode.data;
6352 var children = vnode.children;
6353 inVPre = inVPre || (data && data.pre);
6354 vnode.elm = elm;
6355
6356 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6357 vnode.isAsyncPlaceholder = true;
6358 return true
6359 }
6360 // assert node match
6361 {
6362 if (!assertNodeMatch(elm, vnode, inVPre)) {
6363 return false
6364 }
6365 }
6366 if (isDef(data)) {
6367 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6368 if (isDef(i = vnode.componentInstance)) {
6369 // child component. it should have hydrated its own tree.
6370 initComponent(vnode, insertedVnodeQueue);
6371 return true
6372 }
6373 }
6374 if (isDef(tag)) {
6375 if (isDef(children)) {
6376 // empty element, allow client to pick up and populate children
6377 if (!elm.hasChildNodes()) {
6378 createChildren(vnode, children, insertedVnodeQueue);
6379 } else {
6380 // v-html and domProps: innerHTML
6381 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6382 if (i !== elm.innerHTML) {
6383 /* istanbul ignore if */
6384 if (typeof console !== 'undefined' &&
6385 !hydrationBailed
6386 ) {
6387 hydrationBailed = true;
6388 console.warn('Parent: ', elm);
6389 console.warn('server innerHTML: ', i);
6390 console.warn('client innerHTML: ', elm.innerHTML);
6391 }
6392 return false
6393 }
6394 } else {
6395 // iterate and compare children lists
6396 var childrenMatch = true;
6397 var childNode = elm.firstChild;
6398 for (var i$1 = 0; i$1 < children.length; i$1++) {
6399 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6400 childrenMatch = false;
6401 break
6402 }
6403 childNode = childNode.nextSibling;
6404 }
6405 // if childNode is not null, it means the actual childNodes list is
6406 // longer than the virtual children list.
6407 if (!childrenMatch || childNode) {
6408 /* istanbul ignore if */
6409 if (typeof console !== 'undefined' &&
6410 !hydrationBailed
6411 ) {
6412 hydrationBailed = true;
6413 console.warn('Parent: ', elm);
6414 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6415 }
6416 return false
6417 }
6418 }
6419 }
6420 }
6421 if (isDef(data)) {
6422 var fullInvoke = false;
6423 for (var key in data) {
6424 if (!isRenderedModule(key)) {
6425 fullInvoke = true;
6426 invokeCreateHooks(vnode, insertedVnodeQueue);
6427 break
6428 }
6429 }
6430 if (!fullInvoke && data['class']) {
6431 // ensure collecting deps for deep class bindings for future updates
6432 traverse(data['class']);
6433 }
6434 }
6435 } else if (elm.data !== vnode.text) {
6436 elm.data = vnode.text;
6437 }
6438 return true
6439 }
6440
6441 function assertNodeMatch (node, vnode, inVPre) {
6442 if (isDef(vnode.tag)) {
6443 return vnode.tag.indexOf('vue-component') === 0 || (
6444 !isUnknownElement$$1(vnode, inVPre) &&
6445 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6446 )
6447 } else {
6448 return node.nodeType === (vnode.isComment ? 8 : 3)
6449 }
6450 }
6451
6452 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6453 if (isUndef(vnode)) {
6454 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6455 return
6456 }
6457
6458 var isInitialPatch = false;
6459 var insertedVnodeQueue = [];
6460
6461 if (isUndef(oldVnode)) {
6462 // empty mount (likely as component), create new root element
6463 isInitialPatch = true;
6464 createElm(vnode, insertedVnodeQueue);
6465 } else {
6466 var isRealElement = isDef(oldVnode.nodeType);
6467 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6468 // patch existing root node
6469 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6470 } else {
6471 if (isRealElement) {
6472 // mounting to a real element
6473 // check if this is server-rendered content and if we can perform
6474 // a successful hydration.
6475 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6476 oldVnode.removeAttribute(SSR_ATTR);
6477 hydrating = true;
6478 }
6479 if (isTrue(hydrating)) {
6480 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6481 invokeInsertHook(vnode, insertedVnodeQueue, true);
6482 return oldVnode
6483 } else {
6484 warn(
6485 'The client-side rendered virtual DOM tree is not matching ' +
6486 'server-rendered content. This is likely caused by incorrect ' +
6487 'HTML markup, for example nesting block-level elements inside ' +
6488 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6489 'full client-side render.'
6490 );
6491 }
6492 }
6493 // either not server-rendered, or hydration failed.
6494 // create an empty node and replace it
6495 oldVnode = emptyNodeAt(oldVnode);
6496 }
6497
6498 // replacing existing element
6499 var oldElm = oldVnode.elm;
6500 var parentElm = nodeOps.parentNode(oldElm);
6501
6502 // create new node
6503 createElm(
6504 vnode,
6505 insertedVnodeQueue,
6506 // extremely rare edge case: do not insert if old element is in a
6507 // leaving transition. Only happens when combining transition +
6508 // keep-alive + HOCs. (#4590)
6509 oldElm._leaveCb ? null : parentElm,
6510 nodeOps.nextSibling(oldElm)
6511 );
6512
6513 // update parent placeholder node element, recursively
6514 if (isDef(vnode.parent)) {
6515 var ancestor = vnode.parent;
6516 var patchable = isPatchable(vnode);
6517 while (ancestor) {
6518 for (var i = 0; i < cbs.destroy.length; ++i) {
6519 cbs.destroy[i](ancestor);
6520 }
6521 ancestor.elm = vnode.elm;
6522 if (patchable) {
6523 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6524 cbs.create[i$1](emptyNode, ancestor);
6525 }
6526 // #6513
6527 // invoke insert hooks that may have been merged by create hooks.
6528 // e.g. for directives that uses the "inserted" hook.
6529 var insert = ancestor.data.hook.insert;
6530 if (insert.merged) {
6531 // start at index 1 to avoid re-invoking component mounted hook
6532 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6533 insert.fns[i$2]();
6534 }
6535 }
6536 } else {
6537 registerRef(ancestor);
6538 }
6539 ancestor = ancestor.parent;
6540 }
6541 }
6542
6543 // destroy old node
6544 if (isDef(parentElm)) {
6545 removeVnodes(parentElm, [oldVnode], 0, 0);
6546 } else if (isDef(oldVnode.tag)) {
6547 invokeDestroyHook(oldVnode);
6548 }
6549 }
6550 }
6551
6552 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6553 return vnode.elm
6554 }
6555 }
6556
6557 /* */
6558
6559 var directives = {
6560 create: updateDirectives,
6561 update: updateDirectives,
6562 destroy: function unbindDirectives (vnode) {
6563 updateDirectives(vnode, emptyNode);
6564 }
6565 };
6566
6567 function updateDirectives (oldVnode, vnode) {
6568 if (oldVnode.data.directives || vnode.data.directives) {
6569 _update(oldVnode, vnode);
6570 }
6571 }
6572
6573 function _update (oldVnode, vnode) {
6574 var isCreate = oldVnode === emptyNode;
6575 var isDestroy = vnode === emptyNode;
6576 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6577 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6578
6579 var dirsWithInsert = [];
6580 var dirsWithPostpatch = [];
6581
6582 var key, oldDir, dir;
6583 for (key in newDirs) {
6584 oldDir = oldDirs[key];
6585 dir = newDirs[key];
6586 if (!oldDir) {
6587 // new directive, bind
6588 callHook$1(dir, 'bind', vnode, oldVnode);
6589 if (dir.def && dir.def.inserted) {
6590 dirsWithInsert.push(dir);
6591 }
6592 } else {
6593 // existing directive, update
6594 dir.oldValue = oldDir.value;
6595 dir.oldArg = oldDir.arg;
6596 callHook$1(dir, 'update', vnode, oldVnode);
6597 if (dir.def && dir.def.componentUpdated) {
6598 dirsWithPostpatch.push(dir);
6599 }
6600 }
6601 }
6602
6603 if (dirsWithInsert.length) {
6604 var callInsert = function () {
6605 for (var i = 0; i < dirsWithInsert.length; i++) {
6606 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6607 }
6608 };
6609 if (isCreate) {
6610 mergeVNodeHook(vnode, 'insert', callInsert);
6611 } else {
6612 callInsert();
6613 }
6614 }
6615
6616 if (dirsWithPostpatch.length) {
6617 mergeVNodeHook(vnode, 'postpatch', function () {
6618 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6619 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6620 }
6621 });
6622 }
6623
6624 if (!isCreate) {
6625 for (key in oldDirs) {
6626 if (!newDirs[key]) {
6627 // no longer present, unbind
6628 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6629 }
6630 }
6631 }
6632 }
6633
6634 var emptyModifiers = Object.create(null);
6635
6636 function normalizeDirectives$1 (
6637 dirs,
6638 vm
6639 ) {
6640 var res = Object.create(null);
6641 if (!dirs) {
6642 // $flow-disable-line
6643 return res
6644 }
6645 var i, dir;
6646 for (i = 0; i < dirs.length; i++) {
6647 dir = dirs[i];
6648 if (!dir.modifiers) {
6649 // $flow-disable-line
6650 dir.modifiers = emptyModifiers;
6651 }
6652 res[getRawDirName(dir)] = dir;
6653 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6654 }
6655 // $flow-disable-line
6656 return res
6657 }
6658
6659 function getRawDirName (dir) {
6660 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6661 }
6662
6663 function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6664 var fn = dir.def && dir.def[hook];
6665 if (fn) {
6666 try {
6667 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6668 } catch (e) {
6669 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6670 }
6671 }
6672 }
6673
6674 var baseModules = [
6675 ref,
6676 directives
6677 ];
6678
6679 /* */
6680
6681 function updateAttrs (oldVnode, vnode) {
6682 var opts = vnode.componentOptions;
6683 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6684 return
6685 }
6686 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6687 return
6688 }
6689 var key, cur, old;
6690 var elm = vnode.elm;
6691 var oldAttrs = oldVnode.data.attrs || {};
6692 var attrs = vnode.data.attrs || {};
6693 // clone observed objects, as the user probably wants to mutate it
6694 if (isDef(attrs.__ob__)) {
6695 attrs = vnode.data.attrs = extend({}, attrs);
6696 }
6697
6698 for (key in attrs) {
6699 cur = attrs[key];
6700 old = oldAttrs[key];
6701 if (old !== cur) {
6702 setAttr(elm, key, cur);
6703 }
6704 }
6705 // #4391: in IE9, setting type can reset value for input[type=radio]
6706 // #6666: IE/Edge forces progress value down to 1 before setting a max
6707 /* istanbul ignore if */
6708 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6709 setAttr(elm, 'value', attrs.value);
6710 }
6711 for (key in oldAttrs) {
6712 if (isUndef(attrs[key])) {
6713 if (isXlink(key)) {
6714 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6715 } else if (!isEnumeratedAttr(key)) {
6716 elm.removeAttribute(key);
6717 }
6718 }
6719 }
6720 }
6721
6722 function setAttr (el, key, value) {
6723 if (el.tagName.indexOf('-') > -1) {
6724 baseSetAttr(el, key, value);
6725 } else if (isBooleanAttr(key)) {
6726 // set attribute for blank value
6727 // e.g. <option disabled>Select one</option>
6728 if (isFalsyAttrValue(value)) {
6729 el.removeAttribute(key);
6730 } else {
6731 // technically allowfullscreen is a boolean attribute for <iframe>,
6732 // but Flash expects a value of "true" when used on <embed> tag
6733 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6734 ? 'true'
6735 : key;
6736 el.setAttribute(key, value);
6737 }
6738 } else if (isEnumeratedAttr(key)) {
6739 el.setAttribute(key, convertEnumeratedValue(key, value));
6740 } else if (isXlink(key)) {
6741 if (isFalsyAttrValue(value)) {
6742 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6743 } else {
6744 el.setAttributeNS(xlinkNS, key, value);
6745 }
6746 } else {
6747 baseSetAttr(el, key, value);
6748 }
6749 }
6750
6751 function baseSetAttr (el, key, value) {
6752 if (isFalsyAttrValue(value)) {
6753 el.removeAttribute(key);
6754 } else {
6755 // #7138: IE10 & 11 fires input event when setting placeholder on
6756 // <textarea>... block the first input event and remove the blocker
6757 // immediately.
6758 /* istanbul ignore if */
6759 if (
6760 isIE && !isIE9 &&
6761 el.tagName === 'TEXTAREA' &&
6762 key === 'placeholder' && value !== '' && !el.__ieph
6763 ) {
6764 var blocker = function (e) {
6765 e.stopImmediatePropagation();
6766 el.removeEventListener('input', blocker);
6767 };
6768 el.addEventListener('input', blocker);
6769 // $flow-disable-line
6770 el.__ieph = true; /* IE placeholder patched */
6771 }
6772 el.setAttribute(key, value);
6773 }
6774 }
6775
6776 var attrs = {
6777 create: updateAttrs,
6778 update: updateAttrs
6779 };
6780
6781 /* */
6782
6783 function updateClass (oldVnode, vnode) {
6784 var el = vnode.elm;
6785 var data = vnode.data;
6786 var oldData = oldVnode.data;
6787 if (
6788 isUndef(data.staticClass) &&
6789 isUndef(data.class) && (
6790 isUndef(oldData) || (
6791 isUndef(oldData.staticClass) &&
6792 isUndef(oldData.class)
6793 )
6794 )
6795 ) {
6796 return
6797 }
6798
6799 var cls = genClassForVnode(vnode);
6800
6801 // handle transition classes
6802 var transitionClass = el._transitionClasses;
6803 if (isDef(transitionClass)) {
6804 cls = concat(cls, stringifyClass(transitionClass));
6805 }
6806
6807 // set the class
6808 if (cls !== el._prevClass) {
6809 el.setAttribute('class', cls);
6810 el._prevClass = cls;
6811 }
6812 }
6813
6814 var klass = {
6815 create: updateClass,
6816 update: updateClass
6817 };
6818
6819 /* */
6820
6821 var validDivisionCharRE = /[\w).+\-_$\]]/;
6822
6823 function parseFilters (exp) {
6824 var inSingle = false;
6825 var inDouble = false;
6826 var inTemplateString = false;
6827 var inRegex = false;
6828 var curly = 0;
6829 var square = 0;
6830 var paren = 0;
6831 var lastFilterIndex = 0;
6832 var c, prev, i, expression, filters;
6833
6834 for (i = 0; i < exp.length; i++) {
6835 prev = c;
6836 c = exp.charCodeAt(i);
6837 if (inSingle) {
6838 if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
6839 } else if (inDouble) {
6840 if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
6841 } else if (inTemplateString) {
6842 if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
6843 } else if (inRegex) {
6844 if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
6845 } else if (
6846 c === 0x7C && // pipe
6847 exp.charCodeAt(i + 1) !== 0x7C &&
6848 exp.charCodeAt(i - 1) !== 0x7C &&
6849 !curly && !square && !paren
6850 ) {
6851 if (expression === undefined) {
6852 // first filter, end of expression
6853 lastFilterIndex = i + 1;
6854 expression = exp.slice(0, i).trim();
6855 } else {
6856 pushFilter();
6857 }
6858 } else {
6859 switch (c) {
6860 case 0x22: inDouble = true; break // "
6861 case 0x27: inSingle = true; break // '
6862 case 0x60: inTemplateString = true; break // `
6863 case 0x28: paren++; break // (
6864 case 0x29: paren--; break // )
6865 case 0x5B: square++; break // [
6866 case 0x5D: square--; break // ]
6867 case 0x7B: curly++; break // {
6868 case 0x7D: curly--; break // }
6869 }
6870 if (c === 0x2f) { // /
6871 var j = i - 1;
6872 var p = (void 0);
6873 // find first non-whitespace prev char
6874 for (; j >= 0; j--) {
6875 p = exp.charAt(j);
6876 if (p !== ' ') { break }
6877 }
6878 if (!p || !validDivisionCharRE.test(p)) {
6879 inRegex = true;
6880 }
6881 }
6882 }
6883 }
6884
6885 if (expression === undefined) {
6886 expression = exp.slice(0, i).trim();
6887 } else if (lastFilterIndex !== 0) {
6888 pushFilter();
6889 }
6890
6891 function pushFilter () {
6892 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
6893 lastFilterIndex = i + 1;
6894 }
6895
6896 if (filters) {
6897 for (i = 0; i < filters.length; i++) {
6898 expression = wrapFilter(expression, filters[i]);
6899 }
6900 }
6901
6902 return expression
6903 }
6904
6905 function wrapFilter (exp, filter) {
6906 var i = filter.indexOf('(');
6907 if (i < 0) {
6908 // _f: resolveFilter
6909 return ("_f(\"" + filter + "\")(" + exp + ")")
6910 } else {
6911 var name = filter.slice(0, i);
6912 var args = filter.slice(i + 1);
6913 return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
6914 }
6915 }
6916
6917 /* */
6918
6919
6920
6921 /* eslint-disable no-unused-vars */
6922 function baseWarn (msg, range) {
6923 console.error(("[Vue compiler]: " + msg));
6924 }
6925 /* eslint-enable no-unused-vars */
6926
6927 function pluckModuleFunction (
6928 modules,
6929 key
6930 ) {
6931 return modules
6932 ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
6933 : []
6934 }
6935
6936 function addProp (el, name, value, range, dynamic) {
6937 (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6938 el.plain = false;
6939 }
6940
6941 function addAttr (el, name, value, range, dynamic) {
6942 var attrs = dynamic
6943 ? (el.dynamicAttrs || (el.dynamicAttrs = []))
6944 : (el.attrs || (el.attrs = []));
6945 attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6946 el.plain = false;
6947 }
6948
6949 // add a raw attr (use this in preTransforms)
6950 function addRawAttr (el, name, value, range) {
6951 el.attrsMap[name] = value;
6952 el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
6953 }
6954
6955 function addDirective (
6956 el,
6957 name,
6958 rawName,
6959 value,
6960 arg,
6961 isDynamicArg,
6962 modifiers,
6963 range
6964 ) {
6965 (el.directives || (el.directives = [])).push(rangeSetItem({
6966 name: name,
6967 rawName: rawName,
6968 value: value,
6969 arg: arg,
6970 isDynamicArg: isDynamicArg,
6971 modifiers: modifiers
6972 }, range));
6973 el.plain = false;
6974 }
6975
6976 function prependModifierMarker (symbol, name, dynamic) {
6977 return dynamic
6978 ? ("_p(" + name + ",\"" + symbol + "\")")
6979 : symbol + name // mark the event as captured
6980 }
6981
6982 function addHandler (
6983 el,
6984 name,
6985 value,
6986 modifiers,
6987 important,
6988 warn,
6989 range,
6990 dynamic
6991 ) {
6992 modifiers = modifiers || emptyObject;
6993 // warn prevent and passive modifier
6994 /* istanbul ignore if */
6995 if (
6996 warn &&
6997 modifiers.prevent && modifiers.passive
6998 ) {
6999 warn(
7000 'passive and prevent can\'t be used together. ' +
7001 'Passive handler can\'t prevent default event.',
7002 range
7003 );
7004 }
7005
7006 // normalize click.right and click.middle since they don't actually fire
7007 // this is technically browser-specific, but at least for now browsers are
7008 // the only target envs that have right/middle clicks.
7009 if (modifiers.right) {
7010 if (dynamic) {
7011 name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
7012 } else if (name === 'click') {
7013 name = 'contextmenu';
7014 delete modifiers.right;
7015 }
7016 } else if (modifiers.middle) {
7017 if (dynamic) {
7018 name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
7019 } else if (name === 'click') {
7020 name = 'mouseup';
7021 }
7022 }
7023
7024 // check capture modifier
7025 if (modifiers.capture) {
7026 delete modifiers.capture;
7027 name = prependModifierMarker('!', name, dynamic);
7028 }
7029 if (modifiers.once) {
7030 delete modifiers.once;
7031 name = prependModifierMarker('~', name, dynamic);
7032 }
7033 /* istanbul ignore if */
7034 if (modifiers.passive) {
7035 delete modifiers.passive;
7036 name = prependModifierMarker('&', name, dynamic);
7037 }
7038
7039 var events;
7040 if (modifiers.native) {
7041 delete modifiers.native;
7042 events = el.nativeEvents || (el.nativeEvents = {});
7043 } else {
7044 events = el.events || (el.events = {});
7045 }
7046
7047 var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
7048 if (modifiers !== emptyObject) {
7049 newHandler.modifiers = modifiers;
7050 }
7051
7052 var handlers = events[name];
7053 /* istanbul ignore if */
7054 if (Array.isArray(handlers)) {
7055 important ? handlers.unshift(newHandler) : handlers.push(newHandler);
7056 } else if (handlers) {
7057 events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
7058 } else {
7059 events[name] = newHandler;
7060 }
7061
7062 el.plain = false;
7063 }
7064
7065 function getRawBindingAttr (
7066 el,
7067 name
7068 ) {
7069 return el.rawAttrsMap[':' + name] ||
7070 el.rawAttrsMap['v-bind:' + name] ||
7071 el.rawAttrsMap[name]
7072 }
7073
7074 function getBindingAttr (
7075 el,
7076 name,
7077 getStatic
7078 ) {
7079 var dynamicValue =
7080 getAndRemoveAttr(el, ':' + name) ||
7081 getAndRemoveAttr(el, 'v-bind:' + name);
7082 if (dynamicValue != null) {
7083 return parseFilters(dynamicValue)
7084 } else if (getStatic !== false) {
7085 var staticValue = getAndRemoveAttr(el, name);
7086 if (staticValue != null) {
7087 return JSON.stringify(staticValue)
7088 }
7089 }
7090 }
7091
7092 // note: this only removes the attr from the Array (attrsList) so that it
7093 // doesn't get processed by processAttrs.
7094 // By default it does NOT remove it from the map (attrsMap) because the map is
7095 // needed during codegen.
7096 function getAndRemoveAttr (
7097 el,
7098 name,
7099 removeFromMap
7100 ) {
7101 var val;
7102 if ((val = el.attrsMap[name]) != null) {
7103 var list = el.attrsList;
7104 for (var i = 0, l = list.length; i < l; i++) {
7105 if (list[i].name === name) {
7106 list.splice(i, 1);
7107 break
7108 }
7109 }
7110 }
7111 if (removeFromMap) {
7112 delete el.attrsMap[name];
7113 }
7114 return val
7115 }
7116
7117 function getAndRemoveAttrByRegex (
7118 el,
7119 name
7120 ) {
7121 var list = el.attrsList;
7122 for (var i = 0, l = list.length; i < l; i++) {
7123 var attr = list[i];
7124 if (name.test(attr.name)) {
7125 list.splice(i, 1);
7126 return attr
7127 }
7128 }
7129 }
7130
7131 function rangeSetItem (
7132 item,
7133 range
7134 ) {
7135 if (range) {
7136 if (range.start != null) {
7137 item.start = range.start;
7138 }
7139 if (range.end != null) {
7140 item.end = range.end;
7141 }
7142 }
7143 return item
7144 }
7145
7146 /* */
7147
7148 /**
7149 * Cross-platform code generation for component v-model
7150 */
7151 function genComponentModel (
7152 el,
7153 value,
7154 modifiers
7155 ) {
7156 var ref = modifiers || {};
7157 var number = ref.number;
7158 var trim = ref.trim;
7159
7160 var baseValueExpression = '$$v';
7161 var valueExpression = baseValueExpression;
7162 if (trim) {
7163 valueExpression =
7164 "(typeof " + baseValueExpression + " === 'string'" +
7165 "? " + baseValueExpression + ".trim()" +
7166 ": " + baseValueExpression + ")";
7167 }
7168 if (number) {
7169 valueExpression = "_n(" + valueExpression + ")";
7170 }
7171 var assignment = genAssignmentCode(value, valueExpression);
7172
7173 el.model = {
7174 value: ("(" + value + ")"),
7175 expression: JSON.stringify(value),
7176 callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
7177 };
7178 }
7179
7180 /**
7181 * Cross-platform codegen helper for generating v-model value assignment code.
7182 */
7183 function genAssignmentCode (
7184 value,
7185 assignment
7186 ) {
7187 var res = parseModel(value);
7188 if (res.key === null) {
7189 return (value + "=" + assignment)
7190 } else {
7191 return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
7192 }
7193 }
7194
7195 /**
7196 * Parse a v-model expression into a base path and a final key segment.
7197 * Handles both dot-path and possible square brackets.
7198 *
7199 * Possible cases:
7200 *
7201 * - test
7202 * - test[key]
7203 * - test[test1[key]]
7204 * - test["a"][key]
7205 * - xxx.test[a[a].test1[key]]
7206 * - test.xxx.a["asa"][test1[key]]
7207 *
7208 */
7209
7210 var len, str, chr, index$1, expressionPos, expressionEndPos;
7211
7212
7213
7214 function parseModel (val) {
7215 // Fix https://github.com/vuejs/vue/pull/7730
7216 // allow v-model="obj.val " (trailing whitespace)
7217 val = val.trim();
7218 len = val.length;
7219
7220 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
7221 index$1 = val.lastIndexOf('.');
7222 if (index$1 > -1) {
7223 return {
7224 exp: val.slice(0, index$1),
7225 key: '"' + val.slice(index$1 + 1) + '"'
7226 }
7227 } else {
7228 return {
7229 exp: val,
7230 key: null
7231 }
7232 }
7233 }
7234
7235 str = val;
7236 index$1 = expressionPos = expressionEndPos = 0;
7237
7238 while (!eof()) {
7239 chr = next();
7240 /* istanbul ignore if */
7241 if (isStringStart(chr)) {
7242 parseString(chr);
7243 } else if (chr === 0x5B) {
7244 parseBracket(chr);
7245 }
7246 }
7247
7248 return {
7249 exp: val.slice(0, expressionPos),
7250 key: val.slice(expressionPos + 1, expressionEndPos)
7251 }
7252 }
7253
7254 function next () {
7255 return str.charCodeAt(++index$1)
7256 }
7257
7258 function eof () {
7259 return index$1 >= len
7260 }
7261
7262 function isStringStart (chr) {
7263 return chr === 0x22 || chr === 0x27
7264 }
7265
7266 function parseBracket (chr) {
7267 var inBracket = 1;
7268 expressionPos = index$1;
7269 while (!eof()) {
7270 chr = next();
7271 if (isStringStart(chr)) {
7272 parseString(chr);
7273 continue
7274 }
7275 if (chr === 0x5B) { inBracket++; }
7276 if (chr === 0x5D) { inBracket--; }
7277 if (inBracket === 0) {
7278 expressionEndPos = index$1;
7279 break
7280 }
7281 }
7282 }
7283
7284 function parseString (chr) {
7285 var stringQuote = chr;
7286 while (!eof()) {
7287 chr = next();
7288 if (chr === stringQuote) {
7289 break
7290 }
7291 }
7292 }
7293
7294 /* */
7295
7296 var warn$1;
7297
7298 // in some cases, the event used has to be determined at runtime
7299 // so we used some reserved tokens during compile.
7300 var RANGE_TOKEN = '__r';
7301 var CHECKBOX_RADIO_TOKEN = '__c';
7302
7303 function model (
7304 el,
7305 dir,
7306 _warn
7307 ) {
7308 warn$1 = _warn;
7309 var value = dir.value;
7310 var modifiers = dir.modifiers;
7311 var tag = el.tag;
7312 var type = el.attrsMap.type;
7313
7314 {
7315 // inputs with type="file" are read only and setting the input's
7316 // value will throw an error.
7317 if (tag === 'input' && type === 'file') {
7318 warn$1(
7319 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
7320 "File inputs are read only. Use a v-on:change listener instead.",
7321 el.rawAttrsMap['v-model']
7322 );
7323 }
7324 }
7325
7326 if (el.component) {
7327 genComponentModel(el, value, modifiers);
7328 // component v-model doesn't need extra runtime
7329 return false
7330 } else if (tag === 'select') {
7331 genSelect(el, value, modifiers);
7332 } else if (tag === 'input' && type === 'checkbox') {
7333 genCheckboxModel(el, value, modifiers);
7334 } else if (tag === 'input' && type === 'radio') {
7335 genRadioModel(el, value, modifiers);
7336 } else if (tag === 'input' || tag === 'textarea') {
7337 genDefaultModel(el, value, modifiers);
7338 } else if (!config.isReservedTag(tag)) {
7339 genComponentModel(el, value, modifiers);
7340 // component v-model doesn't need extra runtime
7341 return false
7342 } else {
7343 warn$1(
7344 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
7345 "v-model is not supported on this element type. " +
7346 'If you are working with contenteditable, it\'s recommended to ' +
7347 'wrap a library dedicated for that purpose inside a custom component.',
7348 el.rawAttrsMap['v-model']
7349 );
7350 }
7351
7352 // ensure runtime directive metadata
7353 return true
7354 }
7355
7356 function genCheckboxModel (
7357 el,
7358 value,
7359 modifiers
7360 ) {
7361 var number = modifiers && modifiers.number;
7362 var valueBinding = getBindingAttr(el, 'value') || 'null';
7363 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
7364 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
7365 addProp(el, 'checked',
7366 "Array.isArray(" + value + ")" +
7367 "?_i(" + value + "," + valueBinding + ")>-1" + (
7368 trueValueBinding === 'true'
7369 ? (":(" + value + ")")
7370 : (":_q(" + value + "," + trueValueBinding + ")")
7371 )
7372 );
7373 addHandler(el, 'change',
7374 "var $$a=" + value + "," +
7375 '$$el=$event.target,' +
7376 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
7377 'if(Array.isArray($$a)){' +
7378 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
7379 '$$i=_i($$a,$$v);' +
7380 "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
7381 "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
7382 "}else{" + (genAssignmentCode(value, '$$c')) + "}",
7383 null, true
7384 );
7385 }
7386
7387 function genRadioModel (
7388 el,
7389 value,
7390 modifiers
7391 ) {
7392 var number = modifiers && modifiers.number;
7393 var valueBinding = getBindingAttr(el, 'value') || 'null';
7394 valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
7395 addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
7396 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
7397 }
7398
7399 function genSelect (
7400 el,
7401 value,
7402 modifiers
7403 ) {
7404 var number = modifiers && modifiers.number;
7405 var selectedVal = "Array.prototype.filter" +
7406 ".call($event.target.options,function(o){return o.selected})" +
7407 ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
7408 "return " + (number ? '_n(val)' : 'val') + "})";
7409
7410 var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
7411 var code = "var $$selectedVal = " + selectedVal + ";";
7412 code = code + " " + (genAssignmentCode(value, assignment));
7413 addHandler(el, 'change', code, null, true);
7414 }
7415
7416 function genDefaultModel (
7417 el,
7418 value,
7419 modifiers
7420 ) {
7421 var type = el.attrsMap.type;
7422
7423 // warn if v-bind:value conflicts with v-model
7424 // except for inputs with v-bind:type
7425 {
7426 var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
7427 var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
7428 if (value$1 && !typeBinding) {
7429 var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
7430 warn$1(
7431 binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
7432 'because the latter already expands to a value binding internally',
7433 el.rawAttrsMap[binding]
7434 );
7435 }
7436 }
7437
7438 var ref = modifiers || {};
7439 var lazy = ref.lazy;
7440 var number = ref.number;
7441 var trim = ref.trim;
7442 var needCompositionGuard = !lazy && type !== 'range';
7443 var event = lazy
7444 ? 'change'
7445 : type === 'range'
7446 ? RANGE_TOKEN
7447 : 'input';
7448
7449 var valueExpression = '$event.target.value';
7450 if (trim) {
7451 valueExpression = "$event.target.value.trim()";
7452 }
7453 if (number) {
7454 valueExpression = "_n(" + valueExpression + ")";
7455 }
7456
7457 var code = genAssignmentCode(value, valueExpression);
7458 if (needCompositionGuard) {
7459 code = "if($event.target.composing)return;" + code;
7460 }
7461
7462 addProp(el, 'value', ("(" + value + ")"));
7463 addHandler(el, event, code, null, true);
7464 if (trim || number) {
7465 addHandler(el, 'blur', '$forceUpdate()');
7466 }
7467 }
7468
7469 /* */
7470
7471 // normalize v-model event tokens that can only be determined at runtime.
7472 // it's important to place the event as the first in the array because
7473 // the whole point is ensuring the v-model callback gets called before
7474 // user-attached handlers.
7475 function normalizeEvents (on) {
7476 /* istanbul ignore if */
7477 if (isDef(on[RANGE_TOKEN])) {
7478 // IE input[type=range] only supports `change` event
7479 var event = isIE ? 'change' : 'input';
7480 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
7481 delete on[RANGE_TOKEN];
7482 }
7483 // This was originally intended to fix #4521 but no longer necessary
7484 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7485 /* istanbul ignore if */
7486 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7487 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7488 delete on[CHECKBOX_RADIO_TOKEN];
7489 }
7490 }
7491
7492 var target$1;
7493
7494 function createOnceHandler$1 (event, handler, capture) {
7495 var _target = target$1; // save current target element in closure
7496 return function onceHandler () {
7497 var res = handler.apply(null, arguments);
7498 if (res !== null) {
7499 remove$2(event, onceHandler, capture, _target);
7500 }
7501 }
7502 }
7503
7504 // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
7505 // implementation and does not fire microtasks in between event propagation, so
7506 // safe to exclude.
7507 var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
7508
7509 function add$1 (
7510 name,
7511 handler,
7512 capture,
7513 passive
7514 ) {
7515 // async edge case #6566: inner click event triggers patch, event handler
7516 // attached to outer element during patch, and triggered again. This
7517 // happens because browsers fire microtask ticks between event propagation.
7518 // the solution is simple: we save the timestamp when a handler is attached,
7519 // and the handler would only fire if the event passed to it was fired
7520 // AFTER it was attached.
7521 if (useMicrotaskFix) {
7522 var attachedTimestamp = currentFlushTimestamp;
7523 var original = handler;
7524 handler = original._wrapper = function (e) {
7525 if (
7526 // no bubbling, should always fire.
7527 // this is just a safety net in case event.timeStamp is unreliable in
7528 // certain weird environments...
7529 e.target === e.currentTarget ||
7530 // event is fired after handler attachment
7531 e.timeStamp >= attachedTimestamp ||
7532 // bail for environments that have buggy event.timeStamp implementations
7533 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7534 // #9681 QtWebEngine event.timeStamp is negative value
7535 e.timeStamp <= 0 ||
7536 // #9448 bail if event is fired in another document in a multi-page
7537 // electron/nw.js app, since event.timeStamp will be using a different
7538 // starting reference
7539 e.target.ownerDocument !== document
7540 ) {
7541 return original.apply(this, arguments)
7542 }
7543 };
7544 }
7545 target$1.addEventListener(
7546 name,
7547 handler,
7548 supportsPassive
7549 ? { capture: capture, passive: passive }
7550 : capture
7551 );
7552 }
7553
7554 function remove$2 (
7555 name,
7556 handler,
7557 capture,
7558 _target
7559 ) {
7560 (_target || target$1).removeEventListener(
7561 name,
7562 handler._wrapper || handler,
7563 capture
7564 );
7565 }
7566
7567 function updateDOMListeners (oldVnode, vnode) {
7568 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
7569 return
7570 }
7571 var on = vnode.data.on || {};
7572 var oldOn = oldVnode.data.on || {};
7573 target$1 = vnode.elm;
7574 normalizeEvents(on);
7575 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
7576 target$1 = undefined;
7577 }
7578
7579 var events = {
7580 create: updateDOMListeners,
7581 update: updateDOMListeners
7582 };
7583
7584 /* */
7585
7586 var svgContainer;
7587
7588 function updateDOMProps (oldVnode, vnode) {
7589 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
7590 return
7591 }
7592 var key, cur;
7593 var elm = vnode.elm;
7594 var oldProps = oldVnode.data.domProps || {};
7595 var props = vnode.data.domProps || {};
7596 // clone observed objects, as the user probably wants to mutate it
7597 if (isDef(props.__ob__)) {
7598 props = vnode.data.domProps = extend({}, props);
7599 }
7600
7601 for (key in oldProps) {
7602 if (!(key in props)) {
7603 elm[key] = '';
7604 }
7605 }
7606
7607 for (key in props) {
7608 cur = props[key];
7609 // ignore children if the node has textContent or innerHTML,
7610 // as these will throw away existing DOM nodes and cause removal errors
7611 // on subsequent patches (#3360)
7612 if (key === 'textContent' || key === 'innerHTML') {
7613 if (vnode.children) { vnode.children.length = 0; }
7614 if (cur === oldProps[key]) { continue }
7615 // #6601 work around Chrome version <= 55 bug where single textNode
7616 // replaced by innerHTML/textContent retains its parentNode property
7617 if (elm.childNodes.length === 1) {
7618 elm.removeChild(elm.childNodes[0]);
7619 }
7620 }
7621
7622 if (key === 'value' && elm.tagName !== 'PROGRESS') {
7623 // store value as _value as well since
7624 // non-string values will be stringified
7625 elm._value = cur;
7626 // avoid resetting cursor position when value is the same
7627 var strCur = isUndef(cur) ? '' : String(cur);
7628 if (shouldUpdateValue(elm, strCur)) {
7629 elm.value = strCur;
7630 }
7631 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7632 // IE doesn't support innerHTML for SVG elements
7633 svgContainer = svgContainer || document.createElement('div');
7634 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7635 var svg = svgContainer.firstChild;
7636 while (elm.firstChild) {
7637 elm.removeChild(elm.firstChild);
7638 }
7639 while (svg.firstChild) {
7640 elm.appendChild(svg.firstChild);
7641 }
7642 } else if (
7643 // skip the update if old and new VDOM state is the same.
7644 // `value` is handled separately because the DOM value may be temporarily
7645 // out of sync with VDOM state due to focus, composition and modifiers.
7646 // This #4521 by skipping the unnecesarry `checked` update.
7647 cur !== oldProps[key]
7648 ) {
7649 // some property updates can throw
7650 // e.g. `value` on <progress> w/ non-finite value
7651 try {
7652 elm[key] = cur;
7653 } catch (e) {}
7654 }
7655 }
7656 }
7657
7658 // check platforms/web/util/attrs.js acceptValue
7659
7660
7661 function shouldUpdateValue (elm, checkVal) {
7662 return (!elm.composing && (
7663 elm.tagName === 'OPTION' ||
7664 isNotInFocusAndDirty(elm, checkVal) ||
7665 isDirtyWithModifiers(elm, checkVal)
7666 ))
7667 }
7668
7669 function isNotInFocusAndDirty (elm, checkVal) {
7670 // return true when textbox (.number and .trim) loses focus and its value is
7671 // not equal to the updated value
7672 var notInFocus = true;
7673 // #6157
7674 // work around IE bug when accessing document.activeElement in an iframe
7675 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7676 return notInFocus && elm.value !== checkVal
7677 }
7678
7679 function isDirtyWithModifiers (elm, newVal) {
7680 var value = elm.value;
7681 var modifiers = elm._vModifiers; // injected by v-model runtime
7682 if (isDef(modifiers)) {
7683 if (modifiers.number) {
7684 return toNumber(value) !== toNumber(newVal)
7685 }
7686 if (modifiers.trim) {
7687 return value.trim() !== newVal.trim()
7688 }
7689 }
7690 return value !== newVal
7691 }
7692
7693 var domProps = {
7694 create: updateDOMProps,
7695 update: updateDOMProps
7696 };
7697
7698 /* */
7699
7700 var parseStyleText = cached(function (cssText) {
7701 var res = {};
7702 var listDelimiter = /;(?![^(]*\))/g;
7703 var propertyDelimiter = /:(.+)/;
7704 cssText.split(listDelimiter).forEach(function (item) {
7705 if (item) {
7706 var tmp = item.split(propertyDelimiter);
7707 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7708 }
7709 });
7710 return res
7711 });
7712
7713 // merge static and dynamic style data on the same vnode
7714 function normalizeStyleData (data) {
7715 var style = normalizeStyleBinding(data.style);
7716 // static style is pre-processed into an object during compilation
7717 // and is always a fresh object, so it's safe to merge into it
7718 return data.staticStyle
7719 ? extend(data.staticStyle, style)
7720 : style
7721 }
7722
7723 // normalize possible array / string values into Object
7724 function normalizeStyleBinding (bindingStyle) {
7725 if (Array.isArray(bindingStyle)) {
7726 return toObject(bindingStyle)
7727 }
7728 if (typeof bindingStyle === 'string') {
7729 return parseStyleText(bindingStyle)
7730 }
7731 return bindingStyle
7732 }
7733
7734 /**
7735 * parent component style should be after child's
7736 * so that parent component's style could override it
7737 */
7738 function getStyle (vnode, checkChild) {
7739 var res = {};
7740 var styleData;
7741
7742 if (checkChild) {
7743 var childNode = vnode;
7744 while (childNode.componentInstance) {
7745 childNode = childNode.componentInstance._vnode;
7746 if (
7747 childNode && childNode.data &&
7748 (styleData = normalizeStyleData(childNode.data))
7749 ) {
7750 extend(res, styleData);
7751 }
7752 }
7753 }
7754
7755 if ((styleData = normalizeStyleData(vnode.data))) {
7756 extend(res, styleData);
7757 }
7758
7759 var parentNode = vnode;
7760 while ((parentNode = parentNode.parent)) {
7761 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7762 extend(res, styleData);
7763 }
7764 }
7765 return res
7766 }
7767
7768 /* */
7769
7770 var cssVarRE = /^--/;
7771 var importantRE = /\s*!important$/;
7772 var setProp = function (el, name, val) {
7773 /* istanbul ignore if */
7774 if (cssVarRE.test(name)) {
7775 el.style.setProperty(name, val);
7776 } else if (importantRE.test(val)) {
7777 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7778 } else {
7779 var normalizedName = normalize(name);
7780 if (Array.isArray(val)) {
7781 // Support values array created by autoprefixer, e.g.
7782 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7783 // Set them one by one, and the browser will only set those it can recognize
7784 for (var i = 0, len = val.length; i < len; i++) {
7785 el.style[normalizedName] = val[i];
7786 }
7787 } else {
7788 el.style[normalizedName] = val;
7789 }
7790 }
7791 };
7792
7793 var vendorNames = ['Webkit', 'Moz', 'ms'];
7794
7795 var emptyStyle;
7796 var normalize = cached(function (prop) {
7797 emptyStyle = emptyStyle || document.createElement('div').style;
7798 prop = camelize(prop);
7799 if (prop !== 'filter' && (prop in emptyStyle)) {
7800 return prop
7801 }
7802 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7803 for (var i = 0; i < vendorNames.length; i++) {
7804 var name = vendorNames[i] + capName;
7805 if (name in emptyStyle) {
7806 return name
7807 }
7808 }
7809 });
7810
7811 function updateStyle (oldVnode, vnode) {
7812 var data = vnode.data;
7813 var oldData = oldVnode.data;
7814
7815 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7816 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7817 ) {
7818 return
7819 }
7820
7821 var cur, name;
7822 var el = vnode.elm;
7823 var oldStaticStyle = oldData.staticStyle;
7824 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7825
7826 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7827 var oldStyle = oldStaticStyle || oldStyleBinding;
7828
7829 var style = normalizeStyleBinding(vnode.data.style) || {};
7830
7831 // store normalized style under a different key for next diff
7832 // make sure to clone it if it's reactive, since the user likely wants
7833 // to mutate it.
7834 vnode.data.normalizedStyle = isDef(style.__ob__)
7835 ? extend({}, style)
7836 : style;
7837
7838 var newStyle = getStyle(vnode, true);
7839
7840 for (name in oldStyle) {
7841 if (isUndef(newStyle[name])) {
7842 setProp(el, name, '');
7843 }
7844 }
7845 for (name in newStyle) {
7846 cur = newStyle[name];
7847 if (cur !== oldStyle[name]) {
7848 // ie9 setting to null has no effect, must use empty string
7849 setProp(el, name, cur == null ? '' : cur);
7850 }
7851 }
7852 }
7853
7854 var style = {
7855 create: updateStyle,
7856 update: updateStyle
7857 };
7858
7859 /* */
7860
7861 var whitespaceRE = /\s+/;
7862
7863 /**
7864 * Add class with compatibility for SVG since classList is not supported on
7865 * SVG elements in IE
7866 */
7867 function addClass (el, cls) {
7868 /* istanbul ignore if */
7869 if (!cls || !(cls = cls.trim())) {
7870 return
7871 }
7872
7873 /* istanbul ignore else */
7874 if (el.classList) {
7875 if (cls.indexOf(' ') > -1) {
7876 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7877 } else {
7878 el.classList.add(cls);
7879 }
7880 } else {
7881 var cur = " " + (el.getAttribute('class') || '') + " ";
7882 if (cur.indexOf(' ' + cls + ' ') < 0) {
7883 el.setAttribute('class', (cur + cls).trim());
7884 }
7885 }
7886 }
7887
7888 /**
7889 * Remove class with compatibility for SVG since classList is not supported on
7890 * SVG elements in IE
7891 */
7892 function removeClass (el, cls) {
7893 /* istanbul ignore if */
7894 if (!cls || !(cls = cls.trim())) {
7895 return
7896 }
7897
7898 /* istanbul ignore else */
7899 if (el.classList) {
7900 if (cls.indexOf(' ') > -1) {
7901 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7902 } else {
7903 el.classList.remove(cls);
7904 }
7905 if (!el.classList.length) {
7906 el.removeAttribute('class');
7907 }
7908 } else {
7909 var cur = " " + (el.getAttribute('class') || '') + " ";
7910 var tar = ' ' + cls + ' ';
7911 while (cur.indexOf(tar) >= 0) {
7912 cur = cur.replace(tar, ' ');
7913 }
7914 cur = cur.trim();
7915 if (cur) {
7916 el.setAttribute('class', cur);
7917 } else {
7918 el.removeAttribute('class');
7919 }
7920 }
7921 }
7922
7923 /* */
7924
7925 function resolveTransition (def$$1) {
7926 if (!def$$1) {
7927 return
7928 }
7929 /* istanbul ignore else */
7930 if (typeof def$$1 === 'object') {
7931 var res = {};
7932 if (def$$1.css !== false) {
7933 extend(res, autoCssTransition(def$$1.name || 'v'));
7934 }
7935 extend(res, def$$1);
7936 return res
7937 } else if (typeof def$$1 === 'string') {
7938 return autoCssTransition(def$$1)
7939 }
7940 }
7941
7942 var autoCssTransition = cached(function (name) {
7943 return {
7944 enterClass: (name + "-enter"),
7945 enterToClass: (name + "-enter-to"),
7946 enterActiveClass: (name + "-enter-active"),
7947 leaveClass: (name + "-leave"),
7948 leaveToClass: (name + "-leave-to"),
7949 leaveActiveClass: (name + "-leave-active")
7950 }
7951 });
7952
7953 var hasTransition = inBrowser && !isIE9;
7954 var TRANSITION = 'transition';
7955 var ANIMATION = 'animation';
7956
7957 // Transition property/event sniffing
7958 var transitionProp = 'transition';
7959 var transitionEndEvent = 'transitionend';
7960 var animationProp = 'animation';
7961 var animationEndEvent = 'animationend';
7962 if (hasTransition) {
7963 /* istanbul ignore if */
7964 if (window.ontransitionend === undefined &&
7965 window.onwebkittransitionend !== undefined
7966 ) {
7967 transitionProp = 'WebkitTransition';
7968 transitionEndEvent = 'webkitTransitionEnd';
7969 }
7970 if (window.onanimationend === undefined &&
7971 window.onwebkitanimationend !== undefined
7972 ) {
7973 animationProp = 'WebkitAnimation';
7974 animationEndEvent = 'webkitAnimationEnd';
7975 }
7976 }
7977
7978 // binding to window is necessary to make hot reload work in IE in strict mode
7979 var raf = inBrowser
7980 ? window.requestAnimationFrame
7981 ? window.requestAnimationFrame.bind(window)
7982 : setTimeout
7983 : /* istanbul ignore next */ function (fn) { return fn(); };
7984
7985 function nextFrame (fn) {
7986 raf(function () {
7987 raf(fn);
7988 });
7989 }
7990
7991 function addTransitionClass (el, cls) {
7992 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7993 if (transitionClasses.indexOf(cls) < 0) {
7994 transitionClasses.push(cls);
7995 addClass(el, cls);
7996 }
7997 }
7998
7999 function removeTransitionClass (el, cls) {
8000 if (el._transitionClasses) {
8001 remove(el._transitionClasses, cls);
8002 }
8003 removeClass(el, cls);
8004 }
8005
8006 function whenTransitionEnds (
8007 el,
8008 expectedType,
8009 cb
8010 ) {
8011 var ref = getTransitionInfo(el, expectedType);
8012 var type = ref.type;
8013 var timeout = ref.timeout;
8014 var propCount = ref.propCount;
8015 if (!type) { return cb() }
8016 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
8017 var ended = 0;
8018 var end = function () {
8019 el.removeEventListener(event, onEnd);
8020 cb();
8021 };
8022 var onEnd = function (e) {
8023 if (e.target === el) {
8024 if (++ended >= propCount) {
8025 end();
8026 }
8027 }
8028 };
8029 setTimeout(function () {
8030 if (ended < propCount) {
8031 end();
8032 }
8033 }, timeout + 1);
8034 el.addEventListener(event, onEnd);
8035 }
8036
8037 var transformRE = /\b(transform|all)(,|$)/;
8038
8039 function getTransitionInfo (el, expectedType) {
8040 var styles = window.getComputedStyle(el);
8041 // JSDOM may return undefined for transition properties
8042 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
8043 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
8044 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
8045 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
8046 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
8047 var animationTimeout = getTimeout(animationDelays, animationDurations);
8048
8049 var type;
8050 var timeout = 0;
8051 var propCount = 0;
8052 /* istanbul ignore if */
8053 if (expectedType === TRANSITION) {
8054 if (transitionTimeout > 0) {
8055 type = TRANSITION;
8056 timeout = transitionTimeout;
8057 propCount = transitionDurations.length;
8058 }
8059 } else if (expectedType === ANIMATION) {
8060 if (animationTimeout > 0) {
8061 type = ANIMATION;
8062 timeout = animationTimeout;
8063 propCount = animationDurations.length;
8064 }
8065 } else {
8066 timeout = Math.max(transitionTimeout, animationTimeout);
8067 type = timeout > 0
8068 ? transitionTimeout > animationTimeout
8069 ? TRANSITION
8070 : ANIMATION
8071 : null;
8072 propCount = type
8073 ? type === TRANSITION
8074 ? transitionDurations.length
8075 : animationDurations.length
8076 : 0;
8077 }
8078 var hasTransform =
8079 type === TRANSITION &&
8080 transformRE.test(styles[transitionProp + 'Property']);
8081 return {
8082 type: type,
8083 timeout: timeout,
8084 propCount: propCount,
8085 hasTransform: hasTransform
8086 }
8087 }
8088
8089 function getTimeout (delays, durations) {
8090 /* istanbul ignore next */
8091 while (delays.length < durations.length) {
8092 delays = delays.concat(delays);
8093 }
8094
8095 return Math.max.apply(null, durations.map(function (d, i) {
8096 return toMs(d) + toMs(delays[i])
8097 }))
8098 }
8099
8100 // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
8101 // in a locale-dependent way, using a comma instead of a dot.
8102 // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
8103 // as a floor function) causing unexpected behaviors
8104 function toMs (s) {
8105 return Number(s.slice(0, -1).replace(',', '.')) * 1000
8106 }
8107
8108 /* */
8109
8110 function enter (vnode, toggleDisplay) {
8111 var el = vnode.elm;
8112
8113 // call leave callback now
8114 if (isDef(el._leaveCb)) {
8115 el._leaveCb.cancelled = true;
8116 el._leaveCb();
8117 }
8118
8119 var data = resolveTransition(vnode.data.transition);
8120 if (isUndef(data)) {
8121 return
8122 }
8123
8124 /* istanbul ignore if */
8125 if (isDef(el._enterCb) || el.nodeType !== 1) {
8126 return
8127 }
8128
8129 var css = data.css;
8130 var type = data.type;
8131 var enterClass = data.enterClass;
8132 var enterToClass = data.enterToClass;
8133 var enterActiveClass = data.enterActiveClass;
8134 var appearClass = data.appearClass;
8135 var appearToClass = data.appearToClass;
8136 var appearActiveClass = data.appearActiveClass;
8137 var beforeEnter = data.beforeEnter;
8138 var enter = data.enter;
8139 var afterEnter = data.afterEnter;
8140 var enterCancelled = data.enterCancelled;
8141 var beforeAppear = data.beforeAppear;
8142 var appear = data.appear;
8143 var afterAppear = data.afterAppear;
8144 var appearCancelled = data.appearCancelled;
8145 var duration = data.duration;
8146
8147 // activeInstance will always be the <transition> component managing this
8148 // transition. One edge case to check is when the <transition> is placed
8149 // as the root node of a child component. In that case we need to check
8150 // <transition>'s parent for appear check.
8151 var context = activeInstance;
8152 var transitionNode = activeInstance.$vnode;
8153 while (transitionNode && transitionNode.parent) {
8154 context = transitionNode.context;
8155 transitionNode = transitionNode.parent;
8156 }
8157
8158 var isAppear = !context._isMounted || !vnode.isRootInsert;
8159
8160 if (isAppear && !appear && appear !== '') {
8161 return
8162 }
8163
8164 var startClass = isAppear && appearClass
8165 ? appearClass
8166 : enterClass;
8167 var activeClass = isAppear && appearActiveClass
8168 ? appearActiveClass
8169 : enterActiveClass;
8170 var toClass = isAppear && appearToClass
8171 ? appearToClass
8172 : enterToClass;
8173
8174 var beforeEnterHook = isAppear
8175 ? (beforeAppear || beforeEnter)
8176 : beforeEnter;
8177 var enterHook = isAppear
8178 ? (typeof appear === 'function' ? appear : enter)
8179 : enter;
8180 var afterEnterHook = isAppear
8181 ? (afterAppear || afterEnter)
8182 : afterEnter;
8183 var enterCancelledHook = isAppear
8184 ? (appearCancelled || enterCancelled)
8185 : enterCancelled;
8186
8187 var explicitEnterDuration = toNumber(
8188 isObject(duration)
8189 ? duration.enter
8190 : duration
8191 );
8192
8193 if (explicitEnterDuration != null) {
8194 checkDuration(explicitEnterDuration, 'enter', vnode);
8195 }
8196
8197 var expectsCSS = css !== false && !isIE9;
8198 var userWantsControl = getHookArgumentsLength(enterHook);
8199
8200 var cb = el._enterCb = once(function () {
8201 if (expectsCSS) {
8202 removeTransitionClass(el, toClass);
8203 removeTransitionClass(el, activeClass);
8204 }
8205 if (cb.cancelled) {
8206 if (expectsCSS) {
8207 removeTransitionClass(el, startClass);
8208 }
8209 enterCancelledHook && enterCancelledHook(el);
8210 } else {
8211 afterEnterHook && afterEnterHook(el);
8212 }
8213 el._enterCb = null;
8214 });
8215
8216 if (!vnode.data.show) {
8217 // remove pending leave element on enter by injecting an insert hook
8218 mergeVNodeHook(vnode, 'insert', function () {
8219 var parent = el.parentNode;
8220 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
8221 if (pendingNode &&
8222 pendingNode.tag === vnode.tag &&
8223 pendingNode.elm._leaveCb
8224 ) {
8225 pendingNode.elm._leaveCb();
8226 }
8227 enterHook && enterHook(el, cb);
8228 });
8229 }
8230
8231 // start enter transition
8232 beforeEnterHook && beforeEnterHook(el);
8233 if (expectsCSS) {
8234 addTransitionClass(el, startClass);
8235 addTransitionClass(el, activeClass);
8236 nextFrame(function () {
8237 removeTransitionClass(el, startClass);
8238 if (!cb.cancelled) {
8239 addTransitionClass(el, toClass);
8240 if (!userWantsControl) {
8241 if (isValidDuration(explicitEnterDuration)) {
8242 setTimeout(cb, explicitEnterDuration);
8243 } else {
8244 whenTransitionEnds(el, type, cb);
8245 }
8246 }
8247 }
8248 });
8249 }
8250
8251 if (vnode.data.show) {
8252 toggleDisplay && toggleDisplay();
8253 enterHook && enterHook(el, cb);
8254 }
8255
8256 if (!expectsCSS && !userWantsControl) {
8257 cb();
8258 }
8259 }
8260
8261 function leave (vnode, rm) {
8262 var el = vnode.elm;
8263
8264 // call enter callback now
8265 if (isDef(el._enterCb)) {
8266 el._enterCb.cancelled = true;
8267 el._enterCb();
8268 }
8269
8270 var data = resolveTransition(vnode.data.transition);
8271 if (isUndef(data) || el.nodeType !== 1) {
8272 return rm()
8273 }
8274
8275 /* istanbul ignore if */
8276 if (isDef(el._leaveCb)) {
8277 return
8278 }
8279
8280 var css = data.css;
8281 var type = data.type;
8282 var leaveClass = data.leaveClass;
8283 var leaveToClass = data.leaveToClass;
8284 var leaveActiveClass = data.leaveActiveClass;
8285 var beforeLeave = data.beforeLeave;
8286 var leave = data.leave;
8287 var afterLeave = data.afterLeave;
8288 var leaveCancelled = data.leaveCancelled;
8289 var delayLeave = data.delayLeave;
8290 var duration = data.duration;
8291
8292 var expectsCSS = css !== false && !isIE9;
8293 var userWantsControl = getHookArgumentsLength(leave);
8294
8295 var explicitLeaveDuration = toNumber(
8296 isObject(duration)
8297 ? duration.leave
8298 : duration
8299 );
8300
8301 if (isDef(explicitLeaveDuration)) {
8302 checkDuration(explicitLeaveDuration, 'leave', vnode);
8303 }
8304
8305 var cb = el._leaveCb = once(function () {
8306 if (el.parentNode && el.parentNode._pending) {
8307 el.parentNode._pending[vnode.key] = null;
8308 }
8309 if (expectsCSS) {
8310 removeTransitionClass(el, leaveToClass);
8311 removeTransitionClass(el, leaveActiveClass);
8312 }
8313 if (cb.cancelled) {
8314 if (expectsCSS) {
8315 removeTransitionClass(el, leaveClass);
8316 }
8317 leaveCancelled && leaveCancelled(el);
8318 } else {
8319 rm();
8320 afterLeave && afterLeave(el);
8321 }
8322 el._leaveCb = null;
8323 });
8324
8325 if (delayLeave) {
8326 delayLeave(performLeave);
8327 } else {
8328 performLeave();
8329 }
8330
8331 function performLeave () {
8332 // the delayed leave may have already been cancelled
8333 if (cb.cancelled) {
8334 return
8335 }
8336 // record leaving element
8337 if (!vnode.data.show && el.parentNode) {
8338 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
8339 }
8340 beforeLeave && beforeLeave(el);
8341 if (expectsCSS) {
8342 addTransitionClass(el, leaveClass);
8343 addTransitionClass(el, leaveActiveClass);
8344 nextFrame(function () {
8345 removeTransitionClass(el, leaveClass);
8346 if (!cb.cancelled) {
8347 addTransitionClass(el, leaveToClass);
8348 if (!userWantsControl) {
8349 if (isValidDuration(explicitLeaveDuration)) {
8350 setTimeout(cb, explicitLeaveDuration);
8351 } else {
8352 whenTransitionEnds(el, type, cb);
8353 }
8354 }
8355 }
8356 });
8357 }
8358 leave && leave(el, cb);
8359 if (!expectsCSS && !userWantsControl) {
8360 cb();
8361 }
8362 }
8363 }
8364
8365 // only used in dev mode
8366 function checkDuration (val, name, vnode) {
8367 if (typeof val !== 'number') {
8368 warn(
8369 "<transition> explicit " + name + " duration is not a valid number - " +
8370 "got " + (JSON.stringify(val)) + ".",
8371 vnode.context
8372 );
8373 } else if (isNaN(val)) {
8374 warn(
8375 "<transition> explicit " + name + " duration is NaN - " +
8376 'the duration expression might be incorrect.',
8377 vnode.context
8378 );
8379 }
8380 }
8381
8382 function isValidDuration (val) {
8383 return typeof val === 'number' && !isNaN(val)
8384 }
8385
8386 /**
8387 * Normalize a transition hook's argument length. The hook may be:
8388 * - a merged hook (invoker) with the original in .fns
8389 * - a wrapped component method (check ._length)
8390 * - a plain function (.length)
8391 */
8392 function getHookArgumentsLength (fn) {
8393 if (isUndef(fn)) {
8394 return false
8395 }
8396 var invokerFns = fn.fns;
8397 if (isDef(invokerFns)) {
8398 // invoker
8399 return getHookArgumentsLength(
8400 Array.isArray(invokerFns)
8401 ? invokerFns[0]
8402 : invokerFns
8403 )
8404 } else {
8405 return (fn._length || fn.length) > 1
8406 }
8407 }
8408
8409 function _enter (_, vnode) {
8410 if (vnode.data.show !== true) {
8411 enter(vnode);
8412 }
8413 }
8414
8415 var transition = inBrowser ? {
8416 create: _enter,
8417 activate: _enter,
8418 remove: function remove$$1 (vnode, rm) {
8419 /* istanbul ignore else */
8420 if (vnode.data.show !== true) {
8421 leave(vnode, rm);
8422 } else {
8423 rm();
8424 }
8425 }
8426 } : {};
8427
8428 var platformModules = [
8429 attrs,
8430 klass,
8431 events,
8432 domProps,
8433 style,
8434 transition
8435 ];
8436
8437 /* */
8438
8439 // the directive module should be applied last, after all
8440 // built-in modules have been applied.
8441 var modules = platformModules.concat(baseModules);
8442
8443 var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
8444
8445 /**
8446 * Not type checking this file because flow doesn't like attaching
8447 * properties to Elements.
8448 */
8449
8450 /* istanbul ignore if */
8451 if (isIE9) {
8452 // http://www.matts411.com/post/internet-explorer-9-oninput/
8453 document.addEventListener('selectionchange', function () {
8454 var el = document.activeElement;
8455 if (el && el.vmodel) {
8456 trigger(el, 'input');
8457 }
8458 });
8459 }
8460
8461 var directive = {
8462 inserted: function inserted (el, binding, vnode, oldVnode) {
8463 if (vnode.tag === 'select') {
8464 // #6903
8465 if (oldVnode.elm && !oldVnode.elm._vOptions) {
8466 mergeVNodeHook(vnode, 'postpatch', function () {
8467 directive.componentUpdated(el, binding, vnode);
8468 });
8469 } else {
8470 setSelected(el, binding, vnode.context);
8471 }
8472 el._vOptions = [].map.call(el.options, getValue);
8473 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8474 el._vModifiers = binding.modifiers;
8475 if (!binding.modifiers.lazy) {
8476 el.addEventListener('compositionstart', onCompositionStart);
8477 el.addEventListener('compositionend', onCompositionEnd);
8478 // Safari < 10.2 & UIWebView doesn't fire compositionend when
8479 // switching focus before confirming composition choice
8480 // this also fixes the issue where some browsers e.g. iOS Chrome
8481 // fires "change" instead of "input" on autocomplete.
8482 el.addEventListener('change', onCompositionEnd);
8483 /* istanbul ignore if */
8484 if (isIE9) {
8485 el.vmodel = true;
8486 }
8487 }
8488 }
8489 },
8490
8491 componentUpdated: function componentUpdated (el, binding, vnode) {
8492 if (vnode.tag === 'select') {
8493 setSelected(el, binding, vnode.context);
8494 // in case the options rendered by v-for have changed,
8495 // it's possible that the value is out-of-sync with the rendered options.
8496 // detect such cases and filter out values that no longer has a matching
8497 // option in the DOM.
8498 var prevOptions = el._vOptions;
8499 var curOptions = el._vOptions = [].map.call(el.options, getValue);
8500 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
8501 // trigger change event if
8502 // no matching option found for at least one value
8503 var needReset = el.multiple
8504 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
8505 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
8506 if (needReset) {
8507 trigger(el, 'change');
8508 }
8509 }
8510 }
8511 }
8512 };
8513
8514 function setSelected (el, binding, vm) {
8515 actuallySetSelected(el, binding, vm);
8516 /* istanbul ignore if */
8517 if (isIE || isEdge) {
8518 setTimeout(function () {
8519 actuallySetSelected(el, binding, vm);
8520 }, 0);
8521 }
8522 }
8523
8524 function actuallySetSelected (el, binding, vm) {
8525 var value = binding.value;
8526 var isMultiple = el.multiple;
8527 if (isMultiple && !Array.isArray(value)) {
8528 warn(
8529 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
8530 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
8531 vm
8532 );
8533 return
8534 }
8535 var selected, option;
8536 for (var i = 0, l = el.options.length; i < l; i++) {
8537 option = el.options[i];
8538 if (isMultiple) {
8539 selected = looseIndexOf(value, getValue(option)) > -1;
8540 if (option.selected !== selected) {
8541 option.selected = selected;
8542 }
8543 } else {
8544 if (looseEqual(getValue(option), value)) {
8545 if (el.selectedIndex !== i) {
8546 el.selectedIndex = i;
8547 }
8548 return
8549 }
8550 }
8551 }
8552 if (!isMultiple) {
8553 el.selectedIndex = -1;
8554 }
8555 }
8556
8557 function hasNoMatchingOption (value, options) {
8558 return options.every(function (o) { return !looseEqual(o, value); })
8559 }
8560
8561 function getValue (option) {
8562 return '_value' in option
8563 ? option._value
8564 : option.value
8565 }
8566
8567 function onCompositionStart (e) {
8568 e.target.composing = true;
8569 }
8570
8571 function onCompositionEnd (e) {
8572 // prevent triggering an input event for no reason
8573 if (!e.target.composing) { return }
8574 e.target.composing = false;
8575 trigger(e.target, 'input');
8576 }
8577
8578 function trigger (el, type) {
8579 var e = document.createEvent('HTMLEvents');
8580 e.initEvent(type, true, true);
8581 el.dispatchEvent(e);
8582 }
8583
8584 /* */
8585
8586 // recursively search for possible transition defined inside the component root
8587 function locateNode (vnode) {
8588 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
8589 ? locateNode(vnode.componentInstance._vnode)
8590 : vnode
8591 }
8592
8593 var show = {
8594 bind: function bind (el, ref, vnode) {
8595 var value = ref.value;
8596
8597 vnode = locateNode(vnode);
8598 var transition$$1 = vnode.data && vnode.data.transition;
8599 var originalDisplay = el.__vOriginalDisplay =
8600 el.style.display === 'none' ? '' : el.style.display;
8601 if (value && transition$$1) {
8602 vnode.data.show = true;
8603 enter(vnode, function () {
8604 el.style.display = originalDisplay;
8605 });
8606 } else {
8607 el.style.display = value ? originalDisplay : 'none';
8608 }
8609 },
8610
8611 update: function update (el, ref, vnode) {
8612 var value = ref.value;
8613 var oldValue = ref.oldValue;
8614
8615 /* istanbul ignore if */
8616 if (!value === !oldValue) { return }
8617 vnode = locateNode(vnode);
8618 var transition$$1 = vnode.data && vnode.data.transition;
8619 if (transition$$1) {
8620 vnode.data.show = true;
8621 if (value) {
8622 enter(vnode, function () {
8623 el.style.display = el.__vOriginalDisplay;
8624 });
8625 } else {
8626 leave(vnode, function () {
8627 el.style.display = 'none';
8628 });
8629 }
8630 } else {
8631 el.style.display = value ? el.__vOriginalDisplay : 'none';
8632 }
8633 },
8634
8635 unbind: function unbind (
8636 el,
8637 binding,
8638 vnode,
8639 oldVnode,
8640 isDestroy
8641 ) {
8642 if (!isDestroy) {
8643 el.style.display = el.__vOriginalDisplay;
8644 }
8645 }
8646 };
8647
8648 var platformDirectives = {
8649 model: directive,
8650 show: show
8651 };
8652
8653 /* */
8654
8655 var transitionProps = {
8656 name: String,
8657 appear: Boolean,
8658 css: Boolean,
8659 mode: String,
8660 type: String,
8661 enterClass: String,
8662 leaveClass: String,
8663 enterToClass: String,
8664 leaveToClass: String,
8665 enterActiveClass: String,
8666 leaveActiveClass: String,
8667 appearClass: String,
8668 appearActiveClass: String,
8669 appearToClass: String,
8670 duration: [Number, String, Object]
8671 };
8672
8673 // in case the child is also an abstract component, e.g. <keep-alive>
8674 // we want to recursively retrieve the real component to be rendered
8675 function getRealChild (vnode) {
8676 var compOptions = vnode && vnode.componentOptions;
8677 if (compOptions && compOptions.Ctor.options.abstract) {
8678 return getRealChild(getFirstComponentChild(compOptions.children))
8679 } else {
8680 return vnode
8681 }
8682 }
8683
8684 function extractTransitionData (comp) {
8685 var data = {};
8686 var options = comp.$options;
8687 // props
8688 for (var key in options.propsData) {
8689 data[key] = comp[key];
8690 }
8691 // events.
8692 // extract listeners and pass them directly to the transition methods
8693 var listeners = options._parentListeners;
8694 for (var key$1 in listeners) {
8695 data[camelize(key$1)] = listeners[key$1];
8696 }
8697 return data
8698 }
8699
8700 function placeholder (h, rawChild) {
8701 if (/\d-keep-alive$/.test(rawChild.tag)) {
8702 return h('keep-alive', {
8703 props: rawChild.componentOptions.propsData
8704 })
8705 }
8706 }
8707
8708 function hasParentTransition (vnode) {
8709 while ((vnode = vnode.parent)) {
8710 if (vnode.data.transition) {
8711 return true
8712 }
8713 }
8714 }
8715
8716 function isSameChild (child, oldChild) {
8717 return oldChild.key === child.key && oldChild.tag === child.tag
8718 }
8719
8720 var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8721
8722 var isVShowDirective = function (d) { return d.name === 'show'; };
8723
8724 var Transition = {
8725 name: 'transition',
8726 props: transitionProps,
8727 abstract: true,
8728
8729 render: function render (h) {
8730 var this$1 = this;
8731
8732 var children = this.$slots.default;
8733 if (!children) {
8734 return
8735 }
8736
8737 // filter out text nodes (possible whitespaces)
8738 children = children.filter(isNotTextNode);
8739 /* istanbul ignore if */
8740 if (!children.length) {
8741 return
8742 }
8743
8744 // warn multiple elements
8745 if (children.length > 1) {
8746 warn(
8747 '<transition> can only be used on a single element. Use ' +
8748 '<transition-group> for lists.',
8749 this.$parent
8750 );
8751 }
8752
8753 var mode = this.mode;
8754
8755 // warn invalid mode
8756 if (mode && mode !== 'in-out' && mode !== 'out-in'
8757 ) {
8758 warn(
8759 'invalid <transition> mode: ' + mode,
8760 this.$parent
8761 );
8762 }
8763
8764 var rawChild = children[0];
8765
8766 // if this is a component root node and the component's
8767 // parent container node also has transition, skip.
8768 if (hasParentTransition(this.$vnode)) {
8769 return rawChild
8770 }
8771
8772 // apply transition data to child
8773 // use getRealChild() to ignore abstract components e.g. keep-alive
8774 var child = getRealChild(rawChild);
8775 /* istanbul ignore if */
8776 if (!child) {
8777 return rawChild
8778 }
8779
8780 if (this._leaving) {
8781 return placeholder(h, rawChild)
8782 }
8783
8784 // ensure a key that is unique to the vnode type and to this transition
8785 // component instance. This key will be used to remove pending leaving nodes
8786 // during entering.
8787 var id = "__transition-" + (this._uid) + "-";
8788 child.key = child.key == null
8789 ? child.isComment
8790 ? id + 'comment'
8791 : id + child.tag
8792 : isPrimitive(child.key)
8793 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8794 : child.key;
8795
8796 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8797 var oldRawChild = this._vnode;
8798 var oldChild = getRealChild(oldRawChild);
8799
8800 // mark v-show
8801 // so that the transition module can hand over the control to the directive
8802 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8803 child.data.show = true;
8804 }
8805
8806 if (
8807 oldChild &&
8808 oldChild.data &&
8809 !isSameChild(child, oldChild) &&
8810 !isAsyncPlaceholder(oldChild) &&
8811 // #6687 component root is a comment node
8812 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8813 ) {
8814 // replace old child transition data with fresh one
8815 // important for dynamic transitions!
8816 var oldData = oldChild.data.transition = extend({}, data);
8817 // handle transition mode
8818 if (mode === 'out-in') {
8819 // return placeholder node and queue update when leave finishes
8820 this._leaving = true;
8821 mergeVNodeHook(oldData, 'afterLeave', function () {
8822 this$1._leaving = false;
8823 this$1.$forceUpdate();
8824 });
8825 return placeholder(h, rawChild)
8826 } else if (mode === 'in-out') {
8827 if (isAsyncPlaceholder(child)) {
8828 return oldRawChild
8829 }
8830 var delayedLeave;
8831 var performLeave = function () { delayedLeave(); };
8832 mergeVNodeHook(data, 'afterEnter', performLeave);
8833 mergeVNodeHook(data, 'enterCancelled', performLeave);
8834 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8835 }
8836 }
8837
8838 return rawChild
8839 }
8840 };
8841
8842 /* */
8843
8844 var props = extend({
8845 tag: String,
8846 moveClass: String
8847 }, transitionProps);
8848
8849 delete props.mode;
8850
8851 var TransitionGroup = {
8852 props: props,
8853
8854 beforeMount: function beforeMount () {
8855 var this$1 = this;
8856
8857 var update = this._update;
8858 this._update = function (vnode, hydrating) {
8859 var restoreActiveInstance = setActiveInstance(this$1);
8860 // force removing pass
8861 this$1.__patch__(
8862 this$1._vnode,
8863 this$1.kept,
8864 false, // hydrating
8865 true // removeOnly (!important, avoids unnecessary moves)
8866 );
8867 this$1._vnode = this$1.kept;
8868 restoreActiveInstance();
8869 update.call(this$1, vnode, hydrating);
8870 };
8871 },
8872
8873 render: function render (h) {
8874 var tag = this.tag || this.$vnode.data.tag || 'span';
8875 var map = Object.create(null);
8876 var prevChildren = this.prevChildren = this.children;
8877 var rawChildren = this.$slots.default || [];
8878 var children = this.children = [];
8879 var transitionData = extractTransitionData(this);
8880
8881 for (var i = 0; i < rawChildren.length; i++) {
8882 var c = rawChildren[i];
8883 if (c.tag) {
8884 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8885 children.push(c);
8886 map[c.key] = c
8887 ;(c.data || (c.data = {})).transition = transitionData;
8888 } else {
8889 var opts = c.componentOptions;
8890 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8891 warn(("<transition-group> children must be keyed: <" + name + ">"));
8892 }
8893 }
8894 }
8895
8896 if (prevChildren) {
8897 var kept = [];
8898 var removed = [];
8899 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8900 var c$1 = prevChildren[i$1];
8901 c$1.data.transition = transitionData;
8902 c$1.data.pos = c$1.elm.getBoundingClientRect();
8903 if (map[c$1.key]) {
8904 kept.push(c$1);
8905 } else {
8906 removed.push(c$1);
8907 }
8908 }
8909 this.kept = h(tag, null, kept);
8910 this.removed = removed;
8911 }
8912
8913 return h(tag, null, children)
8914 },
8915
8916 updated: function updated () {
8917 var children = this.prevChildren;
8918 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8919 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8920 return
8921 }
8922
8923 // we divide the work into three loops to avoid mixing DOM reads and writes
8924 // in each iteration - which helps prevent layout thrashing.
8925 children.forEach(callPendingCbs);
8926 children.forEach(recordPosition);
8927 children.forEach(applyTranslation);
8928
8929 // force reflow to put everything in position
8930 // assign to this to avoid being removed in tree-shaking
8931 // $flow-disable-line
8932 this._reflow = document.body.offsetHeight;
8933
8934 children.forEach(function (c) {
8935 if (c.data.moved) {
8936 var el = c.elm;
8937 var s = el.style;
8938 addTransitionClass(el, moveClass);
8939 s.transform = s.WebkitTransform = s.transitionDuration = '';
8940 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8941 if (e && e.target !== el) {
8942 return
8943 }
8944 if (!e || /transform$/.test(e.propertyName)) {
8945 el.removeEventListener(transitionEndEvent, cb);
8946 el._moveCb = null;
8947 removeTransitionClass(el, moveClass);
8948 }
8949 });
8950 }
8951 });
8952 },
8953
8954 methods: {
8955 hasMove: function hasMove (el, moveClass) {
8956 /* istanbul ignore if */
8957 if (!hasTransition) {
8958 return false
8959 }
8960 /* istanbul ignore if */
8961 if (this._hasMove) {
8962 return this._hasMove
8963 }
8964 // Detect whether an element with the move class applied has
8965 // CSS transitions. Since the element may be inside an entering
8966 // transition at this very moment, we make a clone of it and remove
8967 // all other transition classes applied to ensure only the move class
8968 // is applied.
8969 var clone = el.cloneNode();
8970 if (el._transitionClasses) {
8971 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8972 }
8973 addClass(clone, moveClass);
8974 clone.style.display = 'none';
8975 this.$el.appendChild(clone);
8976 var info = getTransitionInfo(clone);
8977 this.$el.removeChild(clone);
8978 return (this._hasMove = info.hasTransform)
8979 }
8980 }
8981 };
8982
8983 function callPendingCbs (c) {
8984 /* istanbul ignore if */
8985 if (c.elm._moveCb) {
8986 c.elm._moveCb();
8987 }
8988 /* istanbul ignore if */
8989 if (c.elm._enterCb) {
8990 c.elm._enterCb();
8991 }
8992 }
8993
8994 function recordPosition (c) {
8995 c.data.newPos = c.elm.getBoundingClientRect();
8996 }
8997
8998 function applyTranslation (c) {
8999 var oldPos = c.data.pos;
9000 var newPos = c.data.newPos;
9001 var dx = oldPos.left - newPos.left;
9002 var dy = oldPos.top - newPos.top;
9003 if (dx || dy) {
9004 c.data.moved = true;
9005 var s = c.elm.style;
9006 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
9007 s.transitionDuration = '0s';
9008 }
9009 }
9010
9011 var platformComponents = {
9012 Transition: Transition,
9013 TransitionGroup: TransitionGroup
9014 };
9015
9016 /* */
9017
9018 // install platform specific utils
9019 Vue.config.mustUseProp = mustUseProp;
9020 Vue.config.isReservedTag = isReservedTag;
9021 Vue.config.isReservedAttr = isReservedAttr;
9022 Vue.config.getTagNamespace = getTagNamespace;
9023 Vue.config.isUnknownElement = isUnknownElement;
9024
9025 // install platform runtime directives & components
9026 extend(Vue.options.directives, platformDirectives);
9027 extend(Vue.options.components, platformComponents);
9028
9029 // install platform patch function
9030 Vue.prototype.__patch__ = inBrowser ? patch : noop;
9031
9032 // public mount method
9033 Vue.prototype.$mount = function (
9034 el,
9035 hydrating
9036 ) {
9037 el = el && inBrowser ? query(el) : undefined;
9038 return mountComponent(this, el, hydrating)
9039 };
9040
9041 // devtools global hook
9042 /* istanbul ignore next */
9043 if (inBrowser) {
9044 setTimeout(function () {
9045 if (config.devtools) {
9046 if (devtools) {
9047 devtools.emit('init', Vue);
9048 } else {
9049 console[console.info ? 'info' : 'log'](
9050 'Download the Vue Devtools extension for a better development experience:\n' +
9051 'https://github.com/vuejs/vue-devtools'
9052 );
9053 }
9054 }
9055 if (config.productionTip !== false &&
9056 typeof console !== 'undefined'
9057 ) {
9058 console[console.info ? 'info' : 'log'](
9059 "You are running Vue in development mode.\n" +
9060 "Make sure to turn on production mode when deploying for production.\n" +
9061 "See more tips at https://vuejs.org/guide/deployment.html"
9062 );
9063 }
9064 }, 0);
9065 }
9066
9067 /* */
9068
9069 var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
9070 var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
9071
9072 var buildRegex = cached(function (delimiters) {
9073 var open = delimiters[0].replace(regexEscapeRE, '\\$&');
9074 var close = delimiters[1].replace(regexEscapeRE, '\\$&');
9075 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
9076 });
9077
9078
9079
9080 function parseText (
9081 text,
9082 delimiters
9083 ) {
9084 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
9085 if (!tagRE.test(text)) {
9086 return
9087 }
9088 var tokens = [];
9089 var rawTokens = [];
9090 var lastIndex = tagRE.lastIndex = 0;
9091 var match, index, tokenValue;
9092 while ((match = tagRE.exec(text))) {
9093 index = match.index;
9094 // push text token
9095 if (index > lastIndex) {
9096 rawTokens.push(tokenValue = text.slice(lastIndex, index));
9097 tokens.push(JSON.stringify(tokenValue));
9098 }
9099 // tag token
9100 var exp = parseFilters(match[1].trim());
9101 tokens.push(("_s(" + exp + ")"));
9102 rawTokens.push({ '@binding': exp });
9103 lastIndex = index + match[0].length;
9104 }
9105 if (lastIndex < text.length) {
9106 rawTokens.push(tokenValue = text.slice(lastIndex));
9107 tokens.push(JSON.stringify(tokenValue));
9108 }
9109 return {
9110 expression: tokens.join('+'),
9111 tokens: rawTokens
9112 }
9113 }
9114
9115 /* */
9116
9117 function transformNode (el, options) {
9118 var warn = options.warn || baseWarn;
9119 var staticClass = getAndRemoveAttr(el, 'class');
9120 if (staticClass) {
9121 var res = parseText(staticClass, options.delimiters);
9122 if (res) {
9123 warn(
9124 "class=\"" + staticClass + "\": " +
9125 'Interpolation inside attributes has been removed. ' +
9126 'Use v-bind or the colon shorthand instead. For example, ' +
9127 'instead of <div class="{{ val }}">, use <div :class="val">.',
9128 el.rawAttrsMap['class']
9129 );
9130 }
9131 }
9132 if (staticClass) {
9133 el.staticClass = JSON.stringify(staticClass);
9134 }
9135 var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
9136 if (classBinding) {
9137 el.classBinding = classBinding;
9138 }
9139 }
9140
9141 function genData (el) {
9142 var data = '';
9143 if (el.staticClass) {
9144 data += "staticClass:" + (el.staticClass) + ",";
9145 }
9146 if (el.classBinding) {
9147 data += "class:" + (el.classBinding) + ",";
9148 }
9149 return data
9150 }
9151
9152 var klass$1 = {
9153 staticKeys: ['staticClass'],
9154 transformNode: transformNode,
9155 genData: genData
9156 };
9157
9158 /* */
9159
9160 function transformNode$1 (el, options) {
9161 var warn = options.warn || baseWarn;
9162 var staticStyle = getAndRemoveAttr(el, 'style');
9163 if (staticStyle) {
9164 /* istanbul ignore if */
9165 {
9166 var res = parseText(staticStyle, options.delimiters);
9167 if (res) {
9168 warn(
9169 "style=\"" + staticStyle + "\": " +
9170 'Interpolation inside attributes has been removed. ' +
9171 'Use v-bind or the colon shorthand instead. For example, ' +
9172 'instead of <div style="{{ val }}">, use <div :style="val">.',
9173 el.rawAttrsMap['style']
9174 );
9175 }
9176 }
9177 el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9178 }
9179
9180 var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
9181 if (styleBinding) {
9182 el.styleBinding = styleBinding;
9183 }
9184 }
9185
9186 function genData$1 (el) {
9187 var data = '';
9188 if (el.staticStyle) {
9189 data += "staticStyle:" + (el.staticStyle) + ",";
9190 }
9191 if (el.styleBinding) {
9192 data += "style:(" + (el.styleBinding) + "),";
9193 }
9194 return data
9195 }
9196
9197 var style$1 = {
9198 staticKeys: ['staticStyle'],
9199 transformNode: transformNode$1,
9200 genData: genData$1
9201 };
9202
9203 /* */
9204
9205 var decoder;
9206
9207 var he = {
9208 decode: function decode (html) {
9209 decoder = decoder || document.createElement('div');
9210 decoder.innerHTML = html;
9211 return decoder.textContent
9212 }
9213 };
9214
9215 /* */
9216
9217 var isUnaryTag = makeMap(
9218 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
9219 'link,meta,param,source,track,wbr'
9220 );
9221
9222 // Elements that you can, intentionally, leave open
9223 // (and which close themselves)
9224 var canBeLeftOpenTag = makeMap(
9225 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
9226 );
9227
9228 // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
9229 // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
9230 var isNonPhrasingTag = makeMap(
9231 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
9232 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
9233 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
9234 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
9235 'title,tr,track'
9236 );
9237
9238 /**
9239 * Not type-checking this file because it's mostly vendor code.
9240 */
9241
9242 // Regular Expressions for parsing tags and attributes
9243 var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9244 var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9245 var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
9246 var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9247 var startTagOpen = new RegExp(("^<" + qnameCapture));
9248 var startTagClose = /^\s*(\/?)>/;
9249 var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9250 var doctype = /^<!DOCTYPE [^>]+>/i;
9251 // #7298: escape - to avoid being pased as HTML comment when inlined in page
9252 var comment = /^<!\--/;
9253 var conditionalComment = /^<!\[/;
9254
9255 // Special Elements (can contain anything)
9256 var isPlainTextElement = makeMap('script,style,textarea', true);
9257 var reCache = {};
9258
9259 var decodingMap = {
9260 '&lt;': '<',
9261 '&gt;': '>',
9262 '&quot;': '"',
9263 '&amp;': '&',
9264 '&#10;': '\n',
9265 '&#9;': '\t',
9266 '&#39;': "'"
9267 };
9268 var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
9269 var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
9270
9271 // #5992
9272 var isIgnoreNewlineTag = makeMap('pre,textarea', true);
9273 var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
9274
9275 function decodeAttr (value, shouldDecodeNewlines) {
9276 var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
9277 return value.replace(re, function (match) { return decodingMap[match]; })
9278 }
9279
9280 function parseHTML (html, options) {
9281 var stack = [];
9282 var expectHTML = options.expectHTML;
9283 var isUnaryTag$$1 = options.isUnaryTag || no;
9284 var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
9285 var index = 0;
9286 var last, lastTag;
9287 while (html) {
9288 last = html;
9289 // Make sure we're not in a plaintext content element like script/style
9290 if (!lastTag || !isPlainTextElement(lastTag)) {
9291 var textEnd = html.indexOf('<');
9292 if (textEnd === 0) {
9293 // Comment:
9294 if (comment.test(html)) {
9295 var commentEnd = html.indexOf('-->');
9296
9297 if (commentEnd >= 0) {
9298 if (options.shouldKeepComment) {
9299 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9300 }
9301 advance(commentEnd + 3);
9302 continue
9303 }
9304 }
9305
9306 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9307 if (conditionalComment.test(html)) {
9308 var conditionalEnd = html.indexOf(']>');
9309
9310 if (conditionalEnd >= 0) {
9311 advance(conditionalEnd + 2);
9312 continue
9313 }
9314 }
9315
9316 // Doctype:
9317 var doctypeMatch = html.match(doctype);
9318 if (doctypeMatch) {
9319 advance(doctypeMatch[0].length);
9320 continue
9321 }
9322
9323 // End tag:
9324 var endTagMatch = html.match(endTag);
9325 if (endTagMatch) {
9326 var curIndex = index;
9327 advance(endTagMatch[0].length);
9328 parseEndTag(endTagMatch[1], curIndex, index);
9329 continue
9330 }
9331
9332 // Start tag:
9333 var startTagMatch = parseStartTag();
9334 if (startTagMatch) {
9335 handleStartTag(startTagMatch);
9336 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9337 advance(1);
9338 }
9339 continue
9340 }
9341 }
9342
9343 var text = (void 0), rest = (void 0), next = (void 0);
9344 if (textEnd >= 0) {
9345 rest = html.slice(textEnd);
9346 while (
9347 !endTag.test(rest) &&
9348 !startTagOpen.test(rest) &&
9349 !comment.test(rest) &&
9350 !conditionalComment.test(rest)
9351 ) {
9352 // < in plain text, be forgiving and treat it as text
9353 next = rest.indexOf('<', 1);
9354 if (next < 0) { break }
9355 textEnd += next;
9356 rest = html.slice(textEnd);
9357 }
9358 text = html.substring(0, textEnd);
9359 }
9360
9361 if (textEnd < 0) {
9362 text = html;
9363 }
9364
9365 if (text) {
9366 advance(text.length);
9367 }
9368
9369 if (options.chars && text) {
9370 options.chars(text, index - text.length, index);
9371 }
9372 } else {
9373 var endTagLength = 0;
9374 var stackedTag = lastTag.toLowerCase();
9375 var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
9376 var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
9377 endTagLength = endTag.length;
9378 if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
9379 text = text
9380 .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
9381 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
9382 }
9383 if (shouldIgnoreFirstNewline(stackedTag, text)) {
9384 text = text.slice(1);
9385 }
9386 if (options.chars) {
9387 options.chars(text);
9388 }
9389 return ''
9390 });
9391 index += html.length - rest$1.length;
9392 html = rest$1;
9393 parseEndTag(stackedTag, index - endTagLength, index);
9394 }
9395
9396 if (html === last) {
9397 options.chars && options.chars(html);
9398 if (!stack.length && options.warn) {
9399 options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
9400 }
9401 break
9402 }
9403 }
9404
9405 // Clean up any remaining tags
9406 parseEndTag();
9407
9408 function advance (n) {
9409 index += n;
9410 html = html.substring(n);
9411 }
9412
9413 function parseStartTag () {
9414 var start = html.match(startTagOpen);
9415 if (start) {
9416 var match = {
9417 tagName: start[1],
9418 attrs: [],
9419 start: index
9420 };
9421 advance(start[0].length);
9422 var end, attr;
9423 while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
9424 attr.start = index;
9425 advance(attr[0].length);
9426 attr.end = index;
9427 match.attrs.push(attr);
9428 }
9429 if (end) {
9430 match.unarySlash = end[1];
9431 advance(end[0].length);
9432 match.end = index;
9433 return match
9434 }
9435 }
9436 }
9437
9438 function handleStartTag (match) {
9439 var tagName = match.tagName;
9440 var unarySlash = match.unarySlash;
9441
9442 if (expectHTML) {
9443 if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
9444 parseEndTag(lastTag);
9445 }
9446 if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
9447 parseEndTag(tagName);
9448 }
9449 }
9450
9451 var unary = isUnaryTag$$1(tagName) || !!unarySlash;
9452
9453 var l = match.attrs.length;
9454 var attrs = new Array(l);
9455 for (var i = 0; i < l; i++) {
9456 var args = match.attrs[i];
9457 var value = args[3] || args[4] || args[5] || '';
9458 var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
9459 ? options.shouldDecodeNewlinesForHref
9460 : options.shouldDecodeNewlines;
9461 attrs[i] = {
9462 name: args[1],
9463 value: decodeAttr(value, shouldDecodeNewlines)
9464 };
9465 if (options.outputSourceRange) {
9466 attrs[i].start = args.start + args[0].match(/^\s*/).length;
9467 attrs[i].end = args.end;
9468 }
9469 }
9470
9471 if (!unary) {
9472 stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
9473 lastTag = tagName;
9474 }
9475
9476 if (options.start) {
9477 options.start(tagName, attrs, unary, match.start, match.end);
9478 }
9479 }
9480
9481 function parseEndTag (tagName, start, end) {
9482 var pos, lowerCasedTagName;
9483 if (start == null) { start = index; }
9484 if (end == null) { end = index; }
9485
9486 // Find the closest opened tag of the same type
9487 if (tagName) {
9488 lowerCasedTagName = tagName.toLowerCase();
9489 for (pos = stack.length - 1; pos >= 0; pos--) {
9490 if (stack[pos].lowerCasedTag === lowerCasedTagName) {
9491 break
9492 }
9493 }
9494 } else {
9495 // If no tag name is provided, clean shop
9496 pos = 0;
9497 }
9498
9499 if (pos >= 0) {
9500 // Close all the open elements, up the stack
9501 for (var i = stack.length - 1; i >= pos; i--) {
9502 if (i > pos || !tagName &&
9503 options.warn
9504 ) {
9505 options.warn(
9506 ("tag <" + (stack[i].tag) + "> has no matching end tag."),
9507 { start: stack[i].start, end: stack[i].end }
9508 );
9509 }
9510 if (options.end) {
9511 options.end(stack[i].tag, start, end);
9512 }
9513 }
9514
9515 // Remove the open elements from the stack
9516 stack.length = pos;
9517 lastTag = pos && stack[pos - 1].tag;
9518 } else if (lowerCasedTagName === 'br') {
9519 if (options.start) {
9520 options.start(tagName, [], true, start, end);
9521 }
9522 } else if (lowerCasedTagName === 'p') {
9523 if (options.start) {
9524 options.start(tagName, [], false, start, end);
9525 }
9526 if (options.end) {
9527 options.end(tagName, start, end);
9528 }
9529 }
9530 }
9531 }
9532
9533 /* */
9534
9535 var onRE = /^@|^v-on:/;
9536 var dirRE = /^v-|^@|^:/;
9537 var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9538 var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9539 var stripParensRE = /^\(|\)$/g;
9540 var dynamicArgRE = /^\[.*\]$/;
9541
9542 var argRE = /:(.*)$/;
9543 var bindRE = /^:|^\.|^v-bind:/;
9544 var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9545
9546 var slotRE = /^v-slot(:|$)|^#/;
9547
9548 var lineBreakRE = /[\r\n]/;
9549 var whitespaceRE$1 = /\s+/g;
9550
9551 var invalidAttributeRE = /[\s"'<>\/=]/;
9552
9553 var decodeHTMLCached = cached(he.decode);
9554
9555 var emptySlotScopeToken = "_empty_";
9556
9557 // configurable state
9558 var warn$2;
9559 var delimiters;
9560 var transforms;
9561 var preTransforms;
9562 var postTransforms;
9563 var platformIsPreTag;
9564 var platformMustUseProp;
9565 var platformGetTagNamespace;
9566 var maybeComponent;
9567
9568 function createASTElement (
9569 tag,
9570 attrs,
9571 parent
9572 ) {
9573 return {
9574 type: 1,
9575 tag: tag,
9576 attrsList: attrs,
9577 attrsMap: makeAttrsMap(attrs),
9578 rawAttrsMap: {},
9579 parent: parent,
9580 children: []
9581 }
9582 }
9583
9584 /**
9585 * Convert HTML string to AST.
9586 */
9587 function parse (
9588 template,
9589 options
9590 ) {
9591 warn$2 = options.warn || baseWarn;
9592
9593 platformIsPreTag = options.isPreTag || no;
9594 platformMustUseProp = options.mustUseProp || no;
9595 platformGetTagNamespace = options.getTagNamespace || no;
9596 var isReservedTag = options.isReservedTag || no;
9597 maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
9598
9599 transforms = pluckModuleFunction(options.modules, 'transformNode');
9600 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9601 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
9602
9603 delimiters = options.delimiters;
9604
9605 var stack = [];
9606 var preserveWhitespace = options.preserveWhitespace !== false;
9607 var whitespaceOption = options.whitespace;
9608 var root;
9609 var currentParent;
9610 var inVPre = false;
9611 var inPre = false;
9612 var warned = false;
9613
9614 function warnOnce (msg, range) {
9615 if (!warned) {
9616 warned = true;
9617 warn$2(msg, range);
9618 }
9619 }
9620
9621 function closeElement (element) {
9622 trimEndingWhitespace(element);
9623 if (!inVPre && !element.processed) {
9624 element = processElement(element, options);
9625 }
9626 // tree management
9627 if (!stack.length && element !== root) {
9628 // allow root elements with v-if, v-else-if and v-else
9629 if (root.if && (element.elseif || element.else)) {
9630 {
9631 checkRootConstraints(element);
9632 }
9633 addIfCondition(root, {
9634 exp: element.elseif,
9635 block: element
9636 });
9637 } else {
9638 warnOnce(
9639 "Component template should contain exactly one root element. " +
9640 "If you are using v-if on multiple elements, " +
9641 "use v-else-if to chain them instead.",
9642 { start: element.start }
9643 );
9644 }
9645 }
9646 if (currentParent && !element.forbidden) {
9647 if (element.elseif || element.else) {
9648 processIfConditions(element, currentParent);
9649 } else {
9650 if (element.slotScope) {
9651 // scoped slot
9652 // keep it in the children list so that v-else(-if) conditions can
9653 // find it as the prev node.
9654 var name = element.slotTarget || '"default"'
9655 ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
9656 }
9657 currentParent.children.push(element);
9658 element.parent = currentParent;
9659 }
9660 }
9661
9662 // final children cleanup
9663 // filter out scoped slots
9664 element.children = element.children.filter(function (c) { return !(c).slotScope; });
9665 // remove trailing whitespace node again
9666 trimEndingWhitespace(element);
9667
9668 // check pre state
9669 if (element.pre) {
9670 inVPre = false;
9671 }
9672 if (platformIsPreTag(element.tag)) {
9673 inPre = false;
9674 }
9675 // apply post-transforms
9676 for (var i = 0; i < postTransforms.length; i++) {
9677 postTransforms[i](element, options);
9678 }
9679 }
9680
9681 function trimEndingWhitespace (el) {
9682 // remove trailing whitespace node
9683 if (!inPre) {
9684 var lastNode;
9685 while (
9686 (lastNode = el.children[el.children.length - 1]) &&
9687 lastNode.type === 3 &&
9688 lastNode.text === ' '
9689 ) {
9690 el.children.pop();
9691 }
9692 }
9693 }
9694
9695 function checkRootConstraints (el) {
9696 if (el.tag === 'slot' || el.tag === 'template') {
9697 warnOnce(
9698 "Cannot use <" + (el.tag) + "> as component root element because it may " +
9699 'contain multiple nodes.',
9700 { start: el.start }
9701 );
9702 }
9703 if (el.attrsMap.hasOwnProperty('v-for')) {
9704 warnOnce(
9705 'Cannot use v-for on stateful component root element because ' +
9706 'it renders multiple elements.',
9707 el.rawAttrsMap['v-for']
9708 );
9709 }
9710 }
9711
9712 parseHTML(template, {
9713 warn: warn$2,
9714 expectHTML: options.expectHTML,
9715 isUnaryTag: options.isUnaryTag,
9716 canBeLeftOpenTag: options.canBeLeftOpenTag,
9717 shouldDecodeNewlines: options.shouldDecodeNewlines,
9718 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9719 shouldKeepComment: options.comments,
9720 outputSourceRange: options.outputSourceRange,
9721 start: function start (tag, attrs, unary, start$1, end) {
9722 // check namespace.
9723 // inherit parent ns if there is one
9724 var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
9725
9726 // handle IE svg bug
9727 /* istanbul ignore if */
9728 if (isIE && ns === 'svg') {
9729 attrs = guardIESVGBug(attrs);
9730 }
9731
9732 var element = createASTElement(tag, attrs, currentParent);
9733 if (ns) {
9734 element.ns = ns;
9735 }
9736
9737 {
9738 if (options.outputSourceRange) {
9739 element.start = start$1;
9740 element.end = end;
9741 element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9742 cumulated[attr.name] = attr;
9743 return cumulated
9744 }, {});
9745 }
9746 attrs.forEach(function (attr) {
9747 if (invalidAttributeRE.test(attr.name)) {
9748 warn$2(
9749 "Invalid dynamic argument expression: attribute names cannot contain " +
9750 "spaces, quotes, <, >, / or =.",
9751 {
9752 start: attr.start + attr.name.indexOf("["),
9753 end: attr.start + attr.name.length
9754 }
9755 );
9756 }
9757 });
9758 }
9759
9760 if (isForbiddenTag(element) && !isServerRendering()) {
9761 element.forbidden = true;
9762 warn$2(
9763 'Templates should only be responsible for mapping the state to the ' +
9764 'UI. Avoid placing tags with side-effects in your templates, such as ' +
9765 "<" + tag + ">" + ', as they will not be parsed.',
9766 { start: element.start }
9767 );
9768 }
9769
9770 // apply pre-transforms
9771 for (var i = 0; i < preTransforms.length; i++) {
9772 element = preTransforms[i](element, options) || element;
9773 }
9774
9775 if (!inVPre) {
9776 processPre(element);
9777 if (element.pre) {
9778 inVPre = true;
9779 }
9780 }
9781 if (platformIsPreTag(element.tag)) {
9782 inPre = true;
9783 }
9784 if (inVPre) {
9785 processRawAttrs(element);
9786 } else if (!element.processed) {
9787 // structural directives
9788 processFor(element);
9789 processIf(element);
9790 processOnce(element);
9791 }
9792
9793 if (!root) {
9794 root = element;
9795 {
9796 checkRootConstraints(root);
9797 }
9798 }
9799
9800 if (!unary) {
9801 currentParent = element;
9802 stack.push(element);
9803 } else {
9804 closeElement(element);
9805 }
9806 },
9807
9808 end: function end (tag, start, end$1) {
9809 var element = stack[stack.length - 1];
9810 // pop stack
9811 stack.length -= 1;
9812 currentParent = stack[stack.length - 1];
9813 if (options.outputSourceRange) {
9814 element.end = end$1;
9815 }
9816 closeElement(element);
9817 },
9818
9819 chars: function chars (text, start, end) {
9820 if (!currentParent) {
9821 {
9822 if (text === template) {
9823 warnOnce(
9824 'Component template requires a root element, rather than just text.',
9825 { start: start }
9826 );
9827 } else if ((text = text.trim())) {
9828 warnOnce(
9829 ("text \"" + text + "\" outside root element will be ignored."),
9830 { start: start }
9831 );
9832 }
9833 }
9834 return
9835 }
9836 // IE textarea placeholder bug
9837 /* istanbul ignore if */
9838 if (isIE &&
9839 currentParent.tag === 'textarea' &&
9840 currentParent.attrsMap.placeholder === text
9841 ) {
9842 return
9843 }
9844 var children = currentParent.children;
9845 if (inPre || text.trim()) {
9846 text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
9847 } else if (!children.length) {
9848 // remove the whitespace-only node right after an opening tag
9849 text = '';
9850 } else if (whitespaceOption) {
9851 if (whitespaceOption === 'condense') {
9852 // in condense mode, remove the whitespace node if it contains
9853 // line break, otherwise condense to a single space
9854 text = lineBreakRE.test(text) ? '' : ' ';
9855 } else {
9856 text = ' ';
9857 }
9858 } else {
9859 text = preserveWhitespace ? ' ' : '';
9860 }
9861 if (text) {
9862 if (!inPre && whitespaceOption === 'condense') {
9863 // condense consecutive whitespaces into single space
9864 text = text.replace(whitespaceRE$1, ' ');
9865 }
9866 var res;
9867 var child;
9868 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
9869 child = {
9870 type: 2,
9871 expression: res.expression,
9872 tokens: res.tokens,
9873 text: text
9874 };
9875 } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
9876 child = {
9877 type: 3,
9878 text: text
9879 };
9880 }
9881 if (child) {
9882 if (options.outputSourceRange) {
9883 child.start = start;
9884 child.end = end;
9885 }
9886 children.push(child);
9887 }
9888 }
9889 },
9890 comment: function comment (text, start, end) {
9891 // adding anyting as a sibling to the root node is forbidden
9892 // comments should still be allowed, but ignored
9893 if (currentParent) {
9894 var child = {
9895 type: 3,
9896 text: text,
9897 isComment: true
9898 };
9899 if (options.outputSourceRange) {
9900 child.start = start;
9901 child.end = end;
9902 }
9903 currentParent.children.push(child);
9904 }
9905 }
9906 });
9907 return root
9908 }
9909
9910 function processPre (el) {
9911 if (getAndRemoveAttr(el, 'v-pre') != null) {
9912 el.pre = true;
9913 }
9914 }
9915
9916 function processRawAttrs (el) {
9917 var list = el.attrsList;
9918 var len = list.length;
9919 if (len) {
9920 var attrs = el.attrs = new Array(len);
9921 for (var i = 0; i < len; i++) {
9922 attrs[i] = {
9923 name: list[i].name,
9924 value: JSON.stringify(list[i].value)
9925 };
9926 if (list[i].start != null) {
9927 attrs[i].start = list[i].start;
9928 attrs[i].end = list[i].end;
9929 }
9930 }
9931 } else if (!el.pre) {
9932 // non root node in pre blocks with no attributes
9933 el.plain = true;
9934 }
9935 }
9936
9937 function processElement (
9938 element,
9939 options
9940 ) {
9941 processKey(element);
9942
9943 // determine whether this is a plain element after
9944 // removing structural attributes
9945 element.plain = (
9946 !element.key &&
9947 !element.scopedSlots &&
9948 !element.attrsList.length
9949 );
9950
9951 processRef(element);
9952 processSlotContent(element);
9953 processSlotOutlet(element);
9954 processComponent(element);
9955 for (var i = 0; i < transforms.length; i++) {
9956 element = transforms[i](element, options) || element;
9957 }
9958 processAttrs(element);
9959 return element
9960 }
9961
9962 function processKey (el) {
9963 var exp = getBindingAttr(el, 'key');
9964 if (exp) {
9965 {
9966 if (el.tag === 'template') {
9967 warn$2(
9968 "<template> cannot be keyed. Place the key on real elements instead.",
9969 getRawBindingAttr(el, 'key')
9970 );
9971 }
9972 if (el.for) {
9973 var iterator = el.iterator2 || el.iterator1;
9974 var parent = el.parent;
9975 if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
9976 warn$2(
9977 "Do not use v-for index as key on <transition-group> children, " +
9978 "this is the same as not using keys.",
9979 getRawBindingAttr(el, 'key'),
9980 true /* tip */
9981 );
9982 }
9983 }
9984 }
9985 el.key = exp;
9986 }
9987 }
9988
9989 function processRef (el) {
9990 var ref = getBindingAttr(el, 'ref');
9991 if (ref) {
9992 el.ref = ref;
9993 el.refInFor = checkInFor(el);
9994 }
9995 }
9996
9997 function processFor (el) {
9998 var exp;
9999 if ((exp = getAndRemoveAttr(el, 'v-for'))) {
10000 var res = parseFor(exp);
10001 if (res) {
10002 extend(el, res);
10003 } else {
10004 warn$2(
10005 ("Invalid v-for expression: " + exp),
10006 el.rawAttrsMap['v-for']
10007 );
10008 }
10009 }
10010 }
10011
10012
10013
10014 function parseFor (exp) {
10015 var inMatch = exp.match(forAliasRE);
10016 if (!inMatch) { return }
10017 var res = {};
10018 res.for = inMatch[2].trim();
10019 var alias = inMatch[1].trim().replace(stripParensRE, '');
10020 var iteratorMatch = alias.match(forIteratorRE);
10021 if (iteratorMatch) {
10022 res.alias = alias.replace(forIteratorRE, '').trim();
10023 res.iterator1 = iteratorMatch[1].trim();
10024 if (iteratorMatch[2]) {
10025 res.iterator2 = iteratorMatch[2].trim();
10026 }
10027 } else {
10028 res.alias = alias;
10029 }
10030 return res
10031 }
10032
10033 function processIf (el) {
10034 var exp = getAndRemoveAttr(el, 'v-if');
10035 if (exp) {
10036 el.if = exp;
10037 addIfCondition(el, {
10038 exp: exp,
10039 block: el
10040 });
10041 } else {
10042 if (getAndRemoveAttr(el, 'v-else') != null) {
10043 el.else = true;
10044 }
10045 var elseif = getAndRemoveAttr(el, 'v-else-if');
10046 if (elseif) {
10047 el.elseif = elseif;
10048 }
10049 }
10050 }
10051
10052 function processIfConditions (el, parent) {
10053 var prev = findPrevElement(parent.children);
10054 if (prev && prev.if) {
10055 addIfCondition(prev, {
10056 exp: el.elseif,
10057 block: el
10058 });
10059 } else {
10060 warn$2(
10061 "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
10062 "used on element <" + (el.tag) + "> without corresponding v-if.",
10063 el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
10064 );
10065 }
10066 }
10067
10068 function findPrevElement (children) {
10069 var i = children.length;
10070 while (i--) {
10071 if (children[i].type === 1) {
10072 return children[i]
10073 } else {
10074 if (children[i].text !== ' ') {
10075 warn$2(
10076 "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
10077 "will be ignored.",
10078 children[i]
10079 );
10080 }
10081 children.pop();
10082 }
10083 }
10084 }
10085
10086 function addIfCondition (el, condition) {
10087 if (!el.ifConditions) {
10088 el.ifConditions = [];
10089 }
10090 el.ifConditions.push(condition);
10091 }
10092
10093 function processOnce (el) {
10094 var once$$1 = getAndRemoveAttr(el, 'v-once');
10095 if (once$$1 != null) {
10096 el.once = true;
10097 }
10098 }
10099
10100 // handle content being passed to a component as slot,
10101 // e.g. <template slot="xxx">, <div slot-scope="xxx">
10102 function processSlotContent (el) {
10103 var slotScope;
10104 if (el.tag === 'template') {
10105 slotScope = getAndRemoveAttr(el, 'scope');
10106 /* istanbul ignore if */
10107 if (slotScope) {
10108 warn$2(
10109 "the \"scope\" attribute for scoped slots have been deprecated and " +
10110 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
10111 "can also be used on plain elements in addition to <template> to " +
10112 "denote scoped slots.",
10113 el.rawAttrsMap['scope'],
10114 true
10115 );
10116 }
10117 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
10118 } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
10119 /* istanbul ignore if */
10120 if (el.attrsMap['v-for']) {
10121 warn$2(
10122 "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
10123 "(v-for takes higher priority). Use a wrapper <template> for the " +
10124 "scoped slot to make it clearer.",
10125 el.rawAttrsMap['slot-scope'],
10126 true
10127 );
10128 }
10129 el.slotScope = slotScope;
10130 }
10131
10132 // slot="xxx"
10133 var slotTarget = getBindingAttr(el, 'slot');
10134 if (slotTarget) {
10135 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
10136 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
10137 // preserve slot as an attribute for native shadow DOM compat
10138 // only for non-scoped slots.
10139 if (el.tag !== 'template' && !el.slotScope) {
10140 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
10141 }
10142 }
10143
10144 // 2.6 v-slot syntax
10145 {
10146 if (el.tag === 'template') {
10147 // v-slot on <template>
10148 var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10149 if (slotBinding) {
10150 {
10151 if (el.slotTarget || el.slotScope) {
10152 warn$2(
10153 "Unexpected mixed usage of different slot syntaxes.",
10154 el
10155 );
10156 }
10157 if (el.parent && !maybeComponent(el.parent)) {
10158 warn$2(
10159 "<template v-slot> can only appear at the root level inside " +
10160 "the receiving the component",
10161 el
10162 );
10163 }
10164 }
10165 var ref = getSlotName(slotBinding);
10166 var name = ref.name;
10167 var dynamic = ref.dynamic;
10168 el.slotTarget = name;
10169 el.slotTargetDynamic = dynamic;
10170 el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
10171 }
10172 } else {
10173 // v-slot on component, denotes default slot
10174 var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
10175 if (slotBinding$1) {
10176 {
10177 if (!maybeComponent(el)) {
10178 warn$2(
10179 "v-slot can only be used on components or <template>.",
10180 slotBinding$1
10181 );
10182 }
10183 if (el.slotScope || el.slotTarget) {
10184 warn$2(
10185 "Unexpected mixed usage of different slot syntaxes.",
10186 el
10187 );
10188 }
10189 if (el.scopedSlots) {
10190 warn$2(
10191 "To avoid scope ambiguity, the default slot should also use " +
10192 "<template> syntax when there are other named slots.",
10193 slotBinding$1
10194 );
10195 }
10196 }
10197 // add the component's children to its default slot
10198 var slots = el.scopedSlots || (el.scopedSlots = {});
10199 var ref$1 = getSlotName(slotBinding$1);
10200 var name$1 = ref$1.name;
10201 var dynamic$1 = ref$1.dynamic;
10202 var slotContainer = slots[name$1] = createASTElement('template', [], el);
10203 slotContainer.slotTarget = name$1;
10204 slotContainer.slotTargetDynamic = dynamic$1;
10205 slotContainer.children = el.children.filter(function (c) {
10206 if (!c.slotScope) {
10207 c.parent = slotContainer;
10208 return true
10209 }
10210 });
10211 slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
10212 // remove children as they are returned from scopedSlots now
10213 el.children = [];
10214 // mark el non-plain so data gets generated
10215 el.plain = false;
10216 }
10217 }
10218 }
10219 }
10220
10221 function getSlotName (binding) {
10222 var name = binding.name.replace(slotRE, '');
10223 if (!name) {
10224 if (binding.name[0] !== '#') {
10225 name = 'default';
10226 } else {
10227 warn$2(
10228 "v-slot shorthand syntax requires a slot name.",
10229 binding
10230 );
10231 }
10232 }
10233 return dynamicArgRE.test(name)
10234 // dynamic [name]
10235 ? { name: name.slice(1, -1), dynamic: true }
10236 // static name
10237 : { name: ("\"" + name + "\""), dynamic: false }
10238 }
10239
10240 // handle <slot/> outlets
10241 function processSlotOutlet (el) {
10242 if (el.tag === 'slot') {
10243 el.slotName = getBindingAttr(el, 'name');
10244 if (el.key) {
10245 warn$2(
10246 "`key` does not work on <slot> because slots are abstract outlets " +
10247 "and can possibly expand into multiple elements. " +
10248 "Use the key on a wrapping element instead.",
10249 getRawBindingAttr(el, 'key')
10250 );
10251 }
10252 }
10253 }
10254
10255 function processComponent (el) {
10256 var binding;
10257 if ((binding = getBindingAttr(el, 'is'))) {
10258 el.component = binding;
10259 }
10260 if (getAndRemoveAttr(el, 'inline-template') != null) {
10261 el.inlineTemplate = true;
10262 }
10263 }
10264
10265 function processAttrs (el) {
10266 var list = el.attrsList;
10267 var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
10268 for (i = 0, l = list.length; i < l; i++) {
10269 name = rawName = list[i].name;
10270 value = list[i].value;
10271 if (dirRE.test(name)) {
10272 // mark element as dynamic
10273 el.hasBindings = true;
10274 // modifiers
10275 modifiers = parseModifiers(name.replace(dirRE, ''));
10276 // support .foo shorthand syntax for the .prop modifier
10277 if (modifiers) {
10278 name = name.replace(modifierRE, '');
10279 }
10280 if (bindRE.test(name)) { // v-bind
10281 name = name.replace(bindRE, '');
10282 value = parseFilters(value);
10283 isDynamic = dynamicArgRE.test(name);
10284 if (isDynamic) {
10285 name = name.slice(1, -1);
10286 }
10287 if (
10288 value.trim().length === 0
10289 ) {
10290 warn$2(
10291 ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
10292 );
10293 }
10294 if (modifiers) {
10295 if (modifiers.prop && !isDynamic) {
10296 name = camelize(name);
10297 if (name === 'innerHtml') { name = 'innerHTML'; }
10298 }
10299 if (modifiers.camel && !isDynamic) {
10300 name = camelize(name);
10301 }
10302 if (modifiers.sync) {
10303 syncGen = genAssignmentCode(value, "$event");
10304 if (!isDynamic) {
10305 addHandler(
10306 el,
10307 ("update:" + (camelize(name))),
10308 syncGen,
10309 null,
10310 false,
10311 warn$2,
10312 list[i]
10313 );
10314 if (hyphenate(name) !== camelize(name)) {
10315 addHandler(
10316 el,
10317 ("update:" + (hyphenate(name))),
10318 syncGen,
10319 null,
10320 false,
10321 warn$2,
10322 list[i]
10323 );
10324 }
10325 } else {
10326 // handler w/ dynamic event name
10327 addHandler(
10328 el,
10329 ("\"update:\"+(" + name + ")"),
10330 syncGen,
10331 null,
10332 false,
10333 warn$2,
10334 list[i],
10335 true // dynamic
10336 );
10337 }
10338 }
10339 }
10340 if ((modifiers && modifiers.prop) || (
10341 !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
10342 )) {
10343 addProp(el, name, value, list[i], isDynamic);
10344 } else {
10345 addAttr(el, name, value, list[i], isDynamic);
10346 }
10347 } else if (onRE.test(name)) { // v-on
10348 name = name.replace(onRE, '');
10349 isDynamic = dynamicArgRE.test(name);
10350 if (isDynamic) {
10351 name = name.slice(1, -1);
10352 }
10353 addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
10354 } else { // normal directives
10355 name = name.replace(dirRE, '');
10356 // parse arg
10357 var argMatch = name.match(argRE);
10358 var arg = argMatch && argMatch[1];
10359 isDynamic = false;
10360 if (arg) {
10361 name = name.slice(0, -(arg.length + 1));
10362 if (dynamicArgRE.test(arg)) {
10363 arg = arg.slice(1, -1);
10364 isDynamic = true;
10365 }
10366 }
10367 addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
10368 if (name === 'model') {
10369 checkForAliasModel(el, value);
10370 }
10371 }
10372 } else {
10373 // literal attribute
10374 {
10375 var res = parseText(value, delimiters);
10376 if (res) {
10377 warn$2(
10378 name + "=\"" + value + "\": " +
10379 'Interpolation inside attributes has been removed. ' +
10380 'Use v-bind or the colon shorthand instead. For example, ' +
10381 'instead of <div id="{{ val }}">, use <div :id="val">.',
10382 list[i]
10383 );
10384 }
10385 }
10386 addAttr(el, name, JSON.stringify(value), list[i]);
10387 // #6887 firefox doesn't update muted state if set via attribute
10388 // even immediately after element creation
10389 if (!el.component &&
10390 name === 'muted' &&
10391 platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10392 addProp(el, name, 'true', list[i]);
10393 }
10394 }
10395 }
10396 }
10397
10398 function checkInFor (el) {
10399 var parent = el;
10400 while (parent) {
10401 if (parent.for !== undefined) {
10402 return true
10403 }
10404 parent = parent.parent;
10405 }
10406 return false
10407 }
10408
10409 function parseModifiers (name) {
10410 var match = name.match(modifierRE);
10411 if (match) {
10412 var ret = {};
10413 match.forEach(function (m) { ret[m.slice(1)] = true; });
10414 return ret
10415 }
10416 }
10417
10418 function makeAttrsMap (attrs) {
10419 var map = {};
10420 for (var i = 0, l = attrs.length; i < l; i++) {
10421 if (
10422 map[attrs[i].name] && !isIE && !isEdge
10423 ) {
10424 warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
10425 }
10426 map[attrs[i].name] = attrs[i].value;
10427 }
10428 return map
10429 }
10430
10431 // for script (e.g. type="x/template") or style, do not decode content
10432 function isTextTag (el) {
10433 return el.tag === 'script' || el.tag === 'style'
10434 }
10435
10436 function isForbiddenTag (el) {
10437 return (
10438 el.tag === 'style' ||
10439 (el.tag === 'script' && (
10440 !el.attrsMap.type ||
10441 el.attrsMap.type === 'text/javascript'
10442 ))
10443 )
10444 }
10445
10446 var ieNSBug = /^xmlns:NS\d+/;
10447 var ieNSPrefix = /^NS\d+:/;
10448
10449 /* istanbul ignore next */
10450 function guardIESVGBug (attrs) {
10451 var res = [];
10452 for (var i = 0; i < attrs.length; i++) {
10453 var attr = attrs[i];
10454 if (!ieNSBug.test(attr.name)) {
10455 attr.name = attr.name.replace(ieNSPrefix, '');
10456 res.push(attr);
10457 }
10458 }
10459 return res
10460 }
10461
10462 function checkForAliasModel (el, value) {
10463 var _el = el;
10464 while (_el) {
10465 if (_el.for && _el.alias === value) {
10466 warn$2(
10467 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
10468 "You are binding v-model directly to a v-for iteration alias. " +
10469 "This will not be able to modify the v-for source array because " +
10470 "writing to the alias is like modifying a function local variable. " +
10471 "Consider using an array of objects and use v-model on an object property instead.",
10472 el.rawAttrsMap['v-model']
10473 );
10474 }
10475 _el = _el.parent;
10476 }
10477 }
10478
10479 /* */
10480
10481 function preTransformNode (el, options) {
10482 if (el.tag === 'input') {
10483 var map = el.attrsMap;
10484 if (!map['v-model']) {
10485 return
10486 }
10487
10488 var typeBinding;
10489 if (map[':type'] || map['v-bind:type']) {
10490 typeBinding = getBindingAttr(el, 'type');
10491 }
10492 if (!map.type && !typeBinding && map['v-bind']) {
10493 typeBinding = "(" + (map['v-bind']) + ").type";
10494 }
10495
10496 if (typeBinding) {
10497 var ifCondition = getAndRemoveAttr(el, 'v-if', true);
10498 var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
10499 var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
10500 var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
10501 // 1. checkbox
10502 var branch0 = cloneASTElement(el);
10503 // process for on the main node
10504 processFor(branch0);
10505 addRawAttr(branch0, 'type', 'checkbox');
10506 processElement(branch0, options);
10507 branch0.processed = true; // prevent it from double-processed
10508 branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
10509 addIfCondition(branch0, {
10510 exp: branch0.if,
10511 block: branch0
10512 });
10513 // 2. add radio else-if condition
10514 var branch1 = cloneASTElement(el);
10515 getAndRemoveAttr(branch1, 'v-for', true);
10516 addRawAttr(branch1, 'type', 'radio');
10517 processElement(branch1, options);
10518 addIfCondition(branch0, {
10519 exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
10520 block: branch1
10521 });
10522 // 3. other
10523 var branch2 = cloneASTElement(el);
10524 getAndRemoveAttr(branch2, 'v-for', true);
10525 addRawAttr(branch2, ':type', typeBinding);
10526 processElement(branch2, options);
10527 addIfCondition(branch0, {
10528 exp: ifCondition,
10529 block: branch2
10530 });
10531
10532 if (hasElse) {
10533 branch0.else = true;
10534 } else if (elseIfCondition) {
10535 branch0.elseif = elseIfCondition;
10536 }
10537
10538 return branch0
10539 }
10540 }
10541 }
10542
10543 function cloneASTElement (el) {
10544 return createASTElement(el.tag, el.attrsList.slice(), el.parent)
10545 }
10546
10547 var model$1 = {
10548 preTransformNode: preTransformNode
10549 };
10550
10551 var modules$1 = [
10552 klass$1,
10553 style$1,
10554 model$1
10555 ];
10556
10557 /* */
10558
10559 function text (el, dir) {
10560 if (dir.value) {
10561 addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
10562 }
10563 }
10564
10565 /* */
10566
10567 function html (el, dir) {
10568 if (dir.value) {
10569 addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
10570 }
10571 }
10572
10573 var directives$1 = {
10574 model: model,
10575 text: text,
10576 html: html
10577 };
10578
10579 /* */
10580
10581 var baseOptions = {
10582 expectHTML: true,
10583 modules: modules$1,
10584 directives: directives$1,
10585 isPreTag: isPreTag,
10586 isUnaryTag: isUnaryTag,
10587 mustUseProp: mustUseProp,
10588 canBeLeftOpenTag: canBeLeftOpenTag,
10589 isReservedTag: isReservedTag,
10590 getTagNamespace: getTagNamespace,
10591 staticKeys: genStaticKeys(modules$1)
10592 };
10593
10594 /* */
10595
10596 var isStaticKey;
10597 var isPlatformReservedTag;
10598
10599 var genStaticKeysCached = cached(genStaticKeys$1);
10600
10601 /**
10602 * Goal of the optimizer: walk the generated template AST tree
10603 * and detect sub-trees that are purely static, i.e. parts of
10604 * the DOM that never needs to change.
10605 *
10606 * Once we detect these sub-trees, we can:
10607 *
10608 * 1. Hoist them into constants, so that we no longer need to
10609 * create fresh nodes for them on each re-render;
10610 * 2. Completely skip them in the patching process.
10611 */
10612 function optimize (root, options) {
10613 if (!root) { return }
10614 isStaticKey = genStaticKeysCached(options.staticKeys || '');
10615 isPlatformReservedTag = options.isReservedTag || no;
10616 // first pass: mark all non-static nodes.
10617 markStatic$1(root);
10618 // second pass: mark static roots.
10619 markStaticRoots(root, false);
10620 }
10621
10622 function genStaticKeys$1 (keys) {
10623 return makeMap(
10624 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
10625 (keys ? ',' + keys : '')
10626 )
10627 }
10628
10629 function markStatic$1 (node) {
10630 node.static = isStatic(node);
10631 if (node.type === 1) {
10632 // do not make component slot content static. this avoids
10633 // 1. components not able to mutate slot nodes
10634 // 2. static slot content fails for hot-reloading
10635 if (
10636 !isPlatformReservedTag(node.tag) &&
10637 node.tag !== 'slot' &&
10638 node.attrsMap['inline-template'] == null
10639 ) {
10640 return
10641 }
10642 for (var i = 0, l = node.children.length; i < l; i++) {
10643 var child = node.children[i];
10644 markStatic$1(child);
10645 if (!child.static) {
10646 node.static = false;
10647 }
10648 }
10649 if (node.ifConditions) {
10650 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10651 var block = node.ifConditions[i$1].block;
10652 markStatic$1(block);
10653 if (!block.static) {
10654 node.static = false;
10655 }
10656 }
10657 }
10658 }
10659 }
10660
10661 function markStaticRoots (node, isInFor) {
10662 if (node.type === 1) {
10663 if (node.static || node.once) {
10664 node.staticInFor = isInFor;
10665 }
10666 // For a node to qualify as a static root, it should have children that
10667 // are not just static text. Otherwise the cost of hoisting out will
10668 // outweigh the benefits and it's better off to just always render it fresh.
10669 if (node.static && node.children.length && !(
10670 node.children.length === 1 &&
10671 node.children[0].type === 3
10672 )) {
10673 node.staticRoot = true;
10674 return
10675 } else {
10676 node.staticRoot = false;
10677 }
10678 if (node.children) {
10679 for (var i = 0, l = node.children.length; i < l; i++) {
10680 markStaticRoots(node.children[i], isInFor || !!node.for);
10681 }
10682 }
10683 if (node.ifConditions) {
10684 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10685 markStaticRoots(node.ifConditions[i$1].block, isInFor);
10686 }
10687 }
10688 }
10689 }
10690
10691 function isStatic (node) {
10692 if (node.type === 2) { // expression
10693 return false
10694 }
10695 if (node.type === 3) { // text
10696 return true
10697 }
10698 return !!(node.pre || (
10699 !node.hasBindings && // no dynamic bindings
10700 !node.if && !node.for && // not v-if or v-for or v-else
10701 !isBuiltInTag(node.tag) && // not a built-in
10702 isPlatformReservedTag(node.tag) && // not a component
10703 !isDirectChildOfTemplateFor(node) &&
10704 Object.keys(node).every(isStaticKey)
10705 ))
10706 }
10707
10708 function isDirectChildOfTemplateFor (node) {
10709 while (node.parent) {
10710 node = node.parent;
10711 if (node.tag !== 'template') {
10712 return false
10713 }
10714 if (node.for) {
10715 return true
10716 }
10717 }
10718 return false
10719 }
10720
10721 /* */
10722
10723 var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
10724 var fnInvokeRE = /\([^)]*?\);*$/;
10725 var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10726
10727 // KeyboardEvent.keyCode aliases
10728 var keyCodes = {
10729 esc: 27,
10730 tab: 9,
10731 enter: 13,
10732 space: 32,
10733 up: 38,
10734 left: 37,
10735 right: 39,
10736 down: 40,
10737 'delete': [8, 46]
10738 };
10739
10740 // KeyboardEvent.key aliases
10741 var keyNames = {
10742 // #7880: IE11 and Edge use `Esc` for Escape key name.
10743 esc: ['Esc', 'Escape'],
10744 tab: 'Tab',
10745 enter: 'Enter',
10746 // #9112: IE11 uses `Spacebar` for Space key name.
10747 space: [' ', 'Spacebar'],
10748 // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
10749 up: ['Up', 'ArrowUp'],
10750 left: ['Left', 'ArrowLeft'],
10751 right: ['Right', 'ArrowRight'],
10752 down: ['Down', 'ArrowDown'],
10753 // #9112: IE11 uses `Del` for Delete key name.
10754 'delete': ['Backspace', 'Delete', 'Del']
10755 };
10756
10757 // #4868: modifiers that prevent the execution of the listener
10758 // need to explicitly return null so that we can determine whether to remove
10759 // the listener for .once
10760 var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
10761
10762 var modifierCode = {
10763 stop: '$event.stopPropagation();',
10764 prevent: '$event.preventDefault();',
10765 self: genGuard("$event.target !== $event.currentTarget"),
10766 ctrl: genGuard("!$event.ctrlKey"),
10767 shift: genGuard("!$event.shiftKey"),
10768 alt: genGuard("!$event.altKey"),
10769 meta: genGuard("!$event.metaKey"),
10770 left: genGuard("'button' in $event && $event.button !== 0"),
10771 middle: genGuard("'button' in $event && $event.button !== 1"),
10772 right: genGuard("'button' in $event && $event.button !== 2")
10773 };
10774
10775 function genHandlers (
10776 events,
10777 isNative
10778 ) {
10779 var prefix = isNative ? 'nativeOn:' : 'on:';
10780 var staticHandlers = "";
10781 var dynamicHandlers = "";
10782 for (var name in events) {
10783 var handlerCode = genHandler(events[name]);
10784 if (events[name] && events[name].dynamic) {
10785 dynamicHandlers += name + "," + handlerCode + ",";
10786 } else {
10787 staticHandlers += "\"" + name + "\":" + handlerCode + ",";
10788 }
10789 }
10790 staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
10791 if (dynamicHandlers) {
10792 return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
10793 } else {
10794 return prefix + staticHandlers
10795 }
10796 }
10797
10798 function genHandler (handler) {
10799 if (!handler) {
10800 return 'function(){}'
10801 }
10802
10803 if (Array.isArray(handler)) {
10804 return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
10805 }
10806
10807 var isMethodPath = simplePathRE.test(handler.value);
10808 var isFunctionExpression = fnExpRE.test(handler.value);
10809 var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
10810
10811 if (!handler.modifiers) {
10812 if (isMethodPath || isFunctionExpression) {
10813 return handler.value
10814 }
10815 return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
10816 } else {
10817 var code = '';
10818 var genModifierCode = '';
10819 var keys = [];
10820 for (var key in handler.modifiers) {
10821 if (modifierCode[key]) {
10822 genModifierCode += modifierCode[key];
10823 // left/right
10824 if (keyCodes[key]) {
10825 keys.push(key);
10826 }
10827 } else if (key === 'exact') {
10828 var modifiers = (handler.modifiers);
10829 genModifierCode += genGuard(
10830 ['ctrl', 'shift', 'alt', 'meta']
10831 .filter(function (keyModifier) { return !modifiers[keyModifier]; })
10832 .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
10833 .join('||')
10834 );
10835 } else {
10836 keys.push(key);
10837 }
10838 }
10839 if (keys.length) {
10840 code += genKeyFilter(keys);
10841 }
10842 // Make sure modifiers like prevent and stop get executed after key filtering
10843 if (genModifierCode) {
10844 code += genModifierCode;
10845 }
10846 var handlerCode = isMethodPath
10847 ? ("return " + (handler.value) + "($event)")
10848 : isFunctionExpression
10849 ? ("return (" + (handler.value) + ")($event)")
10850 : isFunctionInvocation
10851 ? ("return " + (handler.value))
10852 : handler.value;
10853 return ("function($event){" + code + handlerCode + "}")
10854 }
10855 }
10856
10857 function genKeyFilter (keys) {
10858 return (
10859 // make sure the key filters only apply to KeyboardEvents
10860 // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
10861 // key events that do not have keyCode property...
10862 "if(!$event.type.indexOf('key')&&" +
10863 (keys.map(genFilterCode).join('&&')) + ")return null;"
10864 )
10865 }
10866
10867 function genFilterCode (key) {
10868 var keyVal = parseInt(key, 10);
10869 if (keyVal) {
10870 return ("$event.keyCode!==" + keyVal)
10871 }
10872 var keyCode = keyCodes[key];
10873 var keyName = keyNames[key];
10874 return (
10875 "_k($event.keyCode," +
10876 (JSON.stringify(key)) + "," +
10877 (JSON.stringify(keyCode)) + "," +
10878 "$event.key," +
10879 "" + (JSON.stringify(keyName)) +
10880 ")"
10881 )
10882 }
10883
10884 /* */
10885
10886 function on (el, dir) {
10887 if (dir.modifiers) {
10888 warn("v-on without argument does not support modifiers.");
10889 }
10890 el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
10891 }
10892
10893 /* */
10894
10895 function bind$1 (el, dir) {
10896 el.wrapData = function (code) {
10897 return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
10898 };
10899 }
10900
10901 /* */
10902
10903 var baseDirectives = {
10904 on: on,
10905 bind: bind$1,
10906 cloak: noop
10907 };
10908
10909 /* */
10910
10911
10912
10913
10914
10915 var CodegenState = function CodegenState (options) {
10916 this.options = options;
10917 this.warn = options.warn || baseWarn;
10918 this.transforms = pluckModuleFunction(options.modules, 'transformCode');
10919 this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
10920 this.directives = extend(extend({}, baseDirectives), options.directives);
10921 var isReservedTag = options.isReservedTag || no;
10922 this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
10923 this.onceId = 0;
10924 this.staticRenderFns = [];
10925 this.pre = false;
10926 };
10927
10928
10929
10930 function generate (
10931 ast,
10932 options
10933 ) {
10934 var state = new CodegenState(options);
10935 var code = ast ? genElement(ast, state) : '_c("div")';
10936 return {
10937 render: ("with(this){return " + code + "}"),
10938 staticRenderFns: state.staticRenderFns
10939 }
10940 }
10941
10942 function genElement (el, state) {
10943 if (el.parent) {
10944 el.pre = el.pre || el.parent.pre;
10945 }
10946
10947 if (el.staticRoot && !el.staticProcessed) {
10948 return genStatic(el, state)
10949 } else if (el.once && !el.onceProcessed) {
10950 return genOnce(el, state)
10951 } else if (el.for && !el.forProcessed) {
10952 return genFor(el, state)
10953 } else if (el.if && !el.ifProcessed) {
10954 return genIf(el, state)
10955 } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
10956 return genChildren(el, state) || 'void 0'
10957 } else if (el.tag === 'slot') {
10958 return genSlot(el, state)
10959 } else {
10960 // component or element
10961 var code;
10962 if (el.component) {
10963 code = genComponent(el.component, el, state);
10964 } else {
10965 var data;
10966 if (!el.plain || (el.pre && state.maybeComponent(el))) {
10967 data = genData$2(el, state);
10968 }
10969
10970 var children = el.inlineTemplate ? null : genChildren(el, state, true);
10971 code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
10972 }
10973 // module transforms
10974 for (var i = 0; i < state.transforms.length; i++) {
10975 code = state.transforms[i](el, code);
10976 }
10977 return code
10978 }
10979 }
10980
10981 // hoist static sub-trees out
10982 function genStatic (el, state) {
10983 el.staticProcessed = true;
10984 // Some elements (templates) need to behave differently inside of a v-pre
10985 // node. All pre nodes are static roots, so we can use this as a location to
10986 // wrap a state change and reset it upon exiting the pre node.
10987 var originalPreState = state.pre;
10988 if (el.pre) {
10989 state.pre = el.pre;
10990 }
10991 state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
10992 state.pre = originalPreState;
10993 return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
10994 }
10995
10996 // v-once
10997 function genOnce (el, state) {
10998 el.onceProcessed = true;
10999 if (el.if && !el.ifProcessed) {
11000 return genIf(el, state)
11001 } else if (el.staticInFor) {
11002 var key = '';
11003 var parent = el.parent;
11004 while (parent) {
11005 if (parent.for) {
11006 key = parent.key;
11007 break
11008 }
11009 parent = parent.parent;
11010 }
11011 if (!key) {
11012 state.warn(
11013 "v-once can only be used inside v-for that is keyed. ",
11014 el.rawAttrsMap['v-once']
11015 );
11016 return genElement(el, state)
11017 }
11018 return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
11019 } else {
11020 return genStatic(el, state)
11021 }
11022 }
11023
11024 function genIf (
11025 el,
11026 state,
11027 altGen,
11028 altEmpty
11029 ) {
11030 el.ifProcessed = true; // avoid recursion
11031 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
11032 }
11033
11034 function genIfConditions (
11035 conditions,
11036 state,
11037 altGen,
11038 altEmpty
11039 ) {
11040 if (!conditions.length) {
11041 return altEmpty || '_e()'
11042 }
11043
11044 var condition = conditions.shift();
11045 if (condition.exp) {
11046 return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
11047 } else {
11048 return ("" + (genTernaryExp(condition.block)))
11049 }
11050
11051 // v-if with v-once should generate code like (a)?_m(0):_m(1)
11052 function genTernaryExp (el) {
11053 return altGen
11054 ? altGen(el, state)
11055 : el.once
11056 ? genOnce(el, state)
11057 : genElement(el, state)
11058 }
11059 }
11060
11061 function genFor (
11062 el,
11063 state,
11064 altGen,
11065 altHelper
11066 ) {
11067 var exp = el.for;
11068 var alias = el.alias;
11069 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
11070 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
11071
11072 if (state.maybeComponent(el) &&
11073 el.tag !== 'slot' &&
11074 el.tag !== 'template' &&
11075 !el.key
11076 ) {
11077 state.warn(
11078 "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
11079 "v-for should have explicit keys. " +
11080 "See https://vuejs.org/guide/list.html#key for more info.",
11081 el.rawAttrsMap['v-for'],
11082 true /* tip */
11083 );
11084 }
11085
11086 el.forProcessed = true; // avoid recursion
11087 return (altHelper || '_l') + "((" + exp + ")," +
11088 "function(" + alias + iterator1 + iterator2 + "){" +
11089 "return " + ((altGen || genElement)(el, state)) +
11090 '})'
11091 }
11092
11093 function genData$2 (el, state) {
11094 var data = '{';
11095
11096 // directives first.
11097 // directives may mutate the el's other properties before they are generated.
11098 var dirs = genDirectives(el, state);
11099 if (dirs) { data += dirs + ','; }
11100
11101 // key
11102 if (el.key) {
11103 data += "key:" + (el.key) + ",";
11104 }
11105 // ref
11106 if (el.ref) {
11107 data += "ref:" + (el.ref) + ",";
11108 }
11109 if (el.refInFor) {
11110 data += "refInFor:true,";
11111 }
11112 // pre
11113 if (el.pre) {
11114 data += "pre:true,";
11115 }
11116 // record original tag name for components using "is" attribute
11117 if (el.component) {
11118 data += "tag:\"" + (el.tag) + "\",";
11119 }
11120 // module data generation functions
11121 for (var i = 0; i < state.dataGenFns.length; i++) {
11122 data += state.dataGenFns[i](el);
11123 }
11124 // attributes
11125 if (el.attrs) {
11126 data += "attrs:" + (genProps(el.attrs)) + ",";
11127 }
11128 // DOM props
11129 if (el.props) {
11130 data += "domProps:" + (genProps(el.props)) + ",";
11131 }
11132 // event handlers
11133 if (el.events) {
11134 data += (genHandlers(el.events, false)) + ",";
11135 }
11136 if (el.nativeEvents) {
11137 data += (genHandlers(el.nativeEvents, true)) + ",";
11138 }
11139 // slot target
11140 // only for non-scoped slots
11141 if (el.slotTarget && !el.slotScope) {
11142 data += "slot:" + (el.slotTarget) + ",";
11143 }
11144 // scoped slots
11145 if (el.scopedSlots) {
11146 data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
11147 }
11148 // component v-model
11149 if (el.model) {
11150 data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
11151 }
11152 // inline-template
11153 if (el.inlineTemplate) {
11154 var inlineTemplate = genInlineTemplate(el, state);
11155 if (inlineTemplate) {
11156 data += inlineTemplate + ",";
11157 }
11158 }
11159 data = data.replace(/,$/, '') + '}';
11160 // v-bind dynamic argument wrap
11161 // v-bind with dynamic arguments must be applied using the same v-bind object
11162 // merge helper so that class/style/mustUseProp attrs are handled correctly.
11163 if (el.dynamicAttrs) {
11164 data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
11165 }
11166 // v-bind data wrap
11167 if (el.wrapData) {
11168 data = el.wrapData(data);
11169 }
11170 // v-on data wrap
11171 if (el.wrapListeners) {
11172 data = el.wrapListeners(data);
11173 }
11174 return data
11175 }
11176
11177 function genDirectives (el, state) {
11178 var dirs = el.directives;
11179 if (!dirs) { return }
11180 var res = 'directives:[';
11181 var hasRuntime = false;
11182 var i, l, dir, needRuntime;
11183 for (i = 0, l = dirs.length; i < l; i++) {
11184 dir = dirs[i];
11185 needRuntime = true;
11186 var gen = state.directives[dir.name];
11187 if (gen) {
11188 // compile-time directive that manipulates AST.
11189 // returns true if it also needs a runtime counterpart.
11190 needRuntime = !!gen(el, dir, state.warn);
11191 }
11192 if (needRuntime) {
11193 hasRuntime = true;
11194 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))) : '') + "},";
11195 }
11196 }
11197 if (hasRuntime) {
11198 return res.slice(0, -1) + ']'
11199 }
11200 }
11201
11202 function genInlineTemplate (el, state) {
11203 var ast = el.children[0];
11204 if (el.children.length !== 1 || ast.type !== 1) {
11205 state.warn(
11206 'Inline-template components must have exactly one child element.',
11207 { start: el.start }
11208 );
11209 }
11210 if (ast && ast.type === 1) {
11211 var inlineRenderFns = generate(ast, state.options);
11212 return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
11213 }
11214 }
11215
11216 function genScopedSlots (
11217 el,
11218 slots,
11219 state
11220 ) {
11221 // by default scoped slots are considered "stable", this allows child
11222 // components with only scoped slots to skip forced updates from parent.
11223 // but in some cases we have to bail-out of this optimization
11224 // for example if the slot contains dynamic names, has v-if or v-for on them...
11225 var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
11226 var slot = slots[key];
11227 return (
11228 slot.slotTargetDynamic ||
11229 slot.if ||
11230 slot.for ||
11231 containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11232 )
11233 });
11234
11235 // #9534: if a component with scoped slots is inside a conditional branch,
11236 // it's possible for the same component to be reused but with different
11237 // compiled slot content. To avoid that, we generate a unique key based on
11238 // the generated code of all the slot contents.
11239 var needsKey = !!el.if;
11240
11241 // OR when it is inside another scoped slot or v-for (the reactivity may be
11242 // disconnected due to the intermediate scope variable)
11243 // #9438, #9506
11244 // TODO: this can be further optimized by properly analyzing in-scope bindings
11245 // and skip force updating ones that do not actually use scope variables.
11246 if (!needsForceUpdate) {
11247 var parent = el.parent;
11248 while (parent) {
11249 if (
11250 (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
11251 parent.for
11252 ) {
11253 needsForceUpdate = true;
11254 break
11255 }
11256 if (parent.if) {
11257 needsKey = true;
11258 }
11259 parent = parent.parent;
11260 }
11261 }
11262
11263 var generatedSlots = Object.keys(slots)
11264 .map(function (key) { return genScopedSlot(slots[key], state); })
11265 .join(',');
11266
11267 return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
11268 }
11269
11270 function hash(str) {
11271 var hash = 5381;
11272 var i = str.length;
11273 while(i) {
11274 hash = (hash * 33) ^ str.charCodeAt(--i);
11275 }
11276 return hash >>> 0
11277 }
11278
11279 function containsSlotChild (el) {
11280 if (el.type === 1) {
11281 if (el.tag === 'slot') {
11282 return true
11283 }
11284 return el.children.some(containsSlotChild)
11285 }
11286 return false
11287 }
11288
11289 function genScopedSlot (
11290 el,
11291 state
11292 ) {
11293 var isLegacySyntax = el.attrsMap['slot-scope'];
11294 if (el.if && !el.ifProcessed && !isLegacySyntax) {
11295 return genIf(el, state, genScopedSlot, "null")
11296 }
11297 if (el.for && !el.forProcessed) {
11298 return genFor(el, state, genScopedSlot)
11299 }
11300 var slotScope = el.slotScope === emptySlotScopeToken
11301 ? ""
11302 : String(el.slotScope);
11303 var fn = "function(" + slotScope + "){" +
11304 "return " + (el.tag === 'template'
11305 ? el.if && isLegacySyntax
11306 ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
11307 : genChildren(el, state) || 'undefined'
11308 : genElement(el, state)) + "}";
11309 // reverse proxy v-slot without scope on this.$slots
11310 var reverseProxy = slotScope ? "" : ",proxy:true";
11311 return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
11312 }
11313
11314 function genChildren (
11315 el,
11316 state,
11317 checkSkip,
11318 altGenElement,
11319 altGenNode
11320 ) {
11321 var children = el.children;
11322 if (children.length) {
11323 var el$1 = children[0];
11324 // optimize single v-for
11325 if (children.length === 1 &&
11326 el$1.for &&
11327 el$1.tag !== 'template' &&
11328 el$1.tag !== 'slot'
11329 ) {
11330 var normalizationType = checkSkip
11331 ? state.maybeComponent(el$1) ? ",1" : ",0"
11332 : "";
11333 return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
11334 }
11335 var normalizationType$1 = checkSkip
11336 ? getNormalizationType(children, state.maybeComponent)
11337 : 0;
11338 var gen = altGenNode || genNode;
11339 return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
11340 }
11341 }
11342
11343 // determine the normalization needed for the children array.
11344 // 0: no normalization needed
11345 // 1: simple normalization needed (possible 1-level deep nested array)
11346 // 2: full normalization needed
11347 function getNormalizationType (
11348 children,
11349 maybeComponent
11350 ) {
11351 var res = 0;
11352 for (var i = 0; i < children.length; i++) {
11353 var el = children[i];
11354 if (el.type !== 1) {
11355 continue
11356 }
11357 if (needsNormalization(el) ||
11358 (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
11359 res = 2;
11360 break
11361 }
11362 if (maybeComponent(el) ||
11363 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
11364 res = 1;
11365 }
11366 }
11367 return res
11368 }
11369
11370 function needsNormalization (el) {
11371 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
11372 }
11373
11374 function genNode (node, state) {
11375 if (node.type === 1) {
11376 return genElement(node, state)
11377 } else if (node.type === 3 && node.isComment) {
11378 return genComment(node)
11379 } else {
11380 return genText(node)
11381 }
11382 }
11383
11384 function genText (text) {
11385 return ("_v(" + (text.type === 2
11386 ? text.expression // no need for () because already wrapped in _s()
11387 : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
11388 }
11389
11390 function genComment (comment) {
11391 return ("_e(" + (JSON.stringify(comment.text)) + ")")
11392 }
11393
11394 function genSlot (el, state) {
11395 var slotName = el.slotName || '"default"';
11396 var children = genChildren(el, state);
11397 var res = "_t(" + slotName + (children ? ("," + children) : '');
11398 var attrs = el.attrs || el.dynamicAttrs
11399 ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11400 // slot props are camelized
11401 name: camelize(attr.name),
11402 value: attr.value,
11403 dynamic: attr.dynamic
11404 }); }))
11405 : null;
11406 var bind$$1 = el.attrsMap['v-bind'];
11407 if ((attrs || bind$$1) && !children) {
11408 res += ",null";
11409 }
11410 if (attrs) {
11411 res += "," + attrs;
11412 }
11413 if (bind$$1) {
11414 res += (attrs ? '' : ',null') + "," + bind$$1;
11415 }
11416 return res + ')'
11417 }
11418
11419 // componentName is el.component, take it as argument to shun flow's pessimistic refinement
11420 function genComponent (
11421 componentName,
11422 el,
11423 state
11424 ) {
11425 var children = el.inlineTemplate ? null : genChildren(el, state, true);
11426 return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
11427 }
11428
11429 function genProps (props) {
11430 var staticProps = "";
11431 var dynamicProps = "";
11432 for (var i = 0; i < props.length; i++) {
11433 var prop = props[i];
11434 var value = transformSpecialNewlines(prop.value);
11435 if (prop.dynamic) {
11436 dynamicProps += (prop.name) + "," + value + ",";
11437 } else {
11438 staticProps += "\"" + (prop.name) + "\":" + value + ",";
11439 }
11440 }
11441 staticProps = "{" + (staticProps.slice(0, -1)) + "}";
11442 if (dynamicProps) {
11443 return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
11444 } else {
11445 return staticProps
11446 }
11447 }
11448
11449 // #3895, #4268
11450 function transformSpecialNewlines (text) {
11451 return text
11452 .replace(/\u2028/g, '\\u2028')
11453 .replace(/\u2029/g, '\\u2029')
11454 }
11455
11456 /* */
11457
11458
11459
11460 // these keywords should not appear inside expressions, but operators like
11461 // typeof, instanceof and in are allowed
11462 var prohibitedKeywordRE = new RegExp('\\b' + (
11463 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
11464 'super,throw,while,yield,delete,export,import,return,switch,default,' +
11465 'extends,finally,continue,debugger,function,arguments'
11466 ).split(',').join('\\b|\\b') + '\\b');
11467
11468 // these unary operators should not be used as property/method names
11469 var unaryOperatorsRE = new RegExp('\\b' + (
11470 'delete,typeof,void'
11471 ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
11472
11473 // strip strings in expressions
11474 var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
11475
11476 // detect problematic expressions in a template
11477 function detectErrors (ast, warn) {
11478 if (ast) {
11479 checkNode(ast, warn);
11480 }
11481 }
11482
11483 function checkNode (node, warn) {
11484 if (node.type === 1) {
11485 for (var name in node.attrsMap) {
11486 if (dirRE.test(name)) {
11487 var value = node.attrsMap[name];
11488 if (value) {
11489 var range = node.rawAttrsMap[name];
11490 if (name === 'v-for') {
11491 checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11492 } else if (onRE.test(name)) {
11493 checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11494 } else {
11495 checkExpression(value, (name + "=\"" + value + "\""), warn, range);
11496 }
11497 }
11498 }
11499 }
11500 if (node.children) {
11501 for (var i = 0; i < node.children.length; i++) {
11502 checkNode(node.children[i], warn);
11503 }
11504 }
11505 } else if (node.type === 2) {
11506 checkExpression(node.expression, node.text, warn, node);
11507 }
11508 }
11509
11510 function checkEvent (exp, text, warn, range) {
11511 var stipped = exp.replace(stripStringRE, '');
11512 var keywordMatch = stipped.match(unaryOperatorsRE);
11513 if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11514 warn(
11515 "avoid using JavaScript unary operator as property name: " +
11516 "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
11517 range
11518 );
11519 }
11520 checkExpression(exp, text, warn, range);
11521 }
11522
11523 function checkFor (node, text, warn, range) {
11524 checkExpression(node.for || '', text, warn, range);
11525 checkIdentifier(node.alias, 'v-for alias', text, warn, range);
11526 checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
11527 checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
11528 }
11529
11530 function checkIdentifier (
11531 ident,
11532 type,
11533 text,
11534 warn,
11535 range
11536 ) {
11537 if (typeof ident === 'string') {
11538 try {
11539 new Function(("var " + ident + "=_"));
11540 } catch (e) {
11541 warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
11542 }
11543 }
11544 }
11545
11546 function checkExpression (exp, text, warn, range) {
11547 try {
11548 new Function(("return " + exp));
11549 } catch (e) {
11550 var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
11551 if (keywordMatch) {
11552 warn(
11553 "avoid using JavaScript keyword as property name: " +
11554 "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
11555 range
11556 );
11557 } else {
11558 warn(
11559 "invalid expression: " + (e.message) + " in\n\n" +
11560 " " + exp + "\n\n" +
11561 " Raw expression: " + (text.trim()) + "\n",
11562 range
11563 );
11564 }
11565 }
11566 }
11567
11568 /* */
11569
11570 var range = 2;
11571
11572 function generateCodeFrame (
11573 source,
11574 start,
11575 end
11576 ) {
11577 if ( start === void 0 ) start = 0;
11578 if ( end === void 0 ) end = source.length;
11579
11580 var lines = source.split(/\r?\n/);
11581 var count = 0;
11582 var res = [];
11583 for (var i = 0; i < lines.length; i++) {
11584 count += lines[i].length + 1;
11585 if (count >= start) {
11586 for (var j = i - range; j <= i + range || end > count; j++) {
11587 if (j < 0 || j >= lines.length) { continue }
11588 res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
11589 var lineLength = lines[j].length;
11590 if (j === i) {
11591 // push underline
11592 var pad = start - (count - lineLength) + 1;
11593 var length = end > count ? lineLength - pad : end - start;
11594 res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
11595 } else if (j > i) {
11596 if (end > count) {
11597 var length$1 = Math.min(end - count, lineLength);
11598 res.push(" | " + repeat$1("^", length$1));
11599 }
11600 count += lineLength + 1;
11601 }
11602 }
11603 break
11604 }
11605 }
11606 return res.join('\n')
11607 }
11608
11609 function repeat$1 (str, n) {
11610 var result = '';
11611 if (n > 0) {
11612 while (true) { // eslint-disable-line
11613 if (n & 1) { result += str; }
11614 n >>>= 1;
11615 if (n <= 0) { break }
11616 str += str;
11617 }
11618 }
11619 return result
11620 }
11621
11622 /* */
11623
11624
11625
11626 function createFunction (code, errors) {
11627 try {
11628 return new Function(code)
11629 } catch (err) {
11630 errors.push({ err: err, code: code });
11631 return noop
11632 }
11633 }
11634
11635 function createCompileToFunctionFn (compile) {
11636 var cache = Object.create(null);
11637
11638 return function compileToFunctions (
11639 template,
11640 options,
11641 vm
11642 ) {
11643 options = extend({}, options);
11644 var warn$$1 = options.warn || warn;
11645 delete options.warn;
11646
11647 /* istanbul ignore if */
11648 {
11649 // detect possible CSP restriction
11650 try {
11651 new Function('return 1');
11652 } catch (e) {
11653 if (e.toString().match(/unsafe-eval|CSP/)) {
11654 warn$$1(
11655 'It seems you are using the standalone build of Vue.js in an ' +
11656 'environment with Content Security Policy that prohibits unsafe-eval. ' +
11657 'The template compiler cannot work in this environment. Consider ' +
11658 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
11659 'templates into render functions.'
11660 );
11661 }
11662 }
11663 }
11664
11665 // check cache
11666 var key = options.delimiters
11667 ? String(options.delimiters) + template
11668 : template;
11669 if (cache[key]) {
11670 return cache[key]
11671 }
11672
11673 // compile
11674 var compiled = compile(template, options);
11675
11676 // check compilation errors/tips
11677 {
11678 if (compiled.errors && compiled.errors.length) {
11679 if (options.outputSourceRange) {
11680 compiled.errors.forEach(function (e) {
11681 warn$$1(
11682 "Error compiling template:\n\n" + (e.msg) + "\n\n" +
11683 generateCodeFrame(template, e.start, e.end),
11684 vm
11685 );
11686 });
11687 } else {
11688 warn$$1(
11689 "Error compiling template:\n\n" + template + "\n\n" +
11690 compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
11691 vm
11692 );
11693 }
11694 }
11695 if (compiled.tips && compiled.tips.length) {
11696 if (options.outputSourceRange) {
11697 compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
11698 } else {
11699 compiled.tips.forEach(function (msg) { return tip(msg, vm); });
11700 }
11701 }
11702 }
11703
11704 // turn code into functions
11705 var res = {};
11706 var fnGenErrors = [];
11707 res.render = createFunction(compiled.render, fnGenErrors);
11708 res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
11709 return createFunction(code, fnGenErrors)
11710 });
11711
11712 // check function generation errors.
11713 // this should only happen if there is a bug in the compiler itself.
11714 // mostly for codegen development use
11715 /* istanbul ignore if */
11716 {
11717 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
11718 warn$$1(
11719 "Failed to generate render function:\n\n" +
11720 fnGenErrors.map(function (ref) {
11721 var err = ref.err;
11722 var code = ref.code;
11723
11724 return ((err.toString()) + " in\n\n" + code + "\n");
11725 }).join('\n'),
11726 vm
11727 );
11728 }
11729 }
11730
11731 return (cache[key] = res)
11732 }
11733 }
11734
11735 /* */
11736
11737 function createCompilerCreator (baseCompile) {
11738 return function createCompiler (baseOptions) {
11739 function compile (
11740 template,
11741 options
11742 ) {
11743 var finalOptions = Object.create(baseOptions);
11744 var errors = [];
11745 var tips = [];
11746
11747 var warn = function (msg, range, tip) {
11748 (tip ? tips : errors).push(msg);
11749 };
11750
11751 if (options) {
11752 if (options.outputSourceRange) {
11753 // $flow-disable-line
11754 var leadingSpaceLength = template.match(/^\s*/)[0].length;
11755
11756 warn = function (msg, range, tip) {
11757 var data = { msg: msg };
11758 if (range) {
11759 if (range.start != null) {
11760 data.start = range.start + leadingSpaceLength;
11761 }
11762 if (range.end != null) {
11763 data.end = range.end + leadingSpaceLength;
11764 }
11765 }
11766 (tip ? tips : errors).push(data);
11767 };
11768 }
11769 // merge custom modules
11770 if (options.modules) {
11771 finalOptions.modules =
11772 (baseOptions.modules || []).concat(options.modules);
11773 }
11774 // merge custom directives
11775 if (options.directives) {
11776 finalOptions.directives = extend(
11777 Object.create(baseOptions.directives || null),
11778 options.directives
11779 );
11780 }
11781 // copy other options
11782 for (var key in options) {
11783 if (key !== 'modules' && key !== 'directives') {
11784 finalOptions[key] = options[key];
11785 }
11786 }
11787 }
11788
11789 finalOptions.warn = warn;
11790
11791 var compiled = baseCompile(template.trim(), finalOptions);
11792 {
11793 detectErrors(compiled.ast, warn);
11794 }
11795 compiled.errors = errors;
11796 compiled.tips = tips;
11797 return compiled
11798 }
11799
11800 return {
11801 compile: compile,
11802 compileToFunctions: createCompileToFunctionFn(compile)
11803 }
11804 }
11805 }
11806
11807 /* */
11808
11809 // `createCompilerCreator` allows creating compilers that use alternative
11810 // parser/optimizer/codegen, e.g the SSR optimizing compiler.
11811 // Here we just export a default compiler using the default parts.
11812 var createCompiler = createCompilerCreator(function baseCompile (
11813 template,
11814 options
11815 ) {
11816 var ast = parse(template.trim(), options);
11817 if (options.optimize !== false) {
11818 optimize(ast, options);
11819 }
11820 var code = generate(ast, options);
11821 return {
11822 ast: ast,
11823 render: code.render,
11824 staticRenderFns: code.staticRenderFns
11825 }
11826 });
11827
11828 /* */
11829
11830 var ref$1 = createCompiler(baseOptions);
11831 var compile = ref$1.compile;
11832 var compileToFunctions = ref$1.compileToFunctions;
11833
11834 /* */
11835
11836 // check whether current browser encodes a char inside attribute values
11837 var div;
11838 function getShouldDecode (href) {
11839 div = div || document.createElement('div');
11840 div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
11841 return div.innerHTML.indexOf('&#10;') > 0
11842 }
11843
11844 // #3663: IE encodes newlines inside attribute values while other browsers don't
11845 var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
11846 // #6828: chrome encodes content in a[href]
11847 var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
11848
11849 /* */
11850
11851 var idToTemplate = cached(function (id) {
11852 var el = query(id);
11853 return el && el.innerHTML
11854 });
11855
11856 var mount = Vue.prototype.$mount;
11857 Vue.prototype.$mount = function (
11858 el,
11859 hydrating
11860 ) {
11861 el = el && query(el);
11862
11863 /* istanbul ignore if */
11864 if (el === document.body || el === document.documentElement) {
11865 warn(
11866 "Do not mount Vue to <html> or <body> - mount to normal elements instead."
11867 );
11868 return this
11869 }
11870
11871 var options = this.$options;
11872 // resolve template/el and convert to render function
11873 if (!options.render) {
11874 var template = options.template;
11875 if (template) {
11876 if (typeof template === 'string') {
11877 if (template.charAt(0) === '#') {
11878 template = idToTemplate(template);
11879 /* istanbul ignore if */
11880 if (!template) {
11881 warn(
11882 ("Template element not found or is empty: " + (options.template)),
11883 this
11884 );
11885 }
11886 }
11887 } else if (template.nodeType) {
11888 template = template.innerHTML;
11889 } else {
11890 {
11891 warn('invalid template option:' + template, this);
11892 }
11893 return this
11894 }
11895 } else if (el) {
11896 template = getOuterHTML(el);
11897 }
11898 if (template) {
11899 /* istanbul ignore if */
11900 if (config.performance && mark) {
11901 mark('compile');
11902 }
11903
11904 var ref = compileToFunctions(template, {
11905 outputSourceRange: "development" !== 'production',
11906 shouldDecodeNewlines: shouldDecodeNewlines,
11907 shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
11908 delimiters: options.delimiters,
11909 comments: options.comments
11910 }, this);
11911 var render = ref.render;
11912 var staticRenderFns = ref.staticRenderFns;
11913 options.render = render;
11914 options.staticRenderFns = staticRenderFns;
11915
11916 /* istanbul ignore if */
11917 if (config.performance && mark) {
11918 mark('compile end');
11919 measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
11920 }
11921 }
11922 }
11923 return mount.call(this, el, hydrating)
11924 };
11925
11926 /**
11927 * Get outerHTML of elements, taking care
11928 * of SVG elements in IE as well.
11929 */
11930 function getOuterHTML (el) {
11931 if (el.outerHTML) {
11932 return el.outerHTML
11933 } else {
11934 var container = document.createElement('div');
11935 container.appendChild(el.cloneNode(true));
11936 return container.innerHTML
11937 }
11938 }
11939
11940 Vue.compile = compileToFunctions;
11941
11942 return Vue;
11943
11944 }));
11945