1 |
|
2 |
|
3 |
|
4 |
|
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 = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
|
10 | })(this, (function () { 'use strict';
|
11 |
|
12 | var emptyObject = Object.freeze({});
|
13 | var isArray = Array.isArray;
|
14 |
|
15 |
|
16 | function isUndef(v) {
|
17 | return v === undefined || v === null;
|
18 | }
|
19 | function isDef(v) {
|
20 | return v !== undefined && v !== null;
|
21 | }
|
22 | function isTrue(v) {
|
23 | return v === true;
|
24 | }
|
25 | function isFalse(v) {
|
26 | return v === false;
|
27 | }
|
28 | |
29 |
|
30 |
|
31 | function isPrimitive(value) {
|
32 | return (typeof value === 'string' ||
|
33 | typeof value === 'number' ||
|
34 |
|
35 | typeof value === 'symbol' ||
|
36 | typeof value === 'boolean');
|
37 | }
|
38 | function isFunction(value) {
|
39 | return typeof value === 'function';
|
40 | }
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 | function isObject(obj) {
|
47 | return obj !== null && typeof obj === 'object';
|
48 | }
|
49 | |
50 |
|
51 |
|
52 | var _toString = Object.prototype.toString;
|
53 | function toRawType(value) {
|
54 | return _toString.call(value).slice(8, -1);
|
55 | }
|
56 | |
57 |
|
58 |
|
59 |
|
60 | function isPlainObject(obj) {
|
61 | return _toString.call(obj) === '[object Object]';
|
62 | }
|
63 | function isRegExp(v) {
|
64 | return _toString.call(v) === '[object RegExp]';
|
65 | }
|
66 | |
67 |
|
68 |
|
69 | function isValidArrayIndex(val) {
|
70 | var n = parseFloat(String(val));
|
71 | return n >= 0 && Math.floor(n) === n && isFinite(val);
|
72 | }
|
73 | function isPromise(val) {
|
74 | return (isDef(val) &&
|
75 | typeof val.then === 'function' &&
|
76 | typeof val.catch === 'function');
|
77 | }
|
78 | |
79 |
|
80 |
|
81 | function toString(val) {
|
82 | return val == null
|
83 | ? ''
|
84 | : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
85 | ? JSON.stringify(val, null, 2)
|
86 | : String(val);
|
87 | }
|
88 | |
89 |
|
90 |
|
91 |
|
92 | function toNumber(val) {
|
93 | var n = parseFloat(val);
|
94 | return isNaN(n) ? val : n;
|
95 | }
|
96 | |
97 |
|
98 |
|
99 |
|
100 | function makeMap(str, expectsLowerCase) {
|
101 | var map = Object.create(null);
|
102 | var list = str.split(',');
|
103 | for (var i = 0; i < list.length; i++) {
|
104 | map[list[i]] = true;
|
105 | }
|
106 | return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
|
107 | }
|
108 | |
109 |
|
110 |
|
111 | var isBuiltInTag = makeMap('slot,component', true);
|
112 | |
113 |
|
114 |
|
115 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
116 | |
117 |
|
118 |
|
119 | function remove$2(arr, item) {
|
120 | var len = arr.length;
|
121 | if (len) {
|
122 |
|
123 | if (item === arr[len - 1]) {
|
124 | arr.length = len - 1;
|
125 | return;
|
126 | }
|
127 | var index = arr.indexOf(item);
|
128 | if (index > -1) {
|
129 | return arr.splice(index, 1);
|
130 | }
|
131 | }
|
132 | }
|
133 | |
134 |
|
135 |
|
136 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
137 | function hasOwn(obj, key) {
|
138 | return hasOwnProperty.call(obj, key);
|
139 | }
|
140 | |
141 |
|
142 |
|
143 | function cached(fn) {
|
144 | var cache = Object.create(null);
|
145 | return function cachedFn(str) {
|
146 | var hit = cache[str];
|
147 | return hit || (cache[str] = fn(str));
|
148 | };
|
149 | }
|
150 | |
151 |
|
152 |
|
153 | var camelizeRE = /-(\w)/g;
|
154 | var camelize = cached(function (str) {
|
155 | return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
|
156 | });
|
157 | |
158 |
|
159 |
|
160 | var capitalize = cached(function (str) {
|
161 | return str.charAt(0).toUpperCase() + str.slice(1);
|
162 | });
|
163 | |
164 |
|
165 |
|
166 | var hyphenateRE = /\B([A-Z])/g;
|
167 | var hyphenate = cached(function (str) {
|
168 | return str.replace(hyphenateRE, '-$1').toLowerCase();
|
169 | });
|
170 | |
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | function polyfillBind(fn, ctx) {
|
179 | function boundFn(a) {
|
180 | var l = arguments.length;
|
181 | return l
|
182 | ? l > 1
|
183 | ? fn.apply(ctx, arguments)
|
184 | : fn.call(ctx, a)
|
185 | : fn.call(ctx);
|
186 | }
|
187 | boundFn._length = fn.length;
|
188 | return boundFn;
|
189 | }
|
190 | function nativeBind(fn, ctx) {
|
191 | return fn.bind(ctx);
|
192 | }
|
193 |
|
194 | var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
|
195 | |
196 |
|
197 |
|
198 | function toArray(list, start) {
|
199 | start = start || 0;
|
200 | var i = list.length - start;
|
201 | var ret = new Array(i);
|
202 | while (i--) {
|
203 | ret[i] = list[i + start];
|
204 | }
|
205 | return ret;
|
206 | }
|
207 | |
208 |
|
209 |
|
210 | function extend(to, _from) {
|
211 | for (var key in _from) {
|
212 | to[key] = _from[key];
|
213 | }
|
214 | return to;
|
215 | }
|
216 | |
217 |
|
218 |
|
219 | function toObject(arr) {
|
220 | var res = {};
|
221 | for (var i = 0; i < arr.length; i++) {
|
222 | if (arr[i]) {
|
223 | extend(res, arr[i]);
|
224 | }
|
225 | }
|
226 | return res;
|
227 | }
|
228 |
|
229 | |
230 |
|
231 |
|
232 |
|
233 |
|
234 | function noop(a, b, c) { }
|
235 | |
236 |
|
237 |
|
238 | var no = function (a, b, c) { return false; };
|
239 |
|
240 | |
241 |
|
242 |
|
243 | var identity = function (_) { return _; };
|
244 | |
245 |
|
246 |
|
247 | function genStaticKeys$1(modules) {
|
248 | return modules
|
249 | .reduce(function (keys, m) { return keys.concat(m.staticKeys || []); }, [])
|
250 | .join(',');
|
251 | }
|
252 | |
253 |
|
254 |
|
255 |
|
256 | function looseEqual(a, b) {
|
257 | if (a === b)
|
258 | return true;
|
259 | var isObjectA = isObject(a);
|
260 | var isObjectB = isObject(b);
|
261 | if (isObjectA && isObjectB) {
|
262 | try {
|
263 | var isArrayA = Array.isArray(a);
|
264 | var isArrayB = Array.isArray(b);
|
265 | if (isArrayA && isArrayB) {
|
266 | return (a.length === b.length &&
|
267 | a.every(function (e, i) {
|
268 | return looseEqual(e, b[i]);
|
269 | }));
|
270 | }
|
271 | else if (a instanceof Date && b instanceof Date) {
|
272 | return a.getTime() === b.getTime();
|
273 | }
|
274 | else if (!isArrayA && !isArrayB) {
|
275 | var keysA = Object.keys(a);
|
276 | var keysB = Object.keys(b);
|
277 | return (keysA.length === keysB.length &&
|
278 | keysA.every(function (key) {
|
279 | return looseEqual(a[key], b[key]);
|
280 | }));
|
281 | }
|
282 | else {
|
283 |
|
284 | return false;
|
285 | }
|
286 | }
|
287 | catch (e) {
|
288 |
|
289 | return false;
|
290 | }
|
291 | }
|
292 | else if (!isObjectA && !isObjectB) {
|
293 | return String(a) === String(b);
|
294 | }
|
295 | else {
|
296 | return false;
|
297 | }
|
298 | }
|
299 | |
300 |
|
301 |
|
302 |
|
303 |
|
304 | function looseIndexOf(arr, val) {
|
305 | for (var i = 0; i < arr.length; i++) {
|
306 | if (looseEqual(arr[i], val))
|
307 | return i;
|
308 | }
|
309 | return -1;
|
310 | }
|
311 | |
312 |
|
313 |
|
314 | function once(fn) {
|
315 | var called = false;
|
316 | return function () {
|
317 | if (!called) {
|
318 | called = true;
|
319 | fn.apply(this, arguments);
|
320 | }
|
321 | };
|
322 | }
|
323 |
|
324 | function hasChanged(x, y) {
|
325 | if (x === y) {
|
326 | return x === 0 && 1 / x !== 1 / y;
|
327 | }
|
328 | else {
|
329 | return x === x || y === y;
|
330 | }
|
331 | }
|
332 |
|
333 | var SSR_ATTR = 'data-server-rendered';
|
334 | var ASSET_TYPES = ['component', 'directive', 'filter'];
|
335 | var LIFECYCLE_HOOKS = [
|
336 | 'beforeCreate',
|
337 | 'created',
|
338 | 'beforeMount',
|
339 | 'mounted',
|
340 | 'beforeUpdate',
|
341 | 'updated',
|
342 | 'beforeDestroy',
|
343 | 'destroyed',
|
344 | 'activated',
|
345 | 'deactivated',
|
346 | 'errorCaptured',
|
347 | 'serverPrefetch',
|
348 | 'renderTracked',
|
349 | 'renderTriggered'
|
350 | ];
|
351 |
|
352 | var config = {
|
353 | |
354 |
|
355 |
|
356 |
|
357 | optionMergeStrategies: Object.create(null),
|
358 | |
359 |
|
360 |
|
361 | silent: false,
|
362 | |
363 |
|
364 |
|
365 | productionTip: true,
|
366 | |
367 |
|
368 |
|
369 | devtools: true,
|
370 | |
371 |
|
372 |
|
373 | performance: false,
|
374 | |
375 |
|
376 |
|
377 | errorHandler: null,
|
378 | |
379 |
|
380 |
|
381 | warnHandler: null,
|
382 | |
383 |
|
384 |
|
385 | ignoredElements: [],
|
386 | |
387 |
|
388 |
|
389 |
|
390 | keyCodes: Object.create(null),
|
391 | |
392 |
|
393 |
|
394 |
|
395 | isReservedTag: no,
|
396 | |
397 |
|
398 |
|
399 |
|
400 | isReservedAttr: no,
|
401 | |
402 |
|
403 |
|
404 |
|
405 | isUnknownElement: no,
|
406 | |
407 |
|
408 |
|
409 | getTagNamespace: noop,
|
410 | |
411 |
|
412 |
|
413 | parsePlatformTagName: identity,
|
414 | |
415 |
|
416 |
|
417 |
|
418 | mustUseProp: no,
|
419 | |
420 |
|
421 |
|
422 |
|
423 | async: true,
|
424 | |
425 |
|
426 |
|
427 | _lifecycleHooks: LIFECYCLE_HOOKS
|
428 | };
|
429 |
|
430 | |
431 |
|
432 |
|
433 |
|
434 |
|
435 | 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/;
|
436 | |
437 |
|
438 |
|
439 | function isReserved(str) {
|
440 | var c = (str + '').charCodeAt(0);
|
441 | return c === 0x24 || c === 0x5f;
|
442 | }
|
443 | |
444 |
|
445 |
|
446 | function def(obj, key, val, enumerable) {
|
447 | Object.defineProperty(obj, key, {
|
448 | value: val,
|
449 | enumerable: !!enumerable,
|
450 | writable: true,
|
451 | configurable: true
|
452 | });
|
453 | }
|
454 | |
455 |
|
456 |
|
457 | var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
|
458 | function parsePath(path) {
|
459 | if (bailRE.test(path)) {
|
460 | return;
|
461 | }
|
462 | var segments = path.split('.');
|
463 | return function (obj) {
|
464 | for (var i = 0; i < segments.length; i++) {
|
465 | if (!obj)
|
466 | return;
|
467 | obj = obj[segments[i]];
|
468 | }
|
469 | return obj;
|
470 | };
|
471 | }
|
472 |
|
473 |
|
474 | var hasProto = '__proto__' in {};
|
475 |
|
476 | var inBrowser = typeof window !== 'undefined';
|
477 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
478 | var isIE = UA && /msie|trident/.test(UA);
|
479 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
480 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
481 | UA && UA.indexOf('android') > 0;
|
482 | var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
|
483 | UA && /chrome\/\d+/.test(UA) && !isEdge;
|
484 | UA && /phantomjs/.test(UA);
|
485 | var isFF = UA && UA.match(/firefox\/(\d+)/);
|
486 |
|
487 |
|
488 | var nativeWatch = {}.watch;
|
489 | var supportsPassive = false;
|
490 | if (inBrowser) {
|
491 | try {
|
492 | var opts = {};
|
493 | Object.defineProperty(opts, 'passive', {
|
494 | get: function () {
|
495 |
|
496 | supportsPassive = true;
|
497 | }
|
498 | });
|
499 | window.addEventListener('test-passive', null, opts);
|
500 | }
|
501 | catch (e) { }
|
502 | }
|
503 |
|
504 |
|
505 | var _isServer;
|
506 | var isServerRendering = function () {
|
507 | if (_isServer === undefined) {
|
508 |
|
509 | if (!inBrowser && typeof global !== 'undefined') {
|
510 |
|
511 |
|
512 | _isServer =
|
513 | global['process'] && global['process'].env.VUE_ENV === 'server';
|
514 | }
|
515 | else {
|
516 | _isServer = false;
|
517 | }
|
518 | }
|
519 | return _isServer;
|
520 | };
|
521 |
|
522 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
523 |
|
524 | function isNative(Ctor) {
|
525 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
|
526 | }
|
527 | var hasSymbol = typeof Symbol !== 'undefined' &&
|
528 | isNative(Symbol) &&
|
529 | typeof Reflect !== 'undefined' &&
|
530 | isNative(Reflect.ownKeys);
|
531 | var _Set;
|
532 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
533 |
|
534 | _Set = Set;
|
535 | }
|
536 | else {
|
537 |
|
538 | _Set = (function () {
|
539 | function Set() {
|
540 | this.set = Object.create(null);
|
541 | }
|
542 | Set.prototype.has = function (key) {
|
543 | return this.set[key] === true;
|
544 | };
|
545 | Set.prototype.add = function (key) {
|
546 | this.set[key] = true;
|
547 | };
|
548 | Set.prototype.clear = function () {
|
549 | this.set = Object.create(null);
|
550 | };
|
551 | return Set;
|
552 | }());
|
553 | }
|
554 |
|
555 | var currentInstance = null;
|
556 | |
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 | function getCurrentInstance() {
|
564 | return currentInstance && { proxy: currentInstance };
|
565 | }
|
566 | |
567 |
|
568 |
|
569 | function setCurrentInstance(vm) {
|
570 | if (vm === void 0) { vm = null; }
|
571 | if (!vm)
|
572 | currentInstance && currentInstance._scope.off();
|
573 | currentInstance = vm;
|
574 | vm && vm._scope.on();
|
575 | }
|
576 |
|
577 | |
578 |
|
579 |
|
580 | var VNode = (function () {
|
581 | function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
|
582 | this.tag = tag;
|
583 | this.data = data;
|
584 | this.children = children;
|
585 | this.text = text;
|
586 | this.elm = elm;
|
587 | this.ns = undefined;
|
588 | this.context = context;
|
589 | this.fnContext = undefined;
|
590 | this.fnOptions = undefined;
|
591 | this.fnScopeId = undefined;
|
592 | this.key = data && data.key;
|
593 | this.componentOptions = componentOptions;
|
594 | this.componentInstance = undefined;
|
595 | this.parent = undefined;
|
596 | this.raw = false;
|
597 | this.isStatic = false;
|
598 | this.isRootInsert = true;
|
599 | this.isComment = false;
|
600 | this.isCloned = false;
|
601 | this.isOnce = false;
|
602 | this.asyncFactory = asyncFactory;
|
603 | this.asyncMeta = undefined;
|
604 | this.isAsyncPlaceholder = false;
|
605 | }
|
606 | Object.defineProperty(VNode.prototype, "child", {
|
607 |
|
608 |
|
609 | get: function () {
|
610 | return this.componentInstance;
|
611 | },
|
612 | enumerable: false,
|
613 | configurable: true
|
614 | });
|
615 | return VNode;
|
616 | }());
|
617 | var createEmptyVNode = function (text) {
|
618 | if (text === void 0) { text = ''; }
|
619 | var node = new VNode();
|
620 | node.text = text;
|
621 | node.isComment = true;
|
622 | return node;
|
623 | };
|
624 | function createTextVNode(val) {
|
625 | return new VNode(undefined, undefined, undefined, String(val));
|
626 | }
|
627 |
|
628 |
|
629 |
|
630 |
|
631 | function cloneVNode(vnode) {
|
632 | var cloned = new VNode(vnode.tag, vnode.data,
|
633 |
|
634 |
|
635 |
|
636 | vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
|
637 | cloned.ns = vnode.ns;
|
638 | cloned.isStatic = vnode.isStatic;
|
639 | cloned.key = vnode.key;
|
640 | cloned.isComment = vnode.isComment;
|
641 | cloned.fnContext = vnode.fnContext;
|
642 | cloned.fnOptions = vnode.fnOptions;
|
643 | cloned.fnScopeId = vnode.fnScopeId;
|
644 | cloned.asyncMeta = vnode.asyncMeta;
|
645 | cloned.isCloned = true;
|
646 | return cloned;
|
647 | }
|
648 |
|
649 |
|
650 | var initProxy;
|
651 | {
|
652 | var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
|
653 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
654 | 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
655 | 'require'
|
656 | );
|
657 | var warnNonPresent_1 = function (target, key) {
|
658 | warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
|
659 | 'referenced during render. Make sure that this property is reactive, ' +
|
660 | 'either in the data option, or for class-based components, by ' +
|
661 | 'initializing the property. ' +
|
662 | 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
663 | };
|
664 | var warnReservedPrefix_1 = function (target, key) {
|
665 | warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
|
666 | 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
667 | 'prevent conflicts with Vue internals. ' +
|
668 | 'See: https://v2.vuejs.org/v2/api/#data', target);
|
669 | };
|
670 | var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
|
671 | if (hasProxy_1) {
|
672 | var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
673 | config.keyCodes = new Proxy(config.keyCodes, {
|
674 | set: function (target, key, value) {
|
675 | if (isBuiltInModifier_1(key)) {
|
676 | warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
|
677 | return false;
|
678 | }
|
679 | else {
|
680 | target[key] = value;
|
681 | return true;
|
682 | }
|
683 | }
|
684 | });
|
685 | }
|
686 | var hasHandler_1 = {
|
687 | has: function (target, key) {
|
688 | var has = key in target;
|
689 | var isAllowed = allowedGlobals_1(key) ||
|
690 | (typeof key === 'string' &&
|
691 | key.charAt(0) === '_' &&
|
692 | !(key in target.$data));
|
693 | if (!has && !isAllowed) {
|
694 | if (key in target.$data)
|
695 | warnReservedPrefix_1(target, key);
|
696 | else
|
697 | warnNonPresent_1(target, key);
|
698 | }
|
699 | return has || !isAllowed;
|
700 | }
|
701 | };
|
702 | var getHandler_1 = {
|
703 | get: function (target, key) {
|
704 | if (typeof key === 'string' && !(key in target)) {
|
705 | if (key in target.$data)
|
706 | warnReservedPrefix_1(target, key);
|
707 | else
|
708 | warnNonPresent_1(target, key);
|
709 | }
|
710 | return target[key];
|
711 | }
|
712 | };
|
713 | initProxy = function initProxy(vm) {
|
714 | if (hasProxy_1) {
|
715 |
|
716 | var options = vm.$options;
|
717 | var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
|
718 | vm._renderProxy = new Proxy(vm, handlers);
|
719 | }
|
720 | else {
|
721 | vm._renderProxy = vm;
|
722 | }
|
723 | };
|
724 | }
|
725 |
|
726 | |
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 | var __assign = function() {
|
742 | __assign = Object.assign || function __assign(t) {
|
743 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
744 | s = arguments[i];
|
745 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
746 | }
|
747 | return t;
|
748 | };
|
749 | return __assign.apply(this, arguments);
|
750 | };
|
751 |
|
752 | var uid$2 = 0;
|
753 | var pendingCleanupDeps = [];
|
754 | var cleanupDeps = function () {
|
755 | for (var i = 0; i < pendingCleanupDeps.length; i++) {
|
756 | var dep = pendingCleanupDeps[i];
|
757 | dep.subs = dep.subs.filter(function (s) { return s; });
|
758 | dep._pending = false;
|
759 | }
|
760 | pendingCleanupDeps.length = 0;
|
761 | };
|
762 | |
763 |
|
764 |
|
765 |
|
766 |
|
767 | var Dep = (function () {
|
768 | function Dep() {
|
769 |
|
770 | this._pending = false;
|
771 | this.id = uid$2++;
|
772 | this.subs = [];
|
773 | }
|
774 | Dep.prototype.addSub = function (sub) {
|
775 | this.subs.push(sub);
|
776 | };
|
777 | Dep.prototype.removeSub = function (sub) {
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | this.subs[this.subs.indexOf(sub)] = null;
|
783 | if (!this._pending) {
|
784 | this._pending = true;
|
785 | pendingCleanupDeps.push(this);
|
786 | }
|
787 | };
|
788 | Dep.prototype.depend = function (info) {
|
789 | if (Dep.target) {
|
790 | Dep.target.addDep(this);
|
791 | if (info && Dep.target.onTrack) {
|
792 | Dep.target.onTrack(__assign({ effect: Dep.target }, info));
|
793 | }
|
794 | }
|
795 | };
|
796 | Dep.prototype.notify = function (info) {
|
797 |
|
798 | var subs = this.subs.filter(function (s) { return s; });
|
799 | if (!config.async) {
|
800 |
|
801 |
|
802 |
|
803 | subs.sort(function (a, b) { return a.id - b.id; });
|
804 | }
|
805 | for (var i = 0, l = subs.length; i < l; i++) {
|
806 | var sub = subs[i];
|
807 | if (info) {
|
808 | sub.onTrigger &&
|
809 | sub.onTrigger(__assign({ effect: subs[i] }, info));
|
810 | }
|
811 | sub.update();
|
812 | }
|
813 | };
|
814 | return Dep;
|
815 | }());
|
816 |
|
817 |
|
818 |
|
819 | Dep.target = null;
|
820 | var targetStack = [];
|
821 | function pushTarget(target) {
|
822 | targetStack.push(target);
|
823 | Dep.target = target;
|
824 | }
|
825 | function popTarget() {
|
826 | targetStack.pop();
|
827 | Dep.target = targetStack[targetStack.length - 1];
|
828 | }
|
829 |
|
830 | |
831 |
|
832 |
|
833 |
|
834 | var arrayProto = Array.prototype;
|
835 | var arrayMethods = Object.create(arrayProto);
|
836 | var methodsToPatch = [
|
837 | 'push',
|
838 | 'pop',
|
839 | 'shift',
|
840 | 'unshift',
|
841 | 'splice',
|
842 | 'sort',
|
843 | 'reverse'
|
844 | ];
|
845 | |
846 |
|
847 |
|
848 | methodsToPatch.forEach(function (method) {
|
849 |
|
850 | var original = arrayProto[method];
|
851 | def(arrayMethods, method, function mutator() {
|
852 | var args = [];
|
853 | for (var _i = 0; _i < arguments.length; _i++) {
|
854 | args[_i] = arguments[_i];
|
855 | }
|
856 | var result = original.apply(this, args);
|
857 | var ob = this.__ob__;
|
858 | var inserted;
|
859 | switch (method) {
|
860 | case 'push':
|
861 | case 'unshift':
|
862 | inserted = args;
|
863 | break;
|
864 | case 'splice':
|
865 | inserted = args.slice(2);
|
866 | break;
|
867 | }
|
868 | if (inserted)
|
869 | ob.observeArray(inserted);
|
870 |
|
871 | {
|
872 | ob.dep.notify({
|
873 | type: "array mutation" ,
|
874 | target: this,
|
875 | key: method
|
876 | });
|
877 | }
|
878 | return result;
|
879 | });
|
880 | });
|
881 |
|
882 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
883 | var NO_INITIAL_VALUE = {};
|
884 | |
885 |
|
886 |
|
887 |
|
888 | var shouldObserve = true;
|
889 | function toggleObserving(value) {
|
890 | shouldObserve = value;
|
891 | }
|
892 |
|
893 | var mockDep = {
|
894 | notify: noop,
|
895 | depend: noop,
|
896 | addSub: noop,
|
897 | removeSub: noop
|
898 | };
|
899 | |
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | var Observer = (function () {
|
906 | function Observer(value, shallow, mock) {
|
907 | if (shallow === void 0) { shallow = false; }
|
908 | if (mock === void 0) { mock = false; }
|
909 | this.value = value;
|
910 | this.shallow = shallow;
|
911 | this.mock = mock;
|
912 |
|
913 | this.dep = mock ? mockDep : new Dep();
|
914 | this.vmCount = 0;
|
915 | def(value, '__ob__', this);
|
916 | if (isArray(value)) {
|
917 | if (!mock) {
|
918 | if (hasProto) {
|
919 | value.__proto__ = arrayMethods;
|
920 |
|
921 | }
|
922 | else {
|
923 | for (var i = 0, l = arrayKeys.length; i < l; i++) {
|
924 | var key = arrayKeys[i];
|
925 | def(value, key, arrayMethods[key]);
|
926 | }
|
927 | }
|
928 | }
|
929 | if (!shallow) {
|
930 | this.observeArray(value);
|
931 | }
|
932 | }
|
933 | else {
|
934 | |
935 |
|
936 |
|
937 |
|
938 |
|
939 | var keys = Object.keys(value);
|
940 | for (var i = 0; i < keys.length; i++) {
|
941 | var key = keys[i];
|
942 | defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
|
943 | }
|
944 | }
|
945 | }
|
946 | |
947 |
|
948 |
|
949 | Observer.prototype.observeArray = function (value) {
|
950 | for (var i = 0, l = value.length; i < l; i++) {
|
951 | observe(value[i], false, this.mock);
|
952 | }
|
953 | };
|
954 | return Observer;
|
955 | }());
|
956 |
|
957 | |
958 |
|
959 |
|
960 |
|
961 |
|
962 | function observe(value, shallow, ssrMockReactivity) {
|
963 | if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
964 | return value.__ob__;
|
965 | }
|
966 | if (shouldObserve &&
|
967 | (ssrMockReactivity || !isServerRendering()) &&
|
968 | (isArray(value) || isPlainObject(value)) &&
|
969 | Object.isExtensible(value) &&
|
970 | !value.__v_skip &&
|
971 | !isRef(value) &&
|
972 | !(value instanceof VNode)) {
|
973 | return new Observer(value, shallow, ssrMockReactivity);
|
974 | }
|
975 | }
|
976 | |
977 |
|
978 |
|
979 | function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
980 | var dep = new Dep();
|
981 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
982 | if (property && property.configurable === false) {
|
983 | return;
|
984 | }
|
985 |
|
986 | var getter = property && property.get;
|
987 | var setter = property && property.set;
|
988 | if ((!getter || setter) &&
|
989 | (val === NO_INITIAL_VALUE || arguments.length === 2)) {
|
990 | val = obj[key];
|
991 | }
|
992 | var childOb = !shallow && observe(val, false, mock);
|
993 | Object.defineProperty(obj, key, {
|
994 | enumerable: true,
|
995 | configurable: true,
|
996 | get: function reactiveGetter() {
|
997 | var value = getter ? getter.call(obj) : val;
|
998 | if (Dep.target) {
|
999 | {
|
1000 | dep.depend({
|
1001 | target: obj,
|
1002 | type: "get" ,
|
1003 | key: key
|
1004 | });
|
1005 | }
|
1006 | if (childOb) {
|
1007 | childOb.dep.depend();
|
1008 | if (isArray(value)) {
|
1009 | dependArray(value);
|
1010 | }
|
1011 | }
|
1012 | }
|
1013 | return isRef(value) && !shallow ? value.value : value;
|
1014 | },
|
1015 | set: function reactiveSetter(newVal) {
|
1016 | var value = getter ? getter.call(obj) : val;
|
1017 | if (!hasChanged(value, newVal)) {
|
1018 | return;
|
1019 | }
|
1020 | if (customSetter) {
|
1021 | customSetter();
|
1022 | }
|
1023 | if (setter) {
|
1024 | setter.call(obj, newVal);
|
1025 | }
|
1026 | else if (getter) {
|
1027 |
|
1028 | return;
|
1029 | }
|
1030 | else if (!shallow && isRef(value) && !isRef(newVal)) {
|
1031 | value.value = newVal;
|
1032 | return;
|
1033 | }
|
1034 | else {
|
1035 | val = newVal;
|
1036 | }
|
1037 | childOb = !shallow && observe(newVal, false, mock);
|
1038 | {
|
1039 | dep.notify({
|
1040 | type: "set" ,
|
1041 | target: obj,
|
1042 | key: key,
|
1043 | newValue: newVal,
|
1044 | oldValue: value
|
1045 | });
|
1046 | }
|
1047 | }
|
1048 | });
|
1049 | return dep;
|
1050 | }
|
1051 | function set(target, key, val) {
|
1052 | if ((isUndef(target) || isPrimitive(target))) {
|
1053 | warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
|
1054 | }
|
1055 | if (isReadonly(target)) {
|
1056 | warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
|
1057 | return;
|
1058 | }
|
1059 | var ob = target.__ob__;
|
1060 | if (isArray(target) && isValidArrayIndex(key)) {
|
1061 | target.length = Math.max(target.length, key);
|
1062 | target.splice(key, 1, val);
|
1063 |
|
1064 | if (ob && !ob.shallow && ob.mock) {
|
1065 | observe(val, false, true);
|
1066 | }
|
1067 | return val;
|
1068 | }
|
1069 | if (key in target && !(key in Object.prototype)) {
|
1070 | target[key] = val;
|
1071 | return val;
|
1072 | }
|
1073 | if (target._isVue || (ob && ob.vmCount)) {
|
1074 | warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1075 | 'at runtime - declare it upfront in the data option.');
|
1076 | return val;
|
1077 | }
|
1078 | if (!ob) {
|
1079 | target[key] = val;
|
1080 | return val;
|
1081 | }
|
1082 | defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
|
1083 | {
|
1084 | ob.dep.notify({
|
1085 | type: "add" ,
|
1086 | target: target,
|
1087 | key: key,
|
1088 | newValue: val,
|
1089 | oldValue: undefined
|
1090 | });
|
1091 | }
|
1092 | return val;
|
1093 | }
|
1094 | function del(target, key) {
|
1095 | if ((isUndef(target) || isPrimitive(target))) {
|
1096 | warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
|
1097 | }
|
1098 | if (isArray(target) && isValidArrayIndex(key)) {
|
1099 | target.splice(key, 1);
|
1100 | return;
|
1101 | }
|
1102 | var ob = target.__ob__;
|
1103 | if (target._isVue || (ob && ob.vmCount)) {
|
1104 | warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
|
1105 | '- just set it to null.');
|
1106 | return;
|
1107 | }
|
1108 | if (isReadonly(target)) {
|
1109 | warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
|
1110 | return;
|
1111 | }
|
1112 | if (!hasOwn(target, key)) {
|
1113 | return;
|
1114 | }
|
1115 | delete target[key];
|
1116 | if (!ob) {
|
1117 | return;
|
1118 | }
|
1119 | {
|
1120 | ob.dep.notify({
|
1121 | type: "delete" ,
|
1122 | target: target,
|
1123 | key: key
|
1124 | });
|
1125 | }
|
1126 | }
|
1127 | |
1128 |
|
1129 |
|
1130 |
|
1131 | function dependArray(value) {
|
1132 | for (var e = void 0, i = 0, l = value.length; i < l; i++) {
|
1133 | e = value[i];
|
1134 | if (e && e.__ob__) {
|
1135 | e.__ob__.dep.depend();
|
1136 | }
|
1137 | if (isArray(e)) {
|
1138 | dependArray(e);
|
1139 | }
|
1140 | }
|
1141 | }
|
1142 |
|
1143 | function reactive(target) {
|
1144 | makeReactive(target, false);
|
1145 | return target;
|
1146 | }
|
1147 | |
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 | function shallowReactive(target) {
|
1153 | makeReactive(target, true);
|
1154 | def(target, "__v_isShallow" , true);
|
1155 | return target;
|
1156 | }
|
1157 | function makeReactive(target, shallow) {
|
1158 |
|
1159 | if (!isReadonly(target)) {
|
1160 | {
|
1161 | if (isArray(target)) {
|
1162 | warn$2("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
|
1163 | }
|
1164 | var existingOb = target && target.__ob__;
|
1165 | if (existingOb && existingOb.shallow !== shallow) {
|
1166 | warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
|
1167 | }
|
1168 | }
|
1169 | var ob = observe(target, shallow, isServerRendering() );
|
1170 | if (!ob) {
|
1171 | if (target == null || isPrimitive(target)) {
|
1172 | warn$2("value cannot be made reactive: ".concat(String(target)));
|
1173 | }
|
1174 | if (isCollectionType(target)) {
|
1175 | warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
|
1176 | }
|
1177 | }
|
1178 | }
|
1179 | }
|
1180 | function isReactive(value) {
|
1181 | if (isReadonly(value)) {
|
1182 | return isReactive(value["__v_raw" ]);
|
1183 | }
|
1184 | return !!(value && value.__ob__);
|
1185 | }
|
1186 | function isShallow(value) {
|
1187 | return !!(value && value.__v_isShallow);
|
1188 | }
|
1189 | function isReadonly(value) {
|
1190 | return !!(value && value.__v_isReadonly);
|
1191 | }
|
1192 | function isProxy(value) {
|
1193 | return isReactive(value) || isReadonly(value);
|
1194 | }
|
1195 | function toRaw(observed) {
|
1196 | var raw = observed && observed["__v_raw" ];
|
1197 | return raw ? toRaw(raw) : observed;
|
1198 | }
|
1199 | function markRaw(value) {
|
1200 |
|
1201 | if (Object.isExtensible(value)) {
|
1202 | def(value, "__v_skip" , true);
|
1203 | }
|
1204 | return value;
|
1205 | }
|
1206 | |
1207 |
|
1208 |
|
1209 | function isCollectionType(value) {
|
1210 | var type = toRawType(value);
|
1211 | return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
|
1212 | }
|
1213 |
|
1214 | |
1215 |
|
1216 |
|
1217 | var RefFlag = "__v_isRef";
|
1218 | function isRef(r) {
|
1219 | return !!(r && r.__v_isRef === true);
|
1220 | }
|
1221 | function ref$1(value) {
|
1222 | return createRef(value, false);
|
1223 | }
|
1224 | function shallowRef(value) {
|
1225 | return createRef(value, true);
|
1226 | }
|
1227 | function createRef(rawValue, shallow) {
|
1228 | if (isRef(rawValue)) {
|
1229 | return rawValue;
|
1230 | }
|
1231 | var ref = {};
|
1232 | def(ref, RefFlag, true);
|
1233 | def(ref, "__v_isShallow" , shallow);
|
1234 | def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
|
1235 | return ref;
|
1236 | }
|
1237 | function triggerRef(ref) {
|
1238 | if (!ref.dep) {
|
1239 | warn$2("received object is not a triggerable ref.");
|
1240 | }
|
1241 | {
|
1242 | ref.dep &&
|
1243 | ref.dep.notify({
|
1244 | type: "set" ,
|
1245 | target: ref,
|
1246 | key: 'value'
|
1247 | });
|
1248 | }
|
1249 | }
|
1250 | function unref(ref) {
|
1251 | return isRef(ref) ? ref.value : ref;
|
1252 | }
|
1253 | function proxyRefs(objectWithRefs) {
|
1254 | if (isReactive(objectWithRefs)) {
|
1255 | return objectWithRefs;
|
1256 | }
|
1257 | var proxy = {};
|
1258 | var keys = Object.keys(objectWithRefs);
|
1259 | for (var i = 0; i < keys.length; i++) {
|
1260 | proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
|
1261 | }
|
1262 | return proxy;
|
1263 | }
|
1264 | function proxyWithRefUnwrap(target, source, key) {
|
1265 | Object.defineProperty(target, key, {
|
1266 | enumerable: true,
|
1267 | configurable: true,
|
1268 | get: function () {
|
1269 | var val = source[key];
|
1270 | if (isRef(val)) {
|
1271 | return val.value;
|
1272 | }
|
1273 | else {
|
1274 | var ob = val && val.__ob__;
|
1275 | if (ob)
|
1276 | ob.dep.depend();
|
1277 | return val;
|
1278 | }
|
1279 | },
|
1280 | set: function (value) {
|
1281 | var oldValue = source[key];
|
1282 | if (isRef(oldValue) && !isRef(value)) {
|
1283 | oldValue.value = value;
|
1284 | }
|
1285 | else {
|
1286 | source[key] = value;
|
1287 | }
|
1288 | }
|
1289 | });
|
1290 | }
|
1291 | function customRef(factory) {
|
1292 | var dep = new Dep();
|
1293 | var _a = factory(function () {
|
1294 | {
|
1295 | dep.depend({
|
1296 | target: ref,
|
1297 | type: "get" ,
|
1298 | key: 'value'
|
1299 | });
|
1300 | }
|
1301 | }, function () {
|
1302 | {
|
1303 | dep.notify({
|
1304 | target: ref,
|
1305 | type: "set" ,
|
1306 | key: 'value'
|
1307 | });
|
1308 | }
|
1309 | }), get = _a.get, set = _a.set;
|
1310 | var ref = {
|
1311 | get value() {
|
1312 | return get();
|
1313 | },
|
1314 | set value(newVal) {
|
1315 | set(newVal);
|
1316 | }
|
1317 | };
|
1318 | def(ref, RefFlag, true);
|
1319 | return ref;
|
1320 | }
|
1321 | function toRefs(object) {
|
1322 | if (!isReactive(object)) {
|
1323 | warn$2("toRefs() expects a reactive object but received a plain one.");
|
1324 | }
|
1325 | var ret = isArray(object) ? new Array(object.length) : {};
|
1326 | for (var key in object) {
|
1327 | ret[key] = toRef(object, key);
|
1328 | }
|
1329 | return ret;
|
1330 | }
|
1331 | function toRef(object, key, defaultValue) {
|
1332 | var val = object[key];
|
1333 | if (isRef(val)) {
|
1334 | return val;
|
1335 | }
|
1336 | var ref = {
|
1337 | get value() {
|
1338 | var val = object[key];
|
1339 | return val === undefined ? defaultValue : val;
|
1340 | },
|
1341 | set value(newVal) {
|
1342 | object[key] = newVal;
|
1343 | }
|
1344 | };
|
1345 | def(ref, RefFlag, true);
|
1346 | return ref;
|
1347 | }
|
1348 |
|
1349 | var rawToReadonlyFlag = "__v_rawToReadonly";
|
1350 | var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
|
1351 | function readonly(target) {
|
1352 | return createReadonly(target, false);
|
1353 | }
|
1354 | function createReadonly(target, shallow) {
|
1355 | if (!isPlainObject(target)) {
|
1356 | {
|
1357 | if (isArray(target)) {
|
1358 | warn$2("Vue 2 does not support readonly arrays.");
|
1359 | }
|
1360 | else if (isCollectionType(target)) {
|
1361 | warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
|
1362 | }
|
1363 | else {
|
1364 | warn$2("value cannot be made readonly: ".concat(typeof target));
|
1365 | }
|
1366 | }
|
1367 | return target;
|
1368 | }
|
1369 | if (!Object.isExtensible(target)) {
|
1370 | warn$2("Vue 2 does not support creating readonly proxy for non-extensible object.");
|
1371 | }
|
1372 |
|
1373 | if (isReadonly(target)) {
|
1374 | return target;
|
1375 | }
|
1376 |
|
1377 | var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
|
1378 | var existingProxy = target[existingFlag];
|
1379 | if (existingProxy) {
|
1380 | return existingProxy;
|
1381 | }
|
1382 | var proxy = Object.create(Object.getPrototypeOf(target));
|
1383 | def(target, existingFlag, proxy);
|
1384 | def(proxy, "__v_isReadonly" , true);
|
1385 | def(proxy, "__v_raw" , target);
|
1386 | if (isRef(target)) {
|
1387 | def(proxy, RefFlag, true);
|
1388 | }
|
1389 | if (shallow || isShallow(target)) {
|
1390 | def(proxy, "__v_isShallow" , true);
|
1391 | }
|
1392 | var keys = Object.keys(target);
|
1393 | for (var i = 0; i < keys.length; i++) {
|
1394 | defineReadonlyProperty(proxy, target, keys[i], shallow);
|
1395 | }
|
1396 | return proxy;
|
1397 | }
|
1398 | function defineReadonlyProperty(proxy, target, key, shallow) {
|
1399 | Object.defineProperty(proxy, key, {
|
1400 | enumerable: true,
|
1401 | configurable: true,
|
1402 | get: function () {
|
1403 | var val = target[key];
|
1404 | return shallow || !isPlainObject(val) ? val : readonly(val);
|
1405 | },
|
1406 | set: function () {
|
1407 | warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
|
1408 | }
|
1409 | });
|
1410 | }
|
1411 | |
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 | function shallowReadonly(target) {
|
1418 | return createReadonly(target, true);
|
1419 | }
|
1420 |
|
1421 | function computed(getterOrOptions, debugOptions) {
|
1422 | var getter;
|
1423 | var setter;
|
1424 | var onlyGetter = isFunction(getterOrOptions);
|
1425 | if (onlyGetter) {
|
1426 | getter = getterOrOptions;
|
1427 | setter = function () {
|
1428 | warn$2('Write operation failed: computed value is readonly');
|
1429 | }
|
1430 | ;
|
1431 | }
|
1432 | else {
|
1433 | getter = getterOrOptions.get;
|
1434 | setter = getterOrOptions.set;
|
1435 | }
|
1436 | var watcher = isServerRendering()
|
1437 | ? null
|
1438 | : new Watcher(currentInstance, getter, noop, { lazy: true });
|
1439 | if (watcher && debugOptions) {
|
1440 | watcher.onTrack = debugOptions.onTrack;
|
1441 | watcher.onTrigger = debugOptions.onTrigger;
|
1442 | }
|
1443 | var ref = {
|
1444 |
|
1445 |
|
1446 | effect: watcher,
|
1447 | get value() {
|
1448 | if (watcher) {
|
1449 | if (watcher.dirty) {
|
1450 | watcher.evaluate();
|
1451 | }
|
1452 | if (Dep.target) {
|
1453 | if (Dep.target.onTrack) {
|
1454 | Dep.target.onTrack({
|
1455 | effect: Dep.target,
|
1456 | target: ref,
|
1457 | type: "get" ,
|
1458 | key: 'value'
|
1459 | });
|
1460 | }
|
1461 | watcher.depend();
|
1462 | }
|
1463 | return watcher.value;
|
1464 | }
|
1465 | else {
|
1466 | return getter();
|
1467 | }
|
1468 | },
|
1469 | set value(newVal) {
|
1470 | setter(newVal);
|
1471 | }
|
1472 | };
|
1473 | def(ref, RefFlag, true);
|
1474 | def(ref, "__v_isReadonly" , onlyGetter);
|
1475 | return ref;
|
1476 | }
|
1477 |
|
1478 | var mark;
|
1479 | var measure;
|
1480 | {
|
1481 | var perf_1 = inBrowser && window.performance;
|
1482 |
|
1483 | if (perf_1 &&
|
1484 |
|
1485 | perf_1.mark &&
|
1486 |
|
1487 | perf_1.measure &&
|
1488 |
|
1489 | perf_1.clearMarks &&
|
1490 |
|
1491 | perf_1.clearMeasures) {
|
1492 | mark = function (tag) { return perf_1.mark(tag); };
|
1493 | measure = function (name, startTag, endTag) {
|
1494 | perf_1.measure(name, startTag, endTag);
|
1495 | perf_1.clearMarks(startTag);
|
1496 | perf_1.clearMarks(endTag);
|
1497 |
|
1498 | };
|
1499 | }
|
1500 | }
|
1501 |
|
1502 | var normalizeEvent = cached(function (name) {
|
1503 | var passive = name.charAt(0) === '&';
|
1504 | name = passive ? name.slice(1) : name;
|
1505 | var once = name.charAt(0) === '~';
|
1506 | name = once ? name.slice(1) : name;
|
1507 | var capture = name.charAt(0) === '!';
|
1508 | name = capture ? name.slice(1) : name;
|
1509 | return {
|
1510 | name: name,
|
1511 | once: once,
|
1512 | capture: capture,
|
1513 | passive: passive
|
1514 | };
|
1515 | });
|
1516 | function createFnInvoker(fns, vm) {
|
1517 | function invoker() {
|
1518 | var fns = invoker.fns;
|
1519 | if (isArray(fns)) {
|
1520 | var cloned = fns.slice();
|
1521 | for (var i = 0; i < cloned.length; i++) {
|
1522 | invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
|
1523 | }
|
1524 | }
|
1525 | else {
|
1526 |
|
1527 | return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
|
1528 | }
|
1529 | }
|
1530 | invoker.fns = fns;
|
1531 | return invoker;
|
1532 | }
|
1533 | function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
|
1534 | var name, cur, old, event;
|
1535 | for (name in on) {
|
1536 | cur = on[name];
|
1537 | old = oldOn[name];
|
1538 | event = normalizeEvent(name);
|
1539 | if (isUndef(cur)) {
|
1540 | warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
|
1541 | }
|
1542 | else if (isUndef(old)) {
|
1543 | if (isUndef(cur.fns)) {
|
1544 | cur = on[name] = createFnInvoker(cur, vm);
|
1545 | }
|
1546 | if (isTrue(event.once)) {
|
1547 | cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
1548 | }
|
1549 | add(event.name, cur, event.capture, event.passive, event.params);
|
1550 | }
|
1551 | else if (cur !== old) {
|
1552 | old.fns = cur;
|
1553 | on[name] = old;
|
1554 | }
|
1555 | }
|
1556 | for (name in oldOn) {
|
1557 | if (isUndef(on[name])) {
|
1558 | event = normalizeEvent(name);
|
1559 | remove(event.name, oldOn[name], event.capture);
|
1560 | }
|
1561 | }
|
1562 | }
|
1563 |
|
1564 | function mergeVNodeHook(def, hookKey, hook) {
|
1565 | if (def instanceof VNode) {
|
1566 | def = def.data.hook || (def.data.hook = {});
|
1567 | }
|
1568 | var invoker;
|
1569 | var oldHook = def[hookKey];
|
1570 | function wrappedHook() {
|
1571 | hook.apply(this, arguments);
|
1572 |
|
1573 |
|
1574 | remove$2(invoker.fns, wrappedHook);
|
1575 | }
|
1576 | if (isUndef(oldHook)) {
|
1577 |
|
1578 | invoker = createFnInvoker([wrappedHook]);
|
1579 | }
|
1580 | else {
|
1581 |
|
1582 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
1583 |
|
1584 | invoker = oldHook;
|
1585 | invoker.fns.push(wrappedHook);
|
1586 | }
|
1587 | else {
|
1588 |
|
1589 | invoker = createFnInvoker([oldHook, wrappedHook]);
|
1590 | }
|
1591 | }
|
1592 | invoker.merged = true;
|
1593 | def[hookKey] = invoker;
|
1594 | }
|
1595 |
|
1596 | function extractPropsFromVNodeData(data, Ctor, tag) {
|
1597 |
|
1598 |
|
1599 |
|
1600 | var propOptions = Ctor.options.props;
|
1601 | if (isUndef(propOptions)) {
|
1602 | return;
|
1603 | }
|
1604 | var res = {};
|
1605 | var attrs = data.attrs, props = data.props;
|
1606 | if (isDef(attrs) || isDef(props)) {
|
1607 | for (var key in propOptions) {
|
1608 | var altKey = hyphenate(key);
|
1609 | {
|
1610 | var keyInLowerCase = key.toLowerCase();
|
1611 | if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
|
1612 | tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
|
1613 | "".concat(formatComponentName(
|
1614 |
|
1615 | tag || Ctor), ", but the declared prop name is") +
|
1616 | " \"".concat(key, "\". ") +
|
1617 | "Note that HTML attributes are case-insensitive and camelCased " +
|
1618 | "props need to use their kebab-case equivalents when using in-DOM " +
|
1619 | "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
|
1620 | }
|
1621 | }
|
1622 | checkProp(res, props, key, altKey, true) ||
|
1623 | checkProp(res, attrs, key, altKey, false);
|
1624 | }
|
1625 | }
|
1626 | return res;
|
1627 | }
|
1628 | function checkProp(res, hash, key, altKey, preserve) {
|
1629 | if (isDef(hash)) {
|
1630 | if (hasOwn(hash, key)) {
|
1631 | res[key] = hash[key];
|
1632 | if (!preserve) {
|
1633 | delete hash[key];
|
1634 | }
|
1635 | return true;
|
1636 | }
|
1637 | else if (hasOwn(hash, altKey)) {
|
1638 | res[key] = hash[altKey];
|
1639 | if (!preserve) {
|
1640 | delete hash[altKey];
|
1641 | }
|
1642 | return true;
|
1643 | }
|
1644 | }
|
1645 | return false;
|
1646 | }
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 | function simpleNormalizeChildren(children) {
|
1660 | for (var i = 0; i < children.length; i++) {
|
1661 | if (isArray(children[i])) {
|
1662 | return Array.prototype.concat.apply([], children);
|
1663 | }
|
1664 | }
|
1665 | return children;
|
1666 | }
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 | function normalizeChildren(children) {
|
1672 | return isPrimitive(children)
|
1673 | ? [createTextVNode(children)]
|
1674 | : isArray(children)
|
1675 | ? normalizeArrayChildren(children)
|
1676 | : undefined;
|
1677 | }
|
1678 | function isTextNode(node) {
|
1679 | return isDef(node) && isDef(node.text) && isFalse(node.isComment);
|
1680 | }
|
1681 | function normalizeArrayChildren(children, nestedIndex) {
|
1682 | var res = [];
|
1683 | var i, c, lastIndex, last;
|
1684 | for (i = 0; i < children.length; i++) {
|
1685 | c = children[i];
|
1686 | if (isUndef(c) || typeof c === 'boolean')
|
1687 | continue;
|
1688 | lastIndex = res.length - 1;
|
1689 | last = res[lastIndex];
|
1690 |
|
1691 | if (isArray(c)) {
|
1692 | if (c.length > 0) {
|
1693 | c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
|
1694 |
|
1695 | if (isTextNode(c[0]) && isTextNode(last)) {
|
1696 | res[lastIndex] = createTextVNode(last.text + c[0].text);
|
1697 | c.shift();
|
1698 | }
|
1699 | res.push.apply(res, c);
|
1700 | }
|
1701 | }
|
1702 | else if (isPrimitive(c)) {
|
1703 | if (isTextNode(last)) {
|
1704 |
|
1705 |
|
1706 |
|
1707 | res[lastIndex] = createTextVNode(last.text + c);
|
1708 | }
|
1709 | else if (c !== '') {
|
1710 |
|
1711 | res.push(createTextVNode(c));
|
1712 | }
|
1713 | }
|
1714 | else {
|
1715 | if (isTextNode(c) && isTextNode(last)) {
|
1716 |
|
1717 | res[lastIndex] = createTextVNode(last.text + c.text);
|
1718 | }
|
1719 | else {
|
1720 |
|
1721 | if (isTrue(children._isVList) &&
|
1722 | isDef(c.tag) &&
|
1723 | isUndef(c.key) &&
|
1724 | isDef(nestedIndex)) {
|
1725 | c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
|
1726 | }
|
1727 | res.push(c);
|
1728 | }
|
1729 | }
|
1730 | }
|
1731 | return res;
|
1732 | }
|
1733 |
|
1734 | var SIMPLE_NORMALIZE = 1;
|
1735 | var ALWAYS_NORMALIZE = 2;
|
1736 |
|
1737 |
|
1738 | function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
|
1739 | if (isArray(data) || isPrimitive(data)) {
|
1740 | normalizationType = children;
|
1741 | children = data;
|
1742 | data = undefined;
|
1743 | }
|
1744 | if (isTrue(alwaysNormalize)) {
|
1745 | normalizationType = ALWAYS_NORMALIZE;
|
1746 | }
|
1747 | return _createElement(context, tag, data, children, normalizationType);
|
1748 | }
|
1749 | function _createElement(context, tag, data, children, normalizationType) {
|
1750 | if (isDef(data) && isDef(data.__ob__)) {
|
1751 | warn$2("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
|
1752 | return createEmptyVNode();
|
1753 | }
|
1754 |
|
1755 | if (isDef(data) && isDef(data.is)) {
|
1756 | tag = data.is;
|
1757 | }
|
1758 | if (!tag) {
|
1759 |
|
1760 | return createEmptyVNode();
|
1761 | }
|
1762 |
|
1763 | if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
|
1764 | warn$2('Avoid using non-primitive value as key, ' +
|
1765 | 'use string/number value instead.', context);
|
1766 | }
|
1767 |
|
1768 | if (isArray(children) && isFunction(children[0])) {
|
1769 | data = data || {};
|
1770 | data.scopedSlots = { default: children[0] };
|
1771 | children.length = 0;
|
1772 | }
|
1773 | if (normalizationType === ALWAYS_NORMALIZE) {
|
1774 | children = normalizeChildren(children);
|
1775 | }
|
1776 | else if (normalizationType === SIMPLE_NORMALIZE) {
|
1777 | children = simpleNormalizeChildren(children);
|
1778 | }
|
1779 | var vnode, ns;
|
1780 | if (typeof tag === 'string') {
|
1781 | var Ctor = void 0;
|
1782 | ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
1783 | if (config.isReservedTag(tag)) {
|
1784 |
|
1785 | if (isDef(data) &&
|
1786 | isDef(data.nativeOn) &&
|
1787 | data.tag !== 'component') {
|
1788 | warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
|
1789 | }
|
1790 | vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
|
1791 | }
|
1792 | else if ((!data || !data.pre) &&
|
1793 | isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
|
1794 |
|
1795 | vnode = createComponent(Ctor, data, context, children, tag);
|
1796 | }
|
1797 | else {
|
1798 |
|
1799 |
|
1800 |
|
1801 | vnode = new VNode(tag, data, children, undefined, undefined, context);
|
1802 | }
|
1803 | }
|
1804 | else {
|
1805 |
|
1806 | vnode = createComponent(tag, data, context, children);
|
1807 | }
|
1808 | if (isArray(vnode)) {
|
1809 | return vnode;
|
1810 | }
|
1811 | else if (isDef(vnode)) {
|
1812 | if (isDef(ns))
|
1813 | applyNS(vnode, ns);
|
1814 | if (isDef(data))
|
1815 | registerDeepBindings(data);
|
1816 | return vnode;
|
1817 | }
|
1818 | else {
|
1819 | return createEmptyVNode();
|
1820 | }
|
1821 | }
|
1822 | function applyNS(vnode, ns, force) {
|
1823 | vnode.ns = ns;
|
1824 | if (vnode.tag === 'foreignObject') {
|
1825 |
|
1826 | ns = undefined;
|
1827 | force = true;
|
1828 | }
|
1829 | if (isDef(vnode.children)) {
|
1830 | for (var i = 0, l = vnode.children.length; i < l; i++) {
|
1831 | var child = vnode.children[i];
|
1832 | if (isDef(child.tag) &&
|
1833 | (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
1834 | applyNS(child, ns, force);
|
1835 | }
|
1836 | }
|
1837 | }
|
1838 | }
|
1839 |
|
1840 |
|
1841 |
|
1842 | function registerDeepBindings(data) {
|
1843 | if (isObject(data.style)) {
|
1844 | traverse(data.style);
|
1845 | }
|
1846 | if (isObject(data.class)) {
|
1847 | traverse(data.class);
|
1848 | }
|
1849 | }
|
1850 |
|
1851 | |
1852 |
|
1853 |
|
1854 | function renderList(val, render) {
|
1855 | var ret = null, i, l, keys, key;
|
1856 | if (isArray(val) || typeof val === 'string') {
|
1857 | ret = new Array(val.length);
|
1858 | for (i = 0, l = val.length; i < l; i++) {
|
1859 | ret[i] = render(val[i], i);
|
1860 | }
|
1861 | }
|
1862 | else if (typeof val === 'number') {
|
1863 | ret = new Array(val);
|
1864 | for (i = 0; i < val; i++) {
|
1865 | ret[i] = render(i + 1, i);
|
1866 | }
|
1867 | }
|
1868 | else if (isObject(val)) {
|
1869 | if (hasSymbol && val[Symbol.iterator]) {
|
1870 | ret = [];
|
1871 | var iterator = val[Symbol.iterator]();
|
1872 | var result = iterator.next();
|
1873 | while (!result.done) {
|
1874 | ret.push(render(result.value, ret.length));
|
1875 | result = iterator.next();
|
1876 | }
|
1877 | }
|
1878 | else {
|
1879 | keys = Object.keys(val);
|
1880 | ret = new Array(keys.length);
|
1881 | for (i = 0, l = keys.length; i < l; i++) {
|
1882 | key = keys[i];
|
1883 | ret[i] = render(val[key], key, i);
|
1884 | }
|
1885 | }
|
1886 | }
|
1887 | if (!isDef(ret)) {
|
1888 | ret = [];
|
1889 | }
|
1890 | ret._isVList = true;
|
1891 | return ret;
|
1892 | }
|
1893 |
|
1894 | |
1895 |
|
1896 |
|
1897 | function renderSlot(name, fallbackRender, props, bindObject) {
|
1898 | var scopedSlotFn = this.$scopedSlots[name];
|
1899 | var nodes;
|
1900 | if (scopedSlotFn) {
|
1901 |
|
1902 | props = props || {};
|
1903 | if (bindObject) {
|
1904 | if (!isObject(bindObject)) {
|
1905 | warn$2('slot v-bind without argument expects an Object', this);
|
1906 | }
|
1907 | props = extend(extend({}, bindObject), props);
|
1908 | }
|
1909 | nodes =
|
1910 | scopedSlotFn(props) ||
|
1911 | (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
|
1912 | }
|
1913 | else {
|
1914 | nodes =
|
1915 | this.$slots[name] ||
|
1916 | (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
|
1917 | }
|
1918 | var target = props && props.slot;
|
1919 | if (target) {
|
1920 | return this.$createElement('template', { slot: target }, nodes);
|
1921 | }
|
1922 | else {
|
1923 | return nodes;
|
1924 | }
|
1925 | }
|
1926 |
|
1927 | |
1928 |
|
1929 |
|
1930 | function resolveFilter(id) {
|
1931 | return resolveAsset(this.$options, 'filters', id, true) || identity;
|
1932 | }
|
1933 |
|
1934 | function isKeyNotMatch(expect, actual) {
|
1935 | if (isArray(expect)) {
|
1936 | return expect.indexOf(actual) === -1;
|
1937 | }
|
1938 | else {
|
1939 | return expect !== actual;
|
1940 | }
|
1941 | }
|
1942 | |
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 | function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
|
1948 | var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
1949 | if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
1950 | return isKeyNotMatch(builtInKeyName, eventKeyName);
|
1951 | }
|
1952 | else if (mappedKeyCode) {
|
1953 | return isKeyNotMatch(mappedKeyCode, eventKeyCode);
|
1954 | }
|
1955 | else if (eventKeyName) {
|
1956 | return hyphenate(eventKeyName) !== key;
|
1957 | }
|
1958 | return eventKeyCode === undefined;
|
1959 | }
|
1960 |
|
1961 | |
1962 |
|
1963 |
|
1964 | function bindObjectProps(data, tag, value, asProp, isSync) {
|
1965 | if (value) {
|
1966 | if (!isObject(value)) {
|
1967 | warn$2('v-bind without argument expects an Object or Array value', this);
|
1968 | }
|
1969 | else {
|
1970 | if (isArray(value)) {
|
1971 | value = toObject(value);
|
1972 | }
|
1973 | var hash = void 0;
|
1974 | var _loop_1 = function (key) {
|
1975 | if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
|
1976 | hash = data;
|
1977 | }
|
1978 | else {
|
1979 | var type = data.attrs && data.attrs.type;
|
1980 | hash =
|
1981 | asProp || config.mustUseProp(tag, type, key)
|
1982 | ? data.domProps || (data.domProps = {})
|
1983 | : data.attrs || (data.attrs = {});
|
1984 | }
|
1985 | var camelizedKey = camelize(key);
|
1986 | var hyphenatedKey = hyphenate(key);
|
1987 | if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
1988 | hash[key] = value[key];
|
1989 | if (isSync) {
|
1990 | var on = data.on || (data.on = {});
|
1991 | on["update:".concat(key)] = function ($event) {
|
1992 | value[key] = $event;
|
1993 | };
|
1994 | }
|
1995 | }
|
1996 | };
|
1997 | for (var key in value) {
|
1998 | _loop_1(key);
|
1999 | }
|
2000 | }
|
2001 | }
|
2002 | return data;
|
2003 | }
|
2004 |
|
2005 | |
2006 |
|
2007 |
|
2008 | function renderStatic(index, isInFor) {
|
2009 | var cached = this._staticTrees || (this._staticTrees = []);
|
2010 | var tree = cached[index];
|
2011 |
|
2012 |
|
2013 | if (tree && !isInFor) {
|
2014 | return tree;
|
2015 | }
|
2016 |
|
2017 | tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this
|
2018 | );
|
2019 | markStatic$1(tree, "__static__".concat(index), false);
|
2020 | return tree;
|
2021 | }
|
2022 | |
2023 |
|
2024 |
|
2025 |
|
2026 | function markOnce(tree, index, key) {
|
2027 | markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
|
2028 | return tree;
|
2029 | }
|
2030 | function markStatic$1(tree, key, isOnce) {
|
2031 | if (isArray(tree)) {
|
2032 | for (var i = 0; i < tree.length; i++) {
|
2033 | if (tree[i] && typeof tree[i] !== 'string') {
|
2034 | markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
|
2035 | }
|
2036 | }
|
2037 | }
|
2038 | else {
|
2039 | markStaticNode(tree, key, isOnce);
|
2040 | }
|
2041 | }
|
2042 | function markStaticNode(node, key, isOnce) {
|
2043 | node.isStatic = true;
|
2044 | node.key = key;
|
2045 | node.isOnce = isOnce;
|
2046 | }
|
2047 |
|
2048 | function bindObjectListeners(data, value) {
|
2049 | if (value) {
|
2050 | if (!isPlainObject(value)) {
|
2051 | warn$2('v-on without argument expects an Object value', this);
|
2052 | }
|
2053 | else {
|
2054 | var on = (data.on = data.on ? extend({}, data.on) : {});
|
2055 | for (var key in value) {
|
2056 | var existing = on[key];
|
2057 | var ours = value[key];
|
2058 | on[key] = existing ? [].concat(existing, ours) : ours;
|
2059 | }
|
2060 | }
|
2061 | }
|
2062 | return data;
|
2063 | }
|
2064 |
|
2065 | function resolveScopedSlots(fns, res,
|
2066 | // the following are added in 2.6
|
2067 | hasDynamicKeys, contentHashKey) {
|
2068 | res = res || { $stable: !hasDynamicKeys };
|
2069 | for (var i = 0; i < fns.length; i++) {
|
2070 | var slot = fns[i];
|
2071 | if (isArray(slot)) {
|
2072 | resolveScopedSlots(slot, res, hasDynamicKeys);
|
2073 | }
|
2074 | else if (slot) {
|
2075 |
|
2076 |
|
2077 | if (slot.proxy) {
|
2078 |
|
2079 | slot.fn.proxy = true;
|
2080 | }
|
2081 | res[slot.key] = slot.fn;
|
2082 | }
|
2083 | }
|
2084 | if (contentHashKey) {
|
2085 | res.$key = contentHashKey;
|
2086 | }
|
2087 | return res;
|
2088 | }
|
2089 |
|
2090 |
|
2091 | function bindDynamicKeys(baseObj, values) {
|
2092 | for (var i = 0; i < values.length; i += 2) {
|
2093 | var key = values[i];
|
2094 | if (typeof key === 'string' && key) {
|
2095 | baseObj[values[i]] = values[i + 1];
|
2096 | }
|
2097 | else if (key !== '' && key !== null) {
|
2098 |
|
2099 | warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
|
2100 | }
|
2101 | }
|
2102 | return baseObj;
|
2103 | }
|
2104 |
|
2105 |
|
2106 |
|
2107 | function prependModifier(value, symbol) {
|
2108 | return typeof value === 'string' ? symbol + value : value;
|
2109 | }
|
2110 |
|
2111 | function installRenderHelpers(target) {
|
2112 | target._o = markOnce;
|
2113 | target._n = toNumber;
|
2114 | target._s = toString;
|
2115 | target._l = renderList;
|
2116 | target._t = renderSlot;
|
2117 | target._q = looseEqual;
|
2118 | target._i = looseIndexOf;
|
2119 | target._m = renderStatic;
|
2120 | target._f = resolveFilter;
|
2121 | target._k = checkKeyCodes;
|
2122 | target._b = bindObjectProps;
|
2123 | target._v = createTextVNode;
|
2124 | target._e = createEmptyVNode;
|
2125 | target._u = resolveScopedSlots;
|
2126 | target._g = bindObjectListeners;
|
2127 | target._d = bindDynamicKeys;
|
2128 | target._p = prependModifier;
|
2129 | }
|
2130 |
|
2131 | |
2132 |
|
2133 |
|
2134 | function resolveSlots(children, context) {
|
2135 | if (!children || !children.length) {
|
2136 | return {};
|
2137 | }
|
2138 | var slots = {};
|
2139 | for (var i = 0, l = children.length; i < l; i++) {
|
2140 | var child = children[i];
|
2141 | var data = child.data;
|
2142 |
|
2143 | if (data && data.attrs && data.attrs.slot) {
|
2144 | delete data.attrs.slot;
|
2145 | }
|
2146 |
|
2147 |
|
2148 | if ((child.context === context || child.fnContext === context) &&
|
2149 | data &&
|
2150 | data.slot != null) {
|
2151 | var name_1 = data.slot;
|
2152 | var slot = slots[name_1] || (slots[name_1] = []);
|
2153 | if (child.tag === 'template') {
|
2154 | slot.push.apply(slot, child.children || []);
|
2155 | }
|
2156 | else {
|
2157 | slot.push(child);
|
2158 | }
|
2159 | }
|
2160 | else {
|
2161 | (slots.default || (slots.default = [])).push(child);
|
2162 | }
|
2163 | }
|
2164 |
|
2165 | for (var name_2 in slots) {
|
2166 | if (slots[name_2].every(isWhitespace)) {
|
2167 | delete slots[name_2];
|
2168 | }
|
2169 | }
|
2170 | return slots;
|
2171 | }
|
2172 | function isWhitespace(node) {
|
2173 | return (node.isComment && !node.asyncFactory) || node.text === ' ';
|
2174 | }
|
2175 |
|
2176 | function isAsyncPlaceholder(node) {
|
2177 |
|
2178 | return node.isComment && node.asyncFactory;
|
2179 | }
|
2180 |
|
2181 | function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
|
2182 | var res;
|
2183 | var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
2184 | var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
|
2185 | var key = scopedSlots && scopedSlots.$key;
|
2186 | if (!scopedSlots) {
|
2187 | res = {};
|
2188 | }
|
2189 | else if (scopedSlots._normalized) {
|
2190 |
|
2191 | return scopedSlots._normalized;
|
2192 | }
|
2193 | else if (isStable &&
|
2194 | prevScopedSlots &&
|
2195 | prevScopedSlots !== emptyObject &&
|
2196 | key === prevScopedSlots.$key &&
|
2197 | !hasNormalSlots &&
|
2198 | !prevScopedSlots.$hasNormal) {
|
2199 |
|
2200 |
|
2201 | return prevScopedSlots;
|
2202 | }
|
2203 | else {
|
2204 | res = {};
|
2205 | for (var key_1 in scopedSlots) {
|
2206 | if (scopedSlots[key_1] && key_1[0] !== '$') {
|
2207 | res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
|
2208 | }
|
2209 | }
|
2210 | }
|
2211 |
|
2212 | for (var key_2 in normalSlots) {
|
2213 | if (!(key_2 in res)) {
|
2214 | res[key_2] = proxyNormalSlot(normalSlots, key_2);
|
2215 | }
|
2216 | }
|
2217 |
|
2218 |
|
2219 | if (scopedSlots && Object.isExtensible(scopedSlots)) {
|
2220 | scopedSlots._normalized = res;
|
2221 | }
|
2222 | def(res, '$stable', isStable);
|
2223 | def(res, '$key', key);
|
2224 | def(res, '$hasNormal', hasNormalSlots);
|
2225 | return res;
|
2226 | }
|
2227 | function normalizeScopedSlot(vm, normalSlots, key, fn) {
|
2228 | var normalized = function () {
|
2229 | var cur = currentInstance;
|
2230 | setCurrentInstance(vm);
|
2231 | var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2232 | res =
|
2233 | res && typeof res === 'object' && !isArray(res)
|
2234 | ? [res]
|
2235 | : normalizeChildren(res);
|
2236 | var vnode = res && res[0];
|
2237 | setCurrentInstance(cur);
|
2238 | return res &&
|
2239 | (!vnode ||
|
2240 | (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)))
|
2241 | ? undefined
|
2242 | : res;
|
2243 | };
|
2244 |
|
2245 |
|
2246 |
|
2247 | if (fn.proxy) {
|
2248 | Object.defineProperty(normalSlots, key, {
|
2249 | get: normalized,
|
2250 | enumerable: true,
|
2251 | configurable: true
|
2252 | });
|
2253 | }
|
2254 | return normalized;
|
2255 | }
|
2256 | function proxyNormalSlot(slots, key) {
|
2257 | return function () { return slots[key]; };
|
2258 | }
|
2259 |
|
2260 | function initSetup(vm) {
|
2261 | var options = vm.$options;
|
2262 | var setup = options.setup;
|
2263 | if (setup) {
|
2264 | var ctx = (vm._setupContext = createSetupContext(vm));
|
2265 | setCurrentInstance(vm);
|
2266 | pushTarget();
|
2267 | var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
|
2268 | popTarget();
|
2269 | setCurrentInstance();
|
2270 | if (isFunction(setupResult)) {
|
2271 |
|
2272 |
|
2273 | options.render = setupResult;
|
2274 | }
|
2275 | else if (isObject(setupResult)) {
|
2276 |
|
2277 | if (setupResult instanceof VNode) {
|
2278 | warn$2("setup() should not return VNodes directly - " +
|
2279 | "return a render function instead.");
|
2280 | }
|
2281 | vm._setupState = setupResult;
|
2282 |
|
2283 | if (!setupResult.__sfc) {
|
2284 | for (var key in setupResult) {
|
2285 | if (!isReserved(key)) {
|
2286 | proxyWithRefUnwrap(vm, setupResult, key);
|
2287 | }
|
2288 | else {
|
2289 | warn$2("Avoid using variables that start with _ or $ in setup().");
|
2290 | }
|
2291 | }
|
2292 | }
|
2293 | else {
|
2294 |
|
2295 | var proxy = (vm._setupProxy = {});
|
2296 | for (var key in setupResult) {
|
2297 | if (key !== '__sfc') {
|
2298 | proxyWithRefUnwrap(proxy, setupResult, key);
|
2299 | }
|
2300 | }
|
2301 | }
|
2302 | }
|
2303 | else if (setupResult !== undefined) {
|
2304 | warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
|
2305 | }
|
2306 | }
|
2307 | }
|
2308 | function createSetupContext(vm) {
|
2309 | var exposeCalled = false;
|
2310 | return {
|
2311 | get attrs() {
|
2312 | if (!vm._attrsProxy) {
|
2313 | var proxy = (vm._attrsProxy = {});
|
2314 | def(proxy, '_v_attr_proxy', true);
|
2315 | syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
2316 | }
|
2317 | return vm._attrsProxy;
|
2318 | },
|
2319 | get listeners() {
|
2320 | if (!vm._listenersProxy) {
|
2321 | var proxy = (vm._listenersProxy = {});
|
2322 | syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
2323 | }
|
2324 | return vm._listenersProxy;
|
2325 | },
|
2326 | get slots() {
|
2327 | return initSlotsProxy(vm);
|
2328 | },
|
2329 | emit: bind$1(vm.$emit, vm),
|
2330 | expose: function (exposed) {
|
2331 | {
|
2332 | if (exposeCalled) {
|
2333 | warn$2("expose() should be called only once per setup().", vm);
|
2334 | }
|
2335 | exposeCalled = true;
|
2336 | }
|
2337 | if (exposed) {
|
2338 | Object.keys(exposed).forEach(function (key) {
|
2339 | return proxyWithRefUnwrap(vm, exposed, key);
|
2340 | });
|
2341 | }
|
2342 | }
|
2343 | };
|
2344 | }
|
2345 | function syncSetupProxy(to, from, prev, instance, type) {
|
2346 | var changed = false;
|
2347 | for (var key in from) {
|
2348 | if (!(key in to)) {
|
2349 | changed = true;
|
2350 | defineProxyAttr(to, key, instance, type);
|
2351 | }
|
2352 | else if (from[key] !== prev[key]) {
|
2353 | changed = true;
|
2354 | }
|
2355 | }
|
2356 | for (var key in to) {
|
2357 | if (!(key in from)) {
|
2358 | changed = true;
|
2359 | delete to[key];
|
2360 | }
|
2361 | }
|
2362 | return changed;
|
2363 | }
|
2364 | function defineProxyAttr(proxy, key, instance, type) {
|
2365 | Object.defineProperty(proxy, key, {
|
2366 | enumerable: true,
|
2367 | configurable: true,
|
2368 | get: function () {
|
2369 | return instance[type][key];
|
2370 | }
|
2371 | });
|
2372 | }
|
2373 | function initSlotsProxy(vm) {
|
2374 | if (!vm._slotsProxy) {
|
2375 | syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
|
2376 | }
|
2377 | return vm._slotsProxy;
|
2378 | }
|
2379 | function syncSetupSlots(to, from) {
|
2380 | for (var key in from) {
|
2381 | to[key] = from[key];
|
2382 | }
|
2383 | for (var key in to) {
|
2384 | if (!(key in from)) {
|
2385 | delete to[key];
|
2386 | }
|
2387 | }
|
2388 | }
|
2389 | |
2390 |
|
2391 |
|
2392 |
|
2393 | function useSlots() {
|
2394 | return getContext().slots;
|
2395 | }
|
2396 | |
2397 |
|
2398 |
|
2399 |
|
2400 | function useAttrs() {
|
2401 | return getContext().attrs;
|
2402 | }
|
2403 | |
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 | function useListeners() {
|
2409 | return getContext().listeners;
|
2410 | }
|
2411 | function getContext() {
|
2412 | if (!currentInstance) {
|
2413 | warn$2("useContext() called without active instance.");
|
2414 | }
|
2415 | var vm = currentInstance;
|
2416 | return vm._setupContext || (vm._setupContext = createSetupContext(vm));
|
2417 | }
|
2418 | |
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 | function mergeDefaults(raw, defaults) {
|
2424 | var props = isArray(raw)
|
2425 | ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
|
2426 | : raw;
|
2427 | for (var key in defaults) {
|
2428 | var opt = props[key];
|
2429 | if (opt) {
|
2430 | if (isArray(opt) || isFunction(opt)) {
|
2431 | props[key] = { type: opt, default: defaults[key] };
|
2432 | }
|
2433 | else {
|
2434 | opt.default = defaults[key];
|
2435 | }
|
2436 | }
|
2437 | else if (opt === null) {
|
2438 | props[key] = { default: defaults[key] };
|
2439 | }
|
2440 | else {
|
2441 | warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
|
2442 | }
|
2443 | }
|
2444 | return props;
|
2445 | }
|
2446 |
|
2447 | function initRender(vm) {
|
2448 | vm._vnode = null;
|
2449 | vm._staticTrees = null;
|
2450 | var options = vm.$options;
|
2451 | var parentVnode = (vm.$vnode = options._parentVnode);
|
2452 | var renderContext = parentVnode && parentVnode.context;
|
2453 | vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
2454 | vm.$scopedSlots = parentVnode
|
2455 | ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
2456 | : emptyObject;
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 | vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
|
2463 |
|
2464 |
|
2465 |
|
2466 | vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
|
2467 |
|
2468 |
|
2469 | var parentData = parentVnode && parentVnode.data;
|
2470 |
|
2471 | {
|
2472 | defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
|
2473 | !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
|
2474 | }, true);
|
2475 | defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
2476 | !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
|
2477 | }, true);
|
2478 | }
|
2479 | }
|
2480 | var currentRenderingInstance = null;
|
2481 | function renderMixin(Vue) {
|
2482 |
|
2483 | installRenderHelpers(Vue.prototype);
|
2484 | Vue.prototype.$nextTick = function (fn) {
|
2485 | return nextTick(fn, this);
|
2486 | };
|
2487 | Vue.prototype._render = function () {
|
2488 | var vm = this;
|
2489 | var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
|
2490 | if (_parentVnode && vm._isMounted) {
|
2491 | vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
2492 | if (vm._slotsProxy) {
|
2493 | syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
2494 | }
|
2495 | }
|
2496 |
|
2497 |
|
2498 | vm.$vnode = _parentVnode;
|
2499 |
|
2500 | var vnode;
|
2501 | try {
|
2502 |
|
2503 |
|
2504 |
|
2505 | setCurrentInstance(vm);
|
2506 | currentRenderingInstance = vm;
|
2507 | vnode = render.call(vm._renderProxy, vm.$createElement);
|
2508 | }
|
2509 | catch (e) {
|
2510 | handleError(e, vm, "render");
|
2511 |
|
2512 |
|
2513 |
|
2514 | if (vm.$options.renderError) {
|
2515 | try {
|
2516 | vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
2517 | }
|
2518 | catch (e) {
|
2519 | handleError(e, vm, "renderError");
|
2520 | vnode = vm._vnode;
|
2521 | }
|
2522 | }
|
2523 | else {
|
2524 | vnode = vm._vnode;
|
2525 | }
|
2526 | }
|
2527 | finally {
|
2528 | currentRenderingInstance = null;
|
2529 | setCurrentInstance();
|
2530 | }
|
2531 |
|
2532 | if (isArray(vnode) && vnode.length === 1) {
|
2533 | vnode = vnode[0];
|
2534 | }
|
2535 |
|
2536 | if (!(vnode instanceof VNode)) {
|
2537 | if (isArray(vnode)) {
|
2538 | warn$2('Multiple root nodes returned from render function. Render function ' +
|
2539 | 'should return a single root node.', vm);
|
2540 | }
|
2541 | vnode = createEmptyVNode();
|
2542 | }
|
2543 |
|
2544 | vnode.parent = _parentVnode;
|
2545 | return vnode;
|
2546 | };
|
2547 | }
|
2548 |
|
2549 | function ensureCtor(comp, base) {
|
2550 | if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
|
2551 | comp = comp.default;
|
2552 | }
|
2553 | return isObject(comp) ? base.extend(comp) : comp;
|
2554 | }
|
2555 | function createAsyncPlaceholder(factory, data, context, children, tag) {
|
2556 | var node = createEmptyVNode();
|
2557 | node.asyncFactory = factory;
|
2558 | node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
2559 | return node;
|
2560 | }
|
2561 | function resolveAsyncComponent(factory, baseCtor) {
|
2562 | if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
2563 | return factory.errorComp;
|
2564 | }
|
2565 | if (isDef(factory.resolved)) {
|
2566 | return factory.resolved;
|
2567 | }
|
2568 | var owner = currentRenderingInstance;
|
2569 | if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
2570 |
|
2571 | factory.owners.push(owner);
|
2572 | }
|
2573 | if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
2574 | return factory.loadingComp;
|
2575 | }
|
2576 | if (owner && !isDef(factory.owners)) {
|
2577 | var owners_1 = (factory.owners = [owner]);
|
2578 | var sync_1 = true;
|
2579 | var timerLoading_1 = null;
|
2580 | var timerTimeout_1 = null;
|
2581 | owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
|
2582 | var forceRender_1 = function (renderCompleted) {
|
2583 | for (var i = 0, l = owners_1.length; i < l; i++) {
|
2584 | owners_1[i].$forceUpdate();
|
2585 | }
|
2586 | if (renderCompleted) {
|
2587 | owners_1.length = 0;
|
2588 | if (timerLoading_1 !== null) {
|
2589 | clearTimeout(timerLoading_1);
|
2590 | timerLoading_1 = null;
|
2591 | }
|
2592 | if (timerTimeout_1 !== null) {
|
2593 | clearTimeout(timerTimeout_1);
|
2594 | timerTimeout_1 = null;
|
2595 | }
|
2596 | }
|
2597 | };
|
2598 | var resolve = once(function (res) {
|
2599 |
|
2600 | factory.resolved = ensureCtor(res, baseCtor);
|
2601 |
|
2602 |
|
2603 | if (!sync_1) {
|
2604 | forceRender_1(true);
|
2605 | }
|
2606 | else {
|
2607 | owners_1.length = 0;
|
2608 | }
|
2609 | });
|
2610 | var reject_1 = once(function (reason) {
|
2611 | warn$2("Failed to resolve async component: ".concat(String(factory)) +
|
2612 | (reason ? "\nReason: ".concat(reason) : ''));
|
2613 | if (isDef(factory.errorComp)) {
|
2614 | factory.error = true;
|
2615 | forceRender_1(true);
|
2616 | }
|
2617 | });
|
2618 | var res_1 = factory(resolve, reject_1);
|
2619 | if (isObject(res_1)) {
|
2620 | if (isPromise(res_1)) {
|
2621 |
|
2622 | if (isUndef(factory.resolved)) {
|
2623 | res_1.then(resolve, reject_1);
|
2624 | }
|
2625 | }
|
2626 | else if (isPromise(res_1.component)) {
|
2627 | res_1.component.then(resolve, reject_1);
|
2628 | if (isDef(res_1.error)) {
|
2629 | factory.errorComp = ensureCtor(res_1.error, baseCtor);
|
2630 | }
|
2631 | if (isDef(res_1.loading)) {
|
2632 | factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
|
2633 | if (res_1.delay === 0) {
|
2634 | factory.loading = true;
|
2635 | }
|
2636 | else {
|
2637 |
|
2638 | timerLoading_1 = setTimeout(function () {
|
2639 | timerLoading_1 = null;
|
2640 | if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
2641 | factory.loading = true;
|
2642 | forceRender_1(false);
|
2643 | }
|
2644 | }, res_1.delay || 200);
|
2645 | }
|
2646 | }
|
2647 | if (isDef(res_1.timeout)) {
|
2648 |
|
2649 | timerTimeout_1 = setTimeout(function () {
|
2650 | timerTimeout_1 = null;
|
2651 | if (isUndef(factory.resolved)) {
|
2652 | reject_1("timeout (".concat(res_1.timeout, "ms)") );
|
2653 | }
|
2654 | }, res_1.timeout);
|
2655 | }
|
2656 | }
|
2657 | }
|
2658 | sync_1 = false;
|
2659 |
|
2660 | return factory.loading ? factory.loadingComp : factory.resolved;
|
2661 | }
|
2662 | }
|
2663 |
|
2664 | function getFirstComponentChild(children) {
|
2665 | if (isArray(children)) {
|
2666 | for (var i = 0; i < children.length; i++) {
|
2667 | var c = children[i];
|
2668 | if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
2669 | return c;
|
2670 | }
|
2671 | }
|
2672 | }
|
2673 | }
|
2674 |
|
2675 | function initEvents(vm) {
|
2676 | vm._events = Object.create(null);
|
2677 | vm._hasHookEvent = false;
|
2678 |
|
2679 | var listeners = vm.$options._parentListeners;
|
2680 | if (listeners) {
|
2681 | updateComponentListeners(vm, listeners);
|
2682 | }
|
2683 | }
|
2684 | var target$1;
|
2685 | function add$1(event, fn) {
|
2686 | target$1.$on(event, fn);
|
2687 | }
|
2688 | function remove$1(event, fn) {
|
2689 | target$1.$off(event, fn);
|
2690 | }
|
2691 | function createOnceHandler$1(event, fn) {
|
2692 | var _target = target$1;
|
2693 | return function onceHandler() {
|
2694 | var res = fn.apply(null, arguments);
|
2695 | if (res !== null) {
|
2696 | _target.$off(event, onceHandler);
|
2697 | }
|
2698 | };
|
2699 | }
|
2700 | function updateComponentListeners(vm, listeners, oldListeners) {
|
2701 | target$1 = vm;
|
2702 | updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
|
2703 | target$1 = undefined;
|
2704 | }
|
2705 | function eventsMixin(Vue) {
|
2706 | var hookRE = /^hook:/;
|
2707 | Vue.prototype.$on = function (event, fn) {
|
2708 | var vm = this;
|
2709 | if (isArray(event)) {
|
2710 | for (var i = 0, l = event.length; i < l; i++) {
|
2711 | vm.$on(event[i], fn);
|
2712 | }
|
2713 | }
|
2714 | else {
|
2715 | (vm._events[event] || (vm._events[event] = [])).push(fn);
|
2716 |
|
2717 |
|
2718 | if (hookRE.test(event)) {
|
2719 | vm._hasHookEvent = true;
|
2720 | }
|
2721 | }
|
2722 | return vm;
|
2723 | };
|
2724 | Vue.prototype.$once = function (event, fn) {
|
2725 | var vm = this;
|
2726 | function on() {
|
2727 | vm.$off(event, on);
|
2728 | fn.apply(vm, arguments);
|
2729 | }
|
2730 | on.fn = fn;
|
2731 | vm.$on(event, on);
|
2732 | return vm;
|
2733 | };
|
2734 | Vue.prototype.$off = function (event, fn) {
|
2735 | var vm = this;
|
2736 |
|
2737 | if (!arguments.length) {
|
2738 | vm._events = Object.create(null);
|
2739 | return vm;
|
2740 | }
|
2741 |
|
2742 | if (isArray(event)) {
|
2743 | for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
|
2744 | vm.$off(event[i_1], fn);
|
2745 | }
|
2746 | return vm;
|
2747 | }
|
2748 |
|
2749 | var cbs = vm._events[event];
|
2750 | if (!cbs) {
|
2751 | return vm;
|
2752 | }
|
2753 | if (!fn) {
|
2754 | vm._events[event] = null;
|
2755 | return vm;
|
2756 | }
|
2757 |
|
2758 | var cb;
|
2759 | var i = cbs.length;
|
2760 | while (i--) {
|
2761 | cb = cbs[i];
|
2762 | if (cb === fn || cb.fn === fn) {
|
2763 | cbs.splice(i, 1);
|
2764 | break;
|
2765 | }
|
2766 | }
|
2767 | return vm;
|
2768 | };
|
2769 | Vue.prototype.$emit = function (event) {
|
2770 | var vm = this;
|
2771 | {
|
2772 | var lowerCaseEvent = event.toLowerCase();
|
2773 | if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
2774 | tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
|
2775 | "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
|
2776 | "Note that HTML attributes are case-insensitive and you cannot use " +
|
2777 | "v-on to listen to camelCase events when using in-DOM templates. " +
|
2778 | "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
|
2779 | }
|
2780 | }
|
2781 | var cbs = vm._events[event];
|
2782 | if (cbs) {
|
2783 | cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
2784 | var args = toArray(arguments, 1);
|
2785 | var info = "event handler for \"".concat(event, "\"");
|
2786 | for (var i = 0, l = cbs.length; i < l; i++) {
|
2787 | invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
2788 | }
|
2789 | }
|
2790 | return vm;
|
2791 | };
|
2792 | }
|
2793 |
|
2794 | var activeEffectScope;
|
2795 | var EffectScope = (function () {
|
2796 | function EffectScope(detached) {
|
2797 | if (detached === void 0) { detached = false; }
|
2798 | this.detached = detached;
|
2799 | |
2800 |
|
2801 |
|
2802 | this.active = true;
|
2803 | |
2804 |
|
2805 |
|
2806 | this.effects = [];
|
2807 | |
2808 |
|
2809 |
|
2810 | this.cleanups = [];
|
2811 | this.parent = activeEffectScope;
|
2812 | if (!detached && activeEffectScope) {
|
2813 | this.index =
|
2814 | (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
2815 | }
|
2816 | }
|
2817 | EffectScope.prototype.run = function (fn) {
|
2818 | if (this.active) {
|
2819 | var currentEffectScope = activeEffectScope;
|
2820 | try {
|
2821 | activeEffectScope = this;
|
2822 | return fn();
|
2823 | }
|
2824 | finally {
|
2825 | activeEffectScope = currentEffectScope;
|
2826 | }
|
2827 | }
|
2828 | else {
|
2829 | warn$2("cannot run an inactive effect scope.");
|
2830 | }
|
2831 | };
|
2832 | |
2833 |
|
2834 |
|
2835 |
|
2836 | EffectScope.prototype.on = function () {
|
2837 | activeEffectScope = this;
|
2838 | };
|
2839 | |
2840 |
|
2841 |
|
2842 |
|
2843 | EffectScope.prototype.off = function () {
|
2844 | activeEffectScope = this.parent;
|
2845 | };
|
2846 | EffectScope.prototype.stop = function (fromParent) {
|
2847 | if (this.active) {
|
2848 | var i = void 0, l = void 0;
|
2849 | for (i = 0, l = this.effects.length; i < l; i++) {
|
2850 | this.effects[i].teardown();
|
2851 | }
|
2852 | for (i = 0, l = this.cleanups.length; i < l; i++) {
|
2853 | this.cleanups[i]();
|
2854 | }
|
2855 | if (this.scopes) {
|
2856 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
2857 | this.scopes[i].stop(true);
|
2858 | }
|
2859 | }
|
2860 |
|
2861 | if (!this.detached && this.parent && !fromParent) {
|
2862 |
|
2863 | var last = this.parent.scopes.pop();
|
2864 | if (last && last !== this) {
|
2865 | this.parent.scopes[this.index] = last;
|
2866 | last.index = this.index;
|
2867 | }
|
2868 | }
|
2869 | this.parent = undefined;
|
2870 | this.active = false;
|
2871 | }
|
2872 | };
|
2873 | return EffectScope;
|
2874 | }());
|
2875 | function effectScope(detached) {
|
2876 | return new EffectScope(detached);
|
2877 | }
|
2878 | |
2879 |
|
2880 |
|
2881 | function recordEffectScope(effect, scope) {
|
2882 | if (scope === void 0) { scope = activeEffectScope; }
|
2883 | if (scope && scope.active) {
|
2884 | scope.effects.push(effect);
|
2885 | }
|
2886 | }
|
2887 | function getCurrentScope() {
|
2888 | return activeEffectScope;
|
2889 | }
|
2890 | function onScopeDispose(fn) {
|
2891 | if (activeEffectScope) {
|
2892 | activeEffectScope.cleanups.push(fn);
|
2893 | }
|
2894 | else {
|
2895 | warn$2("onScopeDispose() is called when there is no active effect scope" +
|
2896 | " to be associated with.");
|
2897 | }
|
2898 | }
|
2899 |
|
2900 | var activeInstance = null;
|
2901 | var isUpdatingChildComponent = false;
|
2902 | function setActiveInstance(vm) {
|
2903 | var prevActiveInstance = activeInstance;
|
2904 | activeInstance = vm;
|
2905 | return function () {
|
2906 | activeInstance = prevActiveInstance;
|
2907 | };
|
2908 | }
|
2909 | function initLifecycle(vm) {
|
2910 | var options = vm.$options;
|
2911 |
|
2912 | var parent = options.parent;
|
2913 | if (parent && !options.abstract) {
|
2914 | while (parent.$options.abstract && parent.$parent) {
|
2915 | parent = parent.$parent;
|
2916 | }
|
2917 | parent.$children.push(vm);
|
2918 | }
|
2919 | vm.$parent = parent;
|
2920 | vm.$root = parent ? parent.$root : vm;
|
2921 | vm.$children = [];
|
2922 | vm.$refs = {};
|
2923 | vm._provided = parent ? parent._provided : Object.create(null);
|
2924 | vm._watcher = null;
|
2925 | vm._inactive = null;
|
2926 | vm._directInactive = false;
|
2927 | vm._isMounted = false;
|
2928 | vm._isDestroyed = false;
|
2929 | vm._isBeingDestroyed = false;
|
2930 | }
|
2931 | function lifecycleMixin(Vue) {
|
2932 | Vue.prototype._update = function (vnode, hydrating) {
|
2933 | var vm = this;
|
2934 | var prevEl = vm.$el;
|
2935 | var prevVnode = vm._vnode;
|
2936 | var restoreActiveInstance = setActiveInstance(vm);
|
2937 | vm._vnode = vnode;
|
2938 |
|
2939 |
|
2940 | if (!prevVnode) {
|
2941 |
|
2942 | vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false );
|
2943 | }
|
2944 | else {
|
2945 |
|
2946 | vm.$el = vm.__patch__(prevVnode, vnode);
|
2947 | }
|
2948 | restoreActiveInstance();
|
2949 |
|
2950 | if (prevEl) {
|
2951 | prevEl.__vue__ = null;
|
2952 | }
|
2953 | if (vm.$el) {
|
2954 | vm.$el.__vue__ = vm;
|
2955 | }
|
2956 |
|
2957 | var wrapper = vm;
|
2958 | while (wrapper &&
|
2959 | wrapper.$vnode &&
|
2960 | wrapper.$parent &&
|
2961 | wrapper.$vnode === wrapper.$parent._vnode) {
|
2962 | wrapper.$parent.$el = wrapper.$el;
|
2963 | wrapper = wrapper.$parent;
|
2964 | }
|
2965 |
|
2966 |
|
2967 | };
|
2968 | Vue.prototype.$forceUpdate = function () {
|
2969 | var vm = this;
|
2970 | if (vm._watcher) {
|
2971 | vm._watcher.update();
|
2972 | }
|
2973 | };
|
2974 | Vue.prototype.$destroy = function () {
|
2975 | var vm = this;
|
2976 | if (vm._isBeingDestroyed) {
|
2977 | return;
|
2978 | }
|
2979 | callHook$1(vm, 'beforeDestroy');
|
2980 | vm._isBeingDestroyed = true;
|
2981 |
|
2982 | var parent = vm.$parent;
|
2983 | if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
2984 | remove$2(parent.$children, vm);
|
2985 | }
|
2986 |
|
2987 |
|
2988 | vm._scope.stop();
|
2989 |
|
2990 |
|
2991 | if (vm._data.__ob__) {
|
2992 | vm._data.__ob__.vmCount--;
|
2993 | }
|
2994 |
|
2995 | vm._isDestroyed = true;
|
2996 |
|
2997 | vm.__patch__(vm._vnode, null);
|
2998 |
|
2999 | callHook$1(vm, 'destroyed');
|
3000 |
|
3001 | vm.$off();
|
3002 |
|
3003 | if (vm.$el) {
|
3004 | vm.$el.__vue__ = null;
|
3005 | }
|
3006 |
|
3007 | if (vm.$vnode) {
|
3008 | vm.$vnode.parent = null;
|
3009 | }
|
3010 | };
|
3011 | }
|
3012 | function mountComponent(vm, el, hydrating) {
|
3013 | vm.$el = el;
|
3014 | if (!vm.$options.render) {
|
3015 |
|
3016 | vm.$options.render = createEmptyVNode;
|
3017 | {
|
3018 |
|
3019 | if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
3020 | vm.$options.el ||
|
3021 | el) {
|
3022 | warn$2('You are using the runtime-only build of Vue where the template ' +
|
3023 | 'compiler is not available. Either pre-compile the templates into ' +
|
3024 | 'render functions, or use the compiler-included build.', vm);
|
3025 | }
|
3026 | else {
|
3027 | warn$2('Failed to mount component: template or render function not defined.', vm);
|
3028 | }
|
3029 | }
|
3030 | }
|
3031 | callHook$1(vm, 'beforeMount');
|
3032 | var updateComponent;
|
3033 |
|
3034 | if (config.performance && mark) {
|
3035 | updateComponent = function () {
|
3036 | var name = vm._name;
|
3037 | var id = vm._uid;
|
3038 | var startTag = "vue-perf-start:".concat(id);
|
3039 | var endTag = "vue-perf-end:".concat(id);
|
3040 | mark(startTag);
|
3041 | var vnode = vm._render();
|
3042 | mark(endTag);
|
3043 | measure("vue ".concat(name, " render"), startTag, endTag);
|
3044 | mark(startTag);
|
3045 | vm._update(vnode, hydrating);
|
3046 | mark(endTag);
|
3047 | measure("vue ".concat(name, " patch"), startTag, endTag);
|
3048 | };
|
3049 | }
|
3050 | else {
|
3051 | updateComponent = function () {
|
3052 | vm._update(vm._render(), hydrating);
|
3053 | };
|
3054 | }
|
3055 | var watcherOptions = {
|
3056 | before: function () {
|
3057 | if (vm._isMounted && !vm._isDestroyed) {
|
3058 | callHook$1(vm, 'beforeUpdate');
|
3059 | }
|
3060 | }
|
3061 | };
|
3062 | {
|
3063 | watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
|
3064 | watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
|
3065 | }
|
3066 |
|
3067 |
|
3068 |
|
3069 | new Watcher(vm, updateComponent, noop, watcherOptions, true );
|
3070 | hydrating = false;
|
3071 |
|
3072 | var preWatchers = vm._preWatchers;
|
3073 | if (preWatchers) {
|
3074 | for (var i = 0; i < preWatchers.length; i++) {
|
3075 | preWatchers[i].run();
|
3076 | }
|
3077 | }
|
3078 |
|
3079 |
|
3080 | if (vm.$vnode == null) {
|
3081 | vm._isMounted = true;
|
3082 | callHook$1(vm, 'mounted');
|
3083 | }
|
3084 | return vm;
|
3085 | }
|
3086 | function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
|
3087 | {
|
3088 | isUpdatingChildComponent = true;
|
3089 | }
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 | var newScopedSlots = parentVnode.data.scopedSlots;
|
3096 | var oldScopedSlots = vm.$scopedSlots;
|
3097 | var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
|
3098 | (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
3099 | (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
3100 | (!newScopedSlots && vm.$scopedSlots.$key));
|
3101 |
|
3102 |
|
3103 |
|
3104 | var needsForceUpdate = !!(renderChildren ||
|
3105 | vm.$options._renderChildren ||
|
3106 | hasDynamicScopedSlot);
|
3107 | var prevVNode = vm.$vnode;
|
3108 | vm.$options._parentVnode = parentVnode;
|
3109 | vm.$vnode = parentVnode;
|
3110 | if (vm._vnode) {
|
3111 |
|
3112 | vm._vnode.parent = parentVnode;
|
3113 | }
|
3114 | vm.$options._renderChildren = renderChildren;
|
3115 |
|
3116 |
|
3117 |
|
3118 | var attrs = parentVnode.data.attrs || emptyObject;
|
3119 | if (vm._attrsProxy) {
|
3120 |
|
3121 |
|
3122 | if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
3123 | needsForceUpdate = true;
|
3124 | }
|
3125 | }
|
3126 | vm.$attrs = attrs;
|
3127 |
|
3128 | listeners = listeners || emptyObject;
|
3129 | var prevListeners = vm.$options._parentListeners;
|
3130 | if (vm._listenersProxy) {
|
3131 | syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
3132 | }
|
3133 | vm.$listeners = vm.$options._parentListeners = listeners;
|
3134 | updateComponentListeners(vm, listeners, prevListeners);
|
3135 |
|
3136 | if (propsData && vm.$options.props) {
|
3137 | toggleObserving(false);
|
3138 | var props = vm._props;
|
3139 | var propKeys = vm.$options._propKeys || [];
|
3140 | for (var i = 0; i < propKeys.length; i++) {
|
3141 | var key = propKeys[i];
|
3142 | var propOptions = vm.$options.props;
|
3143 | props[key] = validateProp(key, propOptions, propsData, vm);
|
3144 | }
|
3145 | toggleObserving(true);
|
3146 |
|
3147 | vm.$options.propsData = propsData;
|
3148 | }
|
3149 |
|
3150 | if (needsForceUpdate) {
|
3151 | vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
3152 | vm.$forceUpdate();
|
3153 | }
|
3154 | {
|
3155 | isUpdatingChildComponent = false;
|
3156 | }
|
3157 | }
|
3158 | function isInInactiveTree(vm) {
|
3159 | while (vm && (vm = vm.$parent)) {
|
3160 | if (vm._inactive)
|
3161 | return true;
|
3162 | }
|
3163 | return false;
|
3164 | }
|
3165 | function activateChildComponent(vm, direct) {
|
3166 | if (direct) {
|
3167 | vm._directInactive = false;
|
3168 | if (isInInactiveTree(vm)) {
|
3169 | return;
|
3170 | }
|
3171 | }
|
3172 | else if (vm._directInactive) {
|
3173 | return;
|
3174 | }
|
3175 | if (vm._inactive || vm._inactive === null) {
|
3176 | vm._inactive = false;
|
3177 | for (var i = 0; i < vm.$children.length; i++) {
|
3178 | activateChildComponent(vm.$children[i]);
|
3179 | }
|
3180 | callHook$1(vm, 'activated');
|
3181 | }
|
3182 | }
|
3183 | function deactivateChildComponent(vm, direct) {
|
3184 | if (direct) {
|
3185 | vm._directInactive = true;
|
3186 | if (isInInactiveTree(vm)) {
|
3187 | return;
|
3188 | }
|
3189 | }
|
3190 | if (!vm._inactive) {
|
3191 | vm._inactive = true;
|
3192 | for (var i = 0; i < vm.$children.length; i++) {
|
3193 | deactivateChildComponent(vm.$children[i]);
|
3194 | }
|
3195 | callHook$1(vm, 'deactivated');
|
3196 | }
|
3197 | }
|
3198 | function callHook$1(vm, hook, args, setContext) {
|
3199 | if (setContext === void 0) { setContext = true; }
|
3200 |
|
3201 | pushTarget();
|
3202 | var prevInst = currentInstance;
|
3203 | var prevScope = getCurrentScope();
|
3204 | setContext && setCurrentInstance(vm);
|
3205 | var handlers = vm.$options[hook];
|
3206 | var info = "".concat(hook, " hook");
|
3207 | if (handlers) {
|
3208 | for (var i = 0, j = handlers.length; i < j; i++) {
|
3209 | invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
|
3210 | }
|
3211 | }
|
3212 | if (vm._hasHookEvent) {
|
3213 | vm.$emit('hook:' + hook);
|
3214 | }
|
3215 | if (setContext) {
|
3216 | setCurrentInstance(prevInst);
|
3217 | prevScope && prevScope.on();
|
3218 | }
|
3219 | popTarget();
|
3220 | }
|
3221 |
|
3222 | var MAX_UPDATE_COUNT = 100;
|
3223 | var queue = [];
|
3224 | var activatedChildren = [];
|
3225 | var has = {};
|
3226 | var circular = {};
|
3227 | var waiting = false;
|
3228 | var flushing = false;
|
3229 | var index$1 = 0;
|
3230 | |
3231 |
|
3232 |
|
3233 | function resetSchedulerState() {
|
3234 | index$1 = queue.length = activatedChildren.length = 0;
|
3235 | has = {};
|
3236 | {
|
3237 | circular = {};
|
3238 | }
|
3239 | waiting = flushing = false;
|
3240 | }
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 | var currentFlushTimestamp = 0;
|
3247 |
|
3248 | var getNow = Date.now;
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 | if (inBrowser && !isIE) {
|
3256 | var performance_1 = window.performance;
|
3257 | if (performance_1 &&
|
3258 | typeof performance_1.now === 'function' &&
|
3259 | getNow() > document.createEvent('Event').timeStamp) {
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 | getNow = function () { return performance_1.now(); };
|
3265 | }
|
3266 | }
|
3267 | var sortCompareFn = function (a, b) {
|
3268 | if (a.post) {
|
3269 | if (!b.post)
|
3270 | return 1;
|
3271 | }
|
3272 | else if (b.post) {
|
3273 | return -1;
|
3274 | }
|
3275 | return a.id - b.id;
|
3276 | };
|
3277 | |
3278 |
|
3279 |
|
3280 | function flushSchedulerQueue() {
|
3281 | currentFlushTimestamp = getNow();
|
3282 | flushing = true;
|
3283 | var watcher, id;
|
3284 |
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 | queue.sort(sortCompareFn);
|
3293 |
|
3294 |
|
3295 | for (index$1 = 0; index$1 < queue.length; index$1++) {
|
3296 | watcher = queue[index$1];
|
3297 | if (watcher.before) {
|
3298 | watcher.before();
|
3299 | }
|
3300 | id = watcher.id;
|
3301 | has[id] = null;
|
3302 | watcher.run();
|
3303 |
|
3304 | if (has[id] != null) {
|
3305 | circular[id] = (circular[id] || 0) + 1;
|
3306 | if (circular[id] > MAX_UPDATE_COUNT) {
|
3307 | warn$2('You may have an infinite update loop ' +
|
3308 | (watcher.user
|
3309 | ? "in watcher with expression \"".concat(watcher.expression, "\"")
|
3310 | : "in a component render function."), watcher.vm);
|
3311 | break;
|
3312 | }
|
3313 | }
|
3314 | }
|
3315 |
|
3316 | var activatedQueue = activatedChildren.slice();
|
3317 | var updatedQueue = queue.slice();
|
3318 | resetSchedulerState();
|
3319 |
|
3320 | callActivatedHooks(activatedQueue);
|
3321 | callUpdatedHooks(updatedQueue);
|
3322 | cleanupDeps();
|
3323 |
|
3324 |
|
3325 | if (devtools && config.devtools) {
|
3326 | devtools.emit('flush');
|
3327 | }
|
3328 | }
|
3329 | function callUpdatedHooks(queue) {
|
3330 | var i = queue.length;
|
3331 | while (i--) {
|
3332 | var watcher = queue[i];
|
3333 | var vm = watcher.vm;
|
3334 | if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
3335 | callHook$1(vm, 'updated');
|
3336 | }
|
3337 | }
|
3338 | }
|
3339 | |
3340 |
|
3341 |
|
3342 |
|
3343 | function queueActivatedComponent(vm) {
|
3344 |
|
3345 |
|
3346 | vm._inactive = false;
|
3347 | activatedChildren.push(vm);
|
3348 | }
|
3349 | function callActivatedHooks(queue) {
|
3350 | for (var i = 0; i < queue.length; i++) {
|
3351 | queue[i]._inactive = true;
|
3352 | activateChildComponent(queue[i], true );
|
3353 | }
|
3354 | }
|
3355 | |
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 | function queueWatcher(watcher) {
|
3361 | var id = watcher.id;
|
3362 | if (has[id] != null) {
|
3363 | return;
|
3364 | }
|
3365 | if (watcher === Dep.target && watcher.noRecurse) {
|
3366 | return;
|
3367 | }
|
3368 | has[id] = true;
|
3369 | if (!flushing) {
|
3370 | queue.push(watcher);
|
3371 | }
|
3372 | else {
|
3373 |
|
3374 |
|
3375 | var i = queue.length - 1;
|
3376 | while (i > index$1 && queue[i].id > watcher.id) {
|
3377 | i--;
|
3378 | }
|
3379 | queue.splice(i + 1, 0, watcher);
|
3380 | }
|
3381 |
|
3382 | if (!waiting) {
|
3383 | waiting = true;
|
3384 | if (!config.async) {
|
3385 | flushSchedulerQueue();
|
3386 | return;
|
3387 | }
|
3388 | nextTick(flushSchedulerQueue);
|
3389 | }
|
3390 | }
|
3391 |
|
3392 | var WATCHER = "watcher";
|
3393 | var WATCHER_CB = "".concat(WATCHER, " callback");
|
3394 | var WATCHER_GETTER = "".concat(WATCHER, " getter");
|
3395 | var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
|
3396 |
|
3397 | function watchEffect(effect, options) {
|
3398 | return doWatch(effect, null, options);
|
3399 | }
|
3400 | function watchPostEffect(effect, options) {
|
3401 | return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'post' }) ));
|
3402 | }
|
3403 | function watchSyncEffect(effect, options) {
|
3404 | return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'sync' }) ));
|
3405 | }
|
3406 |
|
3407 | var INITIAL_WATCHER_VALUE = {};
|
3408 |
|
3409 | function watch(source, cb, options) {
|
3410 | if (typeof cb !== 'function') {
|
3411 | warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
|
3412 | "Use `watchEffect(fn, options?)` instead. `watch` now only " +
|
3413 | "supports `watch(source, cb, options?) signature.");
|
3414 | }
|
3415 | return doWatch(source, cb, options);
|
3416 | }
|
3417 | function doWatch(source, cb, _a) {
|
3418 | var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
|
3419 | if (!cb) {
|
3420 | if (immediate !== undefined) {
|
3421 | warn$2("watch() \"immediate\" option is only respected when using the " +
|
3422 | "watch(source, callback, options?) signature.");
|
3423 | }
|
3424 | if (deep !== undefined) {
|
3425 | warn$2("watch() \"deep\" option is only respected when using the " +
|
3426 | "watch(source, callback, options?) signature.");
|
3427 | }
|
3428 | }
|
3429 | var warnInvalidSource = function (s) {
|
3430 | warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
|
3431 | "function, a ref, a reactive object, or an array of these types.");
|
3432 | };
|
3433 | var instance = currentInstance;
|
3434 | var call = function (fn, type, args) {
|
3435 | if (args === void 0) { args = null; }
|
3436 | return invokeWithErrorHandling(fn, null, args, instance, type);
|
3437 | };
|
3438 | var getter;
|
3439 | var forceTrigger = false;
|
3440 | var isMultiSource = false;
|
3441 | if (isRef(source)) {
|
3442 | getter = function () { return source.value; };
|
3443 | forceTrigger = isShallow(source);
|
3444 | }
|
3445 | else if (isReactive(source)) {
|
3446 | getter = function () {
|
3447 | source.__ob__.dep.depend();
|
3448 | return source;
|
3449 | };
|
3450 | deep = true;
|
3451 | }
|
3452 | else if (isArray(source)) {
|
3453 | isMultiSource = true;
|
3454 | forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
|
3455 | getter = function () {
|
3456 | return source.map(function (s) {
|
3457 | if (isRef(s)) {
|
3458 | return s.value;
|
3459 | }
|
3460 | else if (isReactive(s)) {
|
3461 | return traverse(s);
|
3462 | }
|
3463 | else if (isFunction(s)) {
|
3464 | return call(s, WATCHER_GETTER);
|
3465 | }
|
3466 | else {
|
3467 | warnInvalidSource(s);
|
3468 | }
|
3469 | });
|
3470 | };
|
3471 | }
|
3472 | else if (isFunction(source)) {
|
3473 | if (cb) {
|
3474 |
|
3475 | getter = function () { return call(source, WATCHER_GETTER); };
|
3476 | }
|
3477 | else {
|
3478 |
|
3479 | getter = function () {
|
3480 | if (instance && instance._isDestroyed) {
|
3481 | return;
|
3482 | }
|
3483 | if (cleanup) {
|
3484 | cleanup();
|
3485 | }
|
3486 | return call(source, WATCHER, [onCleanup]);
|
3487 | };
|
3488 | }
|
3489 | }
|
3490 | else {
|
3491 | getter = noop;
|
3492 | warnInvalidSource(source);
|
3493 | }
|
3494 | if (cb && deep) {
|
3495 | var baseGetter_1 = getter;
|
3496 | getter = function () { return traverse(baseGetter_1()); };
|
3497 | }
|
3498 | var cleanup;
|
3499 | var onCleanup = function (fn) {
|
3500 | cleanup = watcher.onStop = function () {
|
3501 | call(fn, WATCHER_CLEANUP);
|
3502 | };
|
3503 | };
|
3504 |
|
3505 |
|
3506 | if (isServerRendering()) {
|
3507 |
|
3508 | onCleanup = noop;
|
3509 | if (!cb) {
|
3510 | getter();
|
3511 | }
|
3512 | else if (immediate) {
|
3513 | call(cb, WATCHER_CB, [
|
3514 | getter(),
|
3515 | isMultiSource ? [] : undefined,
|
3516 | onCleanup
|
3517 | ]);
|
3518 | }
|
3519 | return noop;
|
3520 | }
|
3521 | var watcher = new Watcher(currentInstance, getter, noop, {
|
3522 | lazy: true
|
3523 | });
|
3524 | watcher.noRecurse = !cb;
|
3525 | var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
3526 |
|
3527 | watcher.run = function () {
|
3528 | if (!watcher.active) {
|
3529 | return;
|
3530 | }
|
3531 | if (cb) {
|
3532 |
|
3533 | var newValue = watcher.get();
|
3534 | if (deep ||
|
3535 | forceTrigger ||
|
3536 | (isMultiSource
|
3537 | ? newValue.some(function (v, i) {
|
3538 | return hasChanged(v, oldValue[i]);
|
3539 | })
|
3540 | : hasChanged(newValue, oldValue))) {
|
3541 |
|
3542 | if (cleanup) {
|
3543 | cleanup();
|
3544 | }
|
3545 | call(cb, WATCHER_CB, [
|
3546 | newValue,
|
3547 |
|
3548 | oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
3549 | onCleanup
|
3550 | ]);
|
3551 | oldValue = newValue;
|
3552 | }
|
3553 | }
|
3554 | else {
|
3555 |
|
3556 | watcher.get();
|
3557 | }
|
3558 | };
|
3559 | if (flush === 'sync') {
|
3560 | watcher.update = watcher.run;
|
3561 | }
|
3562 | else if (flush === 'post') {
|
3563 | watcher.post = true;
|
3564 | watcher.update = function () { return queueWatcher(watcher); };
|
3565 | }
|
3566 | else {
|
3567 |
|
3568 | watcher.update = function () {
|
3569 | if (instance && instance === currentInstance && !instance._isMounted) {
|
3570 |
|
3571 | var buffer = instance._preWatchers || (instance._preWatchers = []);
|
3572 | if (buffer.indexOf(watcher) < 0)
|
3573 | buffer.push(watcher);
|
3574 | }
|
3575 | else {
|
3576 | queueWatcher(watcher);
|
3577 | }
|
3578 | };
|
3579 | }
|
3580 | {
|
3581 | watcher.onTrack = onTrack;
|
3582 | watcher.onTrigger = onTrigger;
|
3583 | }
|
3584 |
|
3585 | if (cb) {
|
3586 | if (immediate) {
|
3587 | watcher.run();
|
3588 | }
|
3589 | else {
|
3590 | oldValue = watcher.get();
|
3591 | }
|
3592 | }
|
3593 | else if (flush === 'post' && instance) {
|
3594 | instance.$once('hook:mounted', function () { return watcher.get(); });
|
3595 | }
|
3596 | else {
|
3597 | watcher.get();
|
3598 | }
|
3599 | return function () {
|
3600 | watcher.teardown();
|
3601 | };
|
3602 | }
|
3603 |
|
3604 | function provide(key, value) {
|
3605 | if (!currentInstance) {
|
3606 | {
|
3607 | warn$2("provide() can only be used inside setup().");
|
3608 | }
|
3609 | }
|
3610 | else {
|
3611 |
|
3612 | resolveProvided(currentInstance)[key] = value;
|
3613 | }
|
3614 | }
|
3615 | function resolveProvided(vm) {
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 | var existing = vm._provided;
|
3622 | var parentProvides = vm.$parent && vm.$parent._provided;
|
3623 | if (parentProvides === existing) {
|
3624 | return (vm._provided = Object.create(parentProvides));
|
3625 | }
|
3626 | else {
|
3627 | return existing;
|
3628 | }
|
3629 | }
|
3630 | function inject(key, defaultValue, treatDefaultAsFactory) {
|
3631 | if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
|
3632 |
|
3633 |
|
3634 | var instance = currentInstance;
|
3635 | if (instance) {
|
3636 |
|
3637 |
|
3638 |
|
3639 | var provides = instance.$parent && instance.$parent._provided;
|
3640 | if (provides && key in provides) {
|
3641 |
|
3642 | return provides[key];
|
3643 | }
|
3644 | else if (arguments.length > 1) {
|
3645 | return treatDefaultAsFactory && isFunction(defaultValue)
|
3646 | ? defaultValue.call(instance)
|
3647 | : defaultValue;
|
3648 | }
|
3649 | else {
|
3650 | warn$2("injection \"".concat(String(key), "\" not found."));
|
3651 | }
|
3652 | }
|
3653 | else {
|
3654 | warn$2("inject() can only be used inside setup() or functional components.");
|
3655 | }
|
3656 | }
|
3657 |
|
3658 | |
3659 |
|
3660 |
|
3661 |
|
3662 | function h(type, props, children) {
|
3663 | if (!currentInstance) {
|
3664 | warn$2("globally imported h() can only be invoked when there is an active " +
|
3665 | "component instance, e.g. synchronously in a component's render or setup function.");
|
3666 | }
|
3667 | return createElement$1(currentInstance, type, props, children, 2, true);
|
3668 | }
|
3669 |
|
3670 | function handleError(err, vm, info) {
|
3671 |
|
3672 |
|
3673 | pushTarget();
|
3674 | try {
|
3675 | if (vm) {
|
3676 | var cur = vm;
|
3677 | while ((cur = cur.$parent)) {
|
3678 | var hooks = cur.$options.errorCaptured;
|
3679 | if (hooks) {
|
3680 | for (var i = 0; i < hooks.length; i++) {
|
3681 | try {
|
3682 | var capture = hooks[i].call(cur, err, vm, info) === false;
|
3683 | if (capture)
|
3684 | return;
|
3685 | }
|
3686 | catch (e) {
|
3687 | globalHandleError(e, cur, 'errorCaptured hook');
|
3688 | }
|
3689 | }
|
3690 | }
|
3691 | }
|
3692 | }
|
3693 | globalHandleError(err, vm, info);
|
3694 | }
|
3695 | finally {
|
3696 | popTarget();
|
3697 | }
|
3698 | }
|
3699 | function invokeWithErrorHandling(handler, context, args, vm, info) {
|
3700 | var res;
|
3701 | try {
|
3702 | res = args ? handler.apply(context, args) : handler.call(context);
|
3703 | if (res && !res._isVue && isPromise(res) && !res._handled) {
|
3704 | res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
3705 | res._handled = true;
|
3706 | }
|
3707 | }
|
3708 | catch (e) {
|
3709 | handleError(e, vm, info);
|
3710 | }
|
3711 | return res;
|
3712 | }
|
3713 | function globalHandleError(err, vm, info) {
|
3714 | if (config.errorHandler) {
|
3715 | try {
|
3716 | return config.errorHandler.call(null, err, vm, info);
|
3717 | }
|
3718 | catch (e) {
|
3719 |
|
3720 |
|
3721 | if (e !== err) {
|
3722 | logError(e, null, 'config.errorHandler');
|
3723 | }
|
3724 | }
|
3725 | }
|
3726 | logError(err, vm, info);
|
3727 | }
|
3728 | function logError(err, vm, info) {
|
3729 | {
|
3730 | warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
|
3731 | }
|
3732 |
|
3733 | if (inBrowser && typeof console !== 'undefined') {
|
3734 | console.error(err);
|
3735 | }
|
3736 | else {
|
3737 | throw err;
|
3738 | }
|
3739 | }
|
3740 |
|
3741 |
|
3742 | var isUsingMicroTask = false;
|
3743 | var callbacks = [];
|
3744 | var pending = false;
|
3745 | function flushCallbacks() {
|
3746 | pending = false;
|
3747 | var copies = callbacks.slice(0);
|
3748 | callbacks.length = 0;
|
3749 | for (var i = 0; i < copies.length; i++) {
|
3750 | copies[i]();
|
3751 | }
|
3752 | }
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 | var timerFunc;
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 | if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
3773 | var p_1 = Promise.resolve();
|
3774 | timerFunc = function () {
|
3775 | p_1.then(flushCallbacks);
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 | if (isIOS)
|
3782 | setTimeout(noop);
|
3783 | };
|
3784 | isUsingMicroTask = true;
|
3785 | }
|
3786 | else if (!isIE &&
|
3787 | typeof MutationObserver !== 'undefined' &&
|
3788 | (isNative(MutationObserver) ||
|
3789 |
|
3790 | MutationObserver.toString() === '[object MutationObserverConstructor]')) {
|
3791 |
|
3792 |
|
3793 |
|
3794 | var counter_1 = 1;
|
3795 | var observer = new MutationObserver(flushCallbacks);
|
3796 | var textNode_1 = document.createTextNode(String(counter_1));
|
3797 | observer.observe(textNode_1, {
|
3798 | characterData: true
|
3799 | });
|
3800 | timerFunc = function () {
|
3801 | counter_1 = (counter_1 + 1) % 2;
|
3802 | textNode_1.data = String(counter_1);
|
3803 | };
|
3804 | isUsingMicroTask = true;
|
3805 | }
|
3806 | else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
3807 |
|
3808 |
|
3809 |
|
3810 | timerFunc = function () {
|
3811 | setImmediate(flushCallbacks);
|
3812 | };
|
3813 | }
|
3814 | else {
|
3815 |
|
3816 | timerFunc = function () {
|
3817 | setTimeout(flushCallbacks, 0);
|
3818 | };
|
3819 | }
|
3820 | |
3821 |
|
3822 |
|
3823 | function nextTick(cb, ctx) {
|
3824 | var _resolve;
|
3825 | callbacks.push(function () {
|
3826 | if (cb) {
|
3827 | try {
|
3828 | cb.call(ctx);
|
3829 | }
|
3830 | catch (e) {
|
3831 | handleError(e, ctx, 'nextTick');
|
3832 | }
|
3833 | }
|
3834 | else if (_resolve) {
|
3835 | _resolve(ctx);
|
3836 | }
|
3837 | });
|
3838 | if (!pending) {
|
3839 | pending = true;
|
3840 | timerFunc();
|
3841 | }
|
3842 |
|
3843 | if (!cb && typeof Promise !== 'undefined') {
|
3844 | return new Promise(function (resolve) {
|
3845 | _resolve = resolve;
|
3846 | });
|
3847 | }
|
3848 | }
|
3849 |
|
3850 | function useCssModule(name) {
|
3851 |
|
3852 | {
|
3853 | {
|
3854 | warn$2("useCssModule() is not supported in the global build.");
|
3855 | }
|
3856 | return emptyObject;
|
3857 | }
|
3858 | }
|
3859 |
|
3860 | |
3861 |
|
3862 |
|
3863 |
|
3864 | function useCssVars(getter) {
|
3865 | if (!inBrowser && !false)
|
3866 | return;
|
3867 | var instance = currentInstance;
|
3868 | if (!instance) {
|
3869 | warn$2("useCssVars is called without current active component instance.");
|
3870 | return;
|
3871 | }
|
3872 | watchPostEffect(function () {
|
3873 | var el = instance.$el;
|
3874 | var vars = getter(instance, instance._setupProxy);
|
3875 | if (el && el.nodeType === 1) {
|
3876 | var style = el.style;
|
3877 | for (var key in vars) {
|
3878 | style.setProperty("--".concat(key), vars[key]);
|
3879 | }
|
3880 | }
|
3881 | });
|
3882 | }
|
3883 |
|
3884 | |
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 | function defineAsyncComponent(source) {
|
3890 | if (isFunction(source)) {
|
3891 | source = { loader: source };
|
3892 | }
|
3893 | var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout,
|
3894 | _b = source.suspensible,
|
3895 | suspensible = _b === void 0 ? false : _b,
|
3896 | userOnError = source.onError;
|
3897 | if (suspensible) {
|
3898 | warn$2("The suspensible option for async components is not supported in Vue2. It is ignored.");
|
3899 | }
|
3900 | var pendingRequest = null;
|
3901 | var retries = 0;
|
3902 | var retry = function () {
|
3903 | retries++;
|
3904 | pendingRequest = null;
|
3905 | return load();
|
3906 | };
|
3907 | var load = function () {
|
3908 | var thisRequest;
|
3909 | return (pendingRequest ||
|
3910 | (thisRequest = pendingRequest =
|
3911 | loader()
|
3912 | .catch(function (err) {
|
3913 | err = err instanceof Error ? err : new Error(String(err));
|
3914 | if (userOnError) {
|
3915 | return new Promise(function (resolve, reject) {
|
3916 | var userRetry = function () { return resolve(retry()); };
|
3917 | var userFail = function () { return reject(err); };
|
3918 | userOnError(err, userRetry, userFail, retries + 1);
|
3919 | });
|
3920 | }
|
3921 | else {
|
3922 | throw err;
|
3923 | }
|
3924 | })
|
3925 | .then(function (comp) {
|
3926 | if (thisRequest !== pendingRequest && pendingRequest) {
|
3927 | return pendingRequest;
|
3928 | }
|
3929 | if (!comp) {
|
3930 | warn$2("Async component loader resolved to undefined. " +
|
3931 | "If you are using retry(), make sure to return its return value.");
|
3932 | }
|
3933 |
|
3934 | if (comp &&
|
3935 | (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
3936 | comp = comp.default;
|
3937 | }
|
3938 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
3939 | throw new Error("Invalid async component load result: ".concat(comp));
|
3940 | }
|
3941 | return comp;
|
3942 | })));
|
3943 | };
|
3944 | return function () {
|
3945 | var component = load();
|
3946 | return {
|
3947 | component: component,
|
3948 | delay: delay,
|
3949 | timeout: timeout,
|
3950 | error: errorComponent,
|
3951 | loading: loadingComponent
|
3952 | };
|
3953 | };
|
3954 | }
|
3955 |
|
3956 | function createLifeCycle(hookName) {
|
3957 | return function (fn, target) {
|
3958 | if (target === void 0) { target = currentInstance; }
|
3959 | if (!target) {
|
3960 | warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
|
3961 | "associated with. " +
|
3962 | "Lifecycle injection APIs can only be used during execution of setup().");
|
3963 | return;
|
3964 | }
|
3965 | return injectHook(target, hookName, fn);
|
3966 | };
|
3967 | }
|
3968 | function formatName(name) {
|
3969 | if (name === 'beforeDestroy') {
|
3970 | name = 'beforeUnmount';
|
3971 | }
|
3972 | else if (name === 'destroyed') {
|
3973 | name = 'unmounted';
|
3974 | }
|
3975 | return "on".concat(name[0].toUpperCase() + name.slice(1));
|
3976 | }
|
3977 | function injectHook(instance, hookName, fn) {
|
3978 | var options = instance.$options;
|
3979 | options[hookName] = mergeLifecycleHook(options[hookName], fn);
|
3980 | }
|
3981 | var onBeforeMount = createLifeCycle('beforeMount');
|
3982 | var onMounted = createLifeCycle('mounted');
|
3983 | var onBeforeUpdate = createLifeCycle('beforeUpdate');
|
3984 | var onUpdated = createLifeCycle('updated');
|
3985 | var onBeforeUnmount = createLifeCycle('beforeDestroy');
|
3986 | var onUnmounted = createLifeCycle('destroyed');
|
3987 | var onActivated = createLifeCycle('activated');
|
3988 | var onDeactivated = createLifeCycle('deactivated');
|
3989 | var onServerPrefetch = createLifeCycle('serverPrefetch');
|
3990 | var onRenderTracked = createLifeCycle('renderTracked');
|
3991 | var onRenderTriggered = createLifeCycle('renderTriggered');
|
3992 | var injectErrorCapturedHook = createLifeCycle('errorCaptured');
|
3993 | function onErrorCaptured(hook, target) {
|
3994 | if (target === void 0) { target = currentInstance; }
|
3995 | injectErrorCapturedHook(hook, target);
|
3996 | }
|
3997 |
|
3998 | |
3999 |
|
4000 |
|
4001 | var version = '2.7.15';
|
4002 | |
4003 |
|
4004 |
|
4005 | function defineComponent(options) {
|
4006 | return options;
|
4007 | }
|
4008 |
|
4009 | var vca = Object.freeze({
|
4010 | __proto__: null,
|
4011 | version: version,
|
4012 | defineComponent: defineComponent,
|
4013 | ref: ref$1,
|
4014 | shallowRef: shallowRef,
|
4015 | isRef: isRef,
|
4016 | toRef: toRef,
|
4017 | toRefs: toRefs,
|
4018 | unref: unref,
|
4019 | proxyRefs: proxyRefs,
|
4020 | customRef: customRef,
|
4021 | triggerRef: triggerRef,
|
4022 | reactive: reactive,
|
4023 | isReactive: isReactive,
|
4024 | isReadonly: isReadonly,
|
4025 | isShallow: isShallow,
|
4026 | isProxy: isProxy,
|
4027 | shallowReactive: shallowReactive,
|
4028 | markRaw: markRaw,
|
4029 | toRaw: toRaw,
|
4030 | readonly: readonly,
|
4031 | shallowReadonly: shallowReadonly,
|
4032 | computed: computed,
|
4033 | watch: watch,
|
4034 | watchEffect: watchEffect,
|
4035 | watchPostEffect: watchPostEffect,
|
4036 | watchSyncEffect: watchSyncEffect,
|
4037 | EffectScope: EffectScope,
|
4038 | effectScope: effectScope,
|
4039 | onScopeDispose: onScopeDispose,
|
4040 | getCurrentScope: getCurrentScope,
|
4041 | provide: provide,
|
4042 | inject: inject,
|
4043 | h: h,
|
4044 | getCurrentInstance: getCurrentInstance,
|
4045 | useSlots: useSlots,
|
4046 | useAttrs: useAttrs,
|
4047 | useListeners: useListeners,
|
4048 | mergeDefaults: mergeDefaults,
|
4049 | nextTick: nextTick,
|
4050 | set: set,
|
4051 | del: del,
|
4052 | useCssModule: useCssModule,
|
4053 | useCssVars: useCssVars,
|
4054 | defineAsyncComponent: defineAsyncComponent,
|
4055 | onBeforeMount: onBeforeMount,
|
4056 | onMounted: onMounted,
|
4057 | onBeforeUpdate: onBeforeUpdate,
|
4058 | onUpdated: onUpdated,
|
4059 | onBeforeUnmount: onBeforeUnmount,
|
4060 | onUnmounted: onUnmounted,
|
4061 | onActivated: onActivated,
|
4062 | onDeactivated: onDeactivated,
|
4063 | onServerPrefetch: onServerPrefetch,
|
4064 | onRenderTracked: onRenderTracked,
|
4065 | onRenderTriggered: onRenderTriggered,
|
4066 | onErrorCaptured: onErrorCaptured
|
4067 | });
|
4068 |
|
4069 | var seenObjects = new _Set();
|
4070 | /**
|
4071 | * Recursively traverse an object to evoke all converted
|
4072 | * getters, so that every nested property inside the object
|
4073 | * is collected as a "deep" dependency.
|
4074 | */
|
4075 | function traverse(val) {
|
4076 | _traverse(val, seenObjects);
|
4077 | seenObjects.clear();
|
4078 | return val;
|
4079 | }
|
4080 | function _traverse(val, seen) {
|
4081 | var i, keys;
|
4082 | var isA = isArray(val);
|
4083 | if ((!isA && !isObject(val)) ||
|
4084 | val.__v_skip ||
|
4085 | Object.isFrozen(val) ||
|
4086 | val instanceof VNode) {
|
4087 | return;
|
4088 | }
|
4089 | if (val.__ob__) {
|
4090 | var depId = val.__ob__.dep.id;
|
4091 | if (seen.has(depId)) {
|
4092 | return;
|
4093 | }
|
4094 | seen.add(depId);
|
4095 | }
|
4096 | if (isA) {
|
4097 | i = val.length;
|
4098 | while (i--)
|
4099 | _traverse(val[i], seen);
|
4100 | }
|
4101 | else if (isRef(val)) {
|
4102 | _traverse(val.value, seen);
|
4103 | }
|
4104 | else {
|
4105 | keys = Object.keys(val);
|
4106 | i = keys.length;
|
4107 | while (i--)
|
4108 | _traverse(val[keys[i]], seen);
|
4109 | }
|
4110 | }
|
4111 |
|
4112 | var uid$1 = 0;
|
4113 | |
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 | var Watcher = (function () {
|
4120 | function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
|
4121 | recordEffectScope(this,
|
4122 |
|
4123 |
|
4124 | activeEffectScope && !activeEffectScope._vm
|
4125 | ? activeEffectScope
|
4126 | : vm
|
4127 | ? vm._scope
|
4128 | : undefined);
|
4129 | if ((this.vm = vm) && isRenderWatcher) {
|
4130 | vm._watcher = this;
|
4131 | }
|
4132 |
|
4133 | if (options) {
|
4134 | this.deep = !!options.deep;
|
4135 | this.user = !!options.user;
|
4136 | this.lazy = !!options.lazy;
|
4137 | this.sync = !!options.sync;
|
4138 | this.before = options.before;
|
4139 | {
|
4140 | this.onTrack = options.onTrack;
|
4141 | this.onTrigger = options.onTrigger;
|
4142 | }
|
4143 | }
|
4144 | else {
|
4145 | this.deep = this.user = this.lazy = this.sync = false;
|
4146 | }
|
4147 | this.cb = cb;
|
4148 | this.id = ++uid$1;
|
4149 | this.active = true;
|
4150 | this.post = false;
|
4151 | this.dirty = this.lazy;
|
4152 | this.deps = [];
|
4153 | this.newDeps = [];
|
4154 | this.depIds = new _Set();
|
4155 | this.newDepIds = new _Set();
|
4156 | this.expression = expOrFn.toString() ;
|
4157 |
|
4158 | if (isFunction(expOrFn)) {
|
4159 | this.getter = expOrFn;
|
4160 | }
|
4161 | else {
|
4162 | this.getter = parsePath(expOrFn);
|
4163 | if (!this.getter) {
|
4164 | this.getter = noop;
|
4165 | warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
|
4166 | 'Watcher only accepts simple dot-delimited paths. ' +
|
4167 | 'For full control, use a function instead.', vm);
|
4168 | }
|
4169 | }
|
4170 | this.value = this.lazy ? undefined : this.get();
|
4171 | }
|
4172 | |
4173 |
|
4174 |
|
4175 | Watcher.prototype.get = function () {
|
4176 | pushTarget(this);
|
4177 | var value;
|
4178 | var vm = this.vm;
|
4179 | try {
|
4180 | value = this.getter.call(vm, vm);
|
4181 | }
|
4182 | catch (e) {
|
4183 | if (this.user) {
|
4184 | handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
|
4185 | }
|
4186 | else {
|
4187 | throw e;
|
4188 | }
|
4189 | }
|
4190 | finally {
|
4191 |
|
4192 |
|
4193 | if (this.deep) {
|
4194 | traverse(value);
|
4195 | }
|
4196 | popTarget();
|
4197 | this.cleanupDeps();
|
4198 | }
|
4199 | return value;
|
4200 | };
|
4201 | |
4202 |
|
4203 |
|
4204 | Watcher.prototype.addDep = function (dep) {
|
4205 | var id = dep.id;
|
4206 | if (!this.newDepIds.has(id)) {
|
4207 | this.newDepIds.add(id);
|
4208 | this.newDeps.push(dep);
|
4209 | if (!this.depIds.has(id)) {
|
4210 | dep.addSub(this);
|
4211 | }
|
4212 | }
|
4213 | };
|
4214 | |
4215 |
|
4216 |
|
4217 | Watcher.prototype.cleanupDeps = function () {
|
4218 | var i = this.deps.length;
|
4219 | while (i--) {
|
4220 | var dep = this.deps[i];
|
4221 | if (!this.newDepIds.has(dep.id)) {
|
4222 | dep.removeSub(this);
|
4223 | }
|
4224 | }
|
4225 | var tmp = this.depIds;
|
4226 | this.depIds = this.newDepIds;
|
4227 | this.newDepIds = tmp;
|
4228 | this.newDepIds.clear();
|
4229 | tmp = this.deps;
|
4230 | this.deps = this.newDeps;
|
4231 | this.newDeps = tmp;
|
4232 | this.newDeps.length = 0;
|
4233 | };
|
4234 | |
4235 |
|
4236 |
|
4237 |
|
4238 | Watcher.prototype.update = function () {
|
4239 |
|
4240 | if (this.lazy) {
|
4241 | this.dirty = true;
|
4242 | }
|
4243 | else if (this.sync) {
|
4244 | this.run();
|
4245 | }
|
4246 | else {
|
4247 | queueWatcher(this);
|
4248 | }
|
4249 | };
|
4250 | |
4251 |
|
4252 |
|
4253 |
|
4254 | Watcher.prototype.run = function () {
|
4255 | if (this.active) {
|
4256 | var value = this.get();
|
4257 | if (value !== this.value ||
|
4258 |
|
4259 |
|
4260 |
|
4261 | isObject(value) ||
|
4262 | this.deep) {
|
4263 |
|
4264 | var oldValue = this.value;
|
4265 | this.value = value;
|
4266 | if (this.user) {
|
4267 | var info = "callback for watcher \"".concat(this.expression, "\"");
|
4268 | invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
|
4269 | }
|
4270 | else {
|
4271 | this.cb.call(this.vm, value, oldValue);
|
4272 | }
|
4273 | }
|
4274 | }
|
4275 | };
|
4276 | |
4277 |
|
4278 |
|
4279 |
|
4280 | Watcher.prototype.evaluate = function () {
|
4281 | this.value = this.get();
|
4282 | this.dirty = false;
|
4283 | };
|
4284 | |
4285 |
|
4286 |
|
4287 | Watcher.prototype.depend = function () {
|
4288 | var i = this.deps.length;
|
4289 | while (i--) {
|
4290 | this.deps[i].depend();
|
4291 | }
|
4292 | };
|
4293 | |
4294 |
|
4295 |
|
4296 | Watcher.prototype.teardown = function () {
|
4297 | if (this.vm && !this.vm._isBeingDestroyed) {
|
4298 | remove$2(this.vm._scope.effects, this);
|
4299 | }
|
4300 | if (this.active) {
|
4301 | var i = this.deps.length;
|
4302 | while (i--) {
|
4303 | this.deps[i].removeSub(this);
|
4304 | }
|
4305 | this.active = false;
|
4306 | if (this.onStop) {
|
4307 | this.onStop();
|
4308 | }
|
4309 | }
|
4310 | };
|
4311 | return Watcher;
|
4312 | }());
|
4313 |
|
4314 | var sharedPropertyDefinition = {
|
4315 | enumerable: true,
|
4316 | configurable: true,
|
4317 | get: noop,
|
4318 | set: noop
|
4319 | };
|
4320 | function proxy(target, sourceKey, key) {
|
4321 | sharedPropertyDefinition.get = function proxyGetter() {
|
4322 | return this[sourceKey][key];
|
4323 | };
|
4324 | sharedPropertyDefinition.set = function proxySetter(val) {
|
4325 | this[sourceKey][key] = val;
|
4326 | };
|
4327 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4328 | }
|
4329 | function initState(vm) {
|
4330 | var opts = vm.$options;
|
4331 | if (opts.props)
|
4332 | initProps$1(vm, opts.props);
|
4333 |
|
4334 | initSetup(vm);
|
4335 | if (opts.methods)
|
4336 | initMethods(vm, opts.methods);
|
4337 | if (opts.data) {
|
4338 | initData(vm);
|
4339 | }
|
4340 | else {
|
4341 | var ob = observe((vm._data = {}));
|
4342 | ob && ob.vmCount++;
|
4343 | }
|
4344 | if (opts.computed)
|
4345 | initComputed$1(vm, opts.computed);
|
4346 | if (opts.watch && opts.watch !== nativeWatch) {
|
4347 | initWatch(vm, opts.watch);
|
4348 | }
|
4349 | }
|
4350 | function initProps$1(vm, propsOptions) {
|
4351 | var propsData = vm.$options.propsData || {};
|
4352 | var props = (vm._props = shallowReactive({}));
|
4353 |
|
4354 |
|
4355 | var keys = (vm.$options._propKeys = []);
|
4356 | var isRoot = !vm.$parent;
|
4357 |
|
4358 | if (!isRoot) {
|
4359 | toggleObserving(false);
|
4360 | }
|
4361 | var _loop_1 = function (key) {
|
4362 | keys.push(key);
|
4363 | var value = validateProp(key, propsOptions, propsData, vm);
|
4364 |
|
4365 | {
|
4366 | var hyphenatedKey = hyphenate(key);
|
4367 | if (isReservedAttribute(hyphenatedKey) ||
|
4368 | config.isReservedAttr(hyphenatedKey)) {
|
4369 | warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
|
4370 | }
|
4371 | defineReactive(props, key, value, function () {
|
4372 | if (!isRoot && !isUpdatingChildComponent) {
|
4373 | warn$2("Avoid mutating a prop directly since the value will be " +
|
4374 | "overwritten whenever the parent component re-renders. " +
|
4375 | "Instead, use a data or computed property based on the prop's " +
|
4376 | "value. Prop being mutated: \"".concat(key, "\""), vm);
|
4377 | }
|
4378 | });
|
4379 | }
|
4380 |
|
4381 |
|
4382 |
|
4383 | if (!(key in vm)) {
|
4384 | proxy(vm, "_props", key);
|
4385 | }
|
4386 | };
|
4387 | for (var key in propsOptions) {
|
4388 | _loop_1(key);
|
4389 | }
|
4390 | toggleObserving(true);
|
4391 | }
|
4392 | function initData(vm) {
|
4393 | var data = vm.$options.data;
|
4394 | data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
|
4395 | if (!isPlainObject(data)) {
|
4396 | data = {};
|
4397 | warn$2('data functions should return an object:\n' +
|
4398 | 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
4399 | }
|
4400 |
|
4401 | var keys = Object.keys(data);
|
4402 | var props = vm.$options.props;
|
4403 | var methods = vm.$options.methods;
|
4404 | var i = keys.length;
|
4405 | while (i--) {
|
4406 | var key = keys[i];
|
4407 | {
|
4408 | if (methods && hasOwn(methods, key)) {
|
4409 | warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
|
4410 | }
|
4411 | }
|
4412 | if (props && hasOwn(props, key)) {
|
4413 | warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
|
4414 | "Use prop default value instead.", vm);
|
4415 | }
|
4416 | else if (!isReserved(key)) {
|
4417 | proxy(vm, "_data", key);
|
4418 | }
|
4419 | }
|
4420 |
|
4421 | var ob = observe(data);
|
4422 | ob && ob.vmCount++;
|
4423 | }
|
4424 | function getData(data, vm) {
|
4425 |
|
4426 | pushTarget();
|
4427 | try {
|
4428 | return data.call(vm, vm);
|
4429 | }
|
4430 | catch (e) {
|
4431 | handleError(e, vm, "data()");
|
4432 | return {};
|
4433 | }
|
4434 | finally {
|
4435 | popTarget();
|
4436 | }
|
4437 | }
|
4438 | var computedWatcherOptions = { lazy: true };
|
4439 | function initComputed$1(vm, computed) {
|
4440 |
|
4441 | var watchers = (vm._computedWatchers = Object.create(null));
|
4442 |
|
4443 | var isSSR = isServerRendering();
|
4444 | for (var key in computed) {
|
4445 | var userDef = computed[key];
|
4446 | var getter = isFunction(userDef) ? userDef : userDef.get;
|
4447 | if (getter == null) {
|
4448 | warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
|
4449 | }
|
4450 | if (!isSSR) {
|
4451 |
|
4452 | watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
|
4453 | }
|
4454 |
|
4455 |
|
4456 |
|
4457 | if (!(key in vm)) {
|
4458 | defineComputed(vm, key, userDef);
|
4459 | }
|
4460 | else {
|
4461 | if (key in vm.$data) {
|
4462 | warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
|
4463 | }
|
4464 | else if (vm.$options.props && key in vm.$options.props) {
|
4465 | warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
|
4466 | }
|
4467 | else if (vm.$options.methods && key in vm.$options.methods) {
|
4468 | warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
|
4469 | }
|
4470 | }
|
4471 | }
|
4472 | }
|
4473 | function defineComputed(target, key, userDef) {
|
4474 | var shouldCache = !isServerRendering();
|
4475 | if (isFunction(userDef)) {
|
4476 | sharedPropertyDefinition.get = shouldCache
|
4477 | ? createComputedGetter(key)
|
4478 | : createGetterInvoker(userDef);
|
4479 | sharedPropertyDefinition.set = noop;
|
4480 | }
|
4481 | else {
|
4482 | sharedPropertyDefinition.get = userDef.get
|
4483 | ? shouldCache && userDef.cache !== false
|
4484 | ? createComputedGetter(key)
|
4485 | : createGetterInvoker(userDef.get)
|
4486 | : noop;
|
4487 | sharedPropertyDefinition.set = userDef.set || noop;
|
4488 | }
|
4489 | if (sharedPropertyDefinition.set === noop) {
|
4490 | sharedPropertyDefinition.set = function () {
|
4491 | warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
|
4492 | };
|
4493 | }
|
4494 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4495 | }
|
4496 | function createComputedGetter(key) {
|
4497 | return function computedGetter() {
|
4498 | var watcher = this._computedWatchers && this._computedWatchers[key];
|
4499 | if (watcher) {
|
4500 | if (watcher.dirty) {
|
4501 | watcher.evaluate();
|
4502 | }
|
4503 | if (Dep.target) {
|
4504 | if (Dep.target.onTrack) {
|
4505 | Dep.target.onTrack({
|
4506 | effect: Dep.target,
|
4507 | target: this,
|
4508 | type: "get" ,
|
4509 | key: key
|
4510 | });
|
4511 | }
|
4512 | watcher.depend();
|
4513 | }
|
4514 | return watcher.value;
|
4515 | }
|
4516 | };
|
4517 | }
|
4518 | function createGetterInvoker(fn) {
|
4519 | return function computedGetter() {
|
4520 | return fn.call(this, this);
|
4521 | };
|
4522 | }
|
4523 | function initMethods(vm, methods) {
|
4524 | var props = vm.$options.props;
|
4525 | for (var key in methods) {
|
4526 | {
|
4527 | if (typeof methods[key] !== 'function') {
|
4528 | warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
|
4529 | "Did you reference the function correctly?", vm);
|
4530 | }
|
4531 | if (props && hasOwn(props, key)) {
|
4532 | warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
|
4533 | }
|
4534 | if (key in vm && isReserved(key)) {
|
4535 | warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
|
4536 | "Avoid defining component methods that start with _ or $.");
|
4537 | }
|
4538 | }
|
4539 | vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
|
4540 | }
|
4541 | }
|
4542 | function initWatch(vm, watch) {
|
4543 | for (var key in watch) {
|
4544 | var handler = watch[key];
|
4545 | if (isArray(handler)) {
|
4546 | for (var i = 0; i < handler.length; i++) {
|
4547 | createWatcher(vm, key, handler[i]);
|
4548 | }
|
4549 | }
|
4550 | else {
|
4551 | createWatcher(vm, key, handler);
|
4552 | }
|
4553 | }
|
4554 | }
|
4555 | function createWatcher(vm, expOrFn, handler, options) {
|
4556 | if (isPlainObject(handler)) {
|
4557 | options = handler;
|
4558 | handler = handler.handler;
|
4559 | }
|
4560 | if (typeof handler === 'string') {
|
4561 | handler = vm[handler];
|
4562 | }
|
4563 | return vm.$watch(expOrFn, handler, options);
|
4564 | }
|
4565 | function stateMixin(Vue) {
|
4566 |
|
4567 |
|
4568 |
|
4569 | var dataDef = {};
|
4570 | dataDef.get = function () {
|
4571 | return this._data;
|
4572 | };
|
4573 | var propsDef = {};
|
4574 | propsDef.get = function () {
|
4575 | return this._props;
|
4576 | };
|
4577 | {
|
4578 | dataDef.set = function () {
|
4579 | warn$2('Avoid replacing instance root $data. ' +
|
4580 | 'Use nested data properties instead.', this);
|
4581 | };
|
4582 | propsDef.set = function () {
|
4583 | warn$2("$props is readonly.", this);
|
4584 | };
|
4585 | }
|
4586 | Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4587 | Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4588 | Vue.prototype.$set = set;
|
4589 | Vue.prototype.$delete = del;
|
4590 | Vue.prototype.$watch = function (expOrFn, cb, options) {
|
4591 | var vm = this;
|
4592 | if (isPlainObject(cb)) {
|
4593 | return createWatcher(vm, expOrFn, cb, options);
|
4594 | }
|
4595 | options = options || {};
|
4596 | options.user = true;
|
4597 | var watcher = new Watcher(vm, expOrFn, cb, options);
|
4598 | if (options.immediate) {
|
4599 | var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
|
4600 | pushTarget();
|
4601 | invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
4602 | popTarget();
|
4603 | }
|
4604 | return function unwatchFn() {
|
4605 | watcher.teardown();
|
4606 | };
|
4607 | };
|
4608 | }
|
4609 |
|
4610 | function initProvide(vm) {
|
4611 | var provideOption = vm.$options.provide;
|
4612 | if (provideOption) {
|
4613 | var provided = isFunction(provideOption)
|
4614 | ? provideOption.call(vm)
|
4615 | : provideOption;
|
4616 | if (!isObject(provided)) {
|
4617 | return;
|
4618 | }
|
4619 | var source = resolveProvided(vm);
|
4620 |
|
4621 |
|
4622 | var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
4623 | for (var i = 0; i < keys.length; i++) {
|
4624 | var key = keys[i];
|
4625 | Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
4626 | }
|
4627 | }
|
4628 | }
|
4629 | function initInjections(vm) {
|
4630 | var result = resolveInject(vm.$options.inject, vm);
|
4631 | if (result) {
|
4632 | toggleObserving(false);
|
4633 | Object.keys(result).forEach(function (key) {
|
4634 |
|
4635 | {
|
4636 | defineReactive(vm, key, result[key], function () {
|
4637 | warn$2("Avoid mutating an injected value directly since the changes will be " +
|
4638 | "overwritten whenever the provided component re-renders. " +
|
4639 | "injection being mutated: \"".concat(key, "\""), vm);
|
4640 | });
|
4641 | }
|
4642 | });
|
4643 | toggleObserving(true);
|
4644 | }
|
4645 | }
|
4646 | function resolveInject(inject, vm) {
|
4647 | if (inject) {
|
4648 |
|
4649 | var result = Object.create(null);
|
4650 | var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
|
4651 | for (var i = 0; i < keys.length; i++) {
|
4652 | var key = keys[i];
|
4653 |
|
4654 | if (key === '__ob__')
|
4655 | continue;
|
4656 | var provideKey = inject[key].from;
|
4657 | if (provideKey in vm._provided) {
|
4658 | result[key] = vm._provided[provideKey];
|
4659 | }
|
4660 | else if ('default' in inject[key]) {
|
4661 | var provideDefault = inject[key].default;
|
4662 | result[key] = isFunction(provideDefault)
|
4663 | ? provideDefault.call(vm)
|
4664 | : provideDefault;
|
4665 | }
|
4666 | else {
|
4667 | warn$2("Injection \"".concat(key, "\" not found"), vm);
|
4668 | }
|
4669 | }
|
4670 | return result;
|
4671 | }
|
4672 | }
|
4673 |
|
4674 | var uid = 0;
|
4675 | function initMixin$1(Vue) {
|
4676 | Vue.prototype._init = function (options) {
|
4677 | var vm = this;
|
4678 |
|
4679 | vm._uid = uid++;
|
4680 | var startTag, endTag;
|
4681 |
|
4682 | if (config.performance && mark) {
|
4683 | startTag = "vue-perf-start:".concat(vm._uid);
|
4684 | endTag = "vue-perf-end:".concat(vm._uid);
|
4685 | mark(startTag);
|
4686 | }
|
4687 |
|
4688 |
|
4689 | vm._isVue = true;
|
4690 |
|
4691 | vm.__v_skip = true;
|
4692 |
|
4693 | vm._scope = new EffectScope(true );
|
4694 | vm._scope._vm = true;
|
4695 |
|
4696 | if (options && options._isComponent) {
|
4697 |
|
4698 |
|
4699 |
|
4700 | initInternalComponent(vm, options);
|
4701 | }
|
4702 | else {
|
4703 | vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
|
4704 | }
|
4705 |
|
4706 | {
|
4707 | initProxy(vm);
|
4708 | }
|
4709 |
|
4710 | vm._self = vm;
|
4711 | initLifecycle(vm);
|
4712 | initEvents(vm);
|
4713 | initRender(vm);
|
4714 | callHook$1(vm, 'beforeCreate', undefined, false );
|
4715 | initInjections(vm);
|
4716 | initState(vm);
|
4717 | initProvide(vm);
|
4718 | callHook$1(vm, 'created');
|
4719 |
|
4720 | if (config.performance && mark) {
|
4721 | vm._name = formatComponentName(vm, false);
|
4722 | mark(endTag);
|
4723 | measure("vue ".concat(vm._name, " init"), startTag, endTag);
|
4724 | }
|
4725 | if (vm.$options.el) {
|
4726 | vm.$mount(vm.$options.el);
|
4727 | }
|
4728 | };
|
4729 | }
|
4730 | function initInternalComponent(vm, options) {
|
4731 | var opts = (vm.$options = Object.create(vm.constructor.options));
|
4732 |
|
4733 | var parentVnode = options._parentVnode;
|
4734 | opts.parent = options.parent;
|
4735 | opts._parentVnode = parentVnode;
|
4736 | var vnodeComponentOptions = parentVnode.componentOptions;
|
4737 | opts.propsData = vnodeComponentOptions.propsData;
|
4738 | opts._parentListeners = vnodeComponentOptions.listeners;
|
4739 | opts._renderChildren = vnodeComponentOptions.children;
|
4740 | opts._componentTag = vnodeComponentOptions.tag;
|
4741 | if (options.render) {
|
4742 | opts.render = options.render;
|
4743 | opts.staticRenderFns = options.staticRenderFns;
|
4744 | }
|
4745 | }
|
4746 | function resolveConstructorOptions(Ctor) {
|
4747 | var options = Ctor.options;
|
4748 | if (Ctor.super) {
|
4749 | var superOptions = resolveConstructorOptions(Ctor.super);
|
4750 | var cachedSuperOptions = Ctor.superOptions;
|
4751 | if (superOptions !== cachedSuperOptions) {
|
4752 |
|
4753 |
|
4754 | Ctor.superOptions = superOptions;
|
4755 |
|
4756 | var modifiedOptions = resolveModifiedOptions(Ctor);
|
4757 |
|
4758 | if (modifiedOptions) {
|
4759 | extend(Ctor.extendOptions, modifiedOptions);
|
4760 | }
|
4761 | options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
4762 | if (options.name) {
|
4763 | options.components[options.name] = Ctor;
|
4764 | }
|
4765 | }
|
4766 | }
|
4767 | return options;
|
4768 | }
|
4769 | function resolveModifiedOptions(Ctor) {
|
4770 | var modified;
|
4771 | var latest = Ctor.options;
|
4772 | var sealed = Ctor.sealedOptions;
|
4773 | for (var key in latest) {
|
4774 | if (latest[key] !== sealed[key]) {
|
4775 | if (!modified)
|
4776 | modified = {};
|
4777 | modified[key] = latest[key];
|
4778 | }
|
4779 | }
|
4780 | return modified;
|
4781 | }
|
4782 |
|
4783 | function FunctionalRenderContext(data, props, children, parent, Ctor) {
|
4784 | var _this = this;
|
4785 | var options = Ctor.options;
|
4786 |
|
4787 |
|
4788 | var contextVm;
|
4789 | if (hasOwn(parent, '_uid')) {
|
4790 | contextVm = Object.create(parent);
|
4791 | contextVm._original = parent;
|
4792 | }
|
4793 | else {
|
4794 |
|
4795 |
|
4796 |
|
4797 | contextVm = parent;
|
4798 |
|
4799 | parent = parent._original;
|
4800 | }
|
4801 | var isCompiled = isTrue(options._compiled);
|
4802 | var needNormalization = !isCompiled;
|
4803 | this.data = data;
|
4804 | this.props = props;
|
4805 | this.children = children;
|
4806 | this.parent = parent;
|
4807 | this.listeners = data.on || emptyObject;
|
4808 | this.injections = resolveInject(options.inject, parent);
|
4809 | this.slots = function () {
|
4810 | if (!_this.$slots) {
|
4811 | normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
|
4812 | }
|
4813 | return _this.$slots;
|
4814 | };
|
4815 | Object.defineProperty(this, 'scopedSlots', {
|
4816 | enumerable: true,
|
4817 | get: function () {
|
4818 | return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
|
4819 | }
|
4820 | });
|
4821 |
|
4822 | if (isCompiled) {
|
4823 |
|
4824 | this.$options = options;
|
4825 |
|
4826 | this.$slots = this.slots();
|
4827 | this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
|
4828 | }
|
4829 | if (options._scopeId) {
|
4830 | this._c = function (a, b, c, d) {
|
4831 | var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
|
4832 | if (vnode && !isArray(vnode)) {
|
4833 | vnode.fnScopeId = options._scopeId;
|
4834 | vnode.fnContext = parent;
|
4835 | }
|
4836 | return vnode;
|
4837 | };
|
4838 | }
|
4839 | else {
|
4840 | this._c = function (a, b, c, d) {
|
4841 | return createElement$1(contextVm, a, b, c, d, needNormalization);
|
4842 | };
|
4843 | }
|
4844 | }
|
4845 | installRenderHelpers(FunctionalRenderContext.prototype);
|
4846 | function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
|
4847 | var options = Ctor.options;
|
4848 | var props = {};
|
4849 | var propOptions = options.props;
|
4850 | if (isDef(propOptions)) {
|
4851 | for (var key in propOptions) {
|
4852 | props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
4853 | }
|
4854 | }
|
4855 | else {
|
4856 | if (isDef(data.attrs))
|
4857 | mergeProps(props, data.attrs);
|
4858 | if (isDef(data.props))
|
4859 | mergeProps(props, data.props);
|
4860 | }
|
4861 | var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
|
4862 | var vnode = options.render.call(null, renderContext._c, renderContext);
|
4863 | if (vnode instanceof VNode) {
|
4864 | return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
|
4865 | }
|
4866 | else if (isArray(vnode)) {
|
4867 | var vnodes = normalizeChildren(vnode) || [];
|
4868 | var res = new Array(vnodes.length);
|
4869 | for (var i = 0; i < vnodes.length; i++) {
|
4870 | res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
4871 | }
|
4872 | return res;
|
4873 | }
|
4874 | }
|
4875 | function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
|
4876 |
|
4877 |
|
4878 |
|
4879 | var clone = cloneVNode(vnode);
|
4880 | clone.fnContext = contextVm;
|
4881 | clone.fnOptions = options;
|
4882 | {
|
4883 | (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
|
4884 | renderContext;
|
4885 | }
|
4886 | if (data.slot) {
|
4887 | (clone.data || (clone.data = {})).slot = data.slot;
|
4888 | }
|
4889 | return clone;
|
4890 | }
|
4891 | function mergeProps(to, from) {
|
4892 | for (var key in from) {
|
4893 | to[camelize(key)] = from[key];
|
4894 | }
|
4895 | }
|
4896 |
|
4897 | function getComponentName(options) {
|
4898 | return options.name || options.__name || options._componentTag;
|
4899 | }
|
4900 |
|
4901 | var componentVNodeHooks = {
|
4902 | init: function (vnode, hydrating) {
|
4903 | if (vnode.componentInstance &&
|
4904 | !vnode.componentInstance._isDestroyed &&
|
4905 | vnode.data.keepAlive) {
|
4906 |
|
4907 | var mountedNode = vnode;
|
4908 | componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
4909 | }
|
4910 | else {
|
4911 | var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
|
4912 | child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
4913 | }
|
4914 | },
|
4915 | prepatch: function (oldVnode, vnode) {
|
4916 | var options = vnode.componentOptions;
|
4917 | var child = (vnode.componentInstance = oldVnode.componentInstance);
|
4918 | updateChildComponent(child, options.propsData,
|
4919 | options.listeners,
|
4920 | vnode,
|
4921 | options.children
|
4922 | );
|
4923 | },
|
4924 | insert: function (vnode) {
|
4925 | var context = vnode.context, componentInstance = vnode.componentInstance;
|
4926 | if (!componentInstance._isMounted) {
|
4927 | componentInstance._isMounted = true;
|
4928 | callHook$1(componentInstance, 'mounted');
|
4929 | }
|
4930 | if (vnode.data.keepAlive) {
|
4931 | if (context._isMounted) {
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 | queueActivatedComponent(componentInstance);
|
4938 | }
|
4939 | else {
|
4940 | activateChildComponent(componentInstance, true );
|
4941 | }
|
4942 | }
|
4943 | },
|
4944 | destroy: function (vnode) {
|
4945 | var componentInstance = vnode.componentInstance;
|
4946 | if (!componentInstance._isDestroyed) {
|
4947 | if (!vnode.data.keepAlive) {
|
4948 | componentInstance.$destroy();
|
4949 | }
|
4950 | else {
|
4951 | deactivateChildComponent(componentInstance, true );
|
4952 | }
|
4953 | }
|
4954 | }
|
4955 | };
|
4956 | var hooksToMerge = Object.keys(componentVNodeHooks);
|
4957 | function createComponent(Ctor, data, context, children, tag) {
|
4958 | if (isUndef(Ctor)) {
|
4959 | return;
|
4960 | }
|
4961 | var baseCtor = context.$options._base;
|
4962 |
|
4963 | if (isObject(Ctor)) {
|
4964 | Ctor = baseCtor.extend(Ctor);
|
4965 | }
|
4966 |
|
4967 |
|
4968 | if (typeof Ctor !== 'function') {
|
4969 | {
|
4970 | warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
|
4971 | }
|
4972 | return;
|
4973 | }
|
4974 |
|
4975 | var asyncFactory;
|
4976 |
|
4977 | if (isUndef(Ctor.cid)) {
|
4978 | asyncFactory = Ctor;
|
4979 | Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
4980 | if (Ctor === undefined) {
|
4981 |
|
4982 |
|
4983 |
|
4984 | return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
|
4985 | }
|
4986 | }
|
4987 | data = data || {};
|
4988 |
|
4989 |
|
4990 | resolveConstructorOptions(Ctor);
|
4991 |
|
4992 | if (isDef(data.model)) {
|
4993 |
|
4994 | transformModel(Ctor.options, data);
|
4995 | }
|
4996 |
|
4997 |
|
4998 | var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
4999 |
|
5000 |
|
5001 | if (isTrue(Ctor.options.functional)) {
|
5002 | return createFunctionalComponent(Ctor, propsData, data, context, children);
|
5003 | }
|
5004 |
|
5005 |
|
5006 | var listeners = data.on;
|
5007 |
|
5008 |
|
5009 | data.on = data.nativeOn;
|
5010 |
|
5011 | if (isTrue(Ctor.options.abstract)) {
|
5012 |
|
5013 |
|
5014 |
|
5015 | var slot = data.slot;
|
5016 | data = {};
|
5017 | if (slot) {
|
5018 | data.slot = slot;
|
5019 | }
|
5020 | }
|
5021 |
|
5022 | installComponentHooks(data);
|
5023 |
|
5024 |
|
5025 | var name = getComponentName(Ctor.options) || tag;
|
5026 | var vnode = new VNode(
|
5027 |
|
5028 | "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
|
5029 |
|
5030 | { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
|
5031 | return vnode;
|
5032 | }
|
5033 | function createComponentInstanceForVnode(
|
5034 | // we know it's MountedComponentVNode but flow doesn't
|
5035 | vnode,
|
5036 | // activeInstance in lifecycle state
|
5037 | parent) {
|
5038 | var options = {
|
5039 | _isComponent: true,
|
5040 | _parentVnode: vnode,
|
5041 | parent: parent
|
5042 | };
|
5043 |
|
5044 | var inlineTemplate = vnode.data.inlineTemplate;
|
5045 | if (isDef(inlineTemplate)) {
|
5046 | options.render = inlineTemplate.render;
|
5047 | options.staticRenderFns = inlineTemplate.staticRenderFns;
|
5048 | }
|
5049 | return new vnode.componentOptions.Ctor(options);
|
5050 | }
|
5051 | function installComponentHooks(data) {
|
5052 | var hooks = data.hook || (data.hook = {});
|
5053 | for (var i = 0; i < hooksToMerge.length; i++) {
|
5054 | var key = hooksToMerge[i];
|
5055 | var existing = hooks[key];
|
5056 | var toMerge = componentVNodeHooks[key];
|
5057 |
|
5058 | if (existing !== toMerge && !(existing && existing._merged)) {
|
5059 | hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
|
5060 | }
|
5061 | }
|
5062 | }
|
5063 | function mergeHook(f1, f2) {
|
5064 | var merged = function (a, b) {
|
5065 |
|
5066 | f1(a, b);
|
5067 | f2(a, b);
|
5068 | };
|
5069 | merged._merged = true;
|
5070 | return merged;
|
5071 | }
|
5072 |
|
5073 |
|
5074 | function transformModel(options, data) {
|
5075 | var prop = (options.model && options.model.prop) || 'value';
|
5076 | var event = (options.model && options.model.event) || 'input';
|
5077 | (data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
5078 | var on = data.on || (data.on = {});
|
5079 | var existing = on[event];
|
5080 | var callback = data.model.callback;
|
5081 | if (isDef(existing)) {
|
5082 | if (isArray(existing)
|
5083 | ? existing.indexOf(callback) === -1
|
5084 | : existing !== callback) {
|
5085 | on[event] = [callback].concat(existing);
|
5086 | }
|
5087 | }
|
5088 | else {
|
5089 | on[event] = callback;
|
5090 | }
|
5091 | }
|
5092 |
|
5093 | var warn$2 = noop;
|
5094 | var tip = noop;
|
5095 | var generateComponentTrace;
|
5096 | var formatComponentName;
|
5097 | {
|
5098 | var hasConsole_1 = typeof console !== 'undefined';
|
5099 | var classifyRE_1 = /(?:^|[-_])(\w)/g;
|
5100 | var classify_1 = function (str) {
|
5101 | return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
|
5102 | };
|
5103 | warn$2 = function (msg, vm) {
|
5104 | if (vm === void 0) { vm = currentInstance; }
|
5105 | var trace = vm ? generateComponentTrace(vm) : '';
|
5106 | if (config.warnHandler) {
|
5107 | config.warnHandler.call(null, msg, vm, trace);
|
5108 | }
|
5109 | else if (hasConsole_1 && !config.silent) {
|
5110 | console.error("[Vue warn]: ".concat(msg).concat(trace));
|
5111 | }
|
5112 | };
|
5113 | tip = function (msg, vm) {
|
5114 | if (hasConsole_1 && !config.silent) {
|
5115 | console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
|
5116 | }
|
5117 | };
|
5118 | formatComponentName = function (vm, includeFile) {
|
5119 | if (vm.$root === vm) {
|
5120 | return '<Root>';
|
5121 | }
|
5122 | var options = isFunction(vm) && vm.cid != null
|
5123 | ? vm.options
|
5124 | : vm._isVue
|
5125 | ? vm.$options || vm.constructor.options
|
5126 | : vm;
|
5127 | var name = getComponentName(options);
|
5128 | var file = options.__file;
|
5129 | if (!name && file) {
|
5130 | var match = file.match(/([^/\\]+)\.vue$/);
|
5131 | name = match && match[1];
|
5132 | }
|
5133 | return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
|
5134 | (file && includeFile !== false ? " at ".concat(file) : ''));
|
5135 | };
|
5136 | var repeat_1 = function (str, n) {
|
5137 | var res = '';
|
5138 | while (n) {
|
5139 | if (n % 2 === 1)
|
5140 | res += str;
|
5141 | if (n > 1)
|
5142 | str += str;
|
5143 | n >>= 1;
|
5144 | }
|
5145 | return res;
|
5146 | };
|
5147 | generateComponentTrace = function (vm) {
|
5148 | if (vm._isVue && vm.$parent) {
|
5149 | var tree = [];
|
5150 | var currentRecursiveSequence = 0;
|
5151 | while (vm) {
|
5152 | if (tree.length > 0) {
|
5153 | var last = tree[tree.length - 1];
|
5154 | if (last.constructor === vm.constructor) {
|
5155 | currentRecursiveSequence++;
|
5156 | vm = vm.$parent;
|
5157 | continue;
|
5158 | }
|
5159 | else if (currentRecursiveSequence > 0) {
|
5160 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
5161 | currentRecursiveSequence = 0;
|
5162 | }
|
5163 | }
|
5164 | tree.push(vm);
|
5165 | vm = vm.$parent;
|
5166 | }
|
5167 | return ('\n\nfound in\n\n' +
|
5168 | tree
|
5169 | .map(function (vm, i) {
|
5170 | return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
|
5171 | ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
|
5172 | : formatComponentName(vm));
|
5173 | })
|
5174 | .join('\n'));
|
5175 | }
|
5176 | else {
|
5177 | return "\n\n(found in ".concat(formatComponentName(vm), ")");
|
5178 | }
|
5179 | };
|
5180 | }
|
5181 |
|
5182 | |
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 | var strats = config.optionMergeStrategies;
|
5188 | |
5189 |
|
5190 |
|
5191 | {
|
5192 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
5193 | if (!vm) {
|
5194 | warn$2("option \"".concat(key, "\" can only be used during instance ") +
|
5195 | 'creation with the `new` keyword.');
|
5196 | }
|
5197 | return defaultStrat(parent, child);
|
5198 | };
|
5199 | }
|
5200 | |
5201 |
|
5202 |
|
5203 | function mergeData(to, from, recursive) {
|
5204 | if (recursive === void 0) { recursive = true; }
|
5205 | if (!from)
|
5206 | return to;
|
5207 | var key, toVal, fromVal;
|
5208 | var keys = hasSymbol
|
5209 | ? Reflect.ownKeys(from)
|
5210 | : Object.keys(from);
|
5211 | for (var i = 0; i < keys.length; i++) {
|
5212 | key = keys[i];
|
5213 |
|
5214 | if (key === '__ob__')
|
5215 | continue;
|
5216 | toVal = to[key];
|
5217 | fromVal = from[key];
|
5218 | if (!recursive || !hasOwn(to, key)) {
|
5219 | set(to, key, fromVal);
|
5220 | }
|
5221 | else if (toVal !== fromVal &&
|
5222 | isPlainObject(toVal) &&
|
5223 | isPlainObject(fromVal)) {
|
5224 | mergeData(toVal, fromVal);
|
5225 | }
|
5226 | }
|
5227 | return to;
|
5228 | }
|
5229 | |
5230 |
|
5231 |
|
5232 | function mergeDataOrFn(parentVal, childVal, vm) {
|
5233 | if (!vm) {
|
5234 |
|
5235 | if (!childVal) {
|
5236 | return parentVal;
|
5237 | }
|
5238 | if (!parentVal) {
|
5239 | return childVal;
|
5240 | }
|
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | return function mergedDataFn() {
|
5247 | return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
|
5248 | };
|
5249 | }
|
5250 | else {
|
5251 | return function mergedInstanceDataFn() {
|
5252 |
|
5253 | var instanceData = isFunction(childVal)
|
5254 | ? childVal.call(vm, vm)
|
5255 | : childVal;
|
5256 | var defaultData = isFunction(parentVal)
|
5257 | ? parentVal.call(vm, vm)
|
5258 | : parentVal;
|
5259 | if (instanceData) {
|
5260 | return mergeData(instanceData, defaultData);
|
5261 | }
|
5262 | else {
|
5263 | return defaultData;
|
5264 | }
|
5265 | };
|
5266 | }
|
5267 | }
|
5268 | strats.data = function (parentVal, childVal, vm) {
|
5269 | if (!vm) {
|
5270 | if (childVal && typeof childVal !== 'function') {
|
5271 | warn$2('The "data" option should be a function ' +
|
5272 | 'that returns a per-instance value in component ' +
|
5273 | 'definitions.', vm);
|
5274 | return parentVal;
|
5275 | }
|
5276 | return mergeDataOrFn(parentVal, childVal);
|
5277 | }
|
5278 | return mergeDataOrFn(parentVal, childVal, vm);
|
5279 | };
|
5280 | |
5281 |
|
5282 |
|
5283 | function mergeLifecycleHook(parentVal, childVal) {
|
5284 | var res = childVal
|
5285 | ? parentVal
|
5286 | ? parentVal.concat(childVal)
|
5287 | : isArray(childVal)
|
5288 | ? childVal
|
5289 | : [childVal]
|
5290 | : parentVal;
|
5291 | return res ? dedupeHooks(res) : res;
|
5292 | }
|
5293 | function dedupeHooks(hooks) {
|
5294 | var res = [];
|
5295 | for (var i = 0; i < hooks.length; i++) {
|
5296 | if (res.indexOf(hooks[i]) === -1) {
|
5297 | res.push(hooks[i]);
|
5298 | }
|
5299 | }
|
5300 | return res;
|
5301 | }
|
5302 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
5303 | strats[hook] = mergeLifecycleHook;
|
5304 | });
|
5305 | |
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 | function mergeAssets(parentVal, childVal, vm, key) {
|
5313 | var res = Object.create(parentVal || null);
|
5314 | if (childVal) {
|
5315 | assertObjectType(key, childVal, vm);
|
5316 | return extend(res, childVal);
|
5317 | }
|
5318 | else {
|
5319 | return res;
|
5320 | }
|
5321 | }
|
5322 | ASSET_TYPES.forEach(function (type) {
|
5323 | strats[type + 's'] = mergeAssets;
|
5324 | });
|
5325 | |
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 | strats.watch = function (parentVal, childVal, vm, key) {
|
5332 |
|
5333 |
|
5334 | if (parentVal === nativeWatch)
|
5335 | parentVal = undefined;
|
5336 |
|
5337 | if (childVal === nativeWatch)
|
5338 | childVal = undefined;
|
5339 |
|
5340 | if (!childVal)
|
5341 | return Object.create(parentVal || null);
|
5342 | {
|
5343 | assertObjectType(key, childVal, vm);
|
5344 | }
|
5345 | if (!parentVal)
|
5346 | return childVal;
|
5347 | var ret = {};
|
5348 | extend(ret, parentVal);
|
5349 | for (var key_1 in childVal) {
|
5350 | var parent_1 = ret[key_1];
|
5351 | var child = childVal[key_1];
|
5352 | if (parent_1 && !isArray(parent_1)) {
|
5353 | parent_1 = [parent_1];
|
5354 | }
|
5355 | ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
|
5356 | }
|
5357 | return ret;
|
5358 | };
|
5359 | |
5360 |
|
5361 |
|
5362 | strats.props =
|
5363 | strats.methods =
|
5364 | strats.inject =
|
5365 | strats.computed =
|
5366 | function (parentVal, childVal, vm, key) {
|
5367 | if (childVal && true) {
|
5368 | assertObjectType(key, childVal, vm);
|
5369 | }
|
5370 | if (!parentVal)
|
5371 | return childVal;
|
5372 | var ret = Object.create(null);
|
5373 | extend(ret, parentVal);
|
5374 | if (childVal)
|
5375 | extend(ret, childVal);
|
5376 | return ret;
|
5377 | };
|
5378 | strats.provide = function (parentVal, childVal) {
|
5379 | if (!parentVal)
|
5380 | return childVal;
|
5381 | return function () {
|
5382 | var ret = Object.create(null);
|
5383 | mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
|
5384 | if (childVal) {
|
5385 | mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false
|
5386 | );
|
5387 | }
|
5388 | return ret;
|
5389 | };
|
5390 | };
|
5391 | |
5392 |
|
5393 |
|
5394 | var defaultStrat = function (parentVal, childVal) {
|
5395 | return childVal === undefined ? parentVal : childVal;
|
5396 | };
|
5397 | |
5398 |
|
5399 |
|
5400 | function checkComponents(options) {
|
5401 | for (var key in options.components) {
|
5402 | validateComponentName(key);
|
5403 | }
|
5404 | }
|
5405 | function validateComponentName(name) {
|
5406 | if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
|
5407 | warn$2('Invalid component name: "' +
|
5408 | name +
|
5409 | '". Component names ' +
|
5410 | 'should conform to valid custom element name in html5 specification.');
|
5411 | }
|
5412 | if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
5413 | warn$2('Do not use built-in or reserved HTML elements as component ' +
|
5414 | 'id: ' +
|
5415 | name);
|
5416 | }
|
5417 | }
|
5418 | |
5419 |
|
5420 |
|
5421 |
|
5422 | function normalizeProps(options, vm) {
|
5423 | var props = options.props;
|
5424 | if (!props)
|
5425 | return;
|
5426 | var res = {};
|
5427 | var i, val, name;
|
5428 | if (isArray(props)) {
|
5429 | i = props.length;
|
5430 | while (i--) {
|
5431 | val = props[i];
|
5432 | if (typeof val === 'string') {
|
5433 | name = camelize(val);
|
5434 | res[name] = { type: null };
|
5435 | }
|
5436 | else {
|
5437 | warn$2('props must be strings when using array syntax.');
|
5438 | }
|
5439 | }
|
5440 | }
|
5441 | else if (isPlainObject(props)) {
|
5442 | for (var key in props) {
|
5443 | val = props[key];
|
5444 | name = camelize(key);
|
5445 | res[name] = isPlainObject(val) ? val : { type: val };
|
5446 | }
|
5447 | }
|
5448 | else {
|
5449 | warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
|
5450 | "but got ".concat(toRawType(props), "."), vm);
|
5451 | }
|
5452 | options.props = res;
|
5453 | }
|
5454 | |
5455 |
|
5456 |
|
5457 | function normalizeInject(options, vm) {
|
5458 | var inject = options.inject;
|
5459 | if (!inject)
|
5460 | return;
|
5461 | var normalized = (options.inject = {});
|
5462 | if (isArray(inject)) {
|
5463 | for (var i = 0; i < inject.length; i++) {
|
5464 | normalized[inject[i]] = { from: inject[i] };
|
5465 | }
|
5466 | }
|
5467 | else if (isPlainObject(inject)) {
|
5468 | for (var key in inject) {
|
5469 | var val = inject[key];
|
5470 | normalized[key] = isPlainObject(val)
|
5471 | ? extend({ from: key }, val)
|
5472 | : { from: val };
|
5473 | }
|
5474 | }
|
5475 | else {
|
5476 | warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
|
5477 | "but got ".concat(toRawType(inject), "."), vm);
|
5478 | }
|
5479 | }
|
5480 | |
5481 |
|
5482 |
|
5483 | function normalizeDirectives$1(options) {
|
5484 | var dirs = options.directives;
|
5485 | if (dirs) {
|
5486 | for (var key in dirs) {
|
5487 | var def = dirs[key];
|
5488 | if (isFunction(def)) {
|
5489 | dirs[key] = { bind: def, update: def };
|
5490 | }
|
5491 | }
|
5492 | }
|
5493 | }
|
5494 | function assertObjectType(name, value, vm) {
|
5495 | if (!isPlainObject(value)) {
|
5496 | warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
|
5497 | "but got ".concat(toRawType(value), "."), vm);
|
5498 | }
|
5499 | }
|
5500 | |
5501 |
|
5502 |
|
5503 |
|
5504 | function mergeOptions(parent, child, vm) {
|
5505 | {
|
5506 | checkComponents(child);
|
5507 | }
|
5508 | if (isFunction(child)) {
|
5509 |
|
5510 | child = child.options;
|
5511 | }
|
5512 | normalizeProps(child, vm);
|
5513 | normalizeInject(child, vm);
|
5514 | normalizeDirectives$1(child);
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 | if (!child._base) {
|
5520 | if (child.extends) {
|
5521 | parent = mergeOptions(parent, child.extends, vm);
|
5522 | }
|
5523 | if (child.mixins) {
|
5524 | for (var i = 0, l = child.mixins.length; i < l; i++) {
|
5525 | parent = mergeOptions(parent, child.mixins[i], vm);
|
5526 | }
|
5527 | }
|
5528 | }
|
5529 | var options = {};
|
5530 | var key;
|
5531 | for (key in parent) {
|
5532 | mergeField(key);
|
5533 | }
|
5534 | for (key in child) {
|
5535 | if (!hasOwn(parent, key)) {
|
5536 | mergeField(key);
|
5537 | }
|
5538 | }
|
5539 | function mergeField(key) {
|
5540 | var strat = strats[key] || defaultStrat;
|
5541 | options[key] = strat(parent[key], child[key], vm, key);
|
5542 | }
|
5543 | return options;
|
5544 | }
|
5545 | |
5546 |
|
5547 |
|
5548 |
|
5549 |
|
5550 | function resolveAsset(options, type, id, warnMissing) {
|
5551 |
|
5552 | if (typeof id !== 'string') {
|
5553 | return;
|
5554 | }
|
5555 | var assets = options[type];
|
5556 |
|
5557 | if (hasOwn(assets, id))
|
5558 | return assets[id];
|
5559 | var camelizedId = camelize(id);
|
5560 | if (hasOwn(assets, camelizedId))
|
5561 | return assets[camelizedId];
|
5562 | var PascalCaseId = capitalize(camelizedId);
|
5563 | if (hasOwn(assets, PascalCaseId))
|
5564 | return assets[PascalCaseId];
|
5565 |
|
5566 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
5567 | if (warnMissing && !res) {
|
5568 | warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
|
5569 | }
|
5570 | return res;
|
5571 | }
|
5572 |
|
5573 | function validateProp(key, propOptions, propsData, vm) {
|
5574 | var prop = propOptions[key];
|
5575 | var absent = !hasOwn(propsData, key);
|
5576 | var value = propsData[key];
|
5577 |
|
5578 | var booleanIndex = getTypeIndex(Boolean, prop.type);
|
5579 | if (booleanIndex > -1) {
|
5580 | if (absent && !hasOwn(prop, 'default')) {
|
5581 | value = false;
|
5582 | }
|
5583 | else if (value === '' || value === hyphenate(key)) {
|
5584 |
|
5585 |
|
5586 | var stringIndex = getTypeIndex(String, prop.type);
|
5587 | if (stringIndex < 0 || booleanIndex < stringIndex) {
|
5588 | value = true;
|
5589 | }
|
5590 | }
|
5591 | }
|
5592 |
|
5593 | if (value === undefined) {
|
5594 | value = getPropDefaultValue(vm, prop, key);
|
5595 |
|
5596 |
|
5597 | var prevShouldObserve = shouldObserve;
|
5598 | toggleObserving(true);
|
5599 | observe(value);
|
5600 | toggleObserving(prevShouldObserve);
|
5601 | }
|
5602 | {
|
5603 | assertProp(prop, key, value, vm, absent);
|
5604 | }
|
5605 | return value;
|
5606 | }
|
5607 | |
5608 |
|
5609 |
|
5610 | function getPropDefaultValue(vm, prop, key) {
|
5611 |
|
5612 | if (!hasOwn(prop, 'default')) {
|
5613 | return undefined;
|
5614 | }
|
5615 | var def = prop.default;
|
5616 |
|
5617 | if (isObject(def)) {
|
5618 | warn$2('Invalid default value for prop "' +
|
5619 | key +
|
5620 | '": ' +
|
5621 | 'Props with type Object/Array must use a factory function ' +
|
5622 | 'to return the default value.', vm);
|
5623 | }
|
5624 |
|
5625 |
|
5626 | if (vm &&
|
5627 | vm.$options.propsData &&
|
5628 | vm.$options.propsData[key] === undefined &&
|
5629 | vm._props[key] !== undefined) {
|
5630 | return vm._props[key];
|
5631 | }
|
5632 |
|
5633 |
|
5634 | return isFunction(def) && getType(prop.type) !== 'Function'
|
5635 | ? def.call(vm)
|
5636 | : def;
|
5637 | }
|
5638 | |
5639 |
|
5640 |
|
5641 | function assertProp(prop, name, value, vm, absent) {
|
5642 | if (prop.required && absent) {
|
5643 | warn$2('Missing required prop: "' + name + '"', vm);
|
5644 | return;
|
5645 | }
|
5646 | if (value == null && !prop.required) {
|
5647 | return;
|
5648 | }
|
5649 | var type = prop.type;
|
5650 | var valid = !type || type === true;
|
5651 | var expectedTypes = [];
|
5652 | if (type) {
|
5653 | if (!isArray(type)) {
|
5654 | type = [type];
|
5655 | }
|
5656 | for (var i = 0; i < type.length && !valid; i++) {
|
5657 | var assertedType = assertType(value, type[i], vm);
|
5658 | expectedTypes.push(assertedType.expectedType || '');
|
5659 | valid = assertedType.valid;
|
5660 | }
|
5661 | }
|
5662 | var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
|
5663 | if (!valid && haveExpectedTypes) {
|
5664 | warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
|
5665 | return;
|
5666 | }
|
5667 | var validator = prop.validator;
|
5668 | if (validator) {
|
5669 | if (!validator(value)) {
|
5670 | warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
|
5671 | }
|
5672 | }
|
5673 | }
|
5674 | var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
|
5675 | function assertType(value, type, vm) {
|
5676 | var valid;
|
5677 | var expectedType = getType(type);
|
5678 | if (simpleCheckRE.test(expectedType)) {
|
5679 | var t = typeof value;
|
5680 | valid = t === expectedType.toLowerCase();
|
5681 |
|
5682 | if (!valid && t === 'object') {
|
5683 | valid = value instanceof type;
|
5684 | }
|
5685 | }
|
5686 | else if (expectedType === 'Object') {
|
5687 | valid = isPlainObject(value);
|
5688 | }
|
5689 | else if (expectedType === 'Array') {
|
5690 | valid = isArray(value);
|
5691 | }
|
5692 | else {
|
5693 | try {
|
5694 | valid = value instanceof type;
|
5695 | }
|
5696 | catch (e) {
|
5697 | warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
|
5698 | valid = false;
|
5699 | }
|
5700 | }
|
5701 | return {
|
5702 | valid: valid,
|
5703 | expectedType: expectedType
|
5704 | };
|
5705 | }
|
5706 | var functionTypeCheckRE = /^\s*function (\w+)/;
|
5707 | |
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 | function getType(fn) {
|
5713 | var match = fn && fn.toString().match(functionTypeCheckRE);
|
5714 | return match ? match[1] : '';
|
5715 | }
|
5716 | function isSameType(a, b) {
|
5717 | return getType(a) === getType(b);
|
5718 | }
|
5719 | function getTypeIndex(type, expectedTypes) {
|
5720 | if (!isArray(expectedTypes)) {
|
5721 | return isSameType(expectedTypes, type) ? 0 : -1;
|
5722 | }
|
5723 | for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
5724 | if (isSameType(expectedTypes[i], type)) {
|
5725 | return i;
|
5726 | }
|
5727 | }
|
5728 | return -1;
|
5729 | }
|
5730 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
5731 | var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
|
5732 | " Expected ".concat(expectedTypes.map(capitalize).join(', '));
|
5733 | var expectedType = expectedTypes[0];
|
5734 | var receivedType = toRawType(value);
|
5735 |
|
5736 | if (expectedTypes.length === 1 &&
|
5737 | isExplicable(expectedType) &&
|
5738 | isExplicable(typeof value) &&
|
5739 | !isBoolean(expectedType, receivedType)) {
|
5740 | message += " with value ".concat(styleValue(value, expectedType));
|
5741 | }
|
5742 | message += ", got ".concat(receivedType, " ");
|
5743 |
|
5744 | if (isExplicable(receivedType)) {
|
5745 | message += "with value ".concat(styleValue(value, receivedType), ".");
|
5746 | }
|
5747 | return message;
|
5748 | }
|
5749 | function styleValue(value, type) {
|
5750 | if (type === 'String') {
|
5751 | return "\"".concat(value, "\"");
|
5752 | }
|
5753 | else if (type === 'Number') {
|
5754 | return "".concat(Number(value));
|
5755 | }
|
5756 | else {
|
5757 | return "".concat(value);
|
5758 | }
|
5759 | }
|
5760 | var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
|
5761 | function isExplicable(value) {
|
5762 | return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
|
5763 | }
|
5764 | function isBoolean() {
|
5765 | var args = [];
|
5766 | for (var _i = 0; _i < arguments.length; _i++) {
|
5767 | args[_i] = arguments[_i];
|
5768 | }
|
5769 | return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
|
5770 | }
|
5771 |
|
5772 | function Vue(options) {
|
5773 | if (!(this instanceof Vue)) {
|
5774 | warn$2('Vue is a constructor and should be called with the `new` keyword');
|
5775 | }
|
5776 | this._init(options);
|
5777 | }
|
5778 |
|
5779 | initMixin$1(Vue);
|
5780 |
|
5781 | stateMixin(Vue);
|
5782 |
|
5783 | eventsMixin(Vue);
|
5784 |
|
5785 | lifecycleMixin(Vue);
|
5786 |
|
5787 | renderMixin(Vue);
|
5788 |
|
5789 | function initUse(Vue) {
|
5790 | Vue.use = function (plugin) {
|
5791 | var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
|
5792 | if (installedPlugins.indexOf(plugin) > -1) {
|
5793 | return this;
|
5794 | }
|
5795 |
|
5796 | var args = toArray(arguments, 1);
|
5797 | args.unshift(this);
|
5798 | if (isFunction(plugin.install)) {
|
5799 | plugin.install.apply(plugin, args);
|
5800 | }
|
5801 | else if (isFunction(plugin)) {
|
5802 | plugin.apply(null, args);
|
5803 | }
|
5804 | installedPlugins.push(plugin);
|
5805 | return this;
|
5806 | };
|
5807 | }
|
5808 |
|
5809 | function initMixin(Vue) {
|
5810 | Vue.mixin = function (mixin) {
|
5811 | this.options = mergeOptions(this.options, mixin);
|
5812 | return this;
|
5813 | };
|
5814 | }
|
5815 |
|
5816 | function initExtend(Vue) {
|
5817 | |
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 | Vue.cid = 0;
|
5823 | var cid = 1;
|
5824 | |
5825 |
|
5826 |
|
5827 | Vue.extend = function (extendOptions) {
|
5828 | extendOptions = extendOptions || {};
|
5829 | var Super = this;
|
5830 | var SuperId = Super.cid;
|
5831 | var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5832 | if (cachedCtors[SuperId]) {
|
5833 | return cachedCtors[SuperId];
|
5834 | }
|
5835 | var name = getComponentName(extendOptions) || getComponentName(Super.options);
|
5836 | if (name) {
|
5837 | validateComponentName(name);
|
5838 | }
|
5839 | var Sub = function VueComponent(options) {
|
5840 | this._init(options);
|
5841 | };
|
5842 | Sub.prototype = Object.create(Super.prototype);
|
5843 | Sub.prototype.constructor = Sub;
|
5844 | Sub.cid = cid++;
|
5845 | Sub.options = mergeOptions(Super.options, extendOptions);
|
5846 | Sub['super'] = Super;
|
5847 |
|
5848 |
|
5849 |
|
5850 | if (Sub.options.props) {
|
5851 | initProps(Sub);
|
5852 | }
|
5853 | if (Sub.options.computed) {
|
5854 | initComputed(Sub);
|
5855 | }
|
5856 |
|
5857 | Sub.extend = Super.extend;
|
5858 | Sub.mixin = Super.mixin;
|
5859 | Sub.use = Super.use;
|
5860 |
|
5861 |
|
5862 | ASSET_TYPES.forEach(function (type) {
|
5863 | Sub[type] = Super[type];
|
5864 | });
|
5865 |
|
5866 | if (name) {
|
5867 | Sub.options.components[name] = Sub;
|
5868 | }
|
5869 |
|
5870 |
|
5871 |
|
5872 | Sub.superOptions = Super.options;
|
5873 | Sub.extendOptions = extendOptions;
|
5874 | Sub.sealedOptions = extend({}, Sub.options);
|
5875 |
|
5876 | cachedCtors[SuperId] = Sub;
|
5877 | return Sub;
|
5878 | };
|
5879 | }
|
5880 | function initProps(Comp) {
|
5881 | var props = Comp.options.props;
|
5882 | for (var key in props) {
|
5883 | proxy(Comp.prototype, "_props", key);
|
5884 | }
|
5885 | }
|
5886 | function initComputed(Comp) {
|
5887 | var computed = Comp.options.computed;
|
5888 | for (var key in computed) {
|
5889 | defineComputed(Comp.prototype, key, computed[key]);
|
5890 | }
|
5891 | }
|
5892 |
|
5893 | function initAssetRegisters(Vue) {
|
5894 | |
5895 |
|
5896 |
|
5897 | ASSET_TYPES.forEach(function (type) {
|
5898 |
|
5899 | Vue[type] = function (id, definition) {
|
5900 | if (!definition) {
|
5901 | return this.options[type + 's'][id];
|
5902 | }
|
5903 | else {
|
5904 |
|
5905 | if (type === 'component') {
|
5906 | validateComponentName(id);
|
5907 | }
|
5908 | if (type === 'component' && isPlainObject(definition)) {
|
5909 |
|
5910 | definition.name = definition.name || id;
|
5911 | definition = this.options._base.extend(definition);
|
5912 | }
|
5913 | if (type === 'directive' && isFunction(definition)) {
|
5914 | definition = { bind: definition, update: definition };
|
5915 | }
|
5916 | this.options[type + 's'][id] = definition;
|
5917 | return definition;
|
5918 | }
|
5919 | };
|
5920 | });
|
5921 | }
|
5922 |
|
5923 | function _getComponentName(opts) {
|
5924 | return opts && (getComponentName(opts.Ctor.options) || opts.tag);
|
5925 | }
|
5926 | function matches(pattern, name) {
|
5927 | if (isArray(pattern)) {
|
5928 | return pattern.indexOf(name) > -1;
|
5929 | }
|
5930 | else if (typeof pattern === 'string') {
|
5931 | return pattern.split(',').indexOf(name) > -1;
|
5932 | }
|
5933 | else if (isRegExp(pattern)) {
|
5934 | return pattern.test(name);
|
5935 | }
|
5936 |
|
5937 | return false;
|
5938 | }
|
5939 | function pruneCache(keepAliveInstance, filter) {
|
5940 | var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode;
|
5941 | for (var key in cache) {
|
5942 | var entry = cache[key];
|
5943 | if (entry) {
|
5944 | var name_1 = entry.name;
|
5945 | if (name_1 && !filter(name_1)) {
|
5946 | pruneCacheEntry(cache, key, keys, _vnode);
|
5947 | }
|
5948 | }
|
5949 | }
|
5950 | }
|
5951 | function pruneCacheEntry(cache, key, keys, current) {
|
5952 | var entry = cache[key];
|
5953 | if (entry && (!current || entry.tag !== current.tag)) {
|
5954 |
|
5955 | entry.componentInstance.$destroy();
|
5956 | }
|
5957 | cache[key] = null;
|
5958 | remove$2(keys, key);
|
5959 | }
|
5960 | var patternTypes = [String, RegExp, Array];
|
5961 |
|
5962 | var KeepAlive = {
|
5963 | name: 'keep-alive',
|
5964 | abstract: true,
|
5965 | props: {
|
5966 | include: patternTypes,
|
5967 | exclude: patternTypes,
|
5968 | max: [String, Number]
|
5969 | },
|
5970 | methods: {
|
5971 | cacheVNode: function () {
|
5972 | var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
|
5973 | if (vnodeToCache) {
|
5974 | var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
|
5975 | cache[keyToCache] = {
|
5976 | name: _getComponentName(componentOptions),
|
5977 | tag: tag,
|
5978 | componentInstance: componentInstance
|
5979 | };
|
5980 | keys.push(keyToCache);
|
5981 |
|
5982 | if (this.max && keys.length > parseInt(this.max)) {
|
5983 | pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5984 | }
|
5985 | this.vnodeToCache = null;
|
5986 | }
|
5987 | }
|
5988 | },
|
5989 | created: function () {
|
5990 | this.cache = Object.create(null);
|
5991 | this.keys = [];
|
5992 | },
|
5993 | destroyed: function () {
|
5994 | for (var key in this.cache) {
|
5995 | pruneCacheEntry(this.cache, key, this.keys);
|
5996 | }
|
5997 | },
|
5998 | mounted: function () {
|
5999 | var _this = this;
|
6000 | this.cacheVNode();
|
6001 | this.$watch('include', function (val) {
|
6002 | pruneCache(_this, function (name) { return matches(val, name); });
|
6003 | });
|
6004 | this.$watch('exclude', function (val) {
|
6005 | pruneCache(_this, function (name) { return !matches(val, name); });
|
6006 | });
|
6007 | },
|
6008 | updated: function () {
|
6009 | this.cacheVNode();
|
6010 | },
|
6011 | render: function () {
|
6012 | var slot = this.$slots.default;
|
6013 | var vnode = getFirstComponentChild(slot);
|
6014 | var componentOptions = vnode && vnode.componentOptions;
|
6015 | if (componentOptions) {
|
6016 |
|
6017 | var name_2 = _getComponentName(componentOptions);
|
6018 | var _a = this, include = _a.include, exclude = _a.exclude;
|
6019 | if (
|
6020 |
|
6021 | (include && (!name_2 || !matches(include, name_2))) ||
|
6022 |
|
6023 | (exclude && name_2 && matches(exclude, name_2))) {
|
6024 | return vnode;
|
6025 | }
|
6026 | var _b = this, cache = _b.cache, keys = _b.keys;
|
6027 | var key = vnode.key == null
|
6028 | ?
|
6029 |
|
6030 | componentOptions.Ctor.cid +
|
6031 | (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
|
6032 | : vnode.key;
|
6033 | if (cache[key]) {
|
6034 | vnode.componentInstance = cache[key].componentInstance;
|
6035 |
|
6036 | remove$2(keys, key);
|
6037 | keys.push(key);
|
6038 | }
|
6039 | else {
|
6040 |
|
6041 | this.vnodeToCache = vnode;
|
6042 | this.keyToCache = key;
|
6043 | }
|
6044 |
|
6045 | vnode.data.keepAlive = true;
|
6046 | }
|
6047 | return vnode || (slot && slot[0]);
|
6048 | }
|
6049 | };
|
6050 |
|
6051 | var builtInComponents = {
|
6052 | KeepAlive: KeepAlive
|
6053 | };
|
6054 |
|
6055 | function initGlobalAPI(Vue) {
|
6056 |
|
6057 | var configDef = {};
|
6058 | configDef.get = function () { return config; };
|
6059 | {
|
6060 | configDef.set = function () {
|
6061 | warn$2('Do not replace the Vue.config object, set individual fields instead.');
|
6062 | };
|
6063 | }
|
6064 | Object.defineProperty(Vue, 'config', configDef);
|
6065 |
|
6066 |
|
6067 |
|
6068 | Vue.util = {
|
6069 | warn: warn$2,
|
6070 | extend: extend,
|
6071 | mergeOptions: mergeOptions,
|
6072 | defineReactive: defineReactive
|
6073 | };
|
6074 | Vue.set = set;
|
6075 | Vue.delete = del;
|
6076 | Vue.nextTick = nextTick;
|
6077 | // 2.6 explicit observable API
|
6078 | Vue.observable = function (obj) {
|
6079 | observe(obj);
|
6080 | return obj;
|
6081 | };
|
6082 | Vue.options = Object.create(null);
|
6083 | ASSET_TYPES.forEach(function (type) {
|
6084 | Vue.options[type + 's'] = Object.create(null);
|
6085 | });
|
6086 |
|
6087 |
|
6088 | Vue.options._base = Vue;
|
6089 | extend(Vue.options.components, builtInComponents);
|
6090 | initUse(Vue);
|
6091 | initMixin(Vue);
|
6092 | initExtend(Vue);
|
6093 | initAssetRegisters(Vue);
|
6094 | }
|
6095 |
|
6096 | initGlobalAPI(Vue);
|
6097 | Object.defineProperty(Vue.prototype, '$isServer', {
|
6098 | get: isServerRendering
|
6099 | });
|
6100 | Object.defineProperty(Vue.prototype, '$ssrContext', {
|
6101 | get: function () {
|
6102 |
|
6103 | return this.$vnode && this.$vnode.ssrContext;
|
6104 | }
|
6105 | });
|
6106 |
|
6107 | Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
6108 | value: FunctionalRenderContext
|
6109 | });
|
6110 | Vue.version = version;
|
6111 |
|
6112 |
|
6113 |
|
6114 | var isReservedAttr = makeMap('style,class');
|
6115 |
|
6116 | var acceptValue = makeMap('input,textarea,option,select,progress');
|
6117 | var mustUseProp = function (tag, type, attr) {
|
6118 | return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
|
6119 | (attr === 'selected' && tag === 'option') ||
|
6120 | (attr === 'checked' && tag === 'input') ||
|
6121 | (attr === 'muted' && tag === 'video'));
|
6122 | };
|
6123 | var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
6124 | var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
6125 | var convertEnumeratedValue = function (key, value) {
|
6126 | return isFalsyAttrValue(value) || value === 'false'
|
6127 | ? 'false'
|
6128 | :
|
6129 | key === 'contenteditable' && isValidContentEditableValue(value)
|
6130 | ? value
|
6131 | : 'true';
|
6132 | };
|
6133 | var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
6134 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
6135 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
6136 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
6137 | 'required,reversed,scoped,seamless,selected,sortable,' +
|
6138 | 'truespeed,typemustmatch,visible');
|
6139 | var xlinkNS = 'http://www.w3.org/1999/xlink';
|
6140 | var isXlink = function (name) {
|
6141 | return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
|
6142 | };
|
6143 | var getXlinkProp = function (name) {
|
6144 | return isXlink(name) ? name.slice(6, name.length) : '';
|
6145 | };
|
6146 | var isFalsyAttrValue = function (val) {
|
6147 | return val == null || val === false;
|
6148 | };
|
6149 |
|
6150 | function genClassForVnode(vnode) {
|
6151 | var data = vnode.data;
|
6152 | var parentNode = vnode;
|
6153 | var childNode = vnode;
|
6154 | while (isDef(childNode.componentInstance)) {
|
6155 | childNode = childNode.componentInstance._vnode;
|
6156 | if (childNode && childNode.data) {
|
6157 | data = mergeClassData(childNode.data, data);
|
6158 | }
|
6159 | }
|
6160 |
|
6161 | while (isDef((parentNode = parentNode.parent))) {
|
6162 | if (parentNode && parentNode.data) {
|
6163 | data = mergeClassData(data, parentNode.data);
|
6164 | }
|
6165 | }
|
6166 | return renderClass(data.staticClass, data.class);
|
6167 | }
|
6168 | function mergeClassData(child, parent) {
|
6169 | return {
|
6170 | staticClass: concat(child.staticClass, parent.staticClass),
|
6171 | class: isDef(child.class) ? [child.class, parent.class] : parent.class
|
6172 | };
|
6173 | }
|
6174 | function renderClass(staticClass, dynamicClass) {
|
6175 | if (isDef(staticClass) || isDef(dynamicClass)) {
|
6176 | return concat(staticClass, stringifyClass(dynamicClass));
|
6177 | }
|
6178 |
|
6179 | return '';
|
6180 | }
|
6181 | function concat(a, b) {
|
6182 | return a ? (b ? a + ' ' + b : a) : b || '';
|
6183 | }
|
6184 | function stringifyClass(value) {
|
6185 | if (Array.isArray(value)) {
|
6186 | return stringifyArray(value);
|
6187 | }
|
6188 | if (isObject(value)) {
|
6189 | return stringifyObject(value);
|
6190 | }
|
6191 | if (typeof value === 'string') {
|
6192 | return value;
|
6193 | }
|
6194 |
|
6195 | return '';
|
6196 | }
|
6197 | function stringifyArray(value) {
|
6198 | var res = '';
|
6199 | var stringified;
|
6200 | for (var i = 0, l = value.length; i < l; i++) {
|
6201 | if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
|
6202 | if (res)
|
6203 | res += ' ';
|
6204 | res += stringified;
|
6205 | }
|
6206 | }
|
6207 | return res;
|
6208 | }
|
6209 | function stringifyObject(value) {
|
6210 | var res = '';
|
6211 | for (var key in value) {
|
6212 | if (value[key]) {
|
6213 | if (res)
|
6214 | res += ' ';
|
6215 | res += key;
|
6216 | }
|
6217 | }
|
6218 | return res;
|
6219 | }
|
6220 |
|
6221 | var namespaceMap = {
|
6222 | svg: 'http://www.w3.org/2000/svg',
|
6223 | math: 'http://www.w3.org/1998/Math/MathML'
|
6224 | };
|
6225 | var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
|
6226 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
6227 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
6228 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
6229 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
6230 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
6231 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
6232 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
6233 | 'output,progress,select,textarea,' +
|
6234 | 'details,dialog,menu,menuitem,summary,' +
|
6235 | 'content,element,shadow,template,blockquote,iframe,tfoot');
|
6236 |
|
6237 |
|
6238 | var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
6239 | 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
6240 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
|
6241 | var isPreTag = function (tag) { return tag === 'pre'; };
|
6242 | var isReservedTag = function (tag) {
|
6243 | return isHTMLTag(tag) || isSVG(tag);
|
6244 | };
|
6245 | function getTagNamespace(tag) {
|
6246 | if (isSVG(tag)) {
|
6247 | return 'svg';
|
6248 | }
|
6249 |
|
6250 |
|
6251 | if (tag === 'math') {
|
6252 | return 'math';
|
6253 | }
|
6254 | }
|
6255 | var unknownElementCache = Object.create(null);
|
6256 | function isUnknownElement(tag) {
|
6257 |
|
6258 | if (!inBrowser) {
|
6259 | return true;
|
6260 | }
|
6261 | if (isReservedTag(tag)) {
|
6262 | return false;
|
6263 | }
|
6264 | tag = tag.toLowerCase();
|
6265 |
|
6266 | if (unknownElementCache[tag] != null) {
|
6267 | return unknownElementCache[tag];
|
6268 | }
|
6269 | var el = document.createElement(tag);
|
6270 | if (tag.indexOf('-') > -1) {
|
6271 |
|
6272 | return (unknownElementCache[tag] =
|
6273 | el.constructor === window.HTMLUnknownElement ||
|
6274 | el.constructor === window.HTMLElement);
|
6275 | }
|
6276 | else {
|
6277 | return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
|
6278 | }
|
6279 | }
|
6280 | var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
6281 |
|
6282 | |
6283 |
|
6284 |
|
6285 | function query(el) {
|
6286 | if (typeof el === 'string') {
|
6287 | var selected = document.querySelector(el);
|
6288 | if (!selected) {
|
6289 | warn$2('Cannot find element: ' + el);
|
6290 | return document.createElement('div');
|
6291 | }
|
6292 | return selected;
|
6293 | }
|
6294 | else {
|
6295 | return el;
|
6296 | }
|
6297 | }
|
6298 |
|
6299 | function createElement(tagName, vnode) {
|
6300 | var elm = document.createElement(tagName);
|
6301 | if (tagName !== 'select') {
|
6302 | return elm;
|
6303 | }
|
6304 |
|
6305 | if (vnode.data &&
|
6306 | vnode.data.attrs &&
|
6307 | vnode.data.attrs.multiple !== undefined) {
|
6308 | elm.setAttribute('multiple', 'multiple');
|
6309 | }
|
6310 | return elm;
|
6311 | }
|
6312 | function createElementNS(namespace, tagName) {
|
6313 | return document.createElementNS(namespaceMap[namespace], tagName);
|
6314 | }
|
6315 | function createTextNode(text) {
|
6316 | return document.createTextNode(text);
|
6317 | }
|
6318 | function createComment(text) {
|
6319 | return document.createComment(text);
|
6320 | }
|
6321 | function insertBefore(parentNode, newNode, referenceNode) {
|
6322 | parentNode.insertBefore(newNode, referenceNode);
|
6323 | }
|
6324 | function removeChild(node, child) {
|
6325 | node.removeChild(child);
|
6326 | }
|
6327 | function appendChild(node, child) {
|
6328 | node.appendChild(child);
|
6329 | }
|
6330 | function parentNode(node) {
|
6331 | return node.parentNode;
|
6332 | }
|
6333 | function nextSibling(node) {
|
6334 | return node.nextSibling;
|
6335 | }
|
6336 | function tagName(node) {
|
6337 | return node.tagName;
|
6338 | }
|
6339 | function setTextContent(node, text) {
|
6340 | node.textContent = text;
|
6341 | }
|
6342 | function setStyleScope(node, scopeId) {
|
6343 | node.setAttribute(scopeId, '');
|
6344 | }
|
6345 |
|
6346 | var nodeOps = Object.freeze({
|
6347 | __proto__: null,
|
6348 | createElement: createElement,
|
6349 | createElementNS: createElementNS,
|
6350 | createTextNode: createTextNode,
|
6351 | createComment: createComment,
|
6352 | insertBefore: insertBefore,
|
6353 | removeChild: removeChild,
|
6354 | appendChild: appendChild,
|
6355 | parentNode: parentNode,
|
6356 | nextSibling: nextSibling,
|
6357 | tagName: tagName,
|
6358 | setTextContent: setTextContent,
|
6359 | setStyleScope: setStyleScope
|
6360 | });
|
6361 |
|
6362 | var ref = {
|
6363 | create: function (_, vnode) {
|
6364 | registerRef(vnode);
|
6365 | },
|
6366 | update: function (oldVnode, vnode) {
|
6367 | if (oldVnode.data.ref !== vnode.data.ref) {
|
6368 | registerRef(oldVnode, true);
|
6369 | registerRef(vnode);
|
6370 | }
|
6371 | },
|
6372 | destroy: function (vnode) {
|
6373 | registerRef(vnode, true);
|
6374 | }
|
6375 | };
|
6376 | function registerRef(vnode, isRemoval) {
|
6377 | var ref = vnode.data.ref;
|
6378 | if (!isDef(ref))
|
6379 | return;
|
6380 | var vm = vnode.context;
|
6381 | var refValue = vnode.componentInstance || vnode.elm;
|
6382 | var value = isRemoval ? null : refValue;
|
6383 | var $refsValue = isRemoval ? undefined : refValue;
|
6384 | if (isFunction(ref)) {
|
6385 | invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
|
6386 | return;
|
6387 | }
|
6388 | var isFor = vnode.data.refInFor;
|
6389 | var _isString = typeof ref === 'string' || typeof ref === 'number';
|
6390 | var _isRef = isRef(ref);
|
6391 | var refs = vm.$refs;
|
6392 | if (_isString || _isRef) {
|
6393 | if (isFor) {
|
6394 | var existing = _isString ? refs[ref] : ref.value;
|
6395 | if (isRemoval) {
|
6396 | isArray(existing) && remove$2(existing, refValue);
|
6397 | }
|
6398 | else {
|
6399 | if (!isArray(existing)) {
|
6400 | if (_isString) {
|
6401 | refs[ref] = [refValue];
|
6402 | setSetupRef(vm, ref, refs[ref]);
|
6403 | }
|
6404 | else {
|
6405 | ref.value = [refValue];
|
6406 | }
|
6407 | }
|
6408 | else if (!existing.includes(refValue)) {
|
6409 | existing.push(refValue);
|
6410 | }
|
6411 | }
|
6412 | }
|
6413 | else if (_isString) {
|
6414 | if (isRemoval && refs[ref] !== refValue) {
|
6415 | return;
|
6416 | }
|
6417 | refs[ref] = $refsValue;
|
6418 | setSetupRef(vm, ref, value);
|
6419 | }
|
6420 | else if (_isRef) {
|
6421 | if (isRemoval && ref.value !== refValue) {
|
6422 | return;
|
6423 | }
|
6424 | ref.value = value;
|
6425 | }
|
6426 | else {
|
6427 | warn$2("Invalid template ref type: ".concat(typeof ref));
|
6428 | }
|
6429 | }
|
6430 | }
|
6431 | function setSetupRef(_a, key, val) {
|
6432 | var _setupState = _a._setupState;
|
6433 | if (_setupState && hasOwn(_setupState, key)) {
|
6434 | if (isRef(_setupState[key])) {
|
6435 | _setupState[key].value = val;
|
6436 | }
|
6437 | else {
|
6438 | _setupState[key] = val;
|
6439 | }
|
6440 | }
|
6441 | }
|
6442 |
|
6443 | |
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 |
|
6449 |
|
6450 |
|
6451 |
|
6452 |
|
6453 |
|
6454 | var emptyNode = new VNode('', {}, []);
|
6455 | var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
6456 | function sameVnode(a, b) {
|
6457 | return (a.key === b.key &&
|
6458 | a.asyncFactory === b.asyncFactory &&
|
6459 | ((a.tag === b.tag &&
|
6460 | a.isComment === b.isComment &&
|
6461 | isDef(a.data) === isDef(b.data) &&
|
6462 | sameInputType(a, b)) ||
|
6463 | (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
|
6464 | }
|
6465 | function sameInputType(a, b) {
|
6466 | if (a.tag !== 'input')
|
6467 | return true;
|
6468 | var i;
|
6469 | var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
|
6470 | var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
|
6471 | return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
|
6472 | }
|
6473 | function createKeyToOldIdx(children, beginIdx, endIdx) {
|
6474 | var i, key;
|
6475 | var map = {};
|
6476 | for (i = beginIdx; i <= endIdx; ++i) {
|
6477 | key = children[i].key;
|
6478 | if (isDef(key))
|
6479 | map[key] = i;
|
6480 | }
|
6481 | return map;
|
6482 | }
|
6483 | function createPatchFunction(backend) {
|
6484 | var i, j;
|
6485 | var cbs = {};
|
6486 | var modules = backend.modules, nodeOps = backend.nodeOps;
|
6487 | for (i = 0; i < hooks.length; ++i) {
|
6488 | cbs[hooks[i]] = [];
|
6489 | for (j = 0; j < modules.length; ++j) {
|
6490 | if (isDef(modules[j][hooks[i]])) {
|
6491 | cbs[hooks[i]].push(modules[j][hooks[i]]);
|
6492 | }
|
6493 | }
|
6494 | }
|
6495 | function emptyNodeAt(elm) {
|
6496 | return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
|
6497 | }
|
6498 | function createRmCb(childElm, listeners) {
|
6499 | function remove() {
|
6500 | if (--remove.listeners === 0) {
|
6501 | removeNode(childElm);
|
6502 | }
|
6503 | }
|
6504 | remove.listeners = listeners;
|
6505 | return remove;
|
6506 | }
|
6507 | function removeNode(el) {
|
6508 | var parent = nodeOps.parentNode(el);
|
6509 |
|
6510 | if (isDef(parent)) {
|
6511 | nodeOps.removeChild(parent, el);
|
6512 | }
|
6513 | }
|
6514 | function isUnknownElement(vnode, inVPre) {
|
6515 | return (!inVPre &&
|
6516 | !vnode.ns &&
|
6517 | !(config.ignoredElements.length &&
|
6518 | config.ignoredElements.some(function (ignore) {
|
6519 | return isRegExp(ignore)
|
6520 | ? ignore.test(vnode.tag)
|
6521 | : ignore === vnode.tag;
|
6522 | })) &&
|
6523 | config.isUnknownElement(vnode.tag));
|
6524 | }
|
6525 | var creatingElmInVPre = 0;
|
6526 | function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
|
6527 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 |
|
6533 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6534 | }
|
6535 | vnode.isRootInsert = !nested;
|
6536 | if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
6537 | return;
|
6538 | }
|
6539 | var data = vnode.data;
|
6540 | var children = vnode.children;
|
6541 | var tag = vnode.tag;
|
6542 | if (isDef(tag)) {
|
6543 | {
|
6544 | if (data && data.pre) {
|
6545 | creatingElmInVPre++;
|
6546 | }
|
6547 | if (isUnknownElement(vnode, creatingElmInVPre)) {
|
6548 | warn$2('Unknown custom element: <' +
|
6549 | tag +
|
6550 | '> - did you ' +
|
6551 | 'register the component correctly? For recursive components, ' +
|
6552 | 'make sure to provide the "name" option.', vnode.context);
|
6553 | }
|
6554 | }
|
6555 | vnode.elm = vnode.ns
|
6556 | ? nodeOps.createElementNS(vnode.ns, tag)
|
6557 | : nodeOps.createElement(tag, vnode);
|
6558 | setScope(vnode);
|
6559 | createChildren(vnode, children, insertedVnodeQueue);
|
6560 | if (isDef(data)) {
|
6561 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6562 | }
|
6563 | insert(parentElm, vnode.elm, refElm);
|
6564 | if (data && data.pre) {
|
6565 | creatingElmInVPre--;
|
6566 | }
|
6567 | }
|
6568 | else if (isTrue(vnode.isComment)) {
|
6569 | vnode.elm = nodeOps.createComment(vnode.text);
|
6570 | insert(parentElm, vnode.elm, refElm);
|
6571 | }
|
6572 | else {
|
6573 | vnode.elm = nodeOps.createTextNode(vnode.text);
|
6574 | insert(parentElm, vnode.elm, refElm);
|
6575 | }
|
6576 | }
|
6577 | function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
|
6578 | var i = vnode.data;
|
6579 | if (isDef(i)) {
|
6580 | var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
6581 | if (isDef((i = i.hook)) && isDef((i = i.init))) {
|
6582 | i(vnode, false );
|
6583 | }
|
6584 |
|
6585 |
|
6586 |
|
6587 |
|
6588 | if (isDef(vnode.componentInstance)) {
|
6589 | initComponent(vnode, insertedVnodeQueue);
|
6590 | insert(parentElm, vnode.elm, refElm);
|
6591 | if (isTrue(isReactivated)) {
|
6592 | reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
6593 | }
|
6594 | return true;
|
6595 | }
|
6596 | }
|
6597 | }
|
6598 | function initComponent(vnode, insertedVnodeQueue) {
|
6599 | if (isDef(vnode.data.pendingInsert)) {
|
6600 | insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
6601 | vnode.data.pendingInsert = null;
|
6602 | }
|
6603 | vnode.elm = vnode.componentInstance.$el;
|
6604 | if (isPatchable(vnode)) {
|
6605 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6606 | setScope(vnode);
|
6607 | }
|
6608 | else {
|
6609 |
|
6610 |
|
6611 | registerRef(vnode);
|
6612 |
|
6613 | insertedVnodeQueue.push(vnode);
|
6614 | }
|
6615 | }
|
6616 | function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
|
6617 | var i;
|
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 | var innerNode = vnode;
|
6623 | while (innerNode.componentInstance) {
|
6624 | innerNode = innerNode.componentInstance._vnode;
|
6625 | if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
|
6626 | for (i = 0; i < cbs.activate.length; ++i) {
|
6627 | cbs.activate[i](emptyNode, innerNode);
|
6628 | }
|
6629 | insertedVnodeQueue.push(innerNode);
|
6630 | break;
|
6631 | }
|
6632 | }
|
6633 |
|
6634 |
|
6635 | insert(parentElm, vnode.elm, refElm);
|
6636 | }
|
6637 | function insert(parent, elm, ref) {
|
6638 | if (isDef(parent)) {
|
6639 | if (isDef(ref)) {
|
6640 | if (nodeOps.parentNode(ref) === parent) {
|
6641 | nodeOps.insertBefore(parent, elm, ref);
|
6642 | }
|
6643 | }
|
6644 | else {
|
6645 | nodeOps.appendChild(parent, elm);
|
6646 | }
|
6647 | }
|
6648 | }
|
6649 | function createChildren(vnode, children, insertedVnodeQueue) {
|
6650 | if (isArray(children)) {
|
6651 | {
|
6652 | checkDuplicateKeys(children);
|
6653 | }
|
6654 | for (var i_1 = 0; i_1 < children.length; ++i_1) {
|
6655 | createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
|
6656 | }
|
6657 | }
|
6658 | else if (isPrimitive(vnode.text)) {
|
6659 | nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6660 | }
|
6661 | }
|
6662 | function isPatchable(vnode) {
|
6663 | while (vnode.componentInstance) {
|
6664 | vnode = vnode.componentInstance._vnode;
|
6665 | }
|
6666 | return isDef(vnode.tag);
|
6667 | }
|
6668 | function invokeCreateHooks(vnode, insertedVnodeQueue) {
|
6669 | for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
|
6670 | cbs.create[i_2](emptyNode, vnode);
|
6671 | }
|
6672 | i = vnode.data.hook;
|
6673 | if (isDef(i)) {
|
6674 | if (isDef(i.create))
|
6675 | i.create(emptyNode, vnode);
|
6676 | if (isDef(i.insert))
|
6677 | insertedVnodeQueue.push(vnode);
|
6678 | }
|
6679 | }
|
6680 |
|
6681 |
|
6682 |
|
6683 | function setScope(vnode) {
|
6684 | var i;
|
6685 | if (isDef((i = vnode.fnScopeId))) {
|
6686 | nodeOps.setStyleScope(vnode.elm, i);
|
6687 | }
|
6688 | else {
|
6689 | var ancestor = vnode;
|
6690 | while (ancestor) {
|
6691 | if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
|
6692 | nodeOps.setStyleScope(vnode.elm, i);
|
6693 | }
|
6694 | ancestor = ancestor.parent;
|
6695 | }
|
6696 | }
|
6697 |
|
6698 | if (isDef((i = activeInstance)) &&
|
6699 | i !== vnode.context &&
|
6700 | i !== vnode.fnContext &&
|
6701 | isDef((i = i.$options._scopeId))) {
|
6702 | nodeOps.setStyleScope(vnode.elm, i);
|
6703 | }
|
6704 | }
|
6705 | function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6706 | for (; startIdx <= endIdx; ++startIdx) {
|
6707 | createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6708 | }
|
6709 | }
|
6710 | function invokeDestroyHook(vnode) {
|
6711 | var i, j;
|
6712 | var data = vnode.data;
|
6713 | if (isDef(data)) {
|
6714 | if (isDef((i = data.hook)) && isDef((i = i.destroy)))
|
6715 | i(vnode);
|
6716 | for (i = 0; i < cbs.destroy.length; ++i)
|
6717 | cbs.destroy[i](vnode);
|
6718 | }
|
6719 | if (isDef((i = vnode.children))) {
|
6720 | for (j = 0; j < vnode.children.length; ++j) {
|
6721 | invokeDestroyHook(vnode.children[j]);
|
6722 | }
|
6723 | }
|
6724 | }
|
6725 | function removeVnodes(vnodes, startIdx, endIdx) {
|
6726 | for (; startIdx <= endIdx; ++startIdx) {
|
6727 | var ch = vnodes[startIdx];
|
6728 | if (isDef(ch)) {
|
6729 | if (isDef(ch.tag)) {
|
6730 | removeAndInvokeRemoveHook(ch);
|
6731 | invokeDestroyHook(ch);
|
6732 | }
|
6733 | else {
|
6734 |
|
6735 | removeNode(ch.elm);
|
6736 | }
|
6737 | }
|
6738 | }
|
6739 | }
|
6740 | function removeAndInvokeRemoveHook(vnode, rm) {
|
6741 | if (isDef(rm) || isDef(vnode.data)) {
|
6742 | var i_3;
|
6743 | var listeners = cbs.remove.length + 1;
|
6744 | if (isDef(rm)) {
|
6745 |
|
6746 |
|
6747 | rm.listeners += listeners;
|
6748 | }
|
6749 | else {
|
6750 |
|
6751 | rm = createRmCb(vnode.elm, listeners);
|
6752 | }
|
6753 |
|
6754 | if (isDef((i_3 = vnode.componentInstance)) &&
|
6755 | isDef((i_3 = i_3._vnode)) &&
|
6756 | isDef(i_3.data)) {
|
6757 | removeAndInvokeRemoveHook(i_3, rm);
|
6758 | }
|
6759 | for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
|
6760 | cbs.remove[i_3](vnode, rm);
|
6761 | }
|
6762 | if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
|
6763 | i_3(vnode, rm);
|
6764 | }
|
6765 | else {
|
6766 | rm();
|
6767 | }
|
6768 | }
|
6769 | else {
|
6770 | removeNode(vnode.elm);
|
6771 | }
|
6772 | }
|
6773 | function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6774 | var oldStartIdx = 0;
|
6775 | var newStartIdx = 0;
|
6776 | var oldEndIdx = oldCh.length - 1;
|
6777 | var oldStartVnode = oldCh[0];
|
6778 | var oldEndVnode = oldCh[oldEndIdx];
|
6779 | var newEndIdx = newCh.length - 1;
|
6780 | var newStartVnode = newCh[0];
|
6781 | var newEndVnode = newCh[newEndIdx];
|
6782 | var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6783 |
|
6784 |
|
6785 |
|
6786 | var canMove = !removeOnly;
|
6787 | {
|
6788 | checkDuplicateKeys(newCh);
|
6789 | }
|
6790 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6791 | if (isUndef(oldStartVnode)) {
|
6792 | oldStartVnode = oldCh[++oldStartIdx];
|
6793 | }
|
6794 | else if (isUndef(oldEndVnode)) {
|
6795 | oldEndVnode = oldCh[--oldEndIdx];
|
6796 | }
|
6797 | else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6798 | patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6799 | oldStartVnode = oldCh[++oldStartIdx];
|
6800 | newStartVnode = newCh[++newStartIdx];
|
6801 | }
|
6802 | else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6803 | patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6804 | oldEndVnode = oldCh[--oldEndIdx];
|
6805 | newEndVnode = newCh[--newEndIdx];
|
6806 | }
|
6807 | else if (sameVnode(oldStartVnode, newEndVnode)) {
|
6808 |
|
6809 | patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6810 | canMove &&
|
6811 | nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6812 | oldStartVnode = oldCh[++oldStartIdx];
|
6813 | newEndVnode = newCh[--newEndIdx];
|
6814 | }
|
6815 | else if (sameVnode(oldEndVnode, newStartVnode)) {
|
6816 |
|
6817 | patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6818 | canMove &&
|
6819 | nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6820 | oldEndVnode = oldCh[--oldEndIdx];
|
6821 | newStartVnode = newCh[++newStartIdx];
|
6822 | }
|
6823 | else {
|
6824 | if (isUndef(oldKeyToIdx))
|
6825 | oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
6826 | idxInOld = isDef(newStartVnode.key)
|
6827 | ? oldKeyToIdx[newStartVnode.key]
|
6828 | : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6829 | if (isUndef(idxInOld)) {
|
6830 |
|
6831 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6832 | }
|
6833 | else {
|
6834 | vnodeToMove = oldCh[idxInOld];
|
6835 | if (sameVnode(vnodeToMove, newStartVnode)) {
|
6836 | patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6837 | oldCh[idxInOld] = undefined;
|
6838 | canMove &&
|
6839 | nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6840 | }
|
6841 | else {
|
6842 |
|
6843 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6844 | }
|
6845 | }
|
6846 | newStartVnode = newCh[++newStartIdx];
|
6847 | }
|
6848 | }
|
6849 | if (oldStartIdx > oldEndIdx) {
|
6850 | refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6851 | addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6852 | }
|
6853 | else if (newStartIdx > newEndIdx) {
|
6854 | removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
6855 | }
|
6856 | }
|
6857 | function checkDuplicateKeys(children) {
|
6858 | var seenKeys = {};
|
6859 | for (var i_4 = 0; i_4 < children.length; i_4++) {
|
6860 | var vnode = children[i_4];
|
6861 | var key = vnode.key;
|
6862 | if (isDef(key)) {
|
6863 | if (seenKeys[key]) {
|
6864 | warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
|
6865 | }
|
6866 | else {
|
6867 | seenKeys[key] = true;
|
6868 | }
|
6869 | }
|
6870 | }
|
6871 | }
|
6872 | function findIdxInOld(node, oldCh, start, end) {
|
6873 | for (var i_5 = start; i_5 < end; i_5++) {
|
6874 | var c = oldCh[i_5];
|
6875 | if (isDef(c) && sameVnode(node, c))
|
6876 | return i_5;
|
6877 | }
|
6878 | }
|
6879 | function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
|
6880 | if (oldVnode === vnode) {
|
6881 | return;
|
6882 | }
|
6883 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6884 |
|
6885 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6886 | }
|
6887 | var elm = (vnode.elm = oldVnode.elm);
|
6888 | if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6889 | if (isDef(vnode.asyncFactory.resolved)) {
|
6890 | hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6891 | }
|
6892 | else {
|
6893 | vnode.isAsyncPlaceholder = true;
|
6894 | }
|
6895 | return;
|
6896 | }
|
6897 |
|
6898 |
|
6899 |
|
6900 |
|
6901 | if (isTrue(vnode.isStatic) &&
|
6902 | isTrue(oldVnode.isStatic) &&
|
6903 | vnode.key === oldVnode.key &&
|
6904 | (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
|
6905 | vnode.componentInstance = oldVnode.componentInstance;
|
6906 | return;
|
6907 | }
|
6908 | var i;
|
6909 | var data = vnode.data;
|
6910 | if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
|
6911 | i(oldVnode, vnode);
|
6912 | }
|
6913 | var oldCh = oldVnode.children;
|
6914 | var ch = vnode.children;
|
6915 | if (isDef(data) && isPatchable(vnode)) {
|
6916 | for (i = 0; i < cbs.update.length; ++i)
|
6917 | cbs.update[i](oldVnode, vnode);
|
6918 | if (isDef((i = data.hook)) && isDef((i = i.update)))
|
6919 | i(oldVnode, vnode);
|
6920 | }
|
6921 | if (isUndef(vnode.text)) {
|
6922 | if (isDef(oldCh) && isDef(ch)) {
|
6923 | if (oldCh !== ch)
|
6924 | updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
|
6925 | }
|
6926 | else if (isDef(ch)) {
|
6927 | {
|
6928 | checkDuplicateKeys(ch);
|
6929 | }
|
6930 | if (isDef(oldVnode.text))
|
6931 | nodeOps.setTextContent(elm, '');
|
6932 | addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6933 | }
|
6934 | else if (isDef(oldCh)) {
|
6935 | removeVnodes(oldCh, 0, oldCh.length - 1);
|
6936 | }
|
6937 | else if (isDef(oldVnode.text)) {
|
6938 | nodeOps.setTextContent(elm, '');
|
6939 | }
|
6940 | }
|
6941 | else if (oldVnode.text !== vnode.text) {
|
6942 | nodeOps.setTextContent(elm, vnode.text);
|
6943 | }
|
6944 | if (isDef(data)) {
|
6945 | if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
|
6946 | i(oldVnode, vnode);
|
6947 | }
|
6948 | }
|
6949 | function invokeInsertHook(vnode, queue, initial) {
|
6950 |
|
6951 |
|
6952 | if (isTrue(initial) && isDef(vnode.parent)) {
|
6953 | vnode.parent.data.pendingInsert = queue;
|
6954 | }
|
6955 | else {
|
6956 | for (var i_6 = 0; i_6 < queue.length; ++i_6) {
|
6957 | queue[i_6].data.hook.insert(queue[i_6]);
|
6958 | }
|
6959 | }
|
6960 | }
|
6961 | var hydrationBailed = false;
|
6962 |
|
6963 |
|
6964 |
|
6965 |
|
6966 | var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6967 |
|
6968 | function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
|
6969 | var i;
|
6970 | var tag = vnode.tag, data = vnode.data, children = vnode.children;
|
6971 | inVPre = inVPre || (data && data.pre);
|
6972 | vnode.elm = elm;
|
6973 | if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6974 | vnode.isAsyncPlaceholder = true;
|
6975 | return true;
|
6976 | }
|
6977 |
|
6978 | {
|
6979 | if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6980 | return false;
|
6981 | }
|
6982 | }
|
6983 | if (isDef(data)) {
|
6984 | if (isDef((i = data.hook)) && isDef((i = i.init)))
|
6985 | i(vnode, true );
|
6986 | if (isDef((i = vnode.componentInstance))) {
|
6987 |
|
6988 | initComponent(vnode, insertedVnodeQueue);
|
6989 | return true;
|
6990 | }
|
6991 | }
|
6992 | if (isDef(tag)) {
|
6993 | if (isDef(children)) {
|
6994 |
|
6995 | if (!elm.hasChildNodes()) {
|
6996 | createChildren(vnode, children, insertedVnodeQueue);
|
6997 | }
|
6998 | else {
|
6999 |
|
7000 | if (isDef((i = data)) &&
|
7001 | isDef((i = i.domProps)) &&
|
7002 | isDef((i = i.innerHTML))) {
|
7003 | if (i !== elm.innerHTML) {
|
7004 |
|
7005 | if (typeof console !== 'undefined' &&
|
7006 | !hydrationBailed) {
|
7007 | hydrationBailed = true;
|
7008 | console.warn('Parent: ', elm);
|
7009 | console.warn('server innerHTML: ', i);
|
7010 | console.warn('client innerHTML: ', elm.innerHTML);
|
7011 | }
|
7012 | return false;
|
7013 | }
|
7014 | }
|
7015 | else {
|
7016 |
|
7017 | var childrenMatch = true;
|
7018 | var childNode = elm.firstChild;
|
7019 | for (var i_7 = 0; i_7 < children.length; i_7++) {
|
7020 | if (!childNode ||
|
7021 | !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
|
7022 | childrenMatch = false;
|
7023 | break;
|
7024 | }
|
7025 | childNode = childNode.nextSibling;
|
7026 | }
|
7027 |
|
7028 |
|
7029 | if (!childrenMatch || childNode) {
|
7030 |
|
7031 | if (typeof console !== 'undefined' &&
|
7032 | !hydrationBailed) {
|
7033 | hydrationBailed = true;
|
7034 | console.warn('Parent: ', elm);
|
7035 | console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
7036 | }
|
7037 | return false;
|
7038 | }
|
7039 | }
|
7040 | }
|
7041 | }
|
7042 | if (isDef(data)) {
|
7043 | var fullInvoke = false;
|
7044 | for (var key in data) {
|
7045 | if (!isRenderedModule(key)) {
|
7046 | fullInvoke = true;
|
7047 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
7048 | break;
|
7049 | }
|
7050 | }
|
7051 | if (!fullInvoke && data['class']) {
|
7052 |
|
7053 | traverse(data['class']);
|
7054 | }
|
7055 | }
|
7056 | }
|
7057 | else if (elm.data !== vnode.text) {
|
7058 | elm.data = vnode.text;
|
7059 | }
|
7060 | return true;
|
7061 | }
|
7062 | function assertNodeMatch(node, vnode, inVPre) {
|
7063 | if (isDef(vnode.tag)) {
|
7064 | return (vnode.tag.indexOf('vue-component') === 0 ||
|
7065 | (!isUnknownElement(vnode, inVPre) &&
|
7066 | vnode.tag.toLowerCase() ===
|
7067 | (node.tagName && node.tagName.toLowerCase())));
|
7068 | }
|
7069 | else {
|
7070 | return node.nodeType === (vnode.isComment ? 8 : 3);
|
7071 | }
|
7072 | }
|
7073 | return function patch(oldVnode, vnode, hydrating, removeOnly) {
|
7074 | if (isUndef(vnode)) {
|
7075 | if (isDef(oldVnode))
|
7076 | invokeDestroyHook(oldVnode);
|
7077 | return;
|
7078 | }
|
7079 | var isInitialPatch = false;
|
7080 | var insertedVnodeQueue = [];
|
7081 | if (isUndef(oldVnode)) {
|
7082 |
|
7083 | isInitialPatch = true;
|
7084 | createElm(vnode, insertedVnodeQueue);
|
7085 | }
|
7086 | else {
|
7087 | var isRealElement = isDef(oldVnode.nodeType);
|
7088 | if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
7089 |
|
7090 | patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
7091 | }
|
7092 | else {
|
7093 | if (isRealElement) {
|
7094 |
|
7095 |
|
7096 |
|
7097 | if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
7098 | oldVnode.removeAttribute(SSR_ATTR);
|
7099 | hydrating = true;
|
7100 | }
|
7101 | if (isTrue(hydrating)) {
|
7102 | if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
7103 | invokeInsertHook(vnode, insertedVnodeQueue, true);
|
7104 | return oldVnode;
|
7105 | }
|
7106 | else {
|
7107 | warn$2('The client-side rendered virtual DOM tree is not matching ' +
|
7108 | 'server-rendered content. This is likely caused by incorrect ' +
|
7109 | 'HTML markup, for example nesting block-level elements inside ' +
|
7110 | '<p>, or missing <tbody>. Bailing hydration and performing ' +
|
7111 | 'full client-side render.');
|
7112 | }
|
7113 | }
|
7114 |
|
7115 |
|
7116 | oldVnode = emptyNodeAt(oldVnode);
|
7117 | }
|
7118 |
|
7119 | var oldElm = oldVnode.elm;
|
7120 | var parentElm = nodeOps.parentNode(oldElm);
|
7121 |
|
7122 | createElm(vnode, insertedVnodeQueue,
|
7123 |
|
7124 |
|
7125 |
|
7126 | oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
|
7127 |
|
7128 | if (isDef(vnode.parent)) {
|
7129 | var ancestor = vnode.parent;
|
7130 | var patchable = isPatchable(vnode);
|
7131 | while (ancestor) {
|
7132 | for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
|
7133 | cbs.destroy[i_8](ancestor);
|
7134 | }
|
7135 | ancestor.elm = vnode.elm;
|
7136 | if (patchable) {
|
7137 | for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
|
7138 | cbs.create[i_9](emptyNode, ancestor);
|
7139 | }
|
7140 |
|
7141 |
|
7142 |
|
7143 | var insert_1 = ancestor.data.hook.insert;
|
7144 | if (insert_1.merged) {
|
7145 |
|
7146 |
|
7147 |
|
7148 | var cloned = insert_1.fns.slice(1);
|
7149 | for (var i_10 = 0; i_10 < cloned.length; i_10++) {
|
7150 | cloned[i_10]();
|
7151 | }
|
7152 | }
|
7153 | }
|
7154 | else {
|
7155 | registerRef(ancestor);
|
7156 | }
|
7157 | ancestor = ancestor.parent;
|
7158 | }
|
7159 | }
|
7160 |
|
7161 | if (isDef(parentElm)) {
|
7162 | removeVnodes([oldVnode], 0, 0);
|
7163 | }
|
7164 | else if (isDef(oldVnode.tag)) {
|
7165 | invokeDestroyHook(oldVnode);
|
7166 | }
|
7167 | }
|
7168 | }
|
7169 | invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
7170 | return vnode.elm;
|
7171 | };
|
7172 | }
|
7173 |
|
7174 | var directives$1 = {
|
7175 | create: updateDirectives,
|
7176 | update: updateDirectives,
|
7177 | destroy: function unbindDirectives(vnode) {
|
7178 |
|
7179 | updateDirectives(vnode, emptyNode);
|
7180 | }
|
7181 | };
|
7182 | function updateDirectives(oldVnode, vnode) {
|
7183 | if (oldVnode.data.directives || vnode.data.directives) {
|
7184 | _update(oldVnode, vnode);
|
7185 | }
|
7186 | }
|
7187 | function _update(oldVnode, vnode) {
|
7188 | var isCreate = oldVnode === emptyNode;
|
7189 | var isDestroy = vnode === emptyNode;
|
7190 | var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
|
7191 | var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
|
7192 | var dirsWithInsert = [];
|
7193 | var dirsWithPostpatch = [];
|
7194 | var key, oldDir, dir;
|
7195 | for (key in newDirs) {
|
7196 | oldDir = oldDirs[key];
|
7197 | dir = newDirs[key];
|
7198 | if (!oldDir) {
|
7199 |
|
7200 | callHook(dir, 'bind', vnode, oldVnode);
|
7201 | if (dir.def && dir.def.inserted) {
|
7202 | dirsWithInsert.push(dir);
|
7203 | }
|
7204 | }
|
7205 | else {
|
7206 |
|
7207 | dir.oldValue = oldDir.value;
|
7208 | dir.oldArg = oldDir.arg;
|
7209 | callHook(dir, 'update', vnode, oldVnode);
|
7210 | if (dir.def && dir.def.componentUpdated) {
|
7211 | dirsWithPostpatch.push(dir);
|
7212 | }
|
7213 | }
|
7214 | }
|
7215 | if (dirsWithInsert.length) {
|
7216 | var callInsert = function () {
|
7217 | for (var i = 0; i < dirsWithInsert.length; i++) {
|
7218 | callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
7219 | }
|
7220 | };
|
7221 | if (isCreate) {
|
7222 | mergeVNodeHook(vnode, 'insert', callInsert);
|
7223 | }
|
7224 | else {
|
7225 | callInsert();
|
7226 | }
|
7227 | }
|
7228 | if (dirsWithPostpatch.length) {
|
7229 | mergeVNodeHook(vnode, 'postpatch', function () {
|
7230 | for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
7231 | callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
7232 | }
|
7233 | });
|
7234 | }
|
7235 | if (!isCreate) {
|
7236 | for (key in oldDirs) {
|
7237 | if (!newDirs[key]) {
|
7238 |
|
7239 | callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
7240 | }
|
7241 | }
|
7242 | }
|
7243 | }
|
7244 | var emptyModifiers = Object.create(null);
|
7245 | function normalizeDirectives(dirs, vm) {
|
7246 | var res = Object.create(null);
|
7247 | if (!dirs) {
|
7248 |
|
7249 | return res;
|
7250 | }
|
7251 | var i, dir;
|
7252 | for (i = 0; i < dirs.length; i++) {
|
7253 | dir = dirs[i];
|
7254 | if (!dir.modifiers) {
|
7255 |
|
7256 | dir.modifiers = emptyModifiers;
|
7257 | }
|
7258 | res[getRawDirName(dir)] = dir;
|
7259 | if (vm._setupState && vm._setupState.__sfc) {
|
7260 | var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
|
7261 | if (typeof setupDef === 'function') {
|
7262 | dir.def = {
|
7263 | bind: setupDef,
|
7264 | update: setupDef,
|
7265 | };
|
7266 | }
|
7267 | else {
|
7268 | dir.def = setupDef;
|
7269 | }
|
7270 | }
|
7271 | dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
|
7272 | }
|
7273 |
|
7274 | return res;
|
7275 | }
|
7276 | function getRawDirName(dir) {
|
7277 | return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
|
7278 | }
|
7279 | function callHook(dir, hook, vnode, oldVnode, isDestroy) {
|
7280 | var fn = dir.def && dir.def[hook];
|
7281 | if (fn) {
|
7282 | try {
|
7283 | fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
7284 | }
|
7285 | catch (e) {
|
7286 | handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
|
7287 | }
|
7288 | }
|
7289 | }
|
7290 |
|
7291 | var baseModules = [ref, directives$1];
|
7292 |
|
7293 | function updateAttrs(oldVnode, vnode) {
|
7294 | var opts = vnode.componentOptions;
|
7295 | if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
7296 | return;
|
7297 | }
|
7298 | if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
7299 | return;
|
7300 | }
|
7301 | var key, cur, old;
|
7302 | var elm = vnode.elm;
|
7303 | var oldAttrs = oldVnode.data.attrs || {};
|
7304 | var attrs = vnode.data.attrs || {};
|
7305 |
|
7306 | if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
|
7307 | attrs = vnode.data.attrs = extend({}, attrs);
|
7308 | }
|
7309 | for (key in attrs) {
|
7310 | cur = attrs[key];
|
7311 | old = oldAttrs[key];
|
7312 | if (old !== cur) {
|
7313 | setAttr(elm, key, cur, vnode.data.pre);
|
7314 | }
|
7315 | }
|
7316 |
|
7317 |
|
7318 |
|
7319 | if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
7320 | setAttr(elm, 'value', attrs.value);
|
7321 | }
|
7322 | for (key in oldAttrs) {
|
7323 | if (isUndef(attrs[key])) {
|
7324 | if (isXlink(key)) {
|
7325 | elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
7326 | }
|
7327 | else if (!isEnumeratedAttr(key)) {
|
7328 | elm.removeAttribute(key);
|
7329 | }
|
7330 | }
|
7331 | }
|
7332 | }
|
7333 | function setAttr(el, key, value, isInPre) {
|
7334 | if (isInPre || el.tagName.indexOf('-') > -1) {
|
7335 | baseSetAttr(el, key, value);
|
7336 | }
|
7337 | else if (isBooleanAttr(key)) {
|
7338 |
|
7339 |
|
7340 | if (isFalsyAttrValue(value)) {
|
7341 | el.removeAttribute(key);
|
7342 | }
|
7343 | else {
|
7344 |
|
7345 |
|
7346 | value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
|
7347 | el.setAttribute(key, value);
|
7348 | }
|
7349 | }
|
7350 | else if (isEnumeratedAttr(key)) {
|
7351 | el.setAttribute(key, convertEnumeratedValue(key, value));
|
7352 | }
|
7353 | else if (isXlink(key)) {
|
7354 | if (isFalsyAttrValue(value)) {
|
7355 | el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
7356 | }
|
7357 | else {
|
7358 | el.setAttributeNS(xlinkNS, key, value);
|
7359 | }
|
7360 | }
|
7361 | else {
|
7362 | baseSetAttr(el, key, value);
|
7363 | }
|
7364 | }
|
7365 | function baseSetAttr(el, key, value) {
|
7366 | if (isFalsyAttrValue(value)) {
|
7367 | el.removeAttribute(key);
|
7368 | }
|
7369 | else {
|
7370 |
|
7371 |
|
7372 |
|
7373 |
|
7374 | if (isIE &&
|
7375 | !isIE9 &&
|
7376 | el.tagName === 'TEXTAREA' &&
|
7377 | key === 'placeholder' &&
|
7378 | value !== '' &&
|
7379 | !el.__ieph) {
|
7380 | var blocker_1 = function (e) {
|
7381 | e.stopImmediatePropagation();
|
7382 | el.removeEventListener('input', blocker_1);
|
7383 | };
|
7384 | el.addEventListener('input', blocker_1);
|
7385 |
|
7386 | el.__ieph = true;
|
7387 | }
|
7388 | el.setAttribute(key, value);
|
7389 | }
|
7390 | }
|
7391 | var attrs = {
|
7392 | create: updateAttrs,
|
7393 | update: updateAttrs
|
7394 | };
|
7395 |
|
7396 | function updateClass(oldVnode, vnode) {
|
7397 | var el = vnode.elm;
|
7398 | var data = vnode.data;
|
7399 | var oldData = oldVnode.data;
|
7400 | if (isUndef(data.staticClass) &&
|
7401 | isUndef(data.class) &&
|
7402 | (isUndef(oldData) ||
|
7403 | (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
|
7404 | return;
|
7405 | }
|
7406 | var cls = genClassForVnode(vnode);
|
7407 |
|
7408 | var transitionClass = el._transitionClasses;
|
7409 | if (isDef(transitionClass)) {
|
7410 | cls = concat(cls, stringifyClass(transitionClass));
|
7411 | }
|
7412 |
|
7413 | if (cls !== el._prevClass) {
|
7414 | el.setAttribute('class', cls);
|
7415 | el._prevClass = cls;
|
7416 | }
|
7417 | }
|
7418 | var klass$1 = {
|
7419 | create: updateClass,
|
7420 | update: updateClass
|
7421 | };
|
7422 |
|
7423 | var validDivisionCharRE = /[\w).+\-_$\]]/;
|
7424 | function parseFilters(exp) {
|
7425 | var inSingle = false;
|
7426 | var inDouble = false;
|
7427 | var inTemplateString = false;
|
7428 | var inRegex = false;
|
7429 | var curly = 0;
|
7430 | var square = 0;
|
7431 | var paren = 0;
|
7432 | var lastFilterIndex = 0;
|
7433 | var c, prev, i, expression, filters;
|
7434 | for (i = 0; i < exp.length; i++) {
|
7435 | prev = c;
|
7436 | c = exp.charCodeAt(i);
|
7437 | if (inSingle) {
|
7438 | if (c === 0x27 && prev !== 0x5c)
|
7439 | inSingle = false;
|
7440 | }
|
7441 | else if (inDouble) {
|
7442 | if (c === 0x22 && prev !== 0x5c)
|
7443 | inDouble = false;
|
7444 | }
|
7445 | else if (inTemplateString) {
|
7446 | if (c === 0x60 && prev !== 0x5c)
|
7447 | inTemplateString = false;
|
7448 | }
|
7449 | else if (inRegex) {
|
7450 | if (c === 0x2f && prev !== 0x5c)
|
7451 | inRegex = false;
|
7452 | }
|
7453 | else if (c === 0x7c &&
|
7454 | exp.charCodeAt(i + 1) !== 0x7c &&
|
7455 | exp.charCodeAt(i - 1) !== 0x7c &&
|
7456 | !curly &&
|
7457 | !square &&
|
7458 | !paren) {
|
7459 | if (expression === undefined) {
|
7460 |
|
7461 | lastFilterIndex = i + 1;
|
7462 | expression = exp.slice(0, i).trim();
|
7463 | }
|
7464 | else {
|
7465 | pushFilter();
|
7466 | }
|
7467 | }
|
7468 | else {
|
7469 | switch (c) {
|
7470 | case 0x22:
|
7471 | inDouble = true;
|
7472 | break;
|
7473 | case 0x27:
|
7474 | inSingle = true;
|
7475 | break;
|
7476 | case 0x60:
|
7477 | inTemplateString = true;
|
7478 | break;
|
7479 | case 0x28:
|
7480 | paren++;
|
7481 | break;
|
7482 | case 0x29:
|
7483 | paren--;
|
7484 | break;
|
7485 | case 0x5b:
|
7486 | square++;
|
7487 | break;
|
7488 | case 0x5d:
|
7489 | square--;
|
7490 | break;
|
7491 | case 0x7b:
|
7492 | curly++;
|
7493 | break;
|
7494 | case 0x7d:
|
7495 | curly--;
|
7496 | break;
|
7497 | }
|
7498 | if (c === 0x2f) {
|
7499 |
|
7500 | var j = i - 1;
|
7501 | var p
|
7502 |
|
7503 | = void 0;
|
7504 |
|
7505 | for (; j >= 0; j--) {
|
7506 | p = exp.charAt(j);
|
7507 | if (p !== ' ')
|
7508 | break;
|
7509 | }
|
7510 | if (!p || !validDivisionCharRE.test(p)) {
|
7511 | inRegex = true;
|
7512 | }
|
7513 | }
|
7514 | }
|
7515 | }
|
7516 | if (expression === undefined) {
|
7517 | expression = exp.slice(0, i).trim();
|
7518 | }
|
7519 | else if (lastFilterIndex !== 0) {
|
7520 | pushFilter();
|
7521 | }
|
7522 | function pushFilter() {
|
7523 | (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
7524 | lastFilterIndex = i + 1;
|
7525 | }
|
7526 | if (filters) {
|
7527 | for (i = 0; i < filters.length; i++) {
|
7528 | expression = wrapFilter(expression, filters[i]);
|
7529 | }
|
7530 | }
|
7531 | return expression;
|
7532 | }
|
7533 | function wrapFilter(exp, filter) {
|
7534 | var i = filter.indexOf('(');
|
7535 | if (i < 0) {
|
7536 |
|
7537 | return "_f(\"".concat(filter, "\")(").concat(exp, ")");
|
7538 | }
|
7539 | else {
|
7540 | var name_1 = filter.slice(0, i);
|
7541 | var args = filter.slice(i + 1);
|
7542 | return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
|
7543 | }
|
7544 | }
|
7545 |
|
7546 |
|
7547 | function baseWarn(msg, range) {
|
7548 | console.error("[Vue compiler]: ".concat(msg));
|
7549 | }
|
7550 |
|
7551 | function pluckModuleFunction(modules, key) {
|
7552 | return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
|
7553 | }
|
7554 | function addProp(el, name, value, range, dynamic) {
|
7555 | (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
7556 | el.plain = false;
|
7557 | }
|
7558 | function addAttr(el, name, value, range, dynamic) {
|
7559 | var attrs = dynamic
|
7560 | ? el.dynamicAttrs || (el.dynamicAttrs = [])
|
7561 | : el.attrs || (el.attrs = []);
|
7562 | attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
7563 | el.plain = false;
|
7564 | }
|
7565 |
|
7566 | function addRawAttr(el, name, value, range) {
|
7567 | el.attrsMap[name] = value;
|
7568 | el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
7569 | }
|
7570 | function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
|
7571 | (el.directives || (el.directives = [])).push(rangeSetItem({
|
7572 | name: name,
|
7573 | rawName: rawName,
|
7574 | value: value,
|
7575 | arg: arg,
|
7576 | isDynamicArg: isDynamicArg,
|
7577 | modifiers: modifiers
|
7578 | }, range));
|
7579 | el.plain = false;
|
7580 | }
|
7581 | function prependModifierMarker(symbol, name, dynamic) {
|
7582 | return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name;
|
7583 | }
|
7584 | function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
|
7585 | modifiers = modifiers || emptyObject;
|
7586 |
|
7587 |
|
7588 | if (warn && modifiers.prevent && modifiers.passive) {
|
7589 | warn("passive and prevent can't be used together. " +
|
7590 | "Passive handler can't prevent default event.", range);
|
7591 | }
|
7592 |
|
7593 |
|
7594 |
|
7595 | if (modifiers.right) {
|
7596 | if (dynamic) {
|
7597 | name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
|
7598 | }
|
7599 | else if (name === 'click') {
|
7600 | name = 'contextmenu';
|
7601 | delete modifiers.right;
|
7602 | }
|
7603 | }
|
7604 | else if (modifiers.middle) {
|
7605 | if (dynamic) {
|
7606 | name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
|
7607 | }
|
7608 | else if (name === 'click') {
|
7609 | name = 'mouseup';
|
7610 | }
|
7611 | }
|
7612 |
|
7613 | if (modifiers.capture) {
|
7614 | delete modifiers.capture;
|
7615 | name = prependModifierMarker('!', name, dynamic);
|
7616 | }
|
7617 | if (modifiers.once) {
|
7618 | delete modifiers.once;
|
7619 | name = prependModifierMarker('~', name, dynamic);
|
7620 | }
|
7621 |
|
7622 | if (modifiers.passive) {
|
7623 | delete modifiers.passive;
|
7624 | name = prependModifierMarker('&', name, dynamic);
|
7625 | }
|
7626 | var events;
|
7627 | if (modifiers.native) {
|
7628 | delete modifiers.native;
|
7629 | events = el.nativeEvents || (el.nativeEvents = {});
|
7630 | }
|
7631 | else {
|
7632 | events = el.events || (el.events = {});
|
7633 | }
|
7634 | var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
7635 | if (modifiers !== emptyObject) {
|
7636 | newHandler.modifiers = modifiers;
|
7637 | }
|
7638 | var handlers = events[name];
|
7639 |
|
7640 | if (Array.isArray(handlers)) {
|
7641 | important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
7642 | }
|
7643 | else if (handlers) {
|
7644 | events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
7645 | }
|
7646 | else {
|
7647 | events[name] = newHandler;
|
7648 | }
|
7649 | el.plain = false;
|
7650 | }
|
7651 | function getRawBindingAttr(el, name) {
|
7652 | return (el.rawAttrsMap[':' + name] ||
|
7653 | el.rawAttrsMap['v-bind:' + name] ||
|
7654 | el.rawAttrsMap[name]);
|
7655 | }
|
7656 | function getBindingAttr(el, name, getStatic) {
|
7657 | var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
|
7658 | if (dynamicValue != null) {
|
7659 | return parseFilters(dynamicValue);
|
7660 | }
|
7661 | else if (getStatic !== false) {
|
7662 | var staticValue = getAndRemoveAttr(el, name);
|
7663 | if (staticValue != null) {
|
7664 | return JSON.stringify(staticValue);
|
7665 | }
|
7666 | }
|
7667 | }
|
7668 |
|
7669 |
|
7670 |
|
7671 |
|
7672 | function getAndRemoveAttr(el, name, removeFromMap) {
|
7673 | var val;
|
7674 | if ((val = el.attrsMap[name]) != null) {
|
7675 | var list = el.attrsList;
|
7676 | for (var i = 0, l = list.length; i < l; i++) {
|
7677 | if (list[i].name === name) {
|
7678 | list.splice(i, 1);
|
7679 | break;
|
7680 | }
|
7681 | }
|
7682 | }
|
7683 | if (removeFromMap) {
|
7684 | delete el.attrsMap[name];
|
7685 | }
|
7686 | return val;
|
7687 | }
|
7688 | function getAndRemoveAttrByRegex(el, name) {
|
7689 | var list = el.attrsList;
|
7690 | for (var i = 0, l = list.length; i < l; i++) {
|
7691 | var attr = list[i];
|
7692 | if (name.test(attr.name)) {
|
7693 | list.splice(i, 1);
|
7694 | return attr;
|
7695 | }
|
7696 | }
|
7697 | }
|
7698 | function rangeSetItem(item, range) {
|
7699 | if (range) {
|
7700 | if (range.start != null) {
|
7701 | item.start = range.start;
|
7702 | }
|
7703 | if (range.end != null) {
|
7704 | item.end = range.end;
|
7705 | }
|
7706 | }
|
7707 | return item;
|
7708 | }
|
7709 |
|
7710 | |
7711 |
|
7712 |
|
7713 | function genComponentModel(el, value, modifiers) {
|
7714 | var _a = modifiers || {}, number = _a.number, trim = _a.trim;
|
7715 | var baseValueExpression = '$$v';
|
7716 | var valueExpression = baseValueExpression;
|
7717 | if (trim) {
|
7718 | valueExpression =
|
7719 | "(typeof ".concat(baseValueExpression, " === 'string'") +
|
7720 | "? ".concat(baseValueExpression, ".trim()") +
|
7721 | ": ".concat(baseValueExpression, ")");
|
7722 | }
|
7723 | if (number) {
|
7724 | valueExpression = "_n(".concat(valueExpression, ")");
|
7725 | }
|
7726 | var assignment = genAssignmentCode(value, valueExpression);
|
7727 | el.model = {
|
7728 | value: "(".concat(value, ")"),
|
7729 | expression: JSON.stringify(value),
|
7730 | callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
|
7731 | };
|
7732 | }
|
7733 | |
7734 |
|
7735 |
|
7736 | function genAssignmentCode(value, assignment) {
|
7737 | var res = parseModel(value);
|
7738 | if (res.key === null) {
|
7739 | return "".concat(value, "=").concat(assignment);
|
7740 | }
|
7741 | else {
|
7742 | return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
|
7743 | }
|
7744 | }
|
7745 | |
7746 |
|
7747 |
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 |
|
7759 | var len, str, chr, index, expressionPos, expressionEndPos;
|
7760 | function parseModel(val) {
|
7761 |
|
7762 |
|
7763 | val = val.trim();
|
7764 | len = val.length;
|
7765 | if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7766 | index = val.lastIndexOf('.');
|
7767 | if (index > -1) {
|
7768 | return {
|
7769 | exp: val.slice(0, index),
|
7770 | key: '"' + val.slice(index + 1) + '"'
|
7771 | };
|
7772 | }
|
7773 | else {
|
7774 | return {
|
7775 | exp: val,
|
7776 | key: null
|
7777 | };
|
7778 | }
|
7779 | }
|
7780 | str = val;
|
7781 | index = expressionPos = expressionEndPos = 0;
|
7782 | while (!eof()) {
|
7783 | chr = next();
|
7784 |
|
7785 | if (isStringStart(chr)) {
|
7786 | parseString(chr);
|
7787 | }
|
7788 | else if (chr === 0x5b) {
|
7789 | parseBracket(chr);
|
7790 | }
|
7791 | }
|
7792 | return {
|
7793 | exp: val.slice(0, expressionPos),
|
7794 | key: val.slice(expressionPos + 1, expressionEndPos)
|
7795 | };
|
7796 | }
|
7797 | function next() {
|
7798 | return str.charCodeAt(++index);
|
7799 | }
|
7800 | function eof() {
|
7801 | return index >= len;
|
7802 | }
|
7803 | function isStringStart(chr) {
|
7804 | return chr === 0x22 || chr === 0x27;
|
7805 | }
|
7806 | function parseBracket(chr) {
|
7807 | var inBracket = 1;
|
7808 | expressionPos = index;
|
7809 | while (!eof()) {
|
7810 | chr = next();
|
7811 | if (isStringStart(chr)) {
|
7812 | parseString(chr);
|
7813 | continue;
|
7814 | }
|
7815 | if (chr === 0x5b)
|
7816 | inBracket++;
|
7817 | if (chr === 0x5d)
|
7818 | inBracket--;
|
7819 | if (inBracket === 0) {
|
7820 | expressionEndPos = index;
|
7821 | break;
|
7822 | }
|
7823 | }
|
7824 | }
|
7825 | function parseString(chr) {
|
7826 | var stringQuote = chr;
|
7827 | while (!eof()) {
|
7828 | chr = next();
|
7829 | if (chr === stringQuote) {
|
7830 | break;
|
7831 | }
|
7832 | }
|
7833 | }
|
7834 |
|
7835 | var warn$1;
|
7836 |
|
7837 |
|
7838 | var RANGE_TOKEN = '__r';
|
7839 | var CHECKBOX_RADIO_TOKEN = '__c';
|
7840 | function model$1(el, dir, _warn) {
|
7841 | warn$1 = _warn;
|
7842 | var value = dir.value;
|
7843 | var modifiers = dir.modifiers;
|
7844 | var tag = el.tag;
|
7845 | var type = el.attrsMap.type;
|
7846 | {
|
7847 |
|
7848 |
|
7849 | if (tag === 'input' && type === 'file') {
|
7850 | warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
|
7851 | "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
|
7852 | }
|
7853 | }
|
7854 | if (el.component) {
|
7855 | genComponentModel(el, value, modifiers);
|
7856 |
|
7857 | return false;
|
7858 | }
|
7859 | else if (tag === 'select') {
|
7860 | genSelect(el, value, modifiers);
|
7861 | }
|
7862 | else if (tag === 'input' && type === 'checkbox') {
|
7863 | genCheckboxModel(el, value, modifiers);
|
7864 | }
|
7865 | else if (tag === 'input' && type === 'radio') {
|
7866 | genRadioModel(el, value, modifiers);
|
7867 | }
|
7868 | else if (tag === 'input' || tag === 'textarea') {
|
7869 | genDefaultModel(el, value, modifiers);
|
7870 | }
|
7871 | else if (!config.isReservedTag(tag)) {
|
7872 | genComponentModel(el, value, modifiers);
|
7873 |
|
7874 | return false;
|
7875 | }
|
7876 | else {
|
7877 | warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
|
7878 | "v-model is not supported on this element type. " +
|
7879 | "If you are working with contenteditable, it's recommended to " +
|
7880 | 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
|
7881 | }
|
7882 |
|
7883 | return true;
|
7884 | }
|
7885 | function genCheckboxModel(el, value, modifiers) {
|
7886 | var number = modifiers && modifiers.number;
|
7887 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7888 | var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7889 | var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7890 | addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
|
7891 | "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
|
7892 | (trueValueBinding === 'true'
|
7893 | ? ":(".concat(value, ")")
|
7894 | : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
|
7895 | addHandler(el, 'change', "var $$a=".concat(value, ",") +
|
7896 | '$$el=$event.target,' +
|
7897 | "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
|
7898 | 'if(Array.isArray($$a)){' +
|
7899 | "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
|
7900 | '$$i=_i($$a,$$v);' +
|
7901 | "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
|
7902 | "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
|
7903 | "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
|
7904 | }
|
7905 | function genRadioModel(el, value, modifiers) {
|
7906 | var number = modifiers && modifiers.number;
|
7907 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7908 | valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
|
7909 | addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
|
7910 | addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7911 | }
|
7912 | function genSelect(el, value, modifiers) {
|
7913 | var number = modifiers && modifiers.number;
|
7914 | var selectedVal = "Array.prototype.filter" +
|
7915 | ".call($event.target.options,function(o){return o.selected})" +
|
7916 | ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7917 | "return ".concat(number ? '_n(val)' : 'val', "})");
|
7918 | var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7919 | var code = "var $$selectedVal = ".concat(selectedVal, ";");
|
7920 | code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
|
7921 | addHandler(el, 'change', code, null, true);
|
7922 | }
|
7923 | function genDefaultModel(el, value, modifiers) {
|
7924 | var type = el.attrsMap.type;
|
7925 |
|
7926 |
|
7927 | {
|
7928 | var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7929 | var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7930 | if (value_1 && !typeBinding) {
|
7931 | var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7932 | warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
|
7933 | 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
|
7934 | }
|
7935 | }
|
7936 | var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
|
7937 | var needCompositionGuard = !lazy && type !== 'range';
|
7938 | var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
|
7939 | var valueExpression = '$event.target.value';
|
7940 | if (trim) {
|
7941 | valueExpression = "$event.target.value.trim()";
|
7942 | }
|
7943 | if (number) {
|
7944 | valueExpression = "_n(".concat(valueExpression, ")");
|
7945 | }
|
7946 | var code = genAssignmentCode(value, valueExpression);
|
7947 | if (needCompositionGuard) {
|
7948 | code = "if($event.target.composing)return;".concat(code);
|
7949 | }
|
7950 | addProp(el, 'value', "(".concat(value, ")"));
|
7951 | addHandler(el, event, code, null, true);
|
7952 | if (trim || number) {
|
7953 | addHandler(el, 'blur', '$forceUpdate()');
|
7954 | }
|
7955 | }
|
7956 |
|
7957 |
|
7958 |
|
7959 |
|
7960 |
|
7961 | function normalizeEvents(on) {
|
7962 |
|
7963 | if (isDef(on[RANGE_TOKEN])) {
|
7964 |
|
7965 | var event_1 = isIE ? 'change' : 'input';
|
7966 | on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
|
7967 | delete on[RANGE_TOKEN];
|
7968 | }
|
7969 |
|
7970 |
|
7971 |
|
7972 | if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7973 | on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7974 | delete on[CHECKBOX_RADIO_TOKEN];
|
7975 | }
|
7976 | }
|
7977 | var target;
|
7978 | function createOnceHandler(event, handler, capture) {
|
7979 | var _target = target;
|
7980 | return function onceHandler() {
|
7981 | var res = handler.apply(null, arguments);
|
7982 | if (res !== null) {
|
7983 | remove(event, onceHandler, capture, _target);
|
7984 | }
|
7985 | };
|
7986 | }
|
7987 |
|
7988 |
|
7989 |
|
7990 | var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
7991 | function add(name, handler, capture, passive) {
|
7992 |
|
7993 |
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 | if (useMicrotaskFix) {
|
7999 | var attachedTimestamp_1 = currentFlushTimestamp;
|
8000 | var original_1 = handler;
|
8001 |
|
8002 | handler = original_1._wrapper = function (e) {
|
8003 | if (
|
8004 |
|
8005 |
|
8006 |
|
8007 | e.target === e.currentTarget ||
|
8008 |
|
8009 | e.timeStamp >= attachedTimestamp_1 ||
|
8010 |
|
8011 |
|
8012 |
|
8013 | e.timeStamp <= 0 ||
|
8014 |
|
8015 |
|
8016 |
|
8017 | e.target.ownerDocument !== document) {
|
8018 | return original_1.apply(this, arguments);
|
8019 | }
|
8020 | };
|
8021 | }
|
8022 | target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
|
8023 | }
|
8024 | function remove(name, handler, capture, _target) {
|
8025 | (_target || target).removeEventListener(name,
|
8026 |
|
8027 | handler._wrapper || handler, capture);
|
8028 | }
|
8029 | function updateDOMListeners(oldVnode, vnode) {
|
8030 | if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
8031 | return;
|
8032 | }
|
8033 | var on = vnode.data.on || {};
|
8034 | var oldOn = oldVnode.data.on || {};
|
8035 |
|
8036 |
|
8037 | target = vnode.elm || oldVnode.elm;
|
8038 | normalizeEvents(on);
|
8039 | updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
|
8040 | target = undefined;
|
8041 | }
|
8042 | var events = {
|
8043 | create: updateDOMListeners,
|
8044 | update: updateDOMListeners,
|
8045 |
|
8046 | destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
|
8047 | };
|
8048 |
|
8049 | var svgContainer;
|
8050 | function updateDOMProps(oldVnode, vnode) {
|
8051 | if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
8052 | return;
|
8053 | }
|
8054 | var key, cur;
|
8055 | var elm = vnode.elm;
|
8056 | var oldProps = oldVnode.data.domProps || {};
|
8057 | var props = vnode.data.domProps || {};
|
8058 |
|
8059 | if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
|
8060 | props = vnode.data.domProps = extend({}, props);
|
8061 | }
|
8062 | for (key in oldProps) {
|
8063 | if (!(key in props)) {
|
8064 | elm[key] = '';
|
8065 | }
|
8066 | }
|
8067 | for (key in props) {
|
8068 | cur = props[key];
|
8069 |
|
8070 |
|
8071 |
|
8072 | if (key === 'textContent' || key === 'innerHTML') {
|
8073 | if (vnode.children)
|
8074 | vnode.children.length = 0;
|
8075 | if (cur === oldProps[key])
|
8076 | continue;
|
8077 |
|
8078 |
|
8079 | if (elm.childNodes.length === 1) {
|
8080 | elm.removeChild(elm.childNodes[0]);
|
8081 | }
|
8082 | }
|
8083 | if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
8084 |
|
8085 |
|
8086 | elm._value = cur;
|
8087 |
|
8088 | var strCur = isUndef(cur) ? '' : String(cur);
|
8089 | if (shouldUpdateValue(elm, strCur)) {
|
8090 | elm.value = strCur;
|
8091 | }
|
8092 | }
|
8093 | else if (key === 'innerHTML' &&
|
8094 | isSVG(elm.tagName) &&
|
8095 | isUndef(elm.innerHTML)) {
|
8096 |
|
8097 | svgContainer = svgContainer || document.createElement('div');
|
8098 | svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
|
8099 | var svg = svgContainer.firstChild;
|
8100 | while (elm.firstChild) {
|
8101 | elm.removeChild(elm.firstChild);
|
8102 | }
|
8103 | while (svg.firstChild) {
|
8104 | elm.appendChild(svg.firstChild);
|
8105 | }
|
8106 | }
|
8107 | else if (
|
8108 |
|
8109 |
|
8110 |
|
8111 |
|
8112 | cur !== oldProps[key]) {
|
8113 |
|
8114 |
|
8115 | try {
|
8116 | elm[key] = cur;
|
8117 | }
|
8118 | catch (e) { }
|
8119 | }
|
8120 | }
|
8121 | }
|
8122 | function shouldUpdateValue(elm, checkVal) {
|
8123 | return (
|
8124 |
|
8125 | !elm.composing &&
|
8126 | (elm.tagName === 'OPTION' ||
|
8127 | isNotInFocusAndDirty(elm, checkVal) ||
|
8128 | isDirtyWithModifiers(elm, checkVal)));
|
8129 | }
|
8130 | function isNotInFocusAndDirty(elm, checkVal) {
|
8131 |
|
8132 |
|
8133 | var notInFocus = true;
|
8134 |
|
8135 |
|
8136 | try {
|
8137 | notInFocus = document.activeElement !== elm;
|
8138 | }
|
8139 | catch (e) { }
|
8140 | return notInFocus && elm.value !== checkVal;
|
8141 | }
|
8142 | function isDirtyWithModifiers(elm, newVal) {
|
8143 | var value = elm.value;
|
8144 | var modifiers = elm._vModifiers;
|
8145 | if (isDef(modifiers)) {
|
8146 | if (modifiers.number) {
|
8147 | return toNumber(value) !== toNumber(newVal);
|
8148 | }
|
8149 | if (modifiers.trim) {
|
8150 | return value.trim() !== newVal.trim();
|
8151 | }
|
8152 | }
|
8153 | return value !== newVal;
|
8154 | }
|
8155 | var domProps = {
|
8156 | create: updateDOMProps,
|
8157 | update: updateDOMProps
|
8158 | };
|
8159 |
|
8160 | var parseStyleText = cached(function (cssText) {
|
8161 | var res = {};
|
8162 | var listDelimiter = /;(?![^(]*\))/g;
|
8163 | var propertyDelimiter = /:(.+)/;
|
8164 | cssText.split(listDelimiter).forEach(function (item) {
|
8165 | if (item) {
|
8166 | var tmp = item.split(propertyDelimiter);
|
8167 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
8168 | }
|
8169 | });
|
8170 | return res;
|
8171 | });
|
8172 |
|
8173 | function normalizeStyleData(data) {
|
8174 | var style = normalizeStyleBinding(data.style);
|
8175 |
|
8176 |
|
8177 | return data.staticStyle ? extend(data.staticStyle, style) : style;
|
8178 | }
|
8179 |
|
8180 | function normalizeStyleBinding(bindingStyle) {
|
8181 | if (Array.isArray(bindingStyle)) {
|
8182 | return toObject(bindingStyle);
|
8183 | }
|
8184 | if (typeof bindingStyle === 'string') {
|
8185 | return parseStyleText(bindingStyle);
|
8186 | }
|
8187 | return bindingStyle;
|
8188 | }
|
8189 | |
8190 |
|
8191 |
|
8192 |
|
8193 | function getStyle(vnode, checkChild) {
|
8194 | var res = {};
|
8195 | var styleData;
|
8196 | if (checkChild) {
|
8197 | var childNode = vnode;
|
8198 | while (childNode.componentInstance) {
|
8199 | childNode = childNode.componentInstance._vnode;
|
8200 | if (childNode &&
|
8201 | childNode.data &&
|
8202 | (styleData = normalizeStyleData(childNode.data))) {
|
8203 | extend(res, styleData);
|
8204 | }
|
8205 | }
|
8206 | }
|
8207 | if ((styleData = normalizeStyleData(vnode.data))) {
|
8208 | extend(res, styleData);
|
8209 | }
|
8210 | var parentNode = vnode;
|
8211 |
|
8212 | while ((parentNode = parentNode.parent)) {
|
8213 | if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
8214 | extend(res, styleData);
|
8215 | }
|
8216 | }
|
8217 | return res;
|
8218 | }
|
8219 |
|
8220 | var cssVarRE = /^--/;
|
8221 | var importantRE = /\s*!important$/;
|
8222 | var setProp = function (el, name, val) {
|
8223 |
|
8224 | if (cssVarRE.test(name)) {
|
8225 | el.style.setProperty(name, val);
|
8226 | }
|
8227 | else if (importantRE.test(val)) {
|
8228 | el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
8229 | }
|
8230 | else {
|
8231 | var normalizedName = normalize(name);
|
8232 | if (Array.isArray(val)) {
|
8233 |
|
8234 |
|
8235 |
|
8236 | for (var i = 0, len = val.length; i < len; i++) {
|
8237 | el.style[normalizedName] = val[i];
|
8238 | }
|
8239 | }
|
8240 | else {
|
8241 | el.style[normalizedName] = val;
|
8242 | }
|
8243 | }
|
8244 | };
|
8245 | var vendorNames = ['Webkit', 'Moz', 'ms'];
|
8246 | var emptyStyle;
|
8247 | var normalize = cached(function (prop) {
|
8248 | emptyStyle = emptyStyle || document.createElement('div').style;
|
8249 | prop = camelize(prop);
|
8250 | if (prop !== 'filter' && prop in emptyStyle) {
|
8251 | return prop;
|
8252 | }
|
8253 | var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
8254 | for (var i = 0; i < vendorNames.length; i++) {
|
8255 | var name_1 = vendorNames[i] + capName;
|
8256 | if (name_1 in emptyStyle) {
|
8257 | return name_1;
|
8258 | }
|
8259 | }
|
8260 | });
|
8261 | function updateStyle(oldVnode, vnode) {
|
8262 | var data = vnode.data;
|
8263 | var oldData = oldVnode.data;
|
8264 | if (isUndef(data.staticStyle) &&
|
8265 | isUndef(data.style) &&
|
8266 | isUndef(oldData.staticStyle) &&
|
8267 | isUndef(oldData.style)) {
|
8268 | return;
|
8269 | }
|
8270 | var cur, name;
|
8271 | var el = vnode.elm;
|
8272 | var oldStaticStyle = oldData.staticStyle;
|
8273 | var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
8274 |
|
8275 | var oldStyle = oldStaticStyle || oldStyleBinding;
|
8276 | var style = normalizeStyleBinding(vnode.data.style) || {};
|
8277 |
|
8278 |
|
8279 |
|
8280 | vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
|
8281 | var newStyle = getStyle(vnode, true);
|
8282 | for (name in oldStyle) {
|
8283 | if (isUndef(newStyle[name])) {
|
8284 | setProp(el, name, '');
|
8285 | }
|
8286 | }
|
8287 | for (name in newStyle) {
|
8288 | cur = newStyle[name];
|
8289 | if (cur !== oldStyle[name]) {
|
8290 |
|
8291 | setProp(el, name, cur == null ? '' : cur);
|
8292 | }
|
8293 | }
|
8294 | }
|
8295 | var style$1 = {
|
8296 | create: updateStyle,
|
8297 | update: updateStyle
|
8298 | };
|
8299 |
|
8300 | var whitespaceRE$1 = /\s+/;
|
8301 | |
8302 |
|
8303 |
|
8304 |
|
8305 | function addClass(el, cls) {
|
8306 |
|
8307 | if (!cls || !(cls = cls.trim())) {
|
8308 | return;
|
8309 | }
|
8310 |
|
8311 | if (el.classList) {
|
8312 | if (cls.indexOf(' ') > -1) {
|
8313 | cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
|
8314 | }
|
8315 | else {
|
8316 | el.classList.add(cls);
|
8317 | }
|
8318 | }
|
8319 | else {
|
8320 | var cur = " ".concat(el.getAttribute('class') || '', " ");
|
8321 | if (cur.indexOf(' ' + cls + ' ') < 0) {
|
8322 | el.setAttribute('class', (cur + cls).trim());
|
8323 | }
|
8324 | }
|
8325 | }
|
8326 | |
8327 |
|
8328 |
|
8329 |
|
8330 | function removeClass(el, cls) {
|
8331 |
|
8332 | if (!cls || !(cls = cls.trim())) {
|
8333 | return;
|
8334 | }
|
8335 |
|
8336 | if (el.classList) {
|
8337 | if (cls.indexOf(' ') > -1) {
|
8338 | cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
|
8339 | }
|
8340 | else {
|
8341 | el.classList.remove(cls);
|
8342 | }
|
8343 | if (!el.classList.length) {
|
8344 | el.removeAttribute('class');
|
8345 | }
|
8346 | }
|
8347 | else {
|
8348 | var cur = " ".concat(el.getAttribute('class') || '', " ");
|
8349 | var tar = ' ' + cls + ' ';
|
8350 | while (cur.indexOf(tar) >= 0) {
|
8351 | cur = cur.replace(tar, ' ');
|
8352 | }
|
8353 | cur = cur.trim();
|
8354 | if (cur) {
|
8355 | el.setAttribute('class', cur);
|
8356 | }
|
8357 | else {
|
8358 | el.removeAttribute('class');
|
8359 | }
|
8360 | }
|
8361 | }
|
8362 |
|
8363 | function resolveTransition(def) {
|
8364 | if (!def) {
|
8365 | return;
|
8366 | }
|
8367 |
|
8368 | if (typeof def === 'object') {
|
8369 | var res = {};
|
8370 | if (def.css !== false) {
|
8371 | extend(res, autoCssTransition(def.name || 'v'));
|
8372 | }
|
8373 | extend(res, def);
|
8374 | return res;
|
8375 | }
|
8376 | else if (typeof def === 'string') {
|
8377 | return autoCssTransition(def);
|
8378 | }
|
8379 | }
|
8380 | var autoCssTransition = cached(function (name) {
|
8381 | return {
|
8382 | enterClass: "".concat(name, "-enter"),
|
8383 | enterToClass: "".concat(name, "-enter-to"),
|
8384 | enterActiveClass: "".concat(name, "-enter-active"),
|
8385 | leaveClass: "".concat(name, "-leave"),
|
8386 | leaveToClass: "".concat(name, "-leave-to"),
|
8387 | leaveActiveClass: "".concat(name, "-leave-active")
|
8388 | };
|
8389 | });
|
8390 | var hasTransition = inBrowser && !isIE9;
|
8391 | var TRANSITION = 'transition';
|
8392 | var ANIMATION = 'animation';
|
8393 |
|
8394 | var transitionProp = 'transition';
|
8395 | var transitionEndEvent = 'transitionend';
|
8396 | var animationProp = 'animation';
|
8397 | var animationEndEvent = 'animationend';
|
8398 | if (hasTransition) {
|
8399 |
|
8400 | if (window.ontransitionend === undefined &&
|
8401 | window.onwebkittransitionend !== undefined) {
|
8402 | transitionProp = 'WebkitTransition';
|
8403 | transitionEndEvent = 'webkitTransitionEnd';
|
8404 | }
|
8405 | if (window.onanimationend === undefined &&
|
8406 | window.onwebkitanimationend !== undefined) {
|
8407 | animationProp = 'WebkitAnimation';
|
8408 | animationEndEvent = 'webkitAnimationEnd';
|
8409 | }
|
8410 | }
|
8411 |
|
8412 | var raf = inBrowser
|
8413 | ? window.requestAnimationFrame
|
8414 | ? window.requestAnimationFrame.bind(window)
|
8415 | : setTimeout
|
8416 | : function (/* istanbul ignore next */ fn) { return fn(); };
|
8417 | function nextFrame(fn) {
|
8418 | raf(function () {
|
8419 |
|
8420 | raf(fn);
|
8421 | });
|
8422 | }
|
8423 | function addTransitionClass(el, cls) {
|
8424 | var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
8425 | if (transitionClasses.indexOf(cls) < 0) {
|
8426 | transitionClasses.push(cls);
|
8427 | addClass(el, cls);
|
8428 | }
|
8429 | }
|
8430 | function removeTransitionClass(el, cls) {
|
8431 | if (el._transitionClasses) {
|
8432 | remove$2(el._transitionClasses, cls);
|
8433 | }
|
8434 | removeClass(el, cls);
|
8435 | }
|
8436 | function whenTransitionEnds(el, expectedType, cb) {
|
8437 | var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
|
8438 | if (!type)
|
8439 | return cb();
|
8440 | var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
8441 | var ended = 0;
|
8442 | var end = function () {
|
8443 | el.removeEventListener(event, onEnd);
|
8444 | cb();
|
8445 | };
|
8446 | var onEnd = function (e) {
|
8447 | if (e.target === el) {
|
8448 | if (++ended >= propCount) {
|
8449 | end();
|
8450 | }
|
8451 | }
|
8452 | };
|
8453 | setTimeout(function () {
|
8454 | if (ended < propCount) {
|
8455 | end();
|
8456 | }
|
8457 | }, timeout + 1);
|
8458 | el.addEventListener(event, onEnd);
|
8459 | }
|
8460 | var transformRE = /\b(transform|all)(,|$)/;
|
8461 | function getTransitionInfo(el, expectedType) {
|
8462 | var styles = window.getComputedStyle(el);
|
8463 |
|
8464 | var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
8465 | var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
8466 | var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8467 | var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
8468 | var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
8469 | var animationTimeout = getTimeout(animationDelays, animationDurations);
|
8470 | var type;
|
8471 | var timeout = 0;
|
8472 | var propCount = 0;
|
8473 |
|
8474 | if (expectedType === TRANSITION) {
|
8475 | if (transitionTimeout > 0) {
|
8476 | type = TRANSITION;
|
8477 | timeout = transitionTimeout;
|
8478 | propCount = transitionDurations.length;
|
8479 | }
|
8480 | }
|
8481 | else if (expectedType === ANIMATION) {
|
8482 | if (animationTimeout > 0) {
|
8483 | type = ANIMATION;
|
8484 | timeout = animationTimeout;
|
8485 | propCount = animationDurations.length;
|
8486 | }
|
8487 | }
|
8488 | else {
|
8489 | timeout = Math.max(transitionTimeout, animationTimeout);
|
8490 | type =
|
8491 | timeout > 0
|
8492 | ? transitionTimeout > animationTimeout
|
8493 | ? TRANSITION
|
8494 | : ANIMATION
|
8495 | : null;
|
8496 | propCount = type
|
8497 | ? type === TRANSITION
|
8498 | ? transitionDurations.length
|
8499 | : animationDurations.length
|
8500 | : 0;
|
8501 | }
|
8502 | var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
|
8503 | return {
|
8504 | type: type,
|
8505 | timeout: timeout,
|
8506 | propCount: propCount,
|
8507 | hasTransform: hasTransform
|
8508 | };
|
8509 | }
|
8510 | function getTimeout(delays, durations) {
|
8511 |
|
8512 | while (delays.length < durations.length) {
|
8513 | delays = delays.concat(delays);
|
8514 | }
|
8515 | return Math.max.apply(null, durations.map(function (d, i) {
|
8516 | return toMs(d) + toMs(delays[i]);
|
8517 | }));
|
8518 | }
|
8519 |
|
8520 |
|
8521 |
|
8522 |
|
8523 | function toMs(s) {
|
8524 | return Number(s.slice(0, -1).replace(',', '.')) * 1000;
|
8525 | }
|
8526 |
|
8527 | function enter(vnode, toggleDisplay) {
|
8528 | var el = vnode.elm;
|
8529 |
|
8530 | if (isDef(el._leaveCb)) {
|
8531 | el._leaveCb.cancelled = true;
|
8532 | el._leaveCb();
|
8533 | }
|
8534 | var data = resolveTransition(vnode.data.transition);
|
8535 | if (isUndef(data)) {
|
8536 | return;
|
8537 | }
|
8538 |
|
8539 | if (isDef(el._enterCb) || el.nodeType !== 1) {
|
8540 | return;
|
8541 | }
|
8542 | var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 | var context = activeInstance;
|
8548 | var transitionNode = activeInstance.$vnode;
|
8549 | while (transitionNode && transitionNode.parent) {
|
8550 | context = transitionNode.context;
|
8551 | transitionNode = transitionNode.parent;
|
8552 | }
|
8553 | var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8554 | if (isAppear && !appear && appear !== '') {
|
8555 | return;
|
8556 | }
|
8557 | var startClass = isAppear && appearClass ? appearClass : enterClass;
|
8558 | var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
|
8559 | var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
|
8560 | var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
|
8561 | var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
|
8562 | var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
|
8563 | var enterCancelledHook = isAppear
|
8564 | ? appearCancelled || enterCancelled
|
8565 | : enterCancelled;
|
8566 | var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
|
8567 | if (explicitEnterDuration != null) {
|
8568 | checkDuration(explicitEnterDuration, 'enter', vnode);
|
8569 | }
|
8570 | var expectsCSS = css !== false && !isIE9;
|
8571 | var userWantsControl = getHookArgumentsLength(enterHook);
|
8572 | var cb = (el._enterCb = once(function () {
|
8573 | if (expectsCSS) {
|
8574 | removeTransitionClass(el, toClass);
|
8575 | removeTransitionClass(el, activeClass);
|
8576 | }
|
8577 |
|
8578 | if (cb.cancelled) {
|
8579 | if (expectsCSS) {
|
8580 | removeTransitionClass(el, startClass);
|
8581 | }
|
8582 | enterCancelledHook && enterCancelledHook(el);
|
8583 | }
|
8584 | else {
|
8585 | afterEnterHook && afterEnterHook(el);
|
8586 | }
|
8587 | el._enterCb = null;
|
8588 | }));
|
8589 | if (!vnode.data.show) {
|
8590 |
|
8591 | mergeVNodeHook(vnode, 'insert', function () {
|
8592 | var parent = el.parentNode;
|
8593 | var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8594 | if (pendingNode &&
|
8595 | pendingNode.tag === vnode.tag &&
|
8596 | pendingNode.elm._leaveCb) {
|
8597 | pendingNode.elm._leaveCb();
|
8598 | }
|
8599 | enterHook && enterHook(el, cb);
|
8600 | });
|
8601 | }
|
8602 |
|
8603 | beforeEnterHook && beforeEnterHook(el);
|
8604 | if (expectsCSS) {
|
8605 | addTransitionClass(el, startClass);
|
8606 | addTransitionClass(el, activeClass);
|
8607 | nextFrame(function () {
|
8608 | removeTransitionClass(el, startClass);
|
8609 |
|
8610 | if (!cb.cancelled) {
|
8611 | addTransitionClass(el, toClass);
|
8612 | if (!userWantsControl) {
|
8613 | if (isValidDuration(explicitEnterDuration)) {
|
8614 | setTimeout(cb, explicitEnterDuration);
|
8615 | }
|
8616 | else {
|
8617 | whenTransitionEnds(el, type, cb);
|
8618 | }
|
8619 | }
|
8620 | }
|
8621 | });
|
8622 | }
|
8623 | if (vnode.data.show) {
|
8624 | toggleDisplay && toggleDisplay();
|
8625 | enterHook && enterHook(el, cb);
|
8626 | }
|
8627 | if (!expectsCSS && !userWantsControl) {
|
8628 | cb();
|
8629 | }
|
8630 | }
|
8631 | function leave(vnode, rm) {
|
8632 | var el = vnode.elm;
|
8633 |
|
8634 | if (isDef(el._enterCb)) {
|
8635 | el._enterCb.cancelled = true;
|
8636 | el._enterCb();
|
8637 | }
|
8638 | var data = resolveTransition(vnode.data.transition);
|
8639 | if (isUndef(data) || el.nodeType !== 1) {
|
8640 | return rm();
|
8641 | }
|
8642 |
|
8643 | if (isDef(el._leaveCb)) {
|
8644 | return;
|
8645 | }
|
8646 | var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
|
8647 | var expectsCSS = css !== false && !isIE9;
|
8648 | var userWantsControl = getHookArgumentsLength(leave);
|
8649 | var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
|
8650 | if (isDef(explicitLeaveDuration)) {
|
8651 | checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8652 | }
|
8653 | var cb = (el._leaveCb = once(function () {
|
8654 | if (el.parentNode && el.parentNode._pending) {
|
8655 | el.parentNode._pending[vnode.key] = null;
|
8656 | }
|
8657 | if (expectsCSS) {
|
8658 | removeTransitionClass(el, leaveToClass);
|
8659 | removeTransitionClass(el, leaveActiveClass);
|
8660 | }
|
8661 |
|
8662 | if (cb.cancelled) {
|
8663 | if (expectsCSS) {
|
8664 | removeTransitionClass(el, leaveClass);
|
8665 | }
|
8666 | leaveCancelled && leaveCancelled(el);
|
8667 | }
|
8668 | else {
|
8669 | rm();
|
8670 | afterLeave && afterLeave(el);
|
8671 | }
|
8672 | el._leaveCb = null;
|
8673 | }));
|
8674 | if (delayLeave) {
|
8675 | delayLeave(performLeave);
|
8676 | }
|
8677 | else {
|
8678 | performLeave();
|
8679 | }
|
8680 | function performLeave() {
|
8681 |
|
8682 |
|
8683 | if (cb.cancelled) {
|
8684 | return;
|
8685 | }
|
8686 |
|
8687 | if (!vnode.data.show && el.parentNode) {
|
8688 | (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
|
8689 | vnode;
|
8690 | }
|
8691 | beforeLeave && beforeLeave(el);
|
8692 | if (expectsCSS) {
|
8693 | addTransitionClass(el, leaveClass);
|
8694 | addTransitionClass(el, leaveActiveClass);
|
8695 | nextFrame(function () {
|
8696 | removeTransitionClass(el, leaveClass);
|
8697 |
|
8698 | if (!cb.cancelled) {
|
8699 | addTransitionClass(el, leaveToClass);
|
8700 | if (!userWantsControl) {
|
8701 | if (isValidDuration(explicitLeaveDuration)) {
|
8702 | setTimeout(cb, explicitLeaveDuration);
|
8703 | }
|
8704 | else {
|
8705 | whenTransitionEnds(el, type, cb);
|
8706 | }
|
8707 | }
|
8708 | }
|
8709 | });
|
8710 | }
|
8711 | leave && leave(el, cb);
|
8712 | if (!expectsCSS && !userWantsControl) {
|
8713 | cb();
|
8714 | }
|
8715 | }
|
8716 | }
|
8717 |
|
8718 | function checkDuration(val, name, vnode) {
|
8719 | if (typeof val !== 'number') {
|
8720 | warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
|
8721 | "got ".concat(JSON.stringify(val), "."), vnode.context);
|
8722 | }
|
8723 | else if (isNaN(val)) {
|
8724 | warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
|
8725 | 'the duration expression might be incorrect.', vnode.context);
|
8726 | }
|
8727 | }
|
8728 | function isValidDuration(val) {
|
8729 | return typeof val === 'number' && !isNaN(val);
|
8730 | }
|
8731 | |
8732 |
|
8733 |
|
8734 |
|
8735 |
|
8736 |
|
8737 | function getHookArgumentsLength(fn) {
|
8738 | if (isUndef(fn)) {
|
8739 | return false;
|
8740 | }
|
8741 |
|
8742 | var invokerFns = fn.fns;
|
8743 | if (isDef(invokerFns)) {
|
8744 |
|
8745 | return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
|
8746 | }
|
8747 | else {
|
8748 |
|
8749 | return (fn._length || fn.length) > 1;
|
8750 | }
|
8751 | }
|
8752 | function _enter(_, vnode) {
|
8753 | if (vnode.data.show !== true) {
|
8754 | enter(vnode);
|
8755 | }
|
8756 | }
|
8757 | var transition = inBrowser
|
8758 | ? {
|
8759 | create: _enter,
|
8760 | activate: _enter,
|
8761 | remove: function (vnode, rm) {
|
8762 |
|
8763 | if (vnode.data.show !== true) {
|
8764 |
|
8765 | leave(vnode, rm);
|
8766 | }
|
8767 | else {
|
8768 | rm();
|
8769 | }
|
8770 | }
|
8771 | }
|
8772 | : {};
|
8773 |
|
8774 | var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
|
8775 |
|
8776 |
|
8777 |
|
8778 | var modules$1 = platformModules.concat(baseModules);
|
8779 | var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
|
8780 |
|
8781 | |
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 | if (isIE9) {
|
8787 |
|
8788 | document.addEventListener('selectionchange', function () {
|
8789 | var el = document.activeElement;
|
8790 |
|
8791 | if (el && el.vmodel) {
|
8792 | trigger(el, 'input');
|
8793 | }
|
8794 | });
|
8795 | }
|
8796 | var directive = {
|
8797 | inserted: function (el, binding, vnode, oldVnode) {
|
8798 | if (vnode.tag === 'select') {
|
8799 |
|
8800 | if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8801 | mergeVNodeHook(vnode, 'postpatch', function () {
|
8802 | directive.componentUpdated(el, binding, vnode);
|
8803 | });
|
8804 | }
|
8805 | else {
|
8806 | setSelected(el, binding, vnode.context);
|
8807 | }
|
8808 | el._vOptions = [].map.call(el.options, getValue);
|
8809 | }
|
8810 | else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8811 | el._vModifiers = binding.modifiers;
|
8812 | if (!binding.modifiers.lazy) {
|
8813 | el.addEventListener('compositionstart', onCompositionStart);
|
8814 | el.addEventListener('compositionend', onCompositionEnd);
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 | el.addEventListener('change', onCompositionEnd);
|
8820 |
|
8821 | if (isIE9) {
|
8822 | el.vmodel = true;
|
8823 | }
|
8824 | }
|
8825 | }
|
8826 | },
|
8827 | componentUpdated: function (el, binding, vnode) {
|
8828 | if (vnode.tag === 'select') {
|
8829 | setSelected(el, binding, vnode.context);
|
8830 |
|
8831 |
|
8832 |
|
8833 |
|
8834 | var prevOptions_1 = el._vOptions;
|
8835 | var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
|
8836 | if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
|
8837 |
|
8838 |
|
8839 | var needReset = el.multiple
|
8840 | ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
|
8841 | : binding.value !== binding.oldValue &&
|
8842 | hasNoMatchingOption(binding.value, curOptions_1);
|
8843 | if (needReset) {
|
8844 | trigger(el, 'change');
|
8845 | }
|
8846 | }
|
8847 | }
|
8848 | }
|
8849 | };
|
8850 | function setSelected(el, binding, vm) {
|
8851 | actuallySetSelected(el, binding, vm);
|
8852 |
|
8853 | if (isIE || isEdge) {
|
8854 | setTimeout(function () {
|
8855 | actuallySetSelected(el, binding, vm);
|
8856 | }, 0);
|
8857 | }
|
8858 | }
|
8859 | function actuallySetSelected(el, binding, vm) {
|
8860 | var value = binding.value;
|
8861 | var isMultiple = el.multiple;
|
8862 | if (isMultiple && !Array.isArray(value)) {
|
8863 | warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
|
8864 | "expects an Array value for its binding, but got ".concat(Object.prototype.toString
|
8865 | .call(value)
|
8866 | .slice(8, -1)), vm);
|
8867 | return;
|
8868 | }
|
8869 | var selected, option;
|
8870 | for (var i = 0, l = el.options.length; i < l; i++) {
|
8871 | option = el.options[i];
|
8872 | if (isMultiple) {
|
8873 | selected = looseIndexOf(value, getValue(option)) > -1;
|
8874 | if (option.selected !== selected) {
|
8875 | option.selected = selected;
|
8876 | }
|
8877 | }
|
8878 | else {
|
8879 | if (looseEqual(getValue(option), value)) {
|
8880 | if (el.selectedIndex !== i) {
|
8881 | el.selectedIndex = i;
|
8882 | }
|
8883 | return;
|
8884 | }
|
8885 | }
|
8886 | }
|
8887 | if (!isMultiple) {
|
8888 | el.selectedIndex = -1;
|
8889 | }
|
8890 | }
|
8891 | function hasNoMatchingOption(value, options) {
|
8892 | return options.every(function (o) { return !looseEqual(o, value); });
|
8893 | }
|
8894 | function getValue(option) {
|
8895 | return '_value' in option ? option._value : option.value;
|
8896 | }
|
8897 | function onCompositionStart(e) {
|
8898 | e.target.composing = true;
|
8899 | }
|
8900 | function onCompositionEnd(e) {
|
8901 |
|
8902 | if (!e.target.composing)
|
8903 | return;
|
8904 | e.target.composing = false;
|
8905 | trigger(e.target, 'input');
|
8906 | }
|
8907 | function trigger(el, type) {
|
8908 | var e = document.createEvent('HTMLEvents');
|
8909 | e.initEvent(type, true, true);
|
8910 | el.dispatchEvent(e);
|
8911 | }
|
8912 |
|
8913 |
|
8914 | function locateNode(vnode) {
|
8915 |
|
8916 | return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8917 | ? locateNode(vnode.componentInstance._vnode)
|
8918 | : vnode;
|
8919 | }
|
8920 | var show = {
|
8921 | bind: function (el, _a, vnode) {
|
8922 | var value = _a.value;
|
8923 | vnode = locateNode(vnode);
|
8924 | var transition = vnode.data && vnode.data.transition;
|
8925 | var originalDisplay = (el.__vOriginalDisplay =
|
8926 | el.style.display === 'none' ? '' : el.style.display);
|
8927 | if (value && transition) {
|
8928 | vnode.data.show = true;
|
8929 | enter(vnode, function () {
|
8930 | el.style.display = originalDisplay;
|
8931 | });
|
8932 | }
|
8933 | else {
|
8934 | el.style.display = value ? originalDisplay : 'none';
|
8935 | }
|
8936 | },
|
8937 | update: function (el, _a, vnode) {
|
8938 | var value = _a.value, oldValue = _a.oldValue;
|
8939 |
|
8940 | if (!value === !oldValue)
|
8941 | return;
|
8942 | vnode = locateNode(vnode);
|
8943 | var transition = vnode.data && vnode.data.transition;
|
8944 | if (transition) {
|
8945 | vnode.data.show = true;
|
8946 | if (value) {
|
8947 | enter(vnode, function () {
|
8948 | el.style.display = el.__vOriginalDisplay;
|
8949 | });
|
8950 | }
|
8951 | else {
|
8952 | leave(vnode, function () {
|
8953 | el.style.display = 'none';
|
8954 | });
|
8955 | }
|
8956 | }
|
8957 | else {
|
8958 | el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8959 | }
|
8960 | },
|
8961 | unbind: function (el, binding, vnode, oldVnode, isDestroy) {
|
8962 | if (!isDestroy) {
|
8963 | el.style.display = el.__vOriginalDisplay;
|
8964 | }
|
8965 | }
|
8966 | };
|
8967 |
|
8968 | var platformDirectives = {
|
8969 | model: directive,
|
8970 | show: show
|
8971 | };
|
8972 |
|
8973 |
|
8974 | var transitionProps = {
|
8975 | name: String,
|
8976 | appear: Boolean,
|
8977 | css: Boolean,
|
8978 | mode: String,
|
8979 | type: String,
|
8980 | enterClass: String,
|
8981 | leaveClass: String,
|
8982 | enterToClass: String,
|
8983 | leaveToClass: String,
|
8984 | enterActiveClass: String,
|
8985 | leaveActiveClass: String,
|
8986 | appearClass: String,
|
8987 | appearActiveClass: String,
|
8988 | appearToClass: String,
|
8989 | duration: [Number, String, Object]
|
8990 | };
|
8991 |
|
8992 |
|
8993 | function getRealChild(vnode) {
|
8994 | var compOptions = vnode && vnode.componentOptions;
|
8995 | if (compOptions && compOptions.Ctor.options.abstract) {
|
8996 | return getRealChild(getFirstComponentChild(compOptions.children));
|
8997 | }
|
8998 | else {
|
8999 | return vnode;
|
9000 | }
|
9001 | }
|
9002 | function extractTransitionData(comp) {
|
9003 | var data = {};
|
9004 | var options = comp.$options;
|
9005 |
|
9006 | for (var key in options.propsData) {
|
9007 | data[key] = comp[key];
|
9008 | }
|
9009 |
|
9010 |
|
9011 | var listeners = options._parentListeners;
|
9012 | for (var key in listeners) {
|
9013 | data[camelize(key)] = listeners[key];
|
9014 | }
|
9015 | return data;
|
9016 | }
|
9017 | function placeholder(h, rawChild) {
|
9018 |
|
9019 | if (/\d-keep-alive$/.test(rawChild.tag)) {
|
9020 | return h('keep-alive', {
|
9021 | props: rawChild.componentOptions.propsData
|
9022 | });
|
9023 | }
|
9024 | }
|
9025 | function hasParentTransition(vnode) {
|
9026 | while ((vnode = vnode.parent)) {
|
9027 | if (vnode.data.transition) {
|
9028 | return true;
|
9029 | }
|
9030 | }
|
9031 | }
|
9032 | function isSameChild(child, oldChild) {
|
9033 | return oldChild.key === child.key && oldChild.tag === child.tag;
|
9034 | }
|
9035 | var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
9036 | var isVShowDirective = function (d) { return d.name === 'show'; };
|
9037 | var Transition = {
|
9038 | name: 'transition',
|
9039 | props: transitionProps,
|
9040 | abstract: true,
|
9041 | render: function (h) {
|
9042 | var _this = this;
|
9043 | var children = this.$slots.default;
|
9044 | if (!children) {
|
9045 | return;
|
9046 | }
|
9047 |
|
9048 | children = children.filter(isNotTextNode);
|
9049 |
|
9050 | if (!children.length) {
|
9051 | return;
|
9052 | }
|
9053 |
|
9054 | if (children.length > 1) {
|
9055 | warn$2('<transition> can only be used on a single element. Use ' +
|
9056 | '<transition-group> for lists.', this.$parent);
|
9057 | }
|
9058 | var mode = this.mode;
|
9059 |
|
9060 | if (mode && mode !== 'in-out' && mode !== 'out-in') {
|
9061 | warn$2('invalid <transition> mode: ' + mode, this.$parent);
|
9062 | }
|
9063 | var rawChild = children[0];
|
9064 |
|
9065 |
|
9066 | if (hasParentTransition(this.$vnode)) {
|
9067 | return rawChild;
|
9068 | }
|
9069 |
|
9070 |
|
9071 | var child = getRealChild(rawChild);
|
9072 |
|
9073 | if (!child) {
|
9074 | return rawChild;
|
9075 | }
|
9076 | if (this._leaving) {
|
9077 | return placeholder(h, rawChild);
|
9078 | }
|
9079 |
|
9080 |
|
9081 |
|
9082 | var id = "__transition-".concat(this._uid, "-");
|
9083 | child.key =
|
9084 | child.key == null
|
9085 | ? child.isComment
|
9086 | ? id + 'comment'
|
9087 | : id + child.tag
|
9088 | : isPrimitive(child.key)
|
9089 | ? String(child.key).indexOf(id) === 0
|
9090 | ? child.key
|
9091 | : id + child.key
|
9092 | : child.key;
|
9093 | var data = ((child.data || (child.data = {})).transition =
|
9094 | extractTransitionData(this));
|
9095 | var oldRawChild = this._vnode;
|
9096 | var oldChild = getRealChild(oldRawChild);
|
9097 |
|
9098 |
|
9099 | if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
9100 | child.data.show = true;
|
9101 | }
|
9102 | if (oldChild &&
|
9103 | oldChild.data &&
|
9104 | !isSameChild(child, oldChild) &&
|
9105 | !isAsyncPlaceholder(oldChild) &&
|
9106 |
|
9107 | !(oldChild.componentInstance &&
|
9108 | oldChild.componentInstance._vnode.isComment)) {
|
9109 |
|
9110 |
|
9111 | var oldData = (oldChild.data.transition = extend({}, data));
|
9112 |
|
9113 | if (mode === 'out-in') {
|
9114 |
|
9115 | this._leaving = true;
|
9116 | mergeVNodeHook(oldData, 'afterLeave', function () {
|
9117 | _this._leaving = false;
|
9118 | _this.$forceUpdate();
|
9119 | });
|
9120 | return placeholder(h, rawChild);
|
9121 | }
|
9122 | else if (mode === 'in-out') {
|
9123 | if (isAsyncPlaceholder(child)) {
|
9124 | return oldRawChild;
|
9125 | }
|
9126 | var delayedLeave_1;
|
9127 | var performLeave = function () {
|
9128 | delayedLeave_1();
|
9129 | };
|
9130 | mergeVNodeHook(data, 'afterEnter', performLeave);
|
9131 | mergeVNodeHook(data, 'enterCancelled', performLeave);
|
9132 | mergeVNodeHook(oldData, 'delayLeave', function (leave) {
|
9133 | delayedLeave_1 = leave;
|
9134 | });
|
9135 | }
|
9136 | }
|
9137 | return rawChild;
|
9138 | }
|
9139 | };
|
9140 |
|
9141 |
|
9142 | var props = extend({
|
9143 | tag: String,
|
9144 | moveClass: String
|
9145 | }, transitionProps);
|
9146 | delete props.mode;
|
9147 | var TransitionGroup = {
|
9148 | props: props,
|
9149 | beforeMount: function () {
|
9150 | var _this = this;
|
9151 | var update = this._update;
|
9152 | this._update = function (vnode, hydrating) {
|
9153 | var restoreActiveInstance = setActiveInstance(_this);
|
9154 |
|
9155 | _this.__patch__(_this._vnode, _this.kept, false,
|
9156 | true
|
9157 | );
|
9158 | _this._vnode = _this.kept;
|
9159 | restoreActiveInstance();
|
9160 | update.call(_this, vnode, hydrating);
|
9161 | };
|
9162 | },
|
9163 | render: function (h) {
|
9164 | var tag = this.tag || this.$vnode.data.tag || 'span';
|
9165 | var map = Object.create(null);
|
9166 | var prevChildren = (this.prevChildren = this.children);
|
9167 | var rawChildren = this.$slots.default || [];
|
9168 | var children = (this.children = []);
|
9169 | var transitionData = extractTransitionData(this);
|
9170 | for (var i = 0; i < rawChildren.length; i++) {
|
9171 | var c = rawChildren[i];
|
9172 | if (c.tag) {
|
9173 | if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
9174 | children.push(c);
|
9175 | map[c.key] = c;
|
9176 | (c.data || (c.data = {})).transition = transitionData;
|
9177 | }
|
9178 | else {
|
9179 | var opts = c.componentOptions;
|
9180 | var name_1 = opts
|
9181 | ? getComponentName(opts.Ctor.options) || opts.tag || ''
|
9182 | : c.tag;
|
9183 | warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
|
9184 | }
|
9185 | }
|
9186 | }
|
9187 | if (prevChildren) {
|
9188 | var kept = [];
|
9189 | var removed = [];
|
9190 | for (var i = 0; i < prevChildren.length; i++) {
|
9191 | var c = prevChildren[i];
|
9192 | c.data.transition = transitionData;
|
9193 |
|
9194 | c.data.pos = c.elm.getBoundingClientRect();
|
9195 | if (map[c.key]) {
|
9196 | kept.push(c);
|
9197 | }
|
9198 | else {
|
9199 | removed.push(c);
|
9200 | }
|
9201 | }
|
9202 | this.kept = h(tag, null, kept);
|
9203 | this.removed = removed;
|
9204 | }
|
9205 | return h(tag, null, children);
|
9206 | },
|
9207 | updated: function () {
|
9208 | var children = this.prevChildren;
|
9209 | var moveClass = this.moveClass || (this.name || 'v') + '-move';
|
9210 | if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
9211 | return;
|
9212 | }
|
9213 |
|
9214 |
|
9215 | children.forEach(callPendingCbs);
|
9216 | children.forEach(recordPosition);
|
9217 | children.forEach(applyTranslation);
|
9218 |
|
9219 |
|
9220 |
|
9221 | this._reflow = document.body.offsetHeight;
|
9222 | children.forEach(function (c) {
|
9223 | if (c.data.moved) {
|
9224 | var el_1 = c.elm;
|
9225 | var s = el_1.style;
|
9226 | addTransitionClass(el_1, moveClass);
|
9227 | s.transform = s.WebkitTransform = s.transitionDuration = '';
|
9228 | el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
|
9229 | if (e && e.target !== el_1) {
|
9230 | return;
|
9231 | }
|
9232 | if (!e || /transform$/.test(e.propertyName)) {
|
9233 | el_1.removeEventListener(transitionEndEvent, cb);
|
9234 | el_1._moveCb = null;
|
9235 | removeTransitionClass(el_1, moveClass);
|
9236 | }
|
9237 | }));
|
9238 | }
|
9239 | });
|
9240 | },
|
9241 | methods: {
|
9242 | hasMove: function (el, moveClass) {
|
9243 |
|
9244 | if (!hasTransition) {
|
9245 | return false;
|
9246 | }
|
9247 |
|
9248 | if (this._hasMove) {
|
9249 | return this._hasMove;
|
9250 | }
|
9251 |
|
9252 |
|
9253 |
|
9254 |
|
9255 |
|
9256 | var clone = el.cloneNode();
|
9257 | if (el._transitionClasses) {
|
9258 | el._transitionClasses.forEach(function (cls) {
|
9259 | removeClass(clone, cls);
|
9260 | });
|
9261 | }
|
9262 | addClass(clone, moveClass);
|
9263 | clone.style.display = 'none';
|
9264 | this.$el.appendChild(clone);
|
9265 | var info = getTransitionInfo(clone);
|
9266 | this.$el.removeChild(clone);
|
9267 | return (this._hasMove = info.hasTransform);
|
9268 | }
|
9269 | }
|
9270 | };
|
9271 | function callPendingCbs(c) {
|
9272 |
|
9273 | if (c.elm._moveCb) {
|
9274 | c.elm._moveCb();
|
9275 | }
|
9276 |
|
9277 | if (c.elm._enterCb) {
|
9278 | c.elm._enterCb();
|
9279 | }
|
9280 | }
|
9281 | function recordPosition(c) {
|
9282 | c.data.newPos = c.elm.getBoundingClientRect();
|
9283 | }
|
9284 | function applyTranslation(c) {
|
9285 | var oldPos = c.data.pos;
|
9286 | var newPos = c.data.newPos;
|
9287 | var dx = oldPos.left - newPos.left;
|
9288 | var dy = oldPos.top - newPos.top;
|
9289 | if (dx || dy) {
|
9290 | c.data.moved = true;
|
9291 | var s = c.elm.style;
|
9292 | s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
|
9293 | s.transitionDuration = '0s';
|
9294 | }
|
9295 | }
|
9296 |
|
9297 | var platformComponents = {
|
9298 | Transition: Transition,
|
9299 | TransitionGroup: TransitionGroup
|
9300 | };
|
9301 |
|
9302 |
|
9303 | Vue.config.mustUseProp = mustUseProp;
|
9304 | Vue.config.isReservedTag = isReservedTag;
|
9305 | Vue.config.isReservedAttr = isReservedAttr;
|
9306 | Vue.config.getTagNamespace = getTagNamespace;
|
9307 | Vue.config.isUnknownElement = isUnknownElement;
|
9308 |
|
9309 | extend(Vue.options.directives, platformDirectives);
|
9310 | extend(Vue.options.components, platformComponents);
|
9311 |
|
9312 | Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
9313 |
|
9314 | Vue.prototype.$mount = function (el, hydrating) {
|
9315 | el = el && inBrowser ? query(el) : undefined;
|
9316 | return mountComponent(this, el, hydrating);
|
9317 | };
|
9318 |
|
9319 |
|
9320 | if (inBrowser) {
|
9321 | setTimeout(function () {
|
9322 | if (config.devtools) {
|
9323 | if (devtools) {
|
9324 | devtools.emit('init', Vue);
|
9325 | }
|
9326 | else {
|
9327 |
|
9328 | console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
|
9329 | 'https://github.com/vuejs/vue-devtools');
|
9330 | }
|
9331 | }
|
9332 | if (config.productionTip !== false &&
|
9333 | typeof console !== 'undefined') {
|
9334 |
|
9335 | console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
|
9336 | "Make sure to turn on production mode when deploying for production.\n" +
|
9337 | "See more tips at https://vuejs.org/guide/deployment.html");
|
9338 | }
|
9339 | }, 0);
|
9340 | }
|
9341 |
|
9342 | var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
9343 | var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
9344 | var buildRegex = cached(function (delimiters) {
|
9345 | var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
9346 | var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
9347 | return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
|
9348 | });
|
9349 | function parseText(text, delimiters) {
|
9350 |
|
9351 | var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
9352 | if (!tagRE.test(text)) {
|
9353 | return;
|
9354 | }
|
9355 | var tokens = [];
|
9356 | var rawTokens = [];
|
9357 | var lastIndex = (tagRE.lastIndex = 0);
|
9358 | var match, index, tokenValue;
|
9359 | while ((match = tagRE.exec(text))) {
|
9360 | index = match.index;
|
9361 |
|
9362 | if (index > lastIndex) {
|
9363 | rawTokens.push((tokenValue = text.slice(lastIndex, index)));
|
9364 | tokens.push(JSON.stringify(tokenValue));
|
9365 | }
|
9366 |
|
9367 | var exp = parseFilters(match[1].trim());
|
9368 | tokens.push("_s(".concat(exp, ")"));
|
9369 | rawTokens.push({ '@binding': exp });
|
9370 | lastIndex = index + match[0].length;
|
9371 | }
|
9372 | if (lastIndex < text.length) {
|
9373 | rawTokens.push((tokenValue = text.slice(lastIndex)));
|
9374 | tokens.push(JSON.stringify(tokenValue));
|
9375 | }
|
9376 | return {
|
9377 | expression: tokens.join('+'),
|
9378 | tokens: rawTokens
|
9379 | };
|
9380 | }
|
9381 |
|
9382 | function transformNode$1(el, options) {
|
9383 | var warn = options.warn || baseWarn;
|
9384 | var staticClass = getAndRemoveAttr(el, 'class');
|
9385 | if (staticClass) {
|
9386 | var res = parseText(staticClass, options.delimiters);
|
9387 | if (res) {
|
9388 | warn("class=\"".concat(staticClass, "\": ") +
|
9389 | 'Interpolation inside attributes has been removed. ' +
|
9390 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
9391 | 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
|
9392 | }
|
9393 | }
|
9394 | if (staticClass) {
|
9395 | el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
|
9396 | }
|
9397 | var classBinding = getBindingAttr(el, 'class', false );
|
9398 | if (classBinding) {
|
9399 | el.classBinding = classBinding;
|
9400 | }
|
9401 | }
|
9402 | function genData$2(el) {
|
9403 | var data = '';
|
9404 | if (el.staticClass) {
|
9405 | data += "staticClass:".concat(el.staticClass, ",");
|
9406 | }
|
9407 | if (el.classBinding) {
|
9408 | data += "class:".concat(el.classBinding, ",");
|
9409 | }
|
9410 | return data;
|
9411 | }
|
9412 | var klass = {
|
9413 | staticKeys: ['staticClass'],
|
9414 | transformNode: transformNode$1,
|
9415 | genData: genData$2
|
9416 | };
|
9417 |
|
9418 | function transformNode(el, options) {
|
9419 | var warn = options.warn || baseWarn;
|
9420 | var staticStyle = getAndRemoveAttr(el, 'style');
|
9421 | if (staticStyle) {
|
9422 |
|
9423 | {
|
9424 | var res = parseText(staticStyle, options.delimiters);
|
9425 | if (res) {
|
9426 | warn("style=\"".concat(staticStyle, "\": ") +
|
9427 | 'Interpolation inside attributes has been removed. ' +
|
9428 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
9429 | 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
|
9430 | }
|
9431 | }
|
9432 | el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9433 | }
|
9434 | var styleBinding = getBindingAttr(el, 'style', false );
|
9435 | if (styleBinding) {
|
9436 | el.styleBinding = styleBinding;
|
9437 | }
|
9438 | }
|
9439 | function genData$1(el) {
|
9440 | var data = '';
|
9441 | if (el.staticStyle) {
|
9442 | data += "staticStyle:".concat(el.staticStyle, ",");
|
9443 | }
|
9444 | if (el.styleBinding) {
|
9445 | data += "style:(".concat(el.styleBinding, "),");
|
9446 | }
|
9447 | return data;
|
9448 | }
|
9449 | var style = {
|
9450 | staticKeys: ['staticStyle'],
|
9451 | transformNode: transformNode,
|
9452 | genData: genData$1
|
9453 | };
|
9454 |
|
9455 | var decoder;
|
9456 | var he = {
|
9457 | decode: function (html) {
|
9458 | decoder = decoder || document.createElement('div');
|
9459 | decoder.innerHTML = html;
|
9460 | return decoder.textContent;
|
9461 | }
|
9462 | };
|
9463 |
|
9464 | var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9465 | 'link,meta,param,source,track,wbr');
|
9466 |
|
9467 |
|
9468 | var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
|
9469 |
|
9470 |
|
9471 | var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9472 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9473 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9474 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9475 | 'title,tr,track');
|
9476 |
|
9477 | |
9478 |
|
9479 |
|
9480 |
|
9481 | var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9482 | var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9483 | var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
|
9484 | var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
|
9485 | var startTagOpen = new RegExp("^<".concat(qnameCapture));
|
9486 | var startTagClose = /^\s*(\/?)>/;
|
9487 | var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
|
9488 | var doctype = /^<!DOCTYPE [^>]+>/i;
|
9489 |
|
9490 | var comment = /^<!\--/;
|
9491 | var conditionalComment = /^<!\[/;
|
9492 |
|
9493 | var isPlainTextElement = makeMap('script,style,textarea', true);
|
9494 | var reCache = {};
|
9495 | var decodingMap = {
|
9496 | '<': '<',
|
9497 | '>': '>',
|
9498 | '"': '"',
|
9499 | '&': '&',
|
9500 | ' ': '\n',
|
9501 | '	': '\t',
|
9502 | ''': "'"
|
9503 | };
|
9504 | var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
9505 | var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
9506 |
|
9507 | var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9508 | var shouldIgnoreFirstNewline = function (tag, html) {
|
9509 | return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
|
9510 | };
|
9511 | function decodeAttr(value, shouldDecodeNewlines) {
|
9512 | var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9513 | return value.replace(re, function (match) { return decodingMap[match]; });
|
9514 | }
|
9515 | function parseHTML(html, options) {
|
9516 | var stack = [];
|
9517 | var expectHTML = options.expectHTML;
|
9518 | var isUnaryTag = options.isUnaryTag || no;
|
9519 | var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
|
9520 | var index = 0;
|
9521 | var last, lastTag;
|
9522 | var _loop_1 = function () {
|
9523 | last = html;
|
9524 |
|
9525 | if (!lastTag || !isPlainTextElement(lastTag)) {
|
9526 | var textEnd = html.indexOf('<');
|
9527 | if (textEnd === 0) {
|
9528 |
|
9529 | if (comment.test(html)) {
|
9530 | var commentEnd = html.indexOf('-->');
|
9531 | if (commentEnd >= 0) {
|
9532 | if (options.shouldKeepComment && options.comment) {
|
9533 | options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9534 | }
|
9535 | advance(commentEnd + 3);
|
9536 | return "continue";
|
9537 | }
|
9538 | }
|
9539 |
|
9540 | if (conditionalComment.test(html)) {
|
9541 | var conditionalEnd = html.indexOf(']>');
|
9542 | if (conditionalEnd >= 0) {
|
9543 | advance(conditionalEnd + 2);
|
9544 | return "continue";
|
9545 | }
|
9546 | }
|
9547 |
|
9548 | var doctypeMatch = html.match(doctype);
|
9549 | if (doctypeMatch) {
|
9550 | advance(doctypeMatch[0].length);
|
9551 | return "continue";
|
9552 | }
|
9553 |
|
9554 | var endTagMatch = html.match(endTag);
|
9555 | if (endTagMatch) {
|
9556 | var curIndex = index;
|
9557 | advance(endTagMatch[0].length);
|
9558 | parseEndTag(endTagMatch[1], curIndex, index);
|
9559 | return "continue";
|
9560 | }
|
9561 |
|
9562 | var startTagMatch = parseStartTag();
|
9563 | if (startTagMatch) {
|
9564 | handleStartTag(startTagMatch);
|
9565 | if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9566 | advance(1);
|
9567 | }
|
9568 | return "continue";
|
9569 | }
|
9570 | }
|
9571 | var text = void 0, rest = void 0, next = void 0;
|
9572 | if (textEnd >= 0) {
|
9573 | rest = html.slice(textEnd);
|
9574 | while (!endTag.test(rest) &&
|
9575 | !startTagOpen.test(rest) &&
|
9576 | !comment.test(rest) &&
|
9577 | !conditionalComment.test(rest)) {
|
9578 |
|
9579 | next = rest.indexOf('<', 1);
|
9580 | if (next < 0)
|
9581 | break;
|
9582 | textEnd += next;
|
9583 | rest = html.slice(textEnd);
|
9584 | }
|
9585 | text = html.substring(0, textEnd);
|
9586 | }
|
9587 | if (textEnd < 0) {
|
9588 | text = html;
|
9589 | }
|
9590 | if (text) {
|
9591 | advance(text.length);
|
9592 | }
|
9593 | if (options.chars && text) {
|
9594 | options.chars(text, index - text.length, index);
|
9595 | }
|
9596 | }
|
9597 | else {
|
9598 | var endTagLength_1 = 0;
|
9599 | var stackedTag_1 = lastTag.toLowerCase();
|
9600 | var reStackedTag = reCache[stackedTag_1] ||
|
9601 | (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
|
9602 | var rest = html.replace(reStackedTag, function (all, text, endTag) {
|
9603 | endTagLength_1 = endTag.length;
|
9604 | if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
|
9605 | text = text
|
9606 | .replace(/<!\--([\s\S]*?)-->/g, '$1')
|
9607 | .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9608 | }
|
9609 | if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
|
9610 | text = text.slice(1);
|
9611 | }
|
9612 | if (options.chars) {
|
9613 | options.chars(text);
|
9614 | }
|
9615 | return '';
|
9616 | });
|
9617 | index += html.length - rest.length;
|
9618 | html = rest;
|
9619 | parseEndTag(stackedTag_1, index - endTagLength_1, index);
|
9620 | }
|
9621 | if (html === last) {
|
9622 | options.chars && options.chars(html);
|
9623 | if (!stack.length && options.warn) {
|
9624 | options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
|
9625 | start: index + html.length
|
9626 | });
|
9627 | }
|
9628 | return "break";
|
9629 | }
|
9630 | };
|
9631 | while (html) {
|
9632 | var state_1 = _loop_1();
|
9633 | if (state_1 === "break")
|
9634 | break;
|
9635 | }
|
9636 |
|
9637 | parseEndTag();
|
9638 | function advance(n) {
|
9639 | index += n;
|
9640 | html = html.substring(n);
|
9641 | }
|
9642 | function parseStartTag() {
|
9643 | var start = html.match(startTagOpen);
|
9644 | if (start) {
|
9645 | var match = {
|
9646 | tagName: start[1],
|
9647 | attrs: [],
|
9648 | start: index
|
9649 | };
|
9650 | advance(start[0].length);
|
9651 | var end = void 0, attr = void 0;
|
9652 | while (!(end = html.match(startTagClose)) &&
|
9653 | (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9654 | attr.start = index;
|
9655 | advance(attr[0].length);
|
9656 | attr.end = index;
|
9657 | match.attrs.push(attr);
|
9658 | }
|
9659 | if (end) {
|
9660 | match.unarySlash = end[1];
|
9661 | advance(end[0].length);
|
9662 | match.end = index;
|
9663 | return match;
|
9664 | }
|
9665 | }
|
9666 | }
|
9667 | function handleStartTag(match) {
|
9668 | var tagName = match.tagName;
|
9669 | var unarySlash = match.unarySlash;
|
9670 | if (expectHTML) {
|
9671 | if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9672 | parseEndTag(lastTag);
|
9673 | }
|
9674 | if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
|
9675 | parseEndTag(tagName);
|
9676 | }
|
9677 | }
|
9678 | var unary = isUnaryTag(tagName) || !!unarySlash;
|
9679 | var l = match.attrs.length;
|
9680 | var attrs = new Array(l);
|
9681 | for (var i = 0; i < l; i++) {
|
9682 | var args = match.attrs[i];
|
9683 | var value = args[3] || args[4] || args[5] || '';
|
9684 | var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9685 | ? options.shouldDecodeNewlinesForHref
|
9686 | : options.shouldDecodeNewlines;
|
9687 | attrs[i] = {
|
9688 | name: args[1],
|
9689 | value: decodeAttr(value, shouldDecodeNewlines)
|
9690 | };
|
9691 | if (options.outputSourceRange) {
|
9692 | attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9693 | attrs[i].end = args.end;
|
9694 | }
|
9695 | }
|
9696 | if (!unary) {
|
9697 | stack.push({
|
9698 | tag: tagName,
|
9699 | lowerCasedTag: tagName.toLowerCase(),
|
9700 | attrs: attrs,
|
9701 | start: match.start,
|
9702 | end: match.end
|
9703 | });
|
9704 | lastTag = tagName;
|
9705 | }
|
9706 | if (options.start) {
|
9707 | options.start(tagName, attrs, unary, match.start, match.end);
|
9708 | }
|
9709 | }
|
9710 | function parseEndTag(tagName, start, end) {
|
9711 | var pos, lowerCasedTagName;
|
9712 | if (start == null)
|
9713 | start = index;
|
9714 | if (end == null)
|
9715 | end = index;
|
9716 |
|
9717 | if (tagName) {
|
9718 | lowerCasedTagName = tagName.toLowerCase();
|
9719 | for (pos = stack.length - 1; pos >= 0; pos--) {
|
9720 | if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9721 | break;
|
9722 | }
|
9723 | }
|
9724 | }
|
9725 | else {
|
9726 |
|
9727 | pos = 0;
|
9728 | }
|
9729 | if (pos >= 0) {
|
9730 |
|
9731 | for (var i = stack.length - 1; i >= pos; i--) {
|
9732 | if ((i > pos || !tagName) && options.warn) {
|
9733 | options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
|
9734 | start: stack[i].start,
|
9735 | end: stack[i].end
|
9736 | });
|
9737 | }
|
9738 | if (options.end) {
|
9739 | options.end(stack[i].tag, start, end);
|
9740 | }
|
9741 | }
|
9742 |
|
9743 | stack.length = pos;
|
9744 | lastTag = pos && stack[pos - 1].tag;
|
9745 | }
|
9746 | else if (lowerCasedTagName === 'br') {
|
9747 | if (options.start) {
|
9748 | options.start(tagName, [], true, start, end);
|
9749 | }
|
9750 | }
|
9751 | else if (lowerCasedTagName === 'p') {
|
9752 | if (options.start) {
|
9753 | options.start(tagName, [], false, start, end);
|
9754 | }
|
9755 | if (options.end) {
|
9756 | options.end(tagName, start, end);
|
9757 | }
|
9758 | }
|
9759 | }
|
9760 | }
|
9761 |
|
9762 | var onRE = /^@|^v-on:/;
|
9763 | var dirRE = /^v-|^@|^:|^#/;
|
9764 | var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9765 | var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9766 | var stripParensRE = /^\(|\)$/g;
|
9767 | var dynamicArgRE = /^\[.*\]$/;
|
9768 | var argRE = /:(.*)$/;
|
9769 | var bindRE = /^:|^\.|^v-bind:/;
|
9770 | var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
9771 | var slotRE = /^v-slot(:|$)|^#/;
|
9772 | var lineBreakRE = /[\r\n]/;
|
9773 | var whitespaceRE = /[ \f\t\r\n]+/g;
|
9774 | var invalidAttributeRE = /[\s"'<>\/=]/;
|
9775 | var decodeHTMLCached = cached(he.decode);
|
9776 | var emptySlotScopeToken = "_empty_";
|
9777 |
|
9778 | var warn;
|
9779 | var delimiters;
|
9780 | var transforms;
|
9781 | var preTransforms;
|
9782 | var postTransforms;
|
9783 | var platformIsPreTag;
|
9784 | var platformMustUseProp;
|
9785 | var platformGetTagNamespace;
|
9786 | var maybeComponent;
|
9787 | function createASTElement(tag, attrs, parent) {
|
9788 | return {
|
9789 | type: 1,
|
9790 | tag: tag,
|
9791 | attrsList: attrs,
|
9792 | attrsMap: makeAttrsMap(attrs),
|
9793 | rawAttrsMap: {},
|
9794 | parent: parent,
|
9795 | children: []
|
9796 | };
|
9797 | }
|
9798 | |
9799 |
|
9800 |
|
9801 | function parse(template, options) {
|
9802 | warn = options.warn || baseWarn;
|
9803 | platformIsPreTag = options.isPreTag || no;
|
9804 | platformMustUseProp = options.mustUseProp || no;
|
9805 | platformGetTagNamespace = options.getTagNamespace || no;
|
9806 | var isReservedTag = options.isReservedTag || no;
|
9807 | maybeComponent = function (el) {
|
9808 | return !!(el.component ||
|
9809 | el.attrsMap[':is'] ||
|
9810 | el.attrsMap['v-bind:is'] ||
|
9811 | !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
|
9812 | };
|
9813 | transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9814 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9815 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9816 | delimiters = options.delimiters;
|
9817 | var stack = [];
|
9818 | var preserveWhitespace = options.preserveWhitespace !== false;
|
9819 | var whitespaceOption = options.whitespace;
|
9820 | var root;
|
9821 | var currentParent;
|
9822 | var inVPre = false;
|
9823 | var inPre = false;
|
9824 | var warned = false;
|
9825 | function warnOnce(msg, range) {
|
9826 | if (!warned) {
|
9827 | warned = true;
|
9828 | warn(msg, range);
|
9829 | }
|
9830 | }
|
9831 | function closeElement(element) {
|
9832 | trimEndingWhitespace(element);
|
9833 | if (!inVPre && !element.processed) {
|
9834 | element = processElement(element, options);
|
9835 | }
|
9836 |
|
9837 | if (!stack.length && element !== root) {
|
9838 |
|
9839 | if (root.if && (element.elseif || element.else)) {
|
9840 | {
|
9841 | checkRootConstraints(element);
|
9842 | }
|
9843 | addIfCondition(root, {
|
9844 | exp: element.elseif,
|
9845 | block: element
|
9846 | });
|
9847 | }
|
9848 | else {
|
9849 | warnOnce("Component template should contain exactly one root element. " +
|
9850 | "If you are using v-if on multiple elements, " +
|
9851 | "use v-else-if to chain them instead.", { start: element.start });
|
9852 | }
|
9853 | }
|
9854 | if (currentParent && !element.forbidden) {
|
9855 | if (element.elseif || element.else) {
|
9856 | processIfConditions(element, currentParent);
|
9857 | }
|
9858 | else {
|
9859 | if (element.slotScope) {
|
9860 |
|
9861 |
|
9862 |
|
9863 | var name_1 = element.slotTarget || '"default"';
|
9864 | (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
|
9865 | }
|
9866 | currentParent.children.push(element);
|
9867 | element.parent = currentParent;
|
9868 | }
|
9869 | }
|
9870 |
|
9871 |
|
9872 | element.children = element.children.filter(function (c) { return !c.slotScope; });
|
9873 |
|
9874 | trimEndingWhitespace(element);
|
9875 |
|
9876 | if (element.pre) {
|
9877 | inVPre = false;
|
9878 | }
|
9879 | if (platformIsPreTag(element.tag)) {
|
9880 | inPre = false;
|
9881 | }
|
9882 |
|
9883 | for (var i = 0; i < postTransforms.length; i++) {
|
9884 | postTransforms[i](element, options);
|
9885 | }
|
9886 | }
|
9887 | function trimEndingWhitespace(el) {
|
9888 |
|
9889 | if (!inPre) {
|
9890 | var lastNode = void 0;
|
9891 | while ((lastNode = el.children[el.children.length - 1]) &&
|
9892 | lastNode.type === 3 &&
|
9893 | lastNode.text === ' ') {
|
9894 | el.children.pop();
|
9895 | }
|
9896 | }
|
9897 | }
|
9898 | function checkRootConstraints(el) {
|
9899 | if (el.tag === 'slot' || el.tag === 'template') {
|
9900 | warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
|
9901 | 'contain multiple nodes.', { start: el.start });
|
9902 | }
|
9903 | if (el.attrsMap.hasOwnProperty('v-for')) {
|
9904 | warnOnce('Cannot use v-for on stateful component root element because ' +
|
9905 | 'it renders multiple elements.', el.rawAttrsMap['v-for']);
|
9906 | }
|
9907 | }
|
9908 | parseHTML(template, {
|
9909 | warn: warn,
|
9910 | expectHTML: options.expectHTML,
|
9911 | isUnaryTag: options.isUnaryTag,
|
9912 | canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9913 | shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9914 | shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9915 | shouldKeepComment: options.comments,
|
9916 | outputSourceRange: options.outputSourceRange,
|
9917 | start: function (tag, attrs, unary, start, end) {
|
9918 |
|
9919 |
|
9920 | var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9921 |
|
9922 |
|
9923 | if (isIE && ns === 'svg') {
|
9924 | attrs = guardIESVGBug(attrs);
|
9925 | }
|
9926 | var element = createASTElement(tag, attrs, currentParent);
|
9927 | if (ns) {
|
9928 | element.ns = ns;
|
9929 | }
|
9930 | {
|
9931 | if (options.outputSourceRange) {
|
9932 | element.start = start;
|
9933 | element.end = end;
|
9934 | element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9935 | cumulated[attr.name] = attr;
|
9936 | return cumulated;
|
9937 | }, {});
|
9938 | }
|
9939 | attrs.forEach(function (attr) {
|
9940 | if (invalidAttributeRE.test(attr.name)) {
|
9941 | warn("Invalid dynamic argument expression: attribute names cannot contain " +
|
9942 | "spaces, quotes, <, >, / or =.", options.outputSourceRange
|
9943 | ? {
|
9944 | start: attr.start + attr.name.indexOf("["),
|
9945 | end: attr.start + attr.name.length
|
9946 | }
|
9947 | : undefined);
|
9948 | }
|
9949 | });
|
9950 | }
|
9951 | if (isForbiddenTag(element) && !isServerRendering()) {
|
9952 | element.forbidden = true;
|
9953 | warn('Templates should only be responsible for mapping the state to the ' +
|
9954 | 'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9955 | "<".concat(tag, ">") +
|
9956 | ', as they will not be parsed.', { start: element.start });
|
9957 | }
|
9958 |
|
9959 | for (var i = 0; i < preTransforms.length; i++) {
|
9960 | element = preTransforms[i](element, options) || element;
|
9961 | }
|
9962 | if (!inVPre) {
|
9963 | processPre(element);
|
9964 | if (element.pre) {
|
9965 | inVPre = true;
|
9966 | }
|
9967 | }
|
9968 | if (platformIsPreTag(element.tag)) {
|
9969 | inPre = true;
|
9970 | }
|
9971 | if (inVPre) {
|
9972 | processRawAttrs(element);
|
9973 | }
|
9974 | else if (!element.processed) {
|
9975 |
|
9976 | processFor(element);
|
9977 | processIf(element);
|
9978 | processOnce(element);
|
9979 | }
|
9980 | if (!root) {
|
9981 | root = element;
|
9982 | {
|
9983 | checkRootConstraints(root);
|
9984 | }
|
9985 | }
|
9986 | if (!unary) {
|
9987 | currentParent = element;
|
9988 | stack.push(element);
|
9989 | }
|
9990 | else {
|
9991 | closeElement(element);
|
9992 | }
|
9993 | },
|
9994 | end: function (tag, start, end) {
|
9995 | var element = stack[stack.length - 1];
|
9996 |
|
9997 | stack.length -= 1;
|
9998 | currentParent = stack[stack.length - 1];
|
9999 | if (options.outputSourceRange) {
|
10000 | element.end = end;
|
10001 | }
|
10002 | closeElement(element);
|
10003 | },
|
10004 | chars: function (text, start, end) {
|
10005 | if (!currentParent) {
|
10006 | {
|
10007 | if (text === template) {
|
10008 | warnOnce('Component template requires a root element, rather than just text.', { start: start });
|
10009 | }
|
10010 | else if ((text = text.trim())) {
|
10011 | warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
|
10012 | start: start
|
10013 | });
|
10014 | }
|
10015 | }
|
10016 | return;
|
10017 | }
|
10018 |
|
10019 |
|
10020 | if (isIE &&
|
10021 | currentParent.tag === 'textarea' &&
|
10022 | currentParent.attrsMap.placeholder === text) {
|
10023 | return;
|
10024 | }
|
10025 | var children = currentParent.children;
|
10026 | if (inPre || text.trim()) {
|
10027 | text = isTextTag(currentParent)
|
10028 | ? text
|
10029 | : decodeHTMLCached(text);
|
10030 | }
|
10031 | else if (!children.length) {
|
10032 |
|
10033 | text = '';
|
10034 | }
|
10035 | else if (whitespaceOption) {
|
10036 | if (whitespaceOption === 'condense') {
|
10037 |
|
10038 |
|
10039 | text = lineBreakRE.test(text) ? '' : ' ';
|
10040 | }
|
10041 | else {
|
10042 | text = ' ';
|
10043 | }
|
10044 | }
|
10045 | else {
|
10046 | text = preserveWhitespace ? ' ' : '';
|
10047 | }
|
10048 | if (text) {
|
10049 | if (!inPre && whitespaceOption === 'condense') {
|
10050 |
|
10051 | text = text.replace(whitespaceRE, ' ');
|
10052 | }
|
10053 | var res = void 0;
|
10054 | var child = void 0;
|
10055 | if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
10056 | child = {
|
10057 | type: 2,
|
10058 | expression: res.expression,
|
10059 | tokens: res.tokens,
|
10060 | text: text
|
10061 | };
|
10062 | }
|
10063 | else if (text !== ' ' ||
|
10064 | !children.length ||
|
10065 | children[children.length - 1].text !== ' ') {
|
10066 | child = {
|
10067 | type: 3,
|
10068 | text: text
|
10069 | };
|
10070 | }
|
10071 | if (child) {
|
10072 | if (options.outputSourceRange) {
|
10073 | child.start = start;
|
10074 | child.end = end;
|
10075 | }
|
10076 | children.push(child);
|
10077 | }
|
10078 | }
|
10079 | },
|
10080 | comment: function (text, start, end) {
|
10081 |
|
10082 |
|
10083 | if (currentParent) {
|
10084 | var child = {
|
10085 | type: 3,
|
10086 | text: text,
|
10087 | isComment: true
|
10088 | };
|
10089 | if (options.outputSourceRange) {
|
10090 | child.start = start;
|
10091 | child.end = end;
|
10092 | }
|
10093 | currentParent.children.push(child);
|
10094 | }
|
10095 | }
|
10096 | });
|
10097 | return root;
|
10098 | }
|
10099 | function processPre(el) {
|
10100 | if (getAndRemoveAttr(el, 'v-pre') != null) {
|
10101 | el.pre = true;
|
10102 | }
|
10103 | }
|
10104 | function processRawAttrs(el) {
|
10105 | var list = el.attrsList;
|
10106 | var len = list.length;
|
10107 | if (len) {
|
10108 | var attrs = (el.attrs = new Array(len));
|
10109 | for (var i = 0; i < len; i++) {
|
10110 | attrs[i] = {
|
10111 | name: list[i].name,
|
10112 | value: JSON.stringify(list[i].value)
|
10113 | };
|
10114 | if (list[i].start != null) {
|
10115 | attrs[i].start = list[i].start;
|
10116 | attrs[i].end = list[i].end;
|
10117 | }
|
10118 | }
|
10119 | }
|
10120 | else if (!el.pre) {
|
10121 |
|
10122 | el.plain = true;
|
10123 | }
|
10124 | }
|
10125 | function processElement(element, options) {
|
10126 | processKey(element);
|
10127 |
|
10128 |
|
10129 | element.plain =
|
10130 | !element.key && !element.scopedSlots && !element.attrsList.length;
|
10131 | processRef(element);
|
10132 | processSlotContent(element);
|
10133 | processSlotOutlet(element);
|
10134 | processComponent(element);
|
10135 | for (var i = 0; i < transforms.length; i++) {
|
10136 | element = transforms[i](element, options) || element;
|
10137 | }
|
10138 | processAttrs(element);
|
10139 | return element;
|
10140 | }
|
10141 | function processKey(el) {
|
10142 | var exp = getBindingAttr(el, 'key');
|
10143 | if (exp) {
|
10144 | {
|
10145 | if (el.tag === 'template') {
|
10146 | warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
|
10147 | }
|
10148 | if (el.for) {
|
10149 | var iterator = el.iterator2 || el.iterator1;
|
10150 | var parent_1 = el.parent;
|
10151 | if (iterator &&
|
10152 | iterator === exp &&
|
10153 | parent_1 &&
|
10154 | parent_1.tag === 'transition-group') {
|
10155 | warn("Do not use v-for index as key on <transition-group> children, " +
|
10156 | "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true );
|
10157 | }
|
10158 | }
|
10159 | }
|
10160 | el.key = exp;
|
10161 | }
|
10162 | }
|
10163 | function processRef(el) {
|
10164 | var ref = getBindingAttr(el, 'ref');
|
10165 | if (ref) {
|
10166 | el.ref = ref;
|
10167 | el.refInFor = checkInFor(el);
|
10168 | }
|
10169 | }
|
10170 | function processFor(el) {
|
10171 | var exp;
|
10172 | if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
10173 | var res = parseFor(exp);
|
10174 | if (res) {
|
10175 | extend(el, res);
|
10176 | }
|
10177 | else {
|
10178 | warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
|
10179 | }
|
10180 | }
|
10181 | }
|
10182 | function parseFor(exp) {
|
10183 | var inMatch = exp.match(forAliasRE);
|
10184 | if (!inMatch)
|
10185 | return;
|
10186 | var res = {};
|
10187 | res.for = inMatch[2].trim();
|
10188 | var alias = inMatch[1].trim().replace(stripParensRE, '');
|
10189 | var iteratorMatch = alias.match(forIteratorRE);
|
10190 | if (iteratorMatch) {
|
10191 | res.alias = alias.replace(forIteratorRE, '').trim();
|
10192 | res.iterator1 = iteratorMatch[1].trim();
|
10193 | if (iteratorMatch[2]) {
|
10194 | res.iterator2 = iteratorMatch[2].trim();
|
10195 | }
|
10196 | }
|
10197 | else {
|
10198 | res.alias = alias;
|
10199 | }
|
10200 | return res;
|
10201 | }
|
10202 | function processIf(el) {
|
10203 | var exp = getAndRemoveAttr(el, 'v-if');
|
10204 | if (exp) {
|
10205 | el.if = exp;
|
10206 | addIfCondition(el, {
|
10207 | exp: exp,
|
10208 | block: el
|
10209 | });
|
10210 | }
|
10211 | else {
|
10212 | if (getAndRemoveAttr(el, 'v-else') != null) {
|
10213 | el.else = true;
|
10214 | }
|
10215 | var elseif = getAndRemoveAttr(el, 'v-else-if');
|
10216 | if (elseif) {
|
10217 | el.elseif = elseif;
|
10218 | }
|
10219 | }
|
10220 | }
|
10221 | function processIfConditions(el, parent) {
|
10222 | var prev = findPrevElement(parent.children);
|
10223 | if (prev && prev.if) {
|
10224 | addIfCondition(prev, {
|
10225 | exp: el.elseif,
|
10226 | block: el
|
10227 | });
|
10228 | }
|
10229 | else {
|
10230 | warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
|
10231 | "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
|
10232 | }
|
10233 | }
|
10234 | function findPrevElement(children) {
|
10235 | var i = children.length;
|
10236 | while (i--) {
|
10237 | if (children[i].type === 1) {
|
10238 | return children[i];
|
10239 | }
|
10240 | else {
|
10241 | if (children[i].text !== ' ') {
|
10242 | warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
|
10243 | "will be ignored.", children[i]);
|
10244 | }
|
10245 | children.pop();
|
10246 | }
|
10247 | }
|
10248 | }
|
10249 | function addIfCondition(el, condition) {
|
10250 | if (!el.ifConditions) {
|
10251 | el.ifConditions = [];
|
10252 | }
|
10253 | el.ifConditions.push(condition);
|
10254 | }
|
10255 | function processOnce(el) {
|
10256 | var once = getAndRemoveAttr(el, 'v-once');
|
10257 | if (once != null) {
|
10258 | el.once = true;
|
10259 | }
|
10260 | }
|
10261 |
|
10262 |
|
10263 | function processSlotContent(el) {
|
10264 | var slotScope;
|
10265 | if (el.tag === 'template') {
|
10266 | slotScope = getAndRemoveAttr(el, 'scope');
|
10267 |
|
10268 | if (slotScope) {
|
10269 | warn("the \"scope\" attribute for scoped slots have been deprecated and " +
|
10270 | "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
10271 | "can also be used on plain elements in addition to <template> to " +
|
10272 | "denote scoped slots.", el.rawAttrsMap['scope'], true);
|
10273 | }
|
10274 | el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
10275 | }
|
10276 | else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
10277 |
|
10278 | if (el.attrsMap['v-for']) {
|
10279 | warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
|
10280 | "(v-for takes higher priority). Use a wrapper <template> for the " +
|
10281 | "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
|
10282 | }
|
10283 | el.slotScope = slotScope;
|
10284 | }
|
10285 |
|
10286 | var slotTarget = getBindingAttr(el, 'slot');
|
10287 | if (slotTarget) {
|
10288 | el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
10289 | el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
10290 |
|
10291 |
|
10292 | if (el.tag !== 'template' && !el.slotScope) {
|
10293 | addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
10294 | }
|
10295 | }
|
10296 |
|
10297 | {
|
10298 | if (el.tag === 'template') {
|
10299 |
|
10300 | var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10301 | if (slotBinding) {
|
10302 | {
|
10303 | if (el.slotTarget || el.slotScope) {
|
10304 | warn("Unexpected mixed usage of different slot syntaxes.", el);
|
10305 | }
|
10306 | if (el.parent && !maybeComponent(el.parent)) {
|
10307 | warn("<template v-slot> can only appear at the root level inside " +
|
10308 | "the receiving component", el);
|
10309 | }
|
10310 | }
|
10311 | var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
|
10312 | el.slotTarget = name_2;
|
10313 | el.slotTargetDynamic = dynamic;
|
10314 | el.slotScope = slotBinding.value || emptySlotScopeToken;
|
10315 | }
|
10316 | }
|
10317 | else {
|
10318 |
|
10319 | var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10320 | if (slotBinding) {
|
10321 | {
|
10322 | if (!maybeComponent(el)) {
|
10323 | warn("v-slot can only be used on components or <template>.", slotBinding);
|
10324 | }
|
10325 | if (el.slotScope || el.slotTarget) {
|
10326 | warn("Unexpected mixed usage of different slot syntaxes.", el);
|
10327 | }
|
10328 | if (el.scopedSlots) {
|
10329 | warn("To avoid scope ambiguity, the default slot should also use " +
|
10330 | "<template> syntax when there are other named slots.", slotBinding);
|
10331 | }
|
10332 | }
|
10333 |
|
10334 | var slots = el.scopedSlots || (el.scopedSlots = {});
|
10335 | var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
|
10336 | var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
|
10337 | slotContainer_1.slotTarget = name_3;
|
10338 | slotContainer_1.slotTargetDynamic = dynamic;
|
10339 | slotContainer_1.children = el.children.filter(function (c) {
|
10340 | if (!c.slotScope) {
|
10341 | c.parent = slotContainer_1;
|
10342 | return true;
|
10343 | }
|
10344 | });
|
10345 | slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
|
10346 |
|
10347 | el.children = [];
|
10348 |
|
10349 | el.plain = false;
|
10350 | }
|
10351 | }
|
10352 | }
|
10353 | }
|
10354 | function getSlotName(binding) {
|
10355 | var name = binding.name.replace(slotRE, '');
|
10356 | if (!name) {
|
10357 | if (binding.name[0] !== '#') {
|
10358 | name = 'default';
|
10359 | }
|
10360 | else {
|
10361 | warn("v-slot shorthand syntax requires a slot name.", binding);
|
10362 | }
|
10363 | }
|
10364 | return dynamicArgRE.test(name)
|
10365 | ?
|
10366 | { name: name.slice(1, -1), dynamic: true }
|
10367 | :
|
10368 | { name: "\"".concat(name, "\""), dynamic: false };
|
10369 | }
|
10370 |
|
10371 | function processSlotOutlet(el) {
|
10372 | if (el.tag === 'slot') {
|
10373 | el.slotName = getBindingAttr(el, 'name');
|
10374 | if (el.key) {
|
10375 | warn("`key` does not work on <slot> because slots are abstract outlets " +
|
10376 | "and can possibly expand into multiple elements. " +
|
10377 | "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
|
10378 | }
|
10379 | }
|
10380 | }
|
10381 | function processComponent(el) {
|
10382 | var binding;
|
10383 | if ((binding = getBindingAttr(el, 'is'))) {
|
10384 | el.component = binding;
|
10385 | }
|
10386 | if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10387 | el.inlineTemplate = true;
|
10388 | }
|
10389 | }
|
10390 | function processAttrs(el) {
|
10391 | var list = el.attrsList;
|
10392 | var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10393 | for (i = 0, l = list.length; i < l; i++) {
|
10394 | name = rawName = list[i].name;
|
10395 | value = list[i].value;
|
10396 | if (dirRE.test(name)) {
|
10397 |
|
10398 | el.hasBindings = true;
|
10399 |
|
10400 | modifiers = parseModifiers(name.replace(dirRE, ''));
|
10401 |
|
10402 | if (modifiers) {
|
10403 | name = name.replace(modifierRE, '');
|
10404 | }
|
10405 | if (bindRE.test(name)) {
|
10406 |
|
10407 | name = name.replace(bindRE, '');
|
10408 | value = parseFilters(value);
|
10409 | isDynamic = dynamicArgRE.test(name);
|
10410 | if (isDynamic) {
|
10411 | name = name.slice(1, -1);
|
10412 | }
|
10413 | if (value.trim().length === 0) {
|
10414 | warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
|
10415 | }
|
10416 | if (modifiers) {
|
10417 | if (modifiers.prop && !isDynamic) {
|
10418 | name = camelize(name);
|
10419 | if (name === 'innerHtml')
|
10420 | name = 'innerHTML';
|
10421 | }
|
10422 | if (modifiers.camel && !isDynamic) {
|
10423 | name = camelize(name);
|
10424 | }
|
10425 | if (modifiers.sync) {
|
10426 | syncGen = genAssignmentCode(value, "$event");
|
10427 | if (!isDynamic) {
|
10428 | addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
|
10429 | if (hyphenate(name) !== camelize(name)) {
|
10430 | addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
|
10431 | }
|
10432 | }
|
10433 | else {
|
10434 |
|
10435 | addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true
|
10436 | );
|
10437 | }
|
10438 | }
|
10439 | }
|
10440 | if ((modifiers && modifiers.prop) ||
|
10441 | (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
|
10442 | addProp(el, name, value, list[i], isDynamic);
|
10443 | }
|
10444 | else {
|
10445 | addAttr(el, name, value, list[i], isDynamic);
|
10446 | }
|
10447 | }
|
10448 | else if (onRE.test(name)) {
|
10449 |
|
10450 | name = name.replace(onRE, '');
|
10451 | isDynamic = dynamicArgRE.test(name);
|
10452 | if (isDynamic) {
|
10453 | name = name.slice(1, -1);
|
10454 | }
|
10455 | addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
|
10456 | }
|
10457 | else {
|
10458 |
|
10459 | name = name.replace(dirRE, '');
|
10460 |
|
10461 | var argMatch = name.match(argRE);
|
10462 | var arg = argMatch && argMatch[1];
|
10463 | isDynamic = false;
|
10464 | if (arg) {
|
10465 | name = name.slice(0, -(arg.length + 1));
|
10466 | if (dynamicArgRE.test(arg)) {
|
10467 | arg = arg.slice(1, -1);
|
10468 | isDynamic = true;
|
10469 | }
|
10470 | }
|
10471 | addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10472 | if (name === 'model') {
|
10473 | checkForAliasModel(el, value);
|
10474 | }
|
10475 | }
|
10476 | }
|
10477 | else {
|
10478 |
|
10479 | {
|
10480 | var res = parseText(value, delimiters);
|
10481 | if (res) {
|
10482 | warn("".concat(name, "=\"").concat(value, "\": ") +
|
10483 | 'Interpolation inside attributes has been removed. ' +
|
10484 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
10485 | 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
|
10486 | }
|
10487 | }
|
10488 | addAttr(el, name, JSON.stringify(value), list[i]);
|
10489 |
|
10490 |
|
10491 | if (!el.component &&
|
10492 | name === 'muted' &&
|
10493 | platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10494 | addProp(el, name, 'true', list[i]);
|
10495 | }
|
10496 | }
|
10497 | }
|
10498 | }
|
10499 | function checkInFor(el) {
|
10500 | var parent = el;
|
10501 | while (parent) {
|
10502 | if (parent.for !== undefined) {
|
10503 | return true;
|
10504 | }
|
10505 | parent = parent.parent;
|
10506 | }
|
10507 | return false;
|
10508 | }
|
10509 | function parseModifiers(name) {
|
10510 | var match = name.match(modifierRE);
|
10511 | if (match) {
|
10512 | var ret_1 = {};
|
10513 | match.forEach(function (m) {
|
10514 | ret_1[m.slice(1)] = true;
|
10515 | });
|
10516 | return ret_1;
|
10517 | }
|
10518 | }
|
10519 | function makeAttrsMap(attrs) {
|
10520 | var map = {};
|
10521 | for (var i = 0, l = attrs.length; i < l; i++) {
|
10522 | if (map[attrs[i].name] && !isIE && !isEdge) {
|
10523 | warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10524 | }
|
10525 | map[attrs[i].name] = attrs[i].value;
|
10526 | }
|
10527 | return map;
|
10528 | }
|
10529 |
|
10530 | function isTextTag(el) {
|
10531 | return el.tag === 'script' || el.tag === 'style';
|
10532 | }
|
10533 | function isForbiddenTag(el) {
|
10534 | return (el.tag === 'style' ||
|
10535 | (el.tag === 'script' &&
|
10536 | (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
|
10537 | }
|
10538 | var ieNSBug = /^xmlns:NS\d+/;
|
10539 | var ieNSPrefix = /^NS\d+:/;
|
10540 |
|
10541 | function guardIESVGBug(attrs) {
|
10542 | var res = [];
|
10543 | for (var i = 0; i < attrs.length; i++) {
|
10544 | var attr = attrs[i];
|
10545 | if (!ieNSBug.test(attr.name)) {
|
10546 | attr.name = attr.name.replace(ieNSPrefix, '');
|
10547 | res.push(attr);
|
10548 | }
|
10549 | }
|
10550 | return res;
|
10551 | }
|
10552 | function checkForAliasModel(el, value) {
|
10553 | var _el = el;
|
10554 | while (_el) {
|
10555 | if (_el.for && _el.alias === value) {
|
10556 | warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
|
10557 | "You are binding v-model directly to a v-for iteration alias. " +
|
10558 | "This will not be able to modify the v-for source array because " +
|
10559 | "writing to the alias is like modifying a function local variable. " +
|
10560 | "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
|
10561 | }
|
10562 | _el = _el.parent;
|
10563 | }
|
10564 | }
|
10565 |
|
10566 | |
10567 |
|
10568 |
|
10569 |
|
10570 |
|
10571 |
|
10572 |
|
10573 |
|
10574 |
|
10575 | function preTransformNode(el, options) {
|
10576 | if (el.tag === 'input') {
|
10577 | var map = el.attrsMap;
|
10578 | if (!map['v-model']) {
|
10579 | return;
|
10580 | }
|
10581 | var typeBinding = void 0;
|
10582 | if (map[':type'] || map['v-bind:type']) {
|
10583 | typeBinding = getBindingAttr(el, 'type');
|
10584 | }
|
10585 | if (!map.type && !typeBinding && map['v-bind']) {
|
10586 | typeBinding = "(".concat(map['v-bind'], ").type");
|
10587 | }
|
10588 | if (typeBinding) {
|
10589 | var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10590 | var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
|
10591 | var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10592 | var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10593 |
|
10594 | var branch0 = cloneASTElement(el);
|
10595 |
|
10596 | processFor(branch0);
|
10597 | addRawAttr(branch0, 'type', 'checkbox');
|
10598 | processElement(branch0, options);
|
10599 | branch0.processed = true;
|
10600 | branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
|
10601 | addIfCondition(branch0, {
|
10602 | exp: branch0.if,
|
10603 | block: branch0
|
10604 | });
|
10605 |
|
10606 | var branch1 = cloneASTElement(el);
|
10607 | getAndRemoveAttr(branch1, 'v-for', true);
|
10608 | addRawAttr(branch1, 'type', 'radio');
|
10609 | processElement(branch1, options);
|
10610 | addIfCondition(branch0, {
|
10611 | exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
|
10612 | block: branch1
|
10613 | });
|
10614 |
|
10615 | var branch2 = cloneASTElement(el);
|
10616 | getAndRemoveAttr(branch2, 'v-for', true);
|
10617 | addRawAttr(branch2, ':type', typeBinding);
|
10618 | processElement(branch2, options);
|
10619 | addIfCondition(branch0, {
|
10620 | exp: ifCondition,
|
10621 | block: branch2
|
10622 | });
|
10623 | if (hasElse) {
|
10624 | branch0.else = true;
|
10625 | }
|
10626 | else if (elseIfCondition) {
|
10627 | branch0.elseif = elseIfCondition;
|
10628 | }
|
10629 | return branch0;
|
10630 | }
|
10631 | }
|
10632 | }
|
10633 | function cloneASTElement(el) {
|
10634 | return createASTElement(el.tag, el.attrsList.slice(), el.parent);
|
10635 | }
|
10636 | var model = {
|
10637 | preTransformNode: preTransformNode
|
10638 | };
|
10639 |
|
10640 | var modules = [klass, style, model];
|
10641 |
|
10642 | function text(el, dir) {
|
10643 | if (dir.value) {
|
10644 | addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
|
10645 | }
|
10646 | }
|
10647 |
|
10648 | function html(el, dir) {
|
10649 | if (dir.value) {
|
10650 | addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
|
10651 | }
|
10652 | }
|
10653 |
|
10654 | var directives = {
|
10655 | model: model$1,
|
10656 | text: text,
|
10657 | html: html
|
10658 | };
|
10659 |
|
10660 | var baseOptions = {
|
10661 | expectHTML: true,
|
10662 | modules: modules,
|
10663 | directives: directives,
|
10664 | isPreTag: isPreTag,
|
10665 | isUnaryTag: isUnaryTag,
|
10666 | mustUseProp: mustUseProp,
|
10667 | canBeLeftOpenTag: canBeLeftOpenTag,
|
10668 | isReservedTag: isReservedTag,
|
10669 | getTagNamespace: getTagNamespace,
|
10670 | staticKeys: genStaticKeys$1(modules)
|
10671 | };
|
10672 |
|
10673 | var isStaticKey;
|
10674 | var isPlatformReservedTag;
|
10675 | var genStaticKeysCached = cached(genStaticKeys);
|
10676 | |
10677 |
|
10678 |
|
10679 |
|
10680 |
|
10681 |
|
10682 |
|
10683 |
|
10684 |
|
10685 |
|
10686 |
|
10687 | function optimize(root, options) {
|
10688 | if (!root)
|
10689 | return;
|
10690 | isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10691 | isPlatformReservedTag = options.isReservedTag || no;
|
10692 |
|
10693 | markStatic(root);
|
10694 |
|
10695 | markStaticRoots(root, false);
|
10696 | }
|
10697 | function genStaticKeys(keys) {
|
10698 | return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10699 | (keys ? ',' + keys : ''));
|
10700 | }
|
10701 | function markStatic(node) {
|
10702 | node.static = isStatic(node);
|
10703 | if (node.type === 1) {
|
10704 |
|
10705 |
|
10706 |
|
10707 | if (!isPlatformReservedTag(node.tag) &&
|
10708 | node.tag !== 'slot' &&
|
10709 | node.attrsMap['inline-template'] == null) {
|
10710 | return;
|
10711 | }
|
10712 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10713 | var child = node.children[i];
|
10714 | markStatic(child);
|
10715 | if (!child.static) {
|
10716 | node.static = false;
|
10717 | }
|
10718 | }
|
10719 | if (node.ifConditions) {
|
10720 | for (var i = 1, l = node.ifConditions.length; i < l; i++) {
|
10721 | var block = node.ifConditions[i].block;
|
10722 | markStatic(block);
|
10723 | if (!block.static) {
|
10724 | node.static = false;
|
10725 | }
|
10726 | }
|
10727 | }
|
10728 | }
|
10729 | }
|
10730 | function markStaticRoots(node, isInFor) {
|
10731 | if (node.type === 1) {
|
10732 | if (node.static || node.once) {
|
10733 | node.staticInFor = isInFor;
|
10734 | }
|
10735 |
|
10736 |
|
10737 |
|
10738 | if (node.static &&
|
10739 | node.children.length &&
|
10740 | !(node.children.length === 1 && node.children[0].type === 3)) {
|
10741 | node.staticRoot = true;
|
10742 | return;
|
10743 | }
|
10744 | else {
|
10745 | node.staticRoot = false;
|
10746 | }
|
10747 | if (node.children) {
|
10748 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10749 | markStaticRoots(node.children[i], isInFor || !!node.for);
|
10750 | }
|
10751 | }
|
10752 | if (node.ifConditions) {
|
10753 | for (var i = 1, l = node.ifConditions.length; i < l; i++) {
|
10754 | markStaticRoots(node.ifConditions[i].block, isInFor);
|
10755 | }
|
10756 | }
|
10757 | }
|
10758 | }
|
10759 | function isStatic(node) {
|
10760 | if (node.type === 2) {
|
10761 |
|
10762 | return false;
|
10763 | }
|
10764 | if (node.type === 3) {
|
10765 |
|
10766 | return true;
|
10767 | }
|
10768 | return !!(node.pre ||
|
10769 | (!node.hasBindings &&
|
10770 | !node.if &&
|
10771 | !node.for &&
|
10772 | !isBuiltInTag(node.tag) &&
|
10773 | isPlatformReservedTag(node.tag) &&
|
10774 | !isDirectChildOfTemplateFor(node) &&
|
10775 | Object.keys(node).every(isStaticKey)));
|
10776 | }
|
10777 | function isDirectChildOfTemplateFor(node) {
|
10778 | while (node.parent) {
|
10779 | node = node.parent;
|
10780 | if (node.tag !== 'template') {
|
10781 | return false;
|
10782 | }
|
10783 | if (node.for) {
|
10784 | return true;
|
10785 | }
|
10786 | }
|
10787 | return false;
|
10788 | }
|
10789 |
|
10790 | var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
|
10791 | var fnInvokeRE = /\([^)]*?\);*$/;
|
10792 | var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10793 |
|
10794 | var keyCodes = {
|
10795 | esc: 27,
|
10796 | tab: 9,
|
10797 | enter: 13,
|
10798 | space: 32,
|
10799 | up: 38,
|
10800 | left: 37,
|
10801 | right: 39,
|
10802 | down: 40,
|
10803 | delete: [8, 46]
|
10804 | };
|
10805 |
|
10806 | var keyNames = {
|
10807 |
|
10808 | esc: ['Esc', 'Escape'],
|
10809 | tab: 'Tab',
|
10810 | enter: 'Enter',
|
10811 |
|
10812 | space: [' ', 'Spacebar'],
|
10813 |
|
10814 | up: ['Up', 'ArrowUp'],
|
10815 | left: ['Left', 'ArrowLeft'],
|
10816 | right: ['Right', 'ArrowRight'],
|
10817 | down: ['Down', 'ArrowDown'],
|
10818 |
|
10819 | delete: ['Backspace', 'Delete', 'Del']
|
10820 | };
|
10821 |
|
10822 |
|
10823 |
|
10824 | var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
|
10825 | var modifierCode = {
|
10826 | stop: '$event.stopPropagation();',
|
10827 | prevent: '$event.preventDefault();',
|
10828 | self: genGuard("$event.target !== $event.currentTarget"),
|
10829 | ctrl: genGuard("!$event.ctrlKey"),
|
10830 | shift: genGuard("!$event.shiftKey"),
|
10831 | alt: genGuard("!$event.altKey"),
|
10832 | meta: genGuard("!$event.metaKey"),
|
10833 | left: genGuard("'button' in $event && $event.button !== 0"),
|
10834 | middle: genGuard("'button' in $event && $event.button !== 1"),
|
10835 | right: genGuard("'button' in $event && $event.button !== 2")
|
10836 | };
|
10837 | function genHandlers(events, isNative) {
|
10838 | var prefix = isNative ? 'nativeOn:' : 'on:';
|
10839 | var staticHandlers = "";
|
10840 | var dynamicHandlers = "";
|
10841 | for (var name_1 in events) {
|
10842 | var handlerCode = genHandler(events[name_1]);
|
10843 |
|
10844 | if (events[name_1] && events[name_1].dynamic) {
|
10845 | dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
|
10846 | }
|
10847 | else {
|
10848 | staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
|
10849 | }
|
10850 | }
|
10851 | staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
|
10852 | if (dynamicHandlers) {
|
10853 | return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
|
10854 | }
|
10855 | else {
|
10856 | return prefix + staticHandlers;
|
10857 | }
|
10858 | }
|
10859 | function genHandler(handler) {
|
10860 | if (!handler) {
|
10861 | return 'function(){}';
|
10862 | }
|
10863 | if (Array.isArray(handler)) {
|
10864 | return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
|
10865 | }
|
10866 | var isMethodPath = simplePathRE.test(handler.value);
|
10867 | var isFunctionExpression = fnExpRE.test(handler.value);
|
10868 | var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10869 | if (!handler.modifiers) {
|
10870 | if (isMethodPath || isFunctionExpression) {
|
10871 | return handler.value;
|
10872 | }
|
10873 | return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}");
|
10874 | }
|
10875 | else {
|
10876 | var code = '';
|
10877 | var genModifierCode = '';
|
10878 | var keys = [];
|
10879 | var _loop_1 = function (key) {
|
10880 | if (modifierCode[key]) {
|
10881 | genModifierCode += modifierCode[key];
|
10882 |
|
10883 | if (keyCodes[key]) {
|
10884 | keys.push(key);
|
10885 | }
|
10886 | }
|
10887 | else if (key === 'exact') {
|
10888 | var modifiers_1 = handler.modifiers;
|
10889 | genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
|
10890 | .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
|
10891 | .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
|
10892 | .join('||'));
|
10893 | }
|
10894 | else {
|
10895 | keys.push(key);
|
10896 | }
|
10897 | };
|
10898 | for (var key in handler.modifiers) {
|
10899 | _loop_1(key);
|
10900 | }
|
10901 | if (keys.length) {
|
10902 | code += genKeyFilter(keys);
|
10903 | }
|
10904 |
|
10905 | if (genModifierCode) {
|
10906 | code += genModifierCode;
|
10907 | }
|
10908 | var handlerCode = isMethodPath
|
10909 | ? "return ".concat(handler.value, ".apply(null, arguments)")
|
10910 | : isFunctionExpression
|
10911 | ? "return (".concat(handler.value, ").apply(null, arguments)")
|
10912 | : isFunctionInvocation
|
10913 | ? "return ".concat(handler.value)
|
10914 | : handler.value;
|
10915 | return "function($event){".concat(code).concat(handlerCode, "}");
|
10916 | }
|
10917 | }
|
10918 | function genKeyFilter(keys) {
|
10919 | return (
|
10920 |
|
10921 |
|
10922 |
|
10923 | "if(!$event.type.indexOf('key')&&" +
|
10924 | "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
|
10925 | }
|
10926 | function genFilterCode(key) {
|
10927 | var keyVal = parseInt(key, 10);
|
10928 | if (keyVal) {
|
10929 | return "$event.keyCode!==".concat(keyVal);
|
10930 | }
|
10931 | var keyCode = keyCodes[key];
|
10932 | var keyName = keyNames[key];
|
10933 | return ("_k($event.keyCode," +
|
10934 | "".concat(JSON.stringify(key), ",") +
|
10935 | "".concat(JSON.stringify(keyCode), ",") +
|
10936 | "$event.key," +
|
10937 | "".concat(JSON.stringify(keyName)) +
|
10938 | ")");
|
10939 | }
|
10940 |
|
10941 | function on(el, dir) {
|
10942 | if (dir.modifiers) {
|
10943 | warn$2("v-on without argument does not support modifiers.");
|
10944 | }
|
10945 | el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
|
10946 | }
|
10947 |
|
10948 | function bind(el, dir) {
|
10949 | el.wrapData = function (code) {
|
10950 | return "_b(".concat(code, ",'").concat(el.tag, "',").concat(dir.value, ",").concat(dir.modifiers && dir.modifiers.prop ? 'true' : 'false').concat(dir.modifiers && dir.modifiers.sync ? ',true' : '', ")");
|
10951 | };
|
10952 | }
|
10953 |
|
10954 | var baseDirectives = {
|
10955 | on: on,
|
10956 | bind: bind,
|
10957 | cloak: noop
|
10958 | };
|
10959 |
|
10960 | var CodegenState = (function () {
|
10961 | function CodegenState(options) {
|
10962 | this.options = options;
|
10963 | this.warn = options.warn || baseWarn;
|
10964 | this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10965 | this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10966 | this.directives = extend(extend({}, baseDirectives), options.directives);
|
10967 | var isReservedTag = options.isReservedTag || no;
|
10968 | this.maybeComponent = function (el) {
|
10969 | return !!el.component || !isReservedTag(el.tag);
|
10970 | };
|
10971 | this.onceId = 0;
|
10972 | this.staticRenderFns = [];
|
10973 | this.pre = false;
|
10974 | }
|
10975 | return CodegenState;
|
10976 | }());
|
10977 | function generate(ast, options) {
|
10978 | var state = new CodegenState(options);
|
10979 |
|
10980 | var code = ast
|
10981 | ? ast.tag === 'script'
|
10982 | ? 'null'
|
10983 | : genElement(ast, state)
|
10984 | : '_c("div")';
|
10985 | return {
|
10986 | render: "with(this){return ".concat(code, "}"),
|
10987 | staticRenderFns: state.staticRenderFns
|
10988 | };
|
10989 | }
|
10990 | function genElement(el, state) {
|
10991 | if (el.parent) {
|
10992 | el.pre = el.pre || el.parent.pre;
|
10993 | }
|
10994 | if (el.staticRoot && !el.staticProcessed) {
|
10995 | return genStatic(el, state);
|
10996 | }
|
10997 | else if (el.once && !el.onceProcessed) {
|
10998 | return genOnce(el, state);
|
10999 | }
|
11000 | else if (el.for && !el.forProcessed) {
|
11001 | return genFor(el, state);
|
11002 | }
|
11003 | else if (el.if && !el.ifProcessed) {
|
11004 | return genIf(el, state);
|
11005 | }
|
11006 | else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
11007 | return genChildren(el, state) || 'void 0';
|
11008 | }
|
11009 | else if (el.tag === 'slot') {
|
11010 | return genSlot(el, state);
|
11011 | }
|
11012 | else {
|
11013 |
|
11014 | var code = void 0;
|
11015 | if (el.component) {
|
11016 | code = genComponent(el.component, el, state);
|
11017 | }
|
11018 | else {
|
11019 | var data = void 0;
|
11020 | var maybeComponent = state.maybeComponent(el);
|
11021 | if (!el.plain || (el.pre && maybeComponent)) {
|
11022 | data = genData(el, state);
|
11023 | }
|
11024 | var tag
|
11025 |
|
11026 | = void 0;
|
11027 |
|
11028 | var bindings = state.options.bindings;
|
11029 | if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
11030 | tag = checkBindingType(bindings, el.tag);
|
11031 | }
|
11032 | if (!tag)
|
11033 | tag = "'".concat(el.tag, "'");
|
11034 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11035 | code = "_c(".concat(tag).concat(data ? ",".concat(data) : ''
|
11036 | ).concat(children ? ",".concat(children) : ''
|
11037 | , ")");
|
11038 | }
|
11039 |
|
11040 | for (var i = 0; i < state.transforms.length; i++) {
|
11041 | code = state.transforms[i](el, code);
|
11042 | }
|
11043 | return code;
|
11044 | }
|
11045 | }
|
11046 | function checkBindingType(bindings, key) {
|
11047 | var camelName = camelize(key);
|
11048 | var PascalName = capitalize(camelName);
|
11049 | var checkType = function (type) {
|
11050 | if (bindings[key] === type) {
|
11051 | return key;
|
11052 | }
|
11053 | if (bindings[camelName] === type) {
|
11054 | return camelName;
|
11055 | }
|
11056 | if (bindings[PascalName] === type) {
|
11057 | return PascalName;
|
11058 | }
|
11059 | };
|
11060 | var fromConst = checkType("setup-const" ) ||
|
11061 | checkType("setup-reactive-const" );
|
11062 | if (fromConst) {
|
11063 | return fromConst;
|
11064 | }
|
11065 | var fromMaybeRef = checkType("setup-let" ) ||
|
11066 | checkType("setup-ref" ) ||
|
11067 | checkType("setup-maybe-ref" );
|
11068 | if (fromMaybeRef) {
|
11069 | return fromMaybeRef;
|
11070 | }
|
11071 | }
|
11072 |
|
11073 | function genStatic(el, state) {
|
11074 | el.staticProcessed = true;
|
11075 |
|
11076 |
|
11077 |
|
11078 | var originalPreState = state.pre;
|
11079 | if (el.pre) {
|
11080 | state.pre = el.pre;
|
11081 | }
|
11082 | state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
|
11083 | state.pre = originalPreState;
|
11084 | return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
|
11085 | }
|
11086 |
|
11087 | function genOnce(el, state) {
|
11088 | el.onceProcessed = true;
|
11089 | if (el.if && !el.ifProcessed) {
|
11090 | return genIf(el, state);
|
11091 | }
|
11092 | else if (el.staticInFor) {
|
11093 | var key = '';
|
11094 | var parent_1 = el.parent;
|
11095 | while (parent_1) {
|
11096 | if (parent_1.for) {
|
11097 | key = parent_1.key;
|
11098 | break;
|
11099 | }
|
11100 | parent_1 = parent_1.parent;
|
11101 | }
|
11102 | if (!key) {
|
11103 | state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
|
11104 | return genElement(el, state);
|
11105 | }
|
11106 | return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
|
11107 | }
|
11108 | else {
|
11109 | return genStatic(el, state);
|
11110 | }
|
11111 | }
|
11112 | function genIf(el, state, altGen, altEmpty) {
|
11113 | el.ifProcessed = true;
|
11114 | return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
|
11115 | }
|
11116 | function genIfConditions(conditions, state, altGen, altEmpty) {
|
11117 | if (!conditions.length) {
|
11118 | return altEmpty || '_e()';
|
11119 | }
|
11120 | var condition = conditions.shift();
|
11121 | if (condition.exp) {
|
11122 | return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
|
11123 | }
|
11124 | else {
|
11125 | return "".concat(genTernaryExp(condition.block));
|
11126 | }
|
11127 |
|
11128 | function genTernaryExp(el) {
|
11129 | return altGen
|
11130 | ? altGen(el, state)
|
11131 | : el.once
|
11132 | ? genOnce(el, state)
|
11133 | : genElement(el, state);
|
11134 | }
|
11135 | }
|
11136 | function genFor(el, state, altGen, altHelper) {
|
11137 | var exp = el.for;
|
11138 | var alias = el.alias;
|
11139 | var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
|
11140 | var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
|
11141 | if (state.maybeComponent(el) &&
|
11142 | el.tag !== 'slot' &&
|
11143 | el.tag !== 'template' &&
|
11144 | !el.key) {
|
11145 | state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
|
11146 | "v-for should have explicit keys. " +
|
11147 | "See https://v2.vuejs.org/v2/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true );
|
11148 | }
|
11149 | el.forProcessed = true;
|
11150 | return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
|
11151 | "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
|
11152 | "return ".concat((altGen || genElement)(el, state)) +
|
11153 | '})');
|
11154 | }
|
11155 | function genData(el, state) {
|
11156 | var data = '{';
|
11157 |
|
11158 |
|
11159 | var dirs = genDirectives(el, state);
|
11160 | if (dirs)
|
11161 | data += dirs + ',';
|
11162 |
|
11163 | if (el.key) {
|
11164 | data += "key:".concat(el.key, ",");
|
11165 | }
|
11166 |
|
11167 | if (el.ref) {
|
11168 | data += "ref:".concat(el.ref, ",");
|
11169 | }
|
11170 | if (el.refInFor) {
|
11171 | data += "refInFor:true,";
|
11172 | }
|
11173 |
|
11174 | if (el.pre) {
|
11175 | data += "pre:true,";
|
11176 | }
|
11177 |
|
11178 | if (el.component) {
|
11179 | data += "tag:\"".concat(el.tag, "\",");
|
11180 | }
|
11181 |
|
11182 | for (var i = 0; i < state.dataGenFns.length; i++) {
|
11183 | data += state.dataGenFns[i](el);
|
11184 | }
|
11185 |
|
11186 | if (el.attrs) {
|
11187 | data += "attrs:".concat(genProps(el.attrs), ",");
|
11188 | }
|
11189 |
|
11190 | if (el.props) {
|
11191 | data += "domProps:".concat(genProps(el.props), ",");
|
11192 | }
|
11193 |
|
11194 | if (el.events) {
|
11195 | data += "".concat(genHandlers(el.events, false), ",");
|
11196 | }
|
11197 | if (el.nativeEvents) {
|
11198 | data += "".concat(genHandlers(el.nativeEvents, true), ",");
|
11199 | }
|
11200 |
|
11201 |
|
11202 | if (el.slotTarget && !el.slotScope) {
|
11203 | data += "slot:".concat(el.slotTarget, ",");
|
11204 | }
|
11205 |
|
11206 | if (el.scopedSlots) {
|
11207 | data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
|
11208 | }
|
11209 |
|
11210 | if (el.model) {
|
11211 | data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
|
11212 | }
|
11213 |
|
11214 | if (el.inlineTemplate) {
|
11215 | var inlineTemplate = genInlineTemplate(el, state);
|
11216 | if (inlineTemplate) {
|
11217 | data += "".concat(inlineTemplate, ",");
|
11218 | }
|
11219 | }
|
11220 | data = data.replace(/,$/, '') + '}';
|
11221 |
|
11222 |
|
11223 |
|
11224 | if (el.dynamicAttrs) {
|
11225 | data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
|
11226 | }
|
11227 |
|
11228 | if (el.wrapData) {
|
11229 | data = el.wrapData(data);
|
11230 | }
|
11231 |
|
11232 | if (el.wrapListeners) {
|
11233 | data = el.wrapListeners(data);
|
11234 | }
|
11235 | return data;
|
11236 | }
|
11237 | function genDirectives(el, state) {
|
11238 | var dirs = el.directives;
|
11239 | if (!dirs)
|
11240 | return;
|
11241 | var res = 'directives:[';
|
11242 | var hasRuntime = false;
|
11243 | var i, l, dir, needRuntime;
|
11244 | for (i = 0, l = dirs.length; i < l; i++) {
|
11245 | dir = dirs[i];
|
11246 | needRuntime = true;
|
11247 | var gen = state.directives[dir.name];
|
11248 | if (gen) {
|
11249 |
|
11250 |
|
11251 | needRuntime = !!gen(el, dir, state.warn);
|
11252 | }
|
11253 | if (needRuntime) {
|
11254 | hasRuntime = true;
|
11255 | res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
|
11256 | ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
|
11257 | : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
|
11258 | }
|
11259 | }
|
11260 | if (hasRuntime) {
|
11261 | return res.slice(0, -1) + ']';
|
11262 | }
|
11263 | }
|
11264 | function genInlineTemplate(el, state) {
|
11265 | var ast = el.children[0];
|
11266 | if ((el.children.length !== 1 || ast.type !== 1)) {
|
11267 | state.warn('Inline-template components must have exactly one child element.', { start: el.start });
|
11268 | }
|
11269 | if (ast && ast.type === 1) {
|
11270 | var inlineRenderFns = generate(ast, state.options);
|
11271 | return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
|
11272 | .map(function (code) { return "function(){".concat(code, "}"); })
|
11273 | .join(','), "]}");
|
11274 | }
|
11275 | }
|
11276 | function genScopedSlots(el, slots, state) {
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 | var needsForceUpdate = el.for ||
|
11282 | Object.keys(slots).some(function (key) {
|
11283 | var slot = slots[key];
|
11284 | return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot)
|
11285 | );
|
11286 | });
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 | var needsKey = !!el.if;
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 | if (!needsForceUpdate) {
|
11298 | var parent_2 = el.parent;
|
11299 | while (parent_2) {
|
11300 | if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
|
11301 | parent_2.for) {
|
11302 | needsForceUpdate = true;
|
11303 | break;
|
11304 | }
|
11305 | if (parent_2.if) {
|
11306 | needsKey = true;
|
11307 | }
|
11308 | parent_2 = parent_2.parent;
|
11309 | }
|
11310 | }
|
11311 | var generatedSlots = Object.keys(slots)
|
11312 | .map(function (key) { return genScopedSlot(slots[key], state); })
|
11313 | .join(',');
|
11314 | return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
|
11315 | }
|
11316 | function hash(str) {
|
11317 | var hash = 5381;
|
11318 | var i = str.length;
|
11319 | while (i) {
|
11320 | hash = (hash * 33) ^ str.charCodeAt(--i);
|
11321 | }
|
11322 | return hash >>> 0;
|
11323 | }
|
11324 | function containsSlotChild(el) {
|
11325 | if (el.type === 1) {
|
11326 | if (el.tag === 'slot') {
|
11327 | return true;
|
11328 | }
|
11329 | return el.children.some(containsSlotChild);
|
11330 | }
|
11331 | return false;
|
11332 | }
|
11333 | function genScopedSlot(el, state) {
|
11334 | var isLegacySyntax = el.attrsMap['slot-scope'];
|
11335 | if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
11336 | return genIf(el, state, genScopedSlot, "null");
|
11337 | }
|
11338 | if (el.for && !el.forProcessed) {
|
11339 | return genFor(el, state, genScopedSlot);
|
11340 | }
|
11341 | var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
|
11342 | var fn = "function(".concat(slotScope, "){") +
|
11343 | "return ".concat(el.tag === 'template'
|
11344 | ? el.if && isLegacySyntax
|
11345 | ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
|
11346 | : genChildren(el, state) || 'undefined'
|
11347 | : genElement(el, state), "}");
|
11348 |
|
11349 | var reverseProxy = slotScope ? "" : ",proxy:true";
|
11350 | return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
|
11351 | }
|
11352 | function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
|
11353 | var children = el.children;
|
11354 | if (children.length) {
|
11355 | var el_1 = children[0];
|
11356 |
|
11357 | if (children.length === 1 &&
|
11358 | el_1.for &&
|
11359 | el_1.tag !== 'template' &&
|
11360 | el_1.tag !== 'slot') {
|
11361 | var normalizationType_1 = checkSkip
|
11362 | ? state.maybeComponent(el_1)
|
11363 | ? ",1"
|
11364 | : ",0"
|
11365 | : "";
|
11366 | return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
|
11367 | }
|
11368 | var normalizationType = checkSkip
|
11369 | ? getNormalizationType(children, state.maybeComponent)
|
11370 | : 0;
|
11371 | var gen_1 = altGenNode || genNode;
|
11372 | return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
|
11373 | }
|
11374 | }
|
11375 |
|
11376 |
|
11377 |
|
11378 |
|
11379 | function getNormalizationType(children, maybeComponent) {
|
11380 | var res = 0;
|
11381 | for (var i = 0; i < children.length; i++) {
|
11382 | var el = children[i];
|
11383 | if (el.type !== 1) {
|
11384 | continue;
|
11385 | }
|
11386 | if (needsNormalization(el) ||
|
11387 | (el.ifConditions &&
|
11388 | el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11389 | res = 2;
|
11390 | break;
|
11391 | }
|
11392 | if (maybeComponent(el) ||
|
11393 | (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11394 | res = 1;
|
11395 | }
|
11396 | }
|
11397 | return res;
|
11398 | }
|
11399 | function needsNormalization(el) {
|
11400 | return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
|
11401 | }
|
11402 | function genNode(node, state) {
|
11403 | if (node.type === 1) {
|
11404 | return genElement(node, state);
|
11405 | }
|
11406 | else if (node.type === 3 && node.isComment) {
|
11407 | return genComment(node);
|
11408 | }
|
11409 | else {
|
11410 | return genText(node);
|
11411 | }
|
11412 | }
|
11413 | function genText(text) {
|
11414 | return "_v(".concat(text.type === 2
|
11415 | ? text.expression
|
11416 | : transformSpecialNewlines(JSON.stringify(text.text)), ")");
|
11417 | }
|
11418 | function genComment(comment) {
|
11419 | return "_e(".concat(JSON.stringify(comment.text), ")");
|
11420 | }
|
11421 | function genSlot(el, state) {
|
11422 | var slotName = el.slotName || '"default"';
|
11423 | var children = genChildren(el, state);
|
11424 | var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
|
11425 | var attrs = el.attrs || el.dynamicAttrs
|
11426 | ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
11427 |
|
11428 | name: camelize(attr.name),
|
11429 | value: attr.value,
|
11430 | dynamic: attr.dynamic
|
11431 | }); }))
|
11432 | : null;
|
11433 | var bind = el.attrsMap['v-bind'];
|
11434 | if ((attrs || bind) && !children) {
|
11435 | res += ",null";
|
11436 | }
|
11437 | if (attrs) {
|
11438 | res += ",".concat(attrs);
|
11439 | }
|
11440 | if (bind) {
|
11441 | res += "".concat(attrs ? '' : ',null', ",").concat(bind);
|
11442 | }
|
11443 | return res + ')';
|
11444 | }
|
11445 |
|
11446 | function genComponent(componentName, el, state) {
|
11447 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11448 | return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
|
11449 | }
|
11450 | function genProps(props) {
|
11451 | var staticProps = "";
|
11452 | var dynamicProps = "";
|
11453 | for (var i = 0; i < props.length; i++) {
|
11454 | var prop = props[i];
|
11455 | var value = transformSpecialNewlines(prop.value);
|
11456 | if (prop.dynamic) {
|
11457 | dynamicProps += "".concat(prop.name, ",").concat(value, ",");
|
11458 | }
|
11459 | else {
|
11460 | staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
|
11461 | }
|
11462 | }
|
11463 | staticProps = "{".concat(staticProps.slice(0, -1), "}");
|
11464 | if (dynamicProps) {
|
11465 | return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
|
11466 | }
|
11467 | else {
|
11468 | return staticProps;
|
11469 | }
|
11470 | }
|
11471 |
|
11472 | function transformSpecialNewlines(text) {
|
11473 | return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
11474 | }
|
11475 |
|
11476 |
|
11477 |
|
11478 | var prohibitedKeywordRE = new RegExp('\\b' +
|
11479 | ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11480 | 'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11481 | 'extends,finally,continue,debugger,function,arguments')
|
11482 | .split(',')
|
11483 | .join('\\b|\\b') +
|
11484 | '\\b');
|
11485 |
|
11486 | var unaryOperatorsRE = new RegExp('\\b' +
|
11487 | 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
|
11488 | '\\s*\\([^\\)]*\\)');
|
11489 |
|
11490 | var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11491 |
|
11492 | function detectErrors(ast, warn) {
|
11493 | if (ast) {
|
11494 | checkNode(ast, warn);
|
11495 | }
|
11496 | }
|
11497 | function checkNode(node, warn) {
|
11498 | if (node.type === 1) {
|
11499 | for (var name_1 in node.attrsMap) {
|
11500 | if (dirRE.test(name_1)) {
|
11501 | var value = node.attrsMap[name_1];
|
11502 | if (value) {
|
11503 | var range = node.rawAttrsMap[name_1];
|
11504 | if (name_1 === 'v-for') {
|
11505 | checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
|
11506 | }
|
11507 | else if (name_1 === 'v-slot' || name_1[0] === '#') {
|
11508 | checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
|
11509 | }
|
11510 | else if (onRE.test(name_1)) {
|
11511 | checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
|
11512 | }
|
11513 | else {
|
11514 | checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
|
11515 | }
|
11516 | }
|
11517 | }
|
11518 | }
|
11519 | if (node.children) {
|
11520 | for (var i = 0; i < node.children.length; i++) {
|
11521 | checkNode(node.children[i], warn);
|
11522 | }
|
11523 | }
|
11524 | }
|
11525 | else if (node.type === 2) {
|
11526 | checkExpression(node.expression, node.text, warn, node);
|
11527 | }
|
11528 | }
|
11529 | function checkEvent(exp, text, warn, range) {
|
11530 | var stripped = exp.replace(stripStringRE, '');
|
11531 | var keywordMatch = stripped.match(unaryOperatorsRE);
|
11532 | if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
|
11533 | warn("avoid using JavaScript unary operator as property name: " +
|
11534 | "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
|
11535 | }
|
11536 | checkExpression(exp, text, warn, range);
|
11537 | }
|
11538 | function checkFor(node, text, warn, range) {
|
11539 | checkExpression(node.for || '', text, warn, range);
|
11540 | checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11541 | checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11542 | checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11543 | }
|
11544 | function checkIdentifier(ident, type, text, warn, range) {
|
11545 | if (typeof ident === 'string') {
|
11546 | try {
|
11547 | new Function("var ".concat(ident, "=_"));
|
11548 | }
|
11549 | catch (e) {
|
11550 | warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
|
11551 | }
|
11552 | }
|
11553 | }
|
11554 | function checkExpression(exp, text, warn, range) {
|
11555 | try {
|
11556 | new Function("return ".concat(exp));
|
11557 | }
|
11558 | catch (e) {
|
11559 | var keywordMatch = exp
|
11560 | .replace(stripStringRE, '')
|
11561 | .match(prohibitedKeywordRE);
|
11562 | if (keywordMatch) {
|
11563 | warn("avoid using JavaScript keyword as property name: " +
|
11564 | "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
|
11565 | }
|
11566 | else {
|
11567 | warn("invalid expression: ".concat(e.message, " in\n\n") +
|
11568 | " ".concat(exp, "\n\n") +
|
11569 | " Raw expression: ".concat(text.trim(), "\n"), range);
|
11570 | }
|
11571 | }
|
11572 | }
|
11573 | function checkFunctionParameterExpression(exp, text, warn, range) {
|
11574 | try {
|
11575 | new Function(exp, '');
|
11576 | }
|
11577 | catch (e) {
|
11578 | warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
|
11579 | " ".concat(exp, "\n\n") +
|
11580 | " Raw expression: ".concat(text.trim(), "\n"), range);
|
11581 | }
|
11582 | }
|
11583 |
|
11584 | var range = 2;
|
11585 | function generateCodeFrame(source, start, end) {
|
11586 | if (start === void 0) { start = 0; }
|
11587 | if (end === void 0) { end = source.length; }
|
11588 | var lines = source.split(/\r?\n/);
|
11589 | var count = 0;
|
11590 | var res = [];
|
11591 | for (var i = 0; i < lines.length; i++) {
|
11592 | count += lines[i].length + 1;
|
11593 | if (count >= start) {
|
11594 | for (var j = i - range; j <= i + range || end > count; j++) {
|
11595 | if (j < 0 || j >= lines.length)
|
11596 | continue;
|
11597 | res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
|
11598 | var lineLength = lines[j].length;
|
11599 | if (j === i) {
|
11600 |
|
11601 | var pad = start - (count - lineLength) + 1;
|
11602 | var length_1 = end > count ? lineLength - pad : end - start;
|
11603 | res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
|
11604 | }
|
11605 | else if (j > i) {
|
11606 | if (end > count) {
|
11607 | var length_2 = Math.min(end - count, lineLength);
|
11608 | res.push(" | " + repeat("^", length_2));
|
11609 | }
|
11610 | count += lineLength + 1;
|
11611 | }
|
11612 | }
|
11613 | break;
|
11614 | }
|
11615 | }
|
11616 | return res.join('\n');
|
11617 | }
|
11618 | function repeat(str, n) {
|
11619 | var result = '';
|
11620 | if (n > 0) {
|
11621 |
|
11622 | while (true) {
|
11623 |
|
11624 | if (n & 1)
|
11625 | result += str;
|
11626 | n >>>= 1;
|
11627 | if (n <= 0)
|
11628 | break;
|
11629 | str += str;
|
11630 | }
|
11631 | }
|
11632 | return result;
|
11633 | }
|
11634 |
|
11635 | function createFunction(code, errors) {
|
11636 | try {
|
11637 | return new Function(code);
|
11638 | }
|
11639 | catch (err) {
|
11640 | errors.push({ err: err, code: code });
|
11641 | return noop;
|
11642 | }
|
11643 | }
|
11644 | function createCompileToFunctionFn(compile) {
|
11645 | var cache = Object.create(null);
|
11646 | return function compileToFunctions(template, options, vm) {
|
11647 | options = extend({}, options);
|
11648 | var warn = options.warn || warn$2;
|
11649 | delete options.warn;
|
11650 |
|
11651 | {
|
11652 |
|
11653 | try {
|
11654 | new Function('return 1');
|
11655 | }
|
11656 | catch (e) {
|
11657 | if (e.toString().match(/unsafe-eval|CSP/)) {
|
11658 | warn('It seems you are using the standalone build of Vue.js in an ' +
|
11659 | 'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11660 | 'The template compiler cannot work in this environment. Consider ' +
|
11661 | 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11662 | 'templates into render functions.');
|
11663 | }
|
11664 | }
|
11665 | }
|
11666 |
|
11667 | var key = options.delimiters
|
11668 | ? String(options.delimiters) + template
|
11669 | : template;
|
11670 | if (cache[key]) {
|
11671 | return cache[key];
|
11672 | }
|
11673 |
|
11674 | var compiled = compile(template, options);
|
11675 |
|
11676 | {
|
11677 | if (compiled.errors && compiled.errors.length) {
|
11678 | if (options.outputSourceRange) {
|
11679 | compiled.errors.forEach(function (e) {
|
11680 | warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
|
11681 | generateCodeFrame(template, e.start, e.end), vm);
|
11682 | });
|
11683 | }
|
11684 | else {
|
11685 | warn("Error compiling template:\n\n".concat(template, "\n\n") +
|
11686 | compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
|
11687 | '\n', vm);
|
11688 | }
|
11689 | }
|
11690 | if (compiled.tips && compiled.tips.length) {
|
11691 | if (options.outputSourceRange) {
|
11692 | compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11693 | }
|
11694 | else {
|
11695 | compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11696 | }
|
11697 | }
|
11698 | }
|
11699 |
|
11700 | var res = {};
|
11701 | var fnGenErrors = [];
|
11702 | res.render = createFunction(compiled.render, fnGenErrors);
|
11703 | res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11704 | return createFunction(code, fnGenErrors);
|
11705 | });
|
11706 |
|
11707 |
|
11708 |
|
11709 |
|
11710 | {
|
11711 | if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11712 | warn("Failed to generate render function:\n\n" +
|
11713 | fnGenErrors
|
11714 | .map(function (_a) {
|
11715 | var err = _a.err, code = _a.code;
|
11716 | return "".concat(err.toString(), " in\n\n").concat(code, "\n");
|
11717 | })
|
11718 | .join('\n'), vm);
|
11719 | }
|
11720 | }
|
11721 | return (cache[key] = res);
|
11722 | };
|
11723 | }
|
11724 |
|
11725 | function createCompilerCreator(baseCompile) {
|
11726 | return function createCompiler(baseOptions) {
|
11727 | function compile(template, options) {
|
11728 | var finalOptions = Object.create(baseOptions);
|
11729 | var errors = [];
|
11730 | var tips = [];
|
11731 | var warn = function (msg, range, tip) {
|
11732 | (tip ? tips : errors).push(msg);
|
11733 | };
|
11734 | if (options) {
|
11735 | if (options.outputSourceRange) {
|
11736 |
|
11737 | var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
|
11738 | warn = function (msg, range, tip) {
|
11739 | var data = typeof msg === 'string' ? { msg: msg } : msg;
|
11740 | if (range) {
|
11741 | if (range.start != null) {
|
11742 | data.start = range.start + leadingSpaceLength_1;
|
11743 | }
|
11744 | if (range.end != null) {
|
11745 | data.end = range.end + leadingSpaceLength_1;
|
11746 | }
|
11747 | }
|
11748 | (tip ? tips : errors).push(data);
|
11749 | };
|
11750 | }
|
11751 |
|
11752 | if (options.modules) {
|
11753 | finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
|
11754 | }
|
11755 |
|
11756 | if (options.directives) {
|
11757 | finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
|
11758 | }
|
11759 |
|
11760 | for (var key in options) {
|
11761 | if (key !== 'modules' && key !== 'directives') {
|
11762 | finalOptions[key] = options[key];
|
11763 | }
|
11764 | }
|
11765 | }
|
11766 | finalOptions.warn = warn;
|
11767 | var compiled = baseCompile(template.trim(), finalOptions);
|
11768 | {
|
11769 | detectErrors(compiled.ast, warn);
|
11770 | }
|
11771 | compiled.errors = errors;
|
11772 | compiled.tips = tips;
|
11773 | return compiled;
|
11774 | }
|
11775 | return {
|
11776 | compile: compile,
|
11777 | compileToFunctions: createCompileToFunctionFn(compile)
|
11778 | };
|
11779 | };
|
11780 | }
|
11781 |
|
11782 |
|
11783 |
|
11784 |
|
11785 | var createCompiler = createCompilerCreator(function baseCompile(template, options) {
|
11786 | var ast = parse(template.trim(), options);
|
11787 | if (options.optimize !== false) {
|
11788 | optimize(ast, options);
|
11789 | }
|
11790 | var code = generate(ast, options);
|
11791 | return {
|
11792 | ast: ast,
|
11793 | render: code.render,
|
11794 | staticRenderFns: code.staticRenderFns
|
11795 | };
|
11796 | });
|
11797 |
|
11798 | var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
|
11799 |
|
11800 |
|
11801 | var div;
|
11802 | function getShouldDecode(href) {
|
11803 | div = div || document.createElement('div');
|
11804 | div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11805 | return div.innerHTML.indexOf(' ') > 0;
|
11806 | }
|
11807 |
|
11808 | var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11809 |
|
11810 | var shouldDecodeNewlinesForHref = inBrowser
|
11811 | ? getShouldDecode(true)
|
11812 | : false;
|
11813 |
|
11814 | var idToTemplate = cached(function (id) {
|
11815 | var el = query(id);
|
11816 | return el && el.innerHTML;
|
11817 | });
|
11818 | var mount = Vue.prototype.$mount;
|
11819 | Vue.prototype.$mount = function (el, hydrating) {
|
11820 | el = el && query(el);
|
11821 |
|
11822 | if (el === document.body || el === document.documentElement) {
|
11823 | warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
|
11824 | return this;
|
11825 | }
|
11826 | var options = this.$options;
|
11827 |
|
11828 | if (!options.render) {
|
11829 | var template = options.template;
|
11830 | if (template) {
|
11831 | if (typeof template === 'string') {
|
11832 | if (template.charAt(0) === '#') {
|
11833 | template = idToTemplate(template);
|
11834 |
|
11835 | if (!template) {
|
11836 | warn$2("Template element not found or is empty: ".concat(options.template), this);
|
11837 | }
|
11838 | }
|
11839 | }
|
11840 | else if (template.nodeType) {
|
11841 | template = template.innerHTML;
|
11842 | }
|
11843 | else {
|
11844 | {
|
11845 | warn$2('invalid template option:' + template, this);
|
11846 | }
|
11847 | return this;
|
11848 | }
|
11849 | }
|
11850 | else if (el) {
|
11851 |
|
11852 | template = getOuterHTML(el);
|
11853 | }
|
11854 | if (template) {
|
11855 |
|
11856 | if (config.performance && mark) {
|
11857 | mark('compile');
|
11858 | }
|
11859 | var _a = compileToFunctions(template, {
|
11860 | outputSourceRange: true,
|
11861 | shouldDecodeNewlines: shouldDecodeNewlines,
|
11862 | shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11863 | delimiters: options.delimiters,
|
11864 | comments: options.comments
|
11865 | }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
|
11866 | options.render = render;
|
11867 | options.staticRenderFns = staticRenderFns;
|
11868 |
|
11869 | if (config.performance && mark) {
|
11870 | mark('compile end');
|
11871 | measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
|
11872 | }
|
11873 | }
|
11874 | }
|
11875 | return mount.call(this, el, hydrating);
|
11876 | };
|
11877 | |
11878 |
|
11879 |
|
11880 |
|
11881 | function getOuterHTML(el) {
|
11882 | if (el.outerHTML) {
|
11883 | return el.outerHTML;
|
11884 | }
|
11885 | else {
|
11886 | var container = document.createElement('div');
|
11887 | container.appendChild(el.cloneNode(true));
|
11888 | return container.innerHTML;
|
11889 | }
|
11890 | }
|
11891 | Vue.compile = compileToFunctions;
|
11892 |
|
11893 |
|
11894 | |
11895 |
|
11896 |
|
11897 |
|
11898 | function effect(fn, scheduler) {
|
11899 | var watcher = new Watcher(currentInstance, fn, noop, {
|
11900 | sync: true
|
11901 | });
|
11902 | if (scheduler) {
|
11903 | watcher.update = function () {
|
11904 | scheduler(function () { return watcher.run(); });
|
11905 | };
|
11906 | }
|
11907 | }
|
11908 |
|
11909 | extend(Vue, vca);
|
11910 | Vue.effect = effect;
|
11911 |
|
11912 | return Vue;
|
11913 |
|
11914 | }));
|