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